Re: [PATCH 2/6] ARM: at91: pm: use the mmio-sram pool to access SRAM

2015-01-15 Thread Alexandre Belloni

Hi,

Thank you for your review.

On 15/01/2015 at 08:53:54 +, Yang, Wenyou wrote :
> >  config AT91_SLOW_CLOCK
> > bool "Suspend-to-RAM disables main oscillator"
> > +   select SRAM
> Can we move it under config ARCH_AT91 or other place?
> 
> It may be used for other purposes, more than pm. I thinks
> 

I believe it is better if every SRAM user selects SRAM so that when you
don't have any of those, it is not automatically selected and it reduces
the kernel size.

Regards,

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 2/6] ARM: at91: pm: use the mmio-sram pool to access SRAM

2015-01-15 Thread Yang, Wenyou
Hi Alexandre

> -Original Message-
> From: linux-arm-kernel [mailto:linux-arm-kernel-boun...@lists.infradead.org] 
> On
> Behalf Of Alexandre Belloni
> Sent: Tuesday, January 13, 2015 5:24 AM
> To: Ferre, Nicolas
> Cc: Boris Brezillon; Alexandre Belloni; Jean-Christophe Plagniol-Villard; 
> linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: [PATCH 2/6] ARM: at91: pm: use the mmio-sram pool to access SRAM
> 
> Now that the SRAM is part of a genpool, use it to allocate memory to use for 
> the
> slowclock implementation.
> 
> Signed-off-by: Alexandre Belloni 
> ---
>  arch/arm/mach-at91/Kconfig |  1 +
>  arch/arm/mach-at91/pm.c| 46
> +-
>  2 files changed, 46 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index
> cec0fb5d621a..b7dcef50db23 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -178,6 +178,7 @@ comment "AT91 Feature Selections"
> 
>  config AT91_SLOW_CLOCK
>   bool "Suspend-to-RAM disables main oscillator"
> + select SRAM
Can we move it under config ARCH_AT91 or other place?

It may be used for other purposes, more than pm. I thinks

>   depends on SUSPEND
>   help
> Select this if you want Suspend-to-RAM to save the most power diff 
> --git
> a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index
> 79aa793d1f00..515791edcc60 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -14,10 +14,12 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -222,10 +224,52 @@ void at91_pm_set_standby(void (*at91_standby)(void))
>   }
>  }
> 
> +#ifdef CONFIG_AT91_SLOW_CLOCK
> +static void __init at91_pm_sram_init(void) {
> + struct gen_pool *sram_pool;
> + phys_addr_t sram_pbase;
> + unsigned long sram_base;
> + struct device_node *node;
> + struct platform_device *pdev;
> +
> + node = of_find_compatible_node(NULL, NULL, "mmio-sram");
> + if (!node) {
> + pr_warn("%s: failed to find sram node!\n", __func__);
> + return;
> + }
> +
> + pdev = of_find_device_by_node(node);
> + if (!pdev) {
> + pr_warn("%s: failed to find sram device!\n", __func__);
> + goto put_node;
> + }
> +
> + sram_pool = dev_get_gen_pool(&pdev->dev);
> + if (!sram_pool) {
> + pr_warn("%s: sram pool unavailable!\n", __func__);
> + goto put_node;
> + }
> +
> + sram_base = gen_pool_alloc(sram_pool, at91_slow_clock_sz);
> + if (!sram_base) {
> + pr_warn("%s: unable to alloc ocram!\n", __func__);
> + goto put_node;
> + }
> +
> + sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base);
> + slow_clock = __arm_ioremap_exec(sram_pbase, at91_slow_clock_sz,
> +false);
> +
> +put_node:
> + of_node_put(node);
> +}
> +#endif
> +
> +
>  static int __init at91_pm_init(void)
>  {
>  #ifdef CONFIG_AT91_SLOW_CLOCK
> - slow_clock = (void *) (AT91_IO_VIRT_BASE - at91_slow_clock_sz);
> + at91_pm_sram_init();
>  #endif
> 
>   pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock
> mode)" : ""));
> --
> 2.1.0
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Best Regards,
Wenyou Yang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/