aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--drivers/ata/Kconfig4
-rw-r--r--drivers/ata/ahci.c60
-rw-r--r--drivers/ata/ata_generic.c6
-rw-r--r--drivers/ata/libata-core.c14
-rw-r--r--drivers/ata/libata-sff.c21
-rw-r--r--drivers/ata/pata_cmd64x.c23
-rw-r--r--drivers/ata/pata_hpt3x2n.c6
-rw-r--r--drivers/ata/pata_it821x.c4
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c5
-rw-r--r--drivers/ata/pata_legacy.c4
-rw-r--r--drivers/ata/pata_rz1000.c6
-rw-r--r--drivers/ata/sata_uli.c3
-rw-r--r--drivers/ata/sata_via.c12
-rw-r--r--include/asm-generic/libata-portmap.h4
-rw-r--r--include/asm-powerpc/libata-portmap.h12
-rw-r--r--include/linux/libata.h5
17 files changed, 137 insertions, 53 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 0855d55c194d..b268c417c0bf 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -484,6 +484,7 @@ config PPC_MAPLE
484 select PPC_970_NAP 484 select PPC_970_NAP
485 select PPC_NATIVE 485 select PPC_NATIVE
486 select PPC_RTAS 486 select PPC_RTAS
487 select ATA_NONSTANDARD if ATA
487 default n 488 default n
488 help 489 help
489 This option enables support for the Maple 970FX Evaluation Board. 490 This option enables support for the Maple 970FX Evaluation Board.
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index da21552d2b1c..1c94b43d2c9b 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -19,6 +19,10 @@ config ATA
19 19
20if ATA 20if ATA
21 21
22config ATA_NONSTANDARD
23 bool
24 default n
25
22config SATA_AHCI 26config SATA_AHCI
23 tristate "AHCI SATA support" 27 tristate "AHCI SATA support"
24 depends on PCI 28 depends on PCI
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e3c7b312287a..28a82e3403f1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -75,6 +75,7 @@ enum {
75 AHCI_CMD_CLR_BUSY = (1 << 10), 75 AHCI_CMD_CLR_BUSY = (1 << 10),
76 76
77 RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ 77 RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */
78 RX_FIS_SDB = 0x58, /* offset of SDB FIS data */
78 RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ 79 RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */
79 80
80 board_ahci = 0, 81 board_ahci = 0,
@@ -202,6 +203,10 @@ struct ahci_port_priv {
202 dma_addr_t cmd_tbl_dma; 203 dma_addr_t cmd_tbl_dma;
203 void *rx_fis; 204 void *rx_fis;
204 dma_addr_t rx_fis_dma; 205 dma_addr_t rx_fis_dma;
206 /* for NCQ spurious interrupt analysis */
207 int ncq_saw_spurious_sdb_cnt;
208 unsigned int ncq_saw_d2h:1;
209 unsigned int ncq_saw_dmas:1;
205}; 210};
206 211
207static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); 212static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg);
@@ -898,7 +903,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
898 903
899 /* clear D2H reception area to properly wait for D2H FIS */ 904 /* clear D2H reception area to properly wait for D2H FIS */
900 ata_tf_init(ap->device, &tf); 905 ata_tf_init(ap->device, &tf);
901 tf.command = 0xff; 906 tf.command = 0x80;
902 ata_tf_to_fis(&tf, d2h_fis, 0); 907 ata_tf_to_fis(&tf, d2h_fis, 0);
903 908
904 rc = sata_std_hardreset(ap, class); 909 rc = sata_std_hardreset(ap, class);
@@ -1109,8 +1114,9 @@ static void ahci_host_intr(struct ata_port *ap)
1109 void __iomem *mmio = ap->host->mmio_base; 1114 void __iomem *mmio = ap->host->mmio_base;
1110 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1115 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1111 struct ata_eh_info *ehi = &ap->eh_info; 1116 struct ata_eh_info *ehi = &ap->eh_info;
1117 struct ahci_port_priv *pp = ap->private_data;
1112 u32 status, qc_active; 1118 u32 status, qc_active;
1113 int rc; 1119 int rc, known_irq = 0;
1114 1120
1115 status = readl(port_mmio + PORT_IRQ_STAT); 1121 status = readl(port_mmio + PORT_IRQ_STAT);
1116 writel(status, port_mmio + PORT_IRQ_STAT); 1122 writel(status, port_mmio + PORT_IRQ_STAT);
@@ -1137,17 +1143,53 @@ static void ahci_host_intr(struct ata_port *ap)
1137 1143
1138 /* hmmm... a spurious interupt */ 1144 /* hmmm... a spurious interupt */
1139 1145
1140 /* some devices send D2H reg with I bit set during NCQ command phase */ 1146 /* if !NCQ, ignore. No modern ATA device has broken HSM
1141 if (ap->sactive && (status & PORT_IRQ_D2H_REG_FIS)) 1147 * implementation for non-NCQ commands.
1148 */
1149 if (!ap->sactive)
1142 return; 1150 return;
1143 1151
1144 /* ignore interim PIO setup fis interrupts */ 1152 if (status & PORT_IRQ_D2H_REG_FIS) {
1145 if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) 1153 if (!pp->ncq_saw_d2h)
1146 return; 1154 ata_port_printk(ap, KERN_INFO,
1155 "D2H reg with I during NCQ, "
1156 "this message won't be printed again\n");
1157 pp->ncq_saw_d2h = 1;
1158 known_irq = 1;
1159 }
1160
1161 if (status & PORT_IRQ_DMAS_FIS) {
1162 if (!pp->ncq_saw_dmas)
1163 ata_port_printk(ap, KERN_INFO,
1164 "DMAS FIS during NCQ, "
1165 "this message won't be printed again\n");
1166 pp->ncq_saw_dmas = 1;
1167 known_irq = 1;
1168 }
1169
1170 if (status & PORT_IRQ_SDB_FIS &&
1171 pp->ncq_saw_spurious_sdb_cnt < 10) {
1172 /* SDB FIS containing spurious completions might be
1173 * dangerous, we need to know more about them. Print
1174 * more of it.
1175 */
1176 const u32 *f = pp->rx_fis + RX_FIS_SDB;
1177
1178 ata_port_printk(ap, KERN_INFO, "Spurious SDB FIS during NCQ "
1179 "issue=0x%x SAct=0x%x FIS=%08x:%08x%s\n",
1180 readl(port_mmio + PORT_CMD_ISSUE),
1181 readl(port_mmio + PORT_SCR_ACT),
1182 le32_to_cpu(f[0]), le32_to_cpu(f[1]),
1183 pp->ncq_saw_spurious_sdb_cnt < 10 ?
1184 "" : ", shutting up");
1185
1186 pp->ncq_saw_spurious_sdb_cnt++;
1187 known_irq = 1;
1188 }
1147 1189
1148 if (ata_ratelimit()) 1190 if (!known_irq)
1149 ata_port_printk(ap, KERN_INFO, "spurious interrupt " 1191 ata_port_printk(ap, KERN_INFO, "spurious interrupt "
1150 "(irq_stat 0x%x active_tag %d sactive 0x%x)\n", 1192 "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n",
1151 status, ap->active_tag, ap->sactive); 1193 status, ap->active_tag, ap->sactive);
1152} 1194}
1153 1195
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 908751d27e76..24af56081b5d 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -64,6 +64,7 @@ static void generic_error_handler(struct ata_port *ap)
64/** 64/**
65 * generic_set_mode - mode setting 65 * generic_set_mode - mode setting
66 * @ap: interface to set up 66 * @ap: interface to set up
67 * @unused: returned device on error
67 * 68 *
68 * Use a non standard set_mode function. We don't want to be tuned. 69 * Use a non standard set_mode function. We don't want to be tuned.
69 * The BIOS configured everything. Our job is not to fiddle. We 70 * The BIOS configured everything. Our job is not to fiddle. We
@@ -71,7 +72,7 @@ static void generic_error_handler(struct ata_port *ap)
71 * and respect them. 72 * and respect them.
72 */ 73 */
73 74
74static void generic_set_mode(struct ata_port *ap) 75static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
75{ 76{
76 int dma_enabled = 0; 77 int dma_enabled = 0;
77 int i; 78 int i;
@@ -82,7 +83,7 @@ static void generic_set_mode(struct ata_port *ap)
82 83
83 for (i = 0; i < ATA_MAX_DEVICES; i++) { 84 for (i = 0; i < ATA_MAX_DEVICES; i++) {
84 struct ata_device *dev = &ap->device[i]; 85 struct ata_device *dev = &ap->device[i];
85 if (ata_dev_enabled(dev)) { 86 if (ata_dev_ready(dev)) {
86 /* We don't really care */ 87 /* We don't really care */
87 dev->pio_mode = XFER_PIO_0; 88 dev->pio_mode = XFER_PIO_0;
88 dev->dma_mode = XFER_MW_DMA_0; 89 dev->dma_mode = XFER_MW_DMA_0;
@@ -99,6 +100,7 @@ static void generic_set_mode(struct ata_port *ap)
99 } 100 }
100 } 101 }
101 } 102 }
103 return 0;
102} 104}
103 105
104static struct scsi_host_template generic_sht = { 106static struct scsi_host_template generic_sht = {
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0d51d13b16bf..a388a8df0043 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2431,18 +2431,8 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2431 int i, rc = 0, used_dma = 0, found = 0; 2431 int i, rc = 0, used_dma = 0, found = 0;
2432 2432
2433 /* has private set_mode? */ 2433 /* has private set_mode? */
2434 if (ap->ops->set_mode) { 2434 if (ap->ops->set_mode)
2435 /* FIXME: make ->set_mode handle no device case and 2435 return ap->ops->set_mode(ap, r_failed_dev);
2436 * return error code and failing device on failure.
2437 */
2438 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2439 if (ata_dev_ready(&ap->device[i])) {
2440 ap->ops->set_mode(ap);
2441 break;
2442 }
2443 }
2444 return 0;
2445 }
2446 2436
2447 /* step 1: calculate xfer_mask */ 2437 /* step 1: calculate xfer_mask */
2448 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2438 for (i = 0; i < ATA_MAX_DEVICES; i++) {
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 623cec914c9b..12c88c588039 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -827,7 +827,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)
827 */ 827 */
828void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) 828void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
829{ 829{
830 ata_bmdma_stop(qc); 830 if (qc->ap->ioaddr.bmdma_addr)
831 ata_bmdma_stop(qc);
831} 832}
832 833
833#ifdef CONFIG_PCI 834#ifdef CONFIG_PCI
@@ -870,7 +871,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
870 pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; 871 pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS;
871 bmdma = pci_resource_start(pdev, 4); 872 bmdma = pci_resource_start(pdev, 4);
872 if (bmdma) { 873 if (bmdma) {
873 if (inb(bmdma + 2) & 0x80) 874 if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
875 (inb(bmdma + 2) & 0x80))
874 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 876 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
875 probe_ent->port[p].bmdma_addr = bmdma; 877 probe_ent->port[p].bmdma_addr = bmdma;
876 } 878 }
@@ -886,7 +888,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
886 bmdma = pci_resource_start(pdev, 4); 888 bmdma = pci_resource_start(pdev, 4);
887 if (bmdma) { 889 if (bmdma) {
888 bmdma += 8; 890 bmdma += 8;
889 if(inb(bmdma + 2) & 0x80) 891 if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
892 (inb(bmdma + 2) & 0x80))
890 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 893 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
891 probe_ent->port[p].bmdma_addr = bmdma; 894 probe_ent->port[p].bmdma_addr = bmdma;
892 } 895 }
@@ -914,13 +917,14 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
914 probe_ent->irq_flags = IRQF_SHARED; 917 probe_ent->irq_flags = IRQF_SHARED;
915 918
916 if (port_mask & ATA_PORT_PRIMARY) { 919 if (port_mask & ATA_PORT_PRIMARY) {
917 probe_ent->irq = ATA_PRIMARY_IRQ; 920 probe_ent->irq = ATA_PRIMARY_IRQ(pdev);
918 probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD; 921 probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD;
919 probe_ent->port[0].altstatus_addr = 922 probe_ent->port[0].altstatus_addr =
920 probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL; 923 probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL;
921 if (bmdma) { 924 if (bmdma) {
922 probe_ent->port[0].bmdma_addr = bmdma; 925 probe_ent->port[0].bmdma_addr = bmdma;
923 if (inb(bmdma + 2) & 0x80) 926 if ((!(port[0]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
927 (inb(bmdma + 2) & 0x80))
924 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 928 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
925 } 929 }
926 ata_std_ports(&probe_ent->port[0]); 930 ata_std_ports(&probe_ent->port[0]);
@@ -929,15 +933,16 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
929 933
930 if (port_mask & ATA_PORT_SECONDARY) { 934 if (port_mask & ATA_PORT_SECONDARY) {
931 if (probe_ent->irq) 935 if (probe_ent->irq)
932 probe_ent->irq2 = ATA_SECONDARY_IRQ; 936 probe_ent->irq2 = ATA_SECONDARY_IRQ(pdev);
933 else 937 else
934 probe_ent->irq = ATA_SECONDARY_IRQ; 938 probe_ent->irq = ATA_SECONDARY_IRQ(pdev);
935 probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD; 939 probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD;
936 probe_ent->port[1].altstatus_addr = 940 probe_ent->port[1].altstatus_addr =
937 probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL; 941 probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL;
938 if (bmdma) { 942 if (bmdma) {
939 probe_ent->port[1].bmdma_addr = bmdma + 8; 943 probe_ent->port[1].bmdma_addr = bmdma + 8;
940 if (inb(bmdma + 10) & 0x80) 944 if ((!(port[1]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
945 (inb(bmdma + 10) & 0x80))
941 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 946 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
942 } 947 }
943 ata_std_ports(&probe_ent->port[1]); 948 ata_std_ports(&probe_ent->port[1]);
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 15841a563694..449162cbf93e 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -197,7 +197,7 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
197static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) 197static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
198{ 198{
199 static const u8 udma_data[] = { 199 static const u8 udma_data[] = {
200 0x31, 0x21, 0x11, 0x25, 0x15, 0x05 200 0x30, 0x20, 0x10, 0x20, 0x10, 0x00
201 }; 201 };
202 static const u8 mwdma_data[] = { 202 static const u8 mwdma_data[] = {
203 0x30, 0x20, 0x10 203 0x30, 0x20, 0x10
@@ -213,12 +213,21 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
213 pci_read_config_byte(pdev, pciD, &regD); 213 pci_read_config_byte(pdev, pciD, &regD);
214 pci_read_config_byte(pdev, pciU, &regU); 214 pci_read_config_byte(pdev, pciU, &regU);
215 215
216 regD &= ~(0x20 << shift); 216 /* DMA bits off */
217 regU &= ~(0x35 << shift); 217 regD &= ~(0x20 << adev->devno);
218 /* DMA control bits */
219 regU &= ~(0x30 << shift);
220 /* DMA timing bits */
221 regU &= ~(0x05 << adev->devno);
218 222
219 if (adev->dma_mode >= XFER_UDMA_0) 223 if (adev->dma_mode >= XFER_UDMA_0) {
224 /* Merge thge timing value */
220 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; 225 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
221 else 226 /* Merge the control bits */
227 regU |= 1 << adev->devno; /* UDMA on */
228 if (adev->dma_mode > 2) /* 15nS timing */
229 regU |= 4 << adev->devno;
230 } else
222 regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift; 231 regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift;
223 232
224 regD |= 0x20 << adev->devno; 233 regD |= 0x20 << adev->devno;
@@ -239,8 +248,8 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc)
239 struct ata_port *ap = qc->ap; 248 struct ata_port *ap = qc->ap;
240 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 249 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
241 u8 dma_intr; 250 u8 dma_intr;
242 int dma_reg = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; 251 int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
243 int dma_mask = ap->port_no ? ARTTIM2 : CFR; 252 int dma_reg = ap->port_no ? ARTTIM2 : CFR;
244 253
245 ata_bmdma_stop(qc); 254 ata_bmdma_stop(qc);
246 255
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index f6817b4093a4..886fab9aa62c 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3" 28#define DRV_VERSION "0.3.2"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -297,11 +297,11 @@ static int hpt3x2n_pair_idle(struct ata_port *ap)
297 return 0; 297 return 0;
298} 298}
299 299
300static int hpt3x2n_use_dpll(struct ata_port *ap, int reading) 300static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
301{ 301{
302 long flags = (long)ap->host->private_data; 302 long flags = (long)ap->host->private_data;
303 /* See if we should use the DPLL */ 303 /* See if we should use the DPLL */
304 if (reading == 0) 304 if (writing)
305 return USE_DPLL; /* Needed for write */ 305 return USE_DPLL; /* Needed for write */
306 if (flags & PCI66) 306 if (flags & PCI66)
307 return USE_DPLL; /* Needed at 66Mhz */ 307 return USE_DPLL; /* Needed at 66Mhz */
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 0b56ff3d1cfe..e8afd486434a 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -476,6 +476,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
476/** 476/**
477 * it821x_smart_set_mode - mode setting 477 * it821x_smart_set_mode - mode setting
478 * @ap: interface to set up 478 * @ap: interface to set up
479 * @unused: device that failed (error only)
479 * 480 *
480 * Use a non standard set_mode function. We don't want to be tuned. 481 * Use a non standard set_mode function. We don't want to be tuned.
481 * The BIOS configured everything. Our job is not to fiddle. We 482 * The BIOS configured everything. Our job is not to fiddle. We
@@ -483,7 +484,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
483 * and respect them. 484 * and respect them.
484 */ 485 */
485 486
486static void it821x_smart_set_mode(struct ata_port *ap) 487static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused)
487{ 488{
488 int dma_enabled = 0; 489 int dma_enabled = 0;
489 int i; 490 int i;
@@ -512,6 +513,7 @@ static void it821x_smart_set_mode(struct ata_port *ap)
512 } 513 }
513 } 514 }
514 } 515 }
516 return 0;
515} 517}
516 518
517/** 519/**
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index cb8924109f59..23b8aab3ebd8 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -23,9 +23,9 @@
23#include <scsi/scsi_host.h> 23#include <scsi/scsi_host.h>
24 24
25#define DRV_NAME "pata_ixp4xx_cf" 25#define DRV_NAME "pata_ixp4xx_cf"
26#define DRV_VERSION "0.1.1" 26#define DRV_VERSION "0.1.1ac1"
27 27
28static void ixp4xx_set_mode(struct ata_port *ap) 28static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device *adev)
29{ 29{
30 int i; 30 int i;
31 31
@@ -38,6 +38,7 @@ static void ixp4xx_set_mode(struct ata_port *ap)
38 dev->flags |= ATA_DFLAG_PIO; 38 dev->flags |= ATA_DFLAG_PIO;
39 } 39 }
40 } 40 }
41 return 0;
41} 42}
42 43
43static void ixp4xx_phy_reset(struct ata_port *ap) 44static void ixp4xx_phy_reset(struct ata_port *ap)
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index e7bf9d89c8ee..581cb33c6f45 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -96,6 +96,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */
96/** 96/**
97 * legacy_set_mode - mode setting 97 * legacy_set_mode - mode setting
98 * @ap: IDE interface 98 * @ap: IDE interface
99 * @unused: Device that failed when error is returned
99 * 100 *
100 * Use a non standard set_mode function. We don't want to be tuned. 101 * Use a non standard set_mode function. We don't want to be tuned.
101 * 102 *
@@ -105,7 +106,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */
105 * expand on this as per hdparm in the base kernel. 106 * expand on this as per hdparm in the base kernel.
106 */ 107 */
107 108
108static void legacy_set_mode(struct ata_port *ap) 109static int legacy_set_mode(struct ata_port *ap, struct ata_device **unused)
109{ 110{
110 int i; 111 int i;
111 112
@@ -118,6 +119,7 @@ static void legacy_set_mode(struct ata_port *ap)
118 dev->flags |= ATA_DFLAG_PIO; 119 dev->flags |= ATA_DFLAG_PIO;
119 } 120 }
120 } 121 }
122 return 0;
121} 123}
122 124
123static struct scsi_host_template legacy_sht = { 125static struct scsi_host_template legacy_sht = {
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index adf4cc134f25..cec0729225e1 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -52,19 +52,20 @@ static void rz1000_error_handler(struct ata_port *ap)
52/** 52/**
53 * rz1000_set_mode - mode setting function 53 * rz1000_set_mode - mode setting function
54 * @ap: ATA interface 54 * @ap: ATA interface
55 * @unused: returned device on set_mode failure
55 * 56 *
56 * Use a non standard set_mode function. We don't want to be tuned. We 57 * Use a non standard set_mode function. We don't want to be tuned. We
57 * would prefer to be BIOS generic but for the fact our hardware is 58 * would prefer to be BIOS generic but for the fact our hardware is
58 * whacked out. 59 * whacked out.
59 */ 60 */
60 61
61static void rz1000_set_mode(struct ata_port *ap) 62static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused)
62{ 63{
63 int i; 64 int i;
64 65
65 for (i = 0; i < ATA_MAX_DEVICES; i++) { 66 for (i = 0; i < ATA_MAX_DEVICES; i++) {
66 struct ata_device *dev = &ap->device[i]; 67 struct ata_device *dev = &ap->device[i];
67 if (ata_dev_enabled(dev)) { 68 if (ata_dev_ready(dev)) {
68 /* We don't really care */ 69 /* We don't really care */
69 dev->pio_mode = XFER_PIO_0; 70 dev->pio_mode = XFER_PIO_0;
70 dev->xfer_mode = XFER_PIO_0; 71 dev->xfer_mode = XFER_PIO_0;
@@ -72,6 +73,7 @@ static void rz1000_set_mode(struct ata_port *ap)
72 dev->flags |= ATA_DFLAG_PIO; 73 dev->flags |= ATA_DFLAG_PIO;
73 } 74 }
74 } 75 }
76 return 0;
75} 77}
76 78
77 79
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 5c603ca3a50a..a43aec62d505 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -128,7 +128,8 @@ static const struct ata_port_operations uli_ops = {
128 128
129static struct ata_port_info uli_port_info = { 129static struct ata_port_info uli_port_info = {
130 .sht = &uli_sht, 130 .sht = &uli_sht,
131 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 131 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
132 ATA_FLAG_IGN_SIMPLEX,
132 .pio_mask = 0x1f, /* pio0-4 */ 133 .pio_mask = 0x1f, /* pio0-4 */
133 .udma_mask = 0x7f, /* udma0-6 */ 134 .udma_mask = 0x7f, /* udma0-6 */
134 .port_ops = &uli_ops, 135 .port_ops = &uli_ops,
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 88f0565c8883..d3d5c0d57032 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -74,6 +74,7 @@ enum {
74static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 74static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
75static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); 75static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg);
76static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 76static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
77static void svia_noop_freeze(struct ata_port *ap);
77static void vt6420_error_handler(struct ata_port *ap); 78static void vt6420_error_handler(struct ata_port *ap);
78 79
79static const struct pci_device_id svia_pci_tbl[] = { 80static const struct pci_device_id svia_pci_tbl[] = {
@@ -128,7 +129,7 @@ static const struct ata_port_operations vt6420_sata_ops = {
128 .qc_issue = ata_qc_issue_prot, 129 .qc_issue = ata_qc_issue_prot,
129 .data_xfer = ata_pio_data_xfer, 130 .data_xfer = ata_pio_data_xfer,
130 131
131 .freeze = ata_bmdma_freeze, 132 .freeze = svia_noop_freeze,
132 .thaw = ata_bmdma_thaw, 133 .thaw = ata_bmdma_thaw,
133 .error_handler = vt6420_error_handler, 134 .error_handler = vt6420_error_handler,
134 .post_internal_cmd = ata_bmdma_post_internal_cmd, 135 .post_internal_cmd = ata_bmdma_post_internal_cmd,
@@ -204,6 +205,15 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
204 outl(val, ap->ioaddr.scr_addr + (4 * sc_reg)); 205 outl(val, ap->ioaddr.scr_addr + (4 * sc_reg));
205} 206}
206 207
208static void svia_noop_freeze(struct ata_port *ap)
209{
210 /* Some VIA controllers choke if ATA_NIEN is manipulated in
211 * certain way. Leave it alone and just clear pending IRQ.
212 */
213 ata_chk_status(ap);
214 ata_bmdma_irq_clear(ap);
215}
216
207/** 217/**
208 * vt6420_prereset - prereset for vt6420 218 * vt6420_prereset - prereset for vt6420
209 * @ap: target ATA port 219 * @ap: target ATA port
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h
index 9202fd02d5be..62fb3618293d 100644
--- a/include/asm-generic/libata-portmap.h
+++ b/include/asm-generic/libata-portmap.h
@@ -3,10 +3,10 @@
3 3
4#define ATA_PRIMARY_CMD 0x1F0 4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6 5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ 14 6#define ATA_PRIMARY_IRQ(dev) 14
7 7
8#define ATA_SECONDARY_CMD 0x170 8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376 9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ 15 10#define ATA_SECONDARY_IRQ(dev) 15
11 11
12#endif 12#endif
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h
new file mode 100644
index 000000000000..4d8518049f4d
--- /dev/null
+++ b/include/asm-powerpc/libata-portmap.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H
2#define __ASM_POWERPC_LIBATA_PORTMAP_H
3
4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 0)
7
8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 1)
11
12#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index f7f268e38749..22aa69e20905 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -177,6 +177,7 @@ enum {
177 * Register FIS clearing BSY */ 177 * Register FIS clearing BSY */
178 ATA_FLAG_DEBUGMSG = (1 << 13), 178 ATA_FLAG_DEBUGMSG = (1 << 13),
179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */ 179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
180 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
180 181
181 /* The following flag belongs to ap->pflags but is kept in 182 /* The following flag belongs to ap->pflags but is kept in
182 * ap->flags because it's referenced in many LLDs and will be 183 * ap->flags because it's referenced in many LLDs and will be
@@ -612,11 +613,11 @@ struct ata_port_operations {
612 void (*dev_select)(struct ata_port *ap, unsigned int device); 613 void (*dev_select)(struct ata_port *ap, unsigned int device);
613 614
614 void (*phy_reset) (struct ata_port *ap); /* obsolete */ 615 void (*phy_reset) (struct ata_port *ap); /* obsolete */
615 void (*set_mode) (struct ata_port *ap); 616 int (*set_mode) (struct ata_port *ap, struct ata_device **r_failed_dev);
616 617
617 void (*post_set_mode) (struct ata_port *ap); 618 void (*post_set_mode) (struct ata_port *ap);
618 619
619 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 620 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
620 621
621 void (*bmdma_setup) (struct ata_queued_cmd *qc); 622 void (*bmdma_setup) (struct ata_queued_cmd *qc);
622 void (*bmdma_start) (struct ata_queued_cmd *qc); 623 void (*bmdma_start) (struct ata_queued_cmd *qc);