diff options
Diffstat (limited to 'drivers/ata/sata_sil.c')
-rw-r--r-- | drivers/ata/sata_sil.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index f17b3ae4dd37..c63dbabc0cd9 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -56,7 +56,7 @@ enum { | |||
56 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), | 56 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), |
57 | SIL_FLAG_MOD15WRITE = (1 << 30), | 57 | SIL_FLAG_MOD15WRITE = (1 << 30), |
58 | 58 | ||
59 | SIL_DFL_HOST_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 59 | SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
60 | ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME, | 60 | ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME, |
61 | 61 | ||
62 | /* | 62 | /* |
@@ -218,7 +218,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
218 | /* sil_3112 */ | 218 | /* sil_3112 */ |
219 | { | 219 | { |
220 | .sht = &sil_sht, | 220 | .sht = &sil_sht, |
221 | .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_MOD15WRITE, | 221 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE, |
222 | .pio_mask = 0x1f, /* pio0-4 */ | 222 | .pio_mask = 0x1f, /* pio0-4 */ |
223 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 223 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
224 | .udma_mask = 0x3f, /* udma0-5 */ | 224 | .udma_mask = 0x3f, /* udma0-5 */ |
@@ -227,7 +227,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
227 | /* sil_3112_no_sata_irq */ | 227 | /* sil_3112_no_sata_irq */ |
228 | { | 228 | { |
229 | .sht = &sil_sht, | 229 | .sht = &sil_sht, |
230 | .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_MOD15WRITE | | 230 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE | |
231 | SIL_FLAG_NO_SATA_IRQ, | 231 | SIL_FLAG_NO_SATA_IRQ, |
232 | .pio_mask = 0x1f, /* pio0-4 */ | 232 | .pio_mask = 0x1f, /* pio0-4 */ |
233 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 233 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -237,7 +237,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
237 | /* sil_3512 */ | 237 | /* sil_3512 */ |
238 | { | 238 | { |
239 | .sht = &sil_sht, | 239 | .sht = &sil_sht, |
240 | .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, | 240 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, |
241 | .pio_mask = 0x1f, /* pio0-4 */ | 241 | .pio_mask = 0x1f, /* pio0-4 */ |
242 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 242 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
243 | .udma_mask = 0x3f, /* udma0-5 */ | 243 | .udma_mask = 0x3f, /* udma0-5 */ |
@@ -246,7 +246,7 @@ static const struct ata_port_info sil_port_info[] = { | |||
246 | /* sil_3114 */ | 246 | /* sil_3114 */ |
247 | { | 247 | { |
248 | .sht = &sil_sht, | 248 | .sht = &sil_sht, |
249 | .host_flags = SIL_DFL_HOST_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, | 249 | .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, |
250 | .pio_mask = 0x1f, /* pio0-4 */ | 250 | .pio_mask = 0x1f, /* pio0-4 */ |
251 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 251 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
252 | .udma_mask = 0x3f, /* udma0-5 */ | 252 | .udma_mask = 0x3f, /* udma0-5 */ |
@@ -295,10 +295,9 @@ static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) | |||
295 | 295 | ||
296 | static void sil_post_set_mode (struct ata_port *ap) | 296 | static void sil_post_set_mode (struct ata_port *ap) |
297 | { | 297 | { |
298 | struct ata_host_set *host_set = ap->host_set; | 298 | struct ata_host *host = ap->host; |
299 | struct ata_device *dev; | 299 | struct ata_device *dev; |
300 | void __iomem *addr = | 300 | void __iomem *addr = host->mmio_base + sil_port[ap->port_no].xfer_mode; |
301 | host_set->mmio_base + sil_port[ap->port_no].xfer_mode; | ||
302 | u32 tmp, dev_mode[2]; | 301 | u32 tmp, dev_mode[2]; |
303 | unsigned int i; | 302 | unsigned int i; |
304 | 303 | ||
@@ -440,15 +439,15 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) | |||
440 | static irqreturn_t sil_interrupt(int irq, void *dev_instance, | 439 | static irqreturn_t sil_interrupt(int irq, void *dev_instance, |
441 | struct pt_regs *regs) | 440 | struct pt_regs *regs) |
442 | { | 441 | { |
443 | struct ata_host_set *host_set = dev_instance; | 442 | struct ata_host *host = dev_instance; |
444 | void __iomem *mmio_base = host_set->mmio_base; | 443 | void __iomem *mmio_base = host->mmio_base; |
445 | int handled = 0; | 444 | int handled = 0; |
446 | int i; | 445 | int i; |
447 | 446 | ||
448 | spin_lock(&host_set->lock); | 447 | spin_lock(&host->lock); |
449 | 448 | ||
450 | for (i = 0; i < host_set->n_ports; i++) { | 449 | for (i = 0; i < host->n_ports; i++) { |
451 | struct ata_port *ap = host_set->ports[i]; | 450 | struct ata_port *ap = host->ports[i]; |
452 | u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2); | 451 | u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2); |
453 | 452 | ||
454 | if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED)) | 453 | if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED)) |
@@ -466,14 +465,14 @@ static irqreturn_t sil_interrupt(int irq, void *dev_instance, | |||
466 | handled = 1; | 465 | handled = 1; |
467 | } | 466 | } |
468 | 467 | ||
469 | spin_unlock(&host_set->lock); | 468 | spin_unlock(&host->lock); |
470 | 469 | ||
471 | return IRQ_RETVAL(handled); | 470 | return IRQ_RETVAL(handled); |
472 | } | 471 | } |
473 | 472 | ||
474 | static void sil_freeze(struct ata_port *ap) | 473 | static void sil_freeze(struct ata_port *ap) |
475 | { | 474 | { |
476 | void __iomem *mmio_base = ap->host_set->mmio_base; | 475 | void __iomem *mmio_base = ap->host->mmio_base; |
477 | u32 tmp; | 476 | u32 tmp; |
478 | 477 | ||
479 | /* global IRQ mask doesn't block SATA IRQ, turn off explicitly */ | 478 | /* global IRQ mask doesn't block SATA IRQ, turn off explicitly */ |
@@ -488,7 +487,7 @@ static void sil_freeze(struct ata_port *ap) | |||
488 | 487 | ||
489 | static void sil_thaw(struct ata_port *ap) | 488 | static void sil_thaw(struct ata_port *ap) |
490 | { | 489 | { |
491 | void __iomem *mmio_base = ap->host_set->mmio_base; | 490 | void __iomem *mmio_base = ap->host->mmio_base; |
492 | u32 tmp; | 491 | u32 tmp; |
493 | 492 | ||
494 | /* clear IRQ */ | 493 | /* clear IRQ */ |
@@ -567,7 +566,7 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev) | |||
567 | } | 566 | } |
568 | 567 | ||
569 | static void sil_init_controller(struct pci_dev *pdev, | 568 | static void sil_init_controller(struct pci_dev *pdev, |
570 | int n_ports, unsigned long host_flags, | 569 | int n_ports, unsigned long port_flags, |
571 | void __iomem *mmio_base) | 570 | void __iomem *mmio_base) |
572 | { | 571 | { |
573 | u8 cls; | 572 | u8 cls; |
@@ -587,7 +586,7 @@ static void sil_init_controller(struct pci_dev *pdev, | |||
587 | "cache line size not set. Driver may not function\n"); | 586 | "cache line size not set. Driver may not function\n"); |
588 | 587 | ||
589 | /* Apply R_ERR on DMA activate FIS errata workaround */ | 588 | /* Apply R_ERR on DMA activate FIS errata workaround */ |
590 | if (host_flags & SIL_FLAG_RERR_ON_DMA_ACT) { | 589 | if (port_flags & SIL_FLAG_RERR_ON_DMA_ACT) { |
591 | int cnt; | 590 | int cnt; |
592 | 591 | ||
593 | for (i = 0, cnt = 0; i < n_ports; i++) { | 592 | for (i = 0, cnt = 0; i < n_ports; i++) { |
@@ -658,7 +657,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
658 | probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask; | 657 | probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask; |
659 | probe_ent->irq = pdev->irq; | 658 | probe_ent->irq = pdev->irq; |
660 | probe_ent->irq_flags = IRQF_SHARED; | 659 | probe_ent->irq_flags = IRQF_SHARED; |
661 | probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags; | 660 | probe_ent->port_flags = sil_port_info[ent->driver_data].flags; |
662 | 661 | ||
663 | mmio_base = pci_iomap(pdev, 5, 0); | 662 | mmio_base = pci_iomap(pdev, 5, 0); |
664 | if (mmio_base == NULL) { | 663 | if (mmio_base == NULL) { |
@@ -679,7 +678,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
679 | ata_std_ports(&probe_ent->port[i]); | 678 | ata_std_ports(&probe_ent->port[i]); |
680 | } | 679 | } |
681 | 680 | ||
682 | sil_init_controller(pdev, probe_ent->n_ports, probe_ent->host_flags, | 681 | sil_init_controller(pdev, probe_ent->n_ports, probe_ent->port_flags, |
683 | mmio_base); | 682 | mmio_base); |
684 | 683 | ||
685 | pci_set_master(pdev); | 684 | pci_set_master(pdev); |
@@ -703,12 +702,12 @@ err_out: | |||
703 | #ifdef CONFIG_PM | 702 | #ifdef CONFIG_PM |
704 | static int sil_pci_device_resume(struct pci_dev *pdev) | 703 | static int sil_pci_device_resume(struct pci_dev *pdev) |
705 | { | 704 | { |
706 | struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev); | 705 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
707 | 706 | ||
708 | ata_pci_device_do_resume(pdev); | 707 | ata_pci_device_do_resume(pdev); |
709 | sil_init_controller(pdev, host_set->n_ports, host_set->ports[0]->flags, | 708 | sil_init_controller(pdev, host->n_ports, host->ports[0]->flags, |
710 | host_set->mmio_base); | 709 | host->mmio_base); |
711 | ata_host_set_resume(host_set); | 710 | ata_host_resume(host); |
712 | 711 | ||
713 | return 0; | 712 | return 0; |
714 | } | 713 | } |