Commit 557eed60 authored by Linus Torvalds's avatar Linus Torvalds

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: Power off empty ports
  libata-pmp: add support for Thermaltake BlackX Duet esata drive dock
  ATA: Don't powerdown Compaq Triflex IDE device on suspend
  libata: Use Maximum Write Same Length to report discard size limit
  drivers/ata/acard-ahci.c: fix enum warning
  pata_at91: SMC settings calculation bugfixes, support for t6z and IORDY
  libata-sff: prevent irq descriptions for dummy ports
  pata_cm64x: fix boot crash on parisc
parents be84bfcc 8a745f1f
...@@ -417,7 +417,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id ...@@ -417,7 +417,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
WARN_ON(ATA_MAX_QUEUE > AHCI_MAX_CMDS); WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
......
...@@ -3619,8 +3619,14 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, ...@@ -3619,8 +3619,14 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
scontrol |= (0x2 << 8); scontrol |= (0x2 << 8);
break; break;
case ATA_LPM_MIN_POWER: case ATA_LPM_MIN_POWER:
/* no restrictions on LPM transitions */ if (ata_link_nr_enabled(link) > 0)
scontrol &= ~(0x3 << 8); /* no restrictions on LPM transitions */
scontrol &= ~(0x3 << 8);
else {
/* empty port, power off */
scontrol &= ~0xf;
scontrol |= (0x1 << 2);
}
break; break;
default: default:
WARN_ON(1); WARN_ON(1);
......
...@@ -3423,7 +3423,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, ...@@ -3423,7 +3423,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
return rc; return rc;
} }
static int ata_link_nr_enabled(struct ata_link *link) int ata_link_nr_enabled(struct ata_link *link)
{ {
struct ata_device *dev; struct ata_device *dev;
int cnt = 0; int cnt = 0;
......
...@@ -449,6 +449,16 @@ static void sata_pmp_quirks(struct ata_port *ap) ...@@ -449,6 +449,16 @@ static void sata_pmp_quirks(struct ata_port *ap)
* otherwise. Don't try hard to recover it. * otherwise. Don't try hard to recover it.
*/ */
ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY;
} else if (vendor == 0x197b && devid == 0x2352) {
/* chip found in Thermaltake BlackX Duet, jmicron JMB350? */
ata_for_each_link(link, ap, EDGE) {
/* SRST breaks detection and disks get misclassified
* LPM disabled to avoid potential problems
*/
link->flags |= ATA_LFLAG_NO_LPM |
ATA_LFLAG_NO_SRST |
ATA_LFLAG_ASSUME_ATA;
}
} }
} }
......
...@@ -2138,7 +2138,7 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2138,7 +2138,7 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
* with the unmap bit set. * with the unmap bit set.
*/ */
if (ata_id_has_trim(args->id)) { if (ata_id_has_trim(args->id)) {
put_unaligned_be32(65535 * 512 / 8, &rbuf[20]); put_unaligned_be64(65535 * 512 / 8, &rbuf[36]);
put_unaligned_be32(1, &rbuf[28]); put_unaligned_be32(1, &rbuf[28]);
} }
......
...@@ -2447,13 +2447,18 @@ int ata_pci_sff_activate_host(struct ata_host *host, ...@@ -2447,13 +2447,18 @@ int ata_pci_sff_activate_host(struct ata_host *host,
return -ENOMEM; return -ENOMEM;
if (!legacy_mode && pdev->irq) { if (!legacy_mode && pdev->irq) {
int i;
rc = devm_request_irq(dev, pdev->irq, irq_handler, rc = devm_request_irq(dev, pdev->irq, irq_handler,
IRQF_SHARED, drv_name, host); IRQF_SHARED, drv_name, host);
if (rc) if (rc)
goto out; goto out;
ata_port_desc(host->ports[0], "irq %d", pdev->irq); for (i = 0; i < 2; i++) {
ata_port_desc(host->ports[1], "irq %d", pdev->irq); if (ata_port_is_dummy(host->ports[i]))
continue;
ata_port_desc(host->ports[i], "irq %d", pdev->irq);
}
} else if (legacy_mode) { } else if (legacy_mode) {
if (!ata_port_is_dummy(host->ports[0])) { if (!ata_port_is_dummy(host->ports[0])) {
rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
......
This diff is collapsed.
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
enum { enum {
CFR = 0x50, CFR = 0x50,
CFR_INTR_CH0 = 0x04, CFR_INTR_CH0 = 0x04,
CNTRL = 0x51,
CNTRL_CH0 = 0x04,
CNTRL_CH1 = 0x08,
CMDTIM = 0x52, CMDTIM = 0x52,
ARTTIM0 = 0x53, ARTTIM0 = 0x53,
DRWTIM0 = 0x54, DRWTIM0 = 0x54,
...@@ -328,9 +331,19 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -328,9 +331,19 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &cmd648_port_ops .port_ops = &cmd648_port_ops
} }
}; };
const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL }; const struct ata_port_info *ppi[] = {
u8 mrdmode; &cmd_info[id->driver_data],
&cmd_info[id->driver_data],
NULL
};
u8 mrdmode, reg;
int rc; int rc;
struct pci_dev *bridge = pdev->bus->self;
/* mobility split bridges don't report enabled ports correctly */
int port_ok = !(bridge && bridge->vendor ==
PCI_VENDOR_ID_MOBILITY_ELECTRONICS);
/* all (with exceptions below) apart from 643 have CNTRL_CH0 bit */
int cntrl_ch0_ok = (id->driver_data != 0);
rc = pcim_enable_device(pdev); rc = pcim_enable_device(pdev);
if (rc) if (rc)
...@@ -341,11 +354,18 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -341,11 +354,18 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
if (pdev->device == PCI_DEVICE_ID_CMD_646) { if (pdev->device == PCI_DEVICE_ID_CMD_646) {
/* Does UDMA work ? */ /* Does UDMA work ? */
if (pdev->revision > 4) if (pdev->revision > 4) {
ppi[0] = &cmd_info[2]; ppi[0] = &cmd_info[2];
ppi[1] = &cmd_info[2];
}
/* Early rev with other problems ? */ /* Early rev with other problems ? */
else if (pdev->revision == 1) else if (pdev->revision == 1) {
ppi[0] = &cmd_info[3]; ppi[0] = &cmd_info[3];
ppi[1] = &cmd_info[3];
}
/* revs 1,2 have no CNTRL_CH0 */
if (pdev->revision < 3)
cntrl_ch0_ok = 0;
} }
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64);
...@@ -354,6 +374,20 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -354,6 +374,20 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
mrdmode |= 0x02; /* Memory read line enable */ mrdmode |= 0x02; /* Memory read line enable */
pci_write_config_byte(pdev, MRDMODE, mrdmode); pci_write_config_byte(pdev, MRDMODE, mrdmode);
/* check for enabled ports */
pci_read_config_byte(pdev, CNTRL, &reg);
if (!port_ok)
dev_printk(KERN_NOTICE, &pdev->dev, "Mobility Bridge detected, ignoring CNTRL port enable/disable\n");
if (port_ok && cntrl_ch0_ok && !(reg & CNTRL_CH0)) {
dev_printk(KERN_NOTICE, &pdev->dev, "Primary port is disabled\n");
ppi[0] = &ata_dummy_port_info;
}
if (port_ok && !(reg & CNTRL_CH1)) {
dev_printk(KERN_NOTICE, &pdev->dev, "Secondary port is disabled\n");
ppi[1] = &ata_dummy_port_info;
}
/* Force PIO 0 here.. */ /* Force PIO 0 here.. */
/* PPC specific fixup copied from old driver */ /* PPC specific fixup copied from old driver */
......
...@@ -210,13 +210,34 @@ static const struct pci_device_id triflex[] = { ...@@ -210,13 +210,34 @@ static const struct pci_device_id triflex[] = {
{ }, { },
}; };
#ifdef CONFIG_PM
static int triflex_ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
{
struct ata_host *host = dev_get_drvdata(&pdev->dev);
int rc = 0;
rc = ata_host_suspend(host, mesg);
if (rc)
return rc;
/*
* We must not disable or powerdown the device.
* APM bios refuses to suspend if IDE is not accessible.
*/
pci_save_state(pdev);
return 0;
}
#endif
static struct pci_driver triflex_pci_driver = { static struct pci_driver triflex_pci_driver = {
.name = DRV_NAME, .name = DRV_NAME,
.id_table = triflex, .id_table = triflex,
.probe = triflex_init_one, .probe = triflex_init_one,
.remove = ata_pci_remove_one, .remove = ata_pci_remove_one,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.suspend = ata_pci_device_suspend, .suspend = triflex_ata_pci_device_suspend,
.resume = ata_pci_device_resume, .resume = ata_pci_device_resume,
#endif #endif
}; };
......
...@@ -1151,6 +1151,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, ...@@ -1151,6 +1151,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
ata_reset_fn_t softreset, ata_reset_fn_t hardreset, ata_reset_fn_t softreset, ata_reset_fn_t hardreset,
ata_postreset_fn_t postreset); ata_postreset_fn_t postreset);
extern void ata_std_error_handler(struct ata_port *ap); extern void ata_std_error_handler(struct ata_port *ap);
extern int ata_link_nr_enabled(struct ata_link *link);
/* /*
* Base operations to inherit from and initializers for sht * Base operations to inherit from and initializers for sht
......
...@@ -608,6 +608,8 @@ ...@@ -608,6 +608,8 @@
#define PCI_DEVICE_ID_MATROX_G550 0x2527 #define PCI_DEVICE_ID_MATROX_G550 0x2527
#define PCI_DEVICE_ID_MATROX_VIA 0x4536 #define PCI_DEVICE_ID_MATROX_VIA 0x4536
#define PCI_VENDOR_ID_MOBILITY_ELECTRONICS 0x14f2
#define PCI_VENDOR_ID_CT 0x102c #define PCI_VENDOR_ID_CT 0x102c
#define PCI_DEVICE_ID_CT_69000 0x00c0 #define PCI_DEVICE_ID_CT_69000 0x00c0
#define PCI_DEVICE_ID_CT_65545 0x00d8 #define PCI_DEVICE_ID_CT_65545 0x00d8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment