[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110620020125.GA26125@linux-sh.org>
Date: Mon, 20 Jun 2011 11:01:32 +0900
From: Paul Mundt <lethal@...ux-sh.org>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Magnus Damm <magnus.damm@...il.com>,
Linux PM mailing list <linux-pm@...ts.linux-foundation.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
Paul Walmsley <paul@...an.com>, Kevin Hilman <khilman@...com>,
Alan Stern <stern@...land.harvard.edu>,
LKML <linux-kernel@...r.kernel.org>, linux-sh@...r.kernel.org
Subject: Re: [Update][PATCH 8/8] ARM / shmobile: Support for I/O power domains for SH7372 (v6)
On Mon, Jun 20, 2011 at 12:07:47AM +0200, Rafael J. Wysocki wrote:
> +static int pd_power_down(struct generic_pm_domain *genpd)
> +{
> + struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
> + unsigned int mask = 1 << sh7372_pd->bit_shift;
> +
> + if (__raw_readl(PSTR) & mask) {
> + __raw_writel(mask, SPDCR);
> +
> + while (__raw_readl(SPDCR) & mask)
> + cpu_relax();
> +
> + pr_debug("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n",
> + mask, __raw_readl(PSTR));
> + }
> +
> + return 0;
> +}
> +
> +static int pd_power_up(struct generic_pm_domain *genpd)
> +{
> + struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
> + unsigned int mask = 1 << sh7372_pd->bit_shift;
> +
> + if (!(__raw_readl(PSTR) & mask)) {
> + __raw_writel(mask, SWUCR);
> +
> + while (__raw_readl(SWUCR) & mask)
> + cpu_relax();
> +
> + pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n",
> + mask, __raw_readl(PSTR));
> + }
> +
> + return 0;
> +}
> +
Given that these functions can return errors, it's probably more prudent
to implement some timeout logic on top of the busy loop. Hardware does
get stuck, after all.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists