aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_platform.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-04-17 10:44:08 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 14:16:06 -0400
commit5d728824efeda61d304153bfcf1378a3c18b7d70 (patch)
tree8a3d4ba0c1c650da5c161f11155e7c19f0fe78aa /drivers/ata/pata_platform.c
parent4447d35156169cf136e829eb6b5cac2d6370f2d9 (diff)
libata: convert the remaining PATA drivers to new init model
Convert pdc_adma, pata_cs5520, pata_isapnp, pata_ixp4xx_cf, pata_legacy, pata_mpc52xx, pata_mpiix, pata_pcmcia, pata_pdc2027x, pata_platform, pata_qdi, pata_scc and pata_winbond to new init model. * init_one()'s now follow more consistent init order * cs5520 now registers one host with two ports, not two hosts. If any of the two ports are disabled, it's made dummy as other drivers do. Tested pdc_adma and pata_legacy. Both are as broken as before. The rest are compile tested only. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_platform.c')
-rw-r--r--drivers/ata/pata_platform.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 507eb1ee05f8..a0a650c7f272 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -87,7 +87,6 @@ static struct ata_port_operations pata_platform_port_ops = {
87 87
88 .data_xfer = ata_data_xfer_noirq, 88 .data_xfer = ata_data_xfer_noirq,
89 89
90 .irq_handler = ata_interrupt,
91 .irq_clear = ata_bmdma_irq_clear, 90 .irq_clear = ata_bmdma_irq_clear,
92 .irq_on = ata_irq_on, 91 .irq_on = ata_irq_on,
93 .irq_ack = ata_irq_ack, 92 .irq_ack = ata_irq_ack,
@@ -136,7 +135,8 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
136static int __devinit pata_platform_probe(struct platform_device *pdev) 135static int __devinit pata_platform_probe(struct platform_device *pdev)
137{ 136{
138 struct resource *io_res, *ctl_res; 137 struct resource *io_res, *ctl_res;
139 struct ata_probe_ent ae; 138 struct ata_host *host;
139 struct ata_port *ap;
140 unsigned int mmio; 140 unsigned int mmio;
141 141
142 /* 142 /*
@@ -176,44 +176,41 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
176 /* 176 /*
177 * Now that that's out of the way, wire up the port.. 177 * Now that that's out of the way, wire up the port..
178 */ 178 */
179 memset(&ae, 0, sizeof(struct ata_probe_ent)); 179 host = ata_host_alloc(&pdev->dev, 1);
180 INIT_LIST_HEAD(&ae.node); 180 if (!host)
181 ae.dev = &pdev->dev; 181 return -ENOMEM;
182 ae.port_ops = &pata_platform_port_ops; 182 ap = host->ports[0];
183 ae.sht = &pata_platform_sht; 183
184 ae.n_ports = 1; 184 ap->ops = &pata_platform_port_ops;
185 ae.pio_mask = pio_mask; 185 ap->pio_mask = pio_mask;
186 ae.irq = platform_get_irq(pdev, 0); 186 ap->flags |= ATA_FLAG_SLAVE_POSS;
187 ae.irq_flags = 0;
188 ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST;
189 187
190 /* 188 /*
191 * Handle the MMIO case 189 * Handle the MMIO case
192 */ 190 */
193 if (mmio) { 191 if (mmio) {
194 ae.port[0].cmd_addr = devm_ioremap(&pdev->dev, io_res->start, 192 ap->ioaddr.cmd_addr = devm_ioremap(&pdev->dev, io_res->start,
195 io_res->end - io_res->start + 1); 193 io_res->end - io_res->start + 1);
196 ae.port[0].ctl_addr = devm_ioremap(&pdev->dev, ctl_res->start, 194 ap->ioaddr.ctl_addr = devm_ioremap(&pdev->dev, ctl_res->start,
197 ctl_res->end - ctl_res->start + 1); 195 ctl_res->end - ctl_res->start + 1);
198 } else { 196 } else {
199 ae.port[0].cmd_addr = devm_ioport_map(&pdev->dev, io_res->start, 197 ap->ioaddr.cmd_addr = devm_ioport_map(&pdev->dev, io_res->start,
200 io_res->end - io_res->start + 1); 198 io_res->end - io_res->start + 1);
201 ae.port[0].ctl_addr = devm_ioport_map(&pdev->dev, ctl_res->start, 199 ap->ioaddr.ctl_addr = devm_ioport_map(&pdev->dev, ctl_res->start,
202 ctl_res->end - ctl_res->start + 1); 200 ctl_res->end - ctl_res->start + 1);
203 } 201 }
204 if (!ae.port[0].cmd_addr || !ae.port[0].ctl_addr) { 202 if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr) {
205 dev_err(&pdev->dev, "failed to map IO/CTL base\n"); 203 dev_err(&pdev->dev, "failed to map IO/CTL base\n");
206 return -ENOMEM; 204 return -ENOMEM;
207 } 205 }
208 206
209 ae.port[0].altstatus_addr = ae.port[0].ctl_addr; 207 ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr;
210 208
211 pata_platform_setup_port(&ae.port[0], pdev->dev.platform_data); 209 pata_platform_setup_port(&ap->ioaddr, pdev->dev.platform_data);
212 210
213 if (unlikely(ata_device_add(&ae) == 0)) 211 /* activate */
214 return -ENODEV; 212 return ata_host_activate(host, platform_get_irq(pdev, 0), ata_interrupt,
215 213 0, &pata_platform_sht);
216 return 0;
217} 214}
218 215
219/** 216/**