From d8871cd245ece932ced994457e044d0f68b0aab4 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Sun, 11 May 2014 19:54:58 -0600 Subject: ARM: OMAP2+: PRM: remove unnecessary cpu_is_XXX calls from prm_init / exit Done in preparation to make PRM its own driver, as the cpu_is_XXX calls are not available outside mach-omap2 folder. The init functions are called only from cpu specific init chain, and thus don't need to double check against cpu type. The exit calls check against the data provided during init-time registration and thus don't need cpu check either. Signed-off-by: Tero Kristo [paul@pwsan.com: updated to apply] Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/prm44xx.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'arch/arm/mach-omap2/prm44xx.c') diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index 03a603476cfc..15171890f805 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c @@ -660,9 +660,6 @@ static struct prm_ll_data omap44xx_prm_ll_data = { int __init omap44xx_prm_init(void) { - if (!cpu_is_omap44xx() && !soc_is_omap54xx() && !soc_is_dra7xx()) - return 0; - return prm_register(&omap44xx_prm_ll_data); } @@ -679,11 +676,6 @@ omap_subsys_initcall(omap44xx_prm_late_init); static void __exit omap44xx_prm_exit(void) { - if (!cpu_is_omap44xx()) - return; - - /* Should never happen */ - WARN(prm_unregister(&omap44xx_prm_ll_data), - "%s: prm_ll_data function pointer mismatch\n", __func__); + prm_unregister(&omap44xx_prm_ll_data); } __exitcall(omap44xx_prm_exit); -- cgit v1.2.3 From 81243651ba25c4418af26c3c6f1aeabb41f734e0 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Mon, 31 Mar 2014 18:15:43 +0300 Subject: ARM: OMAP3/4: PRM: provide io chain reconfig function through irq setup This helps to make the PRM registration modular, and also gets rid of a cpu type check done later. Signed-off-by: Tero Kristo Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/prcm-common.h | 2 ++ arch/arm/mach-omap2/prm3xxx.c | 1 + arch/arm/mach-omap2/prm44xx.c | 1 + arch/arm/mach-omap2/prm_common.c | 7 +------ 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'arch/arm/mach-omap2/prm44xx.c') diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index ee2384a983bc..a8e4b582c527 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h @@ -480,6 +480,7 @@ struct omap_prcm_irq { * @ocp_barrier: fn ptr to force buffered PRM writes to complete * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs * @restore_irqen: fn ptr to save and clear IRQENABLE regs + * @reconfigure_io_chain: fn ptr to reconfigure IO chain * @saved_mask: IRQENABLE regs are saved here during suspend * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init @@ -501,6 +502,7 @@ struct omap_prcm_irq_setup { void (*ocp_barrier)(void); void (*save_and_clear_irqen)(u32 *saved_mask); void (*restore_irqen)(u32 *saved_mask); + void (*reconfigure_io_chain)(void); u32 *saved_mask; u32 *priority_mask; int base_irq; diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 4c89aa2f1e81..2631b9f2b3d8 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -43,6 +43,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = { .ocp_barrier = &omap3xxx_prm_ocp_barrier, .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, .restore_irqen = &omap3xxx_prm_restore_irqen, + .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain, }; /* diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index 15171890f805..f464179eb82b 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c @@ -47,6 +47,7 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = { .ocp_barrier = &omap44xx_prm_ocp_barrier, .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen, .restore_irqen = &omap44xx_prm_restore_irqen, + .reconfigure_io_chain = &omap44xx_prm_reconfigure_io_chain, }; /* diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index b4c4ab9c8044..bd746fc05d18 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c @@ -330,12 +330,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup) if (of_have_populated_dt()) { int irq = omap_prcm_event_to_irq("io"); - if (cpu_is_omap34xx()) - omap_pcs_legacy_init(irq, - omap3xxx_prm_reconfigure_io_chain); - else - omap_pcs_legacy_init(irq, - omap44xx_prm_reconfigure_io_chain); + omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain); } return 0; -- cgit v1.2.3 From 2541d15f16479fd56debe1ea55dee03c3886e33c Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Mon, 31 Mar 2014 18:15:44 +0300 Subject: ARM: OMAP3/OMAP4: PRM: add prm_features flags and add IO wakeup under it prm_features flag will contain SoC specific feature enabler flags. Initially IO wakeup is added under this. Helps to get rid of runtime cpu_is_X checks. Signed-off-by: Tero Kristo Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/prm.h | 8 ++++++++ arch/arm/mach-omap2/prm3xxx.c | 8 +++++++- arch/arm/mach-omap2/prm44xx.c | 6 ++++++ arch/arm/mach-omap2/prm_common.c | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-omap2/prm44xx.c') diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h index 623db40fdbbd..04426c441fff 100644 --- a/arch/arm/mach-omap2/prm.h +++ b/arch/arm/mach-omap2/prm.h @@ -17,10 +17,18 @@ # ifndef __ASSEMBLER__ extern void __iomem *prm_base; +extern u16 prm_features; extern void omap2_set_globals_prm(void __iomem *prm); int of_prcm_init(void); # endif +/* + * prm_features flag values + * + * PRM_HAS_IO_WAKEUP: has IO wakeup capability + * PRM_HAS_VOLTAGE: has voltage domains + */ +#define PRM_HAS_IO_WAKEUP (1 << 0) /* * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 2631b9f2b3d8..9c95ac21c5b3 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -247,7 +247,7 @@ void omap3xxx_prm_reconfigure_io_chain(void) */ static void __init omap3xxx_prm_enable_io_wakeup(void) { - if (omap3_has_io_wakeup()) + if (prm_features & PRM_HAS_IO_WAKEUP) omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, PM_WKEN); } @@ -407,6 +407,9 @@ static struct prm_ll_data omap3xxx_prm_ll_data = { int __init omap3xxx_prm_init(void) { + if (omap3_has_io_wakeup()) + prm_features |= PRM_HAS_IO_WAKEUP; + return prm_register(&omap3xxx_prm_ll_data); } @@ -417,6 +420,9 @@ static int __init omap3xxx_prm_late_init(void) if (!cpu_is_omap34xx()) return 0; + if (!(prm_features & PRM_HAS_IO_WAKEUP)) + return 0; + omap3xxx_prm_enable_io_wakeup(); ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); if (!ret) diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index f464179eb82b..e4e52f14dbbf 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c @@ -661,6 +661,9 @@ static struct prm_ll_data omap44xx_prm_ll_data = { int __init omap44xx_prm_init(void) { + if (cpu_is_omap44xx()) + prm_features |= PRM_HAS_IO_WAKEUP; + return prm_register(&omap44xx_prm_ll_data); } @@ -669,6 +672,9 @@ static int __init omap44xx_prm_late_init(void) if (!cpu_is_omap44xx()) return 0; + if (!(prm_features & PRM_HAS_IO_WAKEUP)) + return 0; + omap44xx_prm_enable_io_wakeup(); return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index bd746fc05d18..aa2550dd2ac1 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c @@ -62,6 +62,8 @@ static struct omap_prcm_irq_setup *prcm_irq_setup; /* prm_base: base virtual address of the PRM IP block */ void __iomem *prm_base; +u16 prm_features; + /* * prm_ll_data: function pointers to SoC-specific implementations of * common PRM functions -- cgit v1.2.3 From b550e47f5e9e74999f754371bdc79331d19f84a3 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Mon, 31 Mar 2014 18:15:45 +0300 Subject: ARM: OMAP3/4: PRM: add support of late_init call to prm_ll_ops SoC specific late_init call is now registered during PRM init, and will be called automatically by PRM core. This helps to get rid of some redundant initcalls and cpu_is_X checks from the PRM code. Signed-off-by: Tero Kristo Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/prm.h | 2 ++ arch/arm/mach-omap2/prm3xxx.c | 7 +++---- arch/arm/mach-omap2/prm44xx.c | 7 +++---- arch/arm/mach-omap2/prm_common.c | 8 ++++++++ 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'arch/arm/mach-omap2/prm44xx.c') diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h index 04426c441fff..48480d557b61 100644 --- a/arch/arm/mach-omap2/prm.h +++ b/arch/arm/mach-omap2/prm.h @@ -126,6 +126,7 @@ struct prm_reset_src_map { * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn + * @late_init: ptr to the late init function * * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are * deprecated. @@ -134,6 +135,7 @@ struct prm_ll_data { u32 (*read_reset_sources)(void); bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx); void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); + int (*late_init)(void); }; extern int prm_register(struct prm_ll_data *pld); diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 9c95ac21c5b3..4a792fd1363c 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -401,8 +401,11 @@ struct pwrdm_ops omap3_pwrdm_operations = { * */ +static int omap3xxx_prm_late_init(void); + static struct prm_ll_data omap3xxx_prm_ll_data = { .read_reset_sources = &omap3xxx_prm_read_reset_sources, + .late_init = &omap3xxx_prm_late_init, }; int __init omap3xxx_prm_init(void) @@ -417,9 +420,6 @@ static int __init omap3xxx_prm_late_init(void) { int ret; - if (!cpu_is_omap34xx()) - return 0; - if (!(prm_features & PRM_HAS_IO_WAKEUP)) return 0; @@ -431,7 +431,6 @@ static int __init omap3xxx_prm_late_init(void) return ret; } -omap_subsys_initcall(omap3xxx_prm_late_init); static void __exit omap3xxx_prm_exit(void) { diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index e4e52f14dbbf..edf49ef867e1 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c @@ -650,6 +650,8 @@ struct pwrdm_ops omap4_pwrdm_operations = { .pwrdm_has_voltdm = omap4_check_vcvp, }; +static int omap44xx_prm_late_init(void); + /* * XXX document */ @@ -657,6 +659,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = { .read_reset_sources = &omap44xx_prm_read_reset_sources, .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old, .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old, + .late_init = &omap44xx_prm_late_init, }; int __init omap44xx_prm_init(void) @@ -669,9 +672,6 @@ int __init omap44xx_prm_init(void) static int __init omap44xx_prm_late_init(void) { - if (!cpu_is_omap44xx()) - return 0; - if (!(prm_features & PRM_HAS_IO_WAKEUP)) return 0; @@ -679,7 +679,6 @@ static int __init omap44xx_prm_late_init(void) return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); } -omap_subsys_initcall(omap44xx_prm_late_init); static void __exit omap44xx_prm_exit(void) { diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index aa2550dd2ac1..25e8b8232115 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c @@ -527,3 +527,11 @@ int __init of_prcm_init(void) return 0; } + +static int __init prm_late_init(void) +{ + if (prm_ll_data->late_init) + return prm_ll_data->late_init(); + return 0; +} +subsys_initcall(prm_late_init); -- cgit v1.2.3