Commit 9a47a8dc authored by Linus Walleij's avatar Linus Walleij

mfd: prcmu: pass a base and size with the early initcall

This patch will make an early remapping of the PRCMU, to be
used when setting up the clocks, that will call down into parts
of the PRCMU driver before it is probed.

Going forward this will be removed like this:

- The mailbox subsystem need to be merged.
  http://marc.info/?l=linux-kernel&m=136314559201983&w=2

- At this point the PRCMU clock code can be moved over to the
  ux500 clock driver in drivers/clk/ux500/* and maintained
  there in a decentralized manner.

- This early initcall and PRCMU base parameters become part of
  the ux500_clk_init() call instead.

Cc: Suman Anna <s-anna@ti.com>
Cc: Loic Pallardy <loic.pallardy@st.com>
Acked-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a937536b
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/mfd/db8500-prcmu.h> #include <linux/mfd/dbx500-prcmu.h>
#include <linux/clksrc-dbx500-prcmu.h> #include <linux/clksrc-dbx500-prcmu.h>
#include <linux/sys_soc.h> #include <linux/sys_soc.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -68,13 +68,16 @@ void __init ux500_init_irq(void) ...@@ -68,13 +68,16 @@ void __init ux500_init_irq(void)
* Init clocks here so that they are available for system timer * Init clocks here so that they are available for system timer
* initialization. * initialization.
*/ */
if (cpu_is_u8500_family() || cpu_is_u9540()) if (cpu_is_u8500_family()) {
db8500_prcmu_early_init(); prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
u8500_clk_init();
if (cpu_is_u8500_family() || cpu_is_u9540()) } else if (cpu_is_u9540()) {
prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
u8500_clk_init(); u8500_clk_init();
else if (cpu_is_u8540()) } else if (cpu_is_u8540()) {
prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
u8540_clk_init(); u8540_clk_init();
}
} }
void __init ux500_init_late(void) void __init ux500_init_late(void)
......
...@@ -2825,8 +2825,19 @@ static void dbx500_fw_version_init(struct platform_device *pdev, ...@@ -2825,8 +2825,19 @@ static void dbx500_fw_version_init(struct platform_device *pdev,
} }
} }
void __init db8500_prcmu_early_init(void) void __init db8500_prcmu_early_init(u32 phy_base, u32 size)
{ {
/*
* This is a temporary remap to bring up the clocks. It is
* subsequently replaces with a real remap. After the merge of
* the mailbox subsystem all of this early code goes away, and the
* clock driver can probe independently. An early initcall will
* still be needed, but it can be diverted into drivers/clk/ux500.
*/
prcmu_base = ioremap(phy_base, size);
if (!prcmu_base)
pr_err("%s: ioremap() of prcmu registers failed!\n", __func__);
spin_lock_init(&mb0_transfer.lock); spin_lock_init(&mb0_transfer.lock);
spin_lock_init(&mb0_transfer.dbb_irqs_lock); spin_lock_init(&mb0_transfer.dbb_irqs_lock);
mutex_init(&mb0_transfer.ac_wake_lock); mutex_init(&mb0_transfer.ac_wake_lock);
......
...@@ -489,7 +489,7 @@ struct prcmu_auto_pm_config { ...@@ -489,7 +489,7 @@ struct prcmu_auto_pm_config {
#ifdef CONFIG_MFD_DB8500_PRCMU #ifdef CONFIG_MFD_DB8500_PRCMU
void db8500_prcmu_early_init(void); void db8500_prcmu_early_init(u32 phy_base, u32 size);
int prcmu_set_rc_a2p(enum romcode_write); int prcmu_set_rc_a2p(enum romcode_write);
enum romcode_read prcmu_get_rc_p2a(void); enum romcode_read prcmu_get_rc_p2a(void);
enum ap_pwrst prcmu_get_xp70_current_state(void); enum ap_pwrst prcmu_get_xp70_current_state(void);
...@@ -553,7 +553,7 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value); ...@@ -553,7 +553,7 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
#else /* !CONFIG_MFD_DB8500_PRCMU */ #else /* !CONFIG_MFD_DB8500_PRCMU */
static inline void db8500_prcmu_early_init(void) {} static inline void db8500_prcmu_early_init(u32 phy_base, u32 size) {}
static inline int prcmu_set_rc_a2p(enum romcode_write code) static inline int prcmu_set_rc_a2p(enum romcode_write code)
{ {
......
...@@ -276,9 +276,9 @@ struct prcmu_fw_version { ...@@ -276,9 +276,9 @@ struct prcmu_fw_version {
#if defined(CONFIG_UX500_SOC_DB8500) #if defined(CONFIG_UX500_SOC_DB8500)
static inline void __init prcmu_early_init(void) static inline void prcmu_early_init(u32 phy_base, u32 size)
{ {
return db8500_prcmu_early_init(); return db8500_prcmu_early_init(phy_base, size);
} }
static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
...@@ -500,7 +500,7 @@ static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) ...@@ -500,7 +500,7 @@ static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
} }
#else #else
static inline void __init prcmu_early_init(void) {} static inline void prcmu_early_init(u32 phy_base, u32 size) {}
static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
bool keep_ap_pll) bool keep_ap_pll)
......
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