Commit fbc7edca authored by Alexandre Belloni's avatar Alexandre Belloni

ARM: at91: pm: move idle functions to pm.c

Avoid using code from clk/at91 for PM.
This also has the bonus effect of setting arm_pm_idle for sama5 platforms.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 5737b73e
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/system_misc.h>
#include "generic.h" #include "generic.h"
#include "soc.h" #include "soc.h"
...@@ -33,7 +32,6 @@ static void __init at91rm9200_dt_device_init(void) ...@@ -33,7 +32,6 @@ static void __init at91rm9200_dt_device_init(void)
of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
arm_pm_idle = at91rm9200_idle;
at91rm9200_pm_init(); at91rm9200_pm_init();
} }
......
...@@ -62,8 +62,6 @@ static void __init at91sam9_common_init(void) ...@@ -62,8 +62,6 @@ static void __init at91sam9_common_init(void)
soc_dev = soc_device_to_device(soc); soc_dev = soc_device_to_device(soc);
of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
arm_pm_idle = at91sam9_idle;
} }
static void __init at91sam9_dt_device_init(void) static void __init at91sam9_dt_device_init(void)
......
...@@ -18,20 +18,18 @@ ...@@ -18,20 +18,18 @@
extern void __init at91_map_io(void); extern void __init at91_map_io(void);
extern void __init at91_alt_map_io(void); extern void __init at91_alt_map_io(void);
/* idle */
extern void at91rm9200_idle(void);
extern void at91sam9_idle(void);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern void __init at91rm9200_pm_init(void); extern void __init at91rm9200_pm_init(void);
extern void __init at91sam9260_pm_init(void); extern void __init at91sam9260_pm_init(void);
extern void __init at91sam9g45_pm_init(void); extern void __init at91sam9g45_pm_init(void);
extern void __init at91sam9x5_pm_init(void); extern void __init at91sam9x5_pm_init(void);
extern void __init sama5_pm_init(void);
#else #else
static inline void __init at91rm9200_pm_init(void) { } static inline void __init at91rm9200_pm_init(void) { }
static inline void __init at91sam9260_pm_init(void) { } static inline void __init at91sam9260_pm_init(void) { }
static inline void __init at91sam9g45_pm_init(void) { } static inline void __init at91sam9g45_pm_init(void) { }
static inline void __init at91sam9x5_pm_init(void) { } static inline void __init at91sam9x5_pm_init(void) { }
static inline void __init sama5_pm_init(void) { }
#endif #endif
#endif /* _AT91_GENERIC_H */ #endif /* _AT91_GENERIC_H */
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/fncpy.h> #include <asm/fncpy.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/system_misc.h>
#include "generic.h" #include "generic.h"
#include "pm.h" #include "pm.h"
...@@ -354,6 +355,21 @@ static __init void at91_dt_ramc(void) ...@@ -354,6 +355,21 @@ static __init void at91_dt_ramc(void)
at91_pm_set_standby(standby); at91_pm_set_standby(standby);
} }
void at91rm9200_idle(void)
{
/*
* Disable the processor clock. The processor will be automatically
* re-enabled by an interrupt or by a reset.
*/
writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR);
}
void at91sam9_idle(void)
{
writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR);
cpu_do_idle();
}
static void __init at91_pm_sram_init(void) static void __init at91_pm_sram_init(void)
{ {
struct gen_pool *sram_pool; struct gen_pool *sram_pool;
...@@ -411,7 +427,7 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = { ...@@ -411,7 +427,7 @@ static const struct of_device_id atmel_pmc_ids[] __initconst = {
{ /* sentinel */ }, { /* sentinel */ },
}; };
static void __init at91_pm_init(void) static void __init at91_pm_init(void (*pm_idle)(void))
{ {
struct device_node *pmc_np; struct device_node *pmc_np;
...@@ -425,6 +441,9 @@ static void __init at91_pm_init(void) ...@@ -425,6 +441,9 @@ static void __init at91_pm_init(void)
return; return;
} }
if (pm_idle)
arm_pm_idle = pm_idle;
at91_pm_sram_init(); at91_pm_sram_init();
if (at91_suspend_sram_fn) if (at91_suspend_sram_fn)
...@@ -445,7 +464,7 @@ void __init at91rm9200_pm_init(void) ...@@ -445,7 +464,7 @@ void __init at91rm9200_pm_init(void)
at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP; at91_pm_data.uhp_udp_mask = AT91RM9200_PMC_UHP | AT91RM9200_PMC_UDP;
at91_pm_data.memctrl = AT91_MEMCTRL_MC; at91_pm_data.memctrl = AT91_MEMCTRL_MC;
at91_pm_init(); at91_pm_init(at91rm9200_idle);
} }
void __init at91sam9260_pm_init(void) void __init at91sam9260_pm_init(void)
...@@ -453,7 +472,7 @@ void __init at91sam9260_pm_init(void) ...@@ -453,7 +472,7 @@ void __init at91sam9260_pm_init(void)
at91_dt_ramc(); at91_dt_ramc();
at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC;
at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
at91_pm_init(); at91_pm_init(at91sam9_idle);
} }
void __init at91sam9g45_pm_init(void) void __init at91sam9g45_pm_init(void)
...@@ -461,7 +480,7 @@ void __init at91sam9g45_pm_init(void) ...@@ -461,7 +480,7 @@ void __init at91sam9g45_pm_init(void)
at91_dt_ramc(); at91_dt_ramc();
at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP;
at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
at91_pm_init(); at91_pm_init(at91sam9_idle);
} }
void __init at91sam9x5_pm_init(void) void __init at91sam9x5_pm_init(void)
...@@ -469,5 +488,13 @@ void __init at91sam9x5_pm_init(void) ...@@ -469,5 +488,13 @@ void __init at91sam9x5_pm_init(void)
at91_dt_ramc(); at91_dt_ramc();
at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
at91_pm_init(); at91_pm_init(at91sam9_idle);
}
void __init sama5_pm_init(void)
{
at91_dt_ramc();
at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
at91_pm_init(NULL);
} }
...@@ -51,7 +51,7 @@ static void __init sama5_dt_device_init(void) ...@@ -51,7 +51,7 @@ static void __init sama5_dt_device_init(void)
soc_dev = soc_device_to_device(soc); soc_dev = soc_device_to_device(soc);
of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
at91sam9x5_pm_init(); sama5_pm_init();
} }
static const char *const sama5_dt_board_compat[] __initconst = { static const char *const sama5_dt_board_compat[] __initconst = {
......
...@@ -32,21 +32,6 @@ struct at91_pmc { ...@@ -32,21 +32,6 @@ struct at91_pmc {
void __iomem *at91_pmc_base; void __iomem *at91_pmc_base;
EXPORT_SYMBOL_GPL(at91_pmc_base); EXPORT_SYMBOL_GPL(at91_pmc_base);
void at91rm9200_idle(void)
{
/*
* Disable the processor clock. The processor will be automatically
* re-enabled by an interrupt or by a reset.
*/
at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
}
void at91sam9_idle(void)
{
at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
cpu_do_idle();
}
int of_at91_get_clk_range(struct device_node *np, const char *propname, int of_at91_get_clk_range(struct device_node *np, const char *propname,
struct clk_range *range) struct clk_range *range)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment