add PATA host controller support for Cirrus Logic's EP93xx CPUs
PATCH 1/1 add PATA host controller support for Cirrus Logic's EP93xx CPUs
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
---
Depends on "libata: add private driver field to struct ata_device" patch:
http://patchwork.kernel.org/patch/62926/
and also needs "ep93xx: enable/disable gpio pins for ide" one from:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/57688/focus=58730
( Could somebody please tell me if it has been merged already and/or
where one can find the version which applies to more recent kernels? )
Additionally arch/arm specific parts should probably be split from this patch before the final merge.
Sidenote:
I have neither the hardware nor much personal interest in adding support for it so I did it mainly cause:
- IDE host driver wasn't merged due to policy change and I hate seeing fair amount of review work from me & Sergei going into waste. :)
- I was curious about some claims I've been hearing recently so I decided to verify them in practice (porting the driver to libata was relatively easy but unfortunately in the process it gained almost 50% in the LOC count..).
so if somebody would like to take over this patch feel free to do it.
arch/arm/mach-ep93xx/core.c | 25 arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 1 arch/arm/mach-ep93xx/include/mach/platform.h | 1 drivers/ata/Kconfig | 13 drivers/ata/Makefile | 1 drivers/ata/pata_ep93xx.c | 765 ++++++++++++++++++++++++ 6 files changed, 806 insertions(+)
arch/arm/mach-ep93xx/core.c +25 -0
@@ -714,6 +714,31 @@ void __init ep93xx_register_fb(struct epplatform_device_register (&ep93xx_fb_device); } +static struct resource ep93xx_ide_resources[] = { + { + .start =EP93XX_IDE_PHYS_BASE , + .end =EP93XX_IDE_PHYS_BASE +0x37 , + .flags =IORESOURCE_MEM , + }, + { + .start =IRQ_EP93XX_EXT3 , + .end =IRQ_EP93XX_EXT3 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device ep93xx_ide_device = { + .name ="ep93xx-ide" , + .id =-1 , + .num_resources =ARRAY_SIZE (ep93xx_ide_resources), + .resource = ep93xx_ide_resources, +}; + +void __init ep93xx_register_ide (void ) +{ +platform_device_register (&ep93xx_ide_device); +} +extern void ep93xx_gpio_init (void );void __init ep93xx_init_devices (void )
arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +1 -0
@@ -82,6 +82,7 @@#define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000)#define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000) +#define EP93XX_IDE_PHYS_BASE (EP93XX_AHB_PHYS_BASE + 0x000a0000)#define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000)
arch/arm/mach-ep93xx/include/mach/platform.h +1 -0
@@ -32,6 +32,7 @@ static inline void ep93xx_devcfg_clear_bep93xx_devcfg_set_clear (0x00 , bits); } +void ep93xx_register_ide (void );void ep93xx_register_eth (struct ep93xx_eth_data *data,int copy_addr);void ep93xx_register_i2c (struct i2c_board_info *devices,int num);void ep93xx_register_fb (struct ep93xxfb_mach_info *data);
drivers/ata/Kconfig +13 -0
@@ -739,6 +739,19 @@ config PATA_OF_PLATFORM If unsure, say N. +config PATA_EP93XX + tristate "Cirrus Logic EPxx (EP9312, EP9315) PATA support (Experimental)" + depends on ARM && ARCH_EP93XXA && EXPERIMENTAL + help + This is a host controller driver for PATA hardware included in + Cirrus Logic's EP9312 and EP9315 CPUs. + + Say Y here if you want to enable the PATA host controller support + for your machine. + + Choose 'M' to compile this driver as a module; the module will be + called 'pata_ep93xx'. + config PATA_ICSIDE tristate "Acorn ICS PATA support" depends on ARM && ARCH_ACORN
drivers/ata/Makefile +1 -0
@@ -74,6 +74,7 @@ obj-$(CONFIG_PATA_OCTEON_CF) += pata_oct obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o obj-$(CONFIG_PATA_AT91) += pata_at91.o obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o +obj-$(CONFIG_PATA_EP93XX) += pata_ep93xx.o obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o # Should be last but two libata driver obj-$(CONFIG_PATA_ACPI) += pata_acpi.o
drivers/ata/pata_ep93xx.c new file +765 -0
765 lines not on this page · raw message
Quoted 12 lines
drivers/ata/pata_ep93xx.c new file +11
-0+static void pata_ep93xx_set_piomode (struct ata_port *ap, +struct ata_device *adev) +{ +void __iomem *base = ap->host->private_data; +struct ata_device *pair =ata_dev_pair (adev); +const struct ata_timing *t =ata_timing_find_mode (adev->pio_mode); +const struct ata_timing *cmd_t = t; +u32 reg =IDECFG_IDEEN |IDECFG_PIO ; +u8 pio = adev->pio_mode -XFER_PIO_0 ; + +if (pair && pair->pio_mode < adev->pio_mode)
drivers/ata/pata_ep93xx.c line 136
Quoted 10 lines
drivers/ata/pata_ep93xx.c new file +10
-0+ cmd_t =ata_timing_find_mode (pair->pio_mode); + +/* +* store the adequate PIO mode timings, to be used later +* by pata_ep93xx_{read,write} +*/ + adev->private_data = (void *)t; + ap->private_data = (void *)cmd_t; + +/* reconfigure IDE controller according to PIO mode (?) */
This would probably be better in both drivers as a simple table. It would then not be a switch but collapse the entire pile into a single
writel(pio_timing[pio], base + IDECFG);
drivers/ata/pata_ep93xx.c line 198
Quoted 8 lines
drivers/ata/pata_ep93xx.c new file +8
-0+static u16 __pata_ep93xx_read (void __iomem *base,void *addr, +struct ata_timing *t) +{ +u32 reg; + + reg = (unsigned long )addr |IDECTRL_DIORN |IDECTRL_DIOWN ; +writel (reg, base +IDECTRL ); +ndelay (t->setup);
This implies a bus with no posting, which seems to the case from the other driver code.
Review
Quoted 2 lines
(quoted diff) +2
-0+ while (!pata_ep93xx_check_iordy(base)) + cpu_relax();
And if the drive was hot unplugged this is doom incorporated (plus we might not be using an IORDY mode.
Review
Quoted 3 lines
(quoted diff) +2
-0+ while (!pata_ep93xx_check_iordy(base)) + cpu_relax();
Ditto
I don't see anything wrong in the conversion.
The size thing is true - libata tried to abstract at a higher level which in turn avoids lots of computed branches to one liners and lets the compiler inline stuff better (eg all the private read/write methods into a single call free tf_* etc). It could I guess provide an "awkward case" skeleton tf_* and other sets of functions that were passed inb/outb ops. One for Jeff to ponder ?
Alan
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
Sidenote:
I have neither the hardware nor much personal interest in adding support for it so I did it mainly cause:
Quoted 8 lines
- IDE host driver wasn't merged due to policy change and I hate seeing fair amount of review work from me & Sergei going into waste. :)
- I was curious about some claims I've been hearing recently so I decided to verify them in practice (porting the driver to libata was relatively easy but unfortunately in the process it gained almost 50% in the LOC count..).
so if somebody would like to take over this patch feel free to do it.
Thanks for doing this. I'll see if I can dig out a hard-drive and give this a test. I had some comments, but I will fix them up myself if I get round to testing this.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
PATCH 1/1 add PATA host controller support for Cirrus Logic's EP93xx CPUs
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091126/0e7396e4/attachment-0001.htm>
Quoted 3 lines · Bartlomiej Zolnierkiewicz
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
Hi Bartlomiej,
I have got as far as patching this into my kernel and doing a build test (still need to find a hard-disk to test). I got some build errors, see below:
Quoted 9 lines
drivers/ata/pata_ep93xx.c new file +9
-0+static void pata_ep93xx_set_piomode (struct ata_port *ap, +struct ata_device *adev) +{ +void __iomem *base = ap->host->private_data; +struct ata_device *pair =ata_dev_pair (adev); +const struct ata_timing *t =ata_timing_find_mode (adev->pio_mode); +const struct ata_timing *cmd_t = t; +u32 reg =IDECFG_IDEEN |IDECFG_PIO ; +u8 pio = adev->pio_mode -XFER_PIO_0 ;
drivers/ata/pata_ep93xx.c line 134
Quoted 10 lines
drivers/ata/pata_ep93xx.c new file +10
-0+ +if (pair && pair->pio_mode < adev->pio_mode) + cmd_t =ata_timing_find_mode (pair->pio_mode); + +/* +* store the adequate PIO mode timings, to be used later +* by pata_ep93xx_{read,write} +*/ + adev->private_data = (void *)t; + ap->private_data = (void *)cmd_t;
struct ata_device has no member called private_data. Do we need to store both t and cmd_t, or can we just store cmd_t in ap->private_data?
If we need both, can we have something like this (not sure if the member names are sensible):
struct ep93xx_ata_timing {
struct ata_timing *dev_timing;
struct ata_timing *pair_timing;
};and store that struct in ap?
drivers/ata/pata_ep93xx.c line 386
Quoted 8 lines
drivers/ata/pata_ep93xx.c new file +8
-0+unsigned int pata_ep93xx_data_xfer (struct ata_device *adev,unsigned char *buf, +unsigned int buflen,int rw) +{ +struct ata_port *ap = adev->link->ap; +void __iomem *base = ap->host->private_data; +void *data_addr = ap->ioaddr.data_addr; +u16 *data = (u16 *)buf; +struct ata_timing *t = adev->private_data;
This is the only place that uses the ata_timing structure stored in adev->private_data, can this be changed to:
struct ata_timing *t = ap->private_data;
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 10 lines · Ryan Mallon
Quoted 3 lines · Bartlomiej Zolnierkiewicz
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
Hi Bartlomiej,
I have got as far as patching this into my kernel and doing a build test (still need to find a hard-disk to test). I got some build errors, see below:
Hi,
Many thanks for picking this driver up.
The following preparatory libata one-liner is needed to make it build:
http://patchwork.kernel.org/patch/62926/
and you may also need to update ep93xx ide gpio patch:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/57688/focus=58730
to current kernels to make the hardware work.
--
Bartlomiej Zolnierkiewicz
Quoted 18 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Ryan Mallon
Quoted 3 lines · Bartlomiej Zolnierkiewicz
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
Hi Bartlomiej,
I have got as far as patching this into my kernel and doing a build test (still need to find a hard-disk to test). I got some build errors, see below:
Hi,
Many thanks for picking this driver up.
The following preparatory libata one-liner is needed to make it build:
Quoted 7 lines
http://patchwork.kernel.org/patch/62926/and you may also need to update ep93xx ide gpio patch:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/57688/focus=58730to current kernels to make the hardware work.
Ryan,
I updated the core parts of this patch with the ide gpio stuff. This will patch cleanly to 2.6.32-rc8 but will have problems after the 2.6.33 merge due to the core keypad support already in Russell's tree.
But, for what it's worth....
---
arch/arm/mach-ep93xx/core.c +85 -0
@@ -728,6 +728,91 @@ void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data)platform_device_register (&ep93xx_fb_device); } + +/************************************************************************* +* EP93xx ide peripheral handling +*************************************************************************/ +static struct resource ep93xx_ide_resources[] = { + { + .start =EP93XX_IDE_PHYS_BASE , + .end =EP93XX_IDE_PHYS_BASE +0x38 -1 , + .flags =IORESOURCE_MEM , + }, + { + .start =IRQ_EP93XX_EXT3 , + .end =IRQ_EP93XX_EXT3 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device ep93xx_ide_device = { + .name ="ep93xx-ide" , + .id =-1 , + .num_resources =ARRAY_SIZE (ep93xx_ide_resources), + .resource = ep93xx_ide_resources, +}; + +void __init ep93xx_register_ide (void ) +{ +platform_device_register (&ep93xx_ide_device); +} + +int ep93xx_ide_aquire_gpio (struct platform_device *pdev) +{ +int i, err; + +for (i =0 ; i <8 ; i++) { + err =gpio_request (EP93XX_GPIO_LINE_E (i), +dev_name (&pdev->dev)); +if (err) + goto fail_gpio_e; + err =gpio_request (EP93XX_GPIO_LINE_F (i), +dev_name (&pdev->dev)); +if (err) + goto fail_gpio_f; + err =gpio_request (EP93XX_GPIO_LINE_G (i), +dev_name (&pdev->dev)); +if (err) + goto fail_gpio_g; + } + +ep93xx_devcfg_clear_bits (EP93XX_SYSCON_DEVCFG_EONIDE | +EP93XX_SYSCON_DEVCFG_GONIDE | +EP93XX_SYSCON_DEVCFG_HONIDE ); + +return 0 ; + +fail_gpio_g: +gpio_free (EP93XX_GPIO_LINE_F (i)); +fail_gpio_f: +gpio_free (EP93XX_GPIO_LINE_E (i)); +fail_gpio_e: +for ( ; i >=0 ; --i) { +gpio_free (EP93XX_GPIO_LINE_E (i)); +gpio_free (EP93XX_GPIO_LINE_F (i)); +gpio_free (EP93XX_GPIO_LINE_G (i)); + } +return err; +} +EXPORT_SYMBOL (ep93xx_ide_aquire_gpio); + +void ep93xx_ide_release_gpio (struct platform_device *pdev) +{ +int i; + +for (i =0 ; i <8 ; i++) { +gpio_free (EP93XX_GPIO_LINE_E (i)); +gpio_free (EP93XX_GPIO_LINE_F (i)); +gpio_free (EP93XX_GPIO_LINE_G (i)); + } + +ep93xx_devcfg_set_bits (EP93XX_SYSCON_DEVCFG_EONIDE | +EP93XX_SYSCON_DEVCFG_GONIDE | +EP93XX_SYSCON_DEVCFG_HONIDE ); +} +EXPORT_SYMBOL (ep93xx_ide_release_gpio); + +extern void ep93xx_gpio_init (void );void __init ep93xx_init_devices (void )
arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +1 -0
@@ -83,6 +83,7 @@#define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000) +#define EP93XX_IDE_PHYS_BASE EP93XX_AHB_PHYS(0x000a0000)#define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000)#define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000)
arch/arm/mach-ep93xx/include/mach/platform.h +3 -0
@@ -39,6 +39,9 @@ void ep93xx_register_fb(struct ep93xxfb_mach_info *data);void ep93xx_register_pwm (int pwm0,int pwm1);int ep93xx_pwm_acquire_gpio (struct platform_device *pdev);void ep93xx_pwm_release_gpio (struct platform_device *pdev); +void ep93xx_register_ide (void ); +int ep93xx_ide_aquire_gpio (struct platform_device *pdev); +void ep93xx_ide_release_gpio (struct platform_device *pdev);void ep93xx_init_devices (void );extern struct sys_timer ep93xx_timer;
Quoted 25 lines · H Hartley Sweeten
Quoted 16 lines · Bartlomiej Zolnierkiewicz
Quoted 9 lines · Ryan Mallon
Quoted 3 lines · Bartlomiej Zolnierkiewicz
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
Hi Bartlomiej,
I have got as far as patching this into my kernel and doing a build test (still need to find a hard-disk to test). I got some build errors, see below:
Hi,
Many thanks for picking this driver up.
The following preparatory libata one-liner is needed to make it build:
Quoted 7 lines
http://patchwork.kernel.org/patch/62926/and you may also need to update ep93xx ide gpio patch:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/57688/focus=58730to current kernels to make the hardware work.
Quoted 7 lines
Ryan,
I updated the core parts of this patch with the ide gpio stuff. This will patch cleanly to 2.6.32-rc8 but will have problems after the 2.6.33 merge due to the core keypad support already in Russell's tree.
But, for what it's worth....
Thanks. I had planned reposting this as a patch series for the driver and the core stuff once I get it working. At my current pace, I think it will be after 2.6.33 :-).
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · Ryan Mallon
Quoted 4 lines · Bartlomiej Zolnierkiewicz
Based on the older IDE host driver by Joao Ramos and review comments for it from Sergei Shtylyov. Not yet tested with the real hardware.
Hi Bartlomiej,
Quoted 9 lines
Quoted 4 lines
I have got as far as patching this into my kernel and doing a build test (still need to find a hard-disk to test). I got some build errors, see below:
Hi,
Many thanks for picking this driver up.
Okay, it now patches in cleanly. However, I get the following crash on boot:
ep93xx-ide ep93xx-ide: EP93xx PATA host controller driver initialized
ep93xx-ide: __pata_ep93xx_write - base = ce070000, value = a, addr = 1, t = 0
Unable to handle kernel NULL pointer dereference at virtual address 00000002 pgd = c0004000 [00000002] *pgd=00000000 Internal error: Oops: 5 [#1] last sysfs file: Modules linked in: CPU: 0 Not tainted (2.6.32-06794-g17ded11-dirty #544) PC is at __pata_ep93xx_write+0x38/0xc4 LR is at __pata_ep93xx_write+0x34/0xc4 pc : [<c0189dac>] lr : [<c0189da8>] psr: 60000093
sp : cd017e70 ip : 00000c3b fp : 00000000
r10: cd12a754 r9 : c0351140 r8 : 00000000
r7 : 00000000 r6 : ce070000 r5 : 0000000a r4 : 00000061 r3 : ce070000 r2 : cd017e64 r1 : c0301bda r0 : 00000054
Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: c000717f Table: c0004000 DAC: 00000017
Process swapper (pid: 1, stack limit = 0xcd016270)
Stack: (0xcd017e70 to 0xcd018000)
7e60: 00000001 00000000 00000001 cd124000
7e80: cd124000 00000000 00000000 c018a148 cd124000 c018180c a0000013 c0181918 7ea0: cd12a750 cd124000 00000000 c01772fc cd12a750 00000028 c0187e6c c0351140 7ec0: c0344220 cd12a750 00000028 c0187e6c 00000000 c0177edc cd12a750 00000028 7ee0: c0187e6c 00000000 c0351140 c0344220 c0344218 ce070000 cd12a750 00000028 7f00: c0344e68 c0014508 c0351140 00000000 c0344220 c0344220 c0351024 cd12a7a0 7f20: c0350428 00000000 00000000 c0164904 c0344220 c0163a78 c0344220 c0344254 7f40: c0351024 cd12a7a0 c0350428 c0163b88 00000000 c0163b2c c0351024 c0163330 7f60: cd0084a8 cd00fb40 c001b3dc c0351024 c0351024 c0162c48 c02e4755 c02e4755 7f80: ffffffff c001b3dc c0351010 c0351024 c0014354 00000000 00000000 c0163e54 7fa0: c001b3dc c0351010 00000000 c0014354 00000000 c0164bec c001b3dc 00000000 7fc0: 00000000 c002038c c0014354 00000000 c035d740 c001b494 c001b3dc 00000000 7fe0: 00000000 00000000 00000000 c0008578 00000000 c0021ea0 c504c134 c504c136 [<c0189dac>] (__pata_ep93xx_write+0x38/0xc4) from [<c018a148>] (pata_ep93xx_freeze+0x40/0x6c) [<c018a148>] (pata_ep93xx_freeze+0x40/0x6c) from [<c018180c>] (__ata_port_freeze+0x38/0x50) [<c018180c>] (__ata_port_freeze+0x38/0x50) from [<c0181918>] (ata_eh_freeze_port+0x2c/0x3c) [<c0181918>] (ata_eh_freeze_port+0x2c/0x3c) from [<c01772fc>] (ata_host_start+0x12c/0x1a4) [<c01772fc>] (ata_host_start+0x12c/0x1a4) from [<c0177edc>] (ata_host_activate+0x1c/0xe8) [<c0177edc>] (ata_host_activate+0x1c/0xe8) from [<c0014508>] (pata_ep93xx_probe+0x1a0/0x1c8) [<c0014508>] (pata_ep93xx_probe+0x1a0/0x1c8) from [<c0164904>] (platform_drv_probe+0x18/0x1c) [<c0164904>] (platform_drv_probe+0x18/0x1c) from [<c0163a78>] (driver_probe_device+0xa8/0x15c) [<c0163a78>] (driver_probe_device+0xa8/0x15c) from [<c0163b88>] (__driver_attach+0x5c/0x7c) [<c0163b88>] (__driver_attach+0x5c/0x7c) from [<c0163330>] (bus_for_each_dev+0x48/0x78) [<c0163330>] (bus_for_each_dev+0x48/0x78) from [<c0162c48>] (bus_add_driver+0x9c/0x220) [<c0162c48>] (bus_add_driver+0x9c/0x220) from [<c0163e54>] (driver_register+0xa4/0x130) [<c0163e54>] (driver_register+0xa4/0x130) from [<c0164bec>] (platform_driver_probe+0x18/0x8c) [<c0164bec>] (platform_driver_probe+0x18/0x8c) from [<c002038c>] (do_one_initcall+0x5c/0x1b4) [<c002038c>] (do_one_initcall+0x5c/0x1b4) from [<c0008578>] (kernel_init+0x94/0x10c) [<c0008578>] (kernel_init+0x94/0x10c) from [<c0021ea0>] (kernel_thread_exit+0x0/0x8)
Code: e58dc000 e58d7004 eb03cb2e e5864000 (e1d700b2) ---[ end trace ed0490e29e490c57 ]---
I have added some of my own debugging. The problem appears to be that __pata_ep93xx_write gets called from probe (via ata_host_activate), but ap->private_data (ata_timing) is still null. The timing private_data is set by pata_ep93xx_set_piomode, but that needs adev->pio_mode set, but I don't know where this happens. I assume the ATA core handles this. Do I need to call pata_ep93xx_set_piomode from pata_ep93xx_probe before ata_host_activate, or should the private_data timing be set to some default in the probe?
Thanks,
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 8 lines · Ryan Mallon
I have added some of my own debugging. The problem appears to be that
__pata_ep93xx_writegets called from probe (viaata_host_activate), butap->private_data(ata_timing) is still null. The timingprivate_datais set bypata_ep93xx_set_piomode, but that needsadev->pio_modeset, but I don't know where this happens. I assume the ATA core handles this. Do I need to callpata_ep93xx_set_piomodefrompata_ep93xx_probebeforeata_host_activate, or should theprivate_datatiming be set to some default in the probe?
ap->private_data is traditionally initialized in the ->port_start() hook.
Likely, you should follow other drivers and allocate a useful data structure containing useful default values, which can then be adjusted in other hooks such as ->set_dmamode() or ->set_piomode()
Jeff
Quoted 11 lines · Jeff Garzik
Quoted 8 lines · Ryan Mallon
I have added some of my own debugging. The problem appears to be that
__pata_ep93xx_writegets called from probe (viaata_host_activate), butap->private_data(ata_timing) is still null. The timingprivate_datais set bypata_ep93xx_set_piomode, but that needsadev->pio_modeset, but I don't know where this happens. I assume the ATA core handles this. Do I need to callpata_ep93xx_set_piomodefrompata_ep93xx_probebeforeata_host_activate, or should theprivate_datatiming be set to some default in the probe?
Quoted 1 line
ap->private_datais traditionally initialized in the ->port_start() hook.
Ryan, this incremental patch should fix the OOPS (it adds ->port_start implementation which sets the default 'port PIO mode' to PIO0 so we have sane default setting before device probing takes place and ->set_piomode takes over), please retest the driver once you have a minute..
[ Thanks for debugging the problem and sorry for the delay.. ]
--- drivers/ata/pata_ep93xx.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/ata/pata_ep93xx.c +11 -0
@@ -613,6 +613,15 @@ static void pata_ep93xx_postreset(struct } } +static int pata_ep93xx_port_start (struct ata_port *ap) +{ +const struct ata_timing *cmd_t =ata_timing_find_mode (XFER_PIO_0 ); + + ap->private_data = (void *)cmd_t; + +return ata_sff_port_start (ap); +} +static struct ata_port_operations pata_ep93xx_port_ops = { .inherits = &ata_sff_port_ops,
@@ -631,6 +640,8 @@ static struct ata_port_operations pata_e .freeze = pata_ep93xx_freeze, .softreset = pata_ep93xx_softreset, .postreset = pata_ep93xx_postreset, + + .port_start = pata_ep93xx_port_start, };static int __init pata_ep93xx_probe (struct platform_device *pdev)