Re: [PATCH] trm290: do hook dma_host_{on,off} methods (take 2)

2007-12-28 Thread Sergei Shtylyov

Hello.

Bartlomiej Zolnierkiewicz wrote:


Using default methods caused the chip's DMA PRD count registers, inadvertently
starting DMA!  While fixing it, also do:



nasty, this could possibly explain the following trm290.c hack:


   Frankly speaking, I'm not sure it's that destructive: the register in 
question is accessed by inw()/outw() while the genric code would only spoil 
it by inb(). So, I don't know if this would be access to the same register as
outw() does (that write starts DMA, and it is a number of 32-bit words in PRD 
table - 1). Actually, the PRD address is loaded by 32-bit write at address 2 
bytes below the one in question, and so overlaps our register -- the chip must 
be looking at byte enables when deciding what register is addressed).



...
#if 0 /* play it safe for now */

  IDE_HFLAG_TRUST_BIOS_FOR_DMA |

#endif
...



- get rid of the 'ide_' prefixes in several functions for which the prefix in
 the method's name has been 'ide_' ectomized already;



- align the code hooking the IDE DMA methods in init_hwif_trm290()...



---
Fixed the header, added 'static' to the new method definitions.
The patch is against Linus' kernel tree...



Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED]



applied


   The next patch is cooking... :-)

WBR, Sergei
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] trm290: do hook dma_host_{on,off} methods (take 2)

2007-12-27 Thread Sergei Shtylyov
Using default methods caused the chip's DMA PRD count registers, inadvertently
starting DMA!  While fixing it, also do:

- get rid of the 'ide_' prefixes in several functions for which the prefix in
  the method's name has been 'ide_' ectomized already;

- align the code hooking the IDE DMA methods in init_hwif_trm290()...

---
Fixed the header, added 'static' to the new method definitions.
The patch is against Linus' kernel tree...

Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED]

 drivers/ide/pci/trm290.c |   29 -
 1 files changed, 20 insertions(+), 9 deletions(-)

Index: linux-2.6/drivers/ide/pci/trm290.c
===
--- linux-2.6.orig/drivers/ide/pci/trm290.c
+++ linux-2.6/drivers/ide/pci/trm290.c
@@ -1,7 +1,8 @@
 /*
- *  linux/drivers/ide/pci/trm290.c Version 1.02Mar. 18, 2000
+ *  linux/drivers/ide/pci/trm290.c Version 1.05Dec. 26, 2007
  *
  *  Copyright (c) 1997-1998  Mark Lord
+ *  Copyright (c) 2007   MontaVista Software, Inc. [EMAIL PROTECTED]
  *  May be copied or modified under the terms of the GNU General Public License
  *
  *  June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive
trm290_prepare_drive(drive, drive-using_dma);
 }
 
-static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
+static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
BUG_ON(HWGROUP(drive)-handler != NULL);/* paranoia check */
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_
outb(command, IDE_COMMAND_REG);
 }
 
-static int trm290_ide_dma_setup(ide_drive_t *drive)
+static int trm290_dma_setup(ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
struct request *rq = hwif-hwgroup-rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_driv
return 0;
 }
 
-static void trm290_ide_dma_start(ide_drive_t *drive)
+static void trm290_dma_start(ide_drive_t *drive)
 {
 }
 
@@ -240,6 +241,14 @@ static int trm290_ide_dma_test_irq (ide_
return (status == 0x00ff);
 }
 
+static void trm290_dma_host_on(ide_drive_t *drive)
+{
+}
+
+static void trm290_dma_host_off(ide_drive_t *drive)
+{
+}
+
 static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 {
unsigned int cfgbase = 0;
@@ -280,11 +289,13 @@ static void __devinit init_hwif_trm290(i
 
ide_setup_dma(hwif, (hwif-config_data + 4) ^ (hwif-channel ? 0x0080 : 
0x), 3);
 
-   hwif-dma_setup = trm290_ide_dma_setup;
-   hwif-dma_exec_cmd = trm290_ide_dma_exec_cmd;
-   hwif-dma_start = trm290_ide_dma_start;
-   hwif-ide_dma_end = trm290_ide_dma_end;
-   hwif-ide_dma_test_irq = trm290_ide_dma_test_irq;
+   hwif-dma_host_off  = trm290_dma_host_off;
+   hwif-dma_host_on   = trm290_dma_host_on;
+   hwif-dma_setup = trm290_dma_setup;
+   hwif-dma_exec_cmd  = trm290_dma_exec_cmd;
+   hwif-dma_start = trm290_dma_start;
+   hwif-ide_dma_end   = trm290_ide_dma_end;
+   hwif-ide_dma_test_irq  = trm290_ide_dma_test_irq;
 
hwif-selectproc = trm290_selectproc;
 #if 1

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] trm290: do hook dma_host_{on,off} methods (take 2)

2007-12-27 Thread Bartlomiej Zolnierkiewicz
On Thursday 27 December 2007, Sergei Shtylyov wrote:
 Using default methods caused the chip's DMA PRD count registers, inadvertently
 starting DMA!  While fixing it, also do:

nasty, this could possibly explain the following trm290.c hack:

...
#if 0 /* play it safe for now */
  IDE_HFLAG_TRUST_BIOS_FOR_DMA |
#endif
...

 - get rid of the 'ide_' prefixes in several functions for which the prefix in
   the method's name has been 'ide_' ectomized already;
 
 - align the code hooking the IDE DMA methods in init_hwif_trm290()...
 
 ---
 Fixed the header, added 'static' to the new method definitions.
 The patch is against Linus' kernel tree...
 
 Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED]

