linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: wenyou.yang@atmel.com (Yang, Wenyou)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 10/14] ARM: at91: pm: find and remap the pmc
Date: Thu, 29 Oct 2015 09:50:15 +0800	[thread overview]
Message-ID: <56317B57.5040703@atmel.com> (raw)
In-Reply-To: <1444660131-14954-11-git-send-email-alexandre.belloni@free-electrons.com>

Hi Alexandre,

Trivial comments.

On 2015/10/12 22:28, Alexandre Belloni wrote:
> To avoid relying on at91_pmc_read(), find the pmc node and remap it
> locally.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>   arch/arm/mach-at91/pm.c | 32 ++++++++++++++++++++++++++------
>   1 file changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index 5c2b60c5a2a1..1dee29b33ff9 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -35,6 +35,8 @@
>   #include "generic.h"
>   #include "pm.h"
>   
> +void __iomem *pmc;
> +
>   /*
>    * FIXME: this is needed to communicate between the pinctrl driver and
>    * the PM implementation in the machine. Possibly part of the PM
> @@ -85,7 +87,7 @@ static int at91_pm_verify_clocks(void)
>   	unsigned long scsr;
>   	int i;
>   
> -	scsr = at91_pmc_read(AT91_PMC_SCSR);
> +	scsr = readl(pmc + AT91_PMC_SCSR);
>   
>   	/* USB must not be using PLLB */
>   	if ((scsr & at91_pm_data.uhp_udp_mask) != 0) {
> @@ -99,8 +101,7 @@ static int at91_pm_verify_clocks(void)
>   
>   		if ((scsr & (AT91_PMC_PCK0 << i)) == 0)
>   			continue;
> -
> -		css = at91_pmc_read(AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
> +		css = readl(pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS;
>   		if (css != AT91_PMC_CSS_SLOW) {
>   			pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css);
>   			return 0;
> @@ -143,8 +144,8 @@ static void at91_pm_suspend(suspend_state_t state)
>   	flush_cache_all();
>   	outer_disable();
>   
> -	at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0],
> -				at91_ramc_base[1], pm_data);
> +	at91_suspend_sram_fn(pmc, at91_ramc_base[0],
> +			     at91_ramc_base[1], pm_data);
>   
>   	outer_resume();
>   }
> @@ -394,13 +395,32 @@ static void __init at91_pm_sram_init(void)
>   			&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
>   }
>   
> +static const struct of_device_id atmel_pmc_ids[] = {
> +	{ .compatible = "atmel,at91rm9200-pmc"  },
> +	{ .compatible = "atmel,at91sam9260-pmc" },
> +	{ .compatible = "atmel,at91sam9g45-pmc" },
> +	{ .compatible = "atmel,at91sam9n12-pmc" },
> +	{ .compatible = "atmel,at91sam9x5-pmc" },
> +	{ .compatible = "atmel,sama5d3-pmc" },
> +	{ /* sentinel */ },
Do we need  compatible for sama5d2 pmc used in sama5d2.dtsi?
{ .compatible = "atmel,sama5d2-pmc" },

> +};
> +
>   static void __init at91_pm_init(void)
>   {
> -	at91_pm_sram_init();
> +	struct device_node *pmc_np;
>   
>   	if (at91_cpuidle_device.dev.platform_data)
>   		platform_device_register(&at91_cpuidle_device);
>   
> +	pmc_np = of_find_matching_node(NULL, atmel_pmc_ids);
> +	pmc = of_iomap(pmc_np, 0);
> +	if (!pmc) {
> +		pr_info("AT91: PM not supported, PMC not found");
Should need "\n" before end of printout.

> +		return;
> +	}
> +
> +	at91_pm_sram_init();
> +
>   	if (at91_suspend_sram_fn)
>   		suspend_set_ops(&at91_pm_ops);
>   	else

Best Regards,
Wenyou Yang

  reply	other threads:[~2015-10-29  1:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 14:28 [PATCH v2 00/14] ARM: at91: PMC driver rework Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 01/14] ARM: at91/dt: use syscon for PMC Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 02/14] clk: at91: make use of syscon to share PMC registers in several drivers Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 03/14] clk: at91: make use of syscon/regmap internally Alexandre Belloni
2015-10-29  1:52   ` Yang, Wenyou
2015-10-12 14:28 ` [PATCH v2 04/14] clk: at91: clk-main: factorize irq handling Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 05/14] clk: at91: make IRQ optional and register them later Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 06/14] clk: at91: only disable available IRQs Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 07/14] clk: at91: pmc: merge at91_pmc_init in atmel_pmc_probe Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 08/14] clk: at91: pmc: move pmc structures to C file Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 09/14] ARM: at91: pm: simply call at91_pm_init Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 10/14] ARM: at91: pm: find and remap the pmc Alexandre Belloni
2015-10-29  1:50   ` Yang, Wenyou [this message]
2015-10-12 14:28 ` [PATCH v2 11/14] ARM: at91: pm: move idle functions to pm.c Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 12/14] ARM: at91: remove useless includes and function prototypes Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 13/14] usb: gadget: atmel: access the PMC using regmap Alexandre Belloni
2015-10-12 14:28 ` [PATCH v2 14/14] clk: at91: pmc: drop at91_pmc_base Alexandre Belloni

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=56317B57.5040703@atmel.com \
    --to=wenyou.yang@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).