ide: add at91_ide driver
PATCH 2/3 ide: add at91_ide driver
This is IDE host driver for AT91SAM9 Static Memory Controller with Compact Flash True IDE Mode logic.
Driver have to switch 8/16 bit bus width when accessing Task Tile or Data Register. Moreover some extra things need to be done when setting PIO mode. Only PIO mode is used, hardware have no DMA support. If interrupt line is connected through GPIO extra quirk is needed to cope with fake interrupts.
--- arch/arm/mach-at91/include/mach/board.h | 12 + drivers/ide/Kconfig | 5 + drivers/ide/Makefile | 1 + drivers/ide/at91_ide.c | 496 +++++++++++++++++++++++++++++++ 4 files changed, 514 insertions(+), 0 deletions(-) create mode 100644 drivers/ide/at91_ide.c
arch/arm/mach-at91/include/mach/board.h +12 -0
@@ -59,6 +59,18 @@ struct at91_cf_data { };extern void __init at91_add_device_cf (struct at91_cf_data *data); +/* Compact Flash True IDE mode */ +struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */ +u8 det_pin; +u8 rst_pin; +u8 chipselect; +u8 flags; +#define AT91_IDE_SWAP_A0_A2 0x01 +}; + +extern void __init at91_add_device_ide (struct at91_ide_data *data); +/* MMC / SD */ struct at91_mmc_data {u8 det_pin;/* card detect IRQ */
drivers/ide/Kconfig +5 -0
@@ -721,6 +721,11 @@ config BLK_DEV_IDE_TX4939 depends on SOC_TX4939 select BLK_DEV_IDEDMA_SFF +config BLK_DEV_IDE_AT91 + tristate "Atmel AT91 IDE support" + depends on ARM && ARCH_AT91 + select IDE_TIMINGS + config IDE_ARM tristate "ARM IDE support" depends on ARM && (ARCH_RPC || ARCH_SHARK)
drivers/ide/Makefile +1 -0
@@ -116,3 +116,4 @@ obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o +obj-$(CONFIG_BLK_DEV_IDE_AT91) += at91_ide.o
drivers/ide/at91_ide.c new file +496 -0
496 lines not on this page · raw message
Signature · 1 line
1.5.2.5
Hello.
Quoted 10 lines · Stanislaw Gruszka
This is IDE host driver for AT91SAM9 Static Memory Controller with Compact Flash True IDE Mode logic.
Driver have to switch 8/16 bit bus width when accessing Task Tile or Data Register. Moreover some extra things need to be done when setting PIO mode. Only PIO mode is used, hardware have no DMA support. If interrupt line is connected through GPIO extra quirk is needed to cope with fake interrupts.
Signed-off-by Stanislaw Gruszka <[email protected]>
[...]
arch/arm/mach-at91/include/mach/board.h struct at91_cf_data { · line 65
Quoted 12 lines
arch/arm/mach-at91/include/mach/board.h +3
-0@@ -59,6 +59,18 @@ struct at91_cf_data { };extern void __init at91_add_device_cf (struct at91_cf_data *data); +/* Compact Flash True IDE mode */ +struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */
I again have to express my dislike about not passing IRQ the usual
way. Also, see my comments to the platform code.
Quoted 17 lines
arch/arm/mach-at91/include/mach/board.h +9
-0+u8 det_pin; +u8 rst_pin; +u8 chipselect; +u8 flags; +#define AT91_IDE_SWAP_A0_A2 0x01 +}; + +extern void __init at91_add_device_ide (struct at91_ide_data *data); +/* MMC / SD */ struct at91_mmc_data {arch/arm/mach-at91/include/mach/board.h +0
-0u8 det_pin;/* card detect IRQ */ drivers/ide/Kconfig +0
-0
drivers/ide/Kconfig config BLK_DEV_IDE_TX4939 · line 726
Quoted 6 lines
drivers/ide/Kconfig +2
-0@@ -721,6 +721,11 @@ config BLK_DEV_IDE_TX4939 depends on SOC_TX4939 select BLK_DEV_IDEDMA_SFF +config BLK_DEV_IDE_AT91 + tristate "Atmel AT91 IDE support"
Please be more specific -- you can't drive AT91RM9200 SMC.
drivers/ide/Kconfig config BLK_DEV_IDE_TX4939 · line 728
Quoted 2 lines
drivers/ide/Kconfig +1
-0+ depends on ARM && ARCH_AT91
Please add "&& !ARCH_AT91RM9200". And maybe "&& !ARCH_AT91X40" too...
drivers/ide/at91_ide.c line 2
Quoted 9 lines
drivers/ide/at91_ide.c new file +2
-0@@ -0,0 +1,496 @@ +/* +* IDE host driver for AT91SAM9 Static Memory Controller
Why not call the driver 'at91sam9_ide'?
drivers/ide/at91_ide.c line 4
Quoted 2 lines
drivers/ide/at91_ide.c new file +2
-0+/* +* AT91 Static Memory Controller
AT91SAM9.
Quoted 3 lines
maps Task File and Data Register
+ * at the same address. To distinguish access between these two
It would have been strange if it did it otherwise...
Quoted 7 lines
+ * different bus data width is used: 8Bit for Task File, 16Bit for Data I/O
+ *
+ * After initialization we do 8/16 bit flipping (changes in SMC MODE register)
+ * only inside IDE callback routines which are serialized by IDE layer,
+ * so no additional locking needed.
+ */
drivers/ide/at91_ide.c line 63
Quoted 7 lines
drivers/ide/at91_ide.c new file +7
-0+ +static void init_smc_mode (const u8 chipselect) +{ +at91_sys_write (AT91_SMC_MODE (chipselect),AT91_SMC_READMODE | +AT91_SMC_WRITEMODE | +AT91_SMC_BAT_SELECT | +AT91_SMC_TDF_ (0 ));
I'm not sure why are you fixing the dataflow timing again, this time
to 0...
Quoted 10 lines
drivers/ide/at91_ide.c new file +9
-0+} + +static inline void set_8bit_mode (const u8 chipselect) +{ +unsigned long mode =at91_sys_read (AT91_SMC_MODE (chipselect)); + mode &= ~AT91_SMC_DBW ; + mode |=AT91_SMC_DBW_8 ; +at91_sys_write (AT91_SMC_MODE (chipselect), mode); +pdbg ("%u %08lx\n" , chipselect, mode);
drivers/ide/at91_ide.c line 82
Quoted 10 lines
drivers/ide/at91_ide.c new file +10
-0+} + +static inline void set_16bit_mode (const u8 chipselect) +{ +unsigned long mode =at91_sys_read (AT91_SMC_MODE (chipselect)); + mode &= ~AT91_SMC_DBW ; + mode |=AT91_SMC_DBW_16 ; +at91_sys_write (AT91_SMC_MODE (chipselect), mode); +pdbg ("%u %08lx\n" , chipselect, mode); +}
I'd advice to make this single function because it looks like a code
duplication too much.
drivers/ide/at91_ide.c line 86
Quoted 4 lines
drivers/ide/at91_ide.c new file +3
-0+static void set_smc_timings (const u8 chipselect,const u16 cycle, +const u16 setup,const u16 pulse, +const u16 data_float,int use_iordy)
Have you considered using already present sam9_smc_configure()
instead to avoid the code duplication (it needs to be exported though)?
Quoted 7 lines
drivers/ide/at91_ide.c new file +6
-0+{ +unsigned long mode; + +/* setup timings in SMC */ + at91_sys_write(AT91_SMC_SETUP(chipselect), AT91_SMC_NWESETUP_(setup) | + AT91_SMC_NCS_WRSETUP_(0) |
drivers/ide/at91_ide.c line 102
Quoted 10 lines
drivers/ide/at91_ide.c new file +10
-0+AT91_SMC_NRDSETUP_ (setup) | + AT91_SMC_NCS_RDSETUP_(0)); +at91_sys_write (AT91_SMC_PULSE (chipselect),AT91_SMC_NWEPULSE_ (pulse) | +AT91_SMC_NCS_WRPULSE_ (cycle) | +AT91_SMC_NRDPULSE_ (pulse) | +AT91_SMC_NCS_RDPULSE_ (cycle)); +at91_sys_write (AT91_SMC_CYCLE (chipselect),AT91_SMC_NWECYCLE_ (cycle) | +AT91_SMC_NRDCYCLE_ (cycle)); + + mode =at91_sys_read (AT91_SMC_MODE (chipselect));
Frankly speaking, I don't see why you're reading this register back
if you already know what needs to be set there -- as you've done it in init_smc_mode().
Quoted 19 lines
drivers/ide/at91_ide.c new file +18
-0+static unsigned int calc_mck_cycles (unsigned int ns,unsigned int mck_hz) +{ +u64 tmp = ns; + + tmp *= mck_hz; + tmp +=1000 *1000 *1000 -1 ;/* round up */ +do_div (tmp,1000 *1000 *1000 ); +return (unsigned int ) tmp; +} + +static void apply_timings (const u8 chipselect,const u8 pio, +const struct ide_timing *timing,const u16 *ata_id) +{ +unsigned int t0, t1, t2, t6z, th; +unsigned int cycle, setup, pulse, data_float; +unsigned int mck_hz; +struct clk *mck; +int use_iordy;
[...]
drivers/ide/at91_ide.c
Quoted 3 lines
drivers/ide/at91_ide.c new file +2
-0+ + use_iordy =0 ;
Can be done in initializer...
drivers/ide/at91_ide.c line 172
Quoted 8 lines
drivers/ide/at91_ide.c new file +6
-0+if (ata_id) { +if (ata_id_is_cfa (ata_id)) { +if (pio ==3 || pio ==4 ) + use_iordy =1 ; + }else if (pio >=3 ||ata_id_has_iordy (ata_id)) + use_iordy =1 ;
No, you should check for IORDY regardless of CFA and using IORDY
shouldn't be limeited to modes 3 and 4:
if (ata_id_has_iordy(ata_id) && !(ata_id_is_cfa(ata_id) && pio > 4))
use_iodry = 1;drivers/ide/at91_ide.c line 180
Quoted 4 lines
drivers/ide/at91_ide.c new file +3
-0+static u8 ide_mm_inb (unsigned long port) +{ +return (u8 )readb ((void __iomem *) port);
Explict cast not needed here.
drivers/ide/at91_ide.c line 198
Quoted 12 lines
drivers/ide/at91_ide.c new file +11
-0+void at91_ide_tf_load (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; +u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ; + +if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ; + +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) {
Sigh. Bart, couldn't we drop that stupid flag? I bet nobody ever used it.
drivers/ide/at91_ide.c line 239
Quoted 8 lines
drivers/ide/at91_ide.c new file +7
-0+void at91_ide_tf_read (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; + +if (task->tf_flags &IDE_TFLAG_IN_DATA ) {
... and this one too?
Quoted 9 lines
drivers/ide/at91_ide.c new file +8
-0+/* +* If interrupt is delivered through GPIO, IRQ are triggered on falling +* and raising edge of signal. Whereas IDE device request interrupt on high +* level (raising edge in our case). This mean we have fake interrupts, so +* we need to check interrupt pin and exit instantly from ISR when line +* is on low level. +*/ +
drivers/ide/at91_ide.c line 368
Quoted 10 lines
drivers/ide/at91_ide.c new file +10
-0+irqreturn_t at91_irq_handler (int irq,void *dev_id) +{ +int ntries =8 ; +int pin_val1, pin_val2; + +/* additional deglitch, line can be noisy in badly designed PCB */ +do { + pin_val1 =at91_get_gpio_value (irq); + pin_val2 =at91_get_gpio_value (irq); + }while (pin_val1 != pin_val2 && --ntries >0 );
I suggest a shorter code:
do {
pin_val = at91_get_gpio_value(irq);
} while (pin_val != at91_get_gpio_value(irq) && --ntries > 0);Quoted 3 lines
drivers/ide/at91_ide.c new file +2
-0+static int __init at91_ide_probe (struct platform_device *pdev) +{
[...]
drivers/ide/at91_ide.c line 449
Quoted 2 lines
drivers/ide/at91_ide.c new file +1
-0+ host->ports[0 ]->extra_base = board->chipselect;
BTW, we have 2 fields in the struct hwif_s that fit this case better:config_data and select_data. It's a bit stange that you've selected extra_base...
MBR, Sergei
Wednesday 04 February 2009 13:19:50 Sergei Shtylyov napisał(a):
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-at91/include/mach/board.h +0
-0@@ -59,6 +59,18 @@ struct at91_cf_data { };extern void __init at91_add_device_cf (struct at91_cf_data *data);
Quoted 7 lines
arch/arm/mach-at91/include/mach/board.h struct at91_cf_data {
Quoted 4 lines
arch/arm/mach-at91/include/mach/board.h +3
-0+/* Compact Flash True IDE mode */ +struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */ I again have to express my dislike about not passing IRQ the usual
way. Also, see my comments to the platform code.
Yes, I know, I don't like to argue. Only reasoning to use platform irq resource seams to be: "because other drivers do". However we have exception - at91_cf also use board->irq_pin, so maybe this driver could also do ?
Quoted 20 lines
Quoted 20 lines
arch/arm/mach-at91/include/mach/board.h +9
-0+u8 det_pin; +u8 rst_pin; +u8 chipselect; +u8 flags; +#define AT91_IDE_SWAP_A0_A2 0x01 +}; + +extern void __init at91_add_device_ide (struct at91_ide_data *data); +/* MMC / SD */ struct at91_mmc_data {arch/arm/mach-at91/include/mach/board.h +0
-0u8 det_pin;/* card detect IRQ */ drivers/ide/Kconfig +0
-0@@ -721,6 +721,11 @@ config BLK_DEV_IDE_TX4939 depends on SOC_TX4939 select BLK_DEV_IDEDMA_SFF
Quoted 5 lines
drivers/ide/Kconfig config BLK_DEV_IDE_TX4939
Quoted 3 lines
drivers/ide/Kconfig +2
-0+config BLK_DEV_IDE_AT91 + tristate "Atmel AT91 IDE support"Please be more specific -- you can't drive AT91RM9200 SMC.
Ok.
Quoted 5 lines
drivers/ide/Kconfig config BLK_DEV_IDE_TX4939 · line 728
Quoted 3 lines
drivers/ide/Kconfig +1
-0+ depends on ARM && ARCH_AT91Please add "&& !ARCH_AT91RM9200". And maybe "&& !ARCH_AT91X40" too...
Ok.
Quoted 12 lines
drivers/ide/at91_ide.c line 2
Quoted 9 lines
drivers/ide/at91_ide.c new file +2
-0@@ -0,0 +1,496 @@ +/* +* IDE host driver for AT91SAM9 Static Memory Controller Why not call the driver '
at91sam9_ide'?
Quoted 4 lines
drivers/ide/at91_ide.c line 4
Quoted 2 lines
drivers/ide/at91_ide.c new file +2
-0+/* +* AT91 Static Memory Controller AT91SAM9.
Ok, currently only SAM9 can be used with driver. However I think adding support to AT91RM9200 to this driver will be not much effort. I don't think someone will want to write new driver for RM9200 insted using this one.
IMHO, current name is short and sweet and not miss the true so much - most of the AT91s which can work with True IDE logic are supported. I would like to stay with current name.
Quoted 15 lines
Quoted 3 lines
maps Task File and Data Register
+ * at the same address. To distinguish access between these two
It would have been strange if it did it otherwise...
Quoted 9 lines
+ * different bus data width is used: 8Bit for Task File, 16Bit for Data I/O
+ *
+ * After initialization we do 8/16 bit flipping (changes in SMC MODE register)
+ * only inside IDE callback routines which are serialized by IDE layer,
+ * so no additional locking needed.
+ */drivers/ide/at91_ide.c new file +3
-0+ +static void init_smc_mode (const u8 chipselect) +{
Quoted 8 lines
drivers/ide/at91_ide.c line 63
Quoted 5 lines
drivers/ide/at91_ide.c new file +4
-0+at91_sys_write (AT91_SMC_MODE (chipselect),AT91_SMC_READMODE | +AT91_SMC_WRITEMODE | +AT91_SMC_BAT_SELECT | +AT91_SMC_TDF_ (0 ));I'm not sure why are you fixing the dataflow timing again, this time
to 0...
Not necessary code, will be removed.
Quoted 15 lines
Quoted 15 lines
drivers/ide/at91_ide.c new file +15
-0+} + +static inline void set_8bit_mode (const u8 chipselect) +{ +unsigned long mode =at91_sys_read (AT91_SMC_MODE (chipselect)); + mode &= ~AT91_SMC_DBW ; + mode |=AT91_SMC_DBW_8 ; +at91_sys_write (AT91_SMC_MODE (chipselect), mode); +pdbg ("%u %08lx\n" , chipselect, mode); +} + +static inline void set_16bit_mode (const u8 chipselect) +{ +unsigned long mode =at91_sys_read (AT91_SMC_MODE (chipselect)); + mode &= ~AT91_SMC_DBW ;
Quoted 8 lines
drivers/ide/at91_ide.c line 82
Quoted 5 lines
drivers/ide/at91_ide.c new file +4
-0+ mode |=AT91_SMC_DBW_16 ; +at91_sys_write (AT91_SMC_MODE (chipselect), mode); +pdbg ("%u %08lx\n" , chipselect, mode); +}I'd advice to make this single function because it looks like a code
duplication too much.
Uh well.
Quoted 7 lines
drivers/ide/at91_ide.c line 86
Quoted 4 lines
drivers/ide/at91_ide.c new file +3
-0+static void set_smc_timings (const u8 chipselect,const u16 cycle, +const u16 setup,const u16 pulse, +const u16 data_float,int use_iordy)Have you considered using already present
sam9_smc_configure()
instead to avoid the code duplication (it needs to be exported though)?
I think, it need to be exported, I'll check.
Quoted 13 lines
Quoted 13 lines
drivers/ide/at91_ide.c new file +13
-0+{ +unsigned long mode; + +/* setup timings in SMC */ +at91_sys_write (AT91_SMC_SETUP (chipselect),AT91_SMC_NWESETUP_ (setup) | +AT91_SMC_NCS_WRSETUP_ (0 ) | +AT91_SMC_NRDSETUP_ (setup) | +AT91_SMC_NCS_RDSETUP_ (0 )); +at91_sys_write (AT91_SMC_PULSE (chipselect),AT91_SMC_NWEPULSE_ (pulse) | +AT91_SMC_NCS_WRPULSE_ (cycle) | +AT91_SMC_NRDPULSE_ (pulse) | +AT91_SMC_NCS_RDPULSE_ (cycle)); + at91_sys_write(AT91_SMC_CYCLE(chipselect), AT91_SMC_NWECYCLE_(cycle) |
Quoted 8 lines
drivers/ide/at91_ide.c line 102
Quoted 4 lines
drivers/ide/at91_ide.c new file +3
-0+ AT91_SMC_NRDCYCLE_(cycle)); + + mode =at91_sys_read (AT91_SMC_MODE (chipselect));Frankly speaking, I don't see why you're reading this register back
if you already know what needs to be set there -- as you've done it ininit_smc_mode().
This function is not only used at initialization. It is also used when PIO mode is changed.
Quoted 20 lines
Quoted 19 lines
drivers/ide/at91_ide.c new file +18
-0+static unsigned int calc_mck_cycles (unsigned int ns,unsigned int mck_hz) +{ +u64 tmp = ns; + + tmp *= mck_hz; + tmp +=1000 *1000 *1000 -1 ;/* round up */ +do_div (tmp,1000 *1000 *1000 ); +return (unsigned int ) tmp; +} + +static void apply_timings (const u8 chipselect,const u8 pio, +const struct ide_timing *timing,const u16 *ata_id) +{ +unsigned int t0, t1, t2, t6z, th; +unsigned int cycle, setup, pulse, data_float; +unsigned int mck_hz; +struct clk *mck; +int use_iordy;[...]
Quoted 5 lines
drivers/ide/at91_ide.c
Quoted 3 lines
drivers/ide/at91_ide.c new file +2
-0+ + use_iordy =0 ;Can be done in initializer...
But here is more readable, I think.
Quoted 5 lines
Quoted 5 lines
drivers/ide/at91_ide.c new file +4
-0+if (ata_id) { +if (ata_id_is_cfa (ata_id)) { +if (pio ==3 || pio ==4 ) + use_iordy =1 ;
Quoted 7 lines
drivers/ide/at91_ide.c line 172
Quoted 3 lines
drivers/ide/at91_ide.c new file +2
-0+ }else if (pio >=3 ||ata_id_has_iordy (ata_id)) + use_iordy =1 ;No, you should check for IORDY regardless of CFA and using IORDY
shouldn't be limeited to modes 3 and 4:
Hmm, I take as example ata_pio_need_iordy(), it is also wrong or maybe I don't follow the logic properly.
Quoted 9 lines
if (ata_id_has_iordy(ata_id) && !(ata_id_is_cfa(ata_id) && pio > 4)) use_iodry = 1;drivers/ide/at91_ide.c line 180
Quoted 4 lines
drivers/ide/at91_ide.c new file +3
-0+static u8 ide_mm_inb (unsigned long port) +{ +return (u8 )readb ((void __iomem *) port);Explict cast not needed here.
Ok.
Quoted 13 lines
drivers/ide/at91_ide.c line 368
Quoted 11 lines
drivers/ide/at91_ide.c new file +10
-0+irqreturn_t at91_irq_handler (int irq,void *dev_id) +{ +int ntries =8 ; +int pin_val1, pin_val2; + +/* additional deglitch, line can be noisy in badly designed PCB */ +do { + pin_val1 =at91_get_gpio_value (irq); + pin_val2 =at91_get_gpio_value (irq); + }while (pin_val1 != pin_val2 && --ntries >0 );I suggest a shorter code:
Quoted 3 lines
do {
pin_val = at91_get_gpio_value(irq);
} while (pin_val != at91_get_gpio_value(irq) && --ntries > 0);For me your form is less readable.
Quoted 10 lines
Quoted 3 lines
drivers/ide/at91_ide.c new file +2
-0+static int __init at91_ide_probe (struct platform_device *pdev) +{[...]
drivers/ide/at91_ide.c line 449
Quoted 2 lines
drivers/ide/at91_ide.c new file +1
-0+ host->ports[0 ]->extra_base = board->chipselect;BTW, we have 2 fields in the struct
hwif_sthat fit this case better:config_dataandselect_data. It's a bit stange that you've selectedextra_base...
Ok.
Regards
Stanislaw Gruszka
Quoted 15 lines · Stanislaw Gruszka
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-at91/include/mach/board.h +0
-0@@ -59,6 +59,18 @@ struct at91_cf_data { };extern void __init at91_add_device_cf (struct at91_cf_data *data);Quoted 6 lines
arch/arm/mach-at91/include/mach/board.h struct at91_cf_data { · line 64
Quoted 3 lines
arch/arm/mach-at91/include/mach/board.h +3
-0+/* Compact Flash True IDE mode */ +struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */ I again have to express my dislike about not passing IRQ the usual
way. Also, see my comments to the platform code.
Quoted 3 lines
Yes, I know, I don't like to argue. Only reasoning to use platform irq resource seams to be: "because other drivers do". However we have exception -
at91_cfalso useboard->irq_pin, so maybe this driver could also do ?
Then why have the memory resource when we can calculate it from the chip
select? (I'm not asking you to do that, since the platfrom device resources are user-visible thru /proc/iomem -- even if the driver is not enabled.)
Quoted 11 lines
Quoted 10 lines
drivers/ide/at91_ide.c line 2
Quoted 8 lines
drivers/ide/at91_ide.c new file +2
-0@@ -0,0 +1,496 @@ +/* +* IDE host driver for AT91SAM9 Static Memory Controller Why not call the driver '
at91sam9_ide'?
Quoted 7 lines
Quoted 4 lines
drivers/ide/at91_ide.c line 4
Quoted 2 lines
drivers/ide/at91_ide.c new file +2
-0+/* +* AT91 Static Memory Controller AT91SAM9.
Ok, currently only SAM9 can be used with driver. However I think adding support to AT91RM9200 to this driver will be not much effort.
Can you answer the simple question: why we should try to support two
incompatible chips with a single driver? Because the driver name will be shorter? :-)
Quoted 2 lines
I don't think
someone will want to write new driver for RM9200 insted using this one.
You're right, nobody will want that... because AT91RM9200 as is has *no
support for True IDE mode*. ;-)
Quoted 2 lines
IMHO, current name is short and sweet and not miss the true so much -
most of the AT91s which can work with True IDE logic are supported. I would like to stay with current name.
Oh, do what you want... just don't claim it will work on RM9200. :-/
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
drivers/ide/at91_ide.c new file +9
-0+* different bus data width is used: 8Bit for Task File, 16Bit for Data I/O +* +* After initialization we do 8/16 bit flipping (changes in SMC MODE register) +* only inside IDE callback routines which are serialized by IDE layer, +* so no additional locking needed. +*/ + +static void init_smc_mode (const u8 chipselect) +{Quoted 8 lines
drivers/ide/at91_ide.c line 63
Quoted 5 lines
drivers/ide/at91_ide.c new file +4
-0+at91_sys_write (AT91_SMC_MODE (chipselect),AT91_SMC_READMODE | +AT91_SMC_WRITEMODE | +AT91_SMC_BAT_SELECT | +AT91_SMC_TDF_ (0 ));I'm not sure why are you fixing the dataflow timing again, this time
to 0...
Quoted 1 line
Not necessary code, will be removed.
All this funciton seems pretty useless.
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
drivers/ide/at91_ide.c new file +11
-0+{ +unsigned long mode; + +/* setup timings in SMC */ +at91_sys_write (AT91_SMC_SETUP (chipselect),AT91_SMC_NWESETUP_ (setup) | +AT91_SMC_NCS_WRSETUP_ (0 ) | +AT91_SMC_NRDSETUP_ (setup) | +AT91_SMC_NCS_RDSETUP_ (0 )); + at91_sys_write(AT91_SMC_PULSE(chipselect), AT91_SMC_NWEPULSE_(pulse) | + AT91_SMC_NCS_WRPULSE_(cycle) | + AT91_SMC_NRDPULSE_(pulse) |Quoted 8 lines
drivers/ide/at91_ide.c line 102
Quoted 5 lines
drivers/ide/at91_ide.c new file +5
-0+ AT91_SMC_NCS_RDPULSE_(cycle)); +at91_sys_write (AT91_SMC_CYCLE (chipselect),AT91_SMC_NWECYCLE_ (cycle) | +AT91_SMC_NRDCYCLE_ (cycle)); + + mode =at91_sys_read (AT91_SMC_MODE (chipselect));Frankly speaking, I don't see why you're reading this register back
if you already know what needs to be set there -- as you've done it ininit_smc_mode().
Quoted 2 lines
This function is not only used at initialization. It is also used when PIO mode is changed.
So what? You can just write the fixed mode bits into the register every
time without readback.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/ide/at91_ide.c new file +3
-0+static void apply_timings (const u8 chipselect,const u8 pio, +const struct ide_timing *timing,const u16 *ata_id) +{
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/ide/at91_ide.c new file +4
-0+if (ata_id) { +if (ata_id_is_cfa (ata_id)) { +if (pio ==3 || pio ==4 ) + use_iordy =1 ;
Quoted 8 lines
Quoted 5 lines
drivers/ide/at91_ide.c line 172
Quoted 2 lines
drivers/ide/at91_ide.c new file +2
-0+ }else if (pio >=3 ||ata_id_has_iordy (ata_id)) + use_iordy =1 ;No, you should check for IORDY regardless of CFA and using IORDY
shouldn't be limeited to modes 3 and 4:Hmm, I take as example
ata_pio_need_iordy(), it is also wrong or maybe I don't follow the logic properly.
Let me look... yes, you don't follow it properly. Besides, it could have
omitted checking for PIO mode > 2.
MBR, Sergei
Quoted 15 lines · Hello, I wrote:
Quoted 14 lines
Quoted 14 lines
arch/arm/mach-at91/include/mach/board.h struct at91_cf_data { · line 64
Quoted 11 lines
arch/arm/mach-at91/include/mach/board.h +3
-0@@ -59,6 +59,18 @@ struct at91_cf_data { };extern void __init at91_add_device_cf (struct at91_cf_data *data); +/* Compact Flash True IDE mode */ +struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */ I again have to express my dislike about not passing IRQ the usual
way. Also, see my comments to the platform code.
Quoted 6 lines
Quoted 3 lines
Yes, I know, I don't like to argue. Only reasoning to use platform irq resource seams to be: "because other drivers do". However we have exception -
at91_cfalso useboard->irq_pin, so maybe this driver could also do ?Then why have the memory resource when we can calculate it from the
chip select? (I'm not asking you to do that, since the platfrom device resources are user-visible thru/proc/iomem-- even if the driver is not enabled.)
Oh, I forgot that it's ARM with its #ifdef hell. :-D
Then they're only visible when the driver is enabled.
MBR, Sergei
Wednesday 04 February 2009 17:04:27 Sergei Shtylyov napisał(a):
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-at91/include/mach/board.h struct at91_cf_data { · line 64
Quoted 5 lines
extern void
__initat91_add_device_cf(struct at91_cf_data *data);+ /* Compact Flash True IDE mode */
arch/arm/mach-at91/include/mach/board.h +2
-0+struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */ I again have to express my dislike about not passing IRQ the usual
way. Also, see my comments to the platform code.
Quoted 6 lines
Quoted 3 lines
Yes, I know, I don't like to argue. Only reasoning to use platform irq resource seams to be: "because other drivers do". However we have exception -
at91_cfalso useboard->irq_pin, so maybe this driver could also do ?Then why have the memory resource when we can calculate it from the chip
select?
Great idea, I very like it :) But memory is a platform (cpu) resource, however board dependend.
Quoted 2 lines
(I'm not asking you to do that, since the platfrom device resources are user-visible thru
/proc/iomem-- even if the driver is not enabled.)
Let's distinguish platform (cpu) resources and board resources.
If you take a look at arch/arm/mach-at91/*_devices.c files, IORESOURCE_IRQ are used for interrupts from devices that are integrated on the chip. Board specific irq pins (like in at91_cf, at91_ether) are not passed to platform driver via platform_resource but via board data.
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
drivers/ide/at91_ide.c line 2
Quoted 8 lines
drivers/ide/at91_ide.c new file +2
-0@@ -0,0 +1,496 @@ +/* +* IDE host driver for AT91SAM9 Static Memory Controller Why not call the driver '
at91sam9_ide'?Quoted 2 lines
drivers/ide/at91_ide.c new file +2
-0+/* +* AT91 Static Memory Controller
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
AT91SAM9.
Ok, currently only SAM9 can be used with driver. However I think adding support to AT91RM9200 to this driver will be not much effort.
Can you answer the simple question: why we should try to support two
incompatible chips with a single driver? Because the driver name will be shorter? :-)
Very funny. I think patch adding RM9200 support to this driver will have less than 50 lines changeset, whereas writing new driver would be about 500 lines.
Quoted 5 lines
Quoted 2 lines
I don't think
someone will want to write new driver for RM9200 insted using this one.You're right, nobody will want that... because AT91RM9200 as is has *no
support for True IDE mode*. ;-)
Atmel documents are confusing. AT91RM9200 datasheet tells there is no True IDE support, but RM9200 hard drive application note (which I send you a link before) tell it is.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Frankly speaking, I don't see why you're reading this register back
if you already know what needs to be set there -- as you've done it ininit_smc_mode().This function is not only used at initialization. It is also used when PIO mode is changed.
So what? You can just write the fixed mode bits into the register every
time without readback.
Ok, I see now.
Cheers
Stanislaw Gruszka
Quoted 8 lines · Stanislaw Gruszka
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-at91/include/mach/board.h struct at91_cf_data { · line 64
Quoted 5 lines
extern void
__initat91_add_device_cf(struct at91_cf_data *data);+ /* Compact Flash True IDE mode */
arch/arm/mach-at91/include/mach/board.h +2
-0+struct at91_ide_data { +u8 irq_pin;/* the same meaning as for CF */ I again have to express my dislike about not passing IRQ the usual way. Also, see my comments to the platform code.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Yes, I know, I don't like to argue. Only reasoning to use platform irq resource seams to be: "because other drivers do". However we have exception -
at91_cfalso useboard->irq_pin, so maybe this driver could also do ?Then why have the memory resource when we can calculate it from the chip
select?Great idea, I very like it :)
It should have arisen from trying to follow your approach consistently.
You can then drop the whole idea of using the platform device -- 'struct
device' already has 'platform_data' member (although... there is a prominent example of a platfrom driver using only the platform data to pass all the resource information: drivers/serial/8250.c).
Quoted 1 line
But memory is a platform (cpu) resource,
I don't get what you're trying to say. AFAIK, there has never been an
*implication* that the platfrom device resources should be CPU-, and not board-specific.
Quoted 1 line
however board dependend.
Haven't you just told us that it's not board, but CPU dependent?
Quoted 3 lines
Quoted 1 line
(I'm not asking you to do that, since the platfrom device resources are user-visible thru
/proc/iomem-- even if the driver is not enabled.)Let's distinguish platform (cpu) resources and board resources.
I'm seeing no point in such distinction. The platfrom device framework was
created exactly with the assorted on-board devices in mind.
Quoted 3 lines
If you take a look at
arch/arm/mach-at91/*_devices.cfiles,IORESOURCE_IRQare used for interrupts from devices that are integrated on the chip. Board specific irq pins (like inat91_cf,at91_ether) are not
passed to platform driver viaplatform_resourcebut via board data.
I don't care what the particular broken ARM platfrom code does. If it
can't pass resources in a normal way, it should be fixed, and not followed as a good example.
Quoted 16 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/ide/at91_ide.c line 2
Quoted 8 lines
drivers/ide/at91_ide.c new file +2
-0@@ -0,0 +1,496 @@ +/* +* IDE host driver for AT91SAM9 Static Memory Controller Why not call the driver '
at91sam9_ide'?drivers/ide/at91_ide.c line 4
Quoted 2 lines
drivers/ide/at91_ide.c new file +2
-0+/* +* AT91 Static Memory Controller AT91SAM9.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Ok, currently only SAM9 can be used with driver. However I think adding support to AT91RM9200 to this driver will be not much effort.
Can you answer the simple question: why we should try to support two
incompatible chips with a single driver? Because the driver name will be shorter? :-)Very funny. I think patch adding RM9200 support to this driver will have less than 50 lines changeset, whereas writing new driver would be about 500 lines.
This approach is so broken-minded that I'm just out words to argue any more.
Let's then support say all the PCI IDE chipsets with the single driver
(actully, there was a driver that tried to support 2 incompatible Promise chip families but it got split finally). Moreover, with AT91RM9200 lacking True IDE mode support, the code (if anybody in their right mind would undertake the task of adding IDE support) will be different enough from what is there already, that I doubt that that imaginary porgrammer would keep clinging to the doubtful idea to the very end... anyway, I'm now considering the very possibilty of anybody trying to do that minimal, exactly due to AT91RM9200 lacking True IDE support.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I don't think
someone will want to write new driver for RM9200 insted using this one.You're right, nobody will want that... because AT91RM9200 as is has *no
support for True IDE mode*. ;-)Atmel documents are confusing. AT91RM9200 datasheet tells there is no True IDE support,
There is no confusion there -- at least for me. Yes, there is no True IDE
support.
Quoted 1 line
but RM9200 hard drive application note (which I send you a link before) tell it is.
That is just a total hack. I don't think anyone will really want to use
the GPIO controlled chip selects that this application note describes... well, if only out of total desperation. :-)
Quoted 2 lines
Cheers
Stanislaw Gruszka
MBR, Sergei
hi,
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
AT91SAM9.
Ok, currently only SAM9 can be used with driver. However I think adding support to AT91RM9200 to this driver will be not much effort.
Can you answer the simple question: why we should try to support two
incompatible chips with a single driver? Because the driver name will be shorter? :-)
Quoted 7 lines
Quoted 4 lines
Very funny. I think patch adding RM9200 support to this driver will have less
than 50 lines changeset, whereas writing new driver would be about 500 lines.This approach is so broken-minded that I'm just out words to argue any
more.
This driver should also work on the Atmel AT91CAP9 and AT572D940HF processors. So I see no valid reason why the driver cannot be called at91_ide.
Regards,
Andrew Victor
Quoted 14 lines · Andrew Victor
Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
AT91SAM9.
Ok, currently only SAM9 can be used with driver. However I think adding support to AT91RM9200 to this driver will be not much effort.
Can you answer the simple question: why we should try to support two
incompatible chips with a single driver? Because the driver name will be shorter? :-)Very funny. I think patch adding RM9200 support to this driver will have less
than 50 lines changeset, whereas writing new driver would be about 500 lines.
Quoted 5 lines
Quoted 2 lines
This approach is so broken-minded that I'm just out words to argue any
more.This driver should also work on the Atmel AT91CAP9 and AT572D940HF processors. So I see no valid reason why the driver cannot be called
at91_ide.
I've already said: call it whatever you want. Just don't try to add
support for an incompatible AT91 SMC.
Quoted 2 lines
Regards,
Andrew Victor
MBR, Sergei
On Wednesday 04 February 2009, Sergei Shtylyov wrote:
[...]
Quoted 6 lines
Quoted 6 lines
drivers/ide/at91_ide.c new file +6
-0+void at91_ide_tf_load (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; +u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ;
Quoted 8 lines
drivers/ide/at91_ide.c line 198
Quoted 6 lines
drivers/ide/at91_ide.c new file +5
-0+ +if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ; + +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody ever used it.
It is there for HDIO_DRIVE_TASKFILE ioctl and I prefer not to break it.
Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct ide_tp_ops -- it should also help some other host drivers like tx493*.
Thanks,
Bart
Hello.
Quoted 16 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines
Quoted 6 lines
drivers/ide/at91_ide.c new file +6
-0+void at91_ide_tf_load (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; +u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ;Quoted 9 lines
drivers/ide/at91_ide.c line 198
Quoted 7 lines
drivers/ide/at91_ide.c new file +5
-0+ +if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ; + +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody ever used it.
Quoted 5 lines
It is there for
HDIO_DRIVE_TASKFILEioctl and I prefer not to break it.Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct
ide_tp_ops-- it should also help some other host drivers like tx493*.
That would be extremely senseless activity sicne I believe this flag
is totally useless. I have better thing to do. :-)
Quoted 2 lines
Thanks,
Bart
MBR, Sergei
Wednesday 04 February 2009 13:19:50 Sergei Shtylyov napisał(a):
Quoted 7 lines
[...]
drivers/ide/at91_ide.c line 449
Quoted 2 lines
drivers/ide/at91_ide.c new file +1
-0+ host->ports[0 ]->extra_base = board->chipselect;BTW, we have 2 fields in the struct
hwif_sthat fit this case better:config_dataandselect_data. It's a bit stange that you've selectedextra_base...
config_data is in use by IDE core, I'll switch to select_data.
Stanislaw Gruszka
Thursday 05 February 2009 17:09:06 Sergei Shtylyov napisał(a):
Quoted 8 lines
Quoted 4 lines
If you take a look at
arch/arm/mach-at91/*_devices.cfiles,IORESOURCE_IRQare used for interrupts from devices that are integrated on the chip. Board specific irq pins (like inat91_cf,at91_ether) are not passed to platform driver viaplatform_resourcebut via board data.I don't care what the particular broken ARM platfrom code does. If it
can't pass resources in a normal way, it should be fixed, and not followed as a good example.
So fix these divers, then I will have no bad examples. I'll stay with board->irq_pin for now, moving to platform_resource could be done in separate patch (maybe with at91_cf and at91_ether).
Cheers
Stanislaw Gruszka
Hello.
Quoted 7 lines · Stanislaw Gruszka
Quoted 6 lines
drivers/ide/at91_ide.c line 449
Quoted 3 lines
drivers/ide/at91_ide.c new file +1
-0+ host->ports[0 ]->extra_base = board->chipselect;BTW, we have 2 fields in the struct
hwif_sthat fit this case better:config_dataandselect_data. It's a bit stange that you've selectedextra_base...
config_datais in use by IDE core,
Hm, it shouldn't be. These fields are exclusively for drivers' use.
MBR, Sergei
Friday 06 February 2009 11:36:44 Sergei Shtylyov napisał(a):
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
drivers/ide/at91_ide.c line 449
Quoted 3 lines
drivers/ide/at91_ide.c new file +1
-0+ host->ports[0 ]->extra_base = board->chipselect;BTW, we have 2 fields in the struct
hwif_sthat fit this case better:config_dataandselect_data. It's a bit stange that you've selectedextra_base...
config_datais in use by IDE core,Hm, it shouldn't be. These fields are exclusively for drivers' use.
Right, it is just overwritten in ide_init_port_hw() and should be setup by hw->config.
Stanislaw Gruszka
Quoted 10 lines · Hello, I wrote:
Quoted 5 lines
Can you answer the simple question: why we should try to support
two incompatible chips with a single driver? Because the driver name will be shorter? :-)Very funny. I think patch adding RM9200 support to this driver will have less than 50 lines changeset, whereas writing new driver would be about 500 lines.
This approach is so broken-minded that I'm just out words to argue
any more.
Let's then support say all the PCI IDE chipsets with the single
driver (actully, there was a driver that tried to support 2 incompatible Promise chip families but it got split finally).
To say the truth, there are stil at least 2 examples of such drivers:
hpt366 and aec6210. While the former is justified by the bogus chip identification poilicy used by the vendor, the latter has no justification at all.
MBR, Sergei
Quoted 20 lines · Sergei Shtylyov
Hello.
Quoted 16 lines · Bartlomiej Zolnierkiewicz
Quoted 15 lines
drivers/ide/at91_ide.c line 198
Quoted 13 lines
drivers/ide/at91_ide.c new file +11
-0+void at91_ide_tf_load (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; +u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ; + +if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ; + +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody ever used it.
Quoted 8 lines
Quoted 5 lines
It is there for
HDIO_DRIVE_TASKFILEioctl and I prefer not to break it.Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct
ide_tp_ops-- it should also help some other host drivers like tx493*.That would be extremely senseless activity sicne I believe this flag
is totally useless. I have better thing to do. :-)
I would love to remove this flag but it is used by user-space exposed interface (which was used by few drive vendors for their diagnostics tools -- doesn't matter whether internal or external) so you should put some technical arguments behind its removal (you know many of low-level technical details better than me so I may be missing something which is obvious to you).
OTOH while ->{read,write}_data approach would result in something like ~50 extra LOC (or even less with be_tp_ops) compared to removal it is completely safe and we don't need to spend a single second wondering about potential breakage (one day this ioctl will go away together with the flag and issue will solve itself).
Thanks,
Bart
Quoted 11 lines · Sergei Shtylyov
Quoted 9 lines · Hello, I wrote:
Quoted 8 lines
Can you answer the simple question: why we should try to support
two incompatible chips with a single driver? Because the driver name will be shorter? :-)Very funny. I think patch adding RM9200 support to this driver will have less
than 50 lines changeset, whereas writing new driver would be about 500 lines.
Quoted 6 lines
Quoted 6 lines
This approach is so broken-minded that I'm just out words to argue
any more.Let's then support say all the PCI IDE chipsets with the single
driver (actully, there was a driver that tried to support 2 incompatible Promise chip families but it got split finally).
Actually it was the case for Linux during early 2.4.x days. :)
[ Probably for historical reasons. ]
Quoted 2 lines
To say the truth, there are stil at least 2 examples of such drivers:
hpt366 and aec6210. While the former is justified by the bogus chip
The former can be probably still improved with hpt3xx_main.c and chipset family specific code separated into hpt36x.c etc.
Quoted 2 lines
identification poilicy used by the vendor, the latter has no justification at all.
Patches are always warmly welcomed.
Thanks,
Bart
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Can you answer the simple question: why we should try to support
two incompatible chips with a single driver? Because the driver name will be shorter? :-)Very funny. I think patch adding RM9200 support to this driver will have less than 50 lines changeset, whereas writing new driver would be about 500 lines.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
This approach is so broken-minded that I'm just out words to argue
any more.Let's then support say all the PCI IDE chipsets with the single
driver (actully, there was a driver that tried to support 2 incompatible Promise chip families but it got split finally).Actually it was the case for Linux during early 2.4.x days. :)
And I've spent considerable time fixing this driver in 2.4.20. :-)
Quoted 7 lines
[ Probably for historical reasons. ]
Quoted 2 lines
To say the truth, there are stil at least 2 examples of such drivers:
hpt366 and aec6210. While the former is justified by the bogus chipThe former can be probably still improved with
hpt3xx_main.cand chipset family specific code separated intohpt36x.cetc.
Don't think that there's even enough common code for hpt3xx_main.c.
Quoted 3 lines
Quoted 1 line
identification poilicy used by the vendor, the latter has no justification at all.
Patches are always warmly welcomed.
There is just to much I'd like to be done with this driver and too little
time to do that. :-)
Quoted 2 lines
Thanks,
Bart
MBR, Sergei
Hello.
Quoted 23 lines · Bartlomiej Zolnierkiewicz
Quoted 23 lines
Quoted 23 lines
Quoted 7 lines
Quoted 7 lines
drivers/ide/at91_ide.c new file +7
-0+void at91_ide_tf_load (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; +u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ; +Quoted 10 lines
drivers/ide/at91_ide.c line 198
Quoted 7 lines
drivers/ide/at91_ide.c new file +4
-0+if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ; + +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody ever used it.
It is there for
HDIO_DRIVE_TASKFILEioctl and I prefer not to break it.Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct
ide_tp_ops-- it should also help some other host drivers like tx493*.
Quoted 6 lines
Quoted 3 lines
That would be extremely senseless activity sicne I believe this flag
is totally useless. I have better thing to do. :-)I would love to remove this flag but it is used by user-space exposed interface
I know that...
Quoted 6 lines
(which was used by few drive vendors for their diagnostics tools -- doesn't matter whether internal or external) so you should put some technical arguments behind its removal (you know many of low-level technical details better than me so I may be missing something which is obvious to you).
Well, the vendors can do strange things, of course...
However, accessing the data register is certainly not a part of any
ATA/PI defined command's inputs/outputs (the corresponding tables just don't have this register). I suspect that this flag was added just "for completeness".
Quoted 4 lines
OTOH while ->{read,write}_data approach would result in something like ~50 extra LOC (or even less with
be_tp_ops) compared to removal it is completely safe and we don't need to spend a single second wondering about potential breakage
Go for it. ;-)
Quoted 3 lines
(one day this ioctl will go away together with
the flag and issue will solve itself).
I certainly can live with this feature in the meantime... :-) BTW, looks like libata has already dropped HDIO_DRIVE_TASKFILE ioctl.
Quoted 3 lines
Thanks,
Bart
MBR, Sergei
Quoted 40 lines · Hello, I wrote:
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
drivers/ide/at91_ide.c new file +6
-0+void at91_ide_tf_load (ide_drive_t *drive,ide_task_t *task) +{ +ide_hwif_t *hwif = drive->hwif; +struct ide_io_ports *io_ports = &hwif->io_ports; +struct ide_taskfile *tf = &task->tf; +u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ;Quoted 9 lines
drivers/ide/at91_ide.c line 198
Quoted 6 lines
drivers/ide/at91_ide.c new file +5
-0+ +if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ; + +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody
ever used it.It is there for
HDIO_DRIVE_TASKFILEioctl and I prefer not to break it.Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct
ide_tp_ops-- it should also help some other host drivers like tx493*.Quoted 6 lines
Quoted 3 lines
That would be extremely senseless activity sicne I believe this
flag is totally useless. I have better thing to do. :-)I would love to remove this flag but it is used by user-space exposed interface
I know that...
Quoted 6 lines
(which was used by few drive vendors for their diagnostics tools -- doesn't matter whether internal or external) so you should put some technical arguments behind its removal (you know many of low-level technical details better than me so I may be missing something which is obvious to you).
Well, the vendors can do strange things, of course...
However, accessing the data register is certainly not a part of any
ATA/PI defined command's inputs/outputs (the corresponding tables just don't have this register). I suspect that this flag was added just "for completeness".
Quoted 6 lines
Quoted 4 lines
OTOH while ->{read,write}_data approach would result in something like ~50 extra LOC (or even less with
be_tp_ops) compared to removal it is completely safe and we don't need to spend a single second wondering about potential breakageGo for it. ;-)
I think I have a better idea than creating another (useless) couple
of "transport" methods. Why not (ab)use the exisitng {in|out}put_data() methods instead? :-)
MBR, Sergei
Quoted 45 lines · Hello, I wrote:
Quoted 45 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +6
-0+void at91_ide_tf_load(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + struct ide_io_ports *io_ports = &hwif->io_ports; + struct ide_taskfile *tf = &task->tf; + u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+ + if (task->tf_flags & IDE_TFLAG_FLAGGED) + HIHI = 0xFF; + + if (task->tf_flags & IDE_TFLAG_OUT_DATA) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody
ever used it.It is there for
HDIO_DRIVE_TASKFILEioctl and I prefer not to break it.Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct
ide_tp_ops-- it should also help some other host drivers like tx493*.Quoted 6 lines
Quoted 3 lines
That would be extremely senseless activity sicne I believe this
flag is totally useless. I have better thing to do. :-)I would love to remove this flag but it is used by user-space exposed interface
I know that...
Quoted 6 lines
(which was used by few drive vendors for their diagnostics tools -- doesn't matter whether internal or external) so you should put some technical arguments behind its removal (you know many of low-level technical details better than me so I may be missing something which is obvious to you).
Well, the vendors can do strange things, of course...
However, accessing the data register is certainly not a part of any
ATA/PI defined command's inputs/outputs (the corresponding tables just don't have this register). I suspect that this flag was added just "for completeness".Quoted 4 lines
OTOH while ->{read,write}_data approach would result in something like ~50 extra LOC (or even less with
be_tp_ops) compared to removal it is completely safe and we don't need to spend a single second wondering about potential breakage
Quoted 4 lines
Quoted 1 line
Go for it. ;-)
I think I have a better idea than creating another (useless) couple
of "transport" methods. Why not (ab)use the exisitng {in|out}put_data() methods instead? :-)
Besides, those methods are clearly subject to some size
optimization... I'll cook up a patch while I'm at it. :-)
MBR, Sergei
Quoted 52 lines · Sergei Shtylyov
Quoted 50 lines · Hello, I wrote:
Quoted 50 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +6
-0+void at91_ide_tf_load(ide_drive_t *drive, ide_task_t *task) +{ + ide_hwif_t *hwif = drive->hwif; + struct ide_io_ports *io_ports = &hwif->io_ports; + struct ide_taskfile *tf = &task->tf; + u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+ + if (task->tf_flags & IDE_TFLAG_FLAGGED) + HIHI = 0xFF; + + if (task->tf_flags & IDE_TFLAG_OUT_DATA) {Sigh. Bart, couldn't we drop that stupid flag? I bet nobody
ever used it.It is there for
HDIO_DRIVE_TASKFILEioctl and I prefer not to break it.Just add ->{read,write}_data methods for IDE_TFLAG_{IN,OUT}_DATA to struct
ide_tp_ops-- it should also help some other host drivers like tx493*.Quoted 6 lines
Quoted 3 lines
That would be extremely senseless activity sicne I believe this
flag is totally useless. I have better thing to do. :-)I would love to remove this flag but it is used by user-space exposed interface
I know that...
Quoted 6 lines
(which was used by few drive vendors for their diagnostics tools -- doesn't matter whether internal or external) so you should put some technical arguments behind its removal (you know many of low-level technical details better than me so I may be missing something which is obvious to you).
Well, the vendors can do strange things, of course... However, accessing the data register is certainly not a part of any
ATA/PI defined command's inputs/outputs (the corresponding tables just don't have this register). I suspect that this flag was added just "for completeness".Quoted 4 lines
OTOH while ->{read,write}_data approach would result in something like ~50 extra LOC (or even less with
be_tp_ops) compared to removal it is completely safe and we don't need to spend a single second wondering about potential breakage
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Go for it. ;-)
I think I have a better idea than creating another (useless) couple
of "transport" methods. Why not (ab)use the exisitng {in|out}put_data() methods instead? :-)
Good idea.
Quoted 2 lines
Besides, those methods are clearly subject to some size
optimization... I'll cook up a patch while I'm at it. :-)
:)