diff options
author | Tejun Heo <htejun@gmail.com> | 2007-04-17 10:44:08 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 14:16:06 -0400 |
commit | 5d728824efeda61d304153bfcf1378a3c18b7d70 (patch) | |
tree | 8a3d4ba0c1c650da5c161f11155e7c19f0fe78aa /drivers/ata/pata_qdi.c | |
parent | 4447d35156169cf136e829eb6b5cac2d6370f2d9 (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_qdi.c')
-rw-r--r-- | drivers/ata/pata_qdi.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index 44472641db28..27685ce63ceb 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -190,7 +190,6 @@ static struct ata_port_operations qdi6500_port_ops = { | |||
190 | 190 | ||
191 | .data_xfer = qdi_data_xfer, | 191 | .data_xfer = qdi_data_xfer, |
192 | 192 | ||
193 | .irq_handler = ata_interrupt, | ||
194 | .irq_clear = ata_bmdma_irq_clear, | 193 | .irq_clear = ata_bmdma_irq_clear, |
195 | .irq_on = ata_irq_on, | 194 | .irq_on = ata_irq_on, |
196 | .irq_ack = ata_irq_ack, | 195 | .irq_ack = ata_irq_ack, |
@@ -219,7 +218,6 @@ static struct ata_port_operations qdi6580_port_ops = { | |||
219 | 218 | ||
220 | .data_xfer = qdi_data_xfer, | 219 | .data_xfer = qdi_data_xfer, |
221 | 220 | ||
222 | .irq_handler = ata_interrupt, | ||
223 | .irq_clear = ata_bmdma_irq_clear, | 221 | .irq_clear = ata_bmdma_irq_clear, |
224 | .irq_on = ata_irq_on, | 222 | .irq_on = ata_irq_on, |
225 | .irq_ack = ata_irq_ack, | 223 | .irq_ack = ata_irq_ack, |
@@ -240,8 +238,9 @@ static struct ata_port_operations qdi6580_port_ops = { | |||
240 | 238 | ||
241 | static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast) | 239 | static __init int qdi_init_one(unsigned long port, int type, unsigned long io, int irq, int fast) |
242 | { | 240 | { |
243 | struct ata_probe_ent ae; | ||
244 | struct platform_device *pdev; | 241 | struct platform_device *pdev; |
242 | struct ata_host *host; | ||
243 | struct ata_port *ap; | ||
245 | void __iomem *io_addr, *ctl_addr; | 244 | void __iomem *io_addr, *ctl_addr; |
246 | int ret; | 245 | int ret; |
247 | 246 | ||
@@ -259,34 +258,31 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i | |||
259 | if (!io_addr || !ctl_addr) | 258 | if (!io_addr || !ctl_addr) |
260 | goto fail; | 259 | goto fail; |
261 | 260 | ||
262 | memset(&ae, 0, sizeof(struct ata_probe_ent)); | 261 | ret = -ENOMEM; |
263 | INIT_LIST_HEAD(&ae.node); | 262 | host = ata_host_alloc(&pdev->dev, 1); |
264 | ae.dev = &pdev->dev; | 263 | if (!host) |
264 | goto fail; | ||
265 | ap = host->ports[0]; | ||
265 | 266 | ||
266 | if (type == 6580) { | 267 | if (type == 6580) { |
267 | ae.port_ops = &qdi6580_port_ops; | 268 | ap->ops = &qdi6580_port_ops; |
268 | ae.pio_mask = 0x1F; | 269 | ap->pio_mask = 0x1F; |
269 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; | 270 | ap->flags |= ATA_FLAG_SLAVE_POSS; |
270 | } else { | 271 | } else { |
271 | ae.port_ops = &qdi6500_port_ops; | 272 | ap->ops = &qdi6500_port_ops; |
272 | ae.pio_mask = 0x07; /* Actually PIO3 !IORDY is possible */ | 273 | ap->pio_mask = 0x07; /* Actually PIO3 !IORDY is possible */ |
273 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | | 274 | ap->flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY; |
274 | ATA_FLAG_NO_IORDY; | ||
275 | } | 275 | } |
276 | 276 | ||
277 | ae.sht = &qdi_sht; | 277 | ap->ioaddr.cmd_addr = io_addr; |
278 | ae.n_ports = 1; | 278 | ap->ioaddr.altstatus_addr = ctl_addr; |
279 | ae.irq = irq; | 279 | ap->ioaddr.ctl_addr = ctl_addr; |
280 | ae.irq_flags = 0; | 280 | ata_std_ports(&ap->ioaddr); |
281 | ae.port[0].cmd_addr = io_addr; | ||
282 | ae.port[0].altstatus_addr = ctl_addr; | ||
283 | ae.port[0].ctl_addr = ctl_addr; | ||
284 | ata_std_ports(&ae.port[0]); | ||
285 | 281 | ||
286 | /* | 282 | /* |
287 | * Hook in a private data structure per channel | 283 | * Hook in a private data structure per channel |
288 | */ | 284 | */ |
289 | ae.private_data = &qdi_data[nr_qdi_host]; | 285 | ap->private_data = &qdi_data[nr_qdi_host]; |
290 | 286 | ||
291 | qdi_data[nr_qdi_host].timing = port; | 287 | qdi_data[nr_qdi_host].timing = port; |
292 | qdi_data[nr_qdi_host].fast = fast; | 288 | qdi_data[nr_qdi_host].fast = fast; |
@@ -294,8 +290,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i | |||
294 | 290 | ||
295 | printk(KERN_INFO DRV_NAME": qd%d at 0x%lx.\n", type, io); | 291 | printk(KERN_INFO DRV_NAME": qd%d at 0x%lx.\n", type, io); |
296 | 292 | ||
297 | ret = -ENODEV; | 293 | /* activate */ |
298 | if (!ata_device_add(&ae)) | 294 | ret = ata_host_activate(host, irq, ata_interrupt, 0, &qdi_sht); |
295 | if (ret) | ||
299 | goto fail; | 296 | goto fail; |
300 | 297 | ||
301 | qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev); | 298 | qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev); |