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:
libata: ahci_start_engine compliant to AHCI spec
ata: pata_at91.c bugfix for initial_timing initialisation
ata: pata_at91.c bugfix for high master clock
ahci: AHCI-mode SATA patch for Intel Panther Point DeviceIDs
ata_piix: IDE-mode SATA patch for Intel Panther Point DeviceIDs
libata: Pioneer DVR-216D can't do SETXFER
ahci: don't enable port irq before handler is registered
libata: Implement ATA_FLAG_NO_DIPM and apply it to mcp65
libata: Kill unused ATA_DFLAG_{H|D}IPM flags
ahci: EM supported message type sysfs attribute

+103 -11
+7 -1
drivers/ata/ahci.c
··· 150 150 { 151 151 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | 152 152 AHCI_HFLAG_YES_NCQ), 153 - .flags = AHCI_FLAG_COMMON, 153 + .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, 154 154 .pio_mask = ATA_PIO4, 155 155 .udma_mask = ATA_UDMA6, 156 156 .port_ops = &ahci_ops, ··· 261 261 { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ 262 262 { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ 263 263 { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ 264 + { PCI_VDEVICE(INTEL, 0x1e02), board_ahci }, /* Panther Point AHCI */ 265 + { PCI_VDEVICE(INTEL, 0x1e03), board_ahci }, /* Panther Point AHCI */ 266 + { PCI_VDEVICE(INTEL, 0x1e04), board_ahci }, /* Panther Point RAID */ 267 + { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */ 268 + { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */ 269 + { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */ 264 270 265 271 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 266 272 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+4
drivers/ata/ahci.h
··· 229 229 EM_CTL_ALHD = (1 << 26), /* Activity LED */ 230 230 EM_CTL_XMT = (1 << 25), /* Transmit Only */ 231 231 EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ 232 + EM_CTL_SGPIO = (1 << 19), /* SGPIO messages supported */ 233 + EM_CTL_SES = (1 << 18), /* SES-2 messages supported */ 234 + EM_CTL_SAFTE = (1 << 17), /* SAF-TE messages supported */ 235 + EM_CTL_LED = (1 << 16), /* LED messages supported */ 232 236 233 237 /* em message type */ 234 238 EM_MSG_TYPE_LED = (1 << 0), /* LED */
+8
drivers/ata/ata_piix.c
··· 309 309 { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 310 310 /* SATA Controller IDE (PBG) */ 311 311 { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 312 + /* SATA Controller IDE (Panther Point) */ 313 + { 0x8086, 0x1e00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 314 + /* SATA Controller IDE (Panther Point) */ 315 + { 0x8086, 0x1e01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 316 + /* SATA Controller IDE (Panther Point) */ 317 + { 0x8086, 0x1e08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 318 + /* SATA Controller IDE (Panther Point) */ 319 + { 0x8086, 0x1e09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 312 320 { } /* terminate list */ 313 321 }; 314 322
+58 -2
drivers/ata/libahci.c
··· 109 109 static ssize_t ahci_store_em_buffer(struct device *dev, 110 110 struct device_attribute *attr, 111 111 const char *buf, size_t size); 112 + static ssize_t ahci_show_em_supported(struct device *dev, 113 + struct device_attribute *attr, char *buf); 112 114 113 115 static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); 114 116 static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); ··· 118 116 static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); 119 117 static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, 120 118 ahci_read_em_buffer, ahci_store_em_buffer); 119 + static DEVICE_ATTR(em_message_supported, S_IRUGO, ahci_show_em_supported, NULL); 121 120 122 121 struct device_attribute *ahci_shost_attrs[] = { 123 122 &dev_attr_link_power_management_policy, ··· 129 126 &dev_attr_ahci_host_version, 130 127 &dev_attr_ahci_port_cmd, 131 128 &dev_attr_em_buffer, 129 + &dev_attr_em_message_supported, 132 130 NULL 133 131 }; 134 132 EXPORT_SYMBOL_GPL(ahci_shost_attrs); ··· 347 343 return size; 348 344 } 349 345 346 + static ssize_t ahci_show_em_supported(struct device *dev, 347 + struct device_attribute *attr, char *buf) 348 + { 349 + struct Scsi_Host *shost = class_to_shost(dev); 350 + struct ata_port *ap = ata_shost_to_port(shost); 351 + struct ahci_host_priv *hpriv = ap->host->private_data; 352 + void __iomem *mmio = hpriv->mmio; 353 + u32 em_ctl; 354 + 355 + em_ctl = readl(mmio + HOST_EM_CTL); 356 + 357 + return sprintf(buf, "%s%s%s%s\n", 358 + em_ctl & EM_CTL_LED ? "led " : "", 359 + em_ctl & EM_CTL_SAFTE ? "saf-te " : "", 360 + em_ctl & EM_CTL_SES ? "ses-2 " : "", 361 + em_ctl & EM_CTL_SGPIO ? "sgpio " : ""); 362 + } 363 + 350 364 /** 351 365 * ahci_save_initial_config - Save and fixup initial config values 352 366 * @dev: target AHCI device ··· 561 539 { 562 540 void __iomem *port_mmio = ahci_port_base(ap); 563 541 u32 tmp; 542 + u8 status; 543 + 544 + status = readl(port_mmio + PORT_TFDATA) & 0xFF; 545 + 546 + /* 547 + * At end of section 10.1 of AHCI spec (rev 1.3), it states 548 + * Software shall not set PxCMD.ST to 1 until it is determined 549 + * that a functoinal device is present on the port as determined by 550 + * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h 551 + * 552 + * Even though most AHCI host controllers work without this check, 553 + * specific controller will fail under this condition 554 + */ 555 + if (status & (ATA_BUSY | ATA_DRQ)) 556 + return; 557 + else { 558 + ahci_scr_read(&ap->link, SCR_STATUS, &tmp); 559 + 560 + if ((tmp & 0xf) != 0x3) 561 + return; 562 + } 564 563 565 564 /* start DMA */ 566 565 tmp = readl(port_mmio + PORT_CMD); ··· 1940 1897 ahci_enable_fbs(ap); 1941 1898 1942 1899 pp->intr_mask |= PORT_IRQ_BAD_PMP; 1943 - writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 1900 + 1901 + /* 1902 + * We must not change the port interrupt mask register if the 1903 + * port is marked frozen, the value in pp->intr_mask will be 1904 + * restored later when the port is thawed. 1905 + * 1906 + * Note that during initialization, the port is marked as 1907 + * frozen since the irq handler is not yet registered. 1908 + */ 1909 + if (!(ap->pflags & ATA_PFLAG_FROZEN)) 1910 + writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 1944 1911 } 1945 1912 1946 1913 static void ahci_pmp_detach(struct ata_port *ap) ··· 1966 1913 writel(cmd, port_mmio + PORT_CMD); 1967 1914 1968 1915 pp->intr_mask &= ~PORT_IRQ_BAD_PMP; 1969 - writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 1916 + 1917 + /* see comment above in ahci_pmp_attach() */ 1918 + if (!(ap->pflags & ATA_PFLAG_FROZEN)) 1919 + writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 1970 1920 } 1971 1921 1972 1922 int ahci_port_resume(struct ata_port *ap)
+2 -1
drivers/ata/libata-core.c
··· 4139 4139 */ 4140 4140 { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, 4141 4141 { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, 4142 + { "PIONEER DVD-RW DVR-216D", "1.08", ATA_HORKAGE_NOSETXFER }, 4142 4143 4143 4144 /* End Marker */ 4144 4145 { } ··· 5481 5480 if (!ap) 5482 5481 return NULL; 5483 5482 5484 - ap->pflags |= ATA_PFLAG_INITIALIZING; 5483 + ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; 5485 5484 ap->lock = &host->lock; 5486 5485 ap->print_id = -1; 5487 5486 ap->host = host;
+4 -2
drivers/ata/libata-eh.c
··· 3316 3316 struct ata_eh_context *ehc = &link->eh_context; 3317 3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3318 3318 enum ata_lpm_policy old_policy = link->lpm_policy; 3319 + bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM; 3319 3320 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3320 3321 unsigned int err_mask; 3321 3322 int rc; ··· 3333 3332 */ 3334 3333 ata_for_each_dev(dev, link, ENABLED) { 3335 3334 bool hipm = ata_id_has_hipm(dev->id); 3336 - bool dipm = ata_id_has_dipm(dev->id); 3335 + bool dipm = ata_id_has_dipm(dev->id) && !no_dipm; 3337 3336 3338 3337 /* find the first enabled and LPM enabled devices */ 3339 3338 if (!link_dev) ··· 3390 3389 3391 3390 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3392 3391 ata_for_each_dev(dev, link, ENABLED) { 3393 - if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { 3392 + if (policy == ATA_LPM_MIN_POWER && !no_dipm && 3393 + ata_id_has_dipm(dev->id)) { 3394 3394 err_mask = ata_dev_set_feature(dev, 3395 3395 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3396 3396 if (err_mask && err_mask != AC_ERR_DEV) {
+19 -3
drivers/ata/pata_at91.c
··· 33 33 34 34 35 35 #define DRV_NAME "pata_at91" 36 - #define DRV_VERSION "0.1" 36 + #define DRV_VERSION "0.2" 37 37 38 38 #define CF_IDE_OFFSET 0x00c00000 39 39 #define CF_ALT_IDE_OFFSET 0x00e00000 40 40 #define CF_IDE_RES_SIZE 0x08 41 + #define NCS_RD_PULSE_LIMIT 0x3f /* maximal value for pulse bitfields */ 41 42 42 43 struct at91_ide_info { 43 44 unsigned long mode; ··· 50 49 void __iomem *alt_addr; 51 50 }; 52 51 53 - static const struct ata_timing initial_timing = 54 - {XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0}; 52 + static const struct ata_timing initial_timing = { 53 + .mode = XFER_PIO_0, 54 + .setup = 70, 55 + .act8b = 290, 56 + .rec8b = 240, 57 + .cyc8b = 600, 58 + .active = 165, 59 + .recover = 150, 60 + .dmack_hold = 0, 61 + .cycle = 600, 62 + .udma = 0 63 + }; 55 64 56 65 static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) 57 66 { ··· 120 109 /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ 121 110 ncs_read_setup = 1; 122 111 ncs_read_pulse = read_cycle - 2; 112 + if (ncs_read_pulse > NCS_RD_PULSE_LIMIT) { 113 + ncs_read_pulse = NCS_RD_PULSE_LIMIT; 114 + dev_warn(dev, "ncs_read_pulse limited to maximal value %lu\n", 115 + ncs_read_pulse); 116 + } 123 117 124 118 /* Write timings same as read timings */ 125 119 write_cycle = read_cycle;
+1 -2
include/linux/libata.h
··· 137 137 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 138 138 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 139 139 ATA_DFLAG_AN = (1 << 7), /* AN configured */ 140 - ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */ 141 - ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */ 142 140 ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ 143 141 ATA_DFLAG_CFG_MASK = (1 << 12) - 1, 144 142 ··· 196 198 * management */ 197 199 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 198 200 * led */ 201 + ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ 199 202 200 203 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 201 204