applied
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] trm290: do hook dma_host_{on,off} methods

2007-12-26 Thread Sergei Shtylyov
Those two methods were reading/writing TRM-290 config. register; luckily (?)
the writes only tried to change undefined bits.  While fixing this, also

- get rid of the 'ide_' prefixes in several functions for which the prefix has
  been ectomized before;

- align the code initializing methods in init_hwif_trm290()...

Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED]

 drivers/ide/pci/trm290.c |   26 ++
 1 files changed, 18 insertions(+), 8 deletions(-)

Index: linux-2.6/drivers/ide/pci/trm290.c
===
--- linux-2.6.orig/drivers/ide/pci/trm290.c
+++ linux-2.6/drivers/ide/pci/trm290.c
@@ -177,7 +177,7 @@ static void trm290_selectproc (ide_drive
trm290_prepare_drive(drive, drive-using_dma);
 }
 
-static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
+static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
BUG_ON(HWGROUP(drive)-handler != NULL);/* paranoia check */
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +185,7 @@ static void trm290_ide_dma_exec_cmd(ide_
outb(command, IDE_COMMAND_REG);
 }
 
-static int trm290_ide_dma_setup(ide_drive_t *drive)
+static int trm290_dma_setup(ide_drive_t *drive)
 {
ide_hwif_t *hwif = drive-hwif;
struct request *rq = hwif-hwgroup-rq;
@@ -215,7 +215,7 @@ static int trm290_ide_dma_setup(ide_driv
return 0;
 }
 
-static void trm290_ide_dma_start(ide_drive_t *drive)
+static void trm290_dma_start(ide_drive_t *drive)
 {
 }
 
@@ -240,6 +240,14 @@ static int trm290_ide_dma_test_irq (ide_
return (status == 0x00ff);
 }
 
+void trm290_dma_host_on (ide_drive_t *drive)
+{
+}
+
+void trm290_dma_host_off(ide_drive_t *drive)
+{
+}
+
 static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 {
unsigned int cfgbase = 0;
@@ -280,11 +288,13 @@ static void __devinit init_hwif_trm290(i
 
ide_setup_dma(hwif, (hwif-config_data + 4) ^ (hwif-channel ? 0x0080 : 
0x), 3);
 
-   hwif-dma_setup = trm290_ide_dma_setup;
-   hwif-dma_exec_cmd = trm290_ide_dma_exec_cmd;
-   hwif-dma_start = trm290_ide_dma_start;
-   hwif-ide_dma_end = trm290_ide_dma_end;
-   hwif-ide_dma_test_irq = trm290_ide_dma_test_irq;
+   hwif-dma_host_off  = trm290_dma_host_off;
+   hwif-dma_host_on   = trm290_dma_host_on;
+   hwif-dma_setup = trm290_dma_setup;
+   hwif-dma_exec_cmd  = trm290_dma_exec_cmd;
+   hwif-dma_start = trm290_dma_start;
+   hwif-ide_dma_end   = trm290_ide_dma_end;
+   hwif-ide_dma_test_irq  = trm290_ide_dma_test_irq;
 
hwif-selectproc = trm290_selectproc;
 #if 1

-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] trm290: do hook dma_host_{on,off} methods

2007-12-26 Thread Sergei Shtylyov

Hello, I wrote:


Those two methods were reading/writing TRM-290 config. register; luckily (?)
the writes only tried to change undefined bits.


   Actually, the writes were falling at the PRD address register. Well, 
nobody noticed anyway... :-)


MBR, Sergei
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html