diff options
Diffstat (limited to 'drivers/ata/pata_rb532_cf.c')
-rw-r--r-- | drivers/ata/pata_rb532_cf.c | 64 |
1 files changed, 4 insertions, 60 deletions
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c index ebfcda26d639..8e3cdef8a25f 100644 --- a/drivers/ata/pata_rb532_cf.c +++ b/drivers/ata/pata_rb532_cf.c | |||
@@ -48,63 +48,11 @@ | |||
48 | struct rb532_cf_info { | 48 | struct rb532_cf_info { |
49 | void __iomem *iobase; | 49 | void __iomem *iobase; |
50 | unsigned int gpio_line; | 50 | unsigned int gpio_line; |
51 | int frozen; | ||
52 | unsigned int irq; | 51 | unsigned int irq; |
53 | }; | 52 | }; |
54 | 53 | ||
55 | /* ------------------------------------------------------------------------ */ | 54 | /* ------------------------------------------------------------------------ */ |
56 | 55 | ||
57 | static inline void rb532_pata_finish_io(struct ata_port *ap) | ||
58 | { | ||
59 | struct ata_host *ah = ap->host; | ||
60 | struct rb532_cf_info *info = ah->private_data; | ||
61 | |||
62 | /* FIXME: Keep previous delay. If this is merely a fence then | ||
63 | ata_sff_sync might be sufficient. */ | ||
64 | ata_sff_dma_pause(ap); | ||
65 | ndelay(RB500_CF_IO_DELAY); | ||
66 | } | ||
67 | |||
68 | static void rb532_pata_exec_command(struct ata_port *ap, | ||
69 | const struct ata_taskfile *tf) | ||
70 | { | ||
71 | writeb(tf->command, ap->ioaddr.command_addr); | ||
72 | rb532_pata_finish_io(ap); | ||
73 | } | ||
74 | |||
75 | static unsigned int rb532_pata_data_xfer(struct ata_device *adev, unsigned char *buf, | ||
76 | unsigned int buflen, int write_data) | ||
77 | { | ||
78 | struct ata_port *ap = adev->link->ap; | ||
79 | void __iomem *ioaddr = ap->ioaddr.data_addr; | ||
80 | int retlen = buflen; | ||
81 | |||
82 | if (write_data) { | ||
83 | for (; buflen > 0; buflen--, buf++) | ||
84 | writeb(*buf, ioaddr); | ||
85 | } else { | ||
86 | for (; buflen > 0; buflen--, buf++) | ||
87 | *buf = readb(ioaddr); | ||
88 | } | ||
89 | |||
90 | rb532_pata_finish_io(adev->link->ap); | ||
91 | return retlen; | ||
92 | } | ||
93 | |||
94 | static void rb532_pata_freeze(struct ata_port *ap) | ||
95 | { | ||
96 | struct rb532_cf_info *info = ap->host->private_data; | ||
97 | |||
98 | info->frozen = 1; | ||
99 | } | ||
100 | |||
101 | static void rb532_pata_thaw(struct ata_port *ap) | ||
102 | { | ||
103 | struct rb532_cf_info *info = ap->host->private_data; | ||
104 | |||
105 | info->frozen = 0; | ||
106 | } | ||
107 | |||
108 | static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance) | 56 | static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance) |
109 | { | 57 | { |
110 | struct ata_host *ah = dev_instance; | 58 | struct ata_host *ah = dev_instance; |
@@ -112,8 +60,7 @@ static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance) | |||
112 | 60 | ||
113 | if (gpio_get_value(info->gpio_line)) { | 61 | if (gpio_get_value(info->gpio_line)) { |
114 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); | 62 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); |
115 | if (!info->frozen) | 63 | ata_sff_interrupt(info->irq, dev_instance); |
116 | ata_sff_interrupt(info->irq, dev_instance); | ||
117 | } else { | 64 | } else { |
118 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | 65 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); |
119 | } | 66 | } |
@@ -123,10 +70,7 @@ static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance) | |||
123 | 70 | ||
124 | static struct ata_port_operations rb532_pata_port_ops = { | 71 | static struct ata_port_operations rb532_pata_port_ops = { |
125 | .inherits = &ata_sff_port_ops, | 72 | .inherits = &ata_sff_port_ops, |
126 | .sff_exec_command = rb532_pata_exec_command, | 73 | .sff_data_xfer = ata_sff_data_xfer32, |
127 | .sff_data_xfer = rb532_pata_data_xfer, | ||
128 | .freeze = rb532_pata_freeze, | ||
129 | .thaw = rb532_pata_thaw, | ||
130 | }; | 74 | }; |
131 | 75 | ||
132 | /* ------------------------------------------------------------------------ */ | 76 | /* ------------------------------------------------------------------------ */ |
@@ -145,7 +89,7 @@ static void rb532_pata_setup_ports(struct ata_host *ah) | |||
145 | ap = ah->ports[0]; | 89 | ap = ah->ports[0]; |
146 | 90 | ||
147 | ap->ops = &rb532_pata_port_ops; | 91 | ap->ops = &rb532_pata_port_ops; |
148 | ap->pio_mask = 0x1f; /* PIO4 */ | 92 | ap->pio_mask = ATA_PIO4; |
149 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; | 93 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; |
150 | 94 | ||
151 | ap->ioaddr.cmd_addr = info->iobase + RB500_CF_REG_BASE; | 95 | ap->ioaddr.cmd_addr = info->iobase + RB500_CF_REG_BASE; |
@@ -160,7 +104,7 @@ static void rb532_pata_setup_ports(struct ata_host *ah) | |||
160 | 104 | ||
161 | static __devinit int rb532_pata_driver_probe(struct platform_device *pdev) | 105 | static __devinit int rb532_pata_driver_probe(struct platform_device *pdev) |
162 | { | 106 | { |
163 | unsigned int irq; | 107 | int irq; |
164 | int gpio; | 108 | int gpio; |
165 | struct resource *res; | 109 | struct resource *res; |
166 | struct ata_host *ah; | 110 | struct ata_host *ah; |