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/ahci.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/ahci.c')
-rw-r--r-- | drivers/ata/ahci.c | 79 |
1 files changed, 34 insertions, 45 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 20ab3ffce559..6d664849cc09 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -446,16 +446,12 @@ static inline int ahci_nr_ports(u32 cap) | |||
446 | return (cap & 0x1f) + 1; | 446 | return (cap & 0x1f) + 1; |
447 | } | 447 | } |
448 | 448 | ||
449 | static inline unsigned long ahci_port_base_ul (unsigned long base, unsigned int port) | 449 | static inline void __iomem *ahci_port_base(void __iomem *base, |
450 | unsigned int port) | ||
450 | { | 451 | { |
451 | return base + 0x100 + (port * 0x80); | 452 | return base + 0x100 + (port * 0x80); |
452 | } | 453 | } |
453 | 454 | ||
454 | static inline void __iomem *ahci_port_base (void __iomem *base, unsigned int port) | ||
455 | { | ||
456 | return (void __iomem *) ahci_port_base_ul((unsigned long)base, port); | ||
457 | } | ||
458 | |||
459 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) | 455 | static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) |
460 | { | 456 | { |
461 | unsigned int sc_reg; | 457 | unsigned int sc_reg; |
@@ -469,7 +465,7 @@ static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg_in) | |||
469 | return 0xffffffffU; | 465 | return 0xffffffffU; |
470 | } | 466 | } |
471 | 467 | ||
472 | return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 468 | return readl(ap->ioaddr.scr_addr + (sc_reg * 4)); |
473 | } | 469 | } |
474 | 470 | ||
475 | 471 | ||
@@ -487,7 +483,7 @@ static void ahci_scr_write (struct ata_port *ap, unsigned int sc_reg_in, | |||
487 | return; | 483 | return; |
488 | } | 484 | } |
489 | 485 | ||
490 | writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); | 486 | writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); |
491 | } | 487 | } |
492 | 488 | ||
493 | static void ahci_start_engine(void __iomem *port_mmio) | 489 | static void ahci_start_engine(void __iomem *port_mmio) |
@@ -729,7 +725,7 @@ static void ahci_init_controller(void __iomem *mmio, struct pci_dev *pdev, | |||
729 | 725 | ||
730 | static unsigned int ahci_dev_classify(struct ata_port *ap) | 726 | static unsigned int ahci_dev_classify(struct ata_port *ap) |
731 | { | 727 | { |
732 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; | 728 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; |
733 | struct ata_taskfile tf; | 729 | struct ata_taskfile tf; |
734 | u32 tmp; | 730 | u32 tmp; |
735 | 731 | ||
@@ -757,7 +753,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag, | |||
757 | 753 | ||
758 | static int ahci_clo(struct ata_port *ap) | 754 | static int ahci_clo(struct ata_port *ap) |
759 | { | 755 | { |
760 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; | 756 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; |
761 | struct ahci_host_priv *hpriv = ap->host->private_data; | 757 | struct ahci_host_priv *hpriv = ap->host->private_data; |
762 | u32 tmp; | 758 | u32 tmp; |
763 | 759 | ||
@@ -779,7 +775,7 @@ static int ahci_clo(struct ata_port *ap) | |||
779 | static int ahci_softreset(struct ata_port *ap, unsigned int *class) | 775 | static int ahci_softreset(struct ata_port *ap, unsigned int *class) |
780 | { | 776 | { |
781 | struct ahci_port_priv *pp = ap->private_data; | 777 | struct ahci_port_priv *pp = ap->private_data; |
782 | void __iomem *mmio = ap->host->mmio_base; | 778 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
783 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 779 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
784 | const u32 cmd_fis_len = 5; /* five dwords */ | 780 | const u32 cmd_fis_len = 5; /* five dwords */ |
785 | const char *reason = NULL; | 781 | const char *reason = NULL; |
@@ -887,7 +883,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class) | |||
887 | struct ahci_port_priv *pp = ap->private_data; | 883 | struct ahci_port_priv *pp = ap->private_data; |
888 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 884 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
889 | struct ata_taskfile tf; | 885 | struct ata_taskfile tf; |
890 | void __iomem *mmio = ap->host->mmio_base; | 886 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
891 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 887 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
892 | int rc; | 888 | int rc; |
893 | 889 | ||
@@ -915,7 +911,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class) | |||
915 | 911 | ||
916 | static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class) | 912 | static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class) |
917 | { | 913 | { |
918 | void __iomem *mmio = ap->host->mmio_base; | 914 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
919 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 915 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
920 | int rc; | 916 | int rc; |
921 | 917 | ||
@@ -940,7 +936,7 @@ static int ahci_vt8251_hardreset(struct ata_port *ap, unsigned int *class) | |||
940 | 936 | ||
941 | static void ahci_postreset(struct ata_port *ap, unsigned int *class) | 937 | static void ahci_postreset(struct ata_port *ap, unsigned int *class) |
942 | { | 938 | { |
943 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; | 939 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; |
944 | u32 new_tmp, tmp; | 940 | u32 new_tmp, tmp; |
945 | 941 | ||
946 | ata_std_postreset(ap, class); | 942 | ata_std_postreset(ap, class); |
@@ -959,7 +955,7 @@ static void ahci_postreset(struct ata_port *ap, unsigned int *class) | |||
959 | 955 | ||
960 | static u8 ahci_check_status(struct ata_port *ap) | 956 | static u8 ahci_check_status(struct ata_port *ap) |
961 | { | 957 | { |
962 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; | 958 | void __iomem *mmio = ap->ioaddr.cmd_addr; |
963 | 959 | ||
964 | return readl(mmio + PORT_TFDATA) & 0xFF; | 960 | return readl(mmio + PORT_TFDATA) & 0xFF; |
965 | } | 961 | } |
@@ -1105,7 +1101,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
1105 | 1101 | ||
1106 | static void ahci_host_intr(struct ata_port *ap) | 1102 | static void ahci_host_intr(struct ata_port *ap) |
1107 | { | 1103 | { |
1108 | void __iomem *mmio = ap->host->mmio_base; | 1104 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1109 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1105 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1110 | struct ata_eh_info *ehi = &ap->eh_info; | 1106 | struct ata_eh_info *ehi = &ap->eh_info; |
1111 | struct ahci_port_priv *pp = ap->private_data; | 1107 | struct ahci_port_priv *pp = ap->private_data; |
@@ -1203,7 +1199,7 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance) | |||
1203 | VPRINTK("ENTER\n"); | 1199 | VPRINTK("ENTER\n"); |
1204 | 1200 | ||
1205 | hpriv = host->private_data; | 1201 | hpriv = host->private_data; |
1206 | mmio = host->mmio_base; | 1202 | mmio = host->iomap[AHCI_PCI_BAR]; |
1207 | 1203 | ||
1208 | /* sigh. 0xffffffff is a valid return from h/w */ | 1204 | /* sigh. 0xffffffff is a valid return from h/w */ |
1209 | irq_stat = readl(mmio + HOST_IRQ_STAT); | 1205 | irq_stat = readl(mmio + HOST_IRQ_STAT); |
@@ -1248,7 +1244,7 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance) | |||
1248 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1244 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
1249 | { | 1245 | { |
1250 | struct ata_port *ap = qc->ap; | 1246 | struct ata_port *ap = qc->ap; |
1251 | void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; | 1247 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; |
1252 | 1248 | ||
1253 | if (qc->tf.protocol == ATA_PROT_NCQ) | 1249 | if (qc->tf.protocol == ATA_PROT_NCQ) |
1254 | writel(1 << qc->tag, port_mmio + PORT_SCR_ACT); | 1250 | writel(1 << qc->tag, port_mmio + PORT_SCR_ACT); |
@@ -1260,7 +1256,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
1260 | 1256 | ||
1261 | static void ahci_freeze(struct ata_port *ap) | 1257 | static void ahci_freeze(struct ata_port *ap) |
1262 | { | 1258 | { |
1263 | void __iomem *mmio = ap->host->mmio_base; | 1259 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1264 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1260 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1265 | 1261 | ||
1266 | /* turn IRQ off */ | 1262 | /* turn IRQ off */ |
@@ -1269,7 +1265,7 @@ static void ahci_freeze(struct ata_port *ap) | |||
1269 | 1265 | ||
1270 | static void ahci_thaw(struct ata_port *ap) | 1266 | static void ahci_thaw(struct ata_port *ap) |
1271 | { | 1267 | { |
1272 | void __iomem *mmio = ap->host->mmio_base; | 1268 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1273 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1269 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1274 | u32 tmp; | 1270 | u32 tmp; |
1275 | 1271 | ||
@@ -1284,7 +1280,7 @@ static void ahci_thaw(struct ata_port *ap) | |||
1284 | 1280 | ||
1285 | static void ahci_error_handler(struct ata_port *ap) | 1281 | static void ahci_error_handler(struct ata_port *ap) |
1286 | { | 1282 | { |
1287 | void __iomem *mmio = ap->host->mmio_base; | 1283 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1288 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1284 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1289 | 1285 | ||
1290 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { | 1286 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { |
@@ -1300,7 +1296,7 @@ static void ahci_error_handler(struct ata_port *ap) | |||
1300 | 1296 | ||
1301 | static void ahci_vt8251_error_handler(struct ata_port *ap) | 1297 | static void ahci_vt8251_error_handler(struct ata_port *ap) |
1302 | { | 1298 | { |
1303 | void __iomem *mmio = ap->host->mmio_base; | 1299 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1304 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1300 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1305 | 1301 | ||
1306 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { | 1302 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) { |
@@ -1317,7 +1313,7 @@ static void ahci_vt8251_error_handler(struct ata_port *ap) | |||
1317 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) | 1313 | static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) |
1318 | { | 1314 | { |
1319 | struct ata_port *ap = qc->ap; | 1315 | struct ata_port *ap = qc->ap; |
1320 | void __iomem *mmio = ap->host->mmio_base; | 1316 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1321 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1317 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1322 | 1318 | ||
1323 | if (qc->flags & ATA_QCFLAG_FAILED) | 1319 | if (qc->flags & ATA_QCFLAG_FAILED) |
@@ -1334,7 +1330,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg) | |||
1334 | { | 1330 | { |
1335 | struct ahci_host_priv *hpriv = ap->host->private_data; | 1331 | struct ahci_host_priv *hpriv = ap->host->private_data; |
1336 | struct ahci_port_priv *pp = ap->private_data; | 1332 | struct ahci_port_priv *pp = ap->private_data; |
1337 | void __iomem *mmio = ap->host->mmio_base; | 1333 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1338 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1334 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1339 | const char *emsg = NULL; | 1335 | const char *emsg = NULL; |
1340 | int rc; | 1336 | int rc; |
@@ -1355,7 +1351,7 @@ static int ahci_port_resume(struct ata_port *ap) | |||
1355 | { | 1351 | { |
1356 | struct ahci_port_priv *pp = ap->private_data; | 1352 | struct ahci_port_priv *pp = ap->private_data; |
1357 | struct ahci_host_priv *hpriv = ap->host->private_data; | 1353 | struct ahci_host_priv *hpriv = ap->host->private_data; |
1358 | void __iomem *mmio = ap->host->mmio_base; | 1354 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1359 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1355 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1360 | 1356 | ||
1361 | ahci_power_up(port_mmio, hpriv->cap); | 1357 | ahci_power_up(port_mmio, hpriv->cap); |
@@ -1367,7 +1363,7 @@ static int ahci_port_resume(struct ata_port *ap) | |||
1367 | static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | 1363 | static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) |
1368 | { | 1364 | { |
1369 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 1365 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
1370 | void __iomem *mmio = host->mmio_base; | 1366 | void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; |
1371 | u32 ctl; | 1367 | u32 ctl; |
1372 | 1368 | ||
1373 | if (mesg.event == PM_EVENT_SUSPEND) { | 1369 | if (mesg.event == PM_EVENT_SUSPEND) { |
@@ -1388,7 +1384,7 @@ static int ahci_pci_device_resume(struct pci_dev *pdev) | |||
1388 | { | 1384 | { |
1389 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 1385 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
1390 | struct ahci_host_priv *hpriv = host->private_data; | 1386 | struct ahci_host_priv *hpriv = host->private_data; |
1391 | void __iomem *mmio = host->mmio_base; | 1387 | void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; |
1392 | int rc; | 1388 | int rc; |
1393 | 1389 | ||
1394 | rc = ata_pci_device_do_resume(pdev); | 1390 | rc = ata_pci_device_do_resume(pdev); |
@@ -1414,7 +1410,7 @@ static int ahci_port_start(struct ata_port *ap) | |||
1414 | struct device *dev = ap->host->dev; | 1410 | struct device *dev = ap->host->dev; |
1415 | struct ahci_host_priv *hpriv = ap->host->private_data; | 1411 | struct ahci_host_priv *hpriv = ap->host->private_data; |
1416 | struct ahci_port_priv *pp; | 1412 | struct ahci_port_priv *pp; |
1417 | void __iomem *mmio = ap->host->mmio_base; | 1413 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1418 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1414 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1419 | void *mem; | 1415 | void *mem; |
1420 | dma_addr_t mem_dma; | 1416 | dma_addr_t mem_dma; |
@@ -1474,7 +1470,7 @@ static int ahci_port_start(struct ata_port *ap) | |||
1474 | static void ahci_port_stop(struct ata_port *ap) | 1470 | static void ahci_port_stop(struct ata_port *ap) |
1475 | { | 1471 | { |
1476 | struct ahci_host_priv *hpriv = ap->host->private_data; | 1472 | struct ahci_host_priv *hpriv = ap->host->private_data; |
1477 | void __iomem *mmio = ap->host->mmio_base; | 1473 | void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; |
1478 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 1474 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
1479 | const char *emsg = NULL; | 1475 | const char *emsg = NULL; |
1480 | int rc; | 1476 | int rc; |
@@ -1485,11 +1481,11 @@ static void ahci_port_stop(struct ata_port *ap) | |||
1485 | ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc); | 1481 | ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc); |
1486 | } | 1482 | } |
1487 | 1483 | ||
1488 | static void ahci_setup_port(struct ata_ioports *port, unsigned long base, | 1484 | static void ahci_setup_port(struct ata_ioports *port, void __iomem *base, |
1489 | unsigned int port_idx) | 1485 | unsigned int port_idx) |
1490 | { | 1486 | { |
1491 | VPRINTK("ENTER, base==0x%lx, port_idx %u\n", base, port_idx); | 1487 | VPRINTK("ENTER, base==0x%lx, port_idx %u\n", base, port_idx); |
1492 | base = ahci_port_base_ul(base, port_idx); | 1488 | base = ahci_port_base(base, port_idx); |
1493 | VPRINTK("base now==0x%lx\n", base); | 1489 | VPRINTK("base now==0x%lx\n", base); |
1494 | 1490 | ||
1495 | port->cmd_addr = base; | 1491 | port->cmd_addr = base; |
@@ -1502,7 +1498,7 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
1502 | { | 1498 | { |
1503 | struct ahci_host_priv *hpriv = probe_ent->private_data; | 1499 | struct ahci_host_priv *hpriv = probe_ent->private_data; |
1504 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | 1500 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); |
1505 | void __iomem *mmio = probe_ent->mmio_base; | 1501 | void __iomem *mmio = probe_ent->iomap[AHCI_PCI_BAR]; |
1506 | unsigned int i, cap_n_ports, using_dac; | 1502 | unsigned int i, cap_n_ports, using_dac; |
1507 | int rc; | 1503 | int rc; |
1508 | 1504 | ||
@@ -1569,7 +1565,7 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
1569 | } | 1565 | } |
1570 | 1566 | ||
1571 | for (i = 0; i < probe_ent->n_ports; i++) | 1567 | for (i = 0; i < probe_ent->n_ports; i++) |
1572 | ahci_setup_port(&probe_ent->port[i], (unsigned long) mmio, i); | 1568 | ahci_setup_port(&probe_ent->port[i], mmio, i); |
1573 | 1569 | ||
1574 | ahci_init_controller(mmio, pdev, probe_ent->n_ports, | 1570 | ahci_init_controller(mmio, pdev, probe_ent->n_ports, |
1575 | probe_ent->port_flags, hpriv); | 1571 | probe_ent->port_flags, hpriv); |
@@ -1583,7 +1579,7 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent) | |||
1583 | { | 1579 | { |
1584 | struct ahci_host_priv *hpriv = probe_ent->private_data; | 1580 | struct ahci_host_priv *hpriv = probe_ent->private_data; |
1585 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | 1581 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); |
1586 | void __iomem *mmio = probe_ent->mmio_base; | 1582 | void __iomem *mmio = probe_ent->iomap[AHCI_PCI_BAR]; |
1587 | u32 vers, cap, impl, speed; | 1583 | u32 vers, cap, impl, speed; |
1588 | const char *speed_s; | 1584 | const char *speed_s; |
1589 | u16 cc; | 1585 | u16 cc; |
@@ -1657,8 +1653,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1657 | struct device *dev = &pdev->dev; | 1653 | struct device *dev = &pdev->dev; |
1658 | struct ata_probe_ent *probe_ent; | 1654 | struct ata_probe_ent *probe_ent; |
1659 | struct ahci_host_priv *hpriv; | 1655 | struct ahci_host_priv *hpriv; |
1660 | unsigned long base; | ||
1661 | void __iomem *mmio_base; | ||
1662 | int rc; | 1656 | int rc; |
1663 | 1657 | ||
1664 | VPRINTK("ENTER\n"); | 1658 | VPRINTK("ENTER\n"); |
@@ -1679,11 +1673,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1679 | if (rc) | 1673 | if (rc) |
1680 | return rc; | 1674 | return rc; |
1681 | 1675 | ||
1682 | rc = pci_request_regions(pdev, DRV_NAME); | 1676 | rc = pcim_iomap_regions(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); |
1683 | if (rc) { | 1677 | if (rc == -EBUSY) |
1684 | pcim_pin_device(pdev); | 1678 | pcim_pin_device(pdev); |
1679 | if (rc) | ||
1685 | return rc; | 1680 | return rc; |
1686 | } | ||
1687 | 1681 | ||
1688 | if (pci_enable_msi(pdev)) | 1682 | if (pci_enable_msi(pdev)) |
1689 | pci_intx(pdev, 1); | 1683 | pci_intx(pdev, 1); |
@@ -1695,11 +1689,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1695 | probe_ent->dev = pci_dev_to_dev(pdev); | 1689 | probe_ent->dev = pci_dev_to_dev(pdev); |
1696 | INIT_LIST_HEAD(&probe_ent->node); | 1690 | INIT_LIST_HEAD(&probe_ent->node); |
1697 | 1691 | ||
1698 | mmio_base = pcim_iomap(pdev, AHCI_PCI_BAR, 0); | ||
1699 | if (mmio_base == NULL) | ||
1700 | return -ENOMEM; | ||
1701 | base = (unsigned long) mmio_base; | ||
1702 | |||
1703 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); | 1692 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); |
1704 | if (!hpriv) | 1693 | if (!hpriv) |
1705 | return -ENOMEM; | 1694 | return -ENOMEM; |
@@ -1712,7 +1701,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1712 | 1701 | ||
1713 | probe_ent->irq = pdev->irq; | 1702 | probe_ent->irq = pdev->irq; |
1714 | probe_ent->irq_flags = IRQF_SHARED; | 1703 | probe_ent->irq_flags = IRQF_SHARED; |
1715 | probe_ent->mmio_base = mmio_base; | 1704 | probe_ent->iomap = pcim_iomap_table(pdev); |
1716 | probe_ent->private_data = hpriv; | 1705 | probe_ent->private_data = hpriv; |
1717 | 1706 | ||
1718 | /* initialize adapter */ | 1707 | /* initialize adapter */ |