aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_via.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_via.c')
-rw-r--r--drivers/ata/sata_via.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index c7f527578d11..6b558195a76f 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -134,7 +134,7 @@ static const struct ata_port_operations vt6420_sata_ops = {
134 134
135 .qc_prep = ata_qc_prep, 135 .qc_prep = ata_qc_prep,
136 .qc_issue = ata_qc_issue_prot, 136 .qc_issue = ata_qc_issue_prot,
137 .data_xfer = ata_pio_data_xfer, 137 .data_xfer = ata_data_xfer,
138 138
139 .freeze = svia_noop_freeze, 139 .freeze = svia_noop_freeze,
140 .thaw = ata_bmdma_thaw, 140 .thaw = ata_bmdma_thaw,
@@ -166,7 +166,7 @@ static const struct ata_port_operations vt6421_pata_ops = {
166 166
167 .qc_prep = ata_qc_prep, 167 .qc_prep = ata_qc_prep,
168 .qc_issue = ata_qc_issue_prot, 168 .qc_issue = ata_qc_issue_prot,
169 .data_xfer = ata_pio_data_xfer, 169 .data_xfer = ata_data_xfer,
170 170
171 .freeze = ata_bmdma_freeze, 171 .freeze = ata_bmdma_freeze,
172 .thaw = ata_bmdma_thaw, 172 .thaw = ata_bmdma_thaw,
@@ -195,7 +195,7 @@ static const struct ata_port_operations vt6421_sata_ops = {
195 195
196 .qc_prep = ata_qc_prep, 196 .qc_prep = ata_qc_prep,
197 .qc_issue = ata_qc_issue_prot, 197 .qc_issue = ata_qc_issue_prot,
198 .data_xfer = ata_pio_data_xfer, 198 .data_xfer = ata_data_xfer,
199 199
200 .freeze = ata_bmdma_freeze, 200 .freeze = ata_bmdma_freeze,
201 .thaw = ata_bmdma_thaw, 201 .thaw = ata_bmdma_thaw,
@@ -230,14 +230,14 @@ static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg)
230{ 230{
231 if (sc_reg > SCR_CONTROL) 231 if (sc_reg > SCR_CONTROL)
232 return 0xffffffffU; 232 return 0xffffffffU;
233 return inl(ap->ioaddr.scr_addr + (4 * sc_reg)); 233 return ioread32(ap->ioaddr.scr_addr + (4 * sc_reg));
234} 234}
235 235
236static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 236static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
237{ 237{
238 if (sc_reg > SCR_CONTROL) 238 if (sc_reg > SCR_CONTROL)
239 return; 239 return;
240 outl(val, ap->ioaddr.scr_addr + (4 * sc_reg)); 240 iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg));
241} 241}
242 242
243static void svia_noop_freeze(struct ata_port *ap) 243static void svia_noop_freeze(struct ata_port *ap)
@@ -387,31 +387,28 @@ static const unsigned int vt6421_bar_sizes[] = {
387 16, 16, 16, 16, 32, 128 387 16, 16, 16, 16, 32, 128
388}; 388};
389 389
390static unsigned long svia_scr_addr(unsigned long addr, unsigned int port) 390static void __iomem * svia_scr_addr(void __iomem *addr, unsigned int port)
391{ 391{
392 return addr + (port * 128); 392 return addr + (port * 128);
393} 393}
394 394
395static unsigned long vt6421_scr_addr(unsigned long addr, unsigned int port) 395static void __iomem * vt6421_scr_addr(void __iomem *addr, unsigned int port)
396{ 396{
397 return addr + (port * 64); 397 return addr + (port * 64);
398} 398}
399 399
400static void vt6421_init_addrs(struct ata_probe_ent *probe_ent, 400static void vt6421_init_addrs(struct ata_probe_ent *probe_ent,
401 struct pci_dev *pdev, 401 void __iomem * const *iomap, unsigned int port)
402 unsigned int port)
403{ 402{
404 unsigned long reg_addr = pci_resource_start(pdev, port); 403 void __iomem *reg_addr = iomap[port];
405 unsigned long bmdma_addr = pci_resource_start(pdev, 4) + (port * 8); 404 void __iomem *bmdma_addr = iomap[4] + (port * 8);
406 unsigned long scr_addr;
407 405
408 probe_ent->port[port].cmd_addr = reg_addr; 406 probe_ent->port[port].cmd_addr = reg_addr;
409 probe_ent->port[port].altstatus_addr = 407 probe_ent->port[port].altstatus_addr =
410 probe_ent->port[port].ctl_addr = (reg_addr + 8) | ATA_PCI_CTL_OFS; 408 probe_ent->port[port].ctl_addr = (void __iomem *)
409 ((unsigned long)(reg_addr + 8) | ATA_PCI_CTL_OFS);
411 probe_ent->port[port].bmdma_addr = bmdma_addr; 410 probe_ent->port[port].bmdma_addr = bmdma_addr;
412 411 probe_ent->port[port].scr_addr = vt6421_scr_addr(iomap[5], port);
413 scr_addr = vt6421_scr_addr(pci_resource_start(pdev, 5), port);
414 probe_ent->port[port].scr_addr = scr_addr;
415 412
416 ata_std_ports(&probe_ent->port[port]); 413 ata_std_ports(&probe_ent->port[port]);
417} 414}
@@ -420,16 +417,16 @@ static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev)
420{ 417{
421 struct ata_probe_ent *probe_ent; 418 struct ata_probe_ent *probe_ent;
422 struct ata_port_info *ppi[2]; 419 struct ata_port_info *ppi[2];
420 void __iomem * const *iomap;
423 421
424 ppi[0] = ppi[1] = &vt6420_port_info; 422 ppi[0] = ppi[1] = &vt6420_port_info;
425 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 423 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
426 if (!probe_ent) 424 if (!probe_ent)
427 return NULL; 425 return NULL;
428 426
429 probe_ent->port[0].scr_addr = 427 iomap = pcim_iomap_table(pdev);
430 svia_scr_addr(pci_resource_start(pdev, 5), 0); 428 probe_ent->port[0].scr_addr = svia_scr_addr(iomap[5], 0);
431 probe_ent->port[1].scr_addr = 429 probe_ent->port[1].scr_addr = svia_scr_addr(iomap[5], 1);
432 svia_scr_addr(pci_resource_start(pdev, 5), 1);
433 430
434 return probe_ent; 431 return probe_ent;
435} 432}
@@ -458,7 +455,7 @@ static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev)
458 probe_ent->udma_mask = 0x7f; 455 probe_ent->udma_mask = 0x7f;
459 456
460 for (i = 0; i < N_PORTS; i++) 457 for (i = 0; i < N_PORTS; i++)
461 vt6421_init_addrs(probe_ent, pdev, i); 458 vt6421_init_addrs(probe_ent, pcim_iomap_table(pdev), i);
462 459
463 return probe_ent; 460 return probe_ent;
464} 461}
@@ -519,7 +516,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
519 if (rc) 516 if (rc)
520 return rc; 517 return rc;
521 518
522 rc = pci_request_regions(pdev, DRV_NAME); 519 rc = pcim_iomap_regions(pdev, 0x1f, DRV_NAME);
523 if (rc) { 520 if (rc) {
524 pcim_pin_device(pdev); 521 pcim_pin_device(pdev);
525 return rc; 522 return rc;