diff options
Diffstat (limited to 'drivers/ata')
51 files changed, 1272 insertions, 184 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index c2328aed0836..75afa75a515e 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -202,6 +202,18 @@ config SATA_DWC | |||
202 | 202 | ||
203 | If unsure, say N. | 203 | If unsure, say N. |
204 | 204 | ||
205 | config SATA_DWC_DEBUG | ||
206 | bool "Debugging driver version" | ||
207 | depends on SATA_DWC | ||
208 | help | ||
209 | This option enables debugging output in the driver. | ||
210 | |||
211 | config SATA_DWC_VDEBUG | ||
212 | bool "Verbose debug output" | ||
213 | depends on SATA_DWC_DEBUG | ||
214 | help | ||
215 | This option enables the taskfile dumping and NCQ debugging. | ||
216 | |||
205 | config SATA_MV | 217 | config SATA_MV |
206 | tristate "Marvell SATA support" | 218 | tristate "Marvell SATA support" |
207 | help | 219 | help |
@@ -299,6 +311,12 @@ config PATA_AMD | |||
299 | 311 | ||
300 | If unsure, say N. | 312 | If unsure, say N. |
301 | 313 | ||
314 | config PATA_ARASAN_CF | ||
315 | tristate "ARASAN CompactFlash PATA Controller Support" | ||
316 | select DMA_ENGINE | ||
317 | help | ||
318 | Say Y here to support the ARASAN CompactFlash PATA controller | ||
319 | |||
302 | config PATA_ARTOP | 320 | config PATA_ARTOP |
303 | tristate "ARTOP 6210/6260 PATA support" | 321 | tristate "ARTOP 6210/6260 PATA support" |
304 | depends on PCI | 322 | depends on PCI |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 27291aad6ca7..8ac64e1aa051 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -12,6 +12,7 @@ obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o | |||
12 | 12 | ||
13 | # SFF w/ custom DMA | 13 | # SFF w/ custom DMA |
14 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o | 14 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o |
15 | obj-$(CONFIG_PATA_ARASAN_CF) += pata_arasan_cf.o | ||
15 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o | 16 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o |
16 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o | 17 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o |
17 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o | 18 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index b8d96ce37fc9..e62f693be8ea 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -175,8 +175,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
175 | { | 175 | { |
176 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_MSI | | 176 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_MSI | |
177 | AHCI_HFLAG_MV_PATA | AHCI_HFLAG_NO_PMP), | 177 | AHCI_HFLAG_MV_PATA | AHCI_HFLAG_NO_PMP), |
178 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 178 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA, |
179 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA, | ||
180 | .pio_mask = ATA_PIO4, | 179 | .pio_mask = ATA_PIO4, |
181 | .udma_mask = ATA_UDMA6, | 180 | .udma_mask = ATA_UDMA6, |
182 | .port_ops = &ahci_ops, | 181 | .port_ops = &ahci_ops, |
@@ -260,6 +259,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
260 | { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ | 259 | { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ |
261 | { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ | 260 | { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ |
262 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | 261 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ |
262 | { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ | ||
263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ | 263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ |
264 | 264 | ||
265 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 265 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
@@ -383,6 +383,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
383 | .class = PCI_CLASS_STORAGE_SATA_AHCI, | 383 | .class = PCI_CLASS_STORAGE_SATA_AHCI, |
384 | .class_mask = 0xffffff, | 384 | .class_mask = 0xffffff, |
385 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 385 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
386 | { PCI_DEVICE(0x1b4b, 0x9125), | ||
387 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ | ||
388 | { PCI_DEVICE(0x1b4b, 0x91a3), | ||
389 | .driver_data = board_ahci_yes_fbs }, | ||
386 | 390 | ||
387 | /* Promise */ | 391 | /* Promise */ |
388 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ | 392 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 3e606c34f57b..ccaf08122058 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -213,10 +213,8 @@ enum { | |||
213 | 213 | ||
214 | /* ap->flags bits */ | 214 | /* ap->flags bits */ |
215 | 215 | ||
216 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 216 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | |
217 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 217 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN, |
218 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | | ||
219 | ATA_FLAG_LPM, | ||
220 | 218 | ||
221 | ICH_MAP = 0x90, /* ICH MAP register */ | 219 | ICH_MAP = 0x90, /* ICH MAP register */ |
222 | 220 | ||
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 6981f7680a00..721d38bfa339 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -237,7 +237,7 @@ static struct pci_device_id ata_generic[] = { | |||
237 | #endif | 237 | #endif |
238 | /* Intel, IDE class device */ | 238 | /* Intel, IDE class device */ |
239 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 239 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
240 | PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, | 240 | PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, |
241 | .driver_data = ATA_GEN_INTEL_IDER }, | 241 | .driver_data = ATA_GEN_INTEL_IDER }, |
242 | /* Must come last. If you add entries adjust this table appropriately */ | 242 | /* Must come last. If you add entries adjust this table appropriately */ |
243 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL), | 243 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL), |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 6cb14ca8ee85..cdec4ab3b159 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -230,7 +230,7 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
230 | { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, | 230 | { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, |
231 | 231 | ||
232 | /* SATA ports */ | 232 | /* SATA ports */ |
233 | 233 | ||
234 | /* 82801EB (ICH5) */ | 234 | /* 82801EB (ICH5) */ |
235 | { 0x8086, 0x24d1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, | 235 | { 0x8086, 0x24d1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, |
236 | /* 82801EB (ICH5) */ | 236 | /* 82801EB (ICH5) */ |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 8b5ea399a4f4..a791b8ce6294 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -660,8 +660,7 @@ static int ata_acpi_filter_tf(struct ata_device *dev, | |||
660 | * @dev: target ATA device | 660 | * @dev: target ATA device |
661 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) | 661 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) |
662 | * | 662 | * |
663 | * Outputs ATA taskfile to standard ATA host controller using MMIO | 663 | * Outputs ATA taskfile to standard ATA host controller. |
664 | * or PIO as indicated by the ATA_FLAG_MMIO flag. | ||
665 | * Writes the control, feature, nsect, lbal, lbam, and lbah registers. | 664 | * Writes the control, feature, nsect, lbal, lbam, and lbah registers. |
666 | * Optionally (ATA_TFLAG_LBA48) writes hob_feature, hob_nsect, | 665 | * Optionally (ATA_TFLAG_LBA48) writes hob_feature, hob_nsect, |
667 | * hob_lbal, hob_lbam, and hob_lbah. | 666 | * hob_lbal, hob_lbam, and hob_lbah. |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index d4e52e214859..b91e19cab102 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4210,7 +4210,7 @@ static int glob_match (const char *text, const char *pattern) | |||
4210 | return 0; /* End of both strings: match */ | 4210 | return 0; /* End of both strings: match */ |
4211 | return 1; /* No match */ | 4211 | return 1; /* No match */ |
4212 | } | 4212 | } |
4213 | 4213 | ||
4214 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev) | 4214 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev) |
4215 | { | 4215 | { |
4216 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | 4216 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
@@ -5479,7 +5479,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) | |||
5479 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 5479 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
5480 | if (!ap) | 5480 | if (!ap) |
5481 | return NULL; | 5481 | return NULL; |
5482 | 5482 | ||
5483 | ap->pflags |= ATA_PFLAG_INITIALIZING; | 5483 | ap->pflags |= ATA_PFLAG_INITIALIZING; |
5484 | ap->lock = &host->lock; | 5484 | ap->lock = &host->lock; |
5485 | ap->print_id = -1; | 5485 | ap->print_id = -1; |
@@ -5887,21 +5887,9 @@ void ata_host_init(struct ata_host *host, struct device *dev, | |||
5887 | host->ops = ops; | 5887 | host->ops = ops; |
5888 | } | 5888 | } |
5889 | 5889 | ||
5890 | 5890 | int ata_port_probe(struct ata_port *ap) | |
5891 | static void async_port_probe(void *data, async_cookie_t cookie) | ||
5892 | { | 5891 | { |
5893 | int rc; | 5892 | int rc = 0; |
5894 | struct ata_port *ap = data; | ||
5895 | |||
5896 | /* | ||
5897 | * If we're not allowed to scan this host in parallel, | ||
5898 | * we need to wait until all previous scans have completed | ||
5899 | * before going further. | ||
5900 | * Jeff Garzik says this is only within a controller, so we | ||
5901 | * don't need to wait for port 0, only for later ports. | ||
5902 | */ | ||
5903 | if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) | ||
5904 | async_synchronize_cookie(cookie); | ||
5905 | 5893 | ||
5906 | /* probe */ | 5894 | /* probe */ |
5907 | if (ap->ops->error_handler) { | 5895 | if (ap->ops->error_handler) { |
@@ -5927,23 +5915,33 @@ static void async_port_probe(void *data, async_cookie_t cookie) | |||
5927 | DPRINTK("ata%u: bus probe begin\n", ap->print_id); | 5915 | DPRINTK("ata%u: bus probe begin\n", ap->print_id); |
5928 | rc = ata_bus_probe(ap); | 5916 | rc = ata_bus_probe(ap); |
5929 | DPRINTK("ata%u: bus probe end\n", ap->print_id); | 5917 | DPRINTK("ata%u: bus probe end\n", ap->print_id); |
5930 | |||
5931 | if (rc) { | ||
5932 | /* FIXME: do something useful here? | ||
5933 | * Current libata behavior will | ||
5934 | * tear down everything when | ||
5935 | * the module is removed | ||
5936 | * or the h/w is unplugged. | ||
5937 | */ | ||
5938 | } | ||
5939 | } | 5918 | } |
5919 | return rc; | ||
5920 | } | ||
5921 | |||
5922 | |||
5923 | static void async_port_probe(void *data, async_cookie_t cookie) | ||
5924 | { | ||
5925 | struct ata_port *ap = data; | ||
5926 | |||
5927 | /* | ||
5928 | * If we're not allowed to scan this host in parallel, | ||
5929 | * we need to wait until all previous scans have completed | ||
5930 | * before going further. | ||
5931 | * Jeff Garzik says this is only within a controller, so we | ||
5932 | * don't need to wait for port 0, only for later ports. | ||
5933 | */ | ||
5934 | if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) | ||
5935 | async_synchronize_cookie(cookie); | ||
5936 | |||
5937 | (void)ata_port_probe(ap); | ||
5940 | 5938 | ||
5941 | /* in order to keep device order, we need to synchronize at this point */ | 5939 | /* in order to keep device order, we need to synchronize at this point */ |
5942 | async_synchronize_cookie(cookie); | 5940 | async_synchronize_cookie(cookie); |
5943 | 5941 | ||
5944 | ata_scsi_scan_host(ap, 1); | 5942 | ata_scsi_scan_host(ap, 1); |
5945 | |||
5946 | } | 5943 | } |
5944 | |||
5947 | /** | 5945 | /** |
5948 | * ata_host_register - register initialized ATA host | 5946 | * ata_host_register - register initialized ATA host |
5949 | * @host: ATA host to register | 5947 | * @host: ATA host to register |
@@ -5983,7 +5981,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5983 | for (i = 0; i < host->n_ports; i++) | 5981 | for (i = 0; i < host->n_ports; i++) |
5984 | host->ports[i]->print_id = ata_print_id++; | 5982 | host->ports[i]->print_id = ata_print_id++; |
5985 | 5983 | ||
5986 | 5984 | ||
5987 | /* Create associated sysfs transport objects */ | 5985 | /* Create associated sysfs transport objects */ |
5988 | for (i = 0; i < host->n_ports; i++) { | 5986 | for (i = 0; i < host->n_ports; i++) { |
5989 | rc = ata_tport_add(host->dev,host->ports[i]); | 5987 | rc = ata_tport_add(host->dev,host->ports[i]); |
@@ -6471,7 +6469,7 @@ static int __init ata_init(void) | |||
6471 | ata_sff_exit(); | 6469 | ata_sff_exit(); |
6472 | rc = -ENOMEM; | 6470 | rc = -ENOMEM; |
6473 | goto err_out; | 6471 | goto err_out; |
6474 | } | 6472 | } |
6475 | 6473 | ||
6476 | printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n"); | 6474 | printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n"); |
6477 | return 0; | 6475 | return 0; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 17a637877d03..df3f3140c9c7 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -587,11 +587,43 @@ static void ata_eh_unload(struct ata_port *ap) | |||
587 | void ata_scsi_error(struct Scsi_Host *host) | 587 | void ata_scsi_error(struct Scsi_Host *host) |
588 | { | 588 | { |
589 | struct ata_port *ap = ata_shost_to_port(host); | 589 | struct ata_port *ap = ata_shost_to_port(host); |
590 | int i; | ||
591 | unsigned long flags; | 590 | unsigned long flags; |
591 | LIST_HEAD(eh_work_q); | ||
592 | 592 | ||
593 | DPRINTK("ENTER\n"); | 593 | DPRINTK("ENTER\n"); |
594 | 594 | ||
595 | spin_lock_irqsave(host->host_lock, flags); | ||
596 | list_splice_init(&host->eh_cmd_q, &eh_work_q); | ||
597 | spin_unlock_irqrestore(host->host_lock, flags); | ||
598 | |||
599 | ata_scsi_cmd_error_handler(host, ap, &eh_work_q); | ||
600 | |||
601 | /* If we timed raced normal completion and there is nothing to | ||
602 | recover nr_timedout == 0 why exactly are we doing error recovery ? */ | ||
603 | ata_scsi_port_error_handler(host, ap); | ||
604 | |||
605 | /* finish or retry handled scmd's and clean up */ | ||
606 | WARN_ON(host->host_failed || !list_empty(&eh_work_q)); | ||
607 | |||
608 | DPRINTK("EXIT\n"); | ||
609 | } | ||
610 | |||
611 | /** | ||
612 | * ata_scsi_cmd_error_handler - error callback for a list of commands | ||
613 | * @host: scsi host containing the port | ||
614 | * @ap: ATA port within the host | ||
615 | * @eh_work_q: list of commands to process | ||
616 | * | ||
617 | * process the given list of commands and return those finished to the | ||
618 | * ap->eh_done_q. This function is the first part of the libata error | ||
619 | * handler which processes a given list of failed commands. | ||
620 | */ | ||
621 | void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, | ||
622 | struct list_head *eh_work_q) | ||
623 | { | ||
624 | int i; | ||
625 | unsigned long flags; | ||
626 | |||
595 | /* make sure sff pio task is not running */ | 627 | /* make sure sff pio task is not running */ |
596 | ata_sff_flush_pio_task(ap); | 628 | ata_sff_flush_pio_task(ap); |
597 | 629 | ||
@@ -627,7 +659,7 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
627 | if (ap->ops->lost_interrupt) | 659 | if (ap->ops->lost_interrupt) |
628 | ap->ops->lost_interrupt(ap); | 660 | ap->ops->lost_interrupt(ap); |
629 | 661 | ||
630 | list_for_each_entry_safe(scmd, tmp, &host->eh_cmd_q, eh_entry) { | 662 | list_for_each_entry_safe(scmd, tmp, eh_work_q, eh_entry) { |
631 | struct ata_queued_cmd *qc; | 663 | struct ata_queued_cmd *qc; |
632 | 664 | ||
633 | for (i = 0; i < ATA_MAX_QUEUE; i++) { | 665 | for (i = 0; i < ATA_MAX_QUEUE; i++) { |
@@ -671,8 +703,20 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
671 | } else | 703 | } else |
672 | spin_unlock_wait(ap->lock); | 704 | spin_unlock_wait(ap->lock); |
673 | 705 | ||
674 | /* If we timed raced normal completion and there is nothing to | 706 | } |
675 | recover nr_timedout == 0 why exactly are we doing error recovery ? */ | 707 | EXPORT_SYMBOL(ata_scsi_cmd_error_handler); |
708 | |||
709 | /** | ||
710 | * ata_scsi_port_error_handler - recover the port after the commands | ||
711 | * @host: SCSI host containing the port | ||
712 | * @ap: the ATA port | ||
713 | * | ||
714 | * Handle the recovery of the port @ap after all the commands | ||
715 | * have been recovered. | ||
716 | */ | ||
717 | void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) | ||
718 | { | ||
719 | unsigned long flags; | ||
676 | 720 | ||
677 | /* invoke error handler */ | 721 | /* invoke error handler */ |
678 | if (ap->ops->error_handler) { | 722 | if (ap->ops->error_handler) { |
@@ -761,9 +805,6 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
761 | ap->ops->eng_timeout(ap); | 805 | ap->ops->eng_timeout(ap); |
762 | } | 806 | } |
763 | 807 | ||
764 | /* finish or retry handled scmd's and clean up */ | ||
765 | WARN_ON(host->host_failed || !list_empty(&host->eh_cmd_q)); | ||
766 | |||
767 | scsi_eh_flush_done_q(&ap->eh_done_q); | 808 | scsi_eh_flush_done_q(&ap->eh_done_q); |
768 | 809 | ||
769 | /* clean up */ | 810 | /* clean up */ |
@@ -784,9 +825,8 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
784 | wake_up_all(&ap->eh_wait_q); | 825 | wake_up_all(&ap->eh_wait_q); |
785 | 826 | ||
786 | spin_unlock_irqrestore(ap->lock, flags); | 827 | spin_unlock_irqrestore(ap->lock, flags); |
787 | |||
788 | DPRINTK("EXIT\n"); | ||
789 | } | 828 | } |
829 | EXPORT_SYMBOL_GPL(ata_scsi_port_error_handler); | ||
790 | 830 | ||
791 | /** | 831 | /** |
792 | * ata_port_wait_eh - Wait for the currently pending EH to complete | 832 | * ata_port_wait_eh - Wait for the currently pending EH to complete |
@@ -1618,7 +1658,7 @@ static void ata_eh_analyze_serror(struct ata_link *link) | |||
1618 | * host links. For disabled PMP links, only N bit is | 1658 | * host links. For disabled PMP links, only N bit is |
1619 | * considered as X bit is left at 1 for link plugging. | 1659 | * considered as X bit is left at 1 for link plugging. |
1620 | */ | 1660 | */ |
1621 | if (link->lpm_policy != ATA_LPM_MAX_POWER) | 1661 | if (link->lpm_policy > ATA_LPM_MAX_POWER) |
1622 | hotplug_mask = 0; /* hotplug doesn't work w/ LPM */ | 1662 | hotplug_mask = 0; /* hotplug doesn't work w/ LPM */ |
1623 | else if (!(link->flags & ATA_LFLAG_DISABLED) || ata_is_host_link(link)) | 1663 | else if (!(link->flags & ATA_LFLAG_DISABLED) || ata_is_host_link(link)) |
1624 | hotplug_mask = SERR_PHYRDY_CHG | SERR_DEV_XCHG; | 1664 | hotplug_mask = SERR_PHYRDY_CHG | SERR_DEV_XCHG; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 600f6353ecf8..a83419991357 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2056,6 +2056,17 @@ static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf) | |||
2056 | ATA_ID_SERNO_LEN); | 2056 | ATA_ID_SERNO_LEN); |
2057 | num += ATA_ID_SERNO_LEN; | 2057 | num += ATA_ID_SERNO_LEN; |
2058 | 2058 | ||
2059 | if (ata_id_has_wwn(args->id)) { | ||
2060 | /* SAT defined lu world wide name */ | ||
2061 | /* piv=0, assoc=lu, code_set=binary, designator=NAA */ | ||
2062 | rbuf[num + 0] = 1; | ||
2063 | rbuf[num + 1] = 3; | ||
2064 | rbuf[num + 3] = ATA_ID_WWN_LEN; | ||
2065 | num += 4; | ||
2066 | ata_id_string(args->id, (unsigned char *) rbuf + num, | ||
2067 | ATA_ID_WWN, ATA_ID_WWN_LEN); | ||
2068 | num += ATA_ID_WWN_LEN; | ||
2069 | } | ||
2059 | rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ | 2070 | rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ |
2060 | return 0; | 2071 | return 0; |
2061 | } | 2072 | } |
@@ -3759,7 +3770,7 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host, | |||
3759 | return NULL; | 3770 | return NULL; |
3760 | 3771 | ||
3761 | ap->port_no = 0; | 3772 | ap->port_no = 0; |
3762 | ap->lock = shost->host_lock; | 3773 | ap->lock = &host->lock; |
3763 | ap->pio_mask = port_info->pio_mask; | 3774 | ap->pio_mask = port_info->pio_mask; |
3764 | ap->mwdma_mask = port_info->mwdma_mask; | 3775 | ap->mwdma_mask = port_info->mwdma_mask; |
3765 | ap->udma_mask = port_info->udma_mask; | 3776 | ap->udma_mask = port_info->udma_mask; |
@@ -3821,7 +3832,7 @@ int ata_sas_port_init(struct ata_port *ap) | |||
3821 | 3832 | ||
3822 | if (!rc) { | 3833 | if (!rc) { |
3823 | ap->print_id = ata_print_id++; | 3834 | ap->print_id = ata_print_id++; |
3824 | rc = ata_bus_probe(ap); | 3835 | rc = ata_port_probe(ap); |
3825 | } | 3836 | } |
3826 | 3837 | ||
3827 | return rc; | 3838 | return rc; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index af6141bb1ba3..cf7acbc0cfcb 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1302,6 +1302,18 @@ fsm_start: | |||
1302 | } | 1302 | } |
1303 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); | 1303 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); |
1304 | 1304 | ||
1305 | void ata_sff_queue_work(struct work_struct *work) | ||
1306 | { | ||
1307 | queue_work(ata_sff_wq, work); | ||
1308 | } | ||
1309 | EXPORT_SYMBOL_GPL(ata_sff_queue_work); | ||
1310 | |||
1311 | void ata_sff_queue_delayed_work(struct delayed_work *dwork, unsigned long delay) | ||
1312 | { | ||
1313 | queue_delayed_work(ata_sff_wq, dwork, delay); | ||
1314 | } | ||
1315 | EXPORT_SYMBOL_GPL(ata_sff_queue_delayed_work); | ||
1316 | |||
1305 | void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay) | 1317 | void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay) |
1306 | { | 1318 | { |
1307 | struct ata_port *ap = link->ap; | 1319 | struct ata_port *ap = link->ap; |
@@ -1311,8 +1323,7 @@ void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay) | |||
1311 | ap->sff_pio_task_link = link; | 1323 | ap->sff_pio_task_link = link; |
1312 | 1324 | ||
1313 | /* may fail if ata_sff_flush_pio_task() in progress */ | 1325 | /* may fail if ata_sff_flush_pio_task() in progress */ |
1314 | queue_delayed_work(ata_sff_wq, &ap->sff_pio_task, | 1326 | ata_sff_queue_delayed_work(&ap->sff_pio_task, msecs_to_jiffies(delay)); |
1315 | msecs_to_jiffies(delay)); | ||
1316 | } | 1327 | } |
1317 | EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task); | 1328 | EXPORT_SYMBOL_GPL(ata_sff_queue_pio_task); |
1318 | 1329 | ||
@@ -1336,7 +1347,7 @@ static void ata_sff_pio_task(struct work_struct *work) | |||
1336 | u8 status; | 1347 | u8 status; |
1337 | int poll_next; | 1348 | int poll_next; |
1338 | 1349 | ||
1339 | BUG_ON(ap->sff_pio_task_link == NULL); | 1350 | BUG_ON(ap->sff_pio_task_link == NULL); |
1340 | /* qc can be NULL if timeout occurred */ | 1351 | /* qc can be NULL if timeout occurred */ |
1341 | qc = ata_qc_from_tag(ap, link->active_tag); | 1352 | qc = ata_qc_from_tag(ap, link->active_tag); |
1342 | if (!qc) { | 1353 | if (!qc) { |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index a9be110dbf51..773de97988a2 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -103,6 +103,7 @@ extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); | |||
103 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); | 103 | extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); |
104 | extern struct ata_port *ata_port_alloc(struct ata_host *host); | 104 | extern struct ata_port *ata_port_alloc(struct ata_host *host); |
105 | extern const char *sata_spd_string(unsigned int spd); | 105 | extern const char *sata_spd_string(unsigned int spd); |
106 | extern int ata_port_probe(struct ata_port *ap); | ||
106 | 107 | ||
107 | /* libata-acpi.c */ | 108 | /* libata-acpi.c */ |
108 | #ifdef CONFIG_ATA_ACPI | 109 | #ifdef CONFIG_ATA_ACPI |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index c8d47034d5e9..91949d997555 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -245,7 +245,7 @@ static struct ata_port_operations pacpi_ops = { | |||
245 | static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 245 | static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
246 | { | 246 | { |
247 | static const struct ata_port_info info = { | 247 | static const struct ata_port_info info = { |
248 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 248 | .flags = ATA_FLAG_SLAVE_POSS, |
249 | 249 | ||
250 | .pio_mask = ATA_PIO4, | 250 | .pio_mask = ATA_PIO4, |
251 | .mwdma_mask = ATA_MWDMA2, | 251 | .mwdma_mask = ATA_MWDMA2, |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c new file mode 100644 index 000000000000..65cee74605b4 --- /dev/null +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -0,0 +1,983 @@ | |||
1 | /* | ||
2 | * drivers/ata/pata_arasan_cf.c | ||
3 | * | ||
4 | * Arasan Compact Flash host controller source file | ||
5 | * | ||
6 | * Copyright (C) 2011 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * The Arasan CompactFlash Device Controller IP core has three basic modes of | ||
16 | * operation: PC card ATA using I/O mode, PC card ATA using memory mode, PC card | ||
17 | * ATA using true IDE modes. This driver supports only True IDE mode currently. | ||
18 | * | ||
19 | * Arasan CF Controller shares global irq register with Arasan XD Controller. | ||
20 | * | ||
21 | * Tested on arch/arm/mach-spear13xx | ||
22 | */ | ||
23 | |||
24 | #include <linux/ata.h> | ||
25 | #include <linux/clk.h> | ||
26 | #include <linux/completion.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/dmaengine.h> | ||
29 | #include <linux/io.h> | ||
30 | #include <linux/irq.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/libata.h> | ||
33 | #include <linux/module.h> | ||
34 | #include <linux/pata_arasan_cf_data.h> | ||
35 | #include <linux/platform_device.h> | ||
36 | #include <linux/pm.h> | ||
37 | #include <linux/slab.h> | ||
38 | #include <linux/spinlock.h> | ||
39 | #include <linux/types.h> | ||
40 | #include <linux/workqueue.h> | ||
41 | |||
42 | #define DRIVER_NAME "arasan_cf" | ||
43 | #define TIMEOUT msecs_to_jiffies(3000) | ||
44 | |||
45 | /* Registers */ | ||
46 | /* CompactFlash Interface Status */ | ||
47 | #define CFI_STS 0x000 | ||
48 | #define STS_CHG (1) | ||
49 | #define BIN_AUDIO_OUT (1 << 1) | ||
50 | #define CARD_DETECT1 (1 << 2) | ||
51 | #define CARD_DETECT2 (1 << 3) | ||
52 | #define INP_ACK (1 << 4) | ||
53 | #define CARD_READY (1 << 5) | ||
54 | #define IO_READY (1 << 6) | ||
55 | #define B16_IO_PORT_SEL (1 << 7) | ||
56 | /* IRQ */ | ||
57 | #define IRQ_STS 0x004 | ||
58 | /* Interrupt Enable */ | ||
59 | #define IRQ_EN 0x008 | ||
60 | #define CARD_DETECT_IRQ (1) | ||
61 | #define STATUS_CHNG_IRQ (1 << 1) | ||
62 | #define MEM_MODE_IRQ (1 << 2) | ||
63 | #define IO_MODE_IRQ (1 << 3) | ||
64 | #define TRUE_IDE_MODE_IRQ (1 << 8) | ||
65 | #define PIO_XFER_ERR_IRQ (1 << 9) | ||
66 | #define BUF_AVAIL_IRQ (1 << 10) | ||
67 | #define XFER_DONE_IRQ (1 << 11) | ||
68 | #define IGNORED_IRQS (STATUS_CHNG_IRQ | MEM_MODE_IRQ | IO_MODE_IRQ |\ | ||
69 | TRUE_IDE_MODE_IRQ) | ||
70 | #define TRUE_IDE_IRQS (CARD_DETECT_IRQ | PIO_XFER_ERR_IRQ |\ | ||
71 | BUF_AVAIL_IRQ | XFER_DONE_IRQ) | ||
72 | /* Operation Mode */ | ||
73 | #define OP_MODE 0x00C | ||
74 | #define CARD_MODE_MASK (0x3) | ||
75 | #define MEM_MODE (0x0) | ||
76 | #define IO_MODE (0x1) | ||
77 | #define TRUE_IDE_MODE (0x2) | ||
78 | |||
79 | #define CARD_TYPE_MASK (1 << 2) | ||
80 | #define CF_CARD (0) | ||
81 | #define CF_PLUS_CARD (1 << 2) | ||
82 | |||
83 | #define CARD_RESET (1 << 3) | ||
84 | #define CFHOST_ENB (1 << 4) | ||
85 | #define OUTPUTS_TRISTATE (1 << 5) | ||
86 | #define ULTRA_DMA_ENB (1 << 8) | ||
87 | #define MULTI_WORD_DMA_ENB (1 << 9) | ||
88 | #define DRQ_BLOCK_SIZE_MASK (0x3 << 11) | ||
89 | #define DRQ_BLOCK_SIZE_512 (0) | ||
90 | #define DRQ_BLOCK_SIZE_1024 (1 << 11) | ||
91 | #define DRQ_BLOCK_SIZE_2048 (2 << 11) | ||
92 | #define DRQ_BLOCK_SIZE_4096 (3 << 11) | ||
93 | /* CF Interface Clock Configuration */ | ||
94 | #define CLK_CFG 0x010 | ||
95 | #define CF_IF_CLK_MASK (0XF) | ||
96 | /* CF Timing Mode Configuration */ | ||
97 | #define TM_CFG 0x014 | ||
98 | #define MEM_MODE_TIMING_MASK (0x3) | ||
99 | #define MEM_MODE_TIMING_250NS (0x0) | ||
100 | #define MEM_MODE_TIMING_120NS (0x1) | ||
101 | #define MEM_MODE_TIMING_100NS (0x2) | ||
102 | #define MEM_MODE_TIMING_80NS (0x3) | ||
103 | |||
104 | #define IO_MODE_TIMING_MASK (0x3 << 2) | ||
105 | #define IO_MODE_TIMING_250NS (0x0 << 2) | ||
106 | #define IO_MODE_TIMING_120NS (0x1 << 2) | ||
107 | #define IO_MODE_TIMING_100NS (0x2 << 2) | ||
108 | #define IO_MODE_TIMING_80NS (0x3 << 2) | ||
109 | |||
110 | #define TRUEIDE_PIO_TIMING_MASK (0x7 << 4) | ||
111 | #define TRUEIDE_PIO_TIMING_SHIFT 4 | ||
112 | |||
113 | #define TRUEIDE_MWORD_DMA_TIMING_MASK (0x7 << 7) | ||
114 | #define TRUEIDE_MWORD_DMA_TIMING_SHIFT 7 | ||
115 | |||
116 | #define ULTRA_DMA_TIMING_MASK (0x7 << 10) | ||
117 | #define ULTRA_DMA_TIMING_SHIFT 10 | ||
118 | /* CF Transfer Address */ | ||
119 | #define XFER_ADDR 0x014 | ||
120 | #define XFER_ADDR_MASK (0x7FF) | ||
121 | #define MAX_XFER_COUNT 0x20000u | ||
122 | /* Transfer Control */ | ||
123 | #define XFER_CTR 0x01C | ||
124 | #define XFER_COUNT_MASK (0x3FFFF) | ||
125 | #define ADDR_INC_DISABLE (1 << 24) | ||
126 | #define XFER_WIDTH_MASK (1 << 25) | ||
127 | #define XFER_WIDTH_8B (0) | ||
128 | #define XFER_WIDTH_16B (1 << 25) | ||
129 | |||
130 | #define MEM_TYPE_MASK (1 << 26) | ||
131 | #define MEM_TYPE_COMMON (0) | ||
132 | #define MEM_TYPE_ATTRIBUTE (1 << 26) | ||
133 | |||
134 | #define MEM_IO_XFER_MASK (1 << 27) | ||
135 | #define MEM_XFER (0) | ||
136 | #define IO_XFER (1 << 27) | ||
137 | |||
138 | #define DMA_XFER_MODE (1 << 28) | ||
139 | |||
140 | #define AHB_BUS_NORMAL_PIO_OPRTN (~(1 << 29)) | ||
141 | #define XFER_DIR_MASK (1 << 30) | ||
142 | #define XFER_READ (0) | ||
143 | #define XFER_WRITE (1 << 30) | ||
144 | |||
145 | #define XFER_START (1 << 31) | ||
146 | /* Write Data Port */ | ||
147 | #define WRITE_PORT 0x024 | ||
148 | /* Read Data Port */ | ||
149 | #define READ_PORT 0x028 | ||
150 | /* ATA Data Port */ | ||
151 | #define ATA_DATA_PORT 0x030 | ||
152 | #define ATA_DATA_PORT_MASK (0xFFFF) | ||
153 | /* ATA Error/Features */ | ||
154 | #define ATA_ERR_FTR 0x034 | ||
155 | /* ATA Sector Count */ | ||
156 | #define ATA_SC 0x038 | ||
157 | /* ATA Sector Number */ | ||
158 | #define ATA_SN 0x03C | ||
159 | /* ATA Cylinder Low */ | ||
160 | #define ATA_CL 0x040 | ||
161 | /* ATA Cylinder High */ | ||
162 | #define ATA_CH 0x044 | ||
163 | /* ATA Select Card/Head */ | ||
164 | #define ATA_SH 0x048 | ||
165 | /* ATA Status-Command */ | ||
166 | #define ATA_STS_CMD 0x04C | ||
167 | /* ATA Alternate Status/Device Control */ | ||
168 | #define ATA_ASTS_DCTR 0x050 | ||
169 | /* Extended Write Data Port 0x200-0x3FC */ | ||
170 | #define EXT_WRITE_PORT 0x200 | ||
171 | /* Extended Read Data Port 0x400-0x5FC */ | ||
172 | #define EXT_READ_PORT 0x400 | ||
173 | #define FIFO_SIZE 0x200u | ||
174 | /* Global Interrupt Status */ | ||
175 | #define GIRQ_STS 0x800 | ||
176 | /* Global Interrupt Status enable */ | ||
177 | #define GIRQ_STS_EN 0x804 | ||
178 | /* Global Interrupt Signal enable */ | ||
179 | #define GIRQ_SGN_EN 0x808 | ||
180 | #define GIRQ_CF (1) | ||
181 | #define GIRQ_XD (1 << 1) | ||
182 | |||
183 | /* Compact Flash Controller Dev Structure */ | ||
184 | struct arasan_cf_dev { | ||
185 | /* pointer to ata_host structure */ | ||
186 | struct ata_host *host; | ||
187 | /* clk structure, only if HAVE_CLK is defined */ | ||
188 | #ifdef CONFIG_HAVE_CLK | ||
189 | struct clk *clk; | ||
190 | #endif | ||
191 | |||
192 | /* physical base address of controller */ | ||
193 | dma_addr_t pbase; | ||
194 | /* virtual base address of controller */ | ||
195 | void __iomem *vbase; | ||
196 | /* irq number*/ | ||
197 | int irq; | ||
198 | |||
199 | /* status to be updated to framework regarding DMA transfer */ | ||
200 | u8 dma_status; | ||
201 | /* Card is present or Not */ | ||
202 | u8 card_present; | ||
203 | |||
204 | /* dma specific */ | ||
205 | /* Completion for transfer complete interrupt from controller */ | ||
206 | struct completion cf_completion; | ||
207 | /* Completion for DMA transfer complete. */ | ||
208 | struct completion dma_completion; | ||
209 | /* Dma channel allocated */ | ||
210 | struct dma_chan *dma_chan; | ||
211 | /* Mask for DMA transfers */ | ||
212 | dma_cap_mask_t mask; | ||
213 | /* dma channel private data */ | ||
214 | void *dma_priv; | ||
215 | /* DMA transfer work */ | ||
216 | struct work_struct work; | ||
217 | /* DMA delayed finish work */ | ||
218 | struct delayed_work dwork; | ||
219 | /* qc to be transferred using DMA */ | ||
220 | struct ata_queued_cmd *qc; | ||
221 | }; | ||
222 | |||
223 | static struct scsi_host_template arasan_cf_sht = { | ||
224 | ATA_BASE_SHT(DRIVER_NAME), | ||
225 | .sg_tablesize = SG_NONE, | ||
226 | .dma_boundary = 0xFFFFFFFFUL, | ||
227 | }; | ||
228 | |||
229 | static void cf_dumpregs(struct arasan_cf_dev *acdev) | ||
230 | { | ||
231 | struct device *dev = acdev->host->dev; | ||
232 | |||
233 | dev_dbg(dev, ": =========== REGISTER DUMP ==========="); | ||
234 | dev_dbg(dev, ": CFI_STS: %x", readl(acdev->vbase + CFI_STS)); | ||
235 | dev_dbg(dev, ": IRQ_STS: %x", readl(acdev->vbase + IRQ_STS)); | ||
236 | dev_dbg(dev, ": IRQ_EN: %x", readl(acdev->vbase + IRQ_EN)); | ||
237 | dev_dbg(dev, ": OP_MODE: %x", readl(acdev->vbase + OP_MODE)); | ||
238 | dev_dbg(dev, ": CLK_CFG: %x", readl(acdev->vbase + CLK_CFG)); | ||
239 | dev_dbg(dev, ": TM_CFG: %x", readl(acdev->vbase + TM_CFG)); | ||
240 | dev_dbg(dev, ": XFER_CTR: %x", readl(acdev->vbase + XFER_CTR)); | ||
241 | dev_dbg(dev, ": GIRQ_STS: %x", readl(acdev->vbase + GIRQ_STS)); | ||
242 | dev_dbg(dev, ": GIRQ_STS_EN: %x", readl(acdev->vbase + GIRQ_STS_EN)); | ||
243 | dev_dbg(dev, ": GIRQ_SGN_EN: %x", readl(acdev->vbase + GIRQ_SGN_EN)); | ||
244 | dev_dbg(dev, ": ====================================="); | ||
245 | } | ||
246 | |||
247 | /* Enable/Disable global interrupts shared between CF and XD ctrlr. */ | ||
248 | static void cf_ginterrupt_enable(struct arasan_cf_dev *acdev, bool enable) | ||
249 | { | ||
250 | /* enable should be 0 or 1 */ | ||
251 | writel(enable, acdev->vbase + GIRQ_STS_EN); | ||
252 | writel(enable, acdev->vbase + GIRQ_SGN_EN); | ||
253 | } | ||
254 | |||
255 | /* Enable/Disable CF interrupts */ | ||
256 | static inline void | ||
257 | cf_interrupt_enable(struct arasan_cf_dev *acdev, u32 mask, bool enable) | ||
258 | { | ||
259 | u32 val = readl(acdev->vbase + IRQ_EN); | ||
260 | /* clear & enable/disable irqs */ | ||
261 | if (enable) { | ||
262 | writel(mask, acdev->vbase + IRQ_STS); | ||
263 | writel(val | mask, acdev->vbase + IRQ_EN); | ||
264 | } else | ||
265 | writel(val & ~mask, acdev->vbase + IRQ_EN); | ||
266 | } | ||
267 | |||
268 | static inline void cf_card_reset(struct arasan_cf_dev *acdev) | ||
269 | { | ||
270 | u32 val = readl(acdev->vbase + OP_MODE); | ||
271 | |||
272 | writel(val | CARD_RESET, acdev->vbase + OP_MODE); | ||
273 | udelay(200); | ||
274 | writel(val & ~CARD_RESET, acdev->vbase + OP_MODE); | ||
275 | } | ||
276 | |||
277 | static inline void cf_ctrl_reset(struct arasan_cf_dev *acdev) | ||
278 | { | ||
279 | writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB, | ||
280 | acdev->vbase + OP_MODE); | ||
281 | writel(readl(acdev->vbase + OP_MODE) | CFHOST_ENB, | ||
282 | acdev->vbase + OP_MODE); | ||
283 | } | ||
284 | |||
285 | static void cf_card_detect(struct arasan_cf_dev *acdev, bool hotplugged) | ||
286 | { | ||
287 | struct ata_port *ap = acdev->host->ports[0]; | ||
288 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
289 | u32 val = readl(acdev->vbase + CFI_STS); | ||
290 | |||
291 | /* Both CD1 & CD2 should be low if card inserted completely */ | ||
292 | if (!(val & (CARD_DETECT1 | CARD_DETECT2))) { | ||
293 | if (acdev->card_present) | ||
294 | return; | ||
295 | acdev->card_present = 1; | ||
296 | cf_card_reset(acdev); | ||
297 | } else { | ||
298 | if (!acdev->card_present) | ||
299 | return; | ||
300 | acdev->card_present = 0; | ||
301 | } | ||
302 | |||
303 | if (hotplugged) { | ||
304 | ata_ehi_hotplugged(ehi); | ||
305 | ata_port_freeze(ap); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | static int cf_init(struct arasan_cf_dev *acdev) | ||
310 | { | ||
311 | struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev); | ||
312 | unsigned long flags; | ||
313 | int ret = 0; | ||
314 | |||
315 | #ifdef CONFIG_HAVE_CLK | ||
316 | ret = clk_enable(acdev->clk); | ||
317 | if (ret) { | ||
318 | dev_dbg(acdev->host->dev, "clock enable failed"); | ||
319 | return ret; | ||
320 | } | ||
321 | #endif | ||
322 | |||
323 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
324 | /* configure CF interface clock */ | ||
325 | writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk : | ||
326 | CF_IF_CLK_166M, acdev->vbase + CLK_CFG); | ||
327 | |||
328 | writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE); | ||
329 | cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1); | ||
330 | cf_ginterrupt_enable(acdev, 1); | ||
331 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
332 | |||
333 | return ret; | ||
334 | } | ||
335 | |||
336 | static void cf_exit(struct arasan_cf_dev *acdev) | ||
337 | { | ||
338 | unsigned long flags; | ||
339 | |||
340 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
341 | cf_ginterrupt_enable(acdev, 0); | ||
342 | cf_interrupt_enable(acdev, TRUE_IDE_IRQS, 0); | ||
343 | cf_card_reset(acdev); | ||
344 | writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB, | ||
345 | acdev->vbase + OP_MODE); | ||
346 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
347 | #ifdef CONFIG_HAVE_CLK | ||
348 | clk_disable(acdev->clk); | ||
349 | #endif | ||
350 | } | ||
351 | |||
352 | static void dma_callback(void *dev) | ||
353 | { | ||
354 | struct arasan_cf_dev *acdev = (struct arasan_cf_dev *) dev; | ||
355 | |||
356 | complete(&acdev->dma_completion); | ||
357 | } | ||
358 | |||
359 | static bool filter(struct dma_chan *chan, void *slave) | ||
360 | { | ||
361 | chan->private = slave; | ||
362 | return true; | ||
363 | } | ||
364 | |||
365 | static inline void dma_complete(struct arasan_cf_dev *acdev) | ||
366 | { | ||
367 | struct ata_queued_cmd *qc = acdev->qc; | ||
368 | unsigned long flags; | ||
369 | |||
370 | acdev->qc = NULL; | ||
371 | ata_sff_interrupt(acdev->irq, acdev->host); | ||
372 | |||
373 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
374 | if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol)) | ||
375 | ata_ehi_push_desc(&qc->ap->link.eh_info, "DMA Failed: Timeout"); | ||
376 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
377 | } | ||
378 | |||
379 | static inline int wait4buf(struct arasan_cf_dev *acdev) | ||
380 | { | ||
381 | if (!wait_for_completion_timeout(&acdev->cf_completion, TIMEOUT)) { | ||
382 | u32 rw = acdev->qc->tf.flags & ATA_TFLAG_WRITE; | ||
383 | |||
384 | dev_err(acdev->host->dev, "%s TimeOut", rw ? "write" : "read"); | ||
385 | return -ETIMEDOUT; | ||
386 | } | ||
387 | |||
388 | /* Check if PIO Error interrupt has occured */ | ||
389 | if (acdev->dma_status & ATA_DMA_ERR) | ||
390 | return -EAGAIN; | ||
391 | |||
392 | return 0; | ||
393 | } | ||
394 | |||
395 | static int | ||
396 | dma_xfer(struct arasan_cf_dev *acdev, dma_addr_t src, dma_addr_t dest, u32 len) | ||
397 | { | ||
398 | struct dma_async_tx_descriptor *tx; | ||
399 | struct dma_chan *chan = acdev->dma_chan; | ||
400 | dma_cookie_t cookie; | ||
401 | unsigned long flags = DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_SRC_UNMAP | | ||
402 | DMA_COMPL_SKIP_DEST_UNMAP; | ||
403 | int ret = 0; | ||
404 | |||
405 | tx = chan->device->device_prep_dma_memcpy(chan, dest, src, len, flags); | ||
406 | if (!tx) { | ||
407 | dev_err(acdev->host->dev, "device_prep_dma_memcpy failed\n"); | ||
408 | return -EAGAIN; | ||
409 | } | ||
410 | |||
411 | tx->callback = dma_callback; | ||
412 | tx->callback_param = acdev; | ||
413 | cookie = tx->tx_submit(tx); | ||
414 | |||
415 | ret = dma_submit_error(cookie); | ||
416 | if (ret) { | ||
417 | dev_err(acdev->host->dev, "dma_submit_error\n"); | ||
418 | return ret; | ||
419 | } | ||
420 | |||
421 | chan->device->device_issue_pending(chan); | ||
422 | |||
423 | /* Wait for DMA to complete */ | ||
424 | if (!wait_for_completion_timeout(&acdev->dma_completion, TIMEOUT)) { | ||
425 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); | ||
426 | dev_err(acdev->host->dev, "wait_for_completion_timeout\n"); | ||
427 | return -ETIMEDOUT; | ||
428 | } | ||
429 | |||
430 | return ret; | ||
431 | } | ||
432 | |||
433 | static int sg_xfer(struct arasan_cf_dev *acdev, struct scatterlist *sg) | ||
434 | { | ||
435 | dma_addr_t dest = 0, src = 0; | ||
436 | u32 xfer_cnt, sglen, dma_len, xfer_ctr; | ||
437 | u32 write = acdev->qc->tf.flags & ATA_TFLAG_WRITE; | ||
438 | unsigned long flags; | ||
439 | int ret = 0; | ||
440 | |||
441 | sglen = sg_dma_len(sg); | ||
442 | if (write) { | ||
443 | src = sg_dma_address(sg); | ||
444 | dest = acdev->pbase + EXT_WRITE_PORT; | ||
445 | } else { | ||
446 | dest = sg_dma_address(sg); | ||
447 | src = acdev->pbase + EXT_READ_PORT; | ||
448 | } | ||
449 | |||
450 | /* | ||
451 | * For each sg: | ||
452 | * MAX_XFER_COUNT data will be transferred before we get transfer | ||
453 | * complete interrupt. Inbetween after FIFO_SIZE data | ||
454 | * buffer available interrupt will be generated. At this time we will | ||
455 | * fill FIFO again: max FIFO_SIZE data. | ||
456 | */ | ||
457 | while (sglen) { | ||
458 | xfer_cnt = min(sglen, MAX_XFER_COUNT); | ||
459 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
460 | xfer_ctr = readl(acdev->vbase + XFER_CTR) & | ||
461 | ~XFER_COUNT_MASK; | ||
462 | writel(xfer_ctr | xfer_cnt | XFER_START, | ||
463 | acdev->vbase + XFER_CTR); | ||
464 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
465 | |||
466 | /* continue dma xfers untill current sg is completed */ | ||
467 | while (xfer_cnt) { | ||
468 | /* wait for read to complete */ | ||
469 | if (!write) { | ||
470 | ret = wait4buf(acdev); | ||
471 | if (ret) | ||
472 | goto fail; | ||
473 | } | ||
474 | |||
475 | /* read/write FIFO in chunk of FIFO_SIZE */ | ||
476 | dma_len = min(xfer_cnt, FIFO_SIZE); | ||
477 | ret = dma_xfer(acdev, src, dest, dma_len); | ||
478 | if (ret) { | ||
479 | dev_err(acdev->host->dev, "dma failed"); | ||
480 | goto fail; | ||
481 | } | ||
482 | |||
483 | if (write) | ||
484 | src += dma_len; | ||
485 | else | ||
486 | dest += dma_len; | ||
487 | |||
488 | sglen -= dma_len; | ||
489 | xfer_cnt -= dma_len; | ||
490 | |||
491 | /* wait for write to complete */ | ||
492 | if (write) { | ||
493 | ret = wait4buf(acdev); | ||
494 | if (ret) | ||
495 | goto fail; | ||
496 | } | ||
497 | } | ||
498 | } | ||
499 | |||
500 | fail: | ||
501 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
502 | writel(readl(acdev->vbase + XFER_CTR) & ~XFER_START, | ||
503 | acdev->vbase + XFER_CTR); | ||
504 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
505 | |||
506 | return ret; | ||
507 | } | ||
508 | |||
509 | /* | ||
510 | * This routine uses External DMA controller to read/write data to FIFO of CF | ||
511 | * controller. There are two xfer related interrupt supported by CF controller: | ||
512 | * - buf_avail: This interrupt is generated as soon as we have buffer of 512 | ||
513 | * bytes available for reading or empty buffer available for writing. | ||
514 | * - xfer_done: This interrupt is generated on transfer of "xfer_size" amount of | ||
515 | * data to/from FIFO. xfer_size is programmed in XFER_CTR register. | ||
516 | * | ||
517 | * Max buffer size = FIFO_SIZE = 512 Bytes. | ||
518 | * Max xfer_size = MAX_XFER_COUNT = 256 KB. | ||
519 | */ | ||
520 | static void data_xfer(struct work_struct *work) | ||
521 | { | ||
522 | struct arasan_cf_dev *acdev = container_of(work, struct arasan_cf_dev, | ||
523 | work); | ||
524 | struct ata_queued_cmd *qc = acdev->qc; | ||
525 | struct scatterlist *sg; | ||
526 | unsigned long flags; | ||
527 | u32 temp; | ||
528 | int ret = 0; | ||
529 | |||
530 | /* request dma channels */ | ||
531 | /* dma_request_channel may sleep, so calling from process context */ | ||
532 | acdev->dma_chan = dma_request_channel(acdev->mask, filter, | ||
533 | acdev->dma_priv); | ||
534 | if (!acdev->dma_chan) { | ||
535 | dev_err(acdev->host->dev, "Unable to get dma_chan\n"); | ||
536 | goto chan_request_fail; | ||
537 | } | ||
538 | |||
539 | for_each_sg(qc->sg, sg, qc->n_elem, temp) { | ||
540 | ret = sg_xfer(acdev, sg); | ||
541 | if (ret) | ||
542 | break; | ||
543 | } | ||
544 | |||
545 | dma_release_channel(acdev->dma_chan); | ||
546 | |||
547 | /* data xferred successfully */ | ||
548 | if (!ret) { | ||
549 | u32 status; | ||
550 | |||
551 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
552 | status = ioread8(qc->ap->ioaddr.altstatus_addr); | ||
553 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
554 | if (status & (ATA_BUSY | ATA_DRQ)) { | ||
555 | ata_sff_queue_delayed_work(&acdev->dwork, 1); | ||
556 | return; | ||
557 | } | ||
558 | |||
559 | goto sff_intr; | ||
560 | } | ||
561 | |||
562 | cf_dumpregs(acdev); | ||
563 | |||
564 | chan_request_fail: | ||
565 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
566 | /* error when transfering data to/from memory */ | ||
567 | qc->err_mask |= AC_ERR_HOST_BUS; | ||
568 | qc->ap->hsm_task_state = HSM_ST_ERR; | ||
569 | |||
570 | cf_ctrl_reset(acdev); | ||
571 | spin_unlock_irqrestore(qc->ap->lock, flags); | ||
572 | sff_intr: | ||
573 | dma_complete(acdev); | ||
574 | } | ||
575 | |||
576 | static void delayed_finish(struct work_struct *work) | ||
577 | { | ||
578 | struct arasan_cf_dev *acdev = container_of(work, struct arasan_cf_dev, | ||
579 | dwork.work); | ||
580 | struct ata_queued_cmd *qc = acdev->qc; | ||
581 | unsigned long flags; | ||
582 | u8 status; | ||
583 | |||
584 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
585 | status = ioread8(qc->ap->ioaddr.altstatus_addr); | ||
586 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
587 | |||
588 | if (status & (ATA_BUSY | ATA_DRQ)) | ||
589 | ata_sff_queue_delayed_work(&acdev->dwork, 1); | ||
590 | else | ||
591 | dma_complete(acdev); | ||
592 | } | ||
593 | |||
594 | static irqreturn_t arasan_cf_interrupt(int irq, void *dev) | ||
595 | { | ||
596 | struct arasan_cf_dev *acdev = ((struct ata_host *)dev)->private_data; | ||
597 | unsigned long flags; | ||
598 | u32 irqsts; | ||
599 | |||
600 | irqsts = readl(acdev->vbase + GIRQ_STS); | ||
601 | if (!(irqsts & GIRQ_CF)) | ||
602 | return IRQ_NONE; | ||
603 | |||
604 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
605 | irqsts = readl(acdev->vbase + IRQ_STS); | ||
606 | writel(irqsts, acdev->vbase + IRQ_STS); /* clear irqs */ | ||
607 | writel(GIRQ_CF, acdev->vbase + GIRQ_STS); /* clear girqs */ | ||
608 | |||
609 | /* handle only relevant interrupts */ | ||
610 | irqsts &= ~IGNORED_IRQS; | ||
611 | |||
612 | if (irqsts & CARD_DETECT_IRQ) { | ||
613 | cf_card_detect(acdev, 1); | ||
614 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
615 | return IRQ_HANDLED; | ||
616 | } | ||
617 | |||
618 | if (irqsts & PIO_XFER_ERR_IRQ) { | ||
619 | acdev->dma_status = ATA_DMA_ERR; | ||
620 | writel(readl(acdev->vbase + XFER_CTR) & ~XFER_START, | ||
621 | acdev->vbase + XFER_CTR); | ||
622 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
623 | complete(&acdev->cf_completion); | ||
624 | dev_err(acdev->host->dev, "pio xfer err irq\n"); | ||
625 | return IRQ_HANDLED; | ||
626 | } | ||
627 | |||
628 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
629 | |||
630 | if (irqsts & BUF_AVAIL_IRQ) { | ||
631 | complete(&acdev->cf_completion); | ||
632 | return IRQ_HANDLED; | ||
633 | } | ||
634 | |||
635 | if (irqsts & XFER_DONE_IRQ) { | ||
636 | struct ata_queued_cmd *qc = acdev->qc; | ||
637 | |||
638 | /* Send Complete only for write */ | ||
639 | if (qc->tf.flags & ATA_TFLAG_WRITE) | ||
640 | complete(&acdev->cf_completion); | ||
641 | } | ||
642 | |||
643 | return IRQ_HANDLED; | ||
644 | } | ||
645 | |||
646 | static void arasan_cf_freeze(struct ata_port *ap) | ||
647 | { | ||
648 | struct arasan_cf_dev *acdev = ap->host->private_data; | ||
649 | |||
650 | /* stop transfer and reset controller */ | ||
651 | writel(readl(acdev->vbase + XFER_CTR) & ~XFER_START, | ||
652 | acdev->vbase + XFER_CTR); | ||
653 | cf_ctrl_reset(acdev); | ||
654 | acdev->dma_status = ATA_DMA_ERR; | ||
655 | |||
656 | ata_sff_dma_pause(ap); | ||
657 | ata_sff_freeze(ap); | ||
658 | } | ||
659 | |||
660 | void arasan_cf_error_handler(struct ata_port *ap) | ||
661 | { | ||
662 | struct arasan_cf_dev *acdev = ap->host->private_data; | ||
663 | |||
664 | /* | ||
665 | * DMA transfers using an external DMA controller may be scheduled. | ||
666 | * Abort them before handling error. Refer data_xfer() for further | ||
667 | * details. | ||
668 | */ | ||
669 | cancel_work_sync(&acdev->work); | ||
670 | cancel_delayed_work_sync(&acdev->dwork); | ||
671 | return ata_sff_error_handler(ap); | ||
672 | } | ||
673 | |||
674 | static void arasan_cf_dma_start(struct arasan_cf_dev *acdev) | ||
675 | { | ||
676 | u32 xfer_ctr = readl(acdev->vbase + XFER_CTR) & ~XFER_DIR_MASK; | ||
677 | u32 write = acdev->qc->tf.flags & ATA_TFLAG_WRITE; | ||
678 | |||
679 | xfer_ctr |= write ? XFER_WRITE : XFER_READ; | ||
680 | writel(xfer_ctr, acdev->vbase + XFER_CTR); | ||
681 | |||
682 | acdev->qc->ap->ops->sff_exec_command(acdev->qc->ap, &acdev->qc->tf); | ||
683 | ata_sff_queue_work(&acdev->work); | ||
684 | } | ||
685 | |||
686 | unsigned int arasan_cf_qc_issue(struct ata_queued_cmd *qc) | ||
687 | { | ||
688 | struct ata_port *ap = qc->ap; | ||
689 | struct arasan_cf_dev *acdev = ap->host->private_data; | ||
690 | |||
691 | /* defer PIO handling to sff_qc_issue */ | ||
692 | if (!ata_is_dma(qc->tf.protocol)) | ||
693 | return ata_sff_qc_issue(qc); | ||
694 | |||
695 | /* select the device */ | ||
696 | ata_wait_idle(ap); | ||
697 | ata_sff_dev_select(ap, qc->dev->devno); | ||
698 | ata_wait_idle(ap); | ||
699 | |||
700 | /* start the command */ | ||
701 | switch (qc->tf.protocol) { | ||
702 | case ATA_PROT_DMA: | ||
703 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); | ||
704 | |||
705 | ap->ops->sff_tf_load(ap, &qc->tf); | ||
706 | acdev->dma_status = 0; | ||
707 | acdev->qc = qc; | ||
708 | arasan_cf_dma_start(acdev); | ||
709 | ap->hsm_task_state = HSM_ST_LAST; | ||
710 | break; | ||
711 | |||
712 | default: | ||
713 | WARN_ON(1); | ||
714 | return AC_ERR_SYSTEM; | ||
715 | } | ||
716 | |||
717 | return 0; | ||
718 | } | ||
719 | |||
720 | static void arasan_cf_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
721 | { | ||
722 | struct arasan_cf_dev *acdev = ap->host->private_data; | ||
723 | u8 pio = adev->pio_mode - XFER_PIO_0; | ||
724 | unsigned long flags; | ||
725 | u32 val; | ||
726 | |||
727 | /* Arasan ctrl supports Mode0 -> Mode6 */ | ||
728 | if (pio > 6) { | ||
729 | dev_err(ap->dev, "Unknown PIO mode\n"); | ||
730 | return; | ||
731 | } | ||
732 | |||
733 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
734 | val = readl(acdev->vbase + OP_MODE) & | ||
735 | ~(ULTRA_DMA_ENB | MULTI_WORD_DMA_ENB | DRQ_BLOCK_SIZE_MASK); | ||
736 | writel(val, acdev->vbase + OP_MODE); | ||
737 | val = readl(acdev->vbase + TM_CFG) & ~TRUEIDE_PIO_TIMING_MASK; | ||
738 | val |= pio << TRUEIDE_PIO_TIMING_SHIFT; | ||
739 | writel(val, acdev->vbase + TM_CFG); | ||
740 | |||
741 | cf_interrupt_enable(acdev, BUF_AVAIL_IRQ | XFER_DONE_IRQ, 0); | ||
742 | cf_interrupt_enable(acdev, PIO_XFER_ERR_IRQ, 1); | ||
743 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
744 | } | ||
745 | |||
746 | static void arasan_cf_set_dmamode(struct ata_port *ap, struct ata_device *adev) | ||
747 | { | ||
748 | struct arasan_cf_dev *acdev = ap->host->private_data; | ||
749 | u32 opmode, tmcfg, dma_mode = adev->dma_mode; | ||
750 | unsigned long flags; | ||
751 | |||
752 | spin_lock_irqsave(&acdev->host->lock, flags); | ||
753 | opmode = readl(acdev->vbase + OP_MODE) & | ||
754 | ~(MULTI_WORD_DMA_ENB | ULTRA_DMA_ENB); | ||
755 | tmcfg = readl(acdev->vbase + TM_CFG); | ||
756 | |||
757 | if ((dma_mode >= XFER_UDMA_0) && (dma_mode <= XFER_UDMA_6)) { | ||
758 | opmode |= ULTRA_DMA_ENB; | ||
759 | tmcfg &= ~ULTRA_DMA_TIMING_MASK; | ||
760 | tmcfg |= (dma_mode - XFER_UDMA_0) << ULTRA_DMA_TIMING_SHIFT; | ||
761 | } else if ((dma_mode >= XFER_MW_DMA_0) && (dma_mode <= XFER_MW_DMA_4)) { | ||
762 | opmode |= MULTI_WORD_DMA_ENB; | ||
763 | tmcfg &= ~TRUEIDE_MWORD_DMA_TIMING_MASK; | ||
764 | tmcfg |= (dma_mode - XFER_MW_DMA_0) << | ||
765 | TRUEIDE_MWORD_DMA_TIMING_SHIFT; | ||
766 | } else { | ||
767 | dev_err(ap->dev, "Unknown DMA mode\n"); | ||
768 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
769 | return; | ||
770 | } | ||
771 | |||
772 | writel(opmode, acdev->vbase + OP_MODE); | ||
773 | writel(tmcfg, acdev->vbase + TM_CFG); | ||
774 | writel(DMA_XFER_MODE, acdev->vbase + XFER_CTR); | ||
775 | |||
776 | cf_interrupt_enable(acdev, PIO_XFER_ERR_IRQ, 0); | ||
777 | cf_interrupt_enable(acdev, BUF_AVAIL_IRQ | XFER_DONE_IRQ, 1); | ||
778 | spin_unlock_irqrestore(&acdev->host->lock, flags); | ||
779 | } | ||
780 | |||
781 | static struct ata_port_operations arasan_cf_ops = { | ||
782 | .inherits = &ata_sff_port_ops, | ||
783 | .freeze = arasan_cf_freeze, | ||
784 | .error_handler = arasan_cf_error_handler, | ||
785 | .qc_issue = arasan_cf_qc_issue, | ||
786 | .set_piomode = arasan_cf_set_piomode, | ||
787 | .set_dmamode = arasan_cf_set_dmamode, | ||
788 | }; | ||
789 | |||
790 | static int __devinit arasan_cf_probe(struct platform_device *pdev) | ||
791 | { | ||
792 | struct arasan_cf_dev *acdev; | ||
793 | struct arasan_cf_pdata *pdata = dev_get_platdata(&pdev->dev); | ||
794 | struct ata_host *host; | ||
795 | struct ata_port *ap; | ||
796 | struct resource *res; | ||
797 | irq_handler_t irq_handler = NULL; | ||
798 | int ret = 0; | ||
799 | |||
800 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
801 | if (!res) | ||
802 | return -EINVAL; | ||
803 | |||
804 | if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res), | ||
805 | DRIVER_NAME)) { | ||
806 | dev_warn(&pdev->dev, "Failed to get memory region resource\n"); | ||
807 | return -ENOENT; | ||
808 | } | ||
809 | |||
810 | acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL); | ||
811 | if (!acdev) { | ||
812 | dev_warn(&pdev->dev, "kzalloc fail\n"); | ||
813 | return -ENOMEM; | ||
814 | } | ||
815 | |||
816 | /* if irq is 0, support only PIO */ | ||
817 | acdev->irq = platform_get_irq(pdev, 0); | ||
818 | if (acdev->irq) | ||
819 | irq_handler = arasan_cf_interrupt; | ||
820 | else | ||
821 | pdata->quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; | ||
822 | |||
823 | acdev->pbase = res->start; | ||
824 | acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, | ||
825 | resource_size(res)); | ||
826 | if (!acdev->vbase) { | ||
827 | dev_warn(&pdev->dev, "ioremap fail\n"); | ||
828 | return -ENOMEM; | ||
829 | } | ||
830 | |||
831 | #ifdef CONFIG_HAVE_CLK | ||
832 | acdev->clk = clk_get(&pdev->dev, NULL); | ||
833 | if (IS_ERR(acdev->clk)) { | ||
834 | dev_warn(&pdev->dev, "Clock not found\n"); | ||
835 | return PTR_ERR(acdev->clk); | ||
836 | } | ||
837 | #endif | ||
838 | |||
839 | /* allocate host */ | ||
840 | host = ata_host_alloc(&pdev->dev, 1); | ||
841 | if (!host) { | ||
842 | ret = -ENOMEM; | ||
843 | dev_warn(&pdev->dev, "alloc host fail\n"); | ||
844 | goto free_clk; | ||
845 | } | ||
846 | |||
847 | ap = host->ports[0]; | ||
848 | host->private_data = acdev; | ||
849 | acdev->host = host; | ||
850 | ap->ops = &arasan_cf_ops; | ||
851 | ap->pio_mask = ATA_PIO6; | ||
852 | ap->mwdma_mask = ATA_MWDMA4; | ||
853 | ap->udma_mask = ATA_UDMA6; | ||
854 | |||
855 | init_completion(&acdev->cf_completion); | ||
856 | init_completion(&acdev->dma_completion); | ||
857 | INIT_WORK(&acdev->work, data_xfer); | ||
858 | INIT_DELAYED_WORK(&acdev->dwork, delayed_finish); | ||
859 | dma_cap_set(DMA_MEMCPY, acdev->mask); | ||
860 | acdev->dma_priv = pdata->dma_priv; | ||
861 | |||
862 | /* Handle platform specific quirks */ | ||
863 | if (pdata->quirk) { | ||
864 | if (pdata->quirk & CF_BROKEN_PIO) { | ||
865 | ap->ops->set_piomode = NULL; | ||
866 | ap->pio_mask = 0; | ||
867 | } | ||
868 | if (pdata->quirk & CF_BROKEN_MWDMA) | ||
869 | ap->mwdma_mask = 0; | ||
870 | if (pdata->quirk & CF_BROKEN_UDMA) | ||
871 | ap->udma_mask = 0; | ||
872 | } | ||
873 | ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI; | ||
874 | |||
875 | ap->ioaddr.cmd_addr = acdev->vbase + ATA_DATA_PORT; | ||
876 | ap->ioaddr.data_addr = acdev->vbase + ATA_DATA_PORT; | ||
877 | ap->ioaddr.error_addr = acdev->vbase + ATA_ERR_FTR; | ||
878 | ap->ioaddr.feature_addr = acdev->vbase + ATA_ERR_FTR; | ||
879 | ap->ioaddr.nsect_addr = acdev->vbase + ATA_SC; | ||
880 | ap->ioaddr.lbal_addr = acdev->vbase + ATA_SN; | ||
881 | ap->ioaddr.lbam_addr = acdev->vbase + ATA_CL; | ||
882 | ap->ioaddr.lbah_addr = acdev->vbase + ATA_CH; | ||
883 | ap->ioaddr.device_addr = acdev->vbase + ATA_SH; | ||
884 | ap->ioaddr.status_addr = acdev->vbase + ATA_STS_CMD; | ||
885 | ap->ioaddr.command_addr = acdev->vbase + ATA_STS_CMD; | ||
886 | ap->ioaddr.altstatus_addr = acdev->vbase + ATA_ASTS_DCTR; | ||
887 | ap->ioaddr.ctl_addr = acdev->vbase + ATA_ASTS_DCTR; | ||
888 | |||
889 | ata_port_desc(ap, "phy_addr %llx virt_addr %p", | ||
890 | (unsigned long long) res->start, acdev->vbase); | ||
891 | |||
892 | ret = cf_init(acdev); | ||
893 | if (ret) | ||
894 | goto free_clk; | ||
895 | |||
896 | cf_card_detect(acdev, 0); | ||
897 | |||
898 | return ata_host_activate(host, acdev->irq, irq_handler, 0, | ||
899 | &arasan_cf_sht); | ||
900 | |||
901 | free_clk: | ||
902 | #ifdef CONFIG_HAVE_CLK | ||
903 | clk_put(acdev->clk); | ||
904 | #endif | ||
905 | return ret; | ||
906 | } | ||
907 | |||
908 | static int __devexit arasan_cf_remove(struct platform_device *pdev) | ||
909 | { | ||
910 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
911 | struct arasan_cf_dev *acdev = host->ports[0]->private_data; | ||
912 | |||
913 | ata_host_detach(host); | ||
914 | cf_exit(acdev); | ||
915 | #ifdef CONFIG_HAVE_CLK | ||
916 | clk_put(acdev->clk); | ||
917 | #endif | ||
918 | |||
919 | return 0; | ||
920 | } | ||
921 | |||
922 | #ifdef CONFIG_PM | ||
923 | static int arasan_cf_suspend(struct device *dev) | ||
924 | { | ||
925 | struct platform_device *pdev = to_platform_device(dev); | ||
926 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
927 | struct arasan_cf_dev *acdev = host->ports[0]->private_data; | ||
928 | |||
929 | if (acdev->dma_chan) { | ||
930 | acdev->dma_chan->device->device_control(acdev->dma_chan, | ||
931 | DMA_TERMINATE_ALL, 0); | ||
932 | dma_release_channel(acdev->dma_chan); | ||
933 | } | ||
934 | cf_exit(acdev); | ||
935 | return ata_host_suspend(host, PMSG_SUSPEND); | ||
936 | } | ||
937 | |||
938 | static int arasan_cf_resume(struct device *dev) | ||
939 | { | ||
940 | struct platform_device *pdev = to_platform_device(dev); | ||
941 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
942 | struct arasan_cf_dev *acdev = host->ports[0]->private_data; | ||
943 | |||
944 | cf_init(acdev); | ||
945 | ata_host_resume(host); | ||
946 | |||
947 | return 0; | ||
948 | } | ||
949 | |||
950 | static const struct dev_pm_ops arasan_cf_pm_ops = { | ||
951 | .suspend = arasan_cf_suspend, | ||
952 | .resume = arasan_cf_resume, | ||
953 | }; | ||
954 | #endif | ||
955 | |||
956 | static struct platform_driver arasan_cf_driver = { | ||
957 | .probe = arasan_cf_probe, | ||
958 | .remove = __devexit_p(arasan_cf_remove), | ||
959 | .driver = { | ||
960 | .name = DRIVER_NAME, | ||
961 | .owner = THIS_MODULE, | ||
962 | #ifdef CONFIG_PM | ||
963 | .pm = &arasan_cf_pm_ops, | ||
964 | #endif | ||
965 | }, | ||
966 | }; | ||
967 | |||
968 | static int __init arasan_cf_init(void) | ||
969 | { | ||
970 | return platform_driver_register(&arasan_cf_driver); | ||
971 | } | ||
972 | module_init(arasan_cf_init); | ||
973 | |||
974 | static void __exit arasan_cf_exit(void) | ||
975 | { | ||
976 | platform_driver_unregister(&arasan_cf_driver); | ||
977 | } | ||
978 | module_exit(arasan_cf_exit); | ||
979 | |||
980 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | ||
981 | MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); | ||
982 | MODULE_LICENSE("GPL"); | ||
983 | MODULE_ALIAS("platform:" DRIVER_NAME); | ||
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c index 66ce6a526f27..36f189c7ee8c 100644 --- a/drivers/ata/pata_at32.c +++ b/drivers/ata/pata_at32.c | |||
@@ -194,7 +194,7 @@ static int __init pata_at32_init_one(struct device *dev, | |||
194 | /* Setup ATA bindings */ | 194 | /* Setup ATA bindings */ |
195 | ap->ops = &at32_port_ops; | 195 | ap->ops = &at32_port_ops; |
196 | ap->pio_mask = PIO_MASK; | 196 | ap->pio_mask = PIO_MASK; |
197 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS; | 197 | ap->flags |= ATA_FLAG_SLAVE_POSS; |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Since all 8-bit taskfile transfers has to go on the lower | 200 | * Since all 8-bit taskfile transfers has to go on the lower |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 7aed5c792597..e0b58b8dfe6f 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1454,9 +1454,7 @@ static struct ata_port_operations bfin_pata_ops = { | |||
1454 | 1454 | ||
1455 | static struct ata_port_info bfin_port_info[] = { | 1455 | static struct ata_port_info bfin_port_info[] = { |
1456 | { | 1456 | { |
1457 | .flags = ATA_FLAG_SLAVE_POSS | 1457 | .flags = ATA_FLAG_SLAVE_POSS, |
1458 | | ATA_FLAG_MMIO | ||
1459 | | ATA_FLAG_NO_LEGACY, | ||
1460 | .pio_mask = ATA_PIO4, | 1458 | .pio_mask = ATA_PIO4, |
1461 | .mwdma_mask = 0, | 1459 | .mwdma_mask = 0, |
1462 | .udma_mask = 0, | 1460 | .udma_mask = 0, |
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index 538ec38ba995..6c77d68dbd05 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * Look into engine reset on timeout errors. Should not be required. | 14 | * Look into engine reset on timeout errors. Should not be required. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
17 | 18 | ||
18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -25,7 +26,7 @@ | |||
25 | #include <linux/libata.h> | 26 | #include <linux/libata.h> |
26 | 27 | ||
27 | #define DRV_NAME "pata_hpt366" | 28 | #define DRV_NAME "pata_hpt366" |
28 | #define DRV_VERSION "0.6.10" | 29 | #define DRV_VERSION "0.6.11" |
29 | 30 | ||
30 | struct hpt_clock { | 31 | struct hpt_clock { |
31 | u8 xfer_mode; | 32 | u8 xfer_mode; |
@@ -160,8 +161,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, | |||
160 | 161 | ||
161 | while (list[i] != NULL) { | 162 | while (list[i] != NULL) { |
162 | if (!strcmp(list[i], model_num)) { | 163 | if (!strcmp(list[i], model_num)) { |
163 | pr_warning(DRV_NAME ": %s is not supported for %s.\n", | 164 | pr_warn("%s is not supported for %s\n", |
164 | modestr, list[i]); | 165 | modestr, list[i]); |
165 | return 1; | 166 | return 1; |
166 | } | 167 | } |
167 | i++; | 168 | i++; |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 4c5b5183225e..9620636aa405 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -14,6 +14,8 @@ | |||
14 | * Look into engine reset on timeout errors. Should not be required. | 14 | * Look into engine reset on timeout errors. Should not be required. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
18 | |||
17 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
19 | #include <linux/pci.h> | 21 | #include <linux/pci.h> |
@@ -24,7 +26,7 @@ | |||
24 | #include <linux/libata.h> | 26 | #include <linux/libata.h> |
25 | 27 | ||
26 | #define DRV_NAME "pata_hpt37x" | 28 | #define DRV_NAME "pata_hpt37x" |
27 | #define DRV_VERSION "0.6.22" | 29 | #define DRV_VERSION "0.6.23" |
28 | 30 | ||
29 | struct hpt_clock { | 31 | struct hpt_clock { |
30 | u8 xfer_speed; | 32 | u8 xfer_speed; |
@@ -229,8 +231,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, | |||
229 | 231 | ||
230 | while (list[i] != NULL) { | 232 | while (list[i] != NULL) { |
231 | if (!strcmp(list[i], model_num)) { | 233 | if (!strcmp(list[i], model_num)) { |
232 | pr_warning(DRV_NAME ": %s is not supported for %s.\n", | 234 | pr_warn("%s is not supported for %s\n", |
233 | modestr, list[i]); | 235 | modestr, list[i]); |
234 | return 1; | 236 | return 1; |
235 | } | 237 | } |
236 | i++; | 238 | i++; |
@@ -863,8 +865,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
863 | chip_table = &hpt372; | 865 | chip_table = &hpt372; |
864 | break; | 866 | break; |
865 | default: | 867 | default: |
866 | pr_err(DRV_NAME ": Unknown HPT366 subtype, " | 868 | pr_err("Unknown HPT366 subtype, please report (%d)\n", |
867 | "please report (%d).\n", rev); | 869 | rev); |
868 | return -ENODEV; | 870 | return -ENODEV; |
869 | } | 871 | } |
870 | break; | 872 | break; |
@@ -904,8 +906,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
904 | *ppi = &info_hpt374_fn1; | 906 | *ppi = &info_hpt374_fn1; |
905 | break; | 907 | break; |
906 | default: | 908 | default: |
907 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", | 909 | pr_err("PCI table is bogus, please report (%d)\n", dev->device); |
908 | dev->device); | ||
909 | return -ENODEV; | 910 | return -ENODEV; |
910 | } | 911 | } |
911 | /* Ok so this is a chip we support */ | 912 | /* Ok so this is a chip we support */ |
@@ -953,7 +954,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
953 | u8 sr; | 954 | u8 sr; |
954 | u32 total = 0; | 955 | u32 total = 0; |
955 | 956 | ||
956 | pr_warning(DRV_NAME ": BIOS has not set timing clocks.\n"); | 957 | pr_warn("BIOS has not set timing clocks\n"); |
957 | 958 | ||
958 | /* This is the process the HPT371 BIOS is reported to use */ | 959 | /* This is the process the HPT371 BIOS is reported to use */ |
959 | for (i = 0; i < 128; i++) { | 960 | for (i = 0; i < 128; i++) { |
@@ -1009,7 +1010,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1009 | (f_high << 16) | f_low | 0x100); | 1010 | (f_high << 16) | f_low | 0x100); |
1010 | } | 1011 | } |
1011 | if (adjust == 8) { | 1012 | if (adjust == 8) { |
1012 | pr_err(DRV_NAME ": DPLL did not stabilize!\n"); | 1013 | pr_err("DPLL did not stabilize!\n"); |
1013 | return -ENODEV; | 1014 | return -ENODEV; |
1014 | } | 1015 | } |
1015 | if (dpll == 3) | 1016 | if (dpll == 3) |
@@ -1017,7 +1018,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1017 | else | 1018 | else |
1018 | private_data = (void *)hpt37x_timings_50; | 1019 | private_data = (void *)hpt37x_timings_50; |
1019 | 1020 | ||
1020 | pr_info(DRV_NAME ": bus clock %dMHz, using %dMHz DPLL.\n", | 1021 | pr_info("bus clock %dMHz, using %dMHz DPLL\n", |
1021 | MHz[clock_slot], MHz[dpll]); | 1022 | MHz[clock_slot], MHz[dpll]); |
1022 | } else { | 1023 | } else { |
1023 | private_data = (void *)chip_table->clocks[clock_slot]; | 1024 | private_data = (void *)chip_table->clocks[clock_slot]; |
@@ -1032,7 +1033,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1032 | if (clock_slot < 2 && ppi[0] == &info_hpt370a) | 1033 | if (clock_slot < 2 && ppi[0] == &info_hpt370a) |
1033 | ppi[0] = &info_hpt370a_33; | 1034 | ppi[0] = &info_hpt370a_33; |
1034 | 1035 | ||
1035 | pr_info(DRV_NAME ": %s using %dMHz bus clock.\n", | 1036 | pr_info("%s using %dMHz bus clock\n", |
1036 | chip_table->name, MHz[clock_slot]); | 1037 | chip_table->name, MHz[clock_slot]); |
1037 | } | 1038 | } |
1038 | 1039 | ||
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index eca68caf5f46..765f136d8cd3 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * Work out best PLL policy | 15 | * Work out best PLL policy |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | 21 | #include <linux/module.h> |
20 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
@@ -25,7 +27,7 @@ | |||
25 | #include <linux/libata.h> | 27 | #include <linux/libata.h> |
26 | 28 | ||
27 | #define DRV_NAME "pata_hpt3x2n" | 29 | #define DRV_NAME "pata_hpt3x2n" |
28 | #define DRV_VERSION "0.3.14" | 30 | #define DRV_VERSION "0.3.15" |
29 | 31 | ||
30 | enum { | 32 | enum { |
31 | HPT_PCI_FAST = (1 << 31), | 33 | HPT_PCI_FAST = (1 << 31), |
@@ -418,7 +420,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) | |||
418 | u16 sr; | 420 | u16 sr; |
419 | u32 total = 0; | 421 | u32 total = 0; |
420 | 422 | ||
421 | pr_warning(DRV_NAME ": BIOS clock data not set.\n"); | 423 | pr_warn("BIOS clock data not set\n"); |
422 | 424 | ||
423 | /* This is the process the HPT371 BIOS is reported to use */ | 425 | /* This is the process the HPT371 BIOS is reported to use */ |
424 | for (i = 0; i < 128; i++) { | 426 | for (i = 0; i < 128; i++) { |
@@ -528,8 +530,7 @@ hpt372n: | |||
528 | ppi[0] = &info_hpt372n; | 530 | ppi[0] = &info_hpt372n; |
529 | break; | 531 | break; |
530 | default: | 532 | default: |
531 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", | 533 | pr_err("PCI table is bogus, please report (%d)\n", dev->device); |
532 | dev->device); | ||
533 | return -ENODEV; | 534 | return -ENODEV; |
534 | } | 535 | } |
535 | 536 | ||
@@ -578,11 +579,11 @@ hpt372n: | |||
578 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); | 579 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); |
579 | } | 580 | } |
580 | if (adjust == 8) { | 581 | if (adjust == 8) { |
581 | pr_err(DRV_NAME ": DPLL did not stabilize!\n"); | 582 | pr_err("DPLL did not stabilize!\n"); |
582 | return -ENODEV; | 583 | return -ENODEV; |
583 | } | 584 | } |
584 | 585 | ||
585 | pr_info(DRV_NAME ": bus clock %dMHz, using 66MHz DPLL.\n", pci_mhz); | 586 | pr_info("bus clock %dMHz, using 66MHz DPLL\n", pci_mhz); |
586 | 587 | ||
587 | /* | 588 | /* |
588 | * Set our private data up. We only need a few flags | 589 | * Set our private data up. We only need a few flags |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index b63d5e2d4628..24d7df81546b 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -151,7 +151,7 @@ static struct ata_port_operations hpt3x3_port_ops = { | |||
151 | .check_atapi_dma= hpt3x3_atapi_dma, | 151 | .check_atapi_dma= hpt3x3_atapi_dma, |
152 | .freeze = hpt3x3_freeze, | 152 | .freeze = hpt3x3_freeze, |
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | }; | 155 | }; |
156 | 156 | ||
157 | /** | 157 | /** |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index aa0e0c51cc08..2d15f2548a10 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -616,7 +616,7 @@ static void it821x_display_disk(int n, u8 *buf) | |||
616 | if (buf[52] > 4) /* No Disk */ | 616 | if (buf[52] > 4) /* No Disk */ |
617 | return; | 617 | return; |
618 | 618 | ||
619 | ata_id_c_string((u16 *)buf, id, 0, 41); | 619 | ata_id_c_string((u16 *)buf, id, 0, 41); |
620 | 620 | ||
621 | if (buf[51]) { | 621 | if (buf[51]) { |
622 | mode = ffs(buf[51]); | 622 | mode = ffs(buf[51]); |
@@ -910,7 +910,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
910 | rc = pcim_enable_device(pdev); | 910 | rc = pcim_enable_device(pdev); |
911 | if (rc) | 911 | if (rc) |
912 | return rc; | 912 | return rc; |
913 | 913 | ||
914 | if (pdev->vendor == PCI_VENDOR_ID_RDC) { | 914 | if (pdev->vendor == PCI_VENDOR_ID_RDC) { |
915 | /* Deal with Vortex86SX */ | 915 | /* Deal with Vortex86SX */ |
916 | if (pdev->revision == 0x11) | 916 | if (pdev->revision == 0x11) |
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index ba54b089f98c..5253b271b3fe 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -177,7 +177,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) | |||
177 | 177 | ||
178 | ap->ops = &ixp4xx_port_ops; | 178 | ap->ops = &ixp4xx_port_ops; |
179 | ap->pio_mask = ATA_PIO4; | 179 | ap->pio_mask = ATA_PIO4; |
180 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI; | 180 | ap->flags |= ATA_FLAG_NO_ATAPI; |
181 | 181 | ||
182 | ixp4xx_setup_port(ap, data, cs0->start, cs1->start); | 182 | ixp4xx_setup_port(ap, data, cs0->start, cs1->start); |
183 | 183 | ||
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c index 75b49d01780b..46f589edccdb 100644 --- a/drivers/ata/pata_macio.c +++ b/drivers/ata/pata_macio.c | |||
@@ -1053,8 +1053,7 @@ static int __devinit pata_macio_common_init(struct pata_macio_priv *priv, | |||
1053 | /* Allocate libata host for 1 port */ | 1053 | /* Allocate libata host for 1 port */ |
1054 | memset(&pinfo, 0, sizeof(struct ata_port_info)); | 1054 | memset(&pinfo, 0, sizeof(struct ata_port_info)); |
1055 | pmac_macio_calc_timing_masks(priv, &pinfo); | 1055 | pmac_macio_calc_timing_masks(priv, &pinfo); |
1056 | pinfo.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_MMIO | | 1056 | pinfo.flags = ATA_FLAG_SLAVE_POSS; |
1057 | ATA_FLAG_NO_LEGACY; | ||
1058 | pinfo.port_ops = &pata_macio_ops; | 1057 | pinfo.port_ops = &pata_macio_ops; |
1059 | pinfo.private_data = priv; | 1058 | pinfo.private_data = priv; |
1060 | 1059 | ||
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index dd38083dcbeb..75a6a0c0094f 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -38,7 +38,7 @@ static int marvell_pata_active(struct pci_dev *pdev) | |||
38 | 38 | ||
39 | /* We don't yet know how to do this for other devices */ | 39 | /* We don't yet know how to do this for other devices */ |
40 | if (pdev->device != 0x6145) | 40 | if (pdev->device != 0x6145) |
41 | return 1; | 41 | return 1; |
42 | 42 | ||
43 | barp = pci_iomap(pdev, 5, 0x10); | 43 | barp = pci_iomap(pdev, 5, 0x10); |
44 | if (barp == NULL) | 44 | if (barp == NULL) |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index d7d8026cde99..2fcac511d39c 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -680,7 +680,7 @@ mpc52xx_ata_remove_one(struct device *dev) | |||
680 | /* ======================================================================== */ | 680 | /* ======================================================================== */ |
681 | 681 | ||
682 | static int __devinit | 682 | static int __devinit |
683 | mpc52xx_ata_probe(struct platform_device *op, const struct of_device_id *match) | 683 | mpc52xx_ata_probe(struct platform_device *op) |
684 | { | 684 | { |
685 | unsigned int ipb_freq; | 685 | unsigned int ipb_freq; |
686 | struct resource res_mem; | 686 | struct resource res_mem; |
@@ -883,7 +883,7 @@ static struct of_device_id mpc52xx_ata_of_match[] = { | |||
883 | }; | 883 | }; |
884 | 884 | ||
885 | 885 | ||
886 | static struct of_platform_driver mpc52xx_ata_of_platform_driver = { | 886 | static struct platform_driver mpc52xx_ata_of_platform_driver = { |
887 | .probe = mpc52xx_ata_probe, | 887 | .probe = mpc52xx_ata_probe, |
888 | .remove = mpc52xx_ata_remove, | 888 | .remove = mpc52xx_ata_remove, |
889 | #ifdef CONFIG_PM | 889 | #ifdef CONFIG_PM |
@@ -906,13 +906,13 @@ static int __init | |||
906 | mpc52xx_ata_init(void) | 906 | mpc52xx_ata_init(void) |
907 | { | 907 | { |
908 | printk(KERN_INFO "ata: MPC52xx IDE/ATA libata driver\n"); | 908 | printk(KERN_INFO "ata: MPC52xx IDE/ATA libata driver\n"); |
909 | return of_register_platform_driver(&mpc52xx_ata_of_platform_driver); | 909 | return platform_driver_register(&mpc52xx_ata_of_platform_driver); |
910 | } | 910 | } |
911 | 911 | ||
912 | static void __exit | 912 | static void __exit |
913 | mpc52xx_ata_exit(void) | 913 | mpc52xx_ata_exit(void) |
914 | { | 914 | { |
915 | of_unregister_platform_driver(&mpc52xx_ata_of_platform_driver); | 915 | platform_driver_unregister(&mpc52xx_ata_of_platform_driver); |
916 | } | 916 | } |
917 | 917 | ||
918 | module_init(mpc52xx_ata_init); | 918 | module_init(mpc52xx_ata_init); |
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c index cc50bd09aa26..e277a142138c 100644 --- a/drivers/ata/pata_ninja32.c +++ b/drivers/ata/pata_ninja32.c | |||
@@ -165,7 +165,7 @@ static int ninja32_reinit_one(struct pci_dev *pdev) | |||
165 | return rc; | 165 | return rc; |
166 | ninja32_program(host->iomap[0]); | 166 | ninja32_program(host->iomap[0]); |
167 | ata_host_resume(host); | 167 | ata_host_resume(host); |
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
170 | #endif | 170 | #endif |
171 | 171 | ||
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index fa1b95a9a7ff..220ddc90608f 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c | |||
@@ -848,8 +848,7 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev) | |||
848 | cf_port->ap = ap; | 848 | cf_port->ap = ap; |
849 | ap->ops = &octeon_cf_ops; | 849 | ap->ops = &octeon_cf_ops; |
850 | ap->pio_mask = ATA_PIO6; | 850 | ap->pio_mask = ATA_PIO6; |
851 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | 851 | ap->flags |= ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING; |
852 | | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING; | ||
853 | 852 | ||
854 | base = cs0 + ocd->base_region_bias; | 853 | base = cs0 + ocd->base_region_bias; |
855 | if (!ocd->is16bit) { | 854 | if (!ocd->is16bit) { |
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index 480e043ce6b8..f3054009bd25 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c | |||
@@ -14,8 +14,7 @@ | |||
14 | #include <linux/of_platform.h> | 14 | #include <linux/of_platform.h> |
15 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
16 | 16 | ||
17 | static int __devinit pata_of_platform_probe(struct platform_device *ofdev, | 17 | static int __devinit pata_of_platform_probe(struct platform_device *ofdev) |
18 | const struct of_device_id *match) | ||
19 | { | 18 | { |
20 | int ret; | 19 | int ret; |
21 | struct device_node *dn = ofdev->dev.of_node; | 20 | struct device_node *dn = ofdev->dev.of_node; |
@@ -90,7 +89,7 @@ static struct of_device_id pata_of_platform_match[] = { | |||
90 | }; | 89 | }; |
91 | MODULE_DEVICE_TABLE(of, pata_of_platform_match); | 90 | MODULE_DEVICE_TABLE(of, pata_of_platform_match); |
92 | 91 | ||
93 | static struct of_platform_driver pata_of_platform_driver = { | 92 | static struct platform_driver pata_of_platform_driver = { |
94 | .driver = { | 93 | .driver = { |
95 | .name = "pata_of_platform", | 94 | .name = "pata_of_platform", |
96 | .owner = THIS_MODULE, | 95 | .owner = THIS_MODULE, |
@@ -102,13 +101,13 @@ static struct of_platform_driver pata_of_platform_driver = { | |||
102 | 101 | ||
103 | static int __init pata_of_platform_init(void) | 102 | static int __init pata_of_platform_init(void) |
104 | { | 103 | { |
105 | return of_register_platform_driver(&pata_of_platform_driver); | 104 | return platform_driver_register(&pata_of_platform_driver); |
106 | } | 105 | } |
107 | module_init(pata_of_platform_init); | 106 | module_init(pata_of_platform_init); |
108 | 107 | ||
109 | static void __exit pata_of_platform_exit(void) | 108 | static void __exit pata_of_platform_exit(void) |
110 | { | 109 | { |
111 | of_unregister_platform_driver(&pata_of_platform_driver); | 110 | platform_driver_unregister(&pata_of_platform_driver); |
112 | } | 111 | } |
113 | module_exit(pata_of_platform_exit); | 112 | module_exit(pata_of_platform_exit); |
114 | 113 | ||
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c index 11fb4ccc74b4..a2a73d953840 100644 --- a/drivers/ata/pata_palmld.c +++ b/drivers/ata/pata_palmld.c | |||
@@ -85,7 +85,7 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev) | |||
85 | ap = host->ports[0]; | 85 | ap = host->ports[0]; |
86 | ap->ops = &palmld_port_ops; | 86 | ap->ops = &palmld_port_ops; |
87 | ap->pio_mask = ATA_PIO4; | 87 | ap->pio_mask = ATA_PIO4; |
88 | ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_PIO_POLLING; | 88 | ap->flags |= ATA_FLAG_PIO_POLLING; |
89 | 89 | ||
90 | /* memory mapping voodoo */ | 90 | /* memory mapping voodoo */ |
91 | ap->ioaddr.cmd_addr = mem + 0x10; | 91 | ap->ioaddr.cmd_addr = mem + 0x10; |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 806292160b3f..29af660d968b 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -124,7 +124,7 @@ static unsigned int ata_data_xfer_8bit(struct ata_device *dev, | |||
124 | * reset will recover the device. | 124 | * reset will recover the device. |
125 | * | 125 | * |
126 | */ | 126 | */ |
127 | 127 | ||
128 | static void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc) | 128 | static void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc) |
129 | { | 129 | { |
130 | int count; | 130 | int count; |
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index b18351122525..9765ace16921 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -150,8 +150,7 @@ static struct ata_port_operations pdc2027x_pata133_ops = { | |||
150 | static struct ata_port_info pdc2027x_port_info[] = { | 150 | static struct ata_port_info pdc2027x_port_info[] = { |
151 | /* PDC_UDMA_100 */ | 151 | /* PDC_UDMA_100 */ |
152 | { | 152 | { |
153 | .flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SLAVE_POSS | | 153 | .flags = ATA_FLAG_SLAVE_POSS, |
154 | ATA_FLAG_MMIO, | ||
155 | .pio_mask = ATA_PIO4, | 154 | .pio_mask = ATA_PIO4, |
156 | .mwdma_mask = ATA_MWDMA2, | 155 | .mwdma_mask = ATA_MWDMA2, |
157 | .udma_mask = ATA_UDMA5, | 156 | .udma_mask = ATA_UDMA5, |
@@ -159,8 +158,7 @@ static struct ata_port_info pdc2027x_port_info[] = { | |||
159 | }, | 158 | }, |
160 | /* PDC_UDMA_133 */ | 159 | /* PDC_UDMA_133 */ |
161 | { | 160 | { |
162 | .flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SLAVE_POSS | | 161 | .flags = ATA_FLAG_SLAVE_POSS, |
163 | ATA_FLAG_MMIO, | ||
164 | .pio_mask = ATA_PIO4, | 162 | .pio_mask = ATA_PIO4, |
165 | .mwdma_mask = ATA_MWDMA2, | 163 | .mwdma_mask = ATA_MWDMA2, |
166 | .udma_mask = ATA_UDMA6, | 164 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c index 1898c6ed4b4e..b4ede40f8ae1 100644 --- a/drivers/ata/pata_pxa.c +++ b/drivers/ata/pata_pxa.c | |||
@@ -292,7 +292,6 @@ static int __devinit pxa_ata_probe(struct platform_device *pdev) | |||
292 | ap->ops = &pxa_ata_port_ops; | 292 | ap->ops = &pxa_ata_port_ops; |
293 | ap->pio_mask = ATA_PIO4; | 293 | ap->pio_mask = ATA_PIO4; |
294 | ap->mwdma_mask = ATA_MWDMA2; | 294 | ap->mwdma_mask = ATA_MWDMA2; |
295 | ap->flags = ATA_FLAG_MMIO; | ||
296 | 295 | ||
297 | ap->ioaddr.cmd_addr = devm_ioremap(&pdev->dev, cmd_res->start, | 296 | ap->ioaddr.cmd_addr = devm_ioremap(&pdev->dev, cmd_res->start, |
298 | resource_size(cmd_res)); | 297 | resource_size(cmd_res)); |
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c index 0ffd631000b7..baeaf938d55b 100644 --- a/drivers/ata/pata_rb532_cf.c +++ b/drivers/ata/pata_rb532_cf.c | |||
@@ -91,7 +91,6 @@ static void rb532_pata_setup_ports(struct ata_host *ah) | |||
91 | 91 | ||
92 | ap->ops = &rb532_pata_port_ops; | 92 | ap->ops = &rb532_pata_port_ops; |
93 | ap->pio_mask = ATA_PIO4; | 93 | ap->pio_mask = ATA_PIO4; |
94 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; | ||
95 | 94 | ||
96 | ap->ioaddr.cmd_addr = info->iobase + RB500_CF_REG_BASE; | 95 | ap->ioaddr.cmd_addr = info->iobase + RB500_CF_REG_BASE; |
97 | ap->ioaddr.ctl_addr = info->iobase + RB500_CF_REG_CTRL; | 96 | ap->ioaddr.ctl_addr = info->iobase + RB500_CF_REG_CTRL; |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index 8a51d673e5b2..c446ae6055a3 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -531,7 +531,6 @@ static int __init pata_s3c_probe(struct platform_device *pdev) | |||
531 | } | 531 | } |
532 | 532 | ||
533 | ap = host->ports[0]; | 533 | ap = host->ports[0]; |
534 | ap->flags |= ATA_FLAG_MMIO; | ||
535 | ap->pio_mask = ATA_PIO4; | 534 | ap->pio_mask = ATA_PIO4; |
536 | 535 | ||
537 | if (cpu_type == TYPE_S3C64XX) { | 536 | if (cpu_type == TYPE_S3C64XX) { |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 093715c3273a..88ea9b677b47 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -959,7 +959,7 @@ static struct ata_port_operations scc_pata_ops = { | |||
959 | 959 | ||
960 | static struct ata_port_info scc_port_info[] = { | 960 | static struct ata_port_info scc_port_info[] = { |
961 | { | 961 | { |
962 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY, | 962 | .flags = ATA_FLAG_SLAVE_POSS, |
963 | .pio_mask = ATA_PIO4, | 963 | .pio_mask = ATA_PIO4, |
964 | /* No MWDMA */ | 964 | /* No MWDMA */ |
965 | .udma_mask = ATA_UDMA6, | 965 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 60cea13cccce..c04abc393fc5 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -593,7 +593,7 @@ static const struct ata_port_info sis_info133 = { | |||
593 | .port_ops = &sis_133_ops, | 593 | .port_ops = &sis_133_ops, |
594 | }; | 594 | }; |
595 | const struct ata_port_info sis_info133_for_sata = { | 595 | const struct ata_port_info sis_info133_for_sata = { |
596 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 596 | .flags = ATA_FLAG_SLAVE_POSS, |
597 | .pio_mask = ATA_PIO4, | 597 | .pio_mask = ATA_PIO4, |
598 | /* No MWDMA */ | 598 | /* No MWDMA */ |
599 | .udma_mask = ATA_UDMA6, | 599 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index adbe0426c8f0..1111712b3d7d 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -166,9 +166,7 @@ static struct ata_port_operations adma_ata_ops = { | |||
166 | static struct ata_port_info adma_port_info[] = { | 166 | static struct ata_port_info adma_port_info[] = { |
167 | /* board_1841_idx */ | 167 | /* board_1841_idx */ |
168 | { | 168 | { |
169 | .flags = ATA_FLAG_SLAVE_POSS | | 169 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_POLLING, |
170 | ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO | | ||
171 | ATA_FLAG_PIO_POLLING, | ||
172 | .pio_mask = ATA_PIO4_ONLY, | 170 | .pio_mask = ATA_PIO4_ONLY, |
173 | .udma_mask = ATA_UDMA4, | 171 | .udma_mask = ATA_UDMA4, |
174 | .port_ops = &adma_ata_ops, | 172 | .port_ops = &adma_ata_ops, |
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 6cf57c5c2b5f..1c4b3aa4c7c4 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c | |||
@@ -40,8 +40,11 @@ | |||
40 | #include <scsi/scsi_host.h> | 40 | #include <scsi/scsi_host.h> |
41 | #include <scsi/scsi_cmnd.h> | 41 | #include <scsi/scsi_cmnd.h> |
42 | 42 | ||
43 | /* These two are defined in "libata.h" */ | ||
44 | #undef DRV_NAME | ||
45 | #undef DRV_VERSION | ||
43 | #define DRV_NAME "sata-dwc" | 46 | #define DRV_NAME "sata-dwc" |
44 | #define DRV_VERSION "1.0" | 47 | #define DRV_VERSION "1.3" |
45 | 48 | ||
46 | /* SATA DMA driver Globals */ | 49 | /* SATA DMA driver Globals */ |
47 | #define DMA_NUM_CHANS 1 | 50 | #define DMA_NUM_CHANS 1 |
@@ -333,11 +336,47 @@ static int dma_dwc_xfer_setup(struct scatterlist *sg, int num_elems, | |||
333 | void __iomem *addr, int dir); | 336 | void __iomem *addr, int dir); |
334 | static void dma_dwc_xfer_start(int dma_ch); | 337 | static void dma_dwc_xfer_start(int dma_ch); |
335 | 338 | ||
339 | static const char *get_prot_descript(u8 protocol) | ||
340 | { | ||
341 | switch ((enum ata_tf_protocols)protocol) { | ||
342 | case ATA_PROT_NODATA: | ||
343 | return "ATA no data"; | ||
344 | case ATA_PROT_PIO: | ||
345 | return "ATA PIO"; | ||
346 | case ATA_PROT_DMA: | ||
347 | return "ATA DMA"; | ||
348 | case ATA_PROT_NCQ: | ||
349 | return "ATA NCQ"; | ||
350 | case ATAPI_PROT_NODATA: | ||
351 | return "ATAPI no data"; | ||
352 | case ATAPI_PROT_PIO: | ||
353 | return "ATAPI PIO"; | ||
354 | case ATAPI_PROT_DMA: | ||
355 | return "ATAPI DMA"; | ||
356 | default: | ||
357 | return "unknown"; | ||
358 | } | ||
359 | } | ||
360 | |||
361 | static const char *get_dma_dir_descript(int dma_dir) | ||
362 | { | ||
363 | switch ((enum dma_data_direction)dma_dir) { | ||
364 | case DMA_BIDIRECTIONAL: | ||
365 | return "bidirectional"; | ||
366 | case DMA_TO_DEVICE: | ||
367 | return "to device"; | ||
368 | case DMA_FROM_DEVICE: | ||
369 | return "from device"; | ||
370 | default: | ||
371 | return "none"; | ||
372 | } | ||
373 | } | ||
374 | |||
336 | static void sata_dwc_tf_dump(struct ata_taskfile *tf) | 375 | static void sata_dwc_tf_dump(struct ata_taskfile *tf) |
337 | { | 376 | { |
338 | dev_vdbg(host_pvt.dwc_dev, "taskfile cmd: 0x%02x protocol: %s flags:" | 377 | dev_vdbg(host_pvt.dwc_dev, "taskfile cmd: 0x%02x protocol: %s flags:" |
339 | "0x%lx device: %x\n", tf->command, ata_get_cmd_descript\ | 378 | "0x%lx device: %x\n", tf->command, |
340 | (tf->protocol), tf->flags, tf->device); | 379 | get_prot_descript(tf->protocol), tf->flags, tf->device); |
341 | dev_vdbg(host_pvt.dwc_dev, "feature: 0x%02x nsect: 0x%x lbal: 0x%x " | 380 | dev_vdbg(host_pvt.dwc_dev, "feature: 0x%02x nsect: 0x%x lbal: 0x%x " |
342 | "lbam: 0x%x lbah: 0x%x\n", tf->feature, tf->nsect, tf->lbal, | 381 | "lbam: 0x%x lbah: 0x%x\n", tf->feature, tf->nsect, tf->lbal, |
343 | tf->lbam, tf->lbah); | 382 | tf->lbam, tf->lbah); |
@@ -715,7 +754,7 @@ static int dma_dwc_xfer_setup(struct scatterlist *sg, int num_elems, | |||
715 | /* Program the CTL register with src enable / dst enable */ | 754 | /* Program the CTL register with src enable / dst enable */ |
716 | out_le32(&(host_pvt.sata_dma_regs->chan_regs[dma_ch].ctl.low), | 755 | out_le32(&(host_pvt.sata_dma_regs->chan_regs[dma_ch].ctl.low), |
717 | DMA_CTL_LLP_SRCEN | DMA_CTL_LLP_DSTEN); | 756 | DMA_CTL_LLP_SRCEN | DMA_CTL_LLP_DSTEN); |
718 | return 0; | 757 | return dma_ch; |
719 | } | 758 | } |
720 | 759 | ||
721 | /* | 760 | /* |
@@ -967,7 +1006,7 @@ static irqreturn_t sata_dwc_isr(int irq, void *dev_instance) | |||
967 | } | 1006 | } |
968 | 1007 | ||
969 | dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n", | 1008 | dev_dbg(ap->dev, "%s non-NCQ cmd interrupt, protocol: %s\n", |
970 | __func__, ata_get_cmd_descript(qc->tf.protocol)); | 1009 | __func__, get_prot_descript(qc->tf.protocol)); |
971 | DRVSTILLBUSY: | 1010 | DRVSTILLBUSY: |
972 | if (ata_is_dma(qc->tf.protocol)) { | 1011 | if (ata_is_dma(qc->tf.protocol)) { |
973 | /* | 1012 | /* |
@@ -1057,7 +1096,7 @@ DRVSTILLBUSY: | |||
1057 | 1096 | ||
1058 | /* Process completed command */ | 1097 | /* Process completed command */ |
1059 | dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__, | 1098 | dev_dbg(ap->dev, "%s NCQ command, protocol: %s\n", __func__, |
1060 | ata_get_cmd_descript(qc->tf.protocol)); | 1099 | get_prot_descript(qc->tf.protocol)); |
1061 | if (ata_is_dma(qc->tf.protocol)) { | 1100 | if (ata_is_dma(qc->tf.protocol)) { |
1062 | host_pvt.dma_interrupt_count++; | 1101 | host_pvt.dma_interrupt_count++; |
1063 | if (hsdevp->dma_pending[tag] == \ | 1102 | if (hsdevp->dma_pending[tag] == \ |
@@ -1142,8 +1181,8 @@ static void sata_dwc_dma_xfer_complete(struct ata_port *ap, u32 check_status) | |||
1142 | if (tag > 0) { | 1181 | if (tag > 0) { |
1143 | dev_info(ap->dev, "%s tag=%u cmd=0x%02x dma dir=%s proto=%s " | 1182 | dev_info(ap->dev, "%s tag=%u cmd=0x%02x dma dir=%s proto=%s " |
1144 | "dmacr=0x%08x\n", __func__, qc->tag, qc->tf.command, | 1183 | "dmacr=0x%08x\n", __func__, qc->tag, qc->tf.command, |
1145 | ata_get_cmd_descript(qc->dma_dir), | 1184 | get_dma_dir_descript(qc->dma_dir), |
1146 | ata_get_cmd_descript(qc->tf.protocol), | 1185 | get_prot_descript(qc->tf.protocol), |
1147 | in_le32(&(hsdev->sata_dwc_regs->dmacr))); | 1186 | in_le32(&(hsdev->sata_dwc_regs->dmacr))); |
1148 | } | 1187 | } |
1149 | #endif | 1188 | #endif |
@@ -1354,7 +1393,7 @@ static void sata_dwc_exec_command_by_tag(struct ata_port *ap, | |||
1354 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); | 1393 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); |
1355 | 1394 | ||
1356 | dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command, | 1395 | dev_dbg(ap->dev, "%s cmd(0x%02x): %s tag=%d\n", __func__, tf->command, |
1357 | ata_get_cmd_descript(tf), tag); | 1396 | ata_get_cmd_descript(tf->command), tag); |
1358 | 1397 | ||
1359 | spin_lock_irqsave(&ap->host->lock, flags); | 1398 | spin_lock_irqsave(&ap->host->lock, flags); |
1360 | hsdevp->cmd_issued[tag] = cmd_issued; | 1399 | hsdevp->cmd_issued[tag] = cmd_issued; |
@@ -1413,7 +1452,7 @@ static void sata_dwc_bmdma_start_by_tag(struct ata_queued_cmd *qc, u8 tag) | |||
1413 | 1452 | ||
1414 | dev_dbg(ap->dev, "%s qc=%p tag: %x cmd: 0x%02x dma_dir: %s " | 1453 | dev_dbg(ap->dev, "%s qc=%p tag: %x cmd: 0x%02x dma_dir: %s " |
1415 | "start_dma? %x\n", __func__, qc, tag, qc->tf.command, | 1454 | "start_dma? %x\n", __func__, qc, tag, qc->tf.command, |
1416 | ata_get_cmd_descript(qc->dma_dir), start_dma); | 1455 | get_dma_dir_descript(qc->dma_dir), start_dma); |
1417 | sata_dwc_tf_dump(&(qc->tf)); | 1456 | sata_dwc_tf_dump(&(qc->tf)); |
1418 | 1457 | ||
1419 | if (start_dma) { | 1458 | if (start_dma) { |
@@ -1462,10 +1501,9 @@ static void sata_dwc_qc_prep_by_tag(struct ata_queued_cmd *qc, u8 tag) | |||
1462 | int dma_chan; | 1501 | int dma_chan; |
1463 | struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); | 1502 | struct sata_dwc_device *hsdev = HSDEV_FROM_AP(ap); |
1464 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); | 1503 | struct sata_dwc_device_port *hsdevp = HSDEVP_FROM_AP(ap); |
1465 | int err; | ||
1466 | 1504 | ||
1467 | dev_dbg(ap->dev, "%s: port=%d dma dir=%s n_elem=%d\n", | 1505 | dev_dbg(ap->dev, "%s: port=%d dma dir=%s n_elem=%d\n", |
1468 | __func__, ap->port_no, ata_get_cmd_descript(qc->dma_dir), | 1506 | __func__, ap->port_no, get_dma_dir_descript(qc->dma_dir), |
1469 | qc->n_elem); | 1507 | qc->n_elem); |
1470 | 1508 | ||
1471 | dma_chan = dma_dwc_xfer_setup(sg, qc->n_elem, hsdevp->llit[tag], | 1509 | dma_chan = dma_dwc_xfer_setup(sg, qc->n_elem, hsdevp->llit[tag], |
@@ -1474,7 +1512,7 @@ static void sata_dwc_qc_prep_by_tag(struct ata_queued_cmd *qc, u8 tag) | |||
1474 | dmadr), qc->dma_dir); | 1512 | dmadr), qc->dma_dir); |
1475 | if (dma_chan < 0) { | 1513 | if (dma_chan < 0) { |
1476 | dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns err %d\n", | 1514 | dev_err(ap->dev, "%s: dma_dwc_xfer_setup returns err %d\n", |
1477 | __func__, err); | 1515 | __func__, dma_chan); |
1478 | return; | 1516 | return; |
1479 | } | 1517 | } |
1480 | hsdevp->dma_chan[tag] = dma_chan; | 1518 | hsdevp->dma_chan[tag] = dma_chan; |
@@ -1491,8 +1529,8 @@ static unsigned int sata_dwc_qc_issue(struct ata_queued_cmd *qc) | |||
1491 | dev_info(ap->dev, "%s ap id=%d cmd(0x%02x)=%s qc tag=%d " | 1529 | dev_info(ap->dev, "%s ap id=%d cmd(0x%02x)=%s qc tag=%d " |
1492 | "prot=%s ap active_tag=0x%08x ap sactive=0x%08x\n", | 1530 | "prot=%s ap active_tag=0x%08x ap sactive=0x%08x\n", |
1493 | __func__, ap->print_id, qc->tf.command, | 1531 | __func__, ap->print_id, qc->tf.command, |
1494 | ata_get_cmd_descript(&qc->tf), | 1532 | ata_get_cmd_descript(qc->tf.command), |
1495 | qc->tag, ata_get_cmd_descript(qc->tf.protocol), | 1533 | qc->tag, get_prot_descript(qc->tf.protocol), |
1496 | ap->link.active_tag, ap->link.sactive); | 1534 | ap->link.active_tag, ap->link.sactive); |
1497 | #endif | 1535 | #endif |
1498 | 1536 | ||
@@ -1533,7 +1571,7 @@ static void sata_dwc_qc_prep(struct ata_queued_cmd *qc) | |||
1533 | #ifdef DEBUG_NCQ | 1571 | #ifdef DEBUG_NCQ |
1534 | if (qc->tag > 0) | 1572 | if (qc->tag > 0) |
1535 | dev_info(qc->ap->dev, "%s: qc->tag=%d ap->active_tag=0x%08x\n", | 1573 | dev_info(qc->ap->dev, "%s: qc->tag=%d ap->active_tag=0x%08x\n", |
1536 | __func__, tag, qc->ap->link.active_tag); | 1574 | __func__, qc->tag, qc->ap->link.active_tag); |
1537 | 1575 | ||
1538 | return ; | 1576 | return ; |
1539 | #endif | 1577 | #endif |
@@ -1580,16 +1618,14 @@ static struct ata_port_operations sata_dwc_ops = { | |||
1580 | 1618 | ||
1581 | static const struct ata_port_info sata_dwc_port_info[] = { | 1619 | static const struct ata_port_info sata_dwc_port_info[] = { |
1582 | { | 1620 | { |
1583 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 1621 | .flags = ATA_FLAG_SATA | ATA_FLAG_NCQ, |
1584 | ATA_FLAG_MMIO | ATA_FLAG_NCQ, | 1622 | .pio_mask = ATA_PIO4, |
1585 | .pio_mask = 0x1f, /* pio 0-4 */ | ||
1586 | .udma_mask = ATA_UDMA6, | 1623 | .udma_mask = ATA_UDMA6, |
1587 | .port_ops = &sata_dwc_ops, | 1624 | .port_ops = &sata_dwc_ops, |
1588 | }, | 1625 | }, |
1589 | }; | 1626 | }; |
1590 | 1627 | ||
1591 | static int sata_dwc_probe(struct platform_device *ofdev, | 1628 | static int sata_dwc_probe(struct platform_device *ofdev) |
1592 | const struct of_device_id *match) | ||
1593 | { | 1629 | { |
1594 | struct sata_dwc_device *hsdev; | 1630 | struct sata_dwc_device *hsdev; |
1595 | u32 idr, versionr; | 1631 | u32 idr, versionr; |
@@ -1727,7 +1763,7 @@ static const struct of_device_id sata_dwc_match[] = { | |||
1727 | }; | 1763 | }; |
1728 | MODULE_DEVICE_TABLE(of, sata_dwc_match); | 1764 | MODULE_DEVICE_TABLE(of, sata_dwc_match); |
1729 | 1765 | ||
1730 | static struct of_platform_driver sata_dwc_driver = { | 1766 | static struct platform_driver sata_dwc_driver = { |
1731 | .driver = { | 1767 | .driver = { |
1732 | .name = DRV_NAME, | 1768 | .name = DRV_NAME, |
1733 | .owner = THIS_MODULE, | 1769 | .owner = THIS_MODULE, |
@@ -1739,12 +1775,12 @@ static struct of_platform_driver sata_dwc_driver = { | |||
1739 | 1775 | ||
1740 | static int __init sata_dwc_init(void) | 1776 | static int __init sata_dwc_init(void) |
1741 | { | 1777 | { |
1742 | return of_register_platform_driver(&sata_dwc_driver); | 1778 | return platform_driver_register(&sata_dwc_driver); |
1743 | } | 1779 | } |
1744 | 1780 | ||
1745 | static void __exit sata_dwc_exit(void) | 1781 | static void __exit sata_dwc_exit(void) |
1746 | { | 1782 | { |
1747 | of_unregister_platform_driver(&sata_dwc_driver); | 1783 | platform_driver_unregister(&sata_dwc_driver); |
1748 | } | 1784 | } |
1749 | 1785 | ||
1750 | module_init(sata_dwc_init); | 1786 | module_init(sata_dwc_init); |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 01a5400bd7c5..0f91e583892e 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -33,8 +33,7 @@ enum { | |||
33 | SATA_FSL_MAX_PRD_USABLE = SATA_FSL_MAX_PRD - 1, | 33 | SATA_FSL_MAX_PRD_USABLE = SATA_FSL_MAX_PRD - 1, |
34 | SATA_FSL_MAX_PRD_DIRECT = 16, /* Direct PRDT entries */ | 34 | SATA_FSL_MAX_PRD_DIRECT = 16, /* Direct PRDT entries */ |
35 | 35 | ||
36 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 36 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | |
37 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | ||
38 | ATA_FLAG_PMP | ATA_FLAG_NCQ | ATA_FLAG_AN), | 37 | ATA_FLAG_PMP | ATA_FLAG_NCQ | ATA_FLAG_AN), |
39 | 38 | ||
40 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, | 39 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, |
@@ -187,6 +186,11 @@ enum { | |||
187 | COMMANDSTAT = 0x20, | 186 | COMMANDSTAT = 0x20, |
188 | }; | 187 | }; |
189 | 188 | ||
189 | /* TRANSCFG (transport-layer) configuration control */ | ||
190 | enum { | ||
191 | TRANSCFG_RX_WATER_MARK = (1 << 4), | ||
192 | }; | ||
193 | |||
190 | /* PHY (link-layer) configuration control */ | 194 | /* PHY (link-layer) configuration control */ |
191 | enum { | 195 | enum { |
192 | PHY_BIST_ENABLE = 0x01, | 196 | PHY_BIST_ENABLE = 0x01, |
@@ -1043,12 +1047,15 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
1043 | 1047 | ||
1044 | /* find out the offending link and qc */ | 1048 | /* find out the offending link and qc */ |
1045 | if (ap->nr_pmp_links) { | 1049 | if (ap->nr_pmp_links) { |
1050 | unsigned int dev_num; | ||
1051 | |||
1046 | dereg = ioread32(hcr_base + DE); | 1052 | dereg = ioread32(hcr_base + DE); |
1047 | iowrite32(dereg, hcr_base + DE); | 1053 | iowrite32(dereg, hcr_base + DE); |
1048 | iowrite32(cereg, hcr_base + CE); | 1054 | iowrite32(cereg, hcr_base + CE); |
1049 | 1055 | ||
1050 | if (dereg < ap->nr_pmp_links) { | 1056 | dev_num = ffs(dereg) - 1; |
1051 | link = &ap->pmp_link[dereg]; | 1057 | if (dev_num < ap->nr_pmp_links && dereg != 0) { |
1058 | link = &ap->pmp_link[dev_num]; | ||
1052 | ehi = &link->eh_info; | 1059 | ehi = &link->eh_info; |
1053 | qc = ata_qc_from_tag(ap, link->active_tag); | 1060 | qc = ata_qc_from_tag(ap, link->active_tag); |
1054 | /* | 1061 | /* |
@@ -1296,8 +1303,7 @@ static const struct ata_port_info sata_fsl_port_info[] = { | |||
1296 | }, | 1303 | }, |
1297 | }; | 1304 | }; |
1298 | 1305 | ||
1299 | static int sata_fsl_probe(struct platform_device *ofdev, | 1306 | static int sata_fsl_probe(struct platform_device *ofdev) |
1300 | const struct of_device_id *match) | ||
1301 | { | 1307 | { |
1302 | int retval = -ENXIO; | 1308 | int retval = -ENXIO; |
1303 | void __iomem *hcr_base = NULL; | 1309 | void __iomem *hcr_base = NULL; |
@@ -1306,6 +1312,7 @@ static int sata_fsl_probe(struct platform_device *ofdev, | |||
1306 | struct sata_fsl_host_priv *host_priv = NULL; | 1312 | struct sata_fsl_host_priv *host_priv = NULL; |
1307 | int irq; | 1313 | int irq; |
1308 | struct ata_host *host; | 1314 | struct ata_host *host; |
1315 | u32 temp; | ||
1309 | 1316 | ||
1310 | struct ata_port_info pi = sata_fsl_port_info[0]; | 1317 | struct ata_port_info pi = sata_fsl_port_info[0]; |
1311 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 1318 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
@@ -1320,6 +1327,12 @@ static int sata_fsl_probe(struct platform_device *ofdev, | |||
1320 | ssr_base = hcr_base + 0x100; | 1327 | ssr_base = hcr_base + 0x100; |
1321 | csr_base = hcr_base + 0x140; | 1328 | csr_base = hcr_base + 0x140; |
1322 | 1329 | ||
1330 | if (!of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc8315-sata")) { | ||
1331 | temp = ioread32(csr_base + TRANSCFG); | ||
1332 | temp = temp & 0xffffffe0; | ||
1333 | iowrite32(temp | TRANSCFG_RX_WATER_MARK, csr_base + TRANSCFG); | ||
1334 | } | ||
1335 | |||
1323 | DPRINTK("@reset i/o = 0x%x\n", ioread32(csr_base + TRANSCFG)); | 1336 | DPRINTK("@reset i/o = 0x%x\n", ioread32(csr_base + TRANSCFG)); |
1324 | DPRINTK("sizeof(cmd_desc) = %d\n", sizeof(struct command_desc)); | 1337 | DPRINTK("sizeof(cmd_desc) = %d\n", sizeof(struct command_desc)); |
1325 | DPRINTK("sizeof(#define cmd_desc) = %d\n", SATA_FSL_CMD_DESC_SIZE); | 1338 | DPRINTK("sizeof(#define cmd_desc) = %d\n", SATA_FSL_CMD_DESC_SIZE); |
@@ -1434,7 +1447,7 @@ static struct of_device_id fsl_sata_match[] = { | |||
1434 | 1447 | ||
1435 | MODULE_DEVICE_TABLE(of, fsl_sata_match); | 1448 | MODULE_DEVICE_TABLE(of, fsl_sata_match); |
1436 | 1449 | ||
1437 | static struct of_platform_driver fsl_sata_driver = { | 1450 | static struct platform_driver fsl_sata_driver = { |
1438 | .driver = { | 1451 | .driver = { |
1439 | .name = "fsl-sata", | 1452 | .name = "fsl-sata", |
1440 | .owner = THIS_MODULE, | 1453 | .owner = THIS_MODULE, |
@@ -1450,13 +1463,13 @@ static struct of_platform_driver fsl_sata_driver = { | |||
1450 | 1463 | ||
1451 | static int __init sata_fsl_init(void) | 1464 | static int __init sata_fsl_init(void) |
1452 | { | 1465 | { |
1453 | of_register_platform_driver(&fsl_sata_driver); | 1466 | platform_driver_register(&fsl_sata_driver); |
1454 | return 0; | 1467 | return 0; |
1455 | } | 1468 | } |
1456 | 1469 | ||
1457 | static void __exit sata_fsl_exit(void) | 1470 | static void __exit sata_fsl_exit(void) |
1458 | { | 1471 | { |
1459 | of_unregister_platform_driver(&fsl_sata_driver); | 1472 | platform_driver_unregister(&fsl_sata_driver); |
1460 | } | 1473 | } |
1461 | 1474 | ||
1462 | MODULE_LICENSE("GPL"); | 1475 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index bf74a36d3cc3..cd40651e9b72 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -160,8 +160,7 @@ enum { | |||
160 | /* Host Flags */ | 160 | /* Host Flags */ |
161 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ | 161 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ |
162 | 162 | ||
163 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 163 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_PIO_POLLING, |
164 | ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, | ||
165 | 164 | ||
166 | MV_GEN_I_FLAGS = MV_COMMON_FLAGS | ATA_FLAG_NO_ATAPI, | 165 | MV_GEN_I_FLAGS = MV_COMMON_FLAGS | ATA_FLAG_NO_ATAPI, |
167 | 166 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 7254e255fd78..42344e3c686d 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -539,7 +539,7 @@ struct nv_pi_priv { | |||
539 | static const struct ata_port_info nv_port_info[] = { | 539 | static const struct ata_port_info nv_port_info[] = { |
540 | /* generic */ | 540 | /* generic */ |
541 | { | 541 | { |
542 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 542 | .flags = ATA_FLAG_SATA, |
543 | .pio_mask = NV_PIO_MASK, | 543 | .pio_mask = NV_PIO_MASK, |
544 | .mwdma_mask = NV_MWDMA_MASK, | 544 | .mwdma_mask = NV_MWDMA_MASK, |
545 | .udma_mask = NV_UDMA_MASK, | 545 | .udma_mask = NV_UDMA_MASK, |
@@ -548,7 +548,7 @@ static const struct ata_port_info nv_port_info[] = { | |||
548 | }, | 548 | }, |
549 | /* nforce2/3 */ | 549 | /* nforce2/3 */ |
550 | { | 550 | { |
551 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 551 | .flags = ATA_FLAG_SATA, |
552 | .pio_mask = NV_PIO_MASK, | 552 | .pio_mask = NV_PIO_MASK, |
553 | .mwdma_mask = NV_MWDMA_MASK, | 553 | .mwdma_mask = NV_MWDMA_MASK, |
554 | .udma_mask = NV_UDMA_MASK, | 554 | .udma_mask = NV_UDMA_MASK, |
@@ -557,7 +557,7 @@ static const struct ata_port_info nv_port_info[] = { | |||
557 | }, | 557 | }, |
558 | /* ck804 */ | 558 | /* ck804 */ |
559 | { | 559 | { |
560 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 560 | .flags = ATA_FLAG_SATA, |
561 | .pio_mask = NV_PIO_MASK, | 561 | .pio_mask = NV_PIO_MASK, |
562 | .mwdma_mask = NV_MWDMA_MASK, | 562 | .mwdma_mask = NV_MWDMA_MASK, |
563 | .udma_mask = NV_UDMA_MASK, | 563 | .udma_mask = NV_UDMA_MASK, |
@@ -566,8 +566,7 @@ static const struct ata_port_info nv_port_info[] = { | |||
566 | }, | 566 | }, |
567 | /* ADMA */ | 567 | /* ADMA */ |
568 | { | 568 | { |
569 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 569 | .flags = ATA_FLAG_SATA | ATA_FLAG_NCQ, |
570 | ATA_FLAG_MMIO | ATA_FLAG_NCQ, | ||
571 | .pio_mask = NV_PIO_MASK, | 570 | .pio_mask = NV_PIO_MASK, |
572 | .mwdma_mask = NV_MWDMA_MASK, | 571 | .mwdma_mask = NV_MWDMA_MASK, |
573 | .udma_mask = NV_UDMA_MASK, | 572 | .udma_mask = NV_UDMA_MASK, |
@@ -576,7 +575,7 @@ static const struct ata_port_info nv_port_info[] = { | |||
576 | }, | 575 | }, |
577 | /* MCP5x */ | 576 | /* MCP5x */ |
578 | { | 577 | { |
579 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 578 | .flags = ATA_FLAG_SATA, |
580 | .pio_mask = NV_PIO_MASK, | 579 | .pio_mask = NV_PIO_MASK, |
581 | .mwdma_mask = NV_MWDMA_MASK, | 580 | .mwdma_mask = NV_MWDMA_MASK, |
582 | .udma_mask = NV_UDMA_MASK, | 581 | .udma_mask = NV_UDMA_MASK, |
@@ -585,8 +584,7 @@ static const struct ata_port_info nv_port_info[] = { | |||
585 | }, | 584 | }, |
586 | /* SWNCQ */ | 585 | /* SWNCQ */ |
587 | { | 586 | { |
588 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 587 | .flags = ATA_FLAG_SATA | ATA_FLAG_NCQ, |
589 | ATA_FLAG_NCQ, | ||
590 | .pio_mask = NV_PIO_MASK, | 588 | .pio_mask = NV_PIO_MASK, |
591 | .mwdma_mask = NV_MWDMA_MASK, | 589 | .mwdma_mask = NV_MWDMA_MASK, |
592 | .udma_mask = NV_UDMA_MASK, | 590 | .udma_mask = NV_UDMA_MASK, |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index f03ad48273ff..a004b1e0ea6d 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -134,9 +134,7 @@ enum { | |||
134 | PDC_IRQ_DISABLE = (1 << 10), | 134 | PDC_IRQ_DISABLE = (1 << 10), |
135 | PDC_RESET = (1 << 11), /* HDMA reset */ | 135 | PDC_RESET = (1 << 11), /* HDMA reset */ |
136 | 136 | ||
137 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | | 137 | PDC_COMMON_FLAGS = ATA_FLAG_PIO_POLLING, |
138 | ATA_FLAG_MMIO | | ||
139 | ATA_FLAG_PIO_POLLING, | ||
140 | 138 | ||
141 | /* ap->flags bits */ | 139 | /* ap->flags bits */ |
142 | PDC_FLAG_GEN_II = (1 << 24), | 140 | PDC_FLAG_GEN_II = (1 << 24), |
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index daeebf19a6a9..c5603265fa58 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -155,8 +155,7 @@ static struct ata_port_operations qs_ata_ops = { | |||
155 | static const struct ata_port_info qs_port_info[] = { | 155 | static const struct ata_port_info qs_port_info[] = { |
156 | /* board_2068_idx */ | 156 | /* board_2068_idx */ |
157 | { | 157 | { |
158 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 158 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_POLLING, |
159 | ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, | ||
160 | .pio_mask = ATA_PIO4_ONLY, | 159 | .pio_mask = ATA_PIO4_ONLY, |
161 | .udma_mask = ATA_UDMA6, | 160 | .udma_mask = ATA_UDMA6, |
162 | .port_ops = &qs_ata_ops, | 161 | .port_ops = &qs_ata_ops, |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 3a4f84219719..b42edaaf3a53 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -61,8 +61,7 @@ enum { | |||
61 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), | 61 | SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29), |
62 | SIL_FLAG_MOD15WRITE = (1 << 30), | 62 | SIL_FLAG_MOD15WRITE = (1 << 30), |
63 | 63 | ||
64 | SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 64 | SIL_DFL_PORT_FLAGS = ATA_FLAG_SATA, |
65 | ATA_FLAG_MMIO, | ||
66 | 65 | ||
67 | /* | 66 | /* |
68 | * Controller IDs | 67 | * Controller IDs |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index af41c6fd1254..06c564e55051 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -244,8 +244,7 @@ enum { | |||
244 | BID_SIL3131 = 2, | 244 | BID_SIL3131 = 2, |
245 | 245 | ||
246 | /* host flags */ | 246 | /* host flags */ |
247 | SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 247 | SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | |
248 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | ||
249 | ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA | | 248 | ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA | |
250 | ATA_FLAG_AN | ATA_FLAG_PMP, | 249 | ATA_FLAG_AN | ATA_FLAG_PMP, |
251 | SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */ | 250 | SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */ |
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index 2bfe3ae03976..cdcc13e9cf51 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -96,7 +96,7 @@ static struct ata_port_operations sis_ops = { | |||
96 | }; | 96 | }; |
97 | 97 | ||
98 | static const struct ata_port_info sis_port_info = { | 98 | static const struct ata_port_info sis_port_info = { |
99 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 99 | .flags = ATA_FLAG_SATA, |
100 | .pio_mask = ATA_PIO4, | 100 | .pio_mask = ATA_PIO4, |
101 | .mwdma_mask = ATA_MWDMA2, | 101 | .mwdma_mask = ATA_MWDMA2, |
102 | .udma_mask = ATA_UDMA6, | 102 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 7d9db4aaf07e..35eabcf34568 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -359,8 +359,7 @@ static struct ata_port_operations k2_sata_ops = { | |||
359 | static const struct ata_port_info k2_port_info[] = { | 359 | static const struct ata_port_info k2_port_info[] = { |
360 | /* chip_svw4 */ | 360 | /* chip_svw4 */ |
361 | { | 361 | { |
362 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 362 | .flags = ATA_FLAG_SATA | K2_FLAG_NO_ATAPI_DMA, |
363 | ATA_FLAG_MMIO | K2_FLAG_NO_ATAPI_DMA, | ||
364 | .pio_mask = ATA_PIO4, | 363 | .pio_mask = ATA_PIO4, |
365 | .mwdma_mask = ATA_MWDMA2, | 364 | .mwdma_mask = ATA_MWDMA2, |
366 | .udma_mask = ATA_UDMA6, | 365 | .udma_mask = ATA_UDMA6, |
@@ -368,8 +367,7 @@ static const struct ata_port_info k2_port_info[] = { | |||
368 | }, | 367 | }, |
369 | /* chip_svw8 */ | 368 | /* chip_svw8 */ |
370 | { | 369 | { |
371 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 370 | .flags = ATA_FLAG_SATA | K2_FLAG_NO_ATAPI_DMA | |
372 | ATA_FLAG_MMIO | K2_FLAG_NO_ATAPI_DMA | | ||
373 | K2_FLAG_SATA_8_PORTS, | 371 | K2_FLAG_SATA_8_PORTS, |
374 | .pio_mask = ATA_PIO4, | 372 | .pio_mask = ATA_PIO4, |
375 | .mwdma_mask = ATA_MWDMA2, | 373 | .mwdma_mask = ATA_MWDMA2, |
@@ -378,8 +376,7 @@ static const struct ata_port_info k2_port_info[] = { | |||
378 | }, | 376 | }, |
379 | /* chip_svw42 */ | 377 | /* chip_svw42 */ |
380 | { | 378 | { |
381 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 379 | .flags = ATA_FLAG_SATA | K2_FLAG_BAR_POS_3, |
382 | ATA_FLAG_MMIO | K2_FLAG_BAR_POS_3, | ||
383 | .pio_mask = ATA_PIO4, | 380 | .pio_mask = ATA_PIO4, |
384 | .mwdma_mask = ATA_MWDMA2, | 381 | .mwdma_mask = ATA_MWDMA2, |
385 | .udma_mask = ATA_UDMA6, | 382 | .udma_mask = ATA_UDMA6, |
@@ -387,8 +384,7 @@ static const struct ata_port_info k2_port_info[] = { | |||
387 | }, | 384 | }, |
388 | /* chip_svw43 */ | 385 | /* chip_svw43 */ |
389 | { | 386 | { |
390 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 387 | .flags = ATA_FLAG_SATA, |
391 | ATA_FLAG_MMIO, | ||
392 | .pio_mask = ATA_PIO4, | 388 | .pio_mask = ATA_PIO4, |
393 | .mwdma_mask = ATA_MWDMA2, | 389 | .mwdma_mask = ATA_MWDMA2, |
394 | .udma_mask = ATA_UDMA6, | 390 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index bedd5188e5b0..8fd3b7252bda 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
@@ -273,9 +273,8 @@ static struct ata_port_operations pdc_20621_ops = { | |||
273 | static const struct ata_port_info pdc_port_info[] = { | 273 | static const struct ata_port_info pdc_port_info[] = { |
274 | /* board_20621 */ | 274 | /* board_20621 */ |
275 | { | 275 | { |
276 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 276 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_ATAPI | |
277 | ATA_FLAG_SRST | ATA_FLAG_MMIO | | 277 | ATA_FLAG_PIO_POLLING, |
278 | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING, | ||
279 | .pio_mask = ATA_PIO4, | 278 | .pio_mask = ATA_PIO4, |
280 | .mwdma_mask = ATA_MWDMA2, | 279 | .mwdma_mask = ATA_MWDMA2, |
281 | .udma_mask = ATA_UDMA6, | 280 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index b8578c32d344..235be717a713 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -88,8 +88,7 @@ static struct ata_port_operations uli_ops = { | |||
88 | }; | 88 | }; |
89 | 89 | ||
90 | static const struct ata_port_info uli_port_info = { | 90 | static const struct ata_port_info uli_port_info = { |
91 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 91 | .flags = ATA_FLAG_SATA | ATA_FLAG_IGN_SIMPLEX, |
92 | ATA_FLAG_IGN_SIMPLEX, | ||
93 | .pio_mask = ATA_PIO4, | 92 | .pio_mask = ATA_PIO4, |
94 | .udma_mask = ATA_UDMA6, | 93 | .udma_mask = ATA_UDMA6, |
95 | .port_ops = &uli_ops, | 94 | .port_ops = &uli_ops, |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 8b677bbf2d37..21242c5709a0 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -148,7 +148,7 @@ static struct ata_port_operations vt8251_ops = { | |||
148 | }; | 148 | }; |
149 | 149 | ||
150 | static const struct ata_port_info vt6420_port_info = { | 150 | static const struct ata_port_info vt6420_port_info = { |
151 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 151 | .flags = ATA_FLAG_SATA, |
152 | .pio_mask = ATA_PIO4, | 152 | .pio_mask = ATA_PIO4, |
153 | .mwdma_mask = ATA_MWDMA2, | 153 | .mwdma_mask = ATA_MWDMA2, |
154 | .udma_mask = ATA_UDMA6, | 154 | .udma_mask = ATA_UDMA6, |
@@ -156,7 +156,7 @@ static const struct ata_port_info vt6420_port_info = { | |||
156 | }; | 156 | }; |
157 | 157 | ||
158 | static struct ata_port_info vt6421_sport_info = { | 158 | static struct ata_port_info vt6421_sport_info = { |
159 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 159 | .flags = ATA_FLAG_SATA, |
160 | .pio_mask = ATA_PIO4, | 160 | .pio_mask = ATA_PIO4, |
161 | .mwdma_mask = ATA_MWDMA2, | 161 | .mwdma_mask = ATA_MWDMA2, |
162 | .udma_mask = ATA_UDMA6, | 162 | .udma_mask = ATA_UDMA6, |
@@ -164,7 +164,7 @@ static struct ata_port_info vt6421_sport_info = { | |||
164 | }; | 164 | }; |
165 | 165 | ||
166 | static struct ata_port_info vt6421_pport_info = { | 166 | static struct ata_port_info vt6421_pport_info = { |
167 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_LEGACY, | 167 | .flags = ATA_FLAG_SLAVE_POSS, |
168 | .pio_mask = ATA_PIO4, | 168 | .pio_mask = ATA_PIO4, |
169 | /* No MWDMA */ | 169 | /* No MWDMA */ |
170 | .udma_mask = ATA_UDMA6, | 170 | .udma_mask = ATA_UDMA6, |
@@ -172,8 +172,7 @@ static struct ata_port_info vt6421_pport_info = { | |||
172 | }; | 172 | }; |
173 | 173 | ||
174 | static struct ata_port_info vt8251_port_info = { | 174 | static struct ata_port_info vt8251_port_info = { |
175 | .flags = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS | | 175 | .flags = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS, |
176 | ATA_FLAG_NO_LEGACY, | ||
177 | .pio_mask = ATA_PIO4, | 176 | .pio_mask = ATA_PIO4, |
178 | .mwdma_mask = ATA_MWDMA2, | 177 | .mwdma_mask = ATA_MWDMA2, |
179 | .udma_mask = ATA_UDMA6, | 178 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index e079cf29ed5d..7c987371136e 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -340,8 +340,7 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev, | |||
340 | const struct pci_device_id *ent) | 340 | const struct pci_device_id *ent) |
341 | { | 341 | { |
342 | static const struct ata_port_info pi = { | 342 | static const struct ata_port_info pi = { |
343 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 343 | .flags = ATA_FLAG_SATA, |
344 | ATA_FLAG_MMIO, | ||
345 | .pio_mask = ATA_PIO4, | 344 | .pio_mask = ATA_PIO4, |
346 | .mwdma_mask = ATA_MWDMA2, | 345 | .mwdma_mask = ATA_MWDMA2, |
347 | .udma_mask = ATA_UDMA6, | 346 | .udma_mask = ATA_UDMA6, |