Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1319115 > unrolled thread

[PATCH v4 07/13] ARM: at91: pm: find and remap the pmc

Started byAlexandre Belloni <alexandre.belloni@free-electrons.com>
First post2016-01-27 17:20 +0100
Last post2016-01-28 09:40 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 07/13] ARM: at91: pm: find and remap the pmc Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-01-27 17:20 +0100
    [PATCH v5 07/13] ARM: at91: pm: find and remap the pmc Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-01-27 17:30 +0100
    Re: [PATCH v4 07/13] ARM: at91: pm: find and remap the pmc kbuild test robot <lkp@intel.com> - 2016-01-27 19:00 +0100
    Re: [PATCH v4 07/13] ARM: at91: pm: find and remap the pmc Stephen Boyd <sboyd@codeaurora.org> - 2016-01-28 09:40 +0100
      Re: [PATCH v4 07/13] ARM: at91: pm: find and remap the pmc Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-01-28 09:40 +0100

#1319115 — [PATCH v4 07/13] ARM: at91: pm: find and remap the pmc

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-01-27 17:20 +0100
Subject[PATCH v4 07/13] ARM: at91: pm: find and remap the pmc
Message-ID<qVAZ3-6ax-1@gated-at.bofh.it>
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>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 arch/arm/mach-at91/pm.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index db32bf846cef..0a87c98337a9 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"
 
+static 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
@@ -87,7 +89,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) {
@@ -101,8 +103,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;
@@ -145,8 +146,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();
 }
@@ -399,13 +400,33 @@ static void __init at91_pm_sram_init(void)
 			&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
 }
 
+static __initconst 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" },
+	{ .compatible = "atmel,sama5d2-pmc" },
+	{ /* sentinel */ },
+};
+
 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_err("AT91: PM not supported, PMC not found\n");
+		return;
+	}
+
+	at91_pm_sram_init();
+
 	if (at91_suspend_sram_fn)
 		suspend_set_ops(&at91_pm_ops);
 	else
-- 
2.5.0

[toc] | [next] | [standalone]


#1319136 — [PATCH v5 07/13] ARM: at91: pm: find and remap the pmc

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-01-27 17:30 +0100
Subject[PATCH v5 07/13] ARM: at91: pm: find and remap the pmc
Message-ID<qVB8K-6ft-11@gated-at.bofh.it>
In reply to#1319115
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>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---

Changes in v5:
 - properly use __initconst

 arch/arm/mach-at91/pm.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index db32bf846cef..8923efbfa7fa 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"
 
+static 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
@@ -87,7 +89,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) {
@@ -101,8 +103,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;
@@ -145,8 +146,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();
 }
@@ -399,13 +400,33 @@ 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[] __initconst = {
+	{ .compatible = "atmel,at91rm9200-pmc"  },
+	{ .compatible = "atmel,at91sam9260-pmc" },
+	{ .compatible = "atmel,at91sam9g45-pmc" },
+	{ .compatible = "atmel,at91sam9n12-pmc" },
+	{ .compatible = "atmel,at91sam9x5-pmc" },
+	{ .compatible = "atmel,sama5d3-pmc" },
+	{ .compatible = "atmel,sama5d2-pmc" },
+	{ /* sentinel */ },
+};
+
 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_err("AT91: PM not supported, PMC not found\n");
+		return;
+	}
+
+	at91_pm_sram_init();
+
 	if (at91_suspend_sram_fn)
 		suspend_set_ops(&at91_pm_ops);
 	else
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1319197

Fromkbuild test robot <lkp@intel.com>
Date2016-01-27 19:00 +0100
Message-ID<qVCxR-7c1-33@gated-at.bofh.it>
In reply to#1319115

[Multipart message — attachments visible in raw view] — view raw

Hi Alexandre,

[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.5-rc1 next-20160127]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Alexandre-Belloni/ARM-at91-PMC-driver-rework/20160128-002052
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: arm-at91_dt_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   include/linux/of.h: In function 'at91_pm_init':
>> arch/arm/mach-at91/pm.c:403:40: error: atmel_pmc_ids causes a section type conflict with ramc_ids
    static __initconst struct of_device_id atmel_pmc_ids[] = {
                                           ^
   arch/arm/mach-at91/pm.c:320:40: note: 'ramc_ids' was declared here
    static const struct of_device_id const ramc_ids[] __initconst = {
                                           ^

vim +403 arch/arm/mach-at91/pm.c

   397	
   398		/* Copy the pm suspend handler to SRAM */
   399		at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
   400				&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
   401	}
   402	
 > 403	static __initconst struct of_device_id atmel_pmc_ids[] = {
   404		{ .compatible = "atmel,at91rm9200-pmc"  },
   405		{ .compatible = "atmel,at91sam9260-pmc" },
   406		{ .compatible = "atmel,at91sam9g45-pmc" },

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1320414

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-01-28 09:40 +0100
Message-ID<qVQhs-Jf-9@gated-at.bofh.it>
In reply to#1319115
On 01/27, Alexandre Belloni wrote:
> @@ -399,13 +400,33 @@ static void __init at91_pm_sram_init(void)
>  			&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
>  }
>  
> +static __initconst struct of_device_id atmel_pmc_ids[] = {

The kbuild error is weird, but __initconst should come right
before the equals sign (=). Plus it should actually be const.

> +	{ .compatible = "atmel,at91rm9200-pmc"  },
> +	{ .compatible = "atmel,at91sam9260-pmc" },
> +	{ .compatible = "atmel,at91sam9g45-pmc" },
> +	{ .compatible = "atmel,at91sam9n12-pmc" },
> +	{ .compatible = "atmel,at91sam9x5-pmc" },
> +	{ .compatible = "atmel,sama5d3-pmc" },
> +	{ .compatible = "atmel,sama5d2-pmc" },
> +	{ /* sentinel */ },
> +};
> +
>  static void __init at91_pm_init(void)

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1320420

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-01-28 09:40 +0100
Message-ID<qVQht-Jf-25@gated-at.bofh.it>
In reply to#1320414
On 28/01/2016 at 00:33:47 -0800, Stephen Boyd wrote :
> On 01/27, Alexandre Belloni wrote:
> > @@ -399,13 +400,33 @@ static void __init at91_pm_sram_init(void)
> >  			&at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
> >  }
> >  
> > +static __initconst struct of_device_id atmel_pmc_ids[] = {
> 
> The kbuild error is weird, but __initconst should come right
> before the equals sign (=). Plus it should actually be const.
> 

Yeah, I sent v5, right after v4. I had that change but forgot to squash
it.

> > +	{ .compatible = "atmel,at91rm9200-pmc"  },
> > +	{ .compatible = "atmel,at91sam9260-pmc" },
> > +	{ .compatible = "atmel,at91sam9g45-pmc" },
> > +	{ .compatible = "atmel,at91sam9n12-pmc" },
> > +	{ .compatible = "atmel,at91sam9x5-pmc" },
> > +	{ .compatible = "atmel,sama5d3-pmc" },
> > +	{ .compatible = "atmel,sama5d2-pmc" },
> > +	{ /* sentinel */ },
> > +};
> > +
> >  static void __init at91_pm_init(void)
> 
> -- 
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web