aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_platform.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-02-01 01:06:36 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:38 -0500
commit0d5ff566779f894ca9937231a181eb31e4adff0e (patch)
treed1c7495c932581c1d41aa7f0fdb303348da49106 /drivers/ata/pata_platform.c
parent1a68ff13c8a9b517de3fd4187dc525412a6eba1b (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_platform.c')
-rw-r--r--drivers/ata/pata_platform.c50
1 files changed, 15 insertions, 35 deletions
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 8a261a3daeda..b35fc29f4db5 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -83,7 +83,7 @@ static struct ata_port_operations pata_platform_port_ops = {
83 .qc_prep = ata_qc_prep, 83 .qc_prep = ata_qc_prep,
84 .qc_issue = ata_qc_issue_prot, 84 .qc_issue = ata_qc_issue_prot,
85 85
86 .data_xfer = ata_pio_data_xfer_noirq, 86 .data_xfer = ata_data_xfer_noirq,
87 87
88 .irq_handler = ata_interrupt, 88 .irq_handler = ata_interrupt,
89 .irq_clear = ata_bmdma_irq_clear, 89 .irq_clear = ata_bmdma_irq_clear,
@@ -134,7 +134,6 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
134 struct resource *io_res, *ctl_res; 134 struct resource *io_res, *ctl_res;
135 struct ata_probe_ent ae; 135 struct ata_probe_ent ae;
136 unsigned int mmio; 136 unsigned int mmio;
137 int ret;
138 137
139 /* 138 /*
140 * Simple resource validation .. 139 * Simple resource validation ..
@@ -188,48 +187,29 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
188 * Handle the MMIO case 187 * Handle the MMIO case
189 */ 188 */
190 if (mmio) { 189 if (mmio) {
191 ae.port_flags |= ATA_FLAG_MMIO; 190 ae.port[0].cmd_addr = devm_ioremap(&pdev->dev, io_res->start,
192 191 io_res->end - io_res->start + 1);
193 ae.port[0].cmd_addr = (unsigned long) 192 ae.port[0].ctl_addr = devm_ioremap(&pdev->dev, ctl_res->start,
194 devm_ioremap(&pdev->dev, io_res->start, 193 ctl_res->end - ctl_res->start + 1);
195 io_res->end - io_res->start + 1);
196 if (unlikely(!ae.port[0].cmd_addr)) {
197 dev_err(&pdev->dev, "failed to remap IO base\n");
198 return -ENXIO;
199 }
200
201 ae.port[0].ctl_addr = (unsigned long)
202 devm_ioremap(&pdev->dev, ctl_res->start,
203 ctl_res->end - ctl_res->start + 1);
204 if (unlikely(!ae.port[0].ctl_addr)) {
205 dev_err(&pdev->dev, "failed to remap CTL base\n");
206 ret = -ENXIO;
207 goto bad_remap;
208 }
209 } else { 194 } else {
210 ae.port[0].cmd_addr = io_res->start; 195 ae.port[0].cmd_addr = devm_ioport_map(&pdev->dev, io_res->start,
211 ae.port[0].ctl_addr = ctl_res->start; 196 io_res->end - io_res->start + 1);
197 ae.port[0].ctl_addr = devm_ioport_map(&pdev->dev, ctl_res->start,
198 ctl_res->end - ctl_res->start + 1);
199 }
200 if (!ae.port[0].cmd_addr || !ae.port[0].ctl_addr) {
201 dev_err(&pdev->dev, "failed to map IO/CTL base\n");
202 return -ENOMEM;
212 } 203 }
213 204
214 ae.port[0].altstatus_addr = ae.port[0].ctl_addr; 205 ae.port[0].altstatus_addr = ae.port[0].ctl_addr;
215 206
216 pata_platform_setup_port(&ae.port[0], pdev->dev.platform_data); 207 pata_platform_setup_port(&ae.port[0], pdev->dev.platform_data);
217 208
218 if (unlikely(ata_device_add(&ae) == 0)) { 209 if (unlikely(ata_device_add(&ae) == 0))
219 ret = -ENODEV; 210 return -ENODEV;
220 goto add_failed;
221 }
222 211
223 return 0; 212 return 0;
224
225add_failed:
226 if (ae.port[0].ctl_addr && mmio)
227 iounmap((void __iomem *)ae.port[0].ctl_addr);
228bad_remap:
229 if (ae.port[0].cmd_addr && mmio)
230 iounmap((void __iomem *)ae.port[0].cmd_addr);
231
232 return ret;
233} 213}
234 214
235/** 215/**