Commit a97c4006 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

ata_piix: implement LPM support

Now that DIPM can be used independently from HIPM, ata_piix can
support LPM too.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 6c8ea89c
...@@ -175,6 +175,8 @@ static int piix_sidpr_scr_read(struct ata_link *link, ...@@ -175,6 +175,8 @@ static int piix_sidpr_scr_read(struct ata_link *link,
unsigned int reg, u32 *val); unsigned int reg, u32 *val);
static int piix_sidpr_scr_write(struct ata_link *link, static int piix_sidpr_scr_write(struct ata_link *link,
unsigned int reg, u32 val); unsigned int reg, u32 val);
static int piix_sidpr_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
unsigned hints);
static bool piix_irq_check(struct ata_port *ap); static bool piix_irq_check(struct ata_port *ap);
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
...@@ -348,11 +350,22 @@ static struct ata_port_operations ich_pata_ops = { ...@@ -348,11 +350,22 @@ static struct ata_port_operations ich_pata_ops = {
.set_dmamode = ich_set_dmamode, .set_dmamode = ich_set_dmamode,
}; };
static struct device_attribute *piix_sidpr_shost_attrs[] = {
&dev_attr_link_power_management_policy,
NULL
};
static struct scsi_host_template piix_sidpr_sht = {
ATA_BMDMA_SHT(DRV_NAME),
.shost_attrs = piix_sidpr_shost_attrs,
};
static struct ata_port_operations piix_sidpr_sata_ops = { static struct ata_port_operations piix_sidpr_sata_ops = {
.inherits = &piix_sata_ops, .inherits = &piix_sata_ops,
.hardreset = sata_std_hardreset, .hardreset = sata_std_hardreset,
.scr_read = piix_sidpr_scr_read, .scr_read = piix_sidpr_scr_read,
.scr_write = piix_sidpr_scr_write, .scr_write = piix_sidpr_scr_write,
.set_lpm = piix_sidpr_set_lpm,
}; };
static const struct piix_map_db ich5_map_db = { static const struct piix_map_db ich5_map_db = {
...@@ -984,6 +997,12 @@ static int piix_sidpr_scr_write(struct ata_link *link, ...@@ -984,6 +997,12 @@ static int piix_sidpr_scr_write(struct ata_link *link,
return 0; return 0;
} }
static int piix_sidpr_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
unsigned hints)
{
return sata_link_scr_lpm(link, policy, false);
}
static bool piix_irq_check(struct ata_port *ap) static bool piix_irq_check(struct ata_port *ap)
{ {
if (unlikely(!ap->ioaddr.bmdma_addr)) if (unlikely(!ap->ioaddr.bmdma_addr))
...@@ -1543,6 +1562,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1543,6 +1562,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ata_port_info port_info[2]; struct ata_port_info port_info[2];
const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
struct scsi_host_template *sht = &piix_sht;
unsigned long port_flags; unsigned long port_flags;
struct ata_host *host; struct ata_host *host;
struct piix_host_priv *hpriv; struct piix_host_priv *hpriv;
...@@ -1612,6 +1632,8 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1612,6 +1632,8 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
rc = piix_init_sidpr(host); rc = piix_init_sidpr(host);
if (rc) if (rc)
return rc; return rc;
if (host->ports[0]->ops == &piix_sidpr_sata_ops)
sht = &piix_sidpr_sht;
} }
/* apply IOCFG bit18 quirk */ /* apply IOCFG bit18 quirk */
...@@ -1638,7 +1660,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, ...@@ -1638,7 +1660,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
host->flags |= ATA_HOST_PARALLEL_SCAN; host->flags |= ATA_HOST_PARALLEL_SCAN;
pci_set_master(pdev); pci_set_master(pdev);
return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, &piix_sht); return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
} }
static void piix_remove_one(struct pci_dev *pdev) static void piix_remove_one(struct pci_dev *pdev)
......
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