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.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index baca6d79bb0b..598e6a26a481 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -46,7 +46,7 @@
46#include <linux/libata.h> 46#include <linux/libata.h>
47 47
48#define DRV_NAME "sata_via" 48#define DRV_NAME "sata_via"
49#define DRV_VERSION "2.0" 49#define DRV_VERSION "2.1"
50 50
51enum board_ids_enum { 51enum board_ids_enum {
52 vt6420, 52 vt6420,
@@ -60,7 +60,7 @@ enum {
60 SATA_PATA_SHARING = 0x49, /* PATA/SATA sharing func ctrl */ 60 SATA_PATA_SHARING = 0x49, /* PATA/SATA sharing func ctrl */
61 PATA_UDMA_TIMING = 0xB3, /* PATA timing for DMA/ cable detect */ 61 PATA_UDMA_TIMING = 0xB3, /* PATA timing for DMA/ cable detect */
62 PATA_PIO_TIMING = 0xAB, /* PATA timing register */ 62 PATA_PIO_TIMING = 0xAB, /* PATA timing register */
63 63
64 PORT0 = (1 << 1), 64 PORT0 = (1 << 1),
65 PORT1 = (1 << 0), 65 PORT1 = (1 << 0),
66 ALL_PORTS = PORT0 | PORT1, 66 ALL_PORTS = PORT0 | PORT1,
@@ -151,7 +151,7 @@ static const struct ata_port_operations vt6420_sata_ops = {
151 151
152static const struct ata_port_operations vt6421_pata_ops = { 152static const struct ata_port_operations vt6421_pata_ops = {
153 .port_disable = ata_port_disable, 153 .port_disable = ata_port_disable,
154 154
155 .set_piomode = vt6421_set_pio_mode, 155 .set_piomode = vt6421_set_pio_mode,
156 .set_dmamode = vt6421_set_dma_mode, 156 .set_dmamode = vt6421_set_dma_mode,
157 157
@@ -185,7 +185,7 @@ static const struct ata_port_operations vt6421_pata_ops = {
185 185
186static const struct ata_port_operations vt6421_sata_ops = { 186static const struct ata_port_operations vt6421_sata_ops = {
187 .port_disable = ata_port_disable, 187 .port_disable = ata_port_disable,
188 188
189 .tf_load = ata_tf_load, 189 .tf_load = ata_tf_load,
190 .tf_read = ata_tf_read, 190 .tf_read = ata_tf_read,
191 .check_status = ata_check_status, 191 .check_status = ata_check_status,
@@ -423,16 +423,21 @@ static struct ata_probe_ent *vt6420_init_probe_ent(struct pci_dev *pdev)
423{ 423{
424 struct ata_probe_ent *probe_ent; 424 struct ata_probe_ent *probe_ent;
425 struct ata_port_info *ppi[2]; 425 struct ata_port_info *ppi[2];
426 void __iomem * const *iomap; 426 void __iomem *bar5;
427 427
428 ppi[0] = ppi[1] = &vt6420_port_info; 428 ppi[0] = ppi[1] = &vt6420_port_info;
429 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); 429 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
430 if (!probe_ent) 430 if (!probe_ent)
431 return NULL; 431 return NULL;
432 432
433 iomap = pcim_iomap_table(pdev); 433 bar5 = pcim_iomap(pdev, 5, 0);
434 probe_ent->port[0].scr_addr = svia_scr_addr(iomap[5], 0); 434 if (!bar5) {
435 probe_ent->port[1].scr_addr = svia_scr_addr(iomap[5], 1); 435 dev_printk(KERN_ERR, &pdev->dev, "failed to iomap PCI BAR 5\n");
436 return NULL;
437 }
438
439 probe_ent->port[0].scr_addr = svia_scr_addr(bar5, 0);
440 probe_ent->port[1].scr_addr = svia_scr_addr(bar5, 1);
436 441
437 return probe_ent; 442 return probe_ent;
438} 443}
@@ -460,6 +465,13 @@ static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev)
460 probe_ent->mwdma_mask = 0x07; 465 probe_ent->mwdma_mask = 0x07;
461 probe_ent->udma_mask = 0x7f; 466 probe_ent->udma_mask = 0x7f;
462 467
468 for (i = 0; i < 6; i++)
469 if (!pcim_iomap(pdev, i, 0)) {
470 dev_printk(KERN_ERR, &pdev->dev,
471 "failed to iomap PCI BAR %d\n", i);
472 return NULL;
473 }
474
463 for (i = 0; i < N_PORTS; i++) 475 for (i = 0; i < N_PORTS; i++)
464 vt6421_init_addrs(probe_ent, pcim_iomap_table(pdev), i); 476 vt6421_init_addrs(probe_ent, pcim_iomap_table(pdev), i);
465 477
@@ -522,7 +534,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
522 if (rc) 534 if (rc)
523 return rc; 535 return rc;
524 536
525 rc = pcim_iomap_regions(pdev, 0x1f, DRV_NAME); 537 rc = pci_request_regions(pdev, DRV_NAME);
526 if (rc) { 538 if (rc) {
527 pcim_pin_device(pdev); 539 pcim_pin_device(pdev);
528 return rc; 540 return rc;