e1e417a5580d1f99bc4324ca47ee9268d6fd565c
[openwrt/svn-archive/archive.git] / target / linux / rb532 / patches-2.6.28 / 004-fix_pata_rb532_cf.patch
1 After applying the following changes I could verify functionality by
2 mounting a filesystem on the cfdisk and reading/writing files in it.
3
4 The set_irq_type() function must be wrong, as there is no set_type()
5 function defined for the rb532 IRQ chip. But as the used IRQ actually is
6 being triggered by a GPIO, setting it's interrupt level should be the
7 right alternative. Also to clear a GPIO triggered IRQ, the source has to
8 be cleared. This is being done at the end of rb532_pata_irq_handler.
9
10 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
11 Acked-by: Florian Fainelli <florian@openwrt.org>
12 ---
13 --- a/drivers/ata/pata_rb532_cf.c
14 +++ b/drivers/ata/pata_rb532_cf.c
15 @@ -31,6 +31,7 @@
16 #include <scsi/scsi_host.h>
17
18 #include <asm/gpio.h>
19 +#include <asm/mach-rc32434/gpio.h>
20
21 #define DRV_NAME "pata-rb532-cf"
22 #define DRV_VERSION "0.1.0"
23 @@ -63,8 +64,8 @@ static inline void rb532_pata_finish_io(
24 ata_sff_sync might be sufficient. */
25 ata_sff_dma_pause(ap);
26 ndelay(RB500_CF_IO_DELAY);
27 -
28 - set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
29 +
30 + rb532_gpio_set_ilevel(1, info->gpio_line);
31 }
32
33 static void rb532_pata_exec_command(struct ata_port *ap,
34 @@ -113,13 +114,15 @@ static irqreturn_t rb532_pata_irq_handle
35 struct rb532_cf_info *info = ah->private_data;
36
37 if (gpio_get_value(info->gpio_line)) {
38 - set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW);
39 + rb532_gpio_set_ilevel(0, info->gpio_line);
40 if (!info->frozen)
41 ata_sff_interrupt(info->irq, dev_instance);
42 } else {
43 - set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
44 + rb532_gpio_set_ilevel(1, info->gpio_line);
45 }
46
47 + rb532_gpio_set_istat(0, info->gpio_line);
48 +
49 return IRQ_HANDLED;
50 }
51