Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (38 commits)
sata_via: Delay on vt6420 when starting ATAPI DMA write
ata: Detect Delkin Devices compact flash
pata_efar: Enable parallel scanning
pata_atiixp: enable parallel scan
[libata] pata_atiixp: add locking for parallel scanning
[libata] pata_efar: add locking for parallel scanning
libata: Pass host flags into the pci helper
[libata] pata_marvell: CONFIG_AHCI is really CONFIG_SATA_AHCI
libata: Allow pata_legacy to be built on non-ISA but PCI systems
pata_pdc202xx_old: fix UDMA mode for PDC2026x chipsets
pata_pdc202xx_old: fix UDMA mode for Promise UDMA33 cards
[libata] pata_at91: fix backslash-continued string
pata_via: store UDMA masks in via_isa_bridges table
pata_via: fix address setup timings underlocking
pata_serverworks: fix error message
pata_serverworks: fix PIO setup for the second channel
pata_efar: fix secondary port support
pata_cypress: fix PIO timings underclocking
pata_cs5535: use correct values for PIO1 and PIO2 data timings
pata_cmd64x: remove unused definitions
...

+677 -431
+2 -2
drivers/ata/Kconfig
··· 446 446 447 447 config PATA_LEGACY 448 448 tristate "Legacy ISA PATA support (Experimental)" 449 - depends on ISA && EXPERIMENTAL 449 + depends on (ISA || PCI) && EXPERIMENTAL 450 450 help 451 - This option enables support for ISA/VLB bus legacy PATA 451 + This option enables support for ISA/VLB/PCI bus legacy PATA 452 452 ports and allows them to be accessed via the new ATA layer. 453 453 454 454 If unsure, say N.
+213 -22
drivers/ata/ahci.c
··· 93 93 AHCI_CMD_TBL_AR_SZ = AHCI_CMD_TBL_SZ * AHCI_MAX_CMDS, 94 94 AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_AR_SZ + 95 95 AHCI_RX_FIS_SZ, 96 + AHCI_PORT_PRIV_FBS_DMA_SZ = AHCI_CMD_SLOT_SZ + 97 + AHCI_CMD_TBL_AR_SZ + 98 + (AHCI_RX_FIS_SZ * 16), 96 99 AHCI_IRQ_ON_SG = (1 << 31), 97 100 AHCI_CMD_ATAPI = (1 << 5), 98 101 AHCI_CMD_WRITE = (1 << 6), ··· 173 170 PORT_SCR_ERR = 0x30, /* SATA phy register: SError */ 174 171 PORT_SCR_ACT = 0x34, /* SATA phy register: SActive */ 175 172 PORT_SCR_NTF = 0x3c, /* SATA phy register: SNotification */ 173 + PORT_FBS = 0x40, /* FIS-based Switching */ 176 174 177 175 /* PORT_IRQ_{STAT,MASK} bits */ 178 176 PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */ ··· 212 208 PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */ 213 209 PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ 214 210 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ 211 + PORT_CMD_FBSCP = (1 << 22), /* FBS Capable Port */ 215 212 PORT_CMD_PMP = (1 << 17), /* PMP attached */ 216 213 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ 217 214 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ ··· 226 221 PORT_CMD_ICC_ACTIVE = (0x1 << 28), /* Put i/f in active state */ 227 222 PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ 228 223 PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ 224 + 225 + PORT_FBS_DWE_OFFSET = 16, /* FBS device with error offset */ 226 + PORT_FBS_ADO_OFFSET = 12, /* FBS active dev optimization offset */ 227 + PORT_FBS_DEV_OFFSET = 8, /* FBS device to issue offset */ 228 + PORT_FBS_DEV_MASK = (0xf << PORT_FBS_DEV_OFFSET), /* FBS.DEV */ 229 + PORT_FBS_SDE = (1 << 2), /* FBS single device error */ 230 + PORT_FBS_DEC = (1 << 1), /* FBS device error clear */ 231 + PORT_FBS_EN = (1 << 0), /* Enable FBS */ 229 232 230 233 /* hpriv->flags bits */ 231 234 AHCI_HFLAG_NO_NCQ = (1 << 0), ··· 317 304 unsigned int ncq_saw_dmas:1; 318 305 unsigned int ncq_saw_sdb:1; 319 306 u32 intr_mask; /* interrupts to enable */ 307 + bool fbs_supported; /* set iff FBS is supported */ 308 + bool fbs_enabled; /* set iff FBS is enabled */ 309 + int fbs_last_dev; /* save FBS.DEV of last FIS */ 320 310 /* enclosure management info per PM slot */ 321 311 struct ahci_em_priv em_priv[EM_MAX_SLOTS]; 322 312 }; ··· 331 315 static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); 332 316 static int ahci_port_start(struct ata_port *ap); 333 317 static void ahci_port_stop(struct ata_port *ap); 318 + static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc); 334 319 static void ahci_qc_prep(struct ata_queued_cmd *qc); 335 320 static void ahci_freeze(struct ata_port *ap); 336 321 static void ahci_thaw(struct ata_port *ap); 322 + static void ahci_enable_fbs(struct ata_port *ap); 323 + static void ahci_disable_fbs(struct ata_port *ap); 337 324 static void ahci_pmp_attach(struct ata_port *ap); 338 325 static void ahci_pmp_detach(struct ata_port *ap); 339 326 static int ahci_softreset(struct ata_link *link, unsigned int *class, ··· 375 356 static ssize_t ahci_show_port_cmd(struct device *dev, 376 357 struct device_attribute *attr, char *buf); 377 358 378 - DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); 379 - DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); 380 - DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); 381 - DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); 359 + static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); 360 + static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); 361 + static DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); 362 + static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); 382 363 383 364 static struct device_attribute *ahci_shost_attrs[] = { 384 365 &dev_attr_link_power_management_policy, ··· 409 390 static struct ata_port_operations ahci_ops = { 410 391 .inherits = &sata_pmp_port_ops, 411 392 412 - .qc_defer = sata_pmp_qc_defer_cmd_switch, 393 + .qc_defer = ahci_pmp_qc_defer, 413 394 .qc_prep = ahci_qc_prep, 414 395 .qc_issue = ahci_qc_issue, 415 396 .qc_fill_rtf = ahci_qc_fill_rtf, ··· 589 570 { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ 590 571 { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ 591 572 { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ 573 + { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ 574 + { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ 575 + { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ 576 + { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */ 577 + { PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */ 578 + { PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */ 592 579 593 580 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 594 581 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, ··· 2070 2045 return si; 2071 2046 } 2072 2047 2048 + static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc) 2049 + { 2050 + struct ata_port *ap = qc->ap; 2051 + struct ahci_port_priv *pp = ap->private_data; 2052 + 2053 + if (!sata_pmp_attached(ap) || pp->fbs_enabled) 2054 + return ata_std_qc_defer(qc); 2055 + else 2056 + return sata_pmp_qc_defer_cmd_switch(qc); 2057 + } 2058 + 2073 2059 static void ahci_qc_prep(struct ata_queued_cmd *qc) 2074 2060 { 2075 2061 struct ata_port *ap = qc->ap; ··· 2119 2083 ahci_fill_cmd_slot(pp, qc->tag, opts); 2120 2084 } 2121 2085 2086 + static void ahci_fbs_dec_intr(struct ata_port *ap) 2087 + { 2088 + struct ahci_port_priv *pp = ap->private_data; 2089 + void __iomem *port_mmio = ahci_port_base(ap); 2090 + u32 fbs = readl(port_mmio + PORT_FBS); 2091 + int retries = 3; 2092 + 2093 + DPRINTK("ENTER\n"); 2094 + BUG_ON(!pp->fbs_enabled); 2095 + 2096 + /* time to wait for DEC is not specified by AHCI spec, 2097 + * add a retry loop for safety. 2098 + */ 2099 + writel(fbs | PORT_FBS_DEC, port_mmio + PORT_FBS); 2100 + fbs = readl(port_mmio + PORT_FBS); 2101 + while ((fbs & PORT_FBS_DEC) && retries--) { 2102 + udelay(1); 2103 + fbs = readl(port_mmio + PORT_FBS); 2104 + } 2105 + 2106 + if (fbs & PORT_FBS_DEC) 2107 + dev_printk(KERN_ERR, ap->host->dev, 2108 + "failed to clear device error\n"); 2109 + } 2110 + 2122 2111 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) 2123 2112 { 2124 2113 struct ahci_host_priv *hpriv = ap->host->private_data; ··· 2152 2091 struct ata_link *link = NULL; 2153 2092 struct ata_queued_cmd *active_qc; 2154 2093 struct ata_eh_info *active_ehi; 2094 + bool fbs_need_dec = false; 2155 2095 u32 serror; 2156 2096 2157 - /* determine active link */ 2158 - ata_for_each_link(link, ap, EDGE) 2159 - if (ata_link_active(link)) 2160 - break; 2097 + /* determine active link with error */ 2098 + if (pp->fbs_enabled) { 2099 + void __iomem *port_mmio = ahci_port_base(ap); 2100 + u32 fbs = readl(port_mmio + PORT_FBS); 2101 + int pmp = fbs >> PORT_FBS_DWE_OFFSET; 2102 + 2103 + if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) && 2104 + ata_link_online(&ap->pmp_link[pmp])) { 2105 + link = &ap->pmp_link[pmp]; 2106 + fbs_need_dec = true; 2107 + } 2108 + 2109 + } else 2110 + ata_for_each_link(link, ap, EDGE) 2111 + if (ata_link_active(link)) 2112 + break; 2113 + 2161 2114 if (!link) 2162 2115 link = &ap->link; 2163 2116 ··· 2228 2153 } 2229 2154 2230 2155 if (irq_stat & PORT_IRQ_IF_ERR) { 2231 - host_ehi->err_mask |= AC_ERR_ATA_BUS; 2232 - host_ehi->action |= ATA_EH_RESET; 2156 + if (fbs_need_dec) 2157 + active_ehi->err_mask |= AC_ERR_DEV; 2158 + else { 2159 + host_ehi->err_mask |= AC_ERR_ATA_BUS; 2160 + host_ehi->action |= ATA_EH_RESET; 2161 + } 2162 + 2233 2163 ata_ehi_push_desc(host_ehi, "interface fatal error"); 2234 2164 } 2235 2165 ··· 2249 2169 2250 2170 if (irq_stat & PORT_IRQ_FREEZE) 2251 2171 ata_port_freeze(ap); 2252 - else 2172 + else if (fbs_need_dec) { 2173 + ata_link_abort(link); 2174 + ahci_fbs_dec_intr(ap); 2175 + } else 2253 2176 ata_port_abort(ap); 2254 2177 } 2255 2178 ··· 2305 2222 /* If the 'N' bit in word 0 of the FIS is set, 2306 2223 * we just received asynchronous notification. 2307 2224 * Tell libata about it. 2225 + * 2226 + * Lack of SNotification should not appear in 2227 + * ahci 1.2, so the workaround is unnecessary 2228 + * when FBS is enabled. 2308 2229 */ 2309 - const __le32 *f = pp->rx_fis + RX_FIS_SDB; 2310 - u32 f0 = le32_to_cpu(f[0]); 2311 - 2312 - if (f0 & (1 << 15)) 2313 - sata_async_notification(ap); 2230 + if (pp->fbs_enabled) 2231 + WARN_ON_ONCE(1); 2232 + else { 2233 + const __le32 *f = pp->rx_fis + RX_FIS_SDB; 2234 + u32 f0 = le32_to_cpu(f[0]); 2235 + if (f0 & (1 << 15)) 2236 + sata_async_notification(ap); 2237 + } 2314 2238 } 2315 2239 } 2316 2240 ··· 2411 2321 2412 2322 if (qc->tf.protocol == ATA_PROT_NCQ) 2413 2323 writel(1 << qc->tag, port_mmio + PORT_SCR_ACT); 2324 + 2325 + if (pp->fbs_enabled && pp->fbs_last_dev != qc->dev->link->pmp) { 2326 + u32 fbs = readl(port_mmio + PORT_FBS); 2327 + fbs &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC); 2328 + fbs |= qc->dev->link->pmp << PORT_FBS_DEV_OFFSET; 2329 + writel(fbs, port_mmio + PORT_FBS); 2330 + pp->fbs_last_dev = qc->dev->link->pmp; 2331 + } 2332 + 2414 2333 writel(1 << qc->tag, port_mmio + PORT_CMD_ISSUE); 2415 2334 2416 2335 ahci_sw_activity(qc->dev->link); ··· 2431 2332 { 2432 2333 struct ahci_port_priv *pp = qc->ap->private_data; 2433 2334 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 2335 + 2336 + if (pp->fbs_enabled) 2337 + d2h_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; 2434 2338 2435 2339 ata_tf_from_fis(d2h_fis, &qc->result_tf); 2436 2340 return true; ··· 2483 2381 ahci_kick_engine(ap); 2484 2382 } 2485 2383 2384 + static void ahci_enable_fbs(struct ata_port *ap) 2385 + { 2386 + struct ahci_port_priv *pp = ap->private_data; 2387 + void __iomem *port_mmio = ahci_port_base(ap); 2388 + u32 fbs; 2389 + int rc; 2390 + 2391 + if (!pp->fbs_supported) 2392 + return; 2393 + 2394 + fbs = readl(port_mmio + PORT_FBS); 2395 + if (fbs & PORT_FBS_EN) { 2396 + pp->fbs_enabled = true; 2397 + pp->fbs_last_dev = -1; /* initialization */ 2398 + return; 2399 + } 2400 + 2401 + rc = ahci_stop_engine(ap); 2402 + if (rc) 2403 + return; 2404 + 2405 + writel(fbs | PORT_FBS_EN, port_mmio + PORT_FBS); 2406 + fbs = readl(port_mmio + PORT_FBS); 2407 + if (fbs & PORT_FBS_EN) { 2408 + dev_printk(KERN_INFO, ap->host->dev, "FBS is enabled.\n"); 2409 + pp->fbs_enabled = true; 2410 + pp->fbs_last_dev = -1; /* initialization */ 2411 + } else 2412 + dev_printk(KERN_ERR, ap->host->dev, "Failed to enable FBS\n"); 2413 + 2414 + ahci_start_engine(ap); 2415 + } 2416 + 2417 + static void ahci_disable_fbs(struct ata_port *ap) 2418 + { 2419 + struct ahci_port_priv *pp = ap->private_data; 2420 + void __iomem *port_mmio = ahci_port_base(ap); 2421 + u32 fbs; 2422 + int rc; 2423 + 2424 + if (!pp->fbs_supported) 2425 + return; 2426 + 2427 + fbs = readl(port_mmio + PORT_FBS); 2428 + if ((fbs & PORT_FBS_EN) == 0) { 2429 + pp->fbs_enabled = false; 2430 + return; 2431 + } 2432 + 2433 + rc = ahci_stop_engine(ap); 2434 + if (rc) 2435 + return; 2436 + 2437 + writel(fbs & ~PORT_FBS_EN, port_mmio + PORT_FBS); 2438 + fbs = readl(port_mmio + PORT_FBS); 2439 + if (fbs & PORT_FBS_EN) 2440 + dev_printk(KERN_ERR, ap->host->dev, "Failed to disable FBS\n"); 2441 + else { 2442 + dev_printk(KERN_INFO, ap->host->dev, "FBS is disabled.\n"); 2443 + pp->fbs_enabled = false; 2444 + } 2445 + 2446 + ahci_start_engine(ap); 2447 + } 2448 + 2486 2449 static void ahci_pmp_attach(struct ata_port *ap) 2487 2450 { 2488 2451 void __iomem *port_mmio = ahci_port_base(ap); ··· 2558 2391 cmd |= PORT_CMD_PMP; 2559 2392 writel(cmd, port_mmio + PORT_CMD); 2560 2393 2394 + ahci_enable_fbs(ap); 2395 + 2561 2396 pp->intr_mask |= PORT_IRQ_BAD_PMP; 2562 2397 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 2563 2398 } ··· 2569 2400 void __iomem *port_mmio = ahci_port_base(ap); 2570 2401 struct ahci_port_priv *pp = ap->private_data; 2571 2402 u32 cmd; 2403 + 2404 + ahci_disable_fbs(ap); 2572 2405 2573 2406 cmd = readl(port_mmio + PORT_CMD); 2574 2407 cmd &= ~PORT_CMD_PMP; ··· 2663 2492 2664 2493 static int ahci_port_start(struct ata_port *ap) 2665 2494 { 2495 + struct ahci_host_priv *hpriv = ap->host->private_data; 2666 2496 struct device *dev = ap->host->dev; 2667 2497 struct ahci_port_priv *pp; 2668 2498 void *mem; 2669 2499 dma_addr_t mem_dma; 2500 + size_t dma_sz, rx_fis_sz; 2670 2501 2671 2502 pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); 2672 2503 if (!pp) 2673 2504 return -ENOMEM; 2674 2505 2675 - mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, 2676 - GFP_KERNEL); 2506 + /* check FBS capability */ 2507 + if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { 2508 + void __iomem *port_mmio = ahci_port_base(ap); 2509 + u32 cmd = readl(port_mmio + PORT_CMD); 2510 + if (cmd & PORT_CMD_FBSCP) 2511 + pp->fbs_supported = true; 2512 + else 2513 + dev_printk(KERN_WARNING, dev, 2514 + "The port is not capable of FBS\n"); 2515 + } 2516 + 2517 + if (pp->fbs_supported) { 2518 + dma_sz = AHCI_PORT_PRIV_FBS_DMA_SZ; 2519 + rx_fis_sz = AHCI_RX_FIS_SZ * 16; 2520 + } else { 2521 + dma_sz = AHCI_PORT_PRIV_DMA_SZ; 2522 + rx_fis_sz = AHCI_RX_FIS_SZ; 2523 + } 2524 + 2525 + mem = dmam_alloc_coherent(dev, dma_sz, &mem_dma, GFP_KERNEL); 2677 2526 if (!mem) 2678 2527 return -ENOMEM; 2679 - memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); 2528 + memset(mem, 0, dma_sz); 2680 2529 2681 2530 /* 2682 2531 * First item in chunk of DMA memory: 32-slot command table, ··· 2714 2523 pp->rx_fis = mem; 2715 2524 pp->rx_fis_dma = mem_dma; 2716 2525 2717 - mem += AHCI_RX_FIS_SZ; 2718 - mem_dma += AHCI_RX_FIS_SZ; 2526 + mem += rx_fis_sz; 2527 + mem_dma += rx_fis_sz; 2719 2528 2720 2529 /* 2721 2530 * Third item: data area for storing a single command
+1 -1
drivers/ata/ata_generic.c
··· 155 155 return rc; 156 156 pcim_pin_device(dev); 157 157 } 158 - return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL); 158 + return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL, 0); 159 159 } 160 160 161 161 static struct pci_device_id ata_generic[] = {
+23 -5
drivers/ata/ata_piix.c
··· 173 173 unsigned int reg, u32 *val); 174 174 static int piix_sidpr_scr_write(struct ata_link *link, 175 175 unsigned int reg, u32 val); 176 + static bool piix_irq_check(struct ata_port *ap); 176 177 #ifdef CONFIG_PM 177 178 static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 178 179 static int piix_pci_device_resume(struct pci_dev *pdev); ··· 292 291 { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 293 292 /* SATA Controller IDE (PCH) */ 294 293 { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 294 + /* SATA Controller IDE (CPT) */ 295 + { 0x8086, 0x1c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 296 + /* SATA Controller IDE (CPT) */ 297 + { 0x8086, 0x1c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 298 + /* SATA Controller IDE (CPT) */ 299 + { 0x8086, 0x1c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 300 + /* SATA Controller IDE (CPT) */ 301 + { 0x8086, 0x1c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 295 302 { } /* terminate list */ 296 303 }; 297 304 ··· 318 309 ATA_BMDMA_SHT(DRV_NAME), 319 310 }; 320 311 321 - static struct ata_port_operations piix_pata_ops = { 312 + static struct ata_port_operations piix_sata_ops = { 322 313 .inherits = &ata_bmdma32_port_ops, 314 + .sff_irq_check = piix_irq_check, 315 + }; 316 + 317 + static struct ata_port_operations piix_pata_ops = { 318 + .inherits = &piix_sata_ops, 323 319 .cable_detect = ata_cable_40wire, 324 320 .set_piomode = piix_set_piomode, 325 321 .set_dmamode = piix_set_dmamode, ··· 340 326 .inherits = &piix_pata_ops, 341 327 .cable_detect = ich_pata_cable_detect, 342 328 .set_dmamode = ich_set_dmamode, 343 - }; 344 - 345 - static struct ata_port_operations piix_sata_ops = { 346 - .inherits = &ata_bmdma32_port_ops, 347 329 }; 348 330 349 331 static struct ata_port_operations piix_sidpr_sata_ops = { ··· 970 960 piix_sidpr_sel(link, reg); 971 961 iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA); 972 962 return 0; 963 + } 964 + 965 + static bool piix_irq_check(struct ata_port *ap) 966 + { 967 + if (unlikely(!ap->ioaddr.bmdma_addr)) 968 + return false; 969 + 970 + return ap->ops->bmdma_status(ap) & ATA_DMA_INTR; 973 971 } 974 972 975 973 #ifdef CONFIG_PM
+11 -6
drivers/ata/libata-core.c
··· 3211 3211 int ata_timing_compute(struct ata_device *adev, unsigned short speed, 3212 3212 struct ata_timing *t, int T, int UT) 3213 3213 { 3214 + const u16 *id = adev->id; 3214 3215 const struct ata_timing *s; 3215 3216 struct ata_timing p; 3216 3217 ··· 3229 3228 * PIO/MW_DMA cycle timing. 3230 3229 */ 3231 3230 3232 - if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ 3231 + if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ 3233 3232 memset(&p, 0, sizeof(p)); 3233 + 3234 3234 if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) { 3235 - if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO]; 3236 - else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY]; 3237 - } else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) { 3238 - p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN]; 3239 - } 3235 + if (speed <= XFER_PIO_2) 3236 + p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO]; 3237 + else if ((speed <= XFER_PIO_4) || 3238 + (speed == XFER_PIO_5 && !ata_id_is_cfa(id))) 3239 + p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY]; 3240 + } else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) 3241 + p.cycle = id[ATA_ID_EIDE_DMA_MIN]; 3242 + 3240 3243 ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B); 3241 3244 } 3242 3245
+39 -11
drivers/ata/libata-sff.c
··· 1763 1763 { 1764 1764 struct ata_host *host = dev_instance; 1765 1765 unsigned int i; 1766 - unsigned int handled = 0; 1766 + unsigned int handled = 0, polling = 0; 1767 1767 unsigned long flags; 1768 1768 1769 1769 /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ 1770 1770 spin_lock_irqsave(&host->lock, flags); 1771 1771 1772 1772 for (i = 0; i < host->n_ports; i++) { 1773 - struct ata_port *ap; 1773 + struct ata_port *ap = host->ports[i]; 1774 + struct ata_queued_cmd *qc; 1774 1775 1775 - ap = host->ports[i]; 1776 - if (ap && 1777 - !(ap->flags & ATA_FLAG_DISABLED)) { 1778 - struct ata_queued_cmd *qc; 1776 + if (unlikely(ap->flags & ATA_FLAG_DISABLED)) 1777 + continue; 1779 1778 1780 - qc = ata_qc_from_tag(ap, ap->link.active_tag); 1781 - if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && 1782 - (qc->flags & ATA_QCFLAG_ACTIVE)) 1779 + qc = ata_qc_from_tag(ap, ap->link.active_tag); 1780 + if (qc) { 1781 + if (!(qc->tf.flags & ATA_TFLAG_POLLING)) 1783 1782 handled |= ata_sff_host_intr(ap, qc); 1783 + else 1784 + polling |= 1 << i; 1785 + } 1786 + } 1787 + 1788 + /* 1789 + * If no port was expecting IRQ but the controller is actually 1790 + * asserting IRQ line, nobody cared will ensue. Check IRQ 1791 + * pending status if available and clear spurious IRQ. 1792 + */ 1793 + if (!handled) { 1794 + for (i = 0; i < host->n_ports; i++) { 1795 + struct ata_port *ap = host->ports[i]; 1796 + 1797 + if (polling & (1 << i)) 1798 + continue; 1799 + 1800 + if (!ap->ops->sff_irq_check || 1801 + !ap->ops->sff_irq_check(ap)) 1802 + continue; 1803 + 1804 + if (printk_ratelimit()) 1805 + ata_port_printk(ap, KERN_INFO, 1806 + "clearing spurious IRQ\n"); 1807 + 1808 + ap->ops->sff_check_status(ap); 1809 + ap->ops->sff_irq_clear(ap); 1784 1810 } 1785 1811 } 1786 1812 ··· 3037 3011 * @ppi: array of port_info, must be enough for two ports 3038 3012 * @sht: scsi_host_template to use when registering the host 3039 3013 * @host_priv: host private_data 3014 + * @hflag: host flags 3040 3015 * 3041 3016 * This is a helper function which can be called from a driver's 3042 3017 * xxx_init_one() probe function if the hardware uses traditional ··· 3058 3031 * Zero on success, negative on errno-based value on error. 3059 3032 */ 3060 3033 int ata_pci_sff_init_one(struct pci_dev *pdev, 3061 - const struct ata_port_info * const *ppi, 3062 - struct scsi_host_template *sht, void *host_priv) 3034 + const struct ata_port_info * const *ppi, 3035 + struct scsi_host_template *sht, void *host_priv, int hflag) 3063 3036 { 3064 3037 struct device *dev = &pdev->dev; 3065 3038 const struct ata_port_info *pi = NULL; ··· 3094 3067 if (rc) 3095 3068 goto out; 3096 3069 host->private_data = host_priv; 3070 + host->flags |= hflag; 3097 3071 3098 3072 pci_set_master(pdev); 3099 3073 rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
+1 -1
drivers/ata/pata_acpi.c
··· 259 259 return rc; 260 260 pcim_pin_device(pdev); 261 261 } 262 - return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL); 262 + return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL, 0); 263 263 } 264 264 265 265 static const struct pci_device_id pacpi_pci_tbl[] = {
+4 -6
drivers/ata/pata_ali.c
··· 159 159 * ali_program_modes - load mode registers 160 160 * @ap: ALi channel to load 161 161 * @adev: Device the timing is for 162 - * @cmd: Command timing 163 - * @data: Data timing 162 + * @t: timing data 164 163 * @ultra: UDMA timing or zero for off 165 164 * 166 165 * Loads the timing registers for cmd/data and disable UDMA if ··· 201 202 * @ap: ATA interface 202 203 * @adev: ATA device 203 204 * 204 - * Program the ALi registers for PIO mode. FIXME: add timings for 205 - * PIO5. 205 + * Program the ALi registers for PIO mode. 206 206 */ 207 207 208 208 static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev) ··· 235 237 * @ap: ATA interface 236 238 * @adev: ATA device 237 239 * 238 - * FIXME: MWDMA timings 240 + * Program the ALi registers for DMA mode. 239 241 */ 240 242 241 243 static void ali_set_dmamode(struct ata_port *ap, struct ata_device *adev) ··· 583 585 ppi[0] = &info_20_udma; 584 586 } 585 587 586 - return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL); 588 + return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL, 0); 587 589 } 588 590 589 591 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_amd.c
··· 574 574 } 575 575 576 576 /* And fire it up */ 577 - return ata_pci_sff_init_one(pdev, ppi, &amd_sht, hpriv); 577 + return ata_pci_sff_init_one(pdev, ppi, &amd_sht, hpriv, 0); 578 578 } 579 579 580 580 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_artop.c
··· 421 421 422 422 BUG_ON(ppi[0] == NULL); 423 423 424 - return ata_pci_sff_init_one(pdev, ppi, &artop_sht, NULL); 424 + return ata_pci_sff_init_one(pdev, ppi, &artop_sht, NULL, 0); 425 425 } 426 426 427 427 static const struct pci_device_id artop_pci_tbl[] = {
+2 -2
drivers/ata/pata_at91.c
··· 153 153 /* Compute ATA timing and set it to SMC */ 154 154 ret = ata_timing_compute(adev, adev->pio_mode, &timing, 1000, 0); 155 155 if (ret) { 156 - dev_warn(ap->dev, "Failed to compute ATA timing %d, \ 157 - set PIO_0 timing\n", ret); 156 + dev_warn(ap->dev, "Failed to compute ATA timing %d, " 157 + "set PIO_0 timing\n", ret); 158 158 set_smc_timing(ap->dev, info, &initial_timing); 159 159 } else { 160 160 set_smc_timing(ap->dev, info, &timing);
+12 -2
drivers/ata/pata_atiixp.c
··· 1 1 /* 2 2 * pata_atiixp.c - ATI PATA for new ATA layer 3 3 * (C) 2005 Red Hat Inc 4 - * (C) 2009 Bartlomiej Zolnierkiewicz 4 + * (C) 2009-2010 Bartlomiej Zolnierkiewicz 5 5 * 6 6 * Based on 7 7 * ··· 46 46 return ATA_CBL_PATA40; 47 47 } 48 48 49 + static DEFINE_SPINLOCK(atiixp_lock); 50 + 49 51 /** 50 52 * atiixp_set_pio_timing - set initial PIO mode data 51 53 * @ap: ATA interface ··· 90 88 91 89 static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev) 92 90 { 91 + unsigned long flags; 92 + spin_lock_irqsave(&atiixp_lock, flags); 93 93 atiixp_set_pio_timing(ap, adev, adev->pio_mode - XFER_PIO_0); 94 + spin_unlock_irqrestore(&atiixp_lock, flags); 94 95 } 95 96 96 97 /** ··· 113 108 int dma = adev->dma_mode; 114 109 int dn = 2 * ap->port_no + adev->devno; 115 110 int wanted_pio; 111 + unsigned long flags; 112 + 113 + spin_lock_irqsave(&atiixp_lock, flags); 116 114 117 115 if (adev->dma_mode >= XFER_UDMA_0) { 118 116 u16 udma_mode_data; ··· 153 145 154 146 if (adev->pio_mode != wanted_pio) 155 147 atiixp_set_pio_timing(ap, adev, wanted_pio); 148 + spin_unlock_irqrestore(&atiixp_lock, flags); 156 149 } 157 150 158 151 /** ··· 246 237 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) 247 238 ppi[i] = &ata_dummy_port_info; 248 239 249 - return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL); 240 + return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL, 241 + ATA_HOST_PARALLEL_SCAN); 250 242 } 251 243 252 244 static const struct pci_device_id atiixp[] = {
+1 -1
drivers/ata/pata_cmd640.c
··· 223 223 224 224 cmd640_hardware_init(pdev); 225 225 226 - return ata_pci_sff_init_one(pdev, ppi, &cmd640_sht, NULL); 226 + return ata_pci_sff_init_one(pdev, ppi, &cmd640_sht, NULL, 0); 227 227 } 228 228 229 229 #ifdef CONFIG_PM
+13 -14
drivers/ata/pata_cmd64x.c
··· 2 2 * pata_cmd64x.c - CMD64x PATA for new ATA layer 3 3 * (C) 2005 Red Hat Inc 4 4 * Alan Cox <alan@lxorguk.ukuu.org.uk> 5 + * (C) 2009-2010 Bartlomiej Zolnierkiewicz 5 6 * 6 7 * Based upon 7 8 * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 ··· 40 39 41 40 enum { 42 41 CFR = 0x50, 43 - CFR_INTR_CH0 = 0x02, 44 - CNTRL = 0x51, 45 - CNTRL_DIS_RA0 = 0x40, 46 - CNTRL_DIS_RA1 = 0x80, 47 - CNTRL_ENA_2ND = 0x08, 42 + CFR_INTR_CH0 = 0x04, 48 43 CMDTIM = 0x52, 49 44 ARTTIM0 = 0x53, 50 45 DRWTIM0 = 0x54, ··· 50 53 ARTTIM23_DIS_RA2 = 0x04, 51 54 ARTTIM23_DIS_RA3 = 0x08, 52 55 ARTTIM23_INTR_CH1 = 0x10, 53 - ARTTIM2 = 0x57, 54 - ARTTIM3 = 0x57, 55 - DRWTIM23 = 0x58, 56 56 DRWTIM2 = 0x58, 57 57 BRST = 0x59, 58 58 DRWTIM3 = 0x5b, ··· 57 63 MRDMODE = 0x71, 58 64 MRDMODE_INTR_CH0 = 0x04, 59 65 MRDMODE_INTR_CH1 = 0x08, 60 - MRDMODE_BLK_CH0 = 0x10, 61 - MRDMODE_BLK_CH1 = 0x20, 62 66 BMIDESR0 = 0x72, 63 67 UDIDETCR0 = 0x73, 64 68 DTPR0 = 0x74, 65 69 BMIDECR1 = 0x78, 66 70 BMIDECSR = 0x79, 67 - BMIDESR1 = 0x7A, 68 71 UDIDETCR1 = 0x7B, 69 72 DTPR1 = 0x7C 70 73 }; ··· 121 130 122 131 if (pair) { 123 132 struct ata_timing tp; 133 + 124 134 ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); 125 135 ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); 136 + if (pair->dma_mode) { 137 + ata_timing_compute(pair, pair->dma_mode, 138 + &tp, T, 0); 139 + ata_timing_merge(&tp, &t, &t, ATA_TIMING_SETUP); 140 + } 126 141 } 127 142 } 128 143 ··· 144 147 /* Now convert the clocks into values we can actually stuff into 145 148 the chip */ 146 149 147 - if (t.recover > 1) 150 + if (t.recover == 16) 151 + t.recover = 0; 152 + else if (t.recover > 1) 148 153 t.recover--; 149 154 else 150 155 t.recover = 15; ··· 244 245 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 245 246 u8 dma_intr; 246 247 int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; 247 - int dma_reg = ap->port_no ? ARTTIM2 : CFR; 248 + int dma_reg = ap->port_no ? ARTTIM23 : CFR; 248 249 249 250 ata_bmdma_stop(qc); 250 251 ··· 367 368 pci_write_config_byte(pdev, UDIDETCR0, 0xF0); 368 369 #endif 369 370 370 - return ata_pci_sff_init_one(pdev, ppi, &cmd64x_sht, NULL); 371 + return ata_pci_sff_init_one(pdev, ppi, &cmd64x_sht, NULL, 0); 371 372 } 372 373 373 374 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_cs5530.c
··· 324 324 ppi[1] = &info_palmax_secondary; 325 325 326 326 /* Now kick off ATA set up */ 327 - return ata_pci_sff_init_one(pdev, ppi, &cs5530_sht, NULL); 327 + return ata_pci_sff_init_one(pdev, ppi, &cs5530_sht, NULL, 0); 328 328 } 329 329 330 330 #ifdef CONFIG_PM
+2 -2
drivers/ata/pata_cs5535.c
··· 100 100 static void cs5535_set_piomode(struct ata_port *ap, struct ata_device *adev) 101 101 { 102 102 static const u16 pio_timings[5] = { 103 - 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 103 + 0xF7F4, 0xF173, 0x8141, 0x5131, 0x1131 104 104 }; 105 105 static const u16 pio_cmd_timings[5] = { 106 106 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 ··· 198 198 rdmsr(ATAC_CH0D1_PIO, timings, dummy); 199 199 if (CS5535_BAD_PIO(timings)) 200 200 wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); 201 - return ata_pci_sff_init_one(dev, ppi, &cs5535_sht, NULL); 201 + return ata_pci_sff_init_one(dev, ppi, &cs5535_sht, NULL, 0); 202 202 } 203 203 204 204 static const struct pci_device_id cs5535[] = {
+1 -1
drivers/ata/pata_cs5536.c
··· 260 260 return -ENODEV; 261 261 } 262 262 263 - return ata_pci_sff_init_one(dev, ppi, &cs5536_sht, NULL); 263 + return ata_pci_sff_init_one(dev, ppi, &cs5536_sht, NULL, 0); 264 264 } 265 265 266 266 static const struct pci_device_id cs5536[] = {
+7 -5
drivers/ata/pata_cypress.c
··· 62 62 return; 63 63 } 64 64 65 - time_16 = clamp_val(t.recover, 0, 15) | (clamp_val(t.active, 0, 15) << 4); 66 - time_8 = clamp_val(t.act8b, 0, 15) | (clamp_val(t.rec8b, 0, 15) << 4); 65 + time_16 = clamp_val(t.recover - 1, 0, 15) | 66 + (clamp_val(t.active - 1, 0, 15) << 4); 67 + time_8 = clamp_val(t.act8b - 1, 0, 15) | 68 + (clamp_val(t.rec8b - 1, 0, 15) << 4); 67 69 68 70 if (adev->devno == 0) { 69 71 pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); 70 72 71 73 addr &= ~0x0F; /* Mask bits */ 72 - addr |= clamp_val(t.setup, 0, 15); 74 + addr |= clamp_val(t.setup - 1, 0, 15); 73 75 74 76 pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); 75 77 pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); ··· 81 79 pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); 82 80 83 81 addr &= ~0xF0; /* Mask bits */ 84 - addr |= (clamp_val(t.setup, 0, 15) << 4); 82 + addr |= (clamp_val(t.setup - 1, 0, 15) << 4); 85 83 86 84 pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); 87 85 pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); ··· 138 136 if (PCI_FUNC(pdev->devfn) != 1) 139 137 return -ENODEV; 140 138 141 - return ata_pci_sff_init_one(pdev, ppi, &cy82c693_sht, NULL); 139 + return ata_pci_sff_init_one(pdev, ppi, &cy82c693_sht, NULL, 0); 142 140 } 143 141 144 142 static const struct pci_device_id cy82c693[] = {
+19 -3
drivers/ata/pata_efar.c
··· 2 2 * pata_efar.c - EFAR PIIX clone controller driver 3 3 * 4 4 * (C) 2005 Red Hat 5 - * (C) 2009 Bartlomiej Zolnierkiewicz 5 + * (C) 2009-2010 Bartlomiej Zolnierkiewicz 6 6 * 7 7 * Some parts based on ata_piix.c by Jeff Garzik and others. 8 8 * ··· 68 68 return ATA_CBL_PATA80; 69 69 } 70 70 71 + static DEFINE_SPINLOCK(efar_lock); 72 + 71 73 /** 72 74 * efar_set_piomode - Initialize host controller PATA PIO timings 73 75 * @ap: Port whose timings we are configuring ··· 86 84 unsigned int pio = adev->pio_mode - XFER_PIO_0; 87 85 struct pci_dev *dev = to_pci_dev(ap->host->dev); 88 86 unsigned int idetm_port= ap->port_no ? 0x42 : 0x40; 87 + unsigned long flags; 89 88 u16 idetm_data; 89 + u8 udma_enable; 90 90 int control = 0; 91 91 92 92 /* ··· 110 106 /* Intel specifies that the prefetch/posting is for disk only */ 111 107 if (adev->class == ATA_DEV_ATA) 112 108 control |= 4; /* PPE */ 109 + 110 + spin_lock_irqsave(&efar_lock, flags); 113 111 114 112 pci_read_config_word(dev, idetm_port, &idetm_data); 115 113 ··· 137 131 138 132 idetm_data |= 0x4000; /* Ensure SITRE is set */ 139 133 pci_write_config_word(dev, idetm_port, idetm_data); 134 + 135 + pci_read_config_byte(dev, 0x48, &udma_enable); 136 + udma_enable &= ~(1 << (2 * ap->port_no + adev->devno)); 137 + pci_write_config_byte(dev, 0x48, udma_enable); 138 + spin_unlock_irqrestore(&efar_lock, flags); 140 139 } 141 140 142 141 /** ··· 162 151 u16 master_data; 163 152 u8 speed = adev->dma_mode; 164 153 int devid = adev->devno + 2 * ap->port_no; 154 + unsigned long flags; 165 155 u8 udma_enable; 166 156 167 157 static const /* ISP RTC */ ··· 171 159 { 1, 0 }, 172 160 { 2, 1 }, 173 161 { 2, 3 }, }; 162 + 163 + spin_lock_irqsave(&efar_lock, flags); 174 164 175 165 pci_read_config_word(dev, master_port, &master_data); 176 166 pci_read_config_byte(dev, 0x48, &udma_enable); ··· 231 217 pci_write_config_word(dev, master_port, master_data); 232 218 } 233 219 pci_write_config_byte(dev, 0x48, udma_enable); 220 + spin_unlock_irqrestore(&efar_lock, flags); 234 221 } 235 222 236 223 static struct scsi_host_template efar_sht = { ··· 271 256 .udma_mask = ATA_UDMA4, 272 257 .port_ops = &efar_ops, 273 258 }; 274 - const struct ata_port_info *ppi[] = { &info, NULL }; 259 + const struct ata_port_info *ppi[] = { &info, &info }; 275 260 276 261 if (!printed_version++) 277 262 dev_printk(KERN_DEBUG, &pdev->dev, 278 263 "version " DRV_VERSION "\n"); 279 264 280 - return ata_pci_sff_init_one(pdev, ppi, &efar_sht, NULL); 265 + return ata_pci_sff_init_one(pdev, ppi, &efar_sht, NULL, 266 + ATA_HOST_PARALLEL_SCAN); 281 267 } 282 268 283 269 static const struct pci_device_id efar_pci_tbl[] = {
+6 -17
drivers/ata/pata_hpt366.c
··· 11 11 * 12 12 * 13 13 * TODO 14 - * Maybe PLL mode 15 - * Look into engine reset on timeout errors. Should not be 16 - * required. 14 + * Look into engine reset on timeout errors. Should not be required. 17 15 */ 18 16 19 17 ··· 25 27 #include <linux/libata.h> 26 28 27 29 #define DRV_NAME "pata_hpt366" 28 - #define DRV_VERSION "0.6.7" 30 + #define DRV_VERSION "0.6.8" 29 31 30 32 struct hpt_clock { 31 33 u8 xfer_mode; ··· 205 207 { 206 208 struct hpt_clock *clocks = ap->host->private_data; 207 209 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 208 - u32 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 209 - u32 addr2 = 0x51 + 4 * ap->port_no; 210 + u32 addr = 0x40 + 4 * adev->devno; 210 211 u32 mask, reg; 211 - u8 fast; 212 - 213 - /* Fast interrupt prediction disable, hold off interrupt disable */ 214 - pci_read_config_byte(pdev, addr2, &fast); 215 - if (fast & 0x80) { 216 - fast &= ~0x80; 217 - pci_write_config_byte(pdev, addr2, fast); 218 - } 219 212 220 213 /* determine timing mask and find matching clock entry */ 221 214 if (mode < XFER_MW_DMA_0) ··· 229 240 * on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid 230 241 * problems handling I/O errors later. 231 242 */ 232 - pci_read_config_dword(pdev, addr1, &reg); 243 + pci_read_config_dword(pdev, addr, &reg); 233 244 reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000; 234 - pci_write_config_dword(pdev, addr1, reg); 245 + pci_write_config_dword(pdev, addr, reg); 235 246 } 236 247 237 248 /** ··· 361 372 break; 362 373 } 363 374 /* Now kick off ATA set up */ 364 - return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv); 375 + return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv, 0); 365 376 } 366 377 367 378 #ifdef CONFIG_PM
+95 -114
drivers/ata/pata_hpt37x.c
··· 24 24 #include <linux/libata.h> 25 25 26 26 #define DRV_NAME "pata_hpt37x" 27 - #define DRV_VERSION "0.6.14" 27 + #define DRV_VERSION "0.6.15" 28 28 29 29 struct hpt_clock { 30 30 u8 xfer_speed; ··· 39 39 40 40 /* key for bus clock timings 41 41 * bit 42 - * 0:3 data_high_time. inactive time of DIOW_/DIOR_ for PIO and MW 43 - * DMA. cycles = value + 1 44 - * 4:8 data_low_time. active time of DIOW_/DIOR_ for PIO and MW 45 - * DMA. cycles = value + 1 46 - * 9:12 cmd_high_time. inactive time of DIOW_/DIOR_ during task file 42 + * 0:3 data_high_time. Inactive time of DIOW_/DIOR_ for PIO and MW DMA. 43 + * cycles = value + 1 44 + * 4:8 data_low_time. Active time of DIOW_/DIOR_ for PIO and MW DMA. 45 + * cycles = value + 1 46 + * 9:12 cmd_high_time. Inactive time of DIOW_/DIOR_ during task file 47 47 * register access. 48 - * 13:17 cmd_low_time. active time of DIOW_/DIOR_ during task file 48 + * 13:17 cmd_low_time. Active time of DIOW_/DIOR_ during task file 49 49 * register access. 50 - * 18:21 udma_cycle_time. clock freq and clock cycles for UDMA xfer. 51 - * during task file register access. 52 - * 22:24 pre_high_time. time to initialize 1st cycle for PIO and MW DMA 53 - * xfer. 54 - * 25:27 cmd_pre_high_time. time to initialize 1st PIO cycle for task 50 + * 18:20 udma_cycle_time. Clock cycles for UDMA xfer. 51 + * 21 CLK frequency for UDMA: 0=ATA clock, 1=dual ATA clock. 52 + * 22:24 pre_high_time. Time to initialize 1st cycle for PIO and MW DMA xfer. 53 + * 25:27 cmd_pre_high_time. Time to initialize 1st PIO cycle for task file 55 54 * register access. 56 - * 28 UDMA enable 57 - * 29 DMA enable 58 - * 30 PIO_MST enable. if set, the chip is in bus master mode during 59 - * PIO. 60 - * 31 FIFO enable. 55 + * 28 UDMA enable. 56 + * 29 DMA enable. 57 + * 30 PIO_MST enable. If set, the chip is in bus master mode during 58 + * PIO xfer. 59 + * 31 FIFO enable. Only for PIO. 61 60 */ 62 61 63 62 static struct hpt_clock hpt37x_timings_33[] = { ··· 383 384 return ata_sff_prereset(link, deadline); 384 385 } 385 386 387 + static void hpt370_set_mode(struct ata_port *ap, struct ata_device *adev, 388 + u8 mode) 389 + { 390 + struct pci_dev *pdev = to_pci_dev(ap->host->dev); 391 + u32 addr1, addr2; 392 + u32 reg, timing, mask; 393 + u8 fast; 394 + 395 + addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 396 + addr2 = 0x51 + 4 * ap->port_no; 397 + 398 + /* Fast interrupt prediction disable, hold off interrupt disable */ 399 + pci_read_config_byte(pdev, addr2, &fast); 400 + fast &= ~0x02; 401 + fast |= 0x01; 402 + pci_write_config_byte(pdev, addr2, fast); 403 + 404 + /* Determine timing mask and find matching mode entry */ 405 + if (mode < XFER_MW_DMA_0) 406 + mask = 0xcfc3ffff; 407 + else if (mode < XFER_UDMA_0) 408 + mask = 0x31c001ff; 409 + else 410 + mask = 0x303c0000; 411 + 412 + timing = hpt37x_find_mode(ap, mode); 413 + 414 + pci_read_config_dword(pdev, addr1, &reg); 415 + reg = (reg & ~mask) | (timing & mask); 416 + pci_write_config_dword(pdev, addr1, reg); 417 + } 386 418 /** 387 419 * hpt370_set_piomode - PIO setup 388 420 * @ap: ATA interface ··· 424 394 425 395 static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev) 426 396 { 427 - struct pci_dev *pdev = to_pci_dev(ap->host->dev); 428 - u32 addr1, addr2; 429 - u32 reg; 430 - u32 mode; 431 - u8 fast; 432 - 433 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 434 - addr2 = 0x51 + 4 * ap->port_no; 435 - 436 - /* Fast interrupt prediction disable, hold off interrupt disable */ 437 - pci_read_config_byte(pdev, addr2, &fast); 438 - fast &= ~0x02; 439 - fast |= 0x01; 440 - pci_write_config_byte(pdev, addr2, fast); 441 - 442 - pci_read_config_dword(pdev, addr1, &reg); 443 - mode = hpt37x_find_mode(ap, adev->pio_mode); 444 - mode &= 0xCFC3FFFF; /* Leave DMA bits alone */ 445 - reg &= ~0xCFC3FFFF; /* Strip timing bits */ 446 - pci_write_config_dword(pdev, addr1, reg | mode); 397 + hpt370_set_mode(ap, adev, adev->pio_mode); 447 398 } 448 399 449 400 /** ··· 432 421 * @ap: ATA interface 433 422 * @adev: Device being configured 434 423 * 435 - * Set up the channel for MWDMA or UDMA modes. Much the same as with 436 - * PIO, load the mode number and then set MWDMA or UDMA flag. 424 + * Set up the channel for MWDMA or UDMA modes. 437 425 */ 438 426 439 427 static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev) 440 428 { 441 - struct pci_dev *pdev = to_pci_dev(ap->host->dev); 442 - u32 addr1, addr2; 443 - u32 reg, mode, mask; 444 - u8 fast; 445 - 446 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 447 - addr2 = 0x51 + 4 * ap->port_no; 448 - 449 - /* Fast interrupt prediction disable, hold off interrupt disable */ 450 - pci_read_config_byte(pdev, addr2, &fast); 451 - fast &= ~0x02; 452 - fast |= 0x01; 453 - pci_write_config_byte(pdev, addr2, fast); 454 - 455 - mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000; 456 - 457 - pci_read_config_dword(pdev, addr1, &reg); 458 - mode = hpt37x_find_mode(ap, adev->dma_mode); 459 - mode &= mask; 460 - reg &= ~mask; 461 - pci_write_config_dword(pdev, addr1, reg | mode); 429 + hpt370_set_mode(ap, adev, adev->dma_mode); 462 430 } 463 431 464 432 /** ··· 451 461 { 452 462 struct ata_port *ap = qc->ap; 453 463 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 454 - u8 dma_stat = ioread8(ap->ioaddr.bmdma_addr + 2); 455 - u8 dma_cmd; 456 464 void __iomem *bmdma = ap->ioaddr.bmdma_addr; 465 + u8 dma_stat = ioread8(bmdma + ATA_DMA_STATUS); 466 + u8 dma_cmd; 457 467 458 - if (dma_stat & 0x01) { 468 + if (dma_stat & ATA_DMA_ACTIVE) { 459 469 udelay(20); 460 - dma_stat = ioread8(bmdma + 2); 470 + dma_stat = ioread8(bmdma + ATA_DMA_STATUS); 461 471 } 462 - if (dma_stat & 0x01) { 472 + if (dma_stat & ATA_DMA_ACTIVE) { 463 473 /* Clear the engine */ 464 474 pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); 465 475 udelay(10); 466 476 /* Stop DMA */ 467 - dma_cmd = ioread8(bmdma ); 468 - iowrite8(dma_cmd & 0xFE, bmdma); 477 + dma_cmd = ioread8(bmdma + ATA_DMA_CMD); 478 + iowrite8(dma_cmd & ~ATA_DMA_START, bmdma + ATA_DMA_CMD); 469 479 /* Clear Error */ 470 - dma_stat = ioread8(bmdma + 2); 471 - iowrite8(dma_stat | 0x06 , bmdma + 2); 480 + dma_stat = ioread8(bmdma + ATA_DMA_STATUS); 481 + iowrite8(dma_stat | ATA_DMA_INTR | ATA_DMA_ERR, 482 + bmdma + ATA_DMA_STATUS); 472 483 /* Clear the engine */ 473 484 pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); 474 485 udelay(10); 475 486 } 476 487 ata_bmdma_stop(qc); 488 + } 489 + 490 + static void hpt372_set_mode(struct ata_port *ap, struct ata_device *adev, 491 + u8 mode) 492 + { 493 + struct pci_dev *pdev = to_pci_dev(ap->host->dev); 494 + u32 addr1, addr2; 495 + u32 reg, timing, mask; 496 + u8 fast; 497 + 498 + addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 499 + addr2 = 0x51 + 4 * ap->port_no; 500 + 501 + /* Fast interrupt prediction disable, hold off interrupt disable */ 502 + pci_read_config_byte(pdev, addr2, &fast); 503 + fast &= ~0x07; 504 + pci_write_config_byte(pdev, addr2, fast); 505 + 506 + /* Determine timing mask and find matching mode entry */ 507 + if (mode < XFER_MW_DMA_0) 508 + mask = 0xcfc3ffff; 509 + else if (mode < XFER_UDMA_0) 510 + mask = 0x31c001ff; 511 + else 512 + mask = 0x303c0000; 513 + 514 + timing = hpt37x_find_mode(ap, mode); 515 + 516 + pci_read_config_dword(pdev, addr1, &reg); 517 + reg = (reg & ~mask) | (timing & mask); 518 + pci_write_config_dword(pdev, addr1, reg); 477 519 } 478 520 479 521 /** ··· 518 496 519 497 static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev) 520 498 { 521 - struct pci_dev *pdev = to_pci_dev(ap->host->dev); 522 - u32 addr1, addr2; 523 - u32 reg; 524 - u32 mode; 525 - u8 fast; 526 - 527 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 528 - addr2 = 0x51 + 4 * ap->port_no; 529 - 530 - /* Fast interrupt prediction disable, hold off interrupt disable */ 531 - pci_read_config_byte(pdev, addr2, &fast); 532 - fast &= ~0x07; 533 - pci_write_config_byte(pdev, addr2, fast); 534 - 535 - pci_read_config_dword(pdev, addr1, &reg); 536 - mode = hpt37x_find_mode(ap, adev->pio_mode); 537 - 538 - printk("Find mode for %d reports %X\n", adev->pio_mode, mode); 539 - mode &= 0xCFC3FFFF; /* Leave DMA bits alone */ 540 - reg &= ~0xCFC3FFFF; /* Strip timing bits */ 541 - pci_write_config_dword(pdev, addr1, reg | mode); 499 + hpt372_set_mode(ap, adev, adev->pio_mode); 542 500 } 543 501 544 502 /** ··· 526 524 * @ap: ATA interface 527 525 * @adev: Device being configured 528 526 * 529 - * Set up the channel for MWDMA or UDMA modes. Much the same as with 530 - * PIO, load the mode number and then set MWDMA or UDMA flag. 527 + * Set up the channel for MWDMA or UDMA modes. 531 528 */ 532 529 533 530 static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev) 534 531 { 535 - struct pci_dev *pdev = to_pci_dev(ap->host->dev); 536 - u32 addr1, addr2; 537 - u32 reg, mode, mask; 538 - u8 fast; 539 - 540 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 541 - addr2 = 0x51 + 4 * ap->port_no; 542 - 543 - /* Fast interrupt prediction disable, hold off interrupt disable */ 544 - pci_read_config_byte(pdev, addr2, &fast); 545 - fast &= ~0x07; 546 - pci_write_config_byte(pdev, addr2, fast); 547 - 548 - mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000; 549 - 550 - pci_read_config_dword(pdev, addr1, &reg); 551 - mode = hpt37x_find_mode(ap, adev->dma_mode); 552 - printk("Find mode for DMA %d reports %X\n", adev->dma_mode, mode); 553 - mode &= mask; 554 - reg &= ~mask; 555 - pci_write_config_dword(pdev, addr1, reg | mode); 532 + hpt372_set_mode(ap, adev, adev->dma_mode); 556 533 } 557 534 558 535 /** ··· 987 1006 } 988 1007 989 1008 /* Now kick off ATA set up */ 990 - return ata_pci_sff_init_one(dev, ppi, &hpt37x_sht, private_data); 1009 + return ata_pci_sff_init_one(dev, ppi, &hpt37x_sht, private_data, 0); 991 1010 } 992 1011 993 1012 static const struct pci_device_id hpt37x[] = {
+60 -68
drivers/ata/pata_hpt3x2n.c
··· 25 25 #include <linux/libata.h> 26 26 27 27 #define DRV_NAME "pata_hpt3x2n" 28 - #define DRV_VERSION "0.3.8" 28 + #define DRV_VERSION "0.3.10" 29 29 30 30 enum { 31 31 HPT_PCI_FAST = (1 << 31), ··· 45 45 46 46 /* key for bus clock timings 47 47 * bit 48 - * 0:3 data_high_time. inactive time of DIOW_/DIOR_ for PIO and MW 49 - * DMA. cycles = value + 1 50 - * 4:8 data_low_time. active time of DIOW_/DIOR_ for PIO and MW 51 - * DMA. cycles = value + 1 52 - * 9:12 cmd_high_time. inactive time of DIOW_/DIOR_ during task file 48 + * 0:3 data_high_time. Inactive time of DIOW_/DIOR_ for PIO and MW DMA. 49 + * cycles = value + 1 50 + * 4:8 data_low_time. Active time of DIOW_/DIOR_ for PIO and MW DMA. 51 + * cycles = value + 1 52 + * 9:12 cmd_high_time. Inactive time of DIOW_/DIOR_ during task file 53 53 * register access. 54 - * 13:17 cmd_low_time. active time of DIOW_/DIOR_ during task file 54 + * 13:17 cmd_low_time. Active time of DIOW_/DIOR_ during task file 55 55 * register access. 56 - * 18:21 udma_cycle_time. clock freq and clock cycles for UDMA xfer. 57 - * during task file register access. 58 - * 22:24 pre_high_time. time to initialize 1st cycle for PIO and MW DMA 59 - * xfer. 60 - * 25:27 cmd_pre_high_time. time to initialize 1st PIO cycle for task 56 + * 18:20 udma_cycle_time. Clock cycles for UDMA xfer. 57 + * 21 CLK frequency for UDMA: 0=ATA clock, 1=dual ATA clock. 58 + * 22:24 pre_high_time. Time to initialize 1st cycle for PIO and MW DMA xfer. 59 + * 25:27 cmd_pre_high_time. Time to initialize 1st PIO cycle for task file 61 60 * register access. 62 - * 28 UDMA enable 63 - * 29 DMA enable 64 - * 30 PIO_MST enable. if set, the chip is in bus master mode during 65 - * PIO. 66 - * 31 FIFO enable. 61 + * 28 UDMA enable. 62 + * 29 DMA enable. 63 + * 30 PIO_MST enable. If set, the chip is in bus master mode during 64 + * PIO xfer. 65 + * 31 FIFO enable. Only for PIO. 67 66 */ 68 67 69 68 /* 66MHz DPLL clocks */ ··· 160 161 return ata_sff_prereset(link, deadline); 161 162 } 162 163 164 + static void hpt3x2n_set_mode(struct ata_port *ap, struct ata_device *adev, 165 + u8 mode) 166 + { 167 + struct pci_dev *pdev = to_pci_dev(ap->host->dev); 168 + u32 addr1, addr2; 169 + u32 reg, timing, mask; 170 + u8 fast; 171 + 172 + addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 173 + addr2 = 0x51 + 4 * ap->port_no; 174 + 175 + /* Fast interrupt prediction disable, hold off interrupt disable */ 176 + pci_read_config_byte(pdev, addr2, &fast); 177 + fast &= ~0x07; 178 + pci_write_config_byte(pdev, addr2, fast); 179 + 180 + /* Determine timing mask and find matching mode entry */ 181 + if (mode < XFER_MW_DMA_0) 182 + mask = 0xcfc3ffff; 183 + else if (mode < XFER_UDMA_0) 184 + mask = 0x31c001ff; 185 + else 186 + mask = 0x303c0000; 187 + 188 + timing = hpt3x2n_find_mode(ap, mode); 189 + 190 + pci_read_config_dword(pdev, addr1, &reg); 191 + reg = (reg & ~mask) | (timing & mask); 192 + pci_write_config_dword(pdev, addr1, reg); 193 + } 194 + 163 195 /** 164 196 * hpt3x2n_set_piomode - PIO setup 165 197 * @ap: ATA interface ··· 201 171 202 172 static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) 203 173 { 204 - struct pci_dev *pdev = to_pci_dev(ap->host->dev); 205 - u32 addr1, addr2; 206 - u32 reg; 207 - u32 mode; 208 - u8 fast; 209 - 210 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 211 - addr2 = 0x51 + 4 * ap->port_no; 212 - 213 - /* Fast interrupt prediction disable, hold off interrupt disable */ 214 - pci_read_config_byte(pdev, addr2, &fast); 215 - fast &= ~0x07; 216 - pci_write_config_byte(pdev, addr2, fast); 217 - 218 - pci_read_config_dword(pdev, addr1, &reg); 219 - mode = hpt3x2n_find_mode(ap, adev->pio_mode); 220 - mode &= 0xCFC3FFFF; /* Leave DMA bits alone */ 221 - reg &= ~0xCFC3FFFF; /* Strip timing bits */ 222 - pci_write_config_dword(pdev, addr1, reg | mode); 174 + hpt3x2n_set_mode(ap, adev, adev->pio_mode); 223 175 } 224 176 225 177 /** ··· 209 197 * @ap: ATA interface 210 198 * @adev: Device being configured 211 199 * 212 - * Set up the channel for MWDMA or UDMA modes. Much the same as with 213 - * PIO, load the mode number and then set MWDMA or UDMA flag. 200 + * Set up the channel for MWDMA or UDMA modes. 214 201 */ 215 202 216 203 static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev) 217 204 { 218 - struct pci_dev *pdev = to_pci_dev(ap->host->dev); 219 - u32 addr1, addr2; 220 - u32 reg, mode, mask; 221 - u8 fast; 222 - 223 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 224 - addr2 = 0x51 + 4 * ap->port_no; 225 - 226 - /* Fast interrupt prediction disable, hold off interrupt disable */ 227 - pci_read_config_byte(pdev, addr2, &fast); 228 - fast &= ~0x07; 229 - pci_write_config_byte(pdev, addr2, fast); 230 - 231 - mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000; 232 - 233 - pci_read_config_dword(pdev, addr1, &reg); 234 - mode = hpt3x2n_find_mode(ap, adev->dma_mode); 235 - mode &= mask; 236 - reg &= ~mask; 237 - pci_write_config_dword(pdev, addr1, reg | mode); 205 + hpt3x2n_set_mode(ap, adev, adev->dma_mode); 238 206 } 239 207 240 208 /** ··· 536 544 pci_mhz); 537 545 /* Set our private data up. We only need a few flags so we use 538 546 it directly */ 539 - if (pci_mhz > 60) { 547 + if (pci_mhz > 60) 540 548 hpriv = (void *)(PCI66 | USE_DPLL); 541 - /* 542 - * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in 543 - * the MISC. register to stretch the UltraDMA Tss timing. 544 - * NOTE: This register is only writeable via I/O space. 545 - */ 546 - if (dev->device == PCI_DEVICE_ID_TTI_HPT371) 547 - outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); 548 - } 549 + 550 + /* 551 + * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in 552 + * the MISC. register to stretch the UltraDMA Tss timing. 553 + * NOTE: This register is only writeable via I/O space. 554 + */ 555 + if (dev->device == PCI_DEVICE_ID_TTI_HPT371) 556 + outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); 549 557 550 558 /* Now kick off ATA set up */ 551 - return ata_pci_sff_init_one(dev, ppi, &hpt3x2n_sht, hpriv); 559 + return ata_pci_sff_init_one(dev, ppi, &hpt3x2n_sht, hpriv, 0); 552 560 } 553 561 554 562 static const struct pci_device_id hpt3x2n[] = {
+1 -1
drivers/ata/pata_it8213.c
··· 273 273 dev_printk(KERN_DEBUG, &pdev->dev, 274 274 "version " DRV_VERSION "\n"); 275 275 276 - return ata_pci_sff_init_one(pdev, ppi, &it8213_sht, NULL); 276 + return ata_pci_sff_init_one(pdev, ppi, &it8213_sht, NULL, 0); 277 277 } 278 278 279 279 static const struct pci_device_id it8213_pci_tbl[] = {
+1 -1
drivers/ata/pata_it821x.c
··· 932 932 else 933 933 ppi[0] = &info_smart; 934 934 } 935 - return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL); 935 + return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL, 0); 936 936 } 937 937 938 938 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_jmicron.c
··· 144 144 }; 145 145 const struct ata_port_info *ppi[] = { &info, NULL }; 146 146 147 - return ata_pci_sff_init_one(pdev, ppi, &jmicron_sht, NULL); 147 + return ata_pci_sff_init_one(pdev, ppi, &jmicron_sht, NULL, 0); 148 148 } 149 149 150 150 static const struct pci_device_id jmicron_pci_tbl[] = {
+2 -2
drivers/ata/pata_marvell.c
··· 147 147 if (pdev->device == 0x6101) 148 148 ppi[1] = &ata_dummy_port_info; 149 149 150 - #if defined(CONFIG_AHCI) || defined(CONFIG_AHCI_MODULE) 150 + #if defined(CONFIG_SATA_AHCI) || defined(CONFIG_SATA_AHCI_MODULE) 151 151 if (!marvell_pata_active(pdev)) { 152 152 printk(KERN_INFO DRV_NAME ": PATA port not active, deferring to AHCI driver.\n"); 153 153 return -ENODEV; 154 154 } 155 155 #endif 156 - return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL); 156 + return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL, 0); 157 157 } 158 158 159 159 static const struct pci_device_id marvell_pci_tbl[] = {
+1 -1
drivers/ata/pata_netcell.c
··· 82 82 ata_pci_bmdma_clear_simplex(pdev); 83 83 84 84 /* And let the library code do the work */ 85 - return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL); 85 + return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL, 0); 86 86 } 87 87 88 88 static const struct pci_device_id netcell_pci_tbl[] = {
+1 -1
drivers/ata/pata_ns87410.c
··· 148 148 .port_ops = &ns87410_port_ops 149 149 }; 150 150 const struct ata_port_info *ppi[] = { &info, NULL }; 151 - return ata_pci_sff_init_one(dev, ppi, &ns87410_sht, NULL); 151 + return ata_pci_sff_init_one(dev, ppi, &ns87410_sht, NULL, 0); 152 152 } 153 153 154 154 static const struct pci_device_id ns87410[] = {
+1 -1
drivers/ata/pata_ns87415.c
··· 380 380 381 381 ns87415_fixup(pdev); 382 382 383 - return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL); 383 + return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL, 0); 384 384 } 385 385 386 386 static const struct pci_device_id ns87415_pci_tbl[] = {
+1 -1
drivers/ata/pata_oldpiix.c
··· 248 248 dev_printk(KERN_DEBUG, &pdev->dev, 249 249 "version " DRV_VERSION "\n"); 250 250 251 - return ata_pci_sff_init_one(pdev, ppi, &oldpiix_sht, NULL); 251 + return ata_pci_sff_init_one(pdev, ppi, &oldpiix_sht, NULL, 0); 252 252 } 253 253 254 254 static const struct pci_device_id oldpiix_pci_tbl[] = {
+1 -1
drivers/ata/pata_opti.c
··· 172 172 if (!printed_version++) 173 173 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); 174 174 175 - return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL); 175 + return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL, 0); 176 176 } 177 177 178 178 static const struct pci_device_id opti[] = {
+1 -1
drivers/ata/pata_optidma.c
··· 429 429 if (optiplus_with_udma(dev)) 430 430 ppi[0] = &info_82c700_udma; 431 431 432 - return ata_pci_sff_init_one(dev, ppi, &optidma_sht, NULL); 432 + return ata_pci_sff_init_one(dev, ppi, &optidma_sht, NULL, 0); 433 433 } 434 434 435 435 static const struct pci_device_id optidma[] = {
+1 -1
drivers/ata/pata_pcmcia.c
··· 136 136 * 137 137 */ 138 138 139 - void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc) 139 + static void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc) 140 140 { 141 141 int count; 142 142 struct ata_port *ap;
+15 -2
drivers/ata/pata_pdc202xx_old.c
··· 2 2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer 3 3 * (C) 2005 Red Hat Inc 4 4 * Alan Cox <alan@lxorguk.ukuu.org.uk> 5 - * (C) 2007,2009 Bartlomiej Zolnierkiewicz 5 + * (C) 2007,2009,2010 Bartlomiej Zolnierkiewicz 6 6 * 7 7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c 8 8 * ··· 33 33 if (cis & (1 << (10 + ap->port_no))) 34 34 return ATA_CBL_PATA40; 35 35 return ATA_CBL_PATA80; 36 + } 37 + 38 + static void pdc202xx_exec_command(struct ata_port *ap, 39 + const struct ata_taskfile *tf) 40 + { 41 + DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); 42 + 43 + iowrite8(tf->command, ap->ioaddr.command_addr); 44 + ndelay(400); 36 45 } 37 46 38 47 /** ··· 280 271 .cable_detect = ata_cable_40wire, 281 272 .set_piomode = pdc202xx_set_piomode, 282 273 .set_dmamode = pdc202xx_set_dmamode, 274 + 275 + .sff_exec_command = pdc202xx_exec_command, 283 276 }; 284 277 285 278 static struct ata_port_operations pdc2026x_port_ops = { ··· 295 284 .dev_config = pdc2026x_dev_config, 296 285 297 286 .port_start = pdc2026x_port_start, 287 + 288 + .sff_exec_command = pdc202xx_exec_command, 298 289 }; 299 290 300 291 static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) ··· 337 324 return -ENODEV; 338 325 } 339 326 } 340 - return ata_pci_sff_init_one(dev, ppi, &pdc202xx_sht, NULL); 327 + return ata_pci_sff_init_one(dev, ppi, &pdc202xx_sht, NULL, 0); 341 328 } 342 329 343 330 static const struct pci_device_id pdc202xx[] = {
+1 -1
drivers/ata/pata_piccolo.c
··· 95 95 }; 96 96 const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; 97 97 /* Just one port for the moment */ 98 - return ata_pci_sff_init_one(dev, ppi, &tosh_sht, NULL); 98 + return ata_pci_sff_init_one(dev, ppi, &tosh_sht, NULL, 0); 99 99 } 100 100 101 101 static struct pci_device_id ata_tosh[] = {
+1 -1
drivers/ata/pata_radisys.c
··· 227 227 dev_printk(KERN_DEBUG, &pdev->dev, 228 228 "version " DRV_VERSION "\n"); 229 229 230 - return ata_pci_sff_init_one(pdev, ppi, &radisys_sht, NULL); 230 + return ata_pci_sff_init_one(pdev, ppi, &radisys_sht, NULL, 0); 231 231 } 232 232 233 233 static const struct pci_device_id radisys_pci_tbl[] = {
+1 -1
drivers/ata/pata_rz1000.c
··· 95 95 printk_once(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); 96 96 97 97 if (rz1000_fifo_disable(pdev) == 0) 98 - return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL); 98 + return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0); 99 99 100 100 printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); 101 101 /* Not safe to use so skip */
+1 -1
drivers/ata/pata_sc1200.c
··· 237 237 }; 238 238 const struct ata_port_info *ppi[] = { &info, NULL }; 239 239 240 - return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); 240 + return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL, 0); 241 241 } 242 242 243 243 static const struct pci_device_id sc1200[] = {
+4 -3
drivers/ata/pata_serverworks.c
··· 1 1 /* 2 2 * pata_serverworks.c - Serverworks PATA for new ATA layer 3 3 * (C) 2005 Red Hat Inc 4 + * (C) 2010 Bartlomiej Zolnierkiewicz 4 5 * 5 6 * based upon 6 7 * ··· 254 253 if (serverworks_is_csb(pdev)) { 255 254 pci_read_config_word(pdev, 0x4A, &csb5_pio); 256 255 csb5_pio &= ~(0x0F << devbits); 257 - pci_write_config_byte(pdev, 0x4A, csb5_pio | (pio << devbits)); 256 + pci_write_config_word(pdev, 0x4A, csb5_pio | (pio << devbits)); 258 257 } 259 258 } 260 259 ··· 328 327 pci_dev_put(isa_dev); 329 328 return 0; 330 329 } 331 - printk(KERN_WARNING "ata_serverworks: Unable to find bridge.\n"); 330 + printk(KERN_WARNING DRV_NAME ": Unable to find bridge.\n"); 332 331 return -ENODEV; 333 332 } 334 333 ··· 460 459 if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) 461 460 ata_pci_bmdma_clear_simplex(pdev); 462 461 463 - return ata_pci_sff_init_one(pdev, ppi, &serverworks_sht, NULL); 462 + return ata_pci_sff_init_one(pdev, ppi, &serverworks_sht, NULL, 0); 464 463 } 465 464 466 465 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_sil680.c
··· 356 356 IRQF_SHARED, &sil680_sht); 357 357 358 358 use_ioports: 359 - return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL); 359 + return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL, 0); 360 360 } 361 361 362 362 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_sis.c
··· 826 826 827 827 sis_fixup(pdev, chipset); 828 828 829 - return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset); 829 + return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset, 0); 830 830 } 831 831 832 832 #ifdef CONFIG_PM
+1 -1
drivers/ata/pata_sl82c105.c
··· 316 316 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 317 317 pci_write_config_dword(dev, 0x40, val); 318 318 319 - return ata_pci_sff_init_one(dev, ppi, &sl82c105_sht, NULL); 319 + return ata_pci_sff_init_one(dev, ppi, &sl82c105_sht, NULL, 0); 320 320 } 321 321 322 322 static const struct pci_device_id sl82c105[] = {
+1 -1
drivers/ata/pata_triflex.c
··· 201 201 if (!printed_version++) 202 202 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); 203 203 204 - return ata_pci_sff_init_one(dev, ppi, &triflex_sht, NULL); 204 + return ata_pci_sff_init_one(dev, ppi, &triflex_sht, NULL, 0); 205 205 } 206 206 207 207 static const struct pci_device_id triflex[] = {
+97 -113
drivers/ata/pata_via.c
··· 22 22 * VIA VT8233c - UDMA100 23 23 * VIA VT8235 - UDMA133 24 24 * VIA VT8237 - UDMA133 25 + * VIA VT8237A - UDMA133 25 26 * VIA VT8237S - UDMA133 26 27 * VIA VT8251 - UDMA133 27 28 * ··· 65 64 #define DRV_NAME "pata_via" 66 65 #define DRV_VERSION "0.3.4" 67 66 68 - /* 69 - * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx 70 - * driver. 71 - */ 72 - 73 67 enum { 74 - VIA_UDMA = 0x007, 75 - VIA_UDMA_NONE = 0x000, 76 - VIA_UDMA_33 = 0x001, 77 - VIA_UDMA_66 = 0x002, 78 - VIA_UDMA_100 = 0x003, 79 - VIA_UDMA_133 = 0x004, 80 - VIA_BAD_PREQ = 0x010, /* Crashes if PREQ# till DDACK# set */ 81 - VIA_BAD_CLK66 = 0x020, /* 66 MHz clock doesn't work correctly */ 82 - VIA_SET_FIFO = 0x040, /* Needs to have FIFO split set */ 83 - VIA_NO_UNMASK = 0x080, /* Doesn't work with IRQ unmasking on */ 84 - VIA_BAD_ID = 0x100, /* Has wrong vendor ID (0x1107) */ 85 - VIA_BAD_AST = 0x200, /* Don't touch Address Setup Timing */ 86 - VIA_NO_ENABLES = 0x400, /* Has no enablebits */ 87 - VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */ 68 + VIA_BAD_PREQ = 0x01, /* Crashes if PREQ# till DDACK# set */ 69 + VIA_BAD_CLK66 = 0x02, /* 66 MHz clock doesn't work correctly */ 70 + VIA_SET_FIFO = 0x04, /* Needs to have FIFO split set */ 71 + VIA_NO_UNMASK = 0x08, /* Doesn't work with IRQ unmasking on */ 72 + VIA_BAD_ID = 0x10, /* Has wrong vendor ID (0x1107) */ 73 + VIA_BAD_AST = 0x20, /* Don't touch Address Setup Timing */ 74 + VIA_NO_ENABLES = 0x40, /* Has no enablebits */ 75 + VIA_SATA_PATA = 0x80, /* SATA/PATA combined configuration */ 88 76 }; 89 77 90 78 enum { ··· 89 99 u16 id; 90 100 u8 rev_min; 91 101 u8 rev_max; 92 - u16 flags; 102 + u8 udma_mask; 103 + u8 flags; 93 104 } via_isa_bridges[] = { 94 - { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f, 95 - VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, 96 - { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 | 97 - VIA_BAD_AST | VIA_SATA_PATA }, 98 - { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, 99 - VIA_UDMA_133 | VIA_BAD_AST }, 100 - { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 101 - { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 102 - { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, 103 - { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, 104 - { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, 105 - { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 106 - { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 107 - { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 108 - { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 109 - { "vt8233c", PCI_DEVICE_ID_VIA_8233C_0, 0x00, 0x2f, VIA_UDMA_100 }, 110 - { "vt8233", PCI_DEVICE_ID_VIA_8233_0, 0x00, 0x2f, VIA_UDMA_100 }, 111 - { "vt8231", PCI_DEVICE_ID_VIA_8231, 0x00, 0x2f, VIA_UDMA_100 }, 112 - { "vt82c686b", PCI_DEVICE_ID_VIA_82C686, 0x40, 0x4f, VIA_UDMA_100 }, 113 - { "vt82c686a", PCI_DEVICE_ID_VIA_82C686, 0x10, 0x2f, VIA_UDMA_66 }, 114 - { "vt82c686", PCI_DEVICE_ID_VIA_82C686, 0x00, 0x0f, VIA_UDMA_33 | VIA_BAD_CLK66 }, 115 - { "vt82c596b", PCI_DEVICE_ID_VIA_82C596, 0x10, 0x2f, VIA_UDMA_66 }, 116 - { "vt82c596a", PCI_DEVICE_ID_VIA_82C596, 0x00, 0x0f, VIA_UDMA_33 | VIA_BAD_CLK66 }, 117 - { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x47, 0x4f, VIA_UDMA_33 | VIA_SET_FIFO }, 118 - { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x40, 0x46, VIA_UDMA_33 | VIA_SET_FIFO | VIA_BAD_PREQ }, 119 - { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x30, 0x3f, VIA_UDMA_33 | VIA_SET_FIFO }, 120 - { "vt82c586a", PCI_DEVICE_ID_VIA_82C586_0, 0x20, 0x2f, VIA_UDMA_33 | VIA_SET_FIFO }, 121 - { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, 122 - { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, 123 - { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, 124 - { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f, 125 - VIA_UDMA_133 | VIA_BAD_AST }, 105 + { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_SATA_PATA }, 106 + { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_SATA_PATA }, 107 + { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 108 + { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 109 + { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 110 + { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_SATA_PATA }, 111 + { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_NO_ENABLES }, 112 + { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, ATA_UDMA6, VIA_BAD_AST | VIA_NO_ENABLES }, 113 + { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 114 + { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 115 + { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 116 + { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 117 + { "vt8233c", PCI_DEVICE_ID_VIA_8233C_0, 0x00, 0x2f, ATA_UDMA5, }, 118 + { "vt8233", PCI_DEVICE_ID_VIA_8233_0, 0x00, 0x2f, ATA_UDMA5, }, 119 + { "vt8231", PCI_DEVICE_ID_VIA_8231, 0x00, 0x2f, ATA_UDMA5, }, 120 + { "vt82c686b", PCI_DEVICE_ID_VIA_82C686, 0x40, 0x4f, ATA_UDMA5, }, 121 + { "vt82c686a", PCI_DEVICE_ID_VIA_82C686, 0x10, 0x2f, ATA_UDMA4, }, 122 + { "vt82c686", PCI_DEVICE_ID_VIA_82C686, 0x00, 0x0f, ATA_UDMA2, VIA_BAD_CLK66 }, 123 + { "vt82c596b", PCI_DEVICE_ID_VIA_82C596, 0x10, 0x2f, ATA_UDMA4, }, 124 + { "vt82c596a", PCI_DEVICE_ID_VIA_82C596, 0x00, 0x0f, ATA_UDMA2, VIA_BAD_CLK66 }, 125 + { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x47, 0x4f, ATA_UDMA2, VIA_SET_FIFO }, 126 + { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x40, 0x46, ATA_UDMA2, VIA_SET_FIFO | VIA_BAD_PREQ }, 127 + { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x30, 0x3f, ATA_UDMA2, VIA_SET_FIFO }, 128 + { "vt82c586a", PCI_DEVICE_ID_VIA_82C586_0, 0x20, 0x2f, ATA_UDMA2, VIA_SET_FIFO }, 129 + { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, 0x00, VIA_SET_FIFO }, 130 + { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, 0x00, VIA_SET_FIFO | VIA_NO_UNMASK }, 131 + { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, 0x00, VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, 132 + { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 126 133 { NULL } 127 134 }; 128 135 ··· 178 191 return ATA_CBL_SATA; 179 192 180 193 /* Early chips are 40 wire */ 181 - if ((config->flags & VIA_UDMA) < VIA_UDMA_66) 194 + if (config->udma_mask < ATA_UDMA4) 182 195 return ATA_CBL_PATA40; 183 196 /* UDMA 66 chips have only drive side logic */ 184 - else if ((config->flags & VIA_UDMA) < VIA_UDMA_100) 197 + else if (config->udma_mask < ATA_UDMA5) 185 198 return ATA_CBL_PATA_UNK; 186 199 /* UDMA 100 or later */ 187 200 pci_read_config_dword(pdev, 0x50, &ata66); ··· 216 229 217 230 218 231 /** 219 - * via_do_set_mode - set initial PIO mode data 232 + * via_do_set_mode - set transfer mode data 220 233 * @ap: ATA interface 221 234 * @adev: ATA device 222 235 * @mode: ATA mode being programmed 223 - * @tdiv: Clocks per PCI clock 224 236 * @set_ast: Set to program address setup 225 237 * @udma_type: UDMA mode/format of registers 226 238 * ··· 230 244 * on the two channels. 231 245 */ 232 246 233 - static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mode, int tdiv, int set_ast, int udma_type) 247 + static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, 248 + int mode, int set_ast, int udma_type) 234 249 { 235 250 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 236 251 struct ata_device *peer = ata_dev_pair(adev); 237 252 struct ata_timing t, p; 238 - static int via_clock = 33333; /* Bus clock in kHZ - ought to be tunable one day */ 253 + static int via_clock = 33333; /* Bus clock in kHZ */ 239 254 unsigned long T = 1000000000 / via_clock; 240 - unsigned long UT = T/tdiv; 255 + unsigned long UT = T; 241 256 int ut; 242 257 int offset = 3 - (2*ap->port_no) - adev->devno; 258 + 259 + switch (udma_type) { 260 + case ATA_UDMA4: 261 + UT = T / 2; break; 262 + case ATA_UDMA5: 263 + UT = T / 3; break; 264 + case ATA_UDMA6: 265 + UT = T / 4; break; 266 + } 243 267 244 268 /* Calculate the timing values we require */ 245 269 ata_timing_compute(adev, mode, &t, T, UT); ··· 269 273 270 274 pci_read_config_byte(pdev, 0x4C, &setup); 271 275 setup &= ~(3 << shift); 272 - setup |= clamp_val(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ 276 + setup |= (clamp_val(t.setup, 1, 4) - 1) << shift; 273 277 pci_write_config_byte(pdev, 0x4C, setup); 274 278 } 275 279 ··· 280 284 ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); 281 285 282 286 /* Load the UDMA bits according to type */ 283 - switch(udma_type) { 284 - default: 285 - /* BUG() ? */ 286 - /* fall through */ 287 - case 33: 288 - ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; 289 - break; 290 - case 66: 291 - ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; 292 - break; 293 - case 100: 294 - ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; 295 - break; 296 - case 133: 297 - ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; 298 - break; 287 + switch (udma_type) { 288 + case ATA_UDMA2: 289 + default: 290 + ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; 291 + break; 292 + case ATA_UDMA4: 293 + ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; 294 + break; 295 + case ATA_UDMA5: 296 + ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; 297 + break; 298 + case ATA_UDMA6: 299 + ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; 300 + break; 299 301 } 300 302 301 303 /* Set UDMA unless device is not UDMA capable */ ··· 319 325 { 320 326 const struct via_isa_bridge *config = ap->host->private_data; 321 327 int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; 322 - int mode = config->flags & VIA_UDMA; 323 - static u8 tclock[5] = { 1, 1, 2, 3, 4 }; 324 - static u8 udma[5] = { 0, 33, 66, 100, 133 }; 325 328 326 - via_do_set_mode(ap, adev, adev->pio_mode, tclock[mode], set_ast, udma[mode]); 329 + via_do_set_mode(ap, adev, adev->pio_mode, set_ast, config->udma_mask); 327 330 } 328 331 329 332 static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev) 330 333 { 331 334 const struct via_isa_bridge *config = ap->host->private_data; 332 335 int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; 333 - int mode = config->flags & VIA_UDMA; 334 - static u8 tclock[5] = { 1, 1, 2, 3, 4 }; 335 - static u8 udma[5] = { 0, 33, 66, 100, 133 }; 336 336 337 - via_do_set_mode(ap, adev, adev->dma_mode, tclock[mode], set_ast, udma[mode]); 337 + via_do_set_mode(ap, adev, adev->dma_mode, set_ast, config->udma_mask); 338 338 } 339 339 340 340 /** ··· 592 604 via_config_fifo(pdev, config->flags); 593 605 594 606 /* Clock set up */ 595 - switch(config->flags & VIA_UDMA) { 596 - case VIA_UDMA_NONE: 597 - if (config->flags & VIA_NO_UNMASK) 598 - ppi[0] = &via_mwdma_info_borked; 599 - else 600 - ppi[0] = &via_mwdma_info; 601 - break; 602 - case VIA_UDMA_33: 603 - ppi[0] = &via_udma33_info; 604 - break; 605 - case VIA_UDMA_66: 606 - ppi[0] = &via_udma66_info; 607 - /* The 66 MHz devices require we enable the clock */ 608 - pci_read_config_dword(pdev, 0x50, &timing); 609 - timing |= 0x80008; 610 - pci_write_config_dword(pdev, 0x50, timing); 611 - break; 612 - case VIA_UDMA_100: 613 - ppi[0] = &via_udma100_info; 614 - break; 615 - case VIA_UDMA_133: 616 - ppi[0] = &via_udma133_info; 617 - break; 618 - default: 619 - WARN_ON(1); 620 - return -ENODEV; 621 - } 607 + switch (config->udma_mask) { 608 + case 0x00: 609 + if (config->flags & VIA_NO_UNMASK) 610 + ppi[0] = &via_mwdma_info_borked; 611 + else 612 + ppi[0] = &via_mwdma_info; 613 + break; 614 + case ATA_UDMA2: 615 + ppi[0] = &via_udma33_info; 616 + break; 617 + case ATA_UDMA4: 618 + ppi[0] = &via_udma66_info; 619 + break; 620 + case ATA_UDMA5: 621 + ppi[0] = &via_udma100_info; 622 + break; 623 + case ATA_UDMA6: 624 + ppi[0] = &via_udma133_info; 625 + break; 626 + default: 627 + WARN_ON(1); 628 + return -ENODEV; 629 + } 622 630 623 631 if (config->flags & VIA_BAD_CLK66) { 624 632 /* Disable the 66MHz clock on problem devices */ ··· 624 640 } 625 641 626 642 /* We have established the device type, now fire it up */ 627 - return ata_pci_sff_init_one(pdev, ppi, &via_sht, (void *)config); 643 + return ata_pci_sff_init_one(pdev, ppi, &via_sht, (void *)config, 0); 628 644 } 629 645 630 646 #ifdef CONFIG_PM ··· 651 667 652 668 via_config_fifo(pdev, config->flags); 653 669 654 - if ((config->flags & VIA_UDMA) == VIA_UDMA_66) { 670 + if (config->udma_mask == ATA_UDMA4) { 655 671 /* The 66 MHz devices require we enable the clock */ 656 672 pci_read_config_dword(pdev, 0x50, &timing); 657 673 timing |= 0x80008;
+20 -3
drivers/ata/sata_via.c
··· 40 40 #include <linux/blkdev.h> 41 41 #include <linux/delay.h> 42 42 #include <linux/device.h> 43 + #include <scsi/scsi.h> 44 + #include <scsi/scsi_cmnd.h> 43 45 #include <scsi/scsi_host.h> 44 46 #include <linux/libata.h> 45 47 46 48 #define DRV_NAME "sata_via" 47 - #define DRV_VERSION "2.4" 49 + #define DRV_VERSION "2.6" 48 50 49 51 /* 50 52 * vt8251 is different from other sata controllers of VIA. It has two ··· 82 80 static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); 83 81 static void svia_noop_freeze(struct ata_port *ap); 84 82 static int vt6420_prereset(struct ata_link *link, unsigned long deadline); 83 + static void vt6420_bmdma_start(struct ata_queued_cmd *qc); 85 84 static int vt6421_pata_cable_detect(struct ata_port *ap); 86 85 static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); 87 86 static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); ··· 124 121 .inherits = &svia_base_ops, 125 122 .freeze = svia_noop_freeze, 126 123 .prereset = vt6420_prereset, 124 + .bmdma_start = vt6420_bmdma_start, 127 125 }; 128 126 129 127 static struct ata_port_operations vt6421_pata_ops = { ··· 381 377 return 0; 382 378 } 383 379 380 + static void vt6420_bmdma_start(struct ata_queued_cmd *qc) 381 + { 382 + struct ata_port *ap = qc->ap; 383 + if ((qc->tf.command == ATA_CMD_PACKET) && 384 + (qc->scsicmd->sc_data_direction == DMA_TO_DEVICE)) { 385 + /* Prevents corruption on some ATAPI burners */ 386 + ata_sff_pause(ap); 387 + } 388 + ata_bmdma_start(qc); 389 + } 390 + 384 391 static int vt6421_pata_cable_detect(struct ata_port *ap) 385 392 { 386 393 struct pci_dev *pdev = to_pci_dev(ap->host->dev); ··· 407 392 { 408 393 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 409 394 static const u8 pio_bits[] = { 0xA8, 0x65, 0x65, 0x31, 0x20 }; 410 - pci_write_config_byte(pdev, PATA_PIO_TIMING, pio_bits[adev->pio_mode - XFER_PIO_0]); 395 + pci_write_config_byte(pdev, PATA_PIO_TIMING - adev->devno, 396 + pio_bits[adev->pio_mode - XFER_PIO_0]); 411 397 } 412 398 413 399 static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev) 414 400 { 415 401 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 416 402 static const u8 udma_bits[] = { 0xEE, 0xE8, 0xE6, 0xE4, 0xE2, 0xE1, 0xE0, 0xE0 }; 417 - pci_write_config_byte(pdev, PATA_UDMA_TIMING, udma_bits[adev->dma_mode - XFER_UDMA_0]); 403 + pci_write_config_byte(pdev, PATA_UDMA_TIMING - adev->devno, 404 + udma_bits[adev->dma_mode - XFER_UDMA_0]); 418 405 } 419 406 420 407 static const unsigned int svia_bar_sizes[] = {
+1 -1
drivers/staging/phison/phison.c
··· 62 62 }; 63 63 const struct ata_port_info *ppi[] = { &info, NULL }; 64 64 65 - ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL); 65 + ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL, 0); 66 66 67 67 dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); 68 68
+2 -1
include/linux/ata.h
··· 841 841 842 842 static inline int ata_id_is_cfa(const u16 *id) 843 843 { 844 - if (id[ATA_ID_CONFIG] == 0x848A) /* Traditional CF */ 844 + if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ 845 + (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ 845 846 return 1; 846 847 /* 847 848 * CF specs don't require specific value in the word 0 anymore and yet
+3 -2
include/linux/libata.h
··· 857 857 unsigned int (*sff_data_xfer)(struct ata_device *dev, 858 858 unsigned char *buf, unsigned int buflen, int rw); 859 859 u8 (*sff_irq_on)(struct ata_port *); 860 + bool (*sff_irq_check)(struct ata_port *); 860 861 void (*sff_irq_clear)(struct ata_port *); 861 862 862 863 void (*bmdma_setup)(struct ata_queued_cmd *qc); ··· 1643 1642 irq_handler_t irq_handler, 1644 1643 struct scsi_host_template *sht); 1645 1644 extern int ata_pci_sff_init_one(struct pci_dev *pdev, 1646 - const struct ata_port_info * const * ppi, 1647 - struct scsi_host_template *sht, void *host_priv); 1645 + const struct ata_port_info * const * ppi, 1646 + struct scsi_host_template *sht, void *host_priv, int hflags); 1648 1647 #endif /* CONFIG_PCI */ 1649 1648 1650 1649 /**