aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-04-24 11:45:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-04-24 11:45:37 -0400
commit8f7544682c488dfc4117b37ed10435bb2d3d8d73 (patch)
tree075f7404d81e3ff8f8cfa52f09a618e9a13b0a55
parent1f91f48b65a075c29c4adc57a895ff0e7306e2ee (diff)
parent270dac35c26433d06a89150c51e75ca0181ca7e4 (diff)
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
-rw-r--r--drivers/ata/ahci.c8
-rw-r--r--drivers/ata/ahci.h4
-rw-r--r--drivers/ata/ata_piix.c8
-rw-r--r--drivers/ata/libahci.c60
-rw-r--r--drivers/ata/libata-core.c3
-rw-r--r--drivers/ata/libata-eh.c6
-rw-r--r--drivers/ata/pata_at91.c22
-rw-r--r--include/linux/libata.h3
8 files changed, 103 insertions, 11 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 39d829cd82d..71afe037131 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -150,7 +150,7 @@ static const struct ata_port_info ahci_port_info[] = {
150 { 150 {
151 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | 151 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP |
152 AHCI_HFLAG_YES_NCQ), 152 AHCI_HFLAG_YES_NCQ),
153 .flags = AHCI_FLAG_COMMON, 153 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM,
154 .pio_mask = ATA_PIO4, 154 .pio_mask = ATA_PIO4,
155 .udma_mask = ATA_UDMA6, 155 .udma_mask = ATA_UDMA6,
156 .port_ops = &ahci_ops, 156 .port_ops = &ahci_ops,
@@ -261,6 +261,12 @@ static const struct pci_device_id ahci_pci_tbl[] = {
261 { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ 261 { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */
262 { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */ 262 { PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */
263 { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ 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 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 271 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
266 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 272 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 39865009c25..12c5282e7fc 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -229,6 +229,10 @@ enum {
229 EM_CTL_ALHD = (1 << 26), /* Activity LED */ 229 EM_CTL_ALHD = (1 << 26), /* Activity LED */
230 EM_CTL_XMT = (1 << 25), /* Transmit Only */ 230 EM_CTL_XMT = (1 << 25), /* Transmit Only */
231 EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ 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 /* em message type */ 237 /* em message type */
234 EM_MSG_TYPE_LED = (1 << 0), /* LED */ 238 EM_MSG_TYPE_LED = (1 << 0), /* LED */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 0bc3fd6c3fd..6f6e7718b05 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -309,6 +309,14 @@ static const struct pci_device_id piix_pci_tbl[] = {
309 { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 309 { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
310 /* SATA Controller IDE (PBG) */ 310 /* SATA Controller IDE (PBG) */
311 { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 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 { } /* terminate list */ 320 { } /* terminate list */
313}; 321};
314 322
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 26d452339e9..ff9d832a163 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -109,6 +109,8 @@ static ssize_t ahci_read_em_buffer(struct device *dev,
109static ssize_t ahci_store_em_buffer(struct device *dev, 109static ssize_t ahci_store_em_buffer(struct device *dev,
110 struct device_attribute *attr, 110 struct device_attribute *attr,
111 const char *buf, size_t size); 111 const char *buf, size_t size);
112static ssize_t ahci_show_em_supported(struct device *dev,
113 struct device_attribute *attr, char *buf);
112 114
113static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); 115static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL);
114static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); 116static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL);
@@ -116,6 +118,7 @@ static DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL);
116static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); 118static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL);
117static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, 119static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO,
118 ahci_read_em_buffer, ahci_store_em_buffer); 120 ahci_read_em_buffer, ahci_store_em_buffer);
121static DEVICE_ATTR(em_message_supported, S_IRUGO, ahci_show_em_supported, NULL);
119 122
120struct device_attribute *ahci_shost_attrs[] = { 123struct device_attribute *ahci_shost_attrs[] = {
121 &dev_attr_link_power_management_policy, 124 &dev_attr_link_power_management_policy,
@@ -126,6 +129,7 @@ struct device_attribute *ahci_shost_attrs[] = {
126 &dev_attr_ahci_host_version, 129 &dev_attr_ahci_host_version,
127 &dev_attr_ahci_port_cmd, 130 &dev_attr_ahci_port_cmd,
128 &dev_attr_em_buffer, 131 &dev_attr_em_buffer,
132 &dev_attr_em_message_supported,
129 NULL 133 NULL
130}; 134};
131EXPORT_SYMBOL_GPL(ahci_shost_attrs); 135EXPORT_SYMBOL_GPL(ahci_shost_attrs);
@@ -343,6 +347,24 @@ static ssize_t ahci_store_em_buffer(struct device *dev,
343 return size; 347 return size;
344} 348}
345 349
350static ssize_t ahci_show_em_supported(struct device *dev,
351 struct device_attribute *attr, char *buf)
352{
353 struct Scsi_Host *shost = class_to_shost(dev);
354 struct ata_port *ap = ata_shost_to_port(shost);
355 struct ahci_host_priv *hpriv = ap->host->private_data;
356 void __iomem *mmio = hpriv->mmio;
357 u32 em_ctl;
358
359 em_ctl = readl(mmio + HOST_EM_CTL);
360
361 return sprintf(buf, "%s%s%s%s\n",
362 em_ctl & EM_CTL_LED ? "led " : "",
363 em_ctl & EM_CTL_SAFTE ? "saf-te " : "",
364 em_ctl & EM_CTL_SES ? "ses-2 " : "",
365 em_ctl & EM_CTL_SGPIO ? "sgpio " : "");
366}
367
346/** 368/**
347 * ahci_save_initial_config - Save and fixup initial config values 369 * ahci_save_initial_config - Save and fixup initial config values
348 * @dev: target AHCI device 370 * @dev: target AHCI device
@@ -539,6 +561,27 @@ void ahci_start_engine(struct ata_port *ap)
539{ 561{
540 void __iomem *port_mmio = ahci_port_base(ap); 562 void __iomem *port_mmio = ahci_port_base(ap);
541 u32 tmp; 563 u32 tmp;
564 u8 status;
565
566 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
567
568 /*
569 * At end of section 10.1 of AHCI spec (rev 1.3), it states
570 * Software shall not set PxCMD.ST to 1 until it is determined
571 * that a functoinal device is present on the port as determined by
572 * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h
573 *
574 * Even though most AHCI host controllers work without this check,
575 * specific controller will fail under this condition
576 */
577 if (status & (ATA_BUSY | ATA_DRQ))
578 return;
579 else {
580 ahci_scr_read(&ap->link, SCR_STATUS, &tmp);
581
582 if ((tmp & 0xf) != 0x3)
583 return;
584 }
542 585
543 /* start DMA */ 586 /* start DMA */
544 tmp = readl(port_mmio + PORT_CMD); 587 tmp = readl(port_mmio + PORT_CMD);
@@ -1897,7 +1940,17 @@ static void ahci_pmp_attach(struct ata_port *ap)
1897 ahci_enable_fbs(ap); 1940 ahci_enable_fbs(ap);
1898 1941
1899 pp->intr_mask |= PORT_IRQ_BAD_PMP; 1942 pp->intr_mask |= PORT_IRQ_BAD_PMP;
1900 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 1943
1944 /*
1945 * We must not change the port interrupt mask register if the
1946 * port is marked frozen, the value in pp->intr_mask will be
1947 * restored later when the port is thawed.
1948 *
1949 * Note that during initialization, the port is marked as
1950 * frozen since the irq handler is not yet registered.
1951 */
1952 if (!(ap->pflags & ATA_PFLAG_FROZEN))
1953 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
1901} 1954}
1902 1955
1903static void ahci_pmp_detach(struct ata_port *ap) 1956static void ahci_pmp_detach(struct ata_port *ap)
@@ -1913,7 +1966,10 @@ static void ahci_pmp_detach(struct ata_port *ap)
1913 writel(cmd, port_mmio + PORT_CMD); 1966 writel(cmd, port_mmio + PORT_CMD);
1914 1967
1915 pp->intr_mask &= ~PORT_IRQ_BAD_PMP; 1968 pp->intr_mask &= ~PORT_IRQ_BAD_PMP;
1916 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 1969
1970 /* see comment above in ahci_pmp_attach() */
1971 if (!(ap->pflags & ATA_PFLAG_FROZEN))
1972 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
1917} 1973}
1918 1974
1919int ahci_port_resume(struct ata_port *ap) 1975int ahci_port_resume(struct ata_port *ap)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 423c0a6952b..76c3c15cb1e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4139,6 +4139,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4139 */ 4139 */
4140 { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, 4140 { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER },
4141 { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, 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 /* End Marker */ 4144 /* End Marker */
4144 { } 4145 { }
@@ -5480,7 +5481,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
5480 if (!ap) 5481 if (!ap)
5481 return NULL; 5482 return NULL;
5482 5483
5483 ap->pflags |= ATA_PFLAG_INITIALIZING; 5484 ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
5484 ap->lock = &host->lock; 5485 ap->lock = &host->lock;
5485 ap->print_id = -1; 5486 ap->print_id = -1;
5486 ap->host = host; 5487 ap->host = host;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 88cd22fa65c..f26f2fe3480 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3316,6 +3316,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3316 struct ata_eh_context *ehc = &link->eh_context; 3316 struct ata_eh_context *ehc = &link->eh_context;
3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
3318 enum ata_lpm_policy old_policy = link->lpm_policy; 3318 enum ata_lpm_policy old_policy = link->lpm_policy;
3319 bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM;
3319 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3320 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
3320 unsigned int err_mask; 3321 unsigned int err_mask;
3321 int rc; 3322 int rc;
@@ -3332,7 +3333,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3332 */ 3333 */
3333 ata_for_each_dev(dev, link, ENABLED) { 3334 ata_for_each_dev(dev, link, ENABLED) {
3334 bool hipm = ata_id_has_hipm(dev->id); 3335 bool hipm = ata_id_has_hipm(dev->id);
3335 bool dipm = ata_id_has_dipm(dev->id); 3336 bool dipm = ata_id_has_dipm(dev->id) && !no_dipm;
3336 3337
3337 /* find the first enabled and LPM enabled devices */ 3338 /* find the first enabled and LPM enabled devices */
3338 if (!link_dev) 3339 if (!link_dev)
@@ -3389,7 +3390,8 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3389 3390
3390 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3391 /* host config updated, enable DIPM if transitioning to MIN_POWER */
3391 ata_for_each_dev(dev, link, ENABLED) { 3392 ata_for_each_dev(dev, link, ENABLED) {
3392 if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { 3393 if (policy == ATA_LPM_MIN_POWER && !no_dipm &&
3394 ata_id_has_dipm(dev->id)) {
3393 err_mask = ata_dev_set_feature(dev, 3395 err_mask = ata_dev_set_feature(dev,
3394 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3396 SETFEATURES_SATA_ENABLE, SATA_DIPM);
3395 if (err_mask && err_mask != AC_ERR_DEV) { 3397 if (err_mask && err_mask != AC_ERR_DEV) {
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
index 0da0dcc7dd0..a5fdbdcb0fa 100644
--- a/drivers/ata/pata_at91.c
+++ b/drivers/ata/pata_at91.c
@@ -33,11 +33,12 @@
33 33
34 34
35#define DRV_NAME "pata_at91" 35#define DRV_NAME "pata_at91"
36#define DRV_VERSION "0.1" 36#define DRV_VERSION "0.2"
37 37
38#define CF_IDE_OFFSET 0x00c00000 38#define CF_IDE_OFFSET 0x00c00000
39#define CF_ALT_IDE_OFFSET 0x00e00000 39#define CF_ALT_IDE_OFFSET 0x00e00000
40#define CF_IDE_RES_SIZE 0x08 40#define CF_IDE_RES_SIZE 0x08
41#define NCS_RD_PULSE_LIMIT 0x3f /* maximal value for pulse bitfields */
41 42
42struct at91_ide_info { 43struct at91_ide_info {
43 unsigned long mode; 44 unsigned long mode;
@@ -49,8 +50,18 @@ struct at91_ide_info {
49 void __iomem *alt_addr; 50 void __iomem *alt_addr;
50}; 51};
51 52
52static const struct ata_timing initial_timing = 53static const struct ata_timing initial_timing = {
53 {XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0}; 54 .mode = XFER_PIO_0,
55 .setup = 70,
56 .act8b = 290,
57 .rec8b = 240,
58 .cyc8b = 600,
59 .active = 165,
60 .recover = 150,
61 .dmack_hold = 0,
62 .cycle = 600,
63 .udma = 0
64};
54 65
55static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) 66static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz)
56{ 67{
@@ -109,6 +120,11 @@ static void set_smc_timing(struct device *dev,
109 /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ 120 /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */
110 ncs_read_setup = 1; 121 ncs_read_setup = 1;
111 ncs_read_pulse = read_cycle - 2; 122 ncs_read_pulse = read_cycle - 2;
123 if (ncs_read_pulse > NCS_RD_PULSE_LIMIT) {
124 ncs_read_pulse = NCS_RD_PULSE_LIMIT;
125 dev_warn(dev, "ncs_read_pulse limited to maximal value %lu\n",
126 ncs_read_pulse);
127 }
112 128
113 /* Write timings same as read timings */ 129 /* Write timings same as read timings */
114 write_cycle = read_cycle; 130 write_cycle = read_cycle;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 7f675aa81d8..04f32a3eb26 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -137,8 +137,6 @@ enum {
137 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 137 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
138 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 138 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
139 ATA_DFLAG_AN = (1 << 7), /* AN configured */ 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 ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ 140 ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */
143 ATA_DFLAG_CFG_MASK = (1 << 12) - 1, 141 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
144 142
@@ -198,6 +196,7 @@ enum {
198 * management */ 196 * management */
199 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 197 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
200 * led */ 198 * led */
199 ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */
201 200
202 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 201 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
203 202