From: Jeff Garzik <jgarzik@pobox.com>
To: Shane Huang <shane.huang@amd.com>
Cc: linux-ide@vger.kernel.org, Tejun Heo <htejun@gmail.com>
Subject: Re: [PATCH RESEND] ahci: implement aggressive SATA device sleep support
Date: Fri, 17 Aug 2012 13:53:11 -0400 [thread overview]
Message-ID: <502E8507.8060806@pobox.com> (raw)
In-Reply-To: <1344361476-2154-1-git-send-email-shane.huang@amd.com>
On 08/07/2012 01:44 PM, Shane Huang wrote:
> @@ -702,6 +708,16 @@ static int ahci_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
> }
> }
>
> + /* set aggressive device sleep */
> + if ((hpriv->cap2 & HOST_CAP2_SDS) &&
> + (hpriv->cap2 & HOST_CAP2_SADM) &&
> + (link->device->flags & ATA_DFLAG_DEVSLP)) {
> + if (policy == ATA_LPM_MIN_POWER)
> + ahci_set_aggressive_devslp(ap, true);
> + else
> + ahci_set_aggressive_devslp(ap, false);
> + }
> +
> if (policy == ATA_LPM_MAX_POWER) {
> sata_link_scr_lpm(link, policy, false);
>
> @@ -1889,6 +1905,55 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
> ahci_kick_engine(ap);
> }
>
> +static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
> +{
> + void __iomem *port_mmio = ahci_port_base(ap);
> + u32 devslp, dm, dito;
> + int rc;
> + unsigned int err_mask;
> +
> + devslp = readl(port_mmio + PORT_DEVSLP);
> + if (!(devslp & PORT_DEVSLP_DSP)) {
> + dev_err(ap->host->dev, "port does not support device sleep\n");
> + return;
> + }
> +
> + /* disable device sleep */
> + if (!sleep) {
> + writel(devslp & ~PORT_DEVSLP_ADSE, port_mmio + PORT_DEVSLP);
> + return;
> + }
> +
> + /* device sleep was already enabled */
> + if (devslp & PORT_DEVSLP_ADSE)
> + return;
Mostly OK. A question and a comment.
* for the !sleep case, don't writel() if the devslp value is unchanged
* if we are disabling sleep -- a valid case where host & device both
support it, but policy denies it -- do we need to stop the ahci engine
as is done in the enabling case?
next prev parent reply other threads:[~2012-08-17 17:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 17:44 [PATCH RESEND] ahci: implement aggressive SATA device sleep support Shane Huang
2012-08-17 17:53 ` Jeff Garzik [this message]
2012-08-19 15:48 ` Huang, Shane
2012-08-22 10:23 ` David Woodhouse
2012-08-22 10:49 ` Huang, Shane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502E8507.8060806@pobox.com \
--to=jgarzik@pobox.com \
--cc=htejun@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=shane.huang@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.