ARM: OMAP2+: PRCM/omap ctrl cleanups against 3.19-rc1
Subsystems (9)
v2 cover ARM: OMAP2+: PRCM/omap ctrl cleanups against 3.19-rc1
Hi,
Updates since v1:
- fixed omap2/am33xx boot issues
- added regmap support to generic omap clock core
- control module driver converted to use syscon
- dropped patches for removing legacy pad muxing support (this is still needed)
Notes:
- patches 4,5 and 8 not posted as these were already queued by Tony
- the above patches still exist in the test branch though
- patches 22-33 are new
Testing done:
- am335x-evm: boot
- am335x-sk: boot
- am3517-evm: boot
- am43x-epos-evm: boot
- am437x-gp-evm: boot
- omap3-beagle-xm: boot
- omap3-beagle: boot, suspend/resume (ret/off), cpuidle (ret/off)
- am335x-bone: boot
- am335x-boneblack: boot
- dra7xx-evm: boot
- omap5-uevm: boot
- omap4-panda: boot
- omap4-panda-es: boot, suspend/resume (ret)
- omap2430-sdp: boot
- omap3430-sdp: boot
- omap4430-sdp-es23plus: boot
Test branch location:
tree: https://github.com/t-kristo/linux-pm.git
branch: 3.19-rc1-prcm-cleanup
-Tero
PATCH v2 1/33 ARM: OMAP2+: clock: move clock provider infrastructure to clock driver
Splits the clock provider init out of the PRM driver and moves it to clock driver. This is needed so that once the PRCM drivers are separated, they can logically just access the clock driver not needing to go through common PRM code. This would be wrong in the case of control module for example.
--- arch/arm/mach-omap2/clock.c | 67 +++++++++++++++++++++++++++++++------ arch/arm/mach-omap2/clock.h | 4 +-- arch/arm/mach-omap2/prcm-common.h | 2 ++ arch/arm/mach-omap2/prm_common.c | 34 +------------------ 4 files changed, 61 insertions(+), 46 deletions(-)
arch/arm/mach-omap2/clock.c +56 -11
@@ -24,6 +24,7 @@#include <linux/io.h> #include <linux/bitops.h> #include <linux/clk-private.h> +#include <linux/of_address.h> #include <asm/cpu.h> #include <trace/events/power.h>
@@ -73,32 +74,76 @@ struct ti_clk_features ti_clk_features;static bool clkdm_control = true;static LIST_HEAD (clk_hw_omap_clocks); -void __iomem *clk_memmaps[CLK_MAX_MEMMAPS ]; +static void __iomem *clk_memmaps[CLK_MAX_MEMMAPS ]; + +static void clk_memmap_writel (u32 val,void __iomem *reg) +{ +struct clk_omap_reg *r = (struct clk_omap_reg *)® + +writel_relaxed (val, clk_memmaps[r->index] + r->offset); +} + +static u32 clk_memmap_readl (void __iomem *reg) +{ +struct clk_omap_reg *r = (struct clk_omap_reg *)® + +return readl_relaxed (clk_memmaps[r->index] + r->offset); +}void omap2_clk_writel (u32 val,struct clk_hw_omap *clk,void __iomem *reg) { -if (clk->flags &MEMMAP_ADDRESSING ) { -struct clk_omap_reg *r = (struct clk_omap_reg *)® -writel_relaxed (val, clk_memmaps[r->index] + r->offset); - }else { +if (clk->flags &MEMMAP_ADDRESSING ) +clk_memmap_writel (val, reg); +else writel_relaxed (val, reg); - } }u32 omap2_clk_readl (struct clk_hw_omap *clk,void __iomem *reg) {u32 val; -if (clk->flags &MEMMAP_ADDRESSING ) { -struct clk_omap_reg *r = (struct clk_omap_reg *)® - val =readl_relaxed (clk_memmaps[r->index] + r->offset); - }else { +if (clk->flags &MEMMAP_ADDRESSING ) + val =clk_memmap_readl (reg); +else val =readl_relaxed (reg); - }return val; } +static struct ti_clk_ll_ops omap_clk_ll_ops = { + .clk_readl = clk_memmap_readl, + .clk_writel = clk_memmap_writel, +}; + +/** +* omap2_clk_provider_init - initialize a clock provider +* @match_table: DT device table to match for devices to init +* +* Initializes a clock provider module (CM/PRM etc.), allocating the +* memory mapping, allocating the mapping index and initializing the +* low level driver infrastructure. Returns 0 in success, -ENOMEM in +* failure. +*/ +int __init omap2_clk_provider_init (struct of_device_id *match_table) +{ +struct device_node *np; +void __iomem *mem; +static int memmap_index; + + ti_clk_ll_ops = &omap_clk_ll_ops; + +for_each_matching_node (np, match_table) { + mem =of_iomap (np,0 ); +if (!mem) +return -ENOMEM ; + clk_memmaps[memmap_index] = mem; +ti_dt_clk_init_provider (np, memmap_index); + memmap_index++; + } + +return 0 ; +} +/* * OMAP2+ specific clock functions */
arch/arm/mach-omap2/clock.h +2 -2
@@ -268,12 +268,12 @@ extern const struct clksel_rate div_1_3_rates[];extern const struct clksel_rate div_1_4_rates[];extern const struct clksel_rate div31_1to31_rates[]; -extern void __iomem *clk_memmaps[]; -extern int omap2_clkops_enable_clkdm (struct clk_hw *hw);extern void omap2_clkops_disable_clkdm (struct clk_hw *hw);extern void omap_clocks_register (struct omap_clk *oclks,int cnt); +int __init omap2_clk_provider_init (struct of_device_id *match_table); +void __init ti_clk_init_features (void );#endif
arch/arm/mach-omap2/prcm-common.h +2 -0
@@ -517,6 +517,8 @@ struct omap_prcm_irq_setup { .priority = _priority \ } +struct of_device_id ; +extern void omap_prcm_irq_cleanup (void );extern int omap_prcm_register_chain_handler (struct omap_prcm_irq_setup *irq_setup);
arch/arm/mach-omap2/prm_common.c +1 -33
@@ -590,41 +590,9 @@ static const struct of_device_id omap_prcm_dt_match_table[] = { { } }; -static struct clk_hw_omap memmap_dummy_ck = { - .flags =MEMMAP_ADDRESSING , -}; - -static u32 prm_clk_readl (void __iomem *reg) -{ -return omap2_clk_readl (&memmap_dummy_ck, reg); -} - -static void prm_clk_writel (u32 val,void __iomem *reg) -{ -omap2_clk_writel (val, &memmap_dummy_ck, reg); -} - -static struct ti_clk_ll_ops omap_clk_ll_ops = { - .clk_readl = prm_clk_readl, - .clk_writel = prm_clk_writel, -}; -int __init of_prcm_init (void ) { -struct device_node *np; -void __iomem *mem; -int memmap_index =0 ; - - ti_clk_ll_ops = &omap_clk_ll_ops; - -for_each_matching_node (np, omap_prcm_dt_match_table) { - mem =of_iomap (np,0 ); - clk_memmaps[memmap_index] = mem; -ti_dt_clk_init_provider (np, memmap_index); - memmap_index++; - } - -return 0 ; +return omap2_clk_provider_init (omap_prcm_dt_match_table); }static int __init prm_late_init (void )
Signature · 1 line
1.7.9.5
PATCH v2 2/33 ARM: OMAP2+: PRCM: rename of_prcm_init to omap_prcm_init
In reply to Tero KristoThis avoids conflicts in the global namespace, and is more descriptive of the purpose anyway.
--- arch/arm/mach-omap2/io.c | 2 +- arch/arm/mach-omap2/prm.h | 2 +- arch/arm/mach-omap2/prm_common.c | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/io.c +1 -1
@@ -731,7 +731,7 @@ int __init omap_clk_init(void)ti_clk_init_features (); - ret =of_prcm_init (); + ret =omap_prcm_init ();if (ret)return ret;
arch/arm/mach-omap2/prm.h +1 -1
@@ -19,7 +19,7 @@extern void __iomem *prm_base;extern u16 prm_features;extern void omap2_set_globals_prm (void __iomem *prm); -int of_prcm_init (void ); +int omap_prcm_init (void );# endif /*
arch/arm/mach-omap2/prm_common.c +7 -1
@@ -590,7 +590,13 @@ static const struct of_device_id omap_prcm_dt_match_table[] = { { } }; -int __init of_prcm_init (void ) +/** +* omap_prcm_init - low level init for the PRCM drivers +* +* Initializes the low level clock infrastructure for PRCM drivers. +* Returns 0 in success, negative error value in failure. +*/ +int __init omap_prcm_init (void ) {return omap2_clk_provider_init (omap_prcm_dt_match_table); }
Signature · 1 line
1.7.9.5
PATCH v2 3/33 ARM: OMAP2+: PRCM: split PRCM module init to their own driver files
In reply to Tero KristoSplits the clock related provider module inits under their own driver files. Previously this was done for all modules under the common PRM driver.
--- arch/arm/mach-omap2/cm.h | 1 + arch/arm/mach-omap2/cm_common.c | 24 ++++++++++++++++++++++++ arch/arm/mach-omap2/control.c | 20 ++++++++++++++++++++ arch/arm/mach-omap2/control.h | 1 + arch/arm/mach-omap2/io.c | 4 ++++ arch/arm/mach-omap2/prm_common.c | 20 ++++++++------------ 6 files changed, 58 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/cm.h +1 -0
@@ -70,6 +70,7 @@ int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);int omap_cm_module_disable (u8 part,u16 inst,u16 clkctrl_offs);extern int cm_register (struct cm_ll_data *cld);extern int cm_unregister (struct cm_ll_data *cld); +int omap_cm_init (void );# endif
arch/arm/mach-omap2/cm_common.c +24 -0
@@ -15,10 +15,12 @@#include <linux/init.h> #include <linux/errno.h> #include <linux/bug.h> +#include <linux/of.h> #include "cm2xxx.h" #include "cm3xxx.h" #include "cm44xx.h" +#include "clock.h" /* * cm_ll_data: function pointers to SoC-specific implementations of
@@ -212,3 +214,25 @@ int cm_unregister(struct cm_ll_data *cld)return 0 ; } + +static struct of_device_id omap_cm_dt_match_table[] = { + { .compatible ="ti,omap3-cm" }, + { .compatible ="ti,omap4-cm1" }, + { .compatible ="ti,omap4-cm2" }, + { .compatible ="ti,omap5-cm-core-aon" }, + { .compatible ="ti,omap5-cm-core" }, + { .compatible ="ti,dra7-cm-core-aon" }, + { .compatible ="ti,dra7-cm-core" }, + { } +}; + +/** +* omap_cm_init - low level init for the CM drivers +* +* Initializes the low level clock infrastructure for CM drivers. +* Returns 0 in success, negative error value in failure. +*/ +int __init omap_cm_init (void ) +{ +return omap2_clk_provider_init (omap_cm_dt_match_table); +}
arch/arm/mach-omap2/control.c +20 -0
@@ -25,6 +25,7 @@#include "sdrc.h" #include "pm.h" #include "control.h" +#include "clock.h" /* Used by omap3_ctrl_save_padconf() */ #define START_PADCONF_SAVE 0x2
@@ -611,3 +612,22 @@ void __init omap3_ctrl_init(void) omap3_ctrl_setup_d2d_padconf(); }#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ + +static struct of_device_id omap_scrm_dt_match_table[] = { + { .compatible ="ti,am3-scrm" }, + { .compatible ="ti,am4-scrm" }, + { .compatible ="ti,omap2-scrm" }, + { .compatible ="ti,omap3-scrm" }, + { } +}; + +/** +* omap_control_init - low level init for the control driver +* +* Initializes the low level clock infrastructure for control driver. +* Returns 0 in success, negative error value in failure. +*/ +int __init omap_control_init (void ) +{ +return omap2_clk_provider_init (omap_scrm_dt_match_table); +}
arch/arm/mach-omap2/control.h +1 -0
@@ -456,6 +456,7 @@ extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);extern void omap3630_ctrl_disable_rta (void );extern int omap3_ctrl_save_padconf (void );void omap3_ctrl_init (void ); +int omap_control_init (void );extern void omap2_set_globals_control (void __iomem *ctrl,void __iomem *ctrl_pad);#else
arch/arm/mach-omap2/io.c +4 -0
@@ -731,6 +731,10 @@ int __init omap_clk_init(void)ti_clk_init_features (); + ret =omap_control_init (); +if (ret) +return ret; + ret =omap_prcm_init ();if (ret)return ret;
arch/arm/mach-omap2/prm_common.c +8 -12
@@ -35,6 +35,7 @@#include "prm44xx.h" #include "common.h" #include "clock.h" +#include "cm.h" /* * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -568,25 +569,14 @@ int prm_unregister(struct prm_ll_data *pld)static const struct of_device_id omap_prcm_dt_match_table[] = { { .compatible ="ti,am3-prcm" }, - { .compatible ="ti,am3-scrm" }, { .compatible ="ti,am4-prcm" }, - { .compatible ="ti,am4-scrm" }, { .compatible ="ti,omap2-prcm" }, - { .compatible ="ti,omap2-scrm" }, { .compatible ="ti,omap3-prm" }, - { .compatible ="ti,omap3-cm" }, - { .compatible ="ti,omap3-scrm" }, - { .compatible ="ti,omap4-cm1" }, { .compatible ="ti,omap4-prm" }, - { .compatible ="ti,omap4-cm2" }, { .compatible ="ti,omap4-scrm" }, { .compatible ="ti,omap5-prm" }, - { .compatible ="ti,omap5-cm-core-aon" }, { .compatible ="ti,omap5-scrm" }, - { .compatible ="ti,omap5-cm-core" }, { .compatible ="ti,dra7-prm" }, - { .compatible ="ti,dra7-cm-core-aon" }, - { .compatible ="ti,dra7-cm-core" }, { } };
@@ -598,7 +588,13 @@ static const struct of_device_id omap_prcm_dt_match_table[] = {*/ int __init omap_prcm_init (void ) { -return omap2_clk_provider_init (omap_prcm_dt_match_table); +int ret; + + ret =omap2_clk_provider_init (omap_prcm_dt_match_table); +if (ret) +return ret; + +return omap_cm_init (); }static int __init prm_late_init (void )
Signature · 1 line
1.7.9.5
PATCH v2 6/33 ARM: OMAP3: PRM: invert the wkst_mask for the prm_clear_mod_irqs
In reply to Tero KristoThis makes the API the same as used with OMAP2, and makes it possible to implement a generic driver API for the functionality.
--- arch/arm/mach-omap2/pm34xx.c | 18 +++++++++--------- arch/arm/mach-omap2/prm3xxx.c | 8 ++++---- arch/arm/mach-omap2/prm3xxx.h | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/mach-omap2/pm34xx.c +9 -9
@@ -137,9 +137,8 @@ static irqreturn_t _prcm_int_handle_io(int irq, void *unused) {int c; - c =omap3xxx_prm_clear_mod_irqs (WKUP_MOD ,1 , - ~(OMAP3430_ST_IO_MASK | -OMAP3430_ST_IO_CHAIN_MASK )); + c =omap3xxx_prm_clear_mod_irqs (WKUP_MOD ,1 ,OMAP3430_ST_IO_MASK | +OMAP3430_ST_IO_CHAIN_MASK );return c ?IRQ_HANDLED :IRQ_NONE ; }
@@ -154,13 +153,14 @@ static irqreturn_t _prcm_int_handle_wakeup(int irq, void *unused)* IO events before parsing in mux code */ c =omap3xxx_prm_clear_mod_irqs (WKUP_MOD ,1 , -OMAP3430_ST_IO_MASK | -OMAP3430_ST_IO_CHAIN_MASK ); - c +=omap3xxx_prm_clear_mod_irqs (CORE_MOD ,1 ,0 ); - c +=omap3xxx_prm_clear_mod_irqs (OMAP3430_PER_MOD ,1 ,0 ); + ~(OMAP3430_ST_IO_MASK | +OMAP3430_ST_IO_CHAIN_MASK )); + c +=omap3xxx_prm_clear_mod_irqs (CORE_MOD ,1 , ~0 ); + c +=omap3xxx_prm_clear_mod_irqs (OMAP3430_PER_MOD ,1 , ~0 );if (omap_rev () >OMAP3430_REV_ES1_0 ) { - c +=omap3xxx_prm_clear_mod_irqs (CORE_MOD ,3 ,0 ); - c +=omap3xxx_prm_clear_mod_irqs (OMAP3430ES2_USBHOST_MOD ,1 ,0 ); + c +=omap3xxx_prm_clear_mod_irqs (CORE_MOD ,3 , ~0 ); + c +=omap3xxx_prm_clear_mod_irqs (OMAP3430ES2_USBHOST_MOD ,1 , + ~0 ); }return c ?IRQ_HANDLED :IRQ_NONE ;
arch/arm/mach-omap2/prm3xxx.c +4 -4
@@ -217,7 +217,7 @@ static void omap3xxx_prm_restore_irqen(u32 *saved_mask)* omap3xxx_prm_clear_mod_irqs - clear wake-up events from PRCM interrupt * @module: PRM module to clear wakeups from * @regs: register set to clear, 1 or 3 -* @ignore_bits: wakeup status bits to ignore +* @wkst_mask: wkst bits to clear * * The purpose of this function is to clear any wake-up events latched * in the PRCM PM_WKST_x registers. It is possible that a wake-up event
@@ -226,7 +226,7 @@ static void omap3xxx_prm_restore_irqen(u32 *saved_mask)* that any peripheral wake-up events occurring while attempting to * clear the PM_WKST_x are detected and cleared. */ -int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 ignore_bits) +int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask) {u32 wkst, fclk, iclk, clken;u16 wkst_off = (regs ==3 ) ?OMAP3430ES2_PM_WKST3 :PM_WKST1 ;
@@ -238,7 +238,7 @@ int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits) wkst =omap2_prm_read_mod_reg (module, wkst_off); wkst &=omap2_prm_read_mod_reg (module, grpsel_off); - wkst &= ~ignore_bits; + wkst &= wkst_mask;if (wkst) { iclk =omap2_cm_read_mod_reg (module, iclk_off); fclk =omap2_cm_read_mod_reg (module, fclk_off);
@@ -254,7 +254,7 @@ int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits)omap2_cm_set_mod_reg_bits (clken, module, fclk_off);omap2_prm_write_mod_reg (wkst, module, wkst_off); wkst =omap2_prm_read_mod_reg (module, wkst_off); - wkst &= ~ignore_bits; + wkst &= wkst_mask; c++; }omap2_cm_write_mod_reg (iclk, module, iclk_off);
arch/arm/mach-omap2/prm3xxx.h +1 -1
@@ -146,7 +146,7 @@ extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);extern int __init omap3xxx_prm_init (void );extern u32 omap3xxx_prm_get_reset_sources (void ); -int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 ignore_bits); +int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask);void omap3xxx_prm_iva_idle (void );void omap3_prm_reset_modem (void );int omap3xxx_prm_clear_global_cold_reset (void );
Signature · 1 line
1.7.9.5
PATCH v2 7/33 ARM: OMAP2+: PRM: add generic API for clear_mod_irqs
In reply to Tero KristoOMAP2/3 now use generic API for the prm_clear_mod_irqs, the SoC specific implementation details are provided through prm_ll_data.
--- arch/arm/mach-omap2/pm24xx.c | 24 +++++++++++------------- arch/arm/mach-omap2/pm34xx.c | 18 ++++++++---------- arch/arm/mach-omap2/prm.h | 2 ++ arch/arm/mach-omap2/prm2xxx.c | 4 +++- arch/arm/mach-omap2/prm2xxx.h | 2 -- arch/arm/mach-omap2/prm3xxx.c | 3 ++- arch/arm/mach-omap2/prm3xxx.h | 1 - arch/arm/mach-omap2/prm_common.c | 21 +++++++++++++++++++++ 8 files changed, 47 insertions(+), 28 deletions(-)
arch/arm/mach-omap2/pm24xx.c +11 -13
@@ -75,9 +75,9 @@ static int omap2_enter_full_retention(void)/* Clear old wake-up events */ /* REVISIT: These write to reserved bits? */ -omap2xxx_prm_clear_mod_irqs (CORE_MOD ,PM_WKST1 , ~0 ); -omap2xxx_prm_clear_mod_irqs (CORE_MOD ,OMAP24XX_PM_WKST2 , ~0 ); -omap2xxx_prm_clear_mod_irqs (WKUP_MOD ,PM_WKST , ~0 ); +omap_prm_clear_mod_irqs (CORE_MOD ,PM_WKST1 , ~0 ); +omap_prm_clear_mod_irqs (CORE_MOD ,OMAP24XX_PM_WKST2 , ~0 ); +omap_prm_clear_mod_irqs (WKUP_MOD ,PM_WKST , ~0 );pwrdm_set_next_pwrst (core_pwrdm,PWRDM_POWER_RET );pwrdm_set_next_pwrst (mpu_pwrdm,PWRDM_POWER_RET );
@@ -104,18 +104,16 @@ no_sleep:clk_enable (osc_ck);/* clear CORE wake-up events */ -omap2xxx_prm_clear_mod_irqs (CORE_MOD ,PM_WKST1 , ~0 ); -omap2xxx_prm_clear_mod_irqs (CORE_MOD ,OMAP24XX_PM_WKST2 , ~0 ); +omap_prm_clear_mod_irqs (CORE_MOD ,PM_WKST1 , ~0 ); +omap_prm_clear_mod_irqs (CORE_MOD ,OMAP24XX_PM_WKST2 , ~0 );/* wakeup domain events - bit 1: GPT1, bit5 GPIO */ -omap2xxx_prm_clear_mod_irqs (WKUP_MOD ,PM_WKST ,0x4 |0x1 ); +omap_prm_clear_mod_irqs (WKUP_MOD ,PM_WKST ,0x4 |0x1 );/* MPU domain wake events */ -omap2xxx_prm_clear_mod_irqs (OCP_MOD ,OMAP2_PRCM_IRQSTATUS_MPU_OFFSET , -0x1 ); +omap_prm_clear_mod_irqs (OCP_MOD ,OMAP2_PRCM_IRQSTATUS_MPU_OFFSET ,0x1 ); -omap2xxx_prm_clear_mod_irqs (OCP_MOD ,OMAP2_PRCM_IRQSTATUS_MPU_OFFSET , -0x20 ); +omap_prm_clear_mod_irqs (OCP_MOD ,OMAP2_PRCM_IRQSTATUS_MPU_OFFSET ,0x20 );pwrdm_set_next_pwrst (mpu_pwrdm,PWRDM_POWER_ON );pwrdm_set_next_pwrst (core_pwrdm,PWRDM_POWER_ON );
@@ -143,9 +141,9 @@ static void omap2_enter_mpu_retention(void)* it is in retention mode. */ if (omap2_allow_mpu_retention ()) {/* REVISIT: These write to reserved bits? */ -omap2xxx_prm_clear_mod_irqs (CORE_MOD ,PM_WKST1 , ~0 ); -omap2xxx_prm_clear_mod_irqs (CORE_MOD ,OMAP24XX_PM_WKST2 , ~0 ); -omap2xxx_prm_clear_mod_irqs (WKUP_MOD ,PM_WKST , ~0 ); +omap_prm_clear_mod_irqs (CORE_MOD ,PM_WKST1 , ~0 ); +omap_prm_clear_mod_irqs (CORE_MOD ,OMAP24XX_PM_WKST2 , ~0 ); +omap_prm_clear_mod_irqs (WKUP_MOD ,PM_WKST , ~0 );/* Try to enter MPU retention */ pwrdm_set_next_pwrst (mpu_pwrdm,PWRDM_POWER_RET );
arch/arm/mach-omap2/pm34xx.c +8 -10
@@ -137,8 +137,8 @@ static irqreturn_t _prcm_int_handle_io(int irq, void *unused) {int c; - c =omap3xxx_prm_clear_mod_irqs (WKUP_MOD ,1 ,OMAP3430_ST_IO_MASK | -OMAP3430_ST_IO_CHAIN_MASK ); + c =omap_prm_clear_mod_irqs (WKUP_MOD ,1 ,OMAP3430_ST_IO_MASK | +OMAP3430_ST_IO_CHAIN_MASK );return c ?IRQ_HANDLED :IRQ_NONE ; }
@@ -152,15 +152,13 @@ static irqreturn_t _prcm_int_handle_wakeup(int irq, void *unused)* these are handled in a separate handler to avoid acking * IO events before parsing in mux code */ - c =omap3xxx_prm_clear_mod_irqs (WKUP_MOD ,1 , - ~(OMAP3430_ST_IO_MASK | -OMAP3430_ST_IO_CHAIN_MASK )); - c +=omap3xxx_prm_clear_mod_irqs (CORE_MOD ,1 , ~0 ); - c +=omap3xxx_prm_clear_mod_irqs (OMAP3430_PER_MOD ,1 , ~0 ); + c =omap_prm_clear_mod_irqs (WKUP_MOD ,1 , ~(OMAP3430_ST_IO_MASK | +OMAP3430_ST_IO_CHAIN_MASK )); + c +=omap_prm_clear_mod_irqs (CORE_MOD ,1 , ~0 ); + c +=omap_prm_clear_mod_irqs (OMAP3430_PER_MOD ,1 , ~0 );if (omap_rev () >OMAP3430_REV_ES1_0 ) { - c +=omap3xxx_prm_clear_mod_irqs (CORE_MOD ,3 , ~0 ); - c +=omap3xxx_prm_clear_mod_irqs (OMAP3430ES2_USBHOST_MOD ,1 , - ~0 ); + c +=omap_prm_clear_mod_irqs (CORE_MOD ,3 , ~0 ); + c +=omap_prm_clear_mod_irqs (OMAP3430ES2_USBHOST_MOD ,1 , ~0 ); }return c ?IRQ_HANDLED :IRQ_NONE ;
arch/arm/mach-omap2/prm.h +2 -0
@@ -145,6 +145,7 @@ struct prm_ll_data {int (*is_hardreset_asserted)(u8 shift,u8 part,s16 prm_mod,u16 offset);void (*reset_system)(void ); +int (*clear_mod_irqs)(s16 module,u8 regs,u32 wkst_mask); };extern int prm_register (struct prm_ll_data *pld);
@@ -160,6 +161,7 @@ extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);void omap_prm_reset_system (void );void omap_prm_reconfigure_io_chain (void ); +int omap_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask);#endif
arch/arm/mach-omap2/prm2xxx.c +3 -1
@@ -123,13 +123,14 @@ static void omap2xxx_prm_dpll_reset(void)* Clears wakeup status bits for a given module, so that the device can * re-enter idle. */ -void omap2xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask) +static int omap2xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask) {u32 wkst; wkst =omap2_prm_read_mod_reg (module, regs); wkst &= wkst_mask;omap2_prm_write_mod_reg (wkst, module, regs); +return 0 ; }int omap2xxx_clkdm_sleep (struct clockdomain *clkdm)
@@ -216,6 +217,7 @@ static struct prm_ll_data omap2xxx_prm_ll_data = { .deassert_hardreset = &omap2_prm_deassert_hardreset, .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted, .reset_system = &omap2xxx_prm_dpll_reset, + .clear_mod_irqs = &omap2xxx_prm_clear_mod_irqs, };int __init omap2xxx_prm_init (void )
arch/arm/mach-omap2/prm2xxx.h +0 -2
@@ -124,8 +124,6 @@extern int omap2xxx_clkdm_sleep (struct clockdomain *clkdm);extern int omap2xxx_clkdm_wakeup (struct clockdomain *clkdm); -void omap2xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask); -extern int __init omap2xxx_prm_init (void );#endif
arch/arm/mach-omap2/prm3xxx.c +2 -1
@@ -226,7 +226,7 @@ static void omap3xxx_prm_restore_irqen(u32 *saved_mask)* that any peripheral wake-up events occurring while attempting to * clear the PM_WKST_x are detected and cleared. */ -int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask) +static int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask) {u32 wkst, fclk, iclk, clken;u16 wkst_off = (regs ==3 ) ?OMAP3430ES2_PM_WKST3 :PM_WKST1 ;
@@ -664,6 +664,7 @@ static struct prm_ll_data omap3xxx_prm_ll_data = { .deassert_hardreset = &omap2_prm_deassert_hardreset, .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted, .reset_system = &omap3xxx_prm_dpll3_reset, + .clear_mod_irqs = &omap3xxx_prm_clear_mod_irqs, };int __init omap3xxx_prm_init (void )
arch/arm/mach-omap2/prm3xxx.h +0 -1
@@ -146,7 +146,6 @@ extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);extern int __init omap3xxx_prm_init (void );extern u32 omap3xxx_prm_get_reset_sources (void ); -int omap3xxx_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask);void omap3xxx_prm_iva_idle (void );void omap3_prm_reset_modem (void );int omap3xxx_prm_clear_global_cold_reset (void );
arch/arm/mach-omap2/prm_common.c +21 -0
@@ -523,6 +523,27 @@ void omap_prm_reset_system(void) }/** +* omap_prm_clear_mod_irqs - clear wake-up events from PRCM interrupt +* @module: PRM module to clear wakeups from +* @regs: register to clear +* @wkst_mask: wkst bits to clear +* +* Clears any wakeup events for the module and register set defined. +* Uses SoC specific implementation to do the actual wakeup status +* clearing. +*/ +int omap_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask) +{ +if (!prm_ll_data->clear_mod_irqs) { +WARN_ONCE (1 ,"prm: %s: no mapping function defined\n" , + __func__); +return -EINVAL ; + } + +return prm_ll_data->clear_mod_irqs (module, regs, wkst_mask); +} + +/** * prm_register - register per-SoC low-level data with the PRM * @pld: low-level per-SoC OMAP PRM data & function pointers to register *
Signature · 1 line
1.7.9.5
PATCH v2 9/33 ARM: OMAP3+: PRM: add common APIs for prm_vp_check/clear_txdone
In reply to Tero KristoPRM driver now only exports a generic API for clearing / checking VP txdone status.
--- arch/arm/mach-omap2/prm.h | 14 ++++++++++++++ arch/arm/mach-omap2/prm3xxx.c | 6 ++++-- arch/arm/mach-omap2/prm3xxx.h | 4 ---- arch/arm/mach-omap2/prm44xx.c | 6 ++++-- arch/arm/mach-omap2/prm44xx_54xx.h | 4 ---- arch/arm/mach-omap2/prm_common.c | 34 ++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/vp.h | 9 --------- arch/arm/mach-omap2/vp3xxx_data.c | 4 ++-- arch/arm/mach-omap2/vp44xx_data.c | 4 ++-- 9 files changed, 60 insertions(+), 25 deletions(-)
arch/arm/mach-omap2/prm.h +14 -0
@@ -146,6 +146,8 @@ struct prm_ll_data { u16 offset);void (*reset_system)(void );int (*clear_mod_irqs)(s16 module,u8 regs,u32 wkst_mask); +u32 (*vp_check_txdone)(u8 vp_id); +void (*vp_clear_txdone)(u8 vp_id); };extern int prm_register (struct prm_ll_data *pld);
@@ -163,6 +165,18 @@ void omap_prm_reset_system(void);void omap_prm_reconfigure_io_chain (void );int omap_prm_clear_mod_irqs (s16 module,u8 regs,u32 wkst_mask); +/* +* Voltage Processor (VP) identifiers +*/ +#define OMAP3_VP_VDD_MPU_ID 0 +#define OMAP3_VP_VDD_CORE_ID 1 +#define OMAP4_VP_VDD_CORE_ID 0 +#define OMAP4_VP_VDD_IVA_ID 1 +#define OMAP4_VP_VDD_MPU_ID 2 + +u32 omap_prm_vp_check_txdone (u8 vp_id); +void omap_prm_vp_clear_txdone (u8 vp_id); +#endif
arch/arm/mach-omap2/prm3xxx.c +4 -2
@@ -96,7 +96,7 @@ static struct omap3_vp omap3_vp[] = {#define MAX_VP_ID ARRAY_SIZE(omap3_vp); -u32 omap3_prm_vp_check_txdone (u8 vp_id) +static u32 omap3_prm_vp_check_txdone (u8 vp_id) {struct omap3_vp *vp = &omap3_vp[vp_id];u32 irqstatus;
@@ -106,7 +106,7 @@ u32 omap3_prm_vp_check_txdone(u8 vp_id)return irqstatus & vp->tranxdone_status; } -void omap3_prm_vp_clear_txdone (u8 vp_id) +static void omap3_prm_vp_clear_txdone (u8 vp_id) {struct omap3_vp *vp = &omap3_vp[vp_id];
@@ -665,6 +665,8 @@ static struct prm_ll_data omap3xxx_prm_ll_data = { .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted, .reset_system = &omap3xxx_prm_dpll3_reset, .clear_mod_irqs = &omap3xxx_prm_clear_mod_irqs, + .vp_check_txdone = &omap3_prm_vp_check_txdone, + .vp_clear_txdone = &omap3_prm_vp_clear_txdone, };int __init omap3xxx_prm_init (void )
arch/arm/mach-omap2/prm3xxx.h +0 -4
@@ -132,10 +132,6 @@#ifndef __ASSEMBLER__ -/* OMAP3-specific VP functions */ -u32 omap3_prm_vp_check_txdone (u8 vp_id); -void omap3_prm_vp_clear_txdone (u8 vp_id); -/* * OMAP3 access functions for voltage controller (VC) and * voltage proccessor (VP) in the PRM.
arch/arm/mach-omap2/prm44xx.c +4 -2
@@ -137,7 +137,7 @@ static struct omap4_vp omap4_vp[] = { }, }; -u32 omap4_prm_vp_check_txdone (u8 vp_id) +static u32 omap4_prm_vp_check_txdone (u8 vp_id) {struct omap4_vp *vp = &omap4_vp[vp_id];u32 irqstatus;
@@ -148,7 +148,7 @@ u32 omap4_prm_vp_check_txdone(u8 vp_id)return irqstatus & vp->tranxdone_status; } -void omap4_prm_vp_clear_txdone (u8 vp_id) +static void omap4_prm_vp_clear_txdone (u8 vp_id) {struct omap4_vp *vp = &omap4_vp[vp_id];
@@ -698,6 +698,8 @@ static struct prm_ll_data omap44xx_prm_ll_data = { .deassert_hardreset = omap4_prminst_deassert_hardreset, .is_hardreset_asserted = omap4_prminst_is_hardreset_asserted, .reset_system = omap4_prminst_global_warm_sw_reset, + .vp_check_txdone = omap4_prm_vp_check_txdone, + .vp_clear_txdone = omap4_prm_vp_clear_txdone, };int __init omap44xx_prm_init (void )
arch/arm/mach-omap2/prm44xx_54xx.h +0 -4
@@ -26,10 +26,6 @@/* Function prototypes */ #ifndef __ASSEMBLER__ -/* OMAP4/OMAP5-specific VP functions */ -u32 omap4_prm_vp_check_txdone (u8 vp_id); -void omap4_prm_vp_clear_txdone (u8 vp_id); -/* * OMAP4/OMAP5 access functions for voltage controller (VC) and * voltage proccessor (VP) in the PRM.
arch/arm/mach-omap2/prm_common.c +34 -0
@@ -544,6 +544,40 @@ int omap_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask) }/** +* omap_prm_vp_check_txdone - check voltage processor TX done status +* +* Checks if voltage processor transmission has been completed. +* Returns non-zero if a transmission has completed, 0 otherwise. +*/ +u32 omap_prm_vp_check_txdone (u8 vp_id) +{ +if (!prm_ll_data->vp_check_txdone) { +WARN_ONCE (1 ,"prm: %s: no mapping function defined\n" , + __func__); +return 0 ; + } + +return prm_ll_data->vp_check_txdone (vp_id); +} + +/** +* omap_prm_vp_clear_txdone - clears voltage processor TX done status +* +* Clears the status bit for completed voltage processor transmission +* returned by prm_vp_check_txdone. +*/ +void omap_prm_vp_clear_txdone (u8 vp_id) +{ +if (!prm_ll_data->vp_clear_txdone) { +WARN_ONCE (1 ,"prm: %s: no mapping function defined\n" , + __func__); +return ; + } + + prm_ll_data->vp_clear_txdone (vp_id); +} + +/** * prm_register - register per-SoC low-level data with the PRM * @pld: low-level per-SoC OMAP PRM data & function pointers to register *
arch/arm/mach-omap2/vp.h +0 -9
@@ -21,15 +21,6 @@struct voltagedomain ; -/* -* Voltage Processor (VP) identifiers -*/ -#define OMAP3_VP_VDD_MPU_ID 0 -#define OMAP3_VP_VDD_CORE_ID 1 -#define OMAP4_VP_VDD_CORE_ID 0 -#define OMAP4_VP_VDD_IVA_ID 1 -#define OMAP4_VP_VDD_MPU_ID 2 -/* XXX document */ #define VP_IDLE_TIMEOUT 200#define VP_TRANXDONE_TIMEOUT 300
arch/arm/mach-omap2/vp3xxx_data.c +2 -2
@@ -28,8 +28,8 @@#include "prm2xxx_3xxx.h" static const struct omap_vp_ops omap3_vp_ops = { - .check_txdone = omap3_prm_vp_check_txdone, - .clear_txdone = omap3_prm_vp_clear_txdone, + .check_txdone = omap_prm_vp_check_txdone, + .clear_txdone = omap_prm_vp_clear_txdone, };/*
arch/arm/mach-omap2/vp44xx_data.c +2 -2
@@ -28,8 +28,8 @@#include "vp.h" static const struct omap_vp_ops omap4_vp_ops = { - .check_txdone = omap4_prm_vp_check_txdone, - .clear_txdone = omap4_prm_vp_clear_txdone, + .check_txdone = omap_prm_vp_check_txdone, + .clear_txdone = omap_prm_vp_clear_txdone, };/*
Signature · 1 line
1.7.9.5
PATCH v2 10/33 ARM: OMAP4+: PRM: move omap_prm_base_init under OMAP4 PRM driver
In reply to Tero KristoThere is no need to call this separately from io.c, rather this can be done commonly under the PRM driver.
--- arch/arm/mach-omap2/io.c | 4 ---- arch/arm/mach-omap2/prm44xx.c | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/io.c +0 -4
@@ -591,7 +591,6 @@ void __init am43xx_init_early(void) NULL);omap2_set_globals_prm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE ));omap2_set_globals_cm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE ),NULL ); -omap_prm_base_init ();omap_cm_base_init ();omap3xxx_check_revision ();am33xx_check_features ();
@@ -622,7 +621,6 @@ void __init omap4430_init_early(void)omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP4430_CM_BASE ),OMAP2_L4_IO_ADDRESS (OMAP4430_CM2_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE )); -omap_prm_base_init ();omap_cm_base_init ();omap4xxx_check_revision ();omap4xxx_check_features ();
@@ -658,7 +656,6 @@ void __init omap5_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early (); -omap_prm_base_init ();omap_cm_base_init ();omap44xx_prm_init ();omap5xxx_check_revision ();
@@ -690,7 +687,6 @@ void __init dra7xx_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early (); -omap_prm_base_init ();omap_cm_base_init ();omap44xx_prm_init ();dra7xxx_check_revision ();
arch/arm/mach-omap2/prm44xx.c +2 -0
@@ -704,6 +704,8 @@ static struct prm_ll_data omap44xx_prm_ll_data = {int __init omap44xx_prm_init (void ) { +omap_prm_base_init (); +if (cpu_is_omap44xx () ||soc_is_omap54xx () ||soc_is_dra7xx ()) prm_features |=PRM_HAS_IO_WAKEUP ;
Signature · 1 line
1.7.9.5
PATCH v2 11/33 ARM: OMAP4+: CM: move omap_cm_base_init under OMAP4 CM driver
In reply to Tero KristoThere is no need to call this separately from io.c, rather this can be done commonly under the CM driver. Also, this patch makes the API static, as it is no longer used outside the driver file.
--- arch/arm/mach-omap2/cm44xx.h | 1 - arch/arm/mach-omap2/cminst44xx.c | 4 +++- arch/arm/mach-omap2/io.c | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/cm44xx.h +0 -1
@@ -23,7 +23,6 @@#define OMAP4_CM_CLKSTCTRL 0x0000#define OMAP4_CM_STATICDEP 0x0004 -void omap_cm_base_init (void );int omap4_cm_init (void );#endif
arch/arm/mach-omap2/cminst44xx.c +3 -1
@@ -63,7 +63,7 @@ static void __iomem *_cm_bases[OMAP4_MAX_PRCM_PARTITIONS];* Populates the base addresses of the _cm_bases * array used for read/write of cm module registers. */ -void omap_cm_base_init (void ) +static void omap_cm_base_init (void ) { _cm_bases[OMAP4430_PRM_PARTITION ] = prm_base; _cm_bases[OMAP4430_CM1_PARTITION ] = cm_base;
@@ -516,6 +516,8 @@ static struct cm_ll_data omap4xxx_cm_ll_data = {int __init omap4_cm_init (void ) { +omap_cm_base_init (); +return cm_register (&omap4xxx_cm_ll_data); }
arch/arm/mach-omap2/io.c +0 -4
@@ -591,7 +591,6 @@ void __init am43xx_init_early(void) NULL);omap2_set_globals_prm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE ));omap2_set_globals_cm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE ),NULL ); -omap_cm_base_init ();omap3xxx_check_revision ();am33xx_check_features ();omap44xx_prm_init ();
@@ -621,7 +620,6 @@ void __init omap4430_init_early(void)omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP4430_CM_BASE ),OMAP2_L4_IO_ADDRESS (OMAP4430_CM2_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE )); -omap_cm_base_init ();omap4xxx_check_revision ();omap4xxx_check_features ();omap4_cm_init ();
@@ -656,7 +654,6 @@ void __init omap5_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early (); -omap_cm_base_init ();omap44xx_prm_init ();omap5xxx_check_revision ();omap4_cm_init ();
@@ -687,7 +684,6 @@ void __init dra7xx_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early (); -omap_cm_base_init ();omap44xx_prm_init ();dra7xxx_check_revision ();omap4_cm_init ();
Signature · 1 line
1.7.9.5
PATCH v2 12/33 ARM: OMAP2+: clock: add support for static clock memmap indexes
In reply to Tero KristoAll clock provider related drivers will now register their iomaps individually, and provide index number to the provider init. The clock related drivers also add support for providing init data through the DT match functionality; this is initially used only to provide the index variable, but can be expanded later to provide more functionality.
--- arch/arm/mach-omap2/clock.c | 32 +++++++++++++-------------- arch/arm/mach-omap2/clock.h | 10 ++++++++- arch/arm/mach-omap2/cm_common.c | 43 +++++++++++++++++++++++++++++------- arch/arm/mach-omap2/control.c | 37 ++++++++++++++++++++++++++----- arch/arm/mach-omap2/prcm-common.h | 8 +++++++ arch/arm/mach-omap2/prm_common.c | 44 +++++++++++++++++++++++++++---------- 6 files changed, 131 insertions(+), 43 deletions(-)
arch/arm/mach-omap2/clock.c +15 -17
@@ -117,30 +117,28 @@ static struct ti_clk_ll_ops omap_clk_ll_ops = {/** * omap2_clk_provider_init - initialize a clock provider -* @match_table: DT device table to match for devices to init +* @np: device node for initializing the clock provider +* @index: memory map index for the clock provider +* @mem: iomem pointer for the memory map * -* Initializes a clock provider module (CM/PRM etc.), allocating the -* memory mapping, allocating the mapping index and initializing the -* low level driver infrastructure. Returns 0 in success, -ENOMEM in -* failure. +* Initializes a clock provider module (CM/PRM etc.), registering +* the iomap and initializing the low level driver infrastructure. +* Returns 0 in success, -EINVAL if multiple registration is attempted. */ -int __init omap2_clk_provider_init (struct of_device_id *match_table) +int __init omap2_clk_provider_init (struct device_node *np,int index, +void __iomem *mem) { -struct device_node *np; -void __iomem *mem; -static int memmap_index; - ti_clk_ll_ops = &omap_clk_ll_ops; -for_each_matching_node (np, match_table) { - mem =of_iomap (np,0 ); -if (!mem) -return -ENOMEM ; - clk_memmaps[memmap_index] = mem; -ti_dt_clk_init_provider (np, memmap_index); - memmap_index++; +if (clk_memmaps[index]) { +pr_err ("%s: duplicate registration for index %d!\n" , __func__, + index); +return -EINVAL ; } + clk_memmaps[index] = mem; +ti_dt_clk_init_provider (np, index); +return 0 ; }
arch/arm/mach-omap2/clock.h +9 -1
@@ -236,6 +236,13 @@ struct ti_clk_features {#define TI_CLK_DPLL_HAS_FREQSEL (1 << 0)#define TI_CLK_DPLL4_DENY_REPROGRAM (1 << 1) +enum { +CLK_MEMMAP_INDEX_PRM =0 , +CLK_MEMMAP_INDEX_CM1 , +CLK_MEMMAP_INDEX_CM2 , +CLK_MEMMAP_INDEX_SCRM , +}; +extern struct ti_clk_features ti_clk_features;extern const struct clkops clkops_omap2_dflt_wait;
@@ -273,7 +280,8 @@ extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);extern void omap_clocks_register (struct omap_clk *oclks,int cnt); -int __init omap2_clk_provider_init (struct of_device_id *match_table); +int __init omap2_clk_provider_init (struct device_node *np,int index, +void __iomem *mem);void __init ti_clk_init_features (void );#endif
arch/arm/mach-omap2/cm_common.c +35 -8
60 lines not on this page · raw message
arch/arm/mach-omap2/control.c +32 -5
@@ -14,6 +14,7 @@#include <linux/kernel.h> #include <linux/io.h> +#include <linux/of_address.h> #include "soc.h" #include "iomap.h"
@@ -613,11 +614,19 @@ void __init omap3_ctrl_init(void) }#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ +struct control_init_data { +int index; +}; + +static const struct control_init_data ctrl_data = { + .index =CLK_MEMMAP_INDEX_SCRM , +}; +static struct of_device_id omap_scrm_dt_match_table[] = { - { .compatible ="ti,am3-scrm" }, - { .compatible ="ti,am4-scrm" }, - { .compatible ="ti,omap2-scrm" }, - { .compatible ="ti,omap3-scrm" }, + { .compatible ="ti,am3-scrm" , .data = &ctrl_data }, + { .compatible ="ti,am4-scrm" , .data = &ctrl_data }, + { .compatible ="ti,omap2-scrm" , .data = &ctrl_data }, + { .compatible ="ti,omap3-scrm" , .data = &ctrl_data }, { } };
@@ -629,5 +638,23 @@ static struct of_device_id omap_scrm_dt_match_table[] = {*/ int __init omap_control_init (void ) { -return omap2_clk_provider_init (omap_scrm_dt_match_table); +struct device_node *np; +const struct of_device_id *match; +const struct control_init_data *data; +void __iomem *mem; +int ret; + +for_each_matching_node_and_match (np, omap_scrm_dt_match_table, &match) { + data = match->data; + + mem =of_iomap (np,0 ); +if (!mem) +return -ENOMEM ; + + ret =omap2_clk_provider_init (np, data->index, mem); +if (ret) +return ret; + } + +return 0 ; }
arch/arm/mach-omap2/prcm-common.h +8 -0
@@ -519,6 +519,14 @@ struct omap_prcm_irq_setup {struct of_device_id ; +/** +* struct omap_prcm_init_data - PRCM driver init data +* @index: clock memory mapping index to be used +*/ +struct omap_prcm_init_data { +int index; +}; +extern void omap_prcm_irq_cleanup (void );extern int omap_prcm_register_chain_handler (struct omap_prcm_irq_setup *irq_setup);
arch/arm/mach-omap2/prm_common.c +32 -12
59 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 13/33 ARM: OMAP2+: CM: determine CM base address from device tree
In reply to Tero KristoThere is no need to provide the CM base address through a low-level API from the low-level IO init, as this information is available through DT. Re-routed the parsing function to be called from the CM drivers also to simplify the implementation under io.c.
--- arch/arm/mach-omap2/cm.h | 1 + arch/arm/mach-omap2/cm2xxx.c | 1 + arch/arm/mach-omap2/cm33xx.c | 1 + arch/arm/mach-omap2/cm3xxx.c | 1 + arch/arm/mach-omap2/cm_common.c | 77 +++++++++++++++++++++++++++++++++---- arch/arm/mach-omap2/cminst44xx.c | 1 + arch/arm/mach-omap2/io.c | 12 +----- arch/arm/mach-omap2/prcm-common.h | 6 +++ 8 files changed, 82 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/cm.h +1 -0
@@ -71,6 +71,7 @@ int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);extern int cm_register (struct cm_ll_data *cld);extern int cm_unregister (struct cm_ll_data *cld);int omap_cm_init (void ); +int omap2_cm_base_init (void );# endif
arch/arm/mach-omap2/cm2xxx.c +1 -0
@@ -395,6 +395,7 @@ static struct cm_ll_data omap2xxx_cm_ll_data = {int __init omap2xxx_cm_init (void ) { +omap2_cm_base_init ();return cm_register (&omap2xxx_cm_ll_data); }
arch/arm/mach-omap2/cm33xx.c +1 -0
@@ -375,6 +375,7 @@ static struct cm_ll_data am33xx_cm_ll_data = {int __init am33xx_cm_init (void ) { +omap2_cm_base_init ();return cm_register (&am33xx_cm_ll_data); }
arch/arm/mach-omap2/cm3xxx.c +1 -0
@@ -673,6 +673,7 @@ static struct cm_ll_data omap3xxx_cm_ll_data = {int __init omap3xxx_cm_init (void ) { +omap2_cm_base_init ();return cm_register (&omap3xxx_cm_ll_data); }
arch/arm/mach-omap2/cm_common.c +69 -8
118 lines not on this page · raw message
arch/arm/mach-omap2/cminst44xx.c +1 -0
@@ -516,6 +516,7 @@ static struct cm_ll_data omap4xxx_cm_ll_data = {int __init omap4_cm_init (void ) { +omap2_cm_base_init ();omap_cm_base_init ();return cm_register (&omap4xxx_cm_ll_data);
arch/arm/mach-omap2/io.c +2 -10
@@ -387,7 +387,6 @@ void __init omap2420_init_early(void)omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP242X_CTRL_BASE ),NULL );omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP2420_PRM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP2420_CM_BASE ),NULL );omap2xxx_check_revision ();omap2xxx_prm_init ();omap2xxx_cm_init ();
@@ -417,7 +416,6 @@ void __init omap2430_init_early(void)omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP243X_CTRL_BASE ),NULL );omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP2430_PRM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP2430_CM_BASE ),NULL );omap2xxx_check_revision ();omap2xxx_prm_init ();omap2xxx_cm_init ();
@@ -451,6 +449,8 @@ void __init omap3_init_early(void)omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP343X_CTRL_BASE ),NULL );omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP3430_PRM_BASE )); + +/* XXX: remove this once OMAP3 is DT only */ omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP3430_CM_BASE ),NULL );omap3xxx_check_revision ();omap3xxx_check_features ();
@@ -564,7 +564,6 @@ void __init am33xx_init_early(void)omap2_set_globals_control (AM33XX_L4_WK_IO_ADDRESS (AM33XX_CTRL_BASE ),NULL );omap2_set_globals_prm (AM33XX_L4_WK_IO_ADDRESS (AM33XX_PRCM_BASE )); -omap2_set_globals_cm (AM33XX_L4_WK_IO_ADDRESS (AM33XX_PRCM_BASE ),NULL );omap3xxx_check_revision ();am33xx_check_features ();am33xx_prm_init ();
@@ -590,7 +589,6 @@ void __init am43xx_init_early(void)omap2_set_globals_control (AM33XX_L4_WK_IO_ADDRESS (AM33XX_CTRL_BASE ),NULL );omap2_set_globals_prm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE )); -omap2_set_globals_cm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE ),NULL );omap3xxx_check_revision ();am33xx_check_features ();omap44xx_prm_init ();
@@ -617,8 +615,6 @@ void __init omap4430_init_early(void)omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP443X_SCM_BASE ),OMAP2_L4_IO_ADDRESS (OMAP443X_CTRL_BASE ));omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP4430_PRM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP4430_CM_BASE ), -OMAP2_L4_IO_ADDRESS (OMAP4430_CM2_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE ));omap4xxx_check_revision ();omap4xxx_check_features ();
@@ -650,8 +646,6 @@ void __init omap5_init_early(void)omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE ),OMAP2_L4_IO_ADDRESS (OMAP54XX_CTRL_BASE ));omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP54XX_CM_CORE_AON_BASE ), -OMAP2_L4_IO_ADDRESS (OMAP54XX_CM_CORE_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early ();omap44xx_prm_init ();
@@ -680,8 +674,6 @@ void __init dra7xx_init_early(void)omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE ),OMAP2_L4_IO_ADDRESS (DRA7XX_CTRL_BASE ));omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (DRA7XX_CM_CORE_AON_BASE ), -OMAP2_L4_IO_ADDRESS (OMAP54XX_CM_CORE_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early ();omap44xx_prm_init ();
arch/arm/mach-omap2/prcm-common.h +6 -0
@@ -522,9 +522,15 @@ struct of_device_id;/** * struct omap_prcm_init_data - PRCM driver init data * @index: clock memory mapping index to be used +* @mem: IO mem pointer for this module +* @offset: module base address offset from the IO base +* @flags: PRCM module init flags */ struct omap_prcm_init_data {int index; +void __iomem *mem; +s16 offset; +u16 flags; };extern void omap_prcm_irq_cleanup (void );
Signature · 1 line
1.7.9.5
PATCH v2 14/33 ARM: OMAP4: PRM: move omap4xxx_prm_init earlier in init order
In reply to Tero KristoOMAP4 has different ordering of PRM and CM init calls in the early init. Re-oder these accordingly for OMAP4 also. This is needed so that we can do some optimizations in the following patches for the PRCM init.
--- arch/arm/mach-omap2/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/io.c +1 -1
@@ -618,9 +618,9 @@ void __init omap4430_init_early(void)omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE ));omap4xxx_check_revision ();omap4xxx_check_features (); +omap44xx_prm_init ();omap4_cm_init ();omap4_pm_init_early (); -omap44xx_prm_init ();omap44xx_voltagedomains_init ();omap44xx_powerdomains_init ();omap44xx_clockdomains_init ();
Signature · 1 line
1.7.9.5
PATCH v2 15/33 ARM: OMAP2+: PRM: determine PRM base address from device tree
In reply to Tero KristoThere is no need to provide the PRM base address through a low-level API from the low-level IO init, as this information is available through DT. Re-routed the parsing function to be called from the PRM drivers also to simplify the implementation under io.c.
--- arch/arm/mach-omap2/io.c | 11 ++------ arch/arm/mach-omap2/prm.h | 1 + arch/arm/mach-omap2/prm2xxx.c | 1 + arch/arm/mach-omap2/prm33xx.c | 1 + arch/arm/mach-omap2/prm3xxx.c | 2 ++ arch/arm/mach-omap2/prm44xx.c | 1 + arch/arm/mach-omap2/prm_common.c | 53 +++++++++++++++++++++++++++++++------- 7 files changed, 52 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/io.c +2 -9
@@ -386,7 +386,6 @@ void __init omap2420_init_early(void) OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP242X_CTRL_BASE ),NULL ); -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP2420_PRM_BASE ));omap2xxx_check_revision ();omap2xxx_prm_init ();omap2xxx_cm_init ();
@@ -415,7 +414,6 @@ void __init omap2430_init_early(void) OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP243X_CTRL_BASE ),NULL ); -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP2430_PRM_BASE ));omap2xxx_check_revision ();omap2xxx_prm_init ();omap2xxx_cm_init ();
@@ -448,9 +446,8 @@ void __init omap3_init_early(void) OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP343X_CTRL_BASE ),NULL ); +/* XXX: remove these two once OMAP3 is DT only */ omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP3430_PRM_BASE )); - -/* XXX: remove this once OMAP3 is DT only */ omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP3430_CM_BASE ),NULL );omap3xxx_check_revision ();omap3xxx_check_features ();
@@ -498,6 +495,7 @@ void __init ti81xx_init_early(void) OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (TI81XX_CTRL_BASE ),NULL ); +/* XXX: remove these two once TI81xx is DT only */ omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (TI81XX_PRCM_BASE ));omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (TI81XX_PRCM_BASE ),NULL );omap3xxx_check_revision ();
@@ -563,7 +561,6 @@ void __init am33xx_init_early(void) AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));omap2_set_globals_control (AM33XX_L4_WK_IO_ADDRESS (AM33XX_CTRL_BASE ),NULL ); -omap2_set_globals_prm (AM33XX_L4_WK_IO_ADDRESS (AM33XX_PRCM_BASE ));omap3xxx_check_revision ();am33xx_check_features ();am33xx_prm_init ();
@@ -588,7 +585,6 @@ void __init am43xx_init_early(void) AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));omap2_set_globals_control (AM33XX_L4_WK_IO_ADDRESS (AM33XX_CTRL_BASE ),NULL ); -omap2_set_globals_prm (AM33XX_L4_WK_IO_ADDRESS (AM43XX_PRCM_BASE ));omap3xxx_check_revision ();am33xx_check_features ();omap44xx_prm_init ();
@@ -614,7 +610,6 @@ void __init omap4430_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP443X_SCM_BASE ),OMAP2_L4_IO_ADDRESS (OMAP443X_CTRL_BASE )); -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP4430_PRM_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE ));omap4xxx_check_revision ();omap4xxx_check_features ();
@@ -645,7 +640,6 @@ void __init omap5_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE ),OMAP2_L4_IO_ADDRESS (OMAP54XX_CTRL_BASE )); -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRM_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early ();omap44xx_prm_init ();
@@ -673,7 +667,6 @@ void __init dra7xx_init_early(void)omap2_set_globals_tap (-1 ,OMAP2_L4_IO_ADDRESS (DRA7XX_TAP_BASE ));omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE ),OMAP2_L4_IO_ADDRESS (DRA7XX_CTRL_BASE )); -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRM_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early ();omap44xx_prm_init ();
arch/arm/mach-omap2/prm.h +1 -0
@@ -20,6 +20,7 @@ extern void __iomem *prm_base;extern u16 prm_features;extern void omap2_set_globals_prm (void __iomem *prm);int omap_prcm_init (void ); +int omap2_prm_base_init (void );# endif /*
arch/arm/mach-omap2/prm2xxx.c +1 -0
@@ -222,6 +222,7 @@ static struct prm_ll_data omap2xxx_prm_ll_data = {int __init omap2xxx_prm_init (void ) { +omap2_prm_base_init ();return prm_register (&omap2xxx_prm_ll_data); }
arch/arm/mach-omap2/prm33xx.c +1 -0
@@ -380,6 +380,7 @@ static struct prm_ll_data am33xx_prm_ll_data = {int __init am33xx_prm_init (void ) { +omap2_prm_base_init ();return prm_register (&am33xx_prm_ll_data); }
arch/arm/mach-omap2/prm3xxx.c +2 -0
@@ -671,6 +671,8 @@ static struct prm_ll_data omap3xxx_prm_ll_data = {int __init omap3xxx_prm_init (void ) { +omap2_prm_base_init (); +if (omap3_has_io_wakeup ()) prm_features |=PRM_HAS_IO_WAKEUP ;
arch/arm/mach-omap2/prm44xx.c +1 -0
@@ -704,6 +704,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {int __init omap44xx_prm_init (void ) { +omap2_prm_base_init ();omap_prm_base_init ();if (cpu_is_omap44xx () ||soc_is_omap54xx () ||soc_is_dra7xx ())
arch/arm/mach-omap2/prm_common.c +44 -9
85 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 16/33 ARM: OMAP2+: control: determine control module base address from DT
In reply to Tero KristoThere is no need to provide the control module base address through a low-level API from the low-level IO init, as this information is available through DT. This patch adds a new API to initialize the control module though, but mostly makes the old API obsolete. The old API can be completely removed once OMAP3 is made DT only.
--- arch/arm/mach-omap2/control.c | 36 ++++++++++++++++++++++++++++++------ arch/arm/mach-omap2/control.h | 1 + arch/arm/mach-omap2/io.c | 39 +++++++++++++++++++++------------------ 3 files changed, 52 insertions(+), 24 deletions(-)
arch/arm/mach-omap2/control.c +30 -6
@@ -616,6 +616,7 @@ void __init omap3_ctrl_init(void)struct control_init_data {int index; +void __iomem *mem; };static const struct control_init_data ctrl_data = {
@@ -631,6 +632,34 @@ static struct of_device_id omap_scrm_dt_match_table[] = { };/** +* omap2_control_base_init - initialize iomappings for the control driver +* +* Detects and initializes the iomappings for the control driver, based +* on the DT data. Returns 0 in success, negative error value +* otherwise. +*/ +int __init omap2_control_base_init (void ) +{ +struct device_node *np; +const struct of_device_id *match; +struct control_init_data *data; +void __iomem *mem; + +for_each_matching_node_and_match (np, omap_scrm_dt_match_table, &match) { + data = (struct control_init_data *)match->data; + + mem =of_iomap (np,0 ); +if (!mem) +return -ENOMEM ; + + omap2_ctrl_base = mem; + data->mem = mem; + } + +return 0 ; +} + +/** * omap_control_init - low level init for the control driver * * Initializes the low level clock infrastructure for control driver.
@@ -641,17 +670,12 @@ int __init omap_control_init(void)struct device_node *np;const struct of_device_id *match;const struct control_init_data *data; -void __iomem *mem;int ret;for_each_matching_node_and_match (np, omap_scrm_dt_match_table, &match) { data = match->data; - mem =of_iomap (np,0 ); -if (!mem) -return -ENOMEM ; - - ret =omap2_clk_provider_init (np, data->index, mem); + ret =omap2_clk_provider_init (np, data->index, data->mem);if (ret)return ret; }
arch/arm/mach-omap2/control.h +1 -0
@@ -456,6 +456,7 @@ extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);extern void omap3630_ctrl_disable_rta (void );extern int omap3_ctrl_save_padconf (void );void omap3_ctrl_init (void ); +int omap2_control_base_init (void );int omap_control_init (void );extern void omap2_set_globals_control (void __iomem *ctrl,void __iomem *ctrl_pad);
arch/arm/mach-omap2/io.c +21 -18
@@ -384,8 +384,7 @@ void __init omap2420_init_early(void)omap2_set_globals_tap (OMAP242X_CLASS ,OMAP2_L4_IO_ADDRESS (0x48014000 ));omap2_set_globals_sdrc (OMAP2_L3_IO_ADDRESS (OMAP2420_SDRC_BASE ),OMAP2_L3_IO_ADDRESS (OMAP2420_SMS_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP242X_CTRL_BASE ), -NULL ); +omap2_control_base_init ();omap2xxx_check_revision ();omap2xxx_prm_init ();omap2xxx_cm_init ();
@@ -412,8 +411,7 @@ void __init omap2430_init_early(void)omap2_set_globals_tap (OMAP243X_CLASS ,OMAP2_L4_IO_ADDRESS (0x4900a000 ));omap2_set_globals_sdrc (OMAP2_L3_IO_ADDRESS (OMAP243X_SDRC_BASE ),OMAP2_L3_IO_ADDRESS (OMAP243X_SMS_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP243X_CTRL_BASE ), -NULL ); +omap2_control_base_init ();omap2xxx_check_revision ();omap2xxx_prm_init ();omap2xxx_cm_init ();
@@ -444,11 +442,15 @@ void __init omap3_init_early(void)omap2_set_globals_tap (OMAP343X_CLASS ,OMAP2_L4_IO_ADDRESS (0x4830A000 ));omap2_set_globals_sdrc (OMAP2_L3_IO_ADDRESS (OMAP343X_SDRC_BASE ),OMAP2_L3_IO_ADDRESS (OMAP343X_SMS_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP343X_CTRL_BASE ), -NULL ); -/* XXX: remove these two once OMAP3 is DT only */ -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP3430_PRM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP3430_CM_BASE ),NULL ); +/* XXX: remove these once OMAP3 is DT only */ +if (!of_have_populated_dt ()) { +omap2_set_globals_control ( +OMAP2_L4_IO_ADDRESS (OMAP343X_CTRL_BASE ),NULL ); +omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (OMAP3430_PRM_BASE )); +omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (OMAP3430_CM_BASE ), +NULL ); + } +omap2_control_base_init ();omap3xxx_check_revision ();omap3xxx_check_features ();omap3xxx_prm_init ();
@@ -493,11 +495,14 @@ void __init ti81xx_init_early(void) {omap2_set_globals_tap (OMAP343X_CLASS ,OMAP2_L4_IO_ADDRESS (TI81XX_TAP_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (TI81XX_CTRL_BASE ), -NULL ); -/* XXX: remove these two once TI81xx is DT only */ -omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (TI81XX_PRCM_BASE )); -omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (TI81XX_PRCM_BASE ),NULL ); +/* XXX: remove these once TI81xx is DT only */ +if (!of_have_populated_dt ()) { +omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (TI81XX_CTRL_BASE ), +NULL ); +omap2_set_globals_prm (OMAP2_L4_IO_ADDRESS (TI81XX_PRCM_BASE )); +omap2_set_globals_cm (OMAP2_L4_IO_ADDRESS (TI81XX_PRCM_BASE ), +NULL ); + }omap3xxx_check_revision ();ti81xx_check_features ();omap3xxx_voltagedomains_init ();
@@ -559,8 +564,7 @@ void __init am33xx_init_early(void) {omap2_set_globals_tap (AM335X_CLASS ,AM33XX_L4_WK_IO_ADDRESS (AM33XX_TAP_BASE )); -omap2_set_globals_control (AM33XX_L4_WK_IO_ADDRESS (AM33XX_CTRL_BASE ), -NULL ); +omap2_control_base_init ();omap3xxx_check_revision ();am33xx_check_features ();am33xx_prm_init ();
@@ -583,8 +587,7 @@ void __init am43xx_init_early(void) {omap2_set_globals_tap (AM335X_CLASS ,AM33XX_L4_WK_IO_ADDRESS (AM33XX_TAP_BASE )); -omap2_set_globals_control (AM33XX_L4_WK_IO_ADDRESS (AM33XX_CTRL_BASE ), -NULL ); +omap2_control_base_init ();omap3xxx_check_revision ();am33xx_check_features ();omap44xx_prm_init ();
Signature · 1 line
1.7.9.5
PATCH v2 17/33 ARM: OMAP2+: PRM: move SoC specific init calls within a generic API
In reply to Tero KristoThis gets rid of need for some exported driver APIs, and simplifies the initialization of the PRM driver. Done in preparation to make PRM a separate driver. The init data is now also passed to the SoC specific implementations, allowing future expansion to add feature flags etc.
--- arch/arm/mach-omap2/io.c | 17 +++++++------- arch/arm/mach-omap2/prcm-common.h | 4 ++++ arch/arm/mach-omap2/prm.h | 1 + arch/arm/mach-omap2/prm2xxx.c | 3 +-- arch/arm/mach-omap2/prm2xxx.h | 2 +- arch/arm/mach-omap2/prm33xx.c | 3 +-- arch/arm/mach-omap2/prm33xx.h | 2 +- arch/arm/mach-omap2/prm3xxx.c | 4 +--- arch/arm/mach-omap2/prm3xxx.h | 2 +- arch/arm/mach-omap2/prm44xx.c | 3 +-- arch/arm/mach-omap2/prm44xx.h | 1 - arch/arm/mach-omap2/prm44xx_54xx.h | 4 +++- arch/arm/mach-omap2/prm54xx.h | 1 - arch/arm/mach-omap2/prm7xx.h | 2 +- arch/arm/mach-omap2/prm_common.c | 43 +++++++++++++++++++++++++++--------- 15 files changed, 58 insertions(+), 34 deletions(-)
arch/arm/mach-omap2/io.c +9 -8
@@ -386,7 +386,7 @@ void __init omap2420_init_early(void) OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));omap2_control_base_init ();omap2xxx_check_revision (); -omap2xxx_prm_init (); +omap2_prcm_base_init ();omap2xxx_cm_init ();omap2xxx_voltagedomains_init ();omap242x_powerdomains_init ();
@@ -413,7 +413,7 @@ void __init omap2430_init_early(void) OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));omap2_control_base_init ();omap2xxx_check_revision (); -omap2xxx_prm_init (); +omap2_prcm_base_init ();omap2xxx_cm_init ();omap2xxx_voltagedomains_init ();omap243x_powerdomains_init ();
@@ -453,7 +453,8 @@ void __init omap3_init_early(void)omap2_control_base_init ();omap3xxx_check_revision ();omap3xxx_check_features (); -omap3xxx_prm_init (); +omap2_prcm_base_init (); +omap3xxx_prm_init (NULL );omap3xxx_cm_init ();omap3xxx_voltagedomains_init ();omap3xxx_powerdomains_init ();
@@ -567,7 +568,7 @@ void __init am33xx_init_early(void)omap2_control_base_init ();omap3xxx_check_revision ();am33xx_check_features (); -am33xx_prm_init (); +omap2_prcm_base_init ();am33xx_cm_init ();am33xx_powerdomains_init ();am33xx_clockdomains_init ();
@@ -590,7 +591,7 @@ void __init am43xx_init_early(void)omap2_control_base_init ();omap3xxx_check_revision ();am33xx_check_features (); -omap44xx_prm_init (); +omap2_prcm_base_init ();omap4_cm_init ();am43xx_powerdomains_init ();am43xx_clockdomains_init ();
@@ -616,7 +617,7 @@ void __init omap4430_init_early(void)omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE ));omap4xxx_check_revision ();omap4xxx_check_features (); -omap44xx_prm_init (); +omap2_prcm_base_init ();omap4_cm_init ();omap4_pm_init_early ();omap44xx_voltagedomains_init ();
@@ -645,7 +646,7 @@ void __init omap5_init_early(void) OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early (); -omap44xx_prm_init (); +omap2_prcm_base_init ();omap5xxx_check_revision ();omap4_cm_init ();omap54xx_voltagedomains_init ();
@@ -672,7 +673,7 @@ void __init dra7xx_init_early(void) OMAP2_L4_IO_ADDRESS(DRA7XX_CTRL_BASE));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE ));omap4_pm_init_early (); -omap44xx_prm_init (); +omap2_prcm_base_init ();dra7xxx_check_revision ();omap4_cm_init ();dra7xx_powerdomains_init ();
arch/arm/mach-omap2/prcm-common.h +4 -0
@@ -525,12 +525,16 @@ struct of_device_id;* @mem: IO mem pointer for this module * @offset: module base address offset from the IO base * @flags: PRCM module init flags +* @init: low level PRCM init function for this module +* @np: device node for this PRCM module */ struct omap_prcm_init_data {int index;void __iomem *mem;s16 offset;u16 flags; +int (*init)(const struct omap_prcm_init_data *data); +struct device_node *np; };extern void omap_prcm_irq_cleanup (void );
arch/arm/mach-omap2/prm.h +1 -0
@@ -21,6 +21,7 @@ extern u16 prm_features;extern void omap2_set_globals_prm (void __iomem *prm);int omap_prcm_init (void );int omap2_prm_base_init (void ); +int omap2_prcm_base_init (void );# endif /*
arch/arm/mach-omap2/prm2xxx.c +1 -2
@@ -220,9 +220,8 @@ static struct prm_ll_data omap2xxx_prm_ll_data = { .clear_mod_irqs = &omap2xxx_prm_clear_mod_irqs, }; -int __init omap2xxx_prm_init (void ) +int __init omap2xxx_prm_init (const struct omap_prcm_init_data *data) { -omap2_prm_base_init ();return prm_register (&omap2xxx_prm_ll_data); }
arch/arm/mach-omap2/prm2xxx.h +1 -1
@@ -124,7 +124,7 @@extern int omap2xxx_clkdm_sleep (struct clockdomain *clkdm);extern int omap2xxx_clkdm_wakeup (struct clockdomain *clkdm); -extern int __init omap2xxx_prm_init (void ); +int __init omap2xxx_prm_init (const struct omap_prcm_init_data *data);#endif
arch/arm/mach-omap2/prm33xx.c +1 -2
@@ -378,9 +378,8 @@ static struct prm_ll_data am33xx_prm_ll_data = { .reset_system = am33xx_prm_global_warm_sw_reset, }; -int __init am33xx_prm_init (void ) +int __init am33xx_prm_init (const struct omap_prcm_init_data *data) { -omap2_prm_base_init ();return prm_register (&am33xx_prm_ll_data); }
arch/arm/mach-omap2/prm33xx.h +1 -1
@@ -118,7 +118,7 @@#define AM33XX_PM_CEFUSE_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0004)#ifndef __ASSEMBLER__ -int am33xx_prm_init (void ); +int am33xx_prm_init (const struct omap_prcm_init_data *data);#endif /* ASSEMBLER */ #endif
arch/arm/mach-omap2/prm3xxx.c +1 -3
@@ -669,10 +669,8 @@ static struct prm_ll_data omap3xxx_prm_ll_data = { .vp_clear_txdone = &omap3_prm_vp_clear_txdone, }; -int __init omap3xxx_prm_init (void ) +int __init omap3xxx_prm_init (const struct omap_prcm_init_data *data) { -omap2_prm_base_init (); -if (omap3_has_io_wakeup ()) prm_features |=PRM_HAS_IO_WAKEUP ;
arch/arm/mach-omap2/prm3xxx.h +1 -1
@@ -140,7 +140,7 @@ extern u32 omap3_prm_vcvp_read(u8 offset);extern void omap3_prm_vcvp_write (u32 val,u8 offset);extern u32 omap3_prm_vcvp_rmw (u32 mask,u32 bits,u8 offset); -extern int __init omap3xxx_prm_init (void ); +int __init omap3xxx_prm_init (const struct omap_prcm_init_data *data);void omap3xxx_prm_iva_idle (void );void omap3_prm_reset_modem (void );int omap3xxx_prm_clear_global_cold_reset (void );
arch/arm/mach-omap2/prm44xx.c +1 -2
@@ -702,9 +702,8 @@ static struct prm_ll_data omap44xx_prm_ll_data = { .vp_clear_txdone = omap4_prm_vp_clear_txdone, }; -int __init omap44xx_prm_init (void ) +int __init omap44xx_prm_init (const struct omap_prcm_init_data *data) { -omap2_prm_base_init ();omap_prm_base_init ();if (cpu_is_omap44xx () ||soc_is_omap54xx () ||soc_is_dra7xx ())
arch/arm/mach-omap2/prm44xx.h +0 -1
@@ -26,7 +26,6 @@#define __ARCH_ARM_MACH_OMAP2_PRM44XX_H#include "prm44xx_54xx.h" -#include "prcm-common.h" #include "prm.h" #define OMAP4430_PRM_BASE 0x4a306000
arch/arm/mach-omap2/prm44xx_54xx.h +3 -1
@@ -23,6 +23,8 @@#ifndef __ARCH_ARM_MACH_OMAP2_PRM44XX_54XX_H#define __ARCH_ARM_MACH_OMAP2_PRM44XX_54XX_H +#include "prcm-common.h" +/* Function prototypes */ #ifndef __ASSEMBLER__
@@ -34,7 +36,7 @@ extern u32 omap4_prm_vcvp_read(u8 offset);extern void omap4_prm_vcvp_write (u32 val,u8 offset);extern u32 omap4_prm_vcvp_rmw (u32 mask,u32 bits,u8 offset); -extern int __init omap44xx_prm_init (void ); +int __init omap44xx_prm_init (const struct omap_prcm_init_data *data);#endif
arch/arm/mach-omap2/prm54xx.h +0 -1
@@ -22,7 +22,6 @@#define __ARCH_ARM_MACH_OMAP2_PRM54XX_H#include "prm44xx_54xx.h" -#include "prcm-common.h" #include "prm.h" #define OMAP54XX_PRM_BASE 0x4ae06000
arch/arm/mach-omap2/prm7xx.h +1 -1
@@ -22,8 +22,8 @@#ifndef __ARCH_ARM_MACH_OMAP2_PRM7XX_H#define __ARCH_ARM_MACH_OMAP2_PRM7XX_H -#include "prm44xx_54xx.h" #include "prcm-common.h" +#include "prm44xx_54xx.h" #include "prm.h" #define DRA7XX_PRM_BASE 0x4ae06000
arch/arm/mach-omap2/prm_common.c +33 -10
82 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 18/33 ARM: OMAP4+: PRM: determine prm_device_inst based on DT compatibility
In reply to Tero KristoPRM device instance offset is now provided through the prm_init_data. This gets rid of some cpu_is_X / soc_is_X calls from PRM core code, preparing for PRM to be its own separate driver.
--- arch/arm/mach-omap2/prcm-common.h | 2 ++ arch/arm/mach-omap2/prm44xx.c | 2 ++ arch/arm/mach-omap2/prm_common.c | 28 +++++++++++++++++++++++++--- arch/arm/mach-omap2/prminst44xx.c | 18 +++++------------- arch/arm/mach-omap2/prminst44xx.h | 1 + 5 files changed, 35 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/prcm-common.h +2 -0
@@ -525,6 +525,7 @@ struct of_device_id;* @mem: IO mem pointer for this module * @offset: module base address offset from the IO base * @flags: PRCM module init flags +* @device_inst_offset: device instance offset within the module address space * @init: low level PRCM init function for this module * @np: device node for this PRCM module */
@@ -533,6 +534,7 @@ struct omap_prcm_init_data {void __iomem *mem;s16 offset;u16 flags; +s32 device_inst_offset;int (*init)(const struct omap_prcm_init_data *data);struct device_node *np; };
arch/arm/mach-omap2/prm44xx.c +2 -0
@@ -712,6 +712,8 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)if (!soc_is_dra7xx ()) prm_features |=PRM_HAS_VOLTAGE ; +omap4_prminst_set_prm_dev_inst (data->device_inst_offset); +return prm_register (&omap44xx_prm_ll_data); }
arch/arm/mach-omap2/prm_common.c +25 -3
@@ -34,6 +34,9 @@#include "prm3xxx.h" #include "prm33xx.h" #include "prm44xx.h" +#include "prm54xx.h" +#include "prm7xx.h" +#include "prcm43xx.h" #include "common.h" #include "clock.h" #include "cm.h"
@@ -647,6 +650,25 @@ static struct omap_prcm_init_data am3_prm_data __initdata = {static struct omap_prcm_init_data omap4_prm_data__initdata = { .index =CLK_MEMMAP_INDEX_PRM , .init = omap44xx_prm_init, + .device_inst_offset =OMAP4430_PRM_DEVICE_INST , +}; + +static struct omap_prcm_init_data omap5_prm_data__initdata = { + .index =CLK_MEMMAP_INDEX_PRM , + .init = omap44xx_prm_init, + .device_inst_offset =OMAP54XX_PRM_DEVICE_INST , +}; + +static struct omap_prcm_init_data dra7_prm_data__initdata = { + .index =CLK_MEMMAP_INDEX_PRM , + .init = omap44xx_prm_init, + .device_inst_offset =DRA7XX_PRM_DEVICE_INST , +}; + +static struct omap_prcm_init_data am4_prm_data__initdata = { + .index =CLK_MEMMAP_INDEX_PRM , + .init = omap44xx_prm_init, + .device_inst_offset =AM43XX_PRM_DEVICE_INST , };static struct omap_prcm_init_data scrm_data__initdata = {
@@ -655,14 +677,14 @@ static struct omap_prcm_init_data scrm_data __initdata = {static struct of_device_id omap_prcm_dt_match_table[]__initdata = { { .compatible ="ti,am3-prcm" , .data = &am3_prm_data }, - { .compatible ="ti,am4-prcm" , .data = &omap4_prm_data }, + { .compatible ="ti,am4-prcm" , .data = &am4_prm_data }, { .compatible ="ti,omap2-prcm" , .data = &omap2_prm_data }, { .compatible ="ti,omap3-prm" , .data = &omap3_prm_data }, { .compatible ="ti,omap4-prm" , .data = &omap4_prm_data }, { .compatible ="ti,omap4-scrm" , .data = &scrm_data }, - { .compatible ="ti,omap5-prm" , .data = &omap4_prm_data }, + { .compatible ="ti,omap5-prm" , .data = &omap5_prm_data }, { .compatible ="ti,omap5-scrm" , .data = &scrm_data }, - { .compatible ="ti,dra7-prm" , .data = &omap4_prm_data }, + { .compatible ="ti,dra7-prm" , .data = &dra7_prm_data }, { } };
arch/arm/mach-omap2/prminst44xx.c +5 -13
@@ -47,22 +47,14 @@ void omap_prm_base_init(void)s32 omap4_prmst_get_prm_dev_inst (void ) { -if (prm_dev_inst !=PRM_INSTANCE_UNKNOWN ) -return prm_dev_inst; - -/* This cannot be done way early at boot.. as things are not setup */ -if (cpu_is_omap44xx ()) - prm_dev_inst =OMAP4430_PRM_DEVICE_INST ; -else if (soc_is_omap54xx ()) - prm_dev_inst =OMAP54XX_PRM_DEVICE_INST ; -else if (soc_is_dra7xx ()) - prm_dev_inst =DRA7XX_PRM_DEVICE_INST ; -else if (soc_is_am43xx ()) - prm_dev_inst =AM43XX_PRM_DEVICE_INST ; -return prm_dev_inst; } +void omap4_prminst_set_prm_dev_inst (s32 dev_inst) +{ + prm_dev_inst = dev_inst; +} +/* Read a register in a PRM instance */ u32 omap4_prminst_read_inst_reg (u8 part,s16 inst,u16 idx) {
arch/arm/mach-omap2/prminst44xx.h +1 -0
@@ -14,6 +14,7 @@#define PRM_INSTANCE_UNKNOWN -1extern s32 omap4_prmst_get_prm_dev_inst (void ); +void omap4_prminst_set_prm_dev_inst (s32 dev_inst);/* * In an ideal world, we would not export these low-level functions,
Signature · 1 line
1.7.9.5
PATCH v2 19/33 ARM: OMAP2+: CM: move SoC specific init calls within a generic API
In reply to Tero KristoThis gets rid of need for some exported driver APIs, and simplifies the initialization of the CM driver. Done in preparation to make CM a separate driver. The init data is now also passed to the SoC specific implementations, allowing future expansion to add feature flags etc.
--- arch/arm/mach-omap2/cm2xxx.c | 3 +-- arch/arm/mach-omap2/cm2xxx.h | 2 +- arch/arm/mach-omap2/cm33xx.c | 3 +-- arch/arm/mach-omap2/cm33xx.h | 3 ++- arch/arm/mach-omap2/cm3xxx.c | 3 +-- arch/arm/mach-omap2/cm3xxx.h | 2 +- arch/arm/mach-omap2/cm44xx.h | 2 +- arch/arm/mach-omap2/cm_common.c | 35 +++++++++++++++++++++++++---------- arch/arm/mach-omap2/cminst44xx.c | 3 +-- arch/arm/mach-omap2/io.c | 14 +++++--------- arch/arm/mach-omap2/prm_common.c | 8 +++++++- 11 files changed, 46 insertions(+), 32 deletions(-)
arch/arm/mach-omap2/cm2xxx.c +1 -2
@@ -393,9 +393,8 @@ static struct cm_ll_data omap2xxx_cm_ll_data = { .wait_module_ready = &omap2xxx_cm_wait_module_ready, }; -int __init omap2xxx_cm_init (void ) +int __init omap2xxx_cm_init (const struct omap_prcm_init_data *data) { -omap2_cm_base_init ();return cm_register (&omap2xxx_cm_ll_data); }
arch/arm/mach-omap2/cm2xxx.h +1 -1
@@ -63,7 +63,7 @@ extern u32 omap2xxx_cm_get_core_pll_config(void);extern void omap2xxx_cm_set_mod_dividers (u32 mpu,u32 dsp,u32 gfx,u32 core,u32 mdm); -extern int __init omap2xxx_cm_init (void ); +int __init omap2xxx_cm_init (const struct omap_prcm_init_data *data);#endif
arch/arm/mach-omap2/cm33xx.c +1 -2
@@ -373,9 +373,8 @@ static struct cm_ll_data am33xx_cm_ll_data = { .module_disable = &am33xx_cm_module_disable, }; -int __init am33xx_cm_init (void ) +int __init am33xx_cm_init (const struct omap_prcm_init_data *data) { -omap2_cm_base_init ();return cm_register (&am33xx_cm_ll_data); }
arch/arm/mach-omap2/cm33xx.h +2 -1
@@ -19,6 +19,7 @@#include "cm.h" #include "cm-regbits-33xx.h" +#include "prcm-common.h" /* CM base address */ #define AM33XX_CM_BASE 0x44e00000
@@ -374,6 +375,6 @@#ifndef __ASSEMBLER__ -int am33xx_cm_init (void ); +int am33xx_cm_init (const struct omap_prcm_init_data *data);#endif /* ASSEMBLER */ #endif
arch/arm/mach-omap2/cm3xxx.c +1 -2
@@ -671,9 +671,8 @@ static struct cm_ll_data omap3xxx_cm_ll_data = { .wait_module_ready = &omap3xxx_cm_wait_module_ready, }; -int __init omap3xxx_cm_init (void ) +int __init omap3xxx_cm_init (const struct omap_prcm_init_data *data) { -omap2_cm_base_init ();return cm_register (&omap3xxx_cm_ll_data); }
arch/arm/mach-omap2/cm3xxx.h +1 -1
@@ -72,7 +72,7 @@ extern void omap3_cm_save_context(void);extern void omap3_cm_restore_context (void );extern void omap3_cm_save_scratchpad_contents (u32 *ptr); -extern int __init omap3xxx_cm_init (void ); +int __init omap3xxx_cm_init (const struct omap_prcm_init_data *data);#endif
arch/arm/mach-omap2/cm44xx.h +1 -1
@@ -23,6 +23,6 @@#define OMAP4_CM_CLKSTCTRL 0x0000#define OMAP4_CM_STATICDEP 0x0004 -int omap4_cm_init (void ); +int omap4_cm_init (const struct omap_prcm_init_data *data);#endif
arch/arm/mach-omap2/cm_common.c +25 -10
@@ -20,6 +20,7 @@#include "cm2xxx.h" #include "cm3xxx.h" +#include "cm33xx.h" #include "cm44xx.h" #include "clock.h"
@@ -37,6 +38,7 @@ void __iomem *cm_base;void __iomem *cm2_base;#define CM_NO_CLOCKS 0x1 +#define CM_SINGLE_INSTANCE 0x2/** * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use)
@@ -218,21 +220,26 @@ int cm_unregister(struct cm_ll_data *cld)return 0 ; } -static struct omap_prcm_init_data cm_data = { +static struct omap_prcm_init_data cm_data__initdata = { .index =CLK_MEMMAP_INDEX_CM1 , + .init = omap4_cm_init, }; -static struct omap_prcm_init_data cm2_data = { +static struct omap_prcm_init_data cm2_data__initdata = { .index =CLK_MEMMAP_INDEX_CM2 , + .init = omap4_cm_init, }; -static struct omap_prcm_init_data omap2_prcm_data = { +static struct omap_prcm_init_data omap2_prcm_data__initdata = { .index =CLK_MEMMAP_INDEX_CM1 , - .flags =CM_NO_CLOCKS , + .init = omap2xxx_cm_init, + .flags =CM_NO_CLOCKS |CM_SINGLE_INSTANCE , }; -static struct omap_prcm_init_data omap3_cm_data = { +static struct omap_prcm_init_data omap3_cm_data__initdata = { .index =CLK_MEMMAP_INDEX_CM1 , + .init = omap3xxx_cm_init, + .flags =CM_SINGLE_INSTANCE ,/* * IVA2 offset is negative value, must offset the cm_base address
@@ -241,17 +248,19 @@ static struct omap_prcm_init_data omap3_cm_data = { .offset = -OMAP3430_IVA2_MOD, }; -static struct omap_prcm_init_data am3_prcm_data = { +static struct omap_prcm_init_data am3_prcm_data__initdata = { .index =CLK_MEMMAP_INDEX_CM1 , - .flags =CM_NO_CLOCKS , + .flags =CM_NO_CLOCKS |CM_SINGLE_INSTANCE , + .init = am33xx_cm_init, }; -static struct omap_prcm_init_data am4_prcm_data = { +static struct omap_prcm_init_data am4_prcm_data__initdata = { .index =CLK_MEMMAP_INDEX_CM1 , - .flags =CM_NO_CLOCKS , + .flags =CM_NO_CLOCKS |CM_SINGLE_INSTANCE , + .init = omap4_cm_init, }; -static struct of_device_id omap_cm_dt_match_table[] = { +static struct of_device_id omap_cm_dt_match_table[]__initdata = { { .compatible ="ti,omap2-prcm" , .data = &omap2_prcm_data }, { .compatible ="ti,omap3-cm" , .data = &omap3_cm_data }, { .compatible ="ti,omap4-cm1" , .data = &cm_data },
@@ -293,6 +302,12 @@ int __init omap2_cm_base_init(void) cm2_base = mem + data->offset; data->mem = mem; + + data->np = np; + +if (data->init && (data->flags &CM_SINGLE_INSTANCE || + (cm_base && cm2_base))) + data->init (data); }return 0 ;
arch/arm/mach-omap2/cminst44xx.c +1 -2
@@ -514,9 +514,8 @@ static struct cm_ll_data omap4xxx_cm_ll_data = { .module_disable = &omap4_cminst_module_disable, }; -int __init omap4_cm_init (void ) +int __init omap4_cm_init (const struct omap_prcm_init_data *data) { -omap2_cm_base_init ();omap_cm_base_init ();return cm_register (&omap4xxx_cm_ll_data);
arch/arm/mach-omap2/io.c +5 -9
@@ -387,7 +387,6 @@ void __init omap2420_init_early(void)omap2_control_base_init ();omap2xxx_check_revision ();omap2_prcm_base_init (); -omap2xxx_cm_init ();omap2xxx_voltagedomains_init ();omap242x_powerdomains_init ();omap242x_clockdomains_init ();
@@ -414,7 +413,6 @@ void __init omap2430_init_early(void)omap2_control_base_init ();omap2xxx_check_revision ();omap2_prcm_base_init (); -omap2xxx_cm_init ();omap2xxx_voltagedomains_init ();omap243x_powerdomains_init ();omap243x_clockdomains_init ();
@@ -454,8 +452,11 @@ void __init omap3_init_early(void)omap3xxx_check_revision ();omap3xxx_check_features ();omap2_prcm_base_init (); -omap3xxx_prm_init (NULL ); -omap3xxx_cm_init (); +/* XXX: remove these once OMAP3 is DT only */ +if (!of_have_populated_dt ()) { +omap3xxx_prm_init (NULL ); +omap3xxx_cm_init (NULL ); + }omap3xxx_voltagedomains_init ();omap3xxx_powerdomains_init ();omap3xxx_clockdomains_init ();
@@ -569,7 +570,6 @@ void __init am33xx_init_early(void)omap3xxx_check_revision ();am33xx_check_features ();omap2_prcm_base_init (); -am33xx_cm_init ();am33xx_powerdomains_init ();am33xx_clockdomains_init ();am33xx_hwmod_init ();
@@ -592,7 +592,6 @@ void __init am43xx_init_early(void)omap3xxx_check_revision ();am33xx_check_features ();omap2_prcm_base_init (); -omap4_cm_init ();am43xx_powerdomains_init ();am43xx_clockdomains_init ();am43xx_hwmod_init ();
@@ -618,7 +617,6 @@ void __init omap4430_init_early(void)omap4xxx_check_revision ();omap4xxx_check_features ();omap2_prcm_base_init (); -omap4_cm_init ();omap4_pm_init_early ();omap44xx_voltagedomains_init ();omap44xx_powerdomains_init ();
@@ -648,7 +646,6 @@ void __init omap5_init_early(void)omap4_pm_init_early ();omap2_prcm_base_init ();omap5xxx_check_revision (); -omap4_cm_init ();omap54xx_voltagedomains_init ();omap54xx_powerdomains_init ();omap54xx_clockdomains_init ();
@@ -675,7 +672,6 @@ void __init dra7xx_init_early(void)omap4_pm_init_early ();omap2_prcm_base_init ();dra7xxx_check_revision (); -omap4_cm_init ();dra7xx_powerdomains_init ();dra7xx_clockdomains_init ();dra7xx_hwmod_init ();
arch/arm/mach-omap2/prm_common.c +7 -1
@@ -725,7 +725,13 @@ int __init omap2_prm_base_init(void)int __init omap2_prcm_base_init (void ) { -return omap2_prm_base_init (); +int ret; + + ret =omap2_prm_base_init (); +if (ret) +return ret; + +return omap2_cm_base_init (); }/**
Signature · 1 line
1.7.9.5
PATCH v2 20/33 ARM: OMAP4+: PRM: setup prm_features from the PRM init time flags
In reply to Tero KristoCurrently some cpu_is_X checks are used to setup prm_features, however the same can be accomplished by just passing these flags from the PRM init data. This is done in preparation to make PRM a separate driver.
--- arch/arm/mach-omap2/prm44xx.c | 4 ++-- arch/arm/mach-omap2/prm_common.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/prm44xx.c +2 -2
@@ -706,10 +706,10 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data) {omap_prm_base_init (); -if (cpu_is_omap44xx () ||soc_is_omap54xx () ||soc_is_dra7xx ()) +if (data->flags &PRM_HAS_IO_WAKEUP ) prm_features |=PRM_HAS_IO_WAKEUP ; -if (!soc_is_dra7xx ()) +if (data->flags &PRM_HAS_VOLTAGE ) prm_features |=PRM_HAS_VOLTAGE ;omap4_prminst_set_prm_dev_inst (data->device_inst_offset);
arch/arm/mach-omap2/prm_common.c +3 -0
@@ -651,18 +651,21 @@ static struct omap_prcm_init_data omap4_prm_data __initdata = { .index = CLK_MEMMAP_INDEX_PRM, .init = omap44xx_prm_init, .device_inst_offset = OMAP4430_PRM_DEVICE_INST, + .flags = PRM_HAS_IO_WAKEUP | PRM_HAS_VOLTAGE, };static struct omap_prcm_init_data omap5_prm_data__initdata = { .index =CLK_MEMMAP_INDEX_PRM , .init = omap44xx_prm_init, .device_inst_offset =OMAP54XX_PRM_DEVICE_INST , + .flags =PRM_HAS_IO_WAKEUP |PRM_HAS_VOLTAGE , };static struct omap_prcm_init_data dra7_prm_data__initdata = { .index =CLK_MEMMAP_INDEX_PRM , .init = omap44xx_prm_init, .device_inst_offset =DRA7XX_PRM_DEVICE_INST , + .flags =PRM_HAS_IO_WAKEUP , };static struct omap_prcm_init_data am4_prm_data__initdata = {
Signature · 1 line
1.7.9.5
PATCH v2 21/33 ARM: OMAP4+: PRM: get rid of cpu_is_omap44xx calls from interrupt init
In reply to Tero KristoThe compatible DT node is now passed with the prm init, so there is no need to do node matching here again. Added a new flag to the init data also, to detect default IRQ support for OMAP4. Also, any booting omap4 DT setup always has a PRM node, so there is no need to check against the special case where it would be missing.
--- arch/arm/mach-omap2/prm.h | 2 ++ arch/arm/mach-omap2/prm44xx.c | 50 +++++++++++++++----------------------- arch/arm/mach-omap2/prm_common.c | 2 +- 3 files changed, 22 insertions(+), 32 deletions(-)
arch/arm/mach-omap2/prm.h +2 -0
@@ -29,9 +29,11 @@ int omap2_prcm_base_init(void);* * PRM_HAS_IO_WAKEUP: has IO wakeup capability * PRM_HAS_VOLTAGE: has voltage domains +* PRM_IRQ_DEFAULT: use default irq number for PRM irq */ #define PRM_HAS_IO_WAKEUP (1 << 0)#define PRM_HAS_VOLTAGE (1 << 1) +#define PRM_IRQ_DEFAULT BIT(2)/* * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
arch/arm/mach-omap2/prm44xx.c +19 -31
76 lines not on this page · raw message
arch/arm/mach-omap2/prm_common.c +1 -1
@@ -651,7 +651,7 @@ static struct omap_prcm_init_data omap4_prm_data __initdata = { .index = CLK_MEMMAP_INDEX_PRM, .init = omap44xx_prm_init, .device_inst_offset = OMAP4430_PRM_DEVICE_INST, - .flags = PRM_HAS_IO_WAKEUP | PRM_HAS_VOLTAGE, + .flags = PRM_HAS_IO_WAKEUP | PRM_HAS_VOLTAGE | PRM_IRQ_DEFAULT, };static struct omap_prcm_init_data omap5_prm_data__initdata = {
Signature · 1 line
1.7.9.5
PATCH v2 22/33 ARM: OMAP2+: clock: convert low-level clock APIs to use regmap
In reply to Tero KristoClock driver will be converted to use regmap, this prepares the low-level register API to use regmap already. Individual driver inits will be converted to use regmap / syscon in following patches.
--- arch/arm/mach-omap2/clock.c | 26 ++++++++++++++++++++------ arch/arm/mach-omap2/clock.h | 4 +++- arch/arm/mach-omap2/cm_common.c | 2 +- arch/arm/mach-omap2/control.c | 2 +- arch/arm/mach-omap2/prm_common.c | 2 +- 5 files changed, 26 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock.c +20 -6
@@ -24,6 +24,7 @@#include <linux/io.h> #include <linux/bitops.h> #include <linux/clk-private.h> +#include <linux/regmap.h> #include <linux/of_address.h> #include <asm/cpu.h>
@@ -74,20 +75,23 @@ struct ti_clk_features ti_clk_features;static bool clkdm_control = true;static LIST_HEAD (clk_hw_omap_clocks); -static void __iomem *clk_memmaps[CLK_MAX_MEMMAPS ]; +static struct regmap *clk_memmaps[CLK_MAX_MEMMAPS ];static void clk_memmap_writel (u32 val,void __iomem *reg) {struct clk_omap_reg *r = (struct clk_omap_reg *)® -writel_relaxed (val, clk_memmaps[r->index] + r->offset); +regmap_write (clk_memmaps[r->index], r->offset, val); }static u32 clk_memmap_readl (void __iomem *reg) { +u32 val;struct clk_omap_reg *r = (struct clk_omap_reg *)® -return readl_relaxed (clk_memmaps[r->index] + r->offset); +regmap_read (clk_memmaps[r->index], r->offset, &val); + +return val; }void omap2_clk_writel (u32 val,struct clk_hw_omap *clk,void __iomem *reg)
@@ -115,18 +119,25 @@ static struct ti_clk_ll_ops omap_clk_ll_ops = { .clk_writel = clk_memmap_writel, }; +static struct regmap_config clk_regmap_config = { + .reg_bits =32 , + .reg_stride =4 , + .val_bits =32 , +}; +/** * omap2_clk_provider_init - initialize a clock provider * @np: device node for initializing the clock provider * @index: memory map index for the clock provider -* @mem: iomem pointer for the memory map +* @syscon: syscon regmap pointer +* @mem: iomem pointer for the memory map, only used if @syscon is not provided * * Initializes a clock provider module (CM/PRM etc.), registering * the iomap and initializing the low level driver infrastructure. * Returns 0 in success, -EINVAL if multiple registration is attempted. */ int __init omap2_clk_provider_init (struct device_node *np,int index, -void __iomem *mem) +struct regmap *syscon,void __iomem *mem) { ti_clk_ll_ops = &omap_clk_ll_ops;
@@ -136,7 +147,10 @@ int __init omap2_clk_provider_init(struct device_node *np, int index,return -EINVAL ; } - clk_memmaps[index] = mem; +if (!syscon) + syscon =regmap_init_mmio (NULL , mem, &clk_regmap_config); + + clk_memmaps[index] = syscon;ti_dt_clk_init_provider (np, index);return 0 ;
arch/arm/mach-omap2/clock.h +3 -1
@@ -280,8 +280,10 @@ extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);extern void omap_clocks_register (struct omap_clk *oclks,int cnt); +struct regmap ; +int __init omap2_clk_provider_init (struct device_node *np,int index, -void __iomem *mem); +struct regmap *syscon,void __iomem *mem);void __init ti_clk_init_features (void );#endif
arch/arm/mach-omap2/cm_common.c +1 -1
@@ -332,7 +332,7 @@ int __init omap_cm_init(void)if (data->flags &CM_NO_CLOCKS )continue ; - ret =omap2_clk_provider_init (np, data->index, data->mem); + ret =omap2_clk_provider_init (np, data->index,NULL , data->mem);if (ret)return ret; }
arch/arm/mach-omap2/control.c +1 -1
@@ -675,7 +675,7 @@ int __init omap_control_init(void)for_each_matching_node_and_match (np, omap_scrm_dt_match_table, &match) { data = match->data; - ret =omap2_clk_provider_init (np, data->index, data->mem); + ret =omap2_clk_provider_init (np, data->index,NULL , data->mem);if (ret)return ret; }
arch/arm/mach-omap2/prm_common.c +1 -1
@@ -753,7 +753,7 @@ int __init omap_prcm_init(void)for_each_matching_node_and_match (np, omap_prcm_dt_match_table, &match) { data = match->data; - ret =omap2_clk_provider_init (np, data->index, data->mem); + ret =omap2_clk_provider_init (np, data->index,NULL , data->mem);if (ret)return ret; }
Signature · 1 line
1.7.9.5
PATCH v2 23/33 ARM: OMAP2+: control: remove API for getting control module base address
In reply to Tero KristoThis shall not be used anymore, as control module driver is converted into using regmap.
--- arch/arm/mach-omap2/control.c | 5 ----- arch/arm/mach-omap2/control.h | 2 -- 2 files changed, 7 deletions(-)
arch/arm/mach-omap2/control.c +0 -5
@@ -145,11 +145,6 @@ void __init omap2_set_globals_control(void __iomem *ctrl, omap4_ctrl_pad_base = ctrl_pad; } -void __iomem *omap_ctrl_base_get (void ) -{ -return omap2_ctrl_base; -} -u8 omap_ctrl_readb (u16 offset) {return readb_relaxed (OMAP_CTRL_REGADDR (offset));
arch/arm/mach-omap2/control.h +0 -2
@@ -432,7 +432,6 @@#ifndef __ASSEMBLY__#ifdef CONFIG_ARCH_OMAP2PLUS -extern void __iomem *omap_ctrl_base_get (void );extern u8 omap_ctrl_readb (u16 offset);extern u16 omap_ctrl_readw (u16 offset);extern u32 omap_ctrl_readl (u16 offset);
@@ -461,7 +460,6 @@ int omap_control_init(void);extern void omap2_set_globals_control (void __iomem *ctrl,void __iomem *ctrl_pad);#else -#define omap_ctrl_base_get () 0#define omap_ctrl_readb (x) 0#define omap_ctrl_readw (x) 0#define omap_ctrl_readl (x) 0
Signature · 1 line
1.7.9.5
PATCH v2 24/33 ARM: OMAP2+: id: cache omap_type value
In reply to Tero KristoThere is no need to read the register with every invocation of the function, as the value is constant. Thus, cache the value in a static variable.
--- arch/arm/mach-omap2/id.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/id.c +4 -1
@@ -52,7 +52,10 @@ EXPORT_SYMBOL(omap_rev);int omap_type (void ) { -u32 val =0 ; +static u32 val =OMAP2_DEVICETYPE_MASK +1 ; + +if (val <OMAP2_DEVICETYPE_MASK ) +return val;if (cpu_is_omap24xx ()) { val =omap_ctrl_readl (OMAP24XX_CONTROL_STATUS );
Signature · 1 line
1.7.9.5
PATCH v2 25/33 ARM: dts: am33xx: add syscon support to scrm node
In reply to Tero KristoControl module will be converted to use syscon, thus add compatible string for this. Also, remove the existing duplicate syscon entries at the same time, and change the users of these to use the real control module syscon.
--- arch/arm/boot/dts/am33xx.dtsi | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-)
arch/arm/boot/dts/am33xx.dtsi +5 -15
@@ -83,11 +83,6 @@ }; }; - am33xx_control_module: control_module at 4a002000 { - compatible = "syscon"; - reg = <0x44e10000 0x7fc>; - }; - am33xx_pinmux: pinmux at 44e10800 { compatible = "pinctrl-single"; reg = <0x44e10800 0x0238>;
@@ -125,8 +120,8 @@ }; scrm: scrm at 44e10000 { - compatible = "ti,am3-scrm"; - reg = <0x44e10000 0x2000>; + compatible = "ti,am3-scrm", "syscon"; + reg = <0x44e10000 0x7fc>; scrm_clocks: clocks { #address-cells = <1>;
@@ -137,11 +132,6 @@ }; }; - cm: syscon at 44e10000 { - compatible = "ti,am33xx-controlmodule", "syscon"; - reg = <0x44e10000 0x800>; - }; - intc: interrupt-controller at 48200000 { compatible = "ti,am33xx-intc"; interrupt-controller;
@@ -350,7 +340,7 @@ reg = <0x481cc000 0x2000>; clocks = <&dcan0_fck>; clock-names = "fck"; - syscon-raminit = <&am33xx_control_module 0x644 0>; + syscon-raminit = <&scrm 0x644 0>; interrupts = <52>; status = "disabled"; };
@@ -361,7 +351,7 @@ reg = <0x481d0000 0x2000>; clocks = <&dcan1_fck>; clock-names = "fck"; - syscon-raminit = <&am33xx_control_module 0x644 1>; + syscon-raminit = <&scrm 0x644 1>; interrupts = <55>; status = "disabled"; };
@@ -720,7 +710,7 @@ */ interrupts = <40 41 42 43>; ranges; - syscon = <&cm>; + syscon = <&scrm>; status = "disabled"; davinci_mdio: mdio at 4a101000 {
Signature · 1 line
1.7.9.5
Tony Lindgren
maintainerPATCH v2 25/33 ARM: dts: am33xx: add syscon support to scrm node
Hi Tero,
Quoted 4 lines · Tero Kristo
Control module will be converted to use syscon, thus add compatible string for this. Also, remove the existing duplicate syscon entries at the same time, and change the users of these to use the real control module syscon.
We should not set the whole SCM as syscon, let's just map the scm_conf areas. Those are the only ones that need to be shared by various Linux generic framework implementing drivers. Those need to be shared for regulators, clocks, PHYs and so on. For the areas where we have a clearly separate area that can be ioremapped by a framework implementing driver let's use that.
The reason is that I'd like to set up things so we can have standard loadable Linux kernel modules working with just plaform_get_resource() or of_ioremap() to take advantage of them protecting access with request_mem_region(). We are already doing that but in an uncoordinated fashion. See the example for dm816x below that has things moved around to start standardizing things for the SCM access.
Quoted 4 lines
arch/arm/boot/dts/am33xx.dtsi +0
-0@@ -83,11 +83,6 @@ };
arch/arm/boot/dts/am33xx.dtsi line 88
Quoted 10 lines
arch/arm/boot/dts/am33xx.dtsi +0
-5}; - am33xx_control_module: control_module at 4a002000 { - compatible = "syscon"; - reg = <0x44e10000 0x7fc>; - }; - am33xx_pinmux: pinmux at 44e10800 { compatible = "pinctrl-single"; reg = <0x44e10800 0x0238>;
BTW, I have just this part as a separate fix in my series along with few other fixes dts fixes for ranges, will post those around -rc1.
Then back to making the SCM behave, we already have an example with dm816x. the current Linux next plus a pending fix for "[PATCH] ARM: dts: Fix USB dts configuration for dm816x" makes the SCM look as below. I have also similar patches in works for omap3, am33xx, am437x, and omap4.
Note that here we have already various framework implementing drivers behaving in a standard way using request_mem_region() and of_ioremap() with help of ranges.
We should still have a core SCM/bus driver take care of managing the SCM clock, and trigger the save and restore of SCM registers for PM.
Regards,
Tony
8<---------------
scrm: scrm@48140000 {
compatible = "ti,dm816-scrm", "simple-bus";
reg = <0x48140000 0x21000>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0x48140000 0x21000>;
dm816x_pinmux: pinmux at 800 {
compatible = "pinctrl-single";
reg = <0x800 0x50a>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-single,register-width = <16>;
pinctrl-single,function-mask = <0xf>;
};
/* Device Configuration Registers */
scm_conf: syscon at 600 {
compatible = "syscon", "simple-bus";
reg = <0x600 0x110>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0x600 0x110>;
usb_phy0: usb-phy at 20 {
compatible = "ti,dm8168-usb-phy";
reg = <0x20 0x8>;
reg-names = "phy";
clocks = <&main_fapll 6>;
clock-names = "refclk";
#phy-cells = <0>;
syscon = <&scm_conf>;
};
usb_phy1: usb-phy at 28 {
compatible = "ti,dm8168-usb-phy";
reg = <0x28 0x8>;
reg-names = "phy";
clocks = <&main_fapll 6>;
clock-names = "refclk";
#phy-cells = <0>;
syscon = <&scm_conf>;
};
};
scrm_clocks: clocks {
#address-cells = <1>;
#size-cells = <0>;
};
scrm_clockdomains: clockdomains {
};
};PATCH v2 26/33 ARM: dts: am4372: add syscon support to control module node
In reply to Tero KristoControl module will be converted to use syscon, thus add compatible string for this. Also, remove the existing duplicate syscon entries at the same time, and change the users of these to use the real control module syscon.
--- arch/arm/boot/dts/am4372.dtsi | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
arch/arm/boot/dts/am4372.dtsi +3 -8
@@ -57,11 +57,6 @@ cache-level = <2>; }; - am43xx_control_module: control_module at 4a002000 { - compatible = "syscon"; - reg = <0x44e10000 0x7f4>; - }; - am43xx_pinmux: pinmux at 44e10800 { compatible = "ti,am437-padconf", "pinctrl-single"; reg = <0x44e10800 0x31c>;
@@ -98,7 +93,7 @@ }; scrm: scrm at 44e10000 { - compatible = "ti,am4-scrm"; + compatible = "ti,am4-scrm", "syscon"; reg = <0x44e10000 0x2000>; scrm_clocks: clocks {
@@ -933,7 +928,7 @@ clocks = <&dcan0_fck>; clock-names = "fck"; reg = <0x481cc000 0x2000>; - syscon-raminit = <&am43xx_control_module 0x644 0>; + syscon-raminit = <&scrm 0x644 0>; interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
@@ -944,7 +939,7 @@ clocks = <&dcan1_fck>; clock-names = "fck"; reg = <0x481d0000 0x2000>; - syscon-raminit = <&am43xx_control_module 0x644 1>; + syscon-raminit = <&scrm 0x644 1>; interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; };
Signature · 1 line
1.7.9.5
PATCH v2 27/33 ARM: dts: omap24xx: add syscon support to scrm node
In reply to Tero KristoControl module will be converted to use syscon, thus add compatible string for this.
--- arch/arm/boot/dts/omap2420.dtsi | 2 +- arch/arm/boot/dts/omap2430.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap2420.dtsi +1 -1
@@ -28,7 +28,7 @@ }; scrm: scrm at 48000000 { - compatible = "ti,omap2-scrm"; + compatible = "ti,omap2-scrm", "syscon"; reg = <0x48000000 0x1000>; scrm_clocks: clocks {
arch/arm/boot/dts/omap2430.dtsi +1 -1
@@ -28,7 +28,7 @@ }; scrm: scrm at 49002000 { - compatible = "ti,omap2-scrm"; + compatible = "ti,omap2-scrm", "syscon"; reg = <0x49002000 0x1000>; scrm_clocks: clocks {
Signature · 1 line
1.7.9.5
PATCH v2 28/33 ARM: dts: omap3: add syscon support to scrm node
In reply to Tero KristoControl module will be converted to use syscon, thus add compatible string for this. Also, remove the existing duplicate syscon entry at the same time, and change the existing users of this to use the real control module syscon.
--- arch/arm/boot/dts/omap3.dtsi | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/arm/boot/dts/omap3.dtsi +4 -9
@@ -122,8 +122,8 @@ }; scrm: scrm at 48002000 { - compatible = "ti,omap3-scrm"; - reg = <0x48002000 0x2000>; + compatible = "ti,omap3-scrm", "syscon"; + reg = <0x48002000 0x1000>; scrm_clocks: clocks { #address-cells = <1>;
@@ -181,15 +181,10 @@ pinctrl-single,function-mask = <0xff1f>; }; - omap3_scm_general: tisyscon at 48002270 { - compatible = "syscon"; - reg = <0x48002270 0x2f0>; - }; - pbias_regulator: pbias_regulator { compatible = "ti,pbias-omap"; - reg = <0x2b0 0x4>; - syscon = <&omap3_scm_general>; + reg = <0x520 0x4>; + syscon = <&scrm>; pbias_mmc_reg: pbias_mmc_omap2430 { regulator-name = "pbias_mmc_omap2430"; regulator-min-microvolt = <1800000>;
Signature · 1 line
1.7.9.5
PATCH v2 29/33 ARM: OMAP2+: control: convert to use syscon for register accesses
In reply to Tero KristoControl driver now uses syscon for accessing its register space. Also, the clock driver under control module are using the same syscon address space now.
--- arch/arm/mach-omap2/clock.h | 1 + arch/arm/mach-omap2/control.c | 89 ++++++++++++++++++++++++++++++++--------- include/linux/clk/ti.h | 2 +- 3 files changed, 71 insertions(+), 21 deletions(-)
arch/arm/mach-omap2/clock.h +1 -0
@@ -241,6 +241,7 @@ enum {CLK_MEMMAP_INDEX_CM1 ,CLK_MEMMAP_INDEX_CM2 ,CLK_MEMMAP_INDEX_SCRM , + CLK_MEMMAP_INDEX_CTRL, };extern struct ti_clk_features ti_clk_features;
arch/arm/mach-omap2/control.c +69 -20
162 lines not on this page · raw message
include/linux/clk/ti.h +1 -1
@@ -215,7 +215,7 @@ struct ti_dt_clk { }/* Maximum number of clock memmaps */ -#define CLK_MAX_MEMMAPS 4 +#define CLK_MAX_MEMMAPS 5typedef void (*ti_of_clk_init_cb_t )(struct clk_hw *,struct device_node *);
Signature · 1 line
1.7.9.5
PATCH v2 30/33 ARM: dts: omap4: add nodes for control module core instances
In reply to Tero KristoAdd support for control module core generic and padconf memory spaces. These nodes add syscon support for shared access, and the duplicate omap4_padconf_global node is removed with the same patch. Kernel support for the new compatible strings is going to be added in a separate patch.
--- .../devicetree/bindings/arm/omap/ctrl.txt | 55 ++++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 19 ++++--- 2 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/omap/ctrl.txt
Documentation/devicetree/bindings/arm/omap/ctrl.txt new file +55 -0
@@ -0,0 +1,55 @@ +OMAP Control Module bindings + +Control Module contains miscellaneous features under it based on SoC type. +Pincontrol is one common feature, and typically some clock nodes are also +under control module. Syscon is used to share register level access to +drivers external to control module driver itself. + +See [1] for documentation about clock/clockdomain nodes. + +[1] Documentation/devicetree/bindings/clock/ti/* + +Required properties: +- compatible: Must be one of: + "ti,am3-scrm" + "ti,am4-scrm" + "ti,omap2-scrm" + "ti,omap3-scrm" + "ti,omap4-ctrl-gen-core" + "ti,omap4-ctrl-pad-core" +- reg: Contains Control Module register address range + (base address and length) + +Optional properties: +- clocks: clocks for this module +- clockdomains: clockdomains for this module + +Examples: + +scrm: scrm at 48002000 { + compatible = "ti,omap3-scrm", "syscon"; + reg = <0x48002000 0x1000>; + + scrm_clocks: clocks { + #address-cells = <1>; + #size-cells = <0>; + }; + + scrm_clockdomains: clockdomains { + }; +} + +&scrm_clocks { + mcbsp5_mux_fck: mcbsp5_mux_fck { + #clock-cells = <0>; + compatible = "ti,composite-mux-clock"; + clocks = <&core_96m_fck>, <&mcbsp_clks>; + ti,bit-shift = <4>; + reg = <0x02d8>; + }; +}; + +ctrl_gen_core: ctrl_gen_core at 4a002000 { + compatible = "ti,omap4-ctrl-gen-core", "syscon"; + reg = <0x4a002000 0x1000>; +};
arch/arm/boot/dts/omap4.dtsi +12 -7
@@ -167,6 +167,16 @@ }; }; + ctrl_gen_core: ctrl_gen_core at 0x4a002000 { + compatible = "ti,omap4-ctrl-gen-core", "syscon"; + reg = <0x4a002000 0x1000>; + }; + + ctrl_pad_core: ctrl_pad_core at 0x4a100000 { + compatible = "ti,omap4-ctrl-pad-core", "syscon"; + reg = <0x4a100000 0x1000>; + }; + counter32k: counter at 4a304000 { compatible = "ti,omap-counter32k"; reg = <0x4a304000 0x20>;
@@ -194,15 +204,10 @@ pinctrl-single,function-mask = <0x7fff>; }; - omap4_padconf_global: tisyscon at 4a1005a0 { - compatible = "syscon"; - reg = <0x4a1005a0 0x170>; - }; - pbias_regulator: pbias_regulator { compatible = "ti,pbias-omap"; - reg = <0x60 0x4>; - syscon = <&omap4_padconf_global>; + reg = <0x600 0x4>; + syscon = <&ctrl_pad_core>; pbias_mmc_reg: pbias_mmc_omap4 { regulator-name = "pbias_mmc_omap4"; regulator-min-microvolt = <1800000>;
Signature · 1 line
1.7.9.5
PATCH v2 31/33 ARM: dts: omap5: add nodes for control module core instances
In reply to Tero KristoAdd support for control module core generic and padconf memory spaces. These nodes add syscon support for shared access, and the duplicate omap5_padconf_global node is removed with the same patch. Kernel support for the new compatible strings is going to be added in a separate patch.
--- .../devicetree/bindings/arm/omap/ctrl.txt | 2 ++ arch/arm/boot/dts/omap5.dtsi | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/arm/omap/ctrl.txt +2 -0
@@ -17,6 +17,8 @@ Required properties: "ti,omap3-scrm" "ti,omap4-ctrl-gen-core" "ti,omap4-ctrl-pad-core" + "ti,omap5-ctrl-gen-core" + "ti,omap5-ctrl-pad-core" - reg: Contains Control Module register address range (base address and length)
arch/arm/boot/dts/omap5.dtsi +12 -7
@@ -182,6 +182,16 @@ }; }; + ctrl_gen_core: ctrl_gen_core at 4a002000 { + compatible = "ti,omap5-ctrl-gen-core", "syscon"; + reg = <0x4a002000 0x800>; + }; + + ctrl_pad_core: ctrl_pad_core at 4a002800 { + compatible = "ti,omap5-ctrl-pad-core", "syscon"; + reg = <0x4a002800 0x800>; + }; + counter32k: counter at 4ae04000 { compatible = "ti,omap-counter32k"; reg = <0x4ae04000 0x40>;
@@ -209,15 +219,10 @@ pinctrl-single,function-mask = <0x7fff>; }; - omap5_padconf_global: tisyscon at 4a002da0 { - compatible = "syscon"; - reg = <0x4A002da0 0xec>; - }; - pbias_regulator: pbias_regulator { compatible = "ti,pbias-omap"; - reg = <0x60 0x4>; - syscon = <&omap5_padconf_global>; + reg = <0x600 0x4>; + syscon = <&ctrl_pad_core>; pbias_mmc_reg: pbias_mmc_omap5 { regulator-name = "pbias_mmc_omap5"; regulator-min-microvolt = <1800000>;
Signature · 1 line
1.7.9.5
PATCH v2 32/33 ARM: dts: dra7: fix control module core instance nodes
In reply to Tero KristoThe old names for these nodes were misleading, and also the address spaces for these didn't match the hardware. Fixed by renaming the nodes and fixing the memory maps to reflect actual hardware implementation. Existing users for the syscons updated accordingly. Support for the new dra7 control module compatible strings is going to be added in a separate patch.
--- .../devicetree/bindings/arm/omap/ctrl.txt | 2 ++ arch/arm/boot/dts/dra7.dtsi | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/arm/omap/ctrl.txt +2 -0
@@ -19,6 +19,8 @@ Required properties: "ti,omap4-ctrl-pad-core" "ti,omap5-ctrl-gen-core" "ti,omap5-ctrl-pad-core" + "ti,dra7-ctrl-gen-core" + "ti,dra7-ctrl-pad-core" - reg: Contains Control Module register address range (base address and length)
arch/arm/boot/dts/dra7.dtsi +10 -10
@@ -209,20 +209,20 @@ ti,hwmods = "counter_32k"; }; - dra7_ctrl_core: ctrl_core at 4a002000 { - compatible = "syscon"; - reg = <0x4a002000 0x6d0>; + ctrl_gen_core: ctrl_gen_core at 4a002000 { + compatible = "ti,dra7-ctrl-gen-core", "syscon"; + reg = <0x4a002000 0x1400>; }; - dra7_ctrl_general: tisyscon at 4a002e00 { - compatible = "syscon"; - reg = <0x4a002e00 0x7c>; + ctrl_pad_core: ctrl_pad_core at 4a003400 { + compatible = "ti,dra7-ctrl-pad-core", "syscon"; + reg = <0x4a003400 0xc00>; }; pbias_regulator: pbias_regulator { compatible = "ti,pbias-omap"; - reg = <0 0x4>; - syscon = <&dra7_ctrl_general>; + reg = <0xe00 0x4>; + syscon = <&ctrl_gen_core>; pbias_mmc_reg: pbias_mmc_omap5 { regulator-name = "pbias_mmc_omap5"; regulator-min-microvolt = <1800000>;
@@ -1406,7 +1406,7 @@ compatible = "ti,dra7-d_can"; ti,hwmods = "dcan1"; reg = <0x4ae3c000 0x2000>; - syscon-raminit = <&dra7_ctrl_core 0x558 0>; + syscon-raminit = <&ctrl_gen_core 0x558 0>; interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH>; clocks = <&dcan1_sys_clk_mux>; status = "disabled";
@@ -1416,7 +1416,7 @@ compatible = "ti,dra7-d_can"; ti,hwmods = "dcan2"; reg = <0x48480000 0x2000>; - syscon-raminit = <&dra7_ctrl_core 0x558 1>; + syscon-raminit = <&ctrl_gen_core 0x558 1>; interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>; clocks = <&sys_clkin1>; status = "disabled";
Signature · 1 line
1.7.9.5
PATCH v2 33/33 ARM: OMAP4+: control: add support for initializing control module via DT
In reply to Tero KristoOMAP4, OMAP5 and DRA7 now parse DT entries for control module address spaces, and set up syscon mappings appropriately. Low level IO init is updated to remove the legacy control module mappings for these devices also.
--- arch/arm/mach-omap2/control.c | 44 +++++++++++++++++++++++++++++++++++------ arch/arm/mach-omap2/io.c | 9 +++------ 2 files changed, 41 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/control.c +38 -6
@@ -35,8 +35,8 @@#define PADCONF_SAVE_DONE 0x1static void __iomem *omap2_ctrl_base; -static void __iomem *omap4_ctrl_pad_base;static struct regmap *omap2_ctrl_syscon; +static struct regmap *omap4_ctrl_pad_syscon;#if defined(CONFIG_ARCH_OMAP3 ) && defined(CONFIG_PM ) struct omap3_scratchpad {
@@ -138,13 +138,10 @@ struct omap3_control_regs {static struct omap3_control_regs control_context;#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ -#define OMAP4_CTRL_PAD_REGADDR (reg) (omap4_ctrl_pad_base + (reg)) -void __init omap2_set_globals_control (void __iomem *ctrl,void __iomem *ctrl_pad) { omap2_ctrl_base = ctrl; - omap4_ctrl_pad_base = ctrl_pad; }u8 omap_ctrl_readb (u16 offset)
@@ -225,12 +222,15 @@ void omap_ctrl_writel(u32 val, u16 offset)u32 omap4_ctrl_pad_readl (u16 offset) { -return readl_relaxed (OMAP4_CTRL_PAD_REGADDR (offset)); +u32 val; + +regmap_read (omap4_ctrl_pad_syscon, offset, &val); +return val; }void omap4_ctrl_pad_writel (u32 val,u16 offset) { -writel_relaxed (val,OMAP4_CTRL_PAD_REGADDR (offset)); +regmap_write (omap4_ctrl_pad_syscon, offset, val); }#ifdef CONFIG_ARCH_OMAP3
@@ -658,11 +658,30 @@ static const struct control_init_data ctrl_data = { .index = CLK_MEMMAP_INDEX_CTRL, }; +static const struct control_init_data omap4_ctrl_gen_core_data = { + .index =CLK_MEMMAP_INDEX_CTRL , +}; + +static const struct control_init_data omap4_ctrl_pad_core_data = { +}; +static struct of_device_id omap_scrm_dt_match_table[] = { { .compatible ="ti,am3-scrm" , .data = &ctrl_data }, { .compatible ="ti,am4-scrm" , .data = &ctrl_data }, { .compatible ="ti,omap2-scrm" , .data = &ctrl_data }, { .compatible ="ti,omap3-scrm" , .data = &ctrl_data }, + { .compatible ="ti,omap4-ctrl-gen-core" , + .data = &omap4_ctrl_gen_core_data }, + { .compatible ="ti,omap4-ctrl-pad-core" , + .data = &omap4_ctrl_pad_core_data }, + { .compatible ="ti,omap5-ctrl-gen-core" , + .data = &omap4_ctrl_gen_core_data }, + { .compatible ="ti,omap5-ctrl-pad-core" , + .data = &omap4_ctrl_pad_core_data }, + { .compatible ="ti,dra7-ctrl-gen-core" , + .data = &omap4_ctrl_gen_core_data }, + { .compatible ="ti,dra7-ctrl-pad-core" , + .data = &omap4_ctrl_pad_core_data }, { } };
@@ -682,6 +701,13 @@ int __init omap2_control_base_init(void)for_each_matching_node_and_match (np, omap_scrm_dt_match_table, &match) { data = match->data; +/* +* Only setup omap2_ctrl_base for base index, omap4+ has +* padconf mapping also +*/ +if (data->index !=CLK_MEMMAP_INDEX_CTRL ) +continue ; + omap2_ctrl_base =of_iomap (np,0 );if (!omap2_ctrl_base)return -ENOMEM ;
@@ -711,6 +737,10 @@ int __init omap_control_init(void)if (IS_ERR (syscon))return PTR_ERR (syscon); +/* +* Setup appropriate syscon mapping; omap4+ is currently +* using two of these, separate ones for generic + padconf +*/ if (data->index ==CLK_MEMMAP_INDEX_CTRL ) { omap2_ctrl_syscon = syscon;
@@ -721,6 +751,8 @@ int __init omap_control_init(void)iounmap (omap2_ctrl_base); omap2_ctrl_base =NULL ; + }else { + omap4_ctrl_pad_syscon = syscon; } }
arch/arm/mach-omap2/io.c +3 -6
@@ -611,9 +611,8 @@ void __init omap4430_init_early(void) {omap2_set_globals_tap (OMAP443X_CLASS ,OMAP2_L4_IO_ADDRESS (OMAP443X_SCM_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP443X_SCM_BASE ), -OMAP2_L4_IO_ADDRESS (OMAP443X_CTRL_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP4430_PRCM_MPU_BASE )); +omap2_control_base_init ();omap4xxx_check_revision ();omap4xxx_check_features ();omap2_prcm_base_init ();
@@ -640,9 +639,8 @@ void __init omap5_init_early(void) {omap2_set_globals_tap (OMAP54XX_CLASS ,OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE ), -OMAP2_L4_IO_ADDRESS (OMAP54XX_CTRL_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE )); +omap2_control_base_init ();omap4_pm_init_early ();omap2_prcm_base_init ();omap5xxx_check_revision ();
@@ -666,9 +664,8 @@ void __init omap5_init_late(void)void __init dra7xx_init_early (void ) {omap2_set_globals_tap (-1 ,OMAP2_L4_IO_ADDRESS (DRA7XX_TAP_BASE )); -omap2_set_globals_control (OMAP2_L4_IO_ADDRESS (OMAP54XX_SCM_BASE ), -OMAP2_L4_IO_ADDRESS (DRA7XX_CTRL_BASE ));omap2_set_globals_prcm_mpu (OMAP2_L4_IO_ADDRESS (OMAP54XX_PRCM_MPU_BASE )); +omap2_control_base_init ();omap4_pm_init_early ();omap2_prcm_base_init ();dra7xxx_check_revision ();
Signature · 1 line
1.7.9.5
Tony Lindgren
maintainerv2 cover ARM: OMAP2+: PRCM/omap ctrl cleanups against 3.19-rc1
In reply to Tero KristoHi Tero,
Quoted 7 lines · Tero Kristo
Hi,
Updates since v1:
- fixed omap2/am33xx boot issues
- added regmap support to generic omap clock core
- control module driver converted to use syscon
I made some comments to patch 25 of this series detailing how we should limit the syscon usage to the scm_conf register area only.
Quoted 2 lines
- dropped patches for removing legacy pad muxing support (this is still needed)
Sounds like this can be moved to the DSS driver using the syscon area as long as these are not in the pinctrl-single padconf register area. Preferrably implementing some standard Linux framework, along the lines pbias-regulator.c is handling the SCM register for MMC.
Regards,
Tony
v2 cover ARM: OMAP2+: PRCM/omap ctrl cleanups against 3.19-rc1
Quoted 15 lines · Tony Lindgren
Hi Tero,
Quoted 7 lines · Tero Kristo
Hi,
Updates since v1:
- fixed omap2/am33xx boot issues
- added regmap support to generic omap clock core
- control module driver converted to use sysconI made some comments to patch 25 of this series detailing how we should limit the syscon usage to the
scm_confregister area only.
Quoted 9 lines
Quoted 2 lines
- dropped patches for removing legacy pad muxing support (this is still needed)
Sounds like this can be moved to the DSS driver using the syscon area as long as these are not in the pinctrl-single padconf register area. Preferrably implementing some standard Linux framework, along the lines
pbias-regulator.cis handling the SCM register for MMC.
I've done some updates/fixes to this set, mostly to address your comments and rebase it on top of 4.0-rc1. Will be posting a v3 in a bit.
-Tero