diff options
author | Tejun Heo <htejun@gmail.com> | 2007-02-01 01:06:36 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:38 -0500 |
commit | 0d5ff566779f894ca9937231a181eb31e4adff0e (patch) | |
tree | d1c7495c932581c1d41aa7f0fdb303348da49106 /drivers/ata/pata_qdi.c | |
parent | 1a68ff13c8a9b517de3fd4187dc525412a6eba1b (diff) |
libata: convert to iomap
Convert libata core layer and LLDs to use iomap.
* managed iomap is used. Pointer to pcim_iomap_table() is cached at
host->iomap and used through out LLDs. This basically replaces
host->mmio_base.
* if possible, pcim_iomap_regions() is used
Most iomap operation conversions are taken from Jeff Garzik
<jgarzik@pobox.com>'s iomap branch.
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 | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index 4413960042a9..5b86effa0bbd 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -131,22 +131,24 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned | |||
131 | 131 | ||
132 | if (ata_id_has_dword_io(adev->id)) { | 132 | if (ata_id_has_dword_io(adev->id)) { |
133 | if (write_data) | 133 | if (write_data) |
134 | outsl(ap->ioaddr.data_addr, buf, buflen >> 2); | 134 | iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
135 | else | 135 | else |
136 | insl(ap->ioaddr.data_addr, buf, buflen >> 2); | 136 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
137 | 137 | ||
138 | if (unlikely(slop)) { | 138 | if (unlikely(slop)) { |
139 | u32 pad; | 139 | u32 pad; |
140 | if (write_data) { | 140 | if (write_data) { |
141 | memcpy(&pad, buf + buflen - slop, slop); | 141 | memcpy(&pad, buf + buflen - slop, slop); |
142 | outl(le32_to_cpu(pad), ap->ioaddr.data_addr); | 142 | pad = le32_to_cpu(pad); |
143 | iowrite32(pad, ap->ioaddr.data_addr); | ||
143 | } else { | 144 | } else { |
144 | pad = cpu_to_le32(inl(ap->ioaddr.data_addr)); | 145 | pad = ioread32(ap->ioaddr.data_addr); |
146 | pad = cpu_to_le32(pad); | ||
145 | memcpy(buf + buflen - slop, &pad, slop); | 147 | memcpy(buf + buflen - slop, &pad, slop); |
146 | } | 148 | } |
147 | } | 149 | } |
148 | } else | 150 | } else |
149 | ata_pio_data_xfer(adev, buf, buflen, write_data); | 151 | ata_data_xfer(adev, buf, buflen, write_data); |
150 | } | 152 | } |
151 | 153 | ||
152 | static struct scsi_host_template qdi_sht = { | 154 | static struct scsi_host_template qdi_sht = { |
@@ -234,10 +236,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i | |||
234 | { | 236 | { |
235 | struct ata_probe_ent ae; | 237 | struct ata_probe_ent ae; |
236 | struct platform_device *pdev; | 238 | struct platform_device *pdev; |
239 | void __iomem *io_addr, *ctl_addr; | ||
237 | int ret; | 240 | int ret; |
238 | 241 | ||
239 | unsigned long ctrl = io + 0x206; | ||
240 | |||
241 | /* | 242 | /* |
242 | * Fill in a probe structure first of all | 243 | * Fill in a probe structure first of all |
243 | */ | 244 | */ |
@@ -246,6 +247,12 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i | |||
246 | if (IS_ERR(pdev)) | 247 | if (IS_ERR(pdev)) |
247 | return PTR_ERR(pdev); | 248 | return PTR_ERR(pdev); |
248 | 249 | ||
250 | ret = -ENOMEM; | ||
251 | io_addr = devm_ioport_map(&pdev->dev, io, 8); | ||
252 | ctl_addr = devm_ioport_map(&pdev->dev, io + 0x206, 1); | ||
253 | if (!io_addr || !ctl_addr) | ||
254 | goto fail; | ||
255 | |||
249 | memset(&ae, 0, sizeof(struct ata_probe_ent)); | 256 | memset(&ae, 0, sizeof(struct ata_probe_ent)); |
250 | INIT_LIST_HEAD(&ae.node); | 257 | INIT_LIST_HEAD(&ae.node); |
251 | ae.dev = &pdev->dev; | 258 | ae.dev = &pdev->dev; |
@@ -263,9 +270,9 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i | |||
263 | ae.irq = irq; | 270 | ae.irq = irq; |
264 | ae.irq_flags = 0; | 271 | ae.irq_flags = 0; |
265 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; | 272 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; |
266 | ae.port[0].cmd_addr = io; | 273 | ae.port[0].cmd_addr = io_addr; |
267 | ae.port[0].altstatus_addr = ctrl; | 274 | ae.port[0].altstatus_addr = ctl_addr; |
268 | ae.port[0].ctl_addr = ctrl; | 275 | ae.port[0].ctl_addr = ctl_addr; |
269 | ata_std_ports(&ae.port[0]); | 276 | ata_std_ports(&ae.port[0]); |
270 | 277 | ||
271 | /* | 278 | /* |
@@ -278,14 +285,17 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i | |||
278 | qdi_data[nr_qdi_host].platform_dev = pdev; | 285 | qdi_data[nr_qdi_host].platform_dev = pdev; |
279 | 286 | ||
280 | printk(KERN_INFO DRV_NAME": qd%d at 0x%lx.\n", type, io); | 287 | printk(KERN_INFO DRV_NAME": qd%d at 0x%lx.\n", type, io); |
281 | ret = ata_device_add(&ae); | 288 | |
282 | if (ret == 0) { | 289 | ret = -ENODEV; |
283 | platform_device_unregister(pdev); | 290 | if (!ata_device_add(&ae)) |
284 | return -ENODEV; | 291 | goto fail; |
285 | } | ||
286 | 292 | ||
287 | qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev); | 293 | qdi_host[nr_qdi_host++] = dev_get_drvdata(&pdev->dev); |
288 | return 0; | 294 | return 0; |
295 | |||
296 | fail: | ||
297 | platform_device_unregister(pdev); | ||
298 | return ret; | ||
289 | } | 299 | } |
290 | 300 | ||
291 | /** | 301 | /** |