diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 8 | ||||
-rw-r--r-- | drivers/ata/ata_piix.c | 8 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 60 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 30 | ||||
-rw-r--r-- | drivers/ata/pata_acpi.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_atiixp.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_cs5530.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_it821x.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_oldpiix.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_sc1200.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_via.c | 59 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 37 |
12 files changed, 96 insertions, 126 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index ef3e5522e1a4..c729e6988bbb 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -486,6 +486,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
486 | { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ | 486 | { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ |
487 | { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ | 487 | { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ |
488 | { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ | 488 | { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ |
489 | { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */ | ||
490 | { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ | ||
489 | 491 | ||
490 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 492 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
491 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 493 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -575,9 +577,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
575 | { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ | 577 | { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ |
576 | 578 | ||
577 | /* SiS */ | 579 | /* SiS */ |
578 | { PCI_VDEVICE(SI, 0x1184), board_ahci_nopmp }, /* SiS 966 */ | 580 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ |
579 | { PCI_VDEVICE(SI, 0x1185), board_ahci_nopmp }, /* SiS 968 */ | 581 | { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 968 */ |
580 | { PCI_VDEVICE(SI, 0x0186), board_ahci_nopmp }, /* SiS 968 */ | 582 | { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */ |
581 | 583 | ||
582 | /* Marvell */ | 584 | /* Marvell */ |
583 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 585 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index c294121fd69e..b1d08a8f5003 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -275,6 +275,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
275 | { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 275 | { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
276 | /* SATA Controller IDE (ICH10) */ | 276 | /* SATA Controller IDE (ICH10) */ |
277 | { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 277 | { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
278 | /* SATA Controller IDE (PCH) */ | ||
279 | { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
280 | /* SATA Controller IDE (PCH) */ | ||
281 | { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
282 | /* SATA Controller IDE (PCH) */ | ||
283 | { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
284 | /* SATA Controller IDE (PCH) */ | ||
285 | { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
278 | 286 | ||
279 | { } /* terminate list */ | 287 | { } /* terminate list */ |
280 | }; | 288 | }; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 5ba96c5052c8..79e3a8e7a84a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -104,6 +104,7 @@ struct ata_force_param { | |||
104 | unsigned long xfer_mask; | 104 | unsigned long xfer_mask; |
105 | unsigned int horkage_on; | 105 | unsigned int horkage_on; |
106 | unsigned int horkage_off; | 106 | unsigned int horkage_off; |
107 | unsigned int lflags; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | struct ata_force_ent { | 110 | struct ata_force_ent { |
@@ -196,22 +197,23 @@ void ata_force_cbl(struct ata_port *ap) | |||
196 | } | 197 | } |
197 | 198 | ||
198 | /** | 199 | /** |
199 | * ata_force_spd_limit - force SATA spd limit according to libata.force | 200 | * ata_force_link_limits - force link limits according to libata.force |
200 | * @link: ATA link of interest | 201 | * @link: ATA link of interest |
201 | * | 202 | * |
202 | * Force SATA spd limit according to libata.force and whine about | 203 | * Force link flags and SATA spd limit according to libata.force |
203 | * it. When only the port part is specified (e.g. 1:), the limit | 204 | * and whine about it. When only the port part is specified |
204 | * applies to all links connected to both the host link and all | 205 | * (e.g. 1:), the limit applies to all links connected to both |
205 | * fan-out ports connected via PMP. If the device part is | 206 | * the host link and all fan-out ports connected via PMP. If the |
206 | * specified as 0 (e.g. 1.00:), it specifies the first fan-out | 207 | * device part is specified as 0 (e.g. 1.00:), it specifies the |
207 | * link not the host link. Device number 15 always points to the | 208 | * first fan-out link not the host link. Device number 15 always |
208 | * host link whether PMP is attached or not. | 209 | * points to the host link whether PMP is attached or not. |
209 | * | 210 | * |
210 | * LOCKING: | 211 | * LOCKING: |
211 | * EH context. | 212 | * EH context. |
212 | */ | 213 | */ |
213 | static void ata_force_spd_limit(struct ata_link *link) | 214 | static void ata_force_link_limits(struct ata_link *link) |
214 | { | 215 | { |
216 | bool did_spd = false; | ||
215 | int linkno, i; | 217 | int linkno, i; |
216 | 218 | ||
217 | if (ata_is_host_link(link)) | 219 | if (ata_is_host_link(link)) |
@@ -228,13 +230,22 @@ static void ata_force_spd_limit(struct ata_link *link) | |||
228 | if (fe->device != -1 && fe->device != linkno) | 230 | if (fe->device != -1 && fe->device != linkno) |
229 | continue; | 231 | continue; |
230 | 232 | ||
231 | if (!fe->param.spd_limit) | 233 | /* only honor the first spd limit */ |
232 | continue; | 234 | if (!did_spd && fe->param.spd_limit) { |
235 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; | ||
236 | ata_link_printk(link, KERN_NOTICE, | ||
237 | "FORCE: PHY spd limit set to %s\n", | ||
238 | fe->param.name); | ||
239 | did_spd = true; | ||
240 | } | ||
233 | 241 | ||
234 | link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; | 242 | /* let lflags stack */ |
235 | ata_link_printk(link, KERN_NOTICE, | 243 | if (fe->param.lflags) { |
236 | "FORCE: PHY spd limit set to %s\n", fe->param.name); | 244 | link->flags |= fe->param.lflags; |
237 | return; | 245 | ata_link_printk(link, KERN_NOTICE, |
246 | "FORCE: link flag 0x%x forced -> 0x%x\n", | ||
247 | fe->param.lflags, link->flags); | ||
248 | } | ||
238 | } | 249 | } |
239 | } | 250 | } |
240 | 251 | ||
@@ -3277,7 +3288,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3277 | dev->dma_mode = ata_xfer_mask2mode(dma_mask); | 3288 | dev->dma_mode = ata_xfer_mask2mode(dma_mask); |
3278 | 3289 | ||
3279 | found = 1; | 3290 | found = 1; |
3280 | if (dev->dma_mode != 0xff) | 3291 | if (ata_dma_enabled(dev)) |
3281 | used_dma = 1; | 3292 | used_dma = 1; |
3282 | } | 3293 | } |
3283 | if (!found) | 3294 | if (!found) |
@@ -3302,7 +3313,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev) | |||
3302 | 3313 | ||
3303 | /* step 3: set host DMA timings */ | 3314 | /* step 3: set host DMA timings */ |
3304 | ata_link_for_each_dev(dev, link) { | 3315 | ata_link_for_each_dev(dev, link) { |
3305 | if (!ata_dev_enabled(dev) || dev->dma_mode == 0xff) | 3316 | if (!ata_dev_enabled(dev) || !ata_dma_enabled(dev)) |
3306 | continue; | 3317 | continue; |
3307 | 3318 | ||
3308 | dev->xfer_mode = dev->dma_mode; | 3319 | dev->xfer_mode = dev->dma_mode; |
@@ -5188,19 +5199,18 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp) | |||
5188 | */ | 5199 | */ |
5189 | int sata_link_init_spd(struct ata_link *link) | 5200 | int sata_link_init_spd(struct ata_link *link) |
5190 | { | 5201 | { |
5191 | u32 scontrol; | ||
5192 | u8 spd; | 5202 | u8 spd; |
5193 | int rc; | 5203 | int rc; |
5194 | 5204 | ||
5195 | rc = sata_scr_read(link, SCR_CONTROL, &scontrol); | 5205 | rc = sata_scr_read(link, SCR_CONTROL, &link->saved_scontrol); |
5196 | if (rc) | 5206 | if (rc) |
5197 | return rc; | 5207 | return rc; |
5198 | 5208 | ||
5199 | spd = (scontrol >> 4) & 0xf; | 5209 | spd = (link->saved_scontrol >> 4) & 0xf; |
5200 | if (spd) | 5210 | if (spd) |
5201 | link->hw_sata_spd_limit &= (1 << spd) - 1; | 5211 | link->hw_sata_spd_limit &= (1 << spd) - 1; |
5202 | 5212 | ||
5203 | ata_force_spd_limit(link); | 5213 | ata_force_link_limits(link); |
5204 | 5214 | ||
5205 | link->sata_spd_limit = link->hw_sata_spd_limit; | 5215 | link->sata_spd_limit = link->hw_sata_spd_limit; |
5206 | 5216 | ||
@@ -5783,9 +5793,10 @@ static void ata_port_detach(struct ata_port *ap) | |||
5783 | ata_port_wait_eh(ap); | 5793 | ata_port_wait_eh(ap); |
5784 | 5794 | ||
5785 | /* EH is now guaranteed to see UNLOADING - EH context belongs | 5795 | /* EH is now guaranteed to see UNLOADING - EH context belongs |
5786 | * to us. Disable all existing devices. | 5796 | * to us. Restore SControl and disable all existing devices. |
5787 | */ | 5797 | */ |
5788 | ata_port_for_each_link(link, ap) { | 5798 | __ata_port_for_each_link(link, ap) { |
5799 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); | ||
5789 | ata_link_for_each_dev(dev, link) | 5800 | ata_link_for_each_dev(dev, link) |
5790 | ata_dev_disable(dev); | 5801 | ata_dev_disable(dev); |
5791 | } | 5802 | } |
@@ -5991,6 +6002,9 @@ static int __init ata_parse_force_one(char **cur, | |||
5991 | { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | 6002 | { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, |
5992 | { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, | 6003 | { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, |
5993 | { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, | 6004 | { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, |
6005 | { "nohrst", .lflags = ATA_LFLAG_NO_HRST }, | ||
6006 | { "nosrst", .lflags = ATA_LFLAG_NO_SRST }, | ||
6007 | { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, | ||
5994 | }; | 6008 | }; |
5995 | char *start = *cur, *p = *cur; | 6009 | char *start = *cur, *p = *cur; |
5996 | char *id, *val, *endp; | 6010 | char *id, *val, *endp; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 58bdc538d229..c1db2f234d2e 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2040,7 +2040,7 @@ static void ata_eh_link_report(struct ata_link *link) | |||
2040 | } | 2040 | } |
2041 | 2041 | ||
2042 | if (ehc->i.serror) | 2042 | if (ehc->i.serror) |
2043 | ata_port_printk(ap, KERN_ERR, | 2043 | ata_link_printk(link, KERN_ERR, |
2044 | "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", | 2044 | "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", |
2045 | ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", | 2045 | ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", |
2046 | ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", | 2046 | ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", |
@@ -2171,18 +2171,12 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2171 | } | 2171 | } |
2172 | 2172 | ||
2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, | 2173 | static int ata_eh_followup_srst_needed(struct ata_link *link, |
2174 | int rc, int classify, | 2174 | int rc, const unsigned int *classes) |
2175 | const unsigned int *classes) | ||
2176 | { | 2175 | { |
2177 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) | 2176 | if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) |
2178 | return 0; | 2177 | return 0; |
2179 | if (rc == -EAGAIN) { | 2178 | if (rc == -EAGAIN) |
2180 | if (classify) | 2179 | return 1; |
2181 | return 1; | ||
2182 | rc = 0; | ||
2183 | } | ||
2184 | if (rc != 0) | ||
2185 | return 0; | ||
2186 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) | 2180 | if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) |
2187 | return 1; | 2181 | return 1; |
2188 | return 0; | 2182 | return 0; |
@@ -2210,6 +2204,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2210 | */ | 2204 | */ |
2211 | while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) | 2205 | while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) |
2212 | max_tries++; | 2206 | max_tries++; |
2207 | if (link->flags & ATA_LFLAG_NO_HRST) | ||
2208 | hardreset = NULL; | ||
2209 | if (link->flags & ATA_LFLAG_NO_SRST) | ||
2210 | softreset = NULL; | ||
2213 | 2211 | ||
2214 | now = jiffies; | 2212 | now = jiffies; |
2215 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); | 2213 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); |
@@ -2247,10 +2245,10 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2247 | ehc->i.action &= ~ATA_EH_RESET; | 2245 | ehc->i.action &= ~ATA_EH_RESET; |
2248 | if (hardreset) { | 2246 | if (hardreset) { |
2249 | reset = hardreset; | 2247 | reset = hardreset; |
2250 | ehc->i.action = ATA_EH_HARDRESET; | 2248 | ehc->i.action |= ATA_EH_HARDRESET; |
2251 | } else if (softreset) { | 2249 | } else if (softreset) { |
2252 | reset = softreset; | 2250 | reset = softreset; |
2253 | ehc->i.action = ATA_EH_SOFTRESET; | 2251 | ehc->i.action |= ATA_EH_SOFTRESET; |
2254 | } | 2252 | } |
2255 | 2253 | ||
2256 | if (prereset) { | 2254 | if (prereset) { |
@@ -2305,9 +2303,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2305 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2303 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
2306 | 2304 | ||
2307 | rc = ata_do_reset(link, reset, classes, deadline); | 2305 | rc = ata_do_reset(link, reset, classes, deadline); |
2306 | if (rc && rc != -EAGAIN) | ||
2307 | goto fail; | ||
2308 | 2308 | ||
2309 | if (reset == hardreset && | 2309 | if (reset == hardreset && |
2310 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { | 2310 | ata_eh_followup_srst_needed(link, rc, classes)) { |
2311 | /* okay, let's do follow-up softreset */ | 2311 | /* okay, let's do follow-up softreset */ |
2312 | reset = softreset; | 2312 | reset = softreset; |
2313 | 2313 | ||
@@ -2322,10 +2322,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2322 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2323 | rc = ata_do_reset(link, reset, classes, deadline); | 2323 | rc = ata_do_reset(link, reset, classes, deadline); |
2324 | } | 2324 | } |
2325 | |||
2326 | /* -EAGAIN can happen if we skipped followup SRST */ | ||
2327 | if (rc && rc != -EAGAIN) | ||
2328 | goto fail; | ||
2329 | } else { | 2325 | } else { |
2330 | if (verbose) | 2326 | if (verbose) |
2331 | ata_link_printk(link, KERN_INFO, "no reset method " | 2327 | ata_link_printk(link, KERN_INFO, "no reset method " |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index fbe605711554..eb919c16a03e 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -181,7 +181,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc) | |||
181 | 181 | ||
182 | if (adev != acpi->last) { | 182 | if (adev != acpi->last) { |
183 | pacpi_set_piomode(ap, adev); | 183 | pacpi_set_piomode(ap, adev); |
184 | if (adev->dma_mode) | 184 | if (ata_dma_enabled(adev)) |
185 | pacpi_set_dmamode(ap, adev); | 185 | pacpi_set_dmamode(ap, adev); |
186 | acpi->last = adev; | 186 | acpi->last = adev; |
187 | } | 187 | } |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index d7de7baf58a8..e8a0d99d7356 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -183,7 +183,7 @@ static void atiixp_bmdma_start(struct ata_queued_cmd *qc) | |||
183 | u16 tmp16; | 183 | u16 tmp16; |
184 | 184 | ||
185 | pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); | 185 | pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); |
186 | if (adev->dma_mode >= XFER_UDMA_0) | 186 | if (ata_using_udma(adev)) |
187 | tmp16 |= (1 << dn); | 187 | tmp16 |= (1 << dn); |
188 | else | 188 | else |
189 | tmp16 &= ~(1 << dn); | 189 | tmp16 &= ~(1 << dn); |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 744beebaaf49..0c4b271a9d5a 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -149,10 +149,10 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc) | |||
149 | struct ata_device *prev = ap->private_data; | 149 | struct ata_device *prev = ap->private_data; |
150 | 150 | ||
151 | /* See if the DMA settings could be wrong */ | 151 | /* See if the DMA settings could be wrong */ |
152 | if (adev->dma_mode != 0 && adev != prev && prev != NULL) { | 152 | if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { |
153 | /* Maybe, but do the channels match MWDMA/UDMA ? */ | 153 | /* Maybe, but do the channels match MWDMA/UDMA ? */ |
154 | if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || | 154 | if ((ata_using_udma(adev) && !ata_using_udma(prev)) || |
155 | (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) | 155 | (ata_using_udma(prev) && !ata_using_udma(adev))) |
156 | /* Switch the mode bits */ | 156 | /* Switch the mode bits */ |
157 | cs5530_set_dmamode(ap, adev); | 157 | cs5530_set_dmamode(ap, adev); |
158 | } | 158 | } |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 27843c70eb9d..0221c9a46769 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -606,7 +606,7 @@ static void it821x_display_disk(int n, u8 *buf) | |||
606 | { | 606 | { |
607 | unsigned char id[41]; | 607 | unsigned char id[41]; |
608 | int mode = 0; | 608 | int mode = 0; |
609 | char *mtype; | 609 | char *mtype = ""; |
610 | char mbuf[8]; | 610 | char mbuf[8]; |
611 | char *cbl = "(40 wire cable)"; | 611 | char *cbl = "(40 wire cable)"; |
612 | 612 | ||
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index e678af383d13..df64f2443001 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -198,7 +198,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc) | |||
198 | 198 | ||
199 | if (adev != ap->private_data) { | 199 | if (adev != ap->private_data) { |
200 | oldpiix_set_piomode(ap, adev); | 200 | oldpiix_set_piomode(ap, adev); |
201 | if (adev->dma_mode) | 201 | if (ata_dma_enabled(adev)) |
202 | oldpiix_set_dmamode(ap, adev); | 202 | oldpiix_set_dmamode(ap, adev); |
203 | } | 203 | } |
204 | return ata_sff_qc_issue(qc); | 204 | return ata_sff_qc_issue(qc); |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index cbab397e3db7..0278fd2b8fb1 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -167,10 +167,10 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc) | |||
167 | struct ata_device *prev = ap->private_data; | 167 | struct ata_device *prev = ap->private_data; |
168 | 168 | ||
169 | /* See if the DMA settings could be wrong */ | 169 | /* See if the DMA settings could be wrong */ |
170 | if (adev->dma_mode != 0 && adev != prev && prev != NULL) { | 170 | if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { |
171 | /* Maybe, but do the channels match MWDMA/UDMA ? */ | 171 | /* Maybe, but do the channels match MWDMA/UDMA ? */ |
172 | if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || | 172 | if ((ata_using_udma(adev) && !ata_using_udma(prev)) || |
173 | (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) | 173 | (ata_using_udma(prev) && !ata_using_udma(adev))) |
174 | /* Switch the mode bits */ | 174 | /* Switch the mode bits */ |
175 | sc1200_set_dmamode(ap, adev); | 175 | sc1200_set_dmamode(ap, adev); |
176 | } | 176 | } |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 57d951b11f2d..8fdb2ce73210 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -324,62 +324,26 @@ static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
324 | } | 324 | } |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * via_ata_sff_tf_load - send taskfile registers to host controller | 327 | * via_tf_load - send taskfile registers to host controller |
328 | * @ap: Port to which output is sent | 328 | * @ap: Port to which output is sent |
329 | * @tf: ATA taskfile register set | 329 | * @tf: ATA taskfile register set |
330 | * | 330 | * |
331 | * Outputs ATA taskfile to standard ATA host controller. | 331 | * Outputs ATA taskfile to standard ATA host controller. |
332 | * | 332 | * |
333 | * Note: This is to fix the internal bug of via chipsets, which | 333 | * Note: This is to fix the internal bug of via chipsets, which |
334 | * will reset the device register after changing the IEN bit on | 334 | * will reset the device register after changing the IEN bit on |
335 | * ctl register | 335 | * ctl register |
336 | */ | 336 | */ |
337 | static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | 337 | static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
338 | { | 338 | { |
339 | struct ata_ioports *ioaddr = &ap->ioaddr; | 339 | struct ata_taskfile tmp_tf; |
340 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | ||
341 | |||
342 | if (tf->ctl != ap->last_ctl) { | ||
343 | iowrite8(tf->ctl, ioaddr->ctl_addr); | ||
344 | iowrite8(tf->device, ioaddr->device_addr); | ||
345 | ap->last_ctl = tf->ctl; | ||
346 | ata_wait_idle(ap); | ||
347 | } | ||
348 | |||
349 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | ||
350 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | ||
351 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | ||
352 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | ||
353 | iowrite8(tf->hob_lbam, ioaddr->lbam_addr); | ||
354 | iowrite8(tf->hob_lbah, ioaddr->lbah_addr); | ||
355 | VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", | ||
356 | tf->hob_feature, | ||
357 | tf->hob_nsect, | ||
358 | tf->hob_lbal, | ||
359 | tf->hob_lbam, | ||
360 | tf->hob_lbah); | ||
361 | } | ||
362 | 340 | ||
363 | if (is_addr) { | 341 | if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) { |
364 | iowrite8(tf->feature, ioaddr->feature_addr); | 342 | tmp_tf = *tf; |
365 | iowrite8(tf->nsect, ioaddr->nsect_addr); | 343 | tmp_tf.flags |= ATA_TFLAG_DEVICE; |
366 | iowrite8(tf->lbal, ioaddr->lbal_addr); | 344 | tf = &tmp_tf; |
367 | iowrite8(tf->lbam, ioaddr->lbam_addr); | ||
368 | iowrite8(tf->lbah, ioaddr->lbah_addr); | ||
369 | VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", | ||
370 | tf->feature, | ||
371 | tf->nsect, | ||
372 | tf->lbal, | ||
373 | tf->lbam, | ||
374 | tf->lbah); | ||
375 | } | 345 | } |
376 | 346 | ata_sff_tf_load(ap, tf); | |
377 | if (tf->flags & ATA_TFLAG_DEVICE) { | ||
378 | iowrite8(tf->device, ioaddr->device_addr); | ||
379 | VPRINTK("device 0x%X\n", tf->device); | ||
380 | } | ||
381 | |||
382 | ata_wait_idle(ap); | ||
383 | } | 347 | } |
384 | 348 | ||
385 | static struct scsi_host_template via_sht = { | 349 | static struct scsi_host_template via_sht = { |
@@ -392,13 +356,12 @@ static struct ata_port_operations via_port_ops = { | |||
392 | .set_piomode = via_set_piomode, | 356 | .set_piomode = via_set_piomode, |
393 | .set_dmamode = via_set_dmamode, | 357 | .set_dmamode = via_set_dmamode, |
394 | .prereset = via_pre_reset, | 358 | .prereset = via_pre_reset, |
395 | .sff_tf_load = via_ata_tf_load, | 359 | .sff_tf_load = via_tf_load, |
396 | }; | 360 | }; |
397 | 361 | ||
398 | static struct ata_port_operations via_port_ops_noirq = { | 362 | static struct ata_port_operations via_port_ops_noirq = { |
399 | .inherits = &via_port_ops, | 363 | .inherits = &via_port_ops, |
400 | .sff_data_xfer = ata_sff_data_xfer_noirq, | 364 | .sff_data_xfer = ata_sff_data_xfer_noirq, |
401 | .sff_tf_load = via_ata_tf_load, | ||
402 | }; | 365 | }; |
403 | 366 | ||
404 | /** | 367 | /** |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index ad169ffbc4cb..13c1d2af18ac 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -1134,30 +1134,16 @@ static int mv_qc_defer(struct ata_queued_cmd *qc) | |||
1134 | if (ap->nr_active_links == 0) | 1134 | if (ap->nr_active_links == 0) |
1135 | return 0; | 1135 | return 0; |
1136 | 1136 | ||
1137 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { | 1137 | /* |
1138 | /* | 1138 | * The port is operating in host queuing mode (EDMA) with NCQ |
1139 | * The port is operating in host queuing mode (EDMA). | 1139 | * enabled, allow multiple NCQ commands. EDMA also allows |
1140 | * It can accomodate a new qc if the qc protocol | 1140 | * queueing multiple DMA commands but libata core currently |
1141 | * is compatible with the current host queue mode. | 1141 | * doesn't allow it. |
1142 | */ | 1142 | */ |
1143 | if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { | 1143 | if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && |
1144 | /* | 1144 | (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol)) |
1145 | * The host queue (EDMA) is in NCQ mode. | 1145 | return 0; |
1146 | * If the new qc is also an NCQ command, | 1146 | |
1147 | * then allow the new qc. | ||
1148 | */ | ||
1149 | if (qc->tf.protocol == ATA_PROT_NCQ) | ||
1150 | return 0; | ||
1151 | } else { | ||
1152 | /* | ||
1153 | * The host queue (EDMA) is in non-NCQ, DMA mode. | ||
1154 | * If the new qc is also a non-NCQ, DMA command, | ||
1155 | * then allow the new qc. | ||
1156 | */ | ||
1157 | if (qc->tf.protocol == ATA_PROT_DMA) | ||
1158 | return 0; | ||
1159 | } | ||
1160 | } | ||
1161 | return ATA_DEFER_PORT; | 1147 | return ATA_DEFER_PORT; |
1162 | } | 1148 | } |
1163 | 1149 | ||
@@ -3036,7 +3022,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
3036 | break; | 3022 | break; |
3037 | case chip_soc: | 3023 | case chip_soc: |
3038 | hpriv->ops = &mv_soc_ops; | 3024 | hpriv->ops = &mv_soc_ops; |
3039 | hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; | 3025 | hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE | |
3026 | MV_HP_ERRATA_60X1C0; | ||
3040 | break; | 3027 | break; |
3041 | 3028 | ||
3042 | default: | 3029 | default: |