diff options
| -rw-r--r-- | drivers/ata/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/ata/Makefile | 1 | ||||
| -rw-r--r-- | drivers/ata/ahci.c | 14 | ||||
| -rw-r--r-- | drivers/ata/libata-acpi.c | 8 | ||||
| -rw-r--r-- | drivers/ata/libata-core.c | 17 | ||||
| -rw-r--r-- | drivers/ata/libata-eh.c | 10 | ||||
| -rw-r--r-- | drivers/ata/libata-sff.c | 36 | ||||
| -rw-r--r-- | drivers/ata/pata_pdc2027x.c | 2 | ||||
| -rw-r--r-- | drivers/ata/pata_rb500_cf.c | 314 | 
9 files changed, 383 insertions, 28 deletions
| diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index ba8f7f4dfa11..e469647330de 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
| @@ -538,6 +538,15 @@ config PATA_RADISYS | |||
| 538 | 538 | ||
| 539 | If unsure, say N. | 539 | If unsure, say N. | 
| 540 | 540 | ||
| 541 | config PATA_RB500 | ||
| 542 | tristate "RouterBoard 500 PATA CompactFlash support" | ||
| 543 | depends on MIKROTIK_RB500 | ||
| 544 | help | ||
| 545 | This option enables support for the RouterBoard 500 | ||
| 546 | PATA CompactFlash controller. | ||
| 547 | |||
| 548 | If unsure, say N. | ||
| 549 | |||
| 541 | config PATA_RZ1000 | 550 | config PATA_RZ1000 | 
| 542 | tristate "PC Tech RZ1000 PATA support" | 551 | tristate "PC Tech RZ1000 PATA support" | 
| 543 | depends on PCI | 552 | depends on PCI | 
| diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 701651e37c89..0511e6f0bb58 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
| @@ -55,6 +55,7 @@ obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o | |||
| 55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o | 55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o | 
| 56 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o | 56 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o | 
| 57 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o | 57 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o | 
| 58 | obj-$(CONFIG_PATA_RB500) += pata_rb500_cf.o | ||
| 58 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | 59 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | 
| 59 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o | 60 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o | 
| 60 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o | 61 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o | 
| diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 8a49835bd0f8..6978469eb16d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -567,6 +567,18 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 567 | { PCI_VDEVICE(NVIDIA, 0x0abd), board_ahci }, /* MCP79 */ | 567 | { PCI_VDEVICE(NVIDIA, 0x0abd), board_ahci }, /* MCP79 */ | 
| 568 | { PCI_VDEVICE(NVIDIA, 0x0abe), board_ahci }, /* MCP79 */ | 568 | { PCI_VDEVICE(NVIDIA, 0x0abe), board_ahci }, /* MCP79 */ | 
| 569 | { PCI_VDEVICE(NVIDIA, 0x0abf), board_ahci }, /* MCP79 */ | 569 | { PCI_VDEVICE(NVIDIA, 0x0abf), board_ahci }, /* MCP79 */ | 
| 570 | { PCI_VDEVICE(NVIDIA, 0x0bc8), board_ahci }, /* MCP7B */ | ||
| 571 | { PCI_VDEVICE(NVIDIA, 0x0bc9), board_ahci }, /* MCP7B */ | ||
| 572 | { PCI_VDEVICE(NVIDIA, 0x0bca), board_ahci }, /* MCP7B */ | ||
| 573 | { PCI_VDEVICE(NVIDIA, 0x0bcb), board_ahci }, /* MCP7B */ | ||
| 574 | { PCI_VDEVICE(NVIDIA, 0x0bcc), board_ahci }, /* MCP7B */ | ||
| 575 | { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ | ||
| 576 | { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ | ||
| 577 | { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ | ||
| 578 | { PCI_VDEVICE(NVIDIA, 0x0bd0), board_ahci }, /* MCP7B */ | ||
| 579 | { PCI_VDEVICE(NVIDIA, 0x0bd1), board_ahci }, /* MCP7B */ | ||
| 580 | { PCI_VDEVICE(NVIDIA, 0x0bd2), board_ahci }, /* MCP7B */ | ||
| 581 | { PCI_VDEVICE(NVIDIA, 0x0bd3), board_ahci }, /* MCP7B */ | ||
| 570 | 582 | ||
| 571 | /* SiS */ | 583 | /* SiS */ | 
| 572 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ | 584 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ | 
| @@ -672,7 +684,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
| 672 | cap &= ~HOST_CAP_NCQ; | 684 | cap &= ~HOST_CAP_NCQ; | 
| 673 | } | 685 | } | 
| 674 | 686 | ||
| 675 | if ((cap && HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { | 687 | if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { | 
| 676 | dev_printk(KERN_INFO, &pdev->dev, | 688 | dev_printk(KERN_INFO, &pdev->dev, | 
| 677 | "controller can't do PMP, turning off CAP_PMP\n"); | 689 | "controller can't do PMP, turning off CAP_PMP\n"); | 
| 678 | cap &= ~HOST_CAP_PMP; | 690 | cap &= ~HOST_CAP_PMP; | 
| diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 9e8ec19260af..0770cb7391a4 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
| @@ -382,7 +382,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
| 382 | 382 | ||
| 383 | if (ata_msg_probe(ap)) | 383 | if (ata_msg_probe(ap)) | 
| 384 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 384 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 
| 385 | __FUNCTION__, ap->port_no); | 385 | __func__, ap->port_no); | 
| 386 | 386 | ||
| 387 | /* _GTF has no input parameters */ | 387 | /* _GTF has no input parameters */ | 
| 388 | status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); | 388 | status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); | 
| @@ -402,7 +402,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
| 402 | if (ata_msg_probe(ap)) | 402 | if (ata_msg_probe(ap)) | 
| 403 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " | 403 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " | 
| 404 | "length or ptr is NULL (0x%llx, 0x%p)\n", | 404 | "length or ptr is NULL (0x%llx, 0x%p)\n", | 
| 405 | __FUNCTION__, | 405 | __func__, | 
| 406 | (unsigned long long)output.length, | 406 | (unsigned long long)output.length, | 
| 407 | output.pointer); | 407 | output.pointer); | 
| 408 | rc = -EINVAL; | 408 | rc = -EINVAL; | 
| @@ -432,7 +432,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
| 432 | if (ata_msg_probe(ap)) | 432 | if (ata_msg_probe(ap)) | 
| 433 | ata_dev_printk(dev, KERN_DEBUG, | 433 | ata_dev_printk(dev, KERN_DEBUG, | 
| 434 | "%s: returning gtf=%p, gtf_count=%d\n", | 434 | "%s: returning gtf=%p, gtf_count=%d\n", | 
| 435 | __FUNCTION__, *gtf, rc); | 435 | __func__, *gtf, rc); | 
| 436 | } | 436 | } | 
| 437 | return rc; | 437 | return rc; | 
| 438 | 438 | ||
| @@ -725,7 +725,7 @@ static int ata_acpi_push_id(struct ata_device *dev) | |||
| 725 | 725 | ||
| 726 | if (ata_msg_probe(ap)) | 726 | if (ata_msg_probe(ap)) | 
| 727 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", | 727 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", | 
| 728 | __FUNCTION__, dev->devno, ap->port_no); | 728 | __func__, dev->devno, ap->port_no); | 
| 729 | 729 | ||
| 730 | /* Give the drive Identify data to the drive via the _SDD method */ | 730 | /* Give the drive Identify data to the drive via the _SDD method */ | 
| 731 | /* _SDD: set up input parameters */ | 731 | /* _SDD: set up input parameters */ | 
| diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4fbcce758b04..4bbe31f98ef8 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -106,7 +106,8 @@ static struct ata_force_ent *ata_force_tbl; | |||
| 106 | static int ata_force_tbl_size; | 106 | static int ata_force_tbl_size; | 
| 107 | 107 | ||
| 108 | static char ata_force_param_buf[PAGE_SIZE] __initdata; | 108 | static char ata_force_param_buf[PAGE_SIZE] __initdata; | 
| 109 | module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0444); | 109 | /* param_buf is thrown away after initialization, disallow read */ | 
| 110 | module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0); | ||
| 110 | MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)"); | 111 | MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)"); | 
| 111 | 112 | ||
| 112 | int atapi_enabled = 1; | 113 | int atapi_enabled = 1; | 
| @@ -1719,7 +1720,7 @@ void ata_port_flush_task(struct ata_port *ap) | |||
| 1719 | cancel_rearming_delayed_work(&ap->port_task); | 1720 | cancel_rearming_delayed_work(&ap->port_task); | 
| 1720 | 1721 | ||
| 1721 | if (ata_msg_ctl(ap)) | 1722 | if (ata_msg_ctl(ap)) | 
| 1722 | ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __FUNCTION__); | 1723 | ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__); | 
| 1723 | } | 1724 | } | 
| 1724 | 1725 | ||
| 1725 | static void ata_qc_complete_internal(struct ata_queued_cmd *qc) | 1726 | static void ata_qc_complete_internal(struct ata_queued_cmd *qc) | 
| @@ -2056,7 +2057,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
| 2056 | int rc; | 2057 | int rc; | 
| 2057 | 2058 | ||
| 2058 | if (ata_msg_ctl(ap)) | 2059 | if (ata_msg_ctl(ap)) | 
| 2059 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); | 2060 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); | 
| 2060 | 2061 | ||
| 2061 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ | 2062 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ | 
| 2062 | retry: | 2063 | retry: | 
| @@ -2253,12 +2254,12 @@ int ata_dev_configure(struct ata_device *dev) | |||
| 2253 | 2254 | ||
| 2254 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { | 2255 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { | 
| 2255 | ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n", | 2256 | ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n", | 
| 2256 | __FUNCTION__); | 2257 | __func__); | 
| 2257 | return 0; | 2258 | return 0; | 
| 2258 | } | 2259 | } | 
| 2259 | 2260 | ||
| 2260 | if (ata_msg_probe(ap)) | 2261 | if (ata_msg_probe(ap)) | 
| 2261 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); | 2262 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); | 
| 2262 | 2263 | ||
| 2263 | /* set horkage */ | 2264 | /* set horkage */ | 
| 2264 | dev->horkage |= ata_dev_blacklisted(dev); | 2265 | dev->horkage |= ata_dev_blacklisted(dev); | 
| @@ -2279,7 +2280,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
| 2279 | ata_dev_printk(dev, KERN_DEBUG, | 2280 | ata_dev_printk(dev, KERN_DEBUG, | 
| 2280 | "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " | 2281 | "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " | 
| 2281 | "85:%04x 86:%04x 87:%04x 88:%04x\n", | 2282 | "85:%04x 86:%04x 87:%04x 88:%04x\n", | 
| 2282 | __FUNCTION__, | 2283 | __func__, | 
| 2283 | id[49], id[82], id[83], id[84], | 2284 | id[49], id[82], id[83], id[84], | 
| 2284 | id[85], id[86], id[87], id[88]); | 2285 | id[85], id[86], id[87], id[88]); | 
| 2285 | 2286 | ||
| @@ -2511,13 +2512,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
| 2511 | 2512 | ||
| 2512 | if (ata_msg_probe(ap)) | 2513 | if (ata_msg_probe(ap)) | 
| 2513 | ata_dev_printk(dev, KERN_DEBUG, "%s: EXIT, drv_stat = 0x%x\n", | 2514 | ata_dev_printk(dev, KERN_DEBUG, "%s: EXIT, drv_stat = 0x%x\n", | 
| 2514 | __FUNCTION__, ata_chk_status(ap)); | 2515 | __func__, ata_chk_status(ap)); | 
| 2515 | return 0; | 2516 | return 0; | 
| 2516 | 2517 | ||
| 2517 | err_out_nosup: | 2518 | err_out_nosup: | 
| 2518 | if (ata_msg_probe(ap)) | 2519 | if (ata_msg_probe(ap)) | 
| 2519 | ata_dev_printk(dev, KERN_DEBUG, | 2520 | ata_dev_printk(dev, KERN_DEBUG, | 
| 2520 | "%s: EXIT, err\n", __FUNCTION__); | 2521 | "%s: EXIT, err\n", __func__); | 
| 2521 | return rc; | 2522 | return rc; | 
| 2522 | } | 2523 | } | 
| 2523 | 2524 | ||
| diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 698ce2cea52c..681252fd8143 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -2150,6 +2150,15 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2150 | ap->ops->set_piomode(ap, dev); | 2150 | ap->ops->set_piomode(ap, dev); | 
| 2151 | } | 2151 | } | 
| 2152 | 2152 | ||
| 2153 | if (!softreset && !hardreset) { | ||
| 2154 | if (verbose) | ||
| 2155 | ata_link_printk(link, KERN_INFO, "no reset method " | ||
| 2156 | "available, skipping reset\n"); | ||
| 2157 | if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) | ||
| 2158 | lflags |= ATA_LFLAG_ASSUME_ATA; | ||
| 2159 | goto done; | ||
| 2160 | } | ||
| 2161 | |||
| 2153 | /* Determine which reset to use and record in ehc->i.action. | 2162 | /* Determine which reset to use and record in ehc->i.action. | 
| 2154 | * prereset() may examine and modify it. | 2163 | * prereset() may examine and modify it. | 
| 2155 | */ | 2164 | */ | 
| @@ -2254,6 +2263,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
| 2254 | lflags |= ATA_LFLAG_ASSUME_ATA; | 2263 | lflags |= ATA_LFLAG_ASSUME_ATA; | 
| 2255 | } | 2264 | } | 
| 2256 | 2265 | ||
| 2266 | done: | ||
| 2257 | ata_link_for_each_dev(dev, link) { | 2267 | ata_link_for_each_dev(dev, link) { | 
| 2258 | /* After the reset, the device state is PIO 0 and the | 2268 | /* After the reset, the device state is PIO 0 and the | 
| 2259 | * controller state is undefined. Reset also wakes up | 2269 | * controller state is undefined. Reset also wakes up | 
| diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 60cd4b179766..20dc572fb45a 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
| @@ -56,7 +56,8 @@ u8 ata_irq_on(struct ata_port *ap) | |||
| 56 | ap->ctl &= ~ATA_NIEN; | 56 | ap->ctl &= ~ATA_NIEN; | 
| 57 | ap->last_ctl = ap->ctl; | 57 | ap->last_ctl = ap->ctl; | 
| 58 | 58 | ||
| 59 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 59 | if (ioaddr->ctl_addr) | 
| 60 | iowrite8(ap->ctl, ioaddr->ctl_addr); | ||
| 60 | tmp = ata_wait_idle(ap); | 61 | tmp = ata_wait_idle(ap); | 
| 61 | 62 | ||
| 62 | ap->ops->irq_clear(ap); | 63 | ap->ops->irq_clear(ap); | 
| @@ -81,12 +82,14 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
| 81 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 82 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 
| 82 | 83 | ||
| 83 | if (tf->ctl != ap->last_ctl) { | 84 | if (tf->ctl != ap->last_ctl) { | 
| 84 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 85 | if (ioaddr->ctl_addr) | 
| 86 | iowrite8(tf->ctl, ioaddr->ctl_addr); | ||
| 85 | ap->last_ctl = tf->ctl; | 87 | ap->last_ctl = tf->ctl; | 
| 86 | ata_wait_idle(ap); | 88 | ata_wait_idle(ap); | 
| 87 | } | 89 | } | 
| 88 | 90 | ||
| 89 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | 91 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | 
| 92 | WARN_ON(!ioaddr->ctl_addr); | ||
| 90 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | 93 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | 
| 91 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | 94 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | 
| 92 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | 95 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | 
| @@ -167,14 +170,17 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
| 167 | tf->device = ioread8(ioaddr->device_addr); | 170 | tf->device = ioread8(ioaddr->device_addr); | 
| 168 | 171 | ||
| 169 | if (tf->flags & ATA_TFLAG_LBA48) { | 172 | if (tf->flags & ATA_TFLAG_LBA48) { | 
| 170 | iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); | 173 | if (likely(ioaddr->ctl_addr)) { | 
| 171 | tf->hob_feature = ioread8(ioaddr->error_addr); | 174 | iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); | 
| 172 | tf->hob_nsect = ioread8(ioaddr->nsect_addr); | 175 | tf->hob_feature = ioread8(ioaddr->error_addr); | 
| 173 | tf->hob_lbal = ioread8(ioaddr->lbal_addr); | 176 | tf->hob_nsect = ioread8(ioaddr->nsect_addr); | 
| 174 | tf->hob_lbam = ioread8(ioaddr->lbam_addr); | 177 | tf->hob_lbal = ioread8(ioaddr->lbal_addr); | 
| 175 | tf->hob_lbah = ioread8(ioaddr->lbah_addr); | 178 | tf->hob_lbam = ioread8(ioaddr->lbam_addr); | 
| 176 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 179 | tf->hob_lbah = ioread8(ioaddr->lbah_addr); | 
| 177 | ap->last_ctl = tf->ctl; | 180 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 
| 181 | ap->last_ctl = tf->ctl; | ||
| 182 | } else | ||
| 183 | WARN_ON(1); | ||
| 178 | } | 184 | } | 
| 179 | } | 185 | } | 
| 180 | 186 | ||
| @@ -352,7 +358,8 @@ void ata_bmdma_freeze(struct ata_port *ap) | |||
| 352 | ap->ctl |= ATA_NIEN; | 358 | ap->ctl |= ATA_NIEN; | 
| 353 | ap->last_ctl = ap->ctl; | 359 | ap->last_ctl = ap->ctl; | 
| 354 | 360 | ||
| 355 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 361 | if (ioaddr->ctl_addr) | 
| 362 | iowrite8(ap->ctl, ioaddr->ctl_addr); | ||
| 356 | 363 | ||
| 357 | /* Under certain circumstances, some controllers raise IRQ on | 364 | /* Under certain circumstances, some controllers raise IRQ on | 
| 358 | * ATA_NIEN manipulation. Also, many controllers fail to mask | 365 | * ATA_NIEN manipulation. Also, many controllers fail to mask | 
| @@ -459,13 +466,14 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
| 459 | */ | 466 | */ | 
| 460 | void ata_bmdma_error_handler(struct ata_port *ap) | 467 | void ata_bmdma_error_handler(struct ata_port *ap) | 
| 461 | { | 468 | { | 
| 462 | ata_reset_fn_t hardreset; | 469 | ata_reset_fn_t softreset = NULL, hardreset = NULL; | 
| 463 | 470 | ||
| 464 | hardreset = NULL; | 471 | if (ap->ioaddr.ctl_addr) | 
| 472 | softreset = ata_std_softreset; | ||
| 465 | if (sata_scr_valid(&ap->link)) | 473 | if (sata_scr_valid(&ap->link)) | 
| 466 | hardreset = sata_std_hardreset; | 474 | hardreset = sata_std_hardreset; | 
| 467 | 475 | ||
| 468 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset, | 476 | ata_bmdma_drive_eh(ap, ata_std_prereset, softreset, hardreset, | 
| 469 | ata_std_postreset); | 477 | ata_std_postreset); | 
| 470 | } | 478 | } | 
| 471 | 479 | ||
| diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 028af5dbeed6..511c89b9bae8 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | #undef PDC_DEBUG | 39 | #undef PDC_DEBUG | 
| 40 | 40 | ||
| 41 | #ifdef PDC_DEBUG | 41 | #ifdef PDC_DEBUG | 
| 42 | #define PDPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | 42 | #define PDPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args) | 
| 43 | #else | 43 | #else | 
| 44 | #define PDPRINTK(fmt, args...) | 44 | #define PDPRINTK(fmt, args...) | 
| 45 | #endif | 45 | #endif | 
| diff --git a/drivers/ata/pata_rb500_cf.c b/drivers/ata/pata_rb500_cf.c new file mode 100644 index 000000000000..4ce9b03fe6c8 --- /dev/null +++ b/drivers/ata/pata_rb500_cf.c | |||
| @@ -0,0 +1,314 @@ | |||
| 1 | /* | ||
| 2 | * A low-level PATA driver to handle a Compact Flash connected on the | ||
| 3 | * Mikrotik's RouterBoard 532 board. | ||
| 4 | * | ||
| 5 | * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> | ||
| 6 | * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> | ||
| 7 | * | ||
| 8 | * This file was based on: drivers/ata/pata_ixp4xx_cf.c | ||
| 9 | * Copyright (C) 2006-07 Tower Technologies | ||
| 10 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
| 11 | * | ||
| 12 | * Also was based on the driver for Linux 2.4.xx published by Mikrotik for | ||
| 13 | * their RouterBoard 1xx and 5xx series devices. The original Mikrotik code | ||
| 14 | * seems not to have a license. | ||
| 15 | * | ||
| 16 | * This program is free software; you can redistribute it and/or modify | ||
| 17 | * it under the terms of the GNU General Public License version 2 as | ||
| 18 | * published by the Free Software Foundation. | ||
| 19 | * | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <linux/kernel.h> | ||
| 23 | #include <linux/module.h> | ||
| 24 | #include <linux/platform_device.h> | ||
| 25 | |||
| 26 | #include <linux/io.h> | ||
| 27 | #include <linux/interrupt.h> | ||
| 28 | #include <linux/irq.h> | ||
| 29 | |||
| 30 | #include <linux/libata.h> | ||
| 31 | #include <scsi/scsi_host.h> | ||
| 32 | |||
| 33 | #include <asm/gpio.h> | ||
| 34 | |||
| 35 | #define DRV_NAME "pata-rb500-cf" | ||
| 36 | #define DRV_VERSION "0.1.0" | ||
| 37 | #define DRV_DESC "PATA driver for RouterBOARD 532 Compact Flash" | ||
| 38 | |||
| 39 | #define RB500_CF_MAXPORTS 1 | ||
| 40 | #define RB500_CF_IO_DELAY 400 | ||
| 41 | |||
| 42 | #define RB500_CF_REG_CMD 0x0800 | ||
| 43 | #define RB500_CF_REG_CTRL 0x080E | ||
| 44 | #define RB500_CF_REG_DATA 0x0C00 | ||
| 45 | |||
| 46 | struct rb500_cf_info { | ||
| 47 | void __iomem *iobase; | ||
| 48 | unsigned int gpio_line; | ||
| 49 | int frozen; | ||
| 50 | unsigned int irq; | ||
| 51 | }; | ||
| 52 | |||
| 53 | /* ------------------------------------------------------------------------ */ | ||
| 54 | |||
| 55 | static inline void rb500_pata_finish_io(struct ata_port *ap) | ||
| 56 | { | ||
| 57 | struct ata_host *ah = ap->host; | ||
| 58 | struct rb500_cf_info *info = ah->private_data; | ||
| 59 | |||
| 60 | ata_altstatus(ap); | ||
| 61 | ndelay(RB500_CF_IO_DELAY); | ||
| 62 | |||
| 63 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | ||
| 64 | } | ||
| 65 | |||
| 66 | static void rb500_pata_exec_command(struct ata_port *ap, | ||
| 67 | const struct ata_taskfile *tf) | ||
| 68 | { | ||
| 69 | writeb(tf->command, ap->ioaddr.command_addr); | ||
| 70 | rb500_pata_finish_io(ap); | ||
| 71 | } | ||
| 72 | |||
| 73 | static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf, | ||
| 74 | unsigned int buflen, int write_data) | ||
| 75 | { | ||
| 76 | struct ata_port *ap = adev->link->ap; | ||
| 77 | void __iomem *ioaddr = ap->ioaddr.data_addr; | ||
| 78 | |||
| 79 | if (write_data) { | ||
| 80 | for (; buflen > 0; buflen--, buf++) | ||
| 81 | writeb(*buf, ioaddr); | ||
| 82 | } else { | ||
| 83 | for (; buflen > 0; buflen--, buf++) | ||
| 84 | *buf = readb(ioaddr); | ||
| 85 | } | ||
| 86 | |||
| 87 | rb500_pata_finish_io(adev->link->ap); | ||
| 88 | } | ||
| 89 | |||
| 90 | static void rb500_pata_freeze(struct ata_port *ap) | ||
| 91 | { | ||
| 92 | struct rb500_cf_info *info = ap->host->private_data; | ||
| 93 | |||
| 94 | info->frozen = 1; | ||
| 95 | } | ||
| 96 | |||
| 97 | static void rb500_pata_thaw(struct ata_port *ap) | ||
| 98 | { | ||
| 99 | struct rb500_cf_info *info = ap->host->private_data; | ||
| 100 | |||
| 101 | info->frozen = 0; | ||
| 102 | } | ||
| 103 | |||
| 104 | static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance) | ||
| 105 | { | ||
| 106 | struct ata_host *ah = dev_instance; | ||
| 107 | struct rb500_cf_info *info = ah->private_data; | ||
| 108 | |||
| 109 | if (gpio_get_value(info->gpio_line)) { | ||
| 110 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); | ||
| 111 | if (!info->frozen) | ||
| 112 | ata_interrupt(info->irq, dev_instance); | ||
| 113 | } else { | ||
| 114 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | ||
| 115 | } | ||
| 116 | |||
| 117 | return IRQ_HANDLED; | ||
| 118 | } | ||
| 119 | |||
| 120 | static void rb500_pata_irq_clear(struct ata_port *ap) | ||
| 121 | { | ||
| 122 | } | ||
| 123 | |||
| 124 | static int rb500_pata_port_start(struct ata_port *ap) | ||
| 125 | { | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | |||
| 129 | static struct ata_port_operations rb500_pata_port_ops = { | ||
| 130 | .tf_load = ata_tf_load, | ||
| 131 | .tf_read = ata_tf_read, | ||
| 132 | |||
| 133 | .exec_command = rb500_pata_exec_command, | ||
| 134 | .check_status = ata_check_status, | ||
| 135 | .dev_select = ata_std_dev_select, | ||
| 136 | |||
| 137 | .data_xfer = rb500_pata_data_xfer, | ||
| 138 | |||
| 139 | .qc_prep = ata_qc_prep, | ||
| 140 | .qc_issue = ata_qc_issue_prot, | ||
| 141 | |||
| 142 | .freeze = rb500_pata_freeze, | ||
| 143 | .thaw = rb500_pata_thaw, | ||
| 144 | .error_handler = ata_bmdma_error_handler, | ||
| 145 | |||
| 146 | .irq_handler = rb500_pata_irq_handler, | ||
| 147 | .irq_clear = rb500_pata_irq_clear, | ||
| 148 | .irq_on = ata_irq_on, | ||
| 149 | |||
| 150 | .port_start = rb500_pata_port_start, | ||
| 151 | }; | ||
| 152 | |||
| 153 | /* ------------------------------------------------------------------------ */ | ||
| 154 | |||
| 155 | static struct scsi_host_template rb500_pata_sht = { | ||
| 156 | .module = THIS_MODULE, | ||
| 157 | .name = DRV_NAME, | ||
| 158 | .ioctl = ata_scsi_ioctl, | ||
| 159 | .queuecommand = ata_scsi_queuecmd, | ||
| 160 | .slave_configure = ata_scsi_slave_config, | ||
| 161 | .slave_destroy = ata_scsi_slave_destroy, | ||
| 162 | .bios_param = ata_std_bios_param, | ||
| 163 | .proc_name = DRV_NAME, | ||
| 164 | |||
| 165 | .can_queue = ATA_DEF_QUEUE, | ||
| 166 | .this_id = ATA_SHT_THIS_ID, | ||
| 167 | .sg_tablesize = LIBATA_MAX_PRD, | ||
| 168 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
| 169 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
| 170 | .emulated = ATA_SHT_EMULATED, | ||
| 171 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
| 172 | }; | ||
| 173 | |||
| 174 | /* ------------------------------------------------------------------------ */ | ||
| 175 | |||
| 176 | static void rb500_pata_setup_ports(struct ata_host *ah) | ||
| 177 | { | ||
| 178 | struct rb500_cf_info *info = ah->private_data; | ||
| 179 | struct ata_port *ap; | ||
| 180 | |||
| 181 | ap = ah->ports[0]; | ||
| 182 | |||
| 183 | ap->ops = &rb500_pata_port_ops; | ||
| 184 | ap->pio_mask = 0x1f; /* PIO4 */ | ||
| 185 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; | ||
| 186 | |||
| 187 | ap->ioaddr.cmd_addr = info->iobase + RB500_CF_REG_CMD; | ||
| 188 | ap->ioaddr.ctl_addr = info->iobase + RB500_CF_REG_CTRL; | ||
| 189 | ap->ioaddr.altstatus_addr = info->iobase + RB500_CF_REG_CTRL; | ||
| 190 | |||
| 191 | ata_std_ports(&ap->ioaddr); | ||
| 192 | |||
| 193 | ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA; | ||
| 194 | } | ||
| 195 | |||
| 196 | static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) | ||
| 197 | { | ||
| 198 | unsigned int irq; | ||
| 199 | int gpio; | ||
| 200 | struct resource *res; | ||
| 201 | struct ata_host *ah; | ||
| 202 | struct rb500_cf_info *info; | ||
| 203 | int ret; | ||
| 204 | |||
| 205 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 206 | if (!res) { | ||
| 207 | dev_err(&pdev->dev, "no IOMEM resource found\n"); | ||
| 208 | return -EINVAL; | ||
| 209 | } | ||
| 210 | |||
| 211 | irq = platform_get_irq(pdev, 0); | ||
| 212 | if (irq <= 0) { | ||
| 213 | dev_err(&pdev->dev, "no IRQ resource found\n"); | ||
| 214 | return -ENOENT; | ||
| 215 | } | ||
| 216 | |||
| 217 | gpio = irq_to_gpio(irq); | ||
| 218 | if (gpio < 0) { | ||
| 219 | dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq); | ||
| 220 | return -ENOENT; | ||
| 221 | } | ||
| 222 | |||
| 223 | ret = gpio_request(gpio, DRV_NAME); | ||
| 224 | if (ret) { | ||
| 225 | dev_err(&pdev->dev, "GPIO request failed\n"); | ||
| 226 | return ret; | ||
| 227 | } | ||
| 228 | |||
| 229 | /* allocate host */ | ||
| 230 | ah = ata_host_alloc(&pdev->dev, RB500_CF_MAXPORTS); | ||
| 231 | if (!ah) | ||
| 232 | return -ENOMEM; | ||
| 233 | |||
| 234 | platform_set_drvdata(pdev, ah); | ||
| 235 | |||
| 236 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); | ||
| 237 | if (!info) | ||
| 238 | return -ENOMEM; | ||
| 239 | |||
| 240 | ah->private_data = info; | ||
| 241 | info->gpio_line = gpio; | ||
| 242 | info->irq = irq; | ||
| 243 | |||
| 244 | info->iobase = devm_ioremap_nocache(&pdev->dev, res->start, | ||
| 245 | res->end - res->start + 1); | ||
| 246 | if (!info->iobase) | ||
| 247 | return -ENOMEM; | ||
| 248 | |||
| 249 | ret = gpio_direction_input(gpio); | ||
| 250 | if (ret) { | ||
| 251 | dev_err(&pdev->dev, "unable to set GPIO direction, err=%d\n", | ||
| 252 | ret); | ||
| 253 | goto err_free_gpio; | ||
| 254 | } | ||
| 255 | |||
| 256 | rb500_pata_setup_ports(ah); | ||
| 257 | |||
| 258 | ret = ata_host_activate(ah, irq, rb500_pata_irq_handler, | ||
| 259 | IRQF_TRIGGER_LOW, &rb500_pata_sht); | ||
| 260 | if (ret) | ||
| 261 | goto err_free_gpio; | ||
| 262 | |||
| 263 | return 0; | ||
| 264 | |||
| 265 | err_free_gpio: | ||
| 266 | gpio_free(gpio); | ||
| 267 | |||
| 268 | return ret; | ||
| 269 | } | ||
| 270 | |||
| 271 | static __devexit int rb500_pata_driver_remove(struct platform_device *pdev) | ||
| 272 | { | ||
| 273 | struct ata_host *ah = platform_get_drvdata(pdev); | ||
| 274 | struct rb500_cf_info *info = ah->private_data; | ||
| 275 | |||
| 276 | ata_host_detach(ah); | ||
| 277 | gpio_free(info->gpio_line); | ||
| 278 | |||
| 279 | return 0; | ||
| 280 | } | ||
| 281 | |||
| 282 | static struct platform_driver rb500_pata_platform_driver = { | ||
| 283 | .probe = rb500_pata_driver_probe, | ||
| 284 | .remove = __devexit_p(rb500_pata_driver_remove), | ||
| 285 | .driver = { | ||
| 286 | .name = DRV_NAME, | ||
| 287 | .owner = THIS_MODULE, | ||
| 288 | }, | ||
| 289 | }; | ||
| 290 | |||
| 291 | /* ------------------------------------------------------------------------ */ | ||
| 292 | |||
| 293 | #define DRV_INFO DRV_DESC " version " DRV_VERSION | ||
| 294 | |||
| 295 | static int __init rb500_pata_module_init(void) | ||
| 296 | { | ||
| 297 | printk(KERN_INFO DRV_INFO "\n"); | ||
| 298 | |||
| 299 | return platform_driver_register(&rb500_pata_platform_driver); | ||
| 300 | } | ||
| 301 | |||
| 302 | static void __exit rb500_pata_module_exit(void) | ||
| 303 | { | ||
| 304 | platform_driver_unregister(&rb500_pata_platform_driver); | ||
| 305 | } | ||
| 306 | |||
| 307 | MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>"); | ||
| 308 | MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); | ||
| 309 | MODULE_DESCRIPTION(DRV_DESC); | ||
| 310 | MODULE_VERSION(DRV_VERSION); | ||
| 311 | MODULE_LICENSE("GPL"); | ||
| 312 | |||
| 313 | module_init(rb500_pata_module_init); | ||
| 314 | module_exit(rb500_pata_module_exit); | ||
