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_winbond.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_winbond.c')
-rw-r--r-- | drivers/ata/pata_winbond.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index bba04a6e3708..d24488bf5644 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -100,22 +100,24 @@ static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsig | |||
100 | 100 | ||
101 | if (ata_id_has_dword_io(adev->id)) { | 101 | if (ata_id_has_dword_io(adev->id)) { |
102 | if (write_data) | 102 | if (write_data) |
103 | outsl(ap->ioaddr.data_addr, buf, buflen >> 2); | 103 | iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
104 | else | 104 | else |
105 | insl(ap->ioaddr.data_addr, buf, buflen >> 2); | 105 | ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); |
106 | 106 | ||
107 | if (unlikely(slop)) { | 107 | if (unlikely(slop)) { |
108 | u32 pad; | 108 | u32 pad; |
109 | if (write_data) { | 109 | if (write_data) { |
110 | memcpy(&pad, buf + buflen - slop, slop); | 110 | memcpy(&pad, buf + buflen - slop, slop); |
111 | outl(le32_to_cpu(pad), ap->ioaddr.data_addr); | 111 | pad = le32_to_cpu(pad); |
112 | iowrite32(pad, ap->ioaddr.data_addr); | ||
112 | } else { | 113 | } else { |
113 | pad = cpu_to_le16(inl(ap->ioaddr.data_addr)); | 114 | pad = ioread32(ap->ioaddr.data_addr); |
115 | pad = cpu_to_le16(pad); | ||
114 | memcpy(buf + buflen - slop, &pad, slop); | 116 | memcpy(buf + buflen - slop, &pad, slop); |
115 | } | 117 | } |
116 | } | 118 | } |
117 | } else | 119 | } else |
118 | ata_pio_data_xfer(adev, buf, buflen, write_data); | 120 | ata_data_xfer(adev, buf, buflen, write_data); |
119 | } | 121 | } |
120 | 122 | ||
121 | static struct scsi_host_template winbond_sht = { | 123 | static struct scsi_host_template winbond_sht = { |
@@ -197,6 +199,8 @@ static __init int winbond_init_one(unsigned long port) | |||
197 | return 0; | 199 | return 0; |
198 | 200 | ||
199 | for (i = 0; i < 2 ; i ++) { | 201 | for (i = 0; i < 2 ; i ++) { |
202 | unsigned long cmd_port = 0x1F0 - (0x80 * i); | ||
203 | void __iomem *cmd_addr, *ctl_addr; | ||
200 | 204 | ||
201 | if (reg & (1 << i)) { | 205 | if (reg & (1 << i)) { |
202 | /* | 206 | /* |
@@ -207,6 +211,13 @@ static __init int winbond_init_one(unsigned long port) | |||
207 | if (IS_ERR(pdev)) | 211 | if (IS_ERR(pdev)) |
208 | return PTR_ERR(pdev); | 212 | return PTR_ERR(pdev); |
209 | 213 | ||
214 | cmd_addr = devm_ioport_map(&pdev->dev, cmd_port, 8); | ||
215 | ctl_addr = devm_ioport_map(&pdev->dev, cmd_port + 0x0206, 1); | ||
216 | if (!cmd_addr || !ctl_addr) { | ||
217 | platform_device_unregister(pdev); | ||
218 | return -ENOMEM; | ||
219 | } | ||
220 | |||
210 | memset(&ae, 0, sizeof(struct ata_probe_ent)); | 221 | memset(&ae, 0, sizeof(struct ata_probe_ent)); |
211 | INIT_LIST_HEAD(&ae.node); | 222 | INIT_LIST_HEAD(&ae.node); |
212 | ae.dev = &pdev->dev; | 223 | ae.dev = &pdev->dev; |
@@ -220,9 +231,9 @@ static __init int winbond_init_one(unsigned long port) | |||
220 | ae.irq = 14 + i; | 231 | ae.irq = 14 + i; |
221 | ae.irq_flags = 0; | 232 | ae.irq_flags = 0; |
222 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; | 233 | ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; |
223 | ae.port[0].cmd_addr = 0x1F0 - (0x80 * i); | 234 | ae.port[0].cmd_addr = cmd_addr; |
224 | ae.port[0].altstatus_addr = ae.port[0].cmd_addr + 0x0206; | 235 | ae.port[0].altstatus_addr = ctl_addr; |
225 | ae.port[0].ctl_addr = ae.port[0].altstatus_addr; | 236 | ae.port[0].ctl_addr = ctl_addr; |
226 | ata_std_ports(&ae.port[0]); | 237 | ata_std_ports(&ae.port[0]); |
227 | /* | 238 | /* |
228 | * Hook in a private data structure per channel | 239 | * Hook in a private data structure per channel |