Skip to contentSkip to conversation

ARM: OMAP2+: Misc cleanup part2

PATCH New R Sricharan 3 participants 16 messages May 10, 2012 – Jul 4, 2012

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover ARM: OMAP2+: Misc cleanup part2

This is a continuation of the previous cleanup series from santosh.shilimkar at ti.com [1]. Patches are outcome of the OMAP5 review suggestions from Tony/Benoit/Santosh/Rajendra.

[1] http://www.spinics.net/lists/linux-omap/msg69730.html

R Sricharan (4):
ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro
ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and
make them __weak.
ARM: OMAP2+: Move stubbed secure_sram_reserve function to a common.c
and call it __weak
ARM: OMAP: counter-32k: Select the CR register offset using the IP
scheme.

 arch/arm/mach-omap2/Kconfig                   |    5 ++
 arch/arm/mach-omap2/clock.c                   |    2 +-
 arch/arm/mach-omap2/cminst44xx.h              |   25 --------
 arch/arm/mach-omap2/prcm.c                    |   77 +++++++++++++++++++++++++
 arch/arm/mach-omap2/prm2xxx_3xxx.h            |   65 ---------------------
 arch/arm/plat-omap/common.c                   |    9 +++
 arch/arm/plat-omap/counter_32k.c              |   16 ++++-
 arch/arm/plat-omap/include/plat/clock.h       |    4 +-
 arch/arm/plat-omap/include/plat/omap-secure.h |    5 --
 9 files changed, 107 insertions(+), 101 deletions(-)
#1 lore raw

PATCH 1/4 ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro

The DPLL ip was introduced and used in the OMAP3PLUS socs, while OMAP2 had the APLL IP. There are some features which are common to both ips, and some which are only applicable to DPLL ip's. Currently CONFIG_ARCH_OMAP_XXX checks is used to conditionally compile the additional features for every applicable SOC. This makes it nessecary to add new a check for every new SOC added in the future.

So by introducing a new "SOC_HAS_OMAP_DPLL" config such new #ifdefs can be avoided for the future socs and also to cleanup the existing
ifdefferies.

---
 arch/arm/mach-omap2/Kconfig             |    5 +++++
 arch/arm/mach-omap2/clock.c             |    2 +-
 arch/arm/plat-omap/include/plat/clock.h |    4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/Kconfig +5 -0
index 0685dc8..9a8d691 100644
@@ -27,9 +27,13 @@ config ARCH_OMAP2
 	select CPU_V6
 	select MULTI_IRQ_HANDLER
 
+config SOC_HAS_OMAP_DPLL
+	bool
+
 config ARCH_OMAP3
 	bool "TI OMAP3"
 	depends on ARCH_OMAP2PLUS
+	select SOC_HAS_OMAP_DPLL
 	default y
 	select CPU_V7
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
@@ -42,6 +46,7 @@ config ARCH_OMAP4
 	bool "TI OMAP4"
 	default y
 	depends on ARCH_OMAP2PLUS
+	select SOC_HAS_OMAP_DPLL
 	select CACHE_L2X0
 	select CPU_V7
 	select ARM_GIC
arch/arm/mach-omap2/clock.c +1 -1
index d9f4931..629cd2d 100644
@@ -400,7 +400,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
 
 /* OMAP3/4 non-CORE DPLL clkops */
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
+#ifdef CONFIG_SOC_HAS_OMAP_DPLL
 
 const struct clkops clkops_omap3_noncore_dpll_ops = {
 	.enable		= omap3_noncore_dpll_enable,
arch/arm/plat-omap/include/plat/clock.h +2 -2
index d0ef57c..095bee8 100644
@@ -156,7 +156,7 @@ struct dpll_data {
 	u8			min_divider;
 	u16			max_divider;
 	u8			modes;
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
+#ifdef CONFIG_SOC_HAS_OMAP_DPLL
 	void __iomem		*autoidle_reg;
 	void __iomem		*idlest_reg;
 	u32			autoidle_mask;
@@ -167,7 +167,7 @@ struct dpll_data {
 	u8			auto_recal_bit;
 	u8			recal_en_bit;
 	u8			recal_st_bit;
-#  endif
+#endif
 	u8			flags;
 };
 
Signature · 1 line
1.7.1
#2 lore raw

PATCH 1/4 ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro

Quoted 72 lines · Sricharan

The DPLL ip was introduced and used in the OMAP3PLUS socs, while OMAP2 had the APLL IP. There are some features which are common to both ips, and some which are only applicable to DPLL ip's. Currently CONFIG_ARCH_OMAP_XXX checks is used to conditionally compile the additional features for every applicable SOC. This makes it nessecary to add new a check for every new SOC added in the future.

So by introducing a new "SOC_HAS_OMAP_DPLL" config such new #ifdefs can be avoided for the future socs and also to cleanup the existing
ifdefferies.

---
 arch/arm/mach-omap2/Kconfig             |    5 +++++
 arch/arm/mach-omap2/clock.c             |    2 +-
 arch/arm/plat-omap/include/plat/clock.h |    4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/Kconfig +5 -0
index 0685dc8..9a8d691 100644
@@ -27,9 +27,13 @@ config ARCH_OMAP2
 	select CPU_V6
 	select MULTI_IRQ_HANDLER
 
+config SOC_HAS_OMAP_DPLL
+	bool
+
 config ARCH_OMAP3
 	bool "TI OMAP3"
 	depends on ARCH_OMAP2PLUS
+	select SOC_HAS_OMAP_DPLL
 	default y
 	select CPU_V7
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
@@ -42,6 +46,7 @@ config ARCH_OMAP4
 	bool "TI OMAP4"
 	default y
 	depends on ARCH_OMAP2PLUS
+	select SOC_HAS_OMAP_DPLL
 	select CACHE_L2X0
 	select CPU_V7
 	select ARM_GIC
arch/arm/mach-omap2/clock.c +1 -1
index d9f4931..629cd2d 100644
@@ -400,7 +400,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
 
 /* OMAP3/4 non-CORE DPLL clkops */
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
+#ifdef CONFIG_SOC_HAS_OMAP_DPLL
 
 const struct clkops clkops_omap3_noncore_dpll_ops = {
 	.enable		= omap3_noncore_dpll_enable,
arch/arm/plat-omap/include/plat/clock.h +1 -1
index d0ef57c..095bee8 100644
@@ -156,7 +156,7 @@ struct dpll_data {
 	u8			min_divider;
 	u16			max_divider;
 	u8			modes;
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
+#ifdef CONFIG_SOC_HAS_OMAP_DPLL
 	void __iomem		*autoidle_reg;
 	void __iomem		*idlest_reg;
 	u32			autoidle_mask;

arch/arm/plat-omap/include/plat/clock.h struct dpll_data { · line 170

Quoted 5 lines
arch/arm/plat-omap/include/plat/clock.h +1 -1
@@ -167,7 +167,7 @@ struct dpll_data {
 	u8			auto_recal_bit;
 	u8			recal_en_bit;
 	u8			recal_st_bit;
-#  endif
+#endif

I had submitted similar patch recently, and Kevin had suggested that Instead of adding config option, we shoule simply get rid of this ifdef completely.

Refer to
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg68293.html

Waiting for Paul to conform here.

Thanks,
Vaibhav

#3 lore raw

PATCH 1/4 ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro

Vaibhav,
[snip]

Quoted 24 lines
Quoted 14 lines
arch/arm/plat-omap/include/plat/clock.h +1 -1
index d0ef57c..095bee8 100644
@@ -156,7 +156,7 @@ struct dpll_data {
 ? ? ? u8 ? ? ? ? ? ? ? ? ? ? ?min_divider;
 ? ? ? u16 ? ? ? ? ? ? ? ? ? ? max_divider;
 ? ? ? u8 ? ? ? ? ? ? ? ? ? ? ?modes;
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
+#ifdef CONFIG_SOC_HAS_OMAP_DPLL
 ? ? ? void __iomem ? ? ? ? ? ?*autoidle_reg;
 ? ? ? void __iomem ? ? ? ? ? ?*idlest_reg;
 ? ? ? u32 ? ? ? ? ? ? ? ? ? ? autoidle_mask;

arch/arm/plat-omap/include/plat/clock.h struct dpll_data { · line 170

Quoted 5 lines
arch/arm/plat-omap/include/plat/clock.h +1 -1
@@ -167,7 +167,7 @@ struct dpll_data {
 ? ? ? u8 ? ? ? ? ? ? ? ? ? ? ?auto_recal_bit;
 ? ? ? u8 ? ? ? ? ? ? ? ? ? ? ?recal_en_bit;
 ? ? ? u8 ? ? ? ? ? ? ? ? ? ? ?recal_st_bit;
-# ?endif
+#endif

I had submitted similar patch recently, and Kevin had suggested that Instead of adding config option, we shoule simply get rid of this ifdef completely.

Quoted 6 lines

Refer to
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg68293.html

Waiting for Paul to conform here.

Thanks for pointing that out. Will check on this and Paul's PRCM series cleanup series then.

Thanks,
Sricharan

#4 lore raw

PATCH 1/4 ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro

Quoted 7 lines · Sricharan

Vaibhav,
[snip]

Quoted 2 lines

Waiting for Paul to conform here.

Thanks for pointing that out. Will check on this and Paul's PRCM series cleanup series then.

Sricharan,

Yesterday, Paul confirmed that, removing ifdef is the way to go. So just few mins back I had submitted patch for the same.

http://permalink.gmane.org/gmane.linux.ports.arm.omap/76972

Thanks,
Vaibhav

#6 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

In reply to R Sricharan

Some prm and cm registers read/write and status functions are built only for some custom OMAP2+ builds and are stubbed in header files for other builds under ifdef statements. But this results in adding new CONFIG_ARCH_OMAPXXX checks when SOCs are added in the future. So move them to a common place for OMAP2+ and make them 'weak' implementations.

This way no new ifdefs would be required in the future and also cleans up the existing code.

---
 arch/arm/mach-omap2/cminst44xx.h   |   25 ------------
 arch/arm/mach-omap2/prcm.c         |   77 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm2xxx_3xxx.h |   65 ------------------------------
 3 files changed, 77 insertions(+), 90 deletions(-)
arch/arm/mach-omap2/cminst44xx.h +0 -25
index a018a73..d69fdef 100644
@@ -16,38 +16,13 @@ extern void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs);
 extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs);
 extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
 extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);
-
 extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
-
-# ifdef CONFIG_ARCH_OMAP4
 extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
 					 u16 clkctrl_offs);
-
 extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
 				       u16 clkctrl_offs);
 extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
 					u16 clkctrl_offs);
-
-# else
-
-static inline int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
-					u16 clkctrl_offs)
-{
-	return 0;
-}
-
-static inline void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
-				s16 cdoffs, u16 clkctrl_offs)
-{
-}
-
-static inline void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
-				 u16 clkctrl_offs)
-{
-}
-
-# endif
-
 /*
  * In an ideal world, we would not export these low-level functions,
  * but this will probably take some time to fix properly
arch/arm/mach-omap2/prcm.c +77 -0

80 lines not on this page · raw message

arch/arm/mach-omap2/prm2xxx_3xxx.h +0 -65

77 lines not on this page · raw message

Signature · 1 line
1.7.1
maintainer
#7 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

Hi

Quoted 6 lines · R Sricharan

Some prm and cm registers read/write and status functions are built only for some custom OMAP2+ builds and are stubbed in header files for other builds under ifdef statements. But this results in adding new CONFIG_ARCH_OMAPXXX checks when SOCs are added in the future. So move them to a common place for OMAP2+ and make them 'weak' implementations.

Thanks for the patch. These stubs aren't needed any longer, so we can just get rid of them; no need to mark them __weak. I've got a patch to just drop them here to be posted soon as part of a larger PRCM cleanup.

- Paul

#8 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

Hi Paul,

Quoted 10 lines · R Sricharan
Quoted 7 lines

Some prm and cm registers read/write and status functions are built only for some custom OMAP2+ builds and are stubbed in header files for other builds under ifdef statements. But this results in adding new CONFIG_ARCH_OMAPXXX checks when SOCs are added in the future. So move them to a common place for OMAP2+ and make them 'weak' implementations.

Quoted 4 lines

Thanks for the patch. These stubs aren't needed any longer, so we can just get rid of them; no need to mark them __weak. I've got a patch to just drop them here to be posted soon as part of a larger PRCM cleanup.

Thanks. I will pick up your series.

Thanks,
Sricharan

#9 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

In reply to Paul Walmsley

Hi Paul,

Quoted 7 lines
Quoted 6 lines

Some prm and cm registers read/write and status functions are built only for some custom OMAP2+ builds and are stubbed in header files for other builds under ifdef statements. But this results in adding new CONFIG_ARCH_OMAPXXX checks when SOCs are added in the future. So move them to a common place for OMAP2+ and make them 'weak' implementations.

Quoted 5 lines

Thanks for the patch. ?These stubs aren't needed any longer, so we can just get rid of them; no need to mark them __weak. ?I've got a patch to just drop them here to be posted soon as part of a larger PRCM cleanup.

Is the PRCM cleanup series available now ?

Thanks,
Sricharan

#10 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

Ping..

Thanks,
Sricharan

Quoted 18 lines · Sricharan

Hi Paul,

Quoted 7 lines
Quoted 6 lines

Some prm and cm registers read/write and status functions are built only for some custom OMAP2+ builds and are stubbed in header files for other builds under ifdef statements. But this results in adding new CONFIG_ARCH_OMAPXXX checks when SOCs are added in the future. So move them to a common place for OMAP2+ and make them 'weak' implementations.

Quoted 5 lines

Thanks for the patch. ?These stubs aren't needed any longer, so we can just get rid of them; no need to mark them __weak. ?I've got a patch to just drop them here to be posted soon as part of a larger PRCM cleanup.

?Is the PRCM cleanup series available now ?

Thanks,
?Sricharan

maintainer
#11 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

Hi

Quoted 1 line · Sricharan

Ping..

Since the prcm.c cleanup series isn't ready yet, I've queued this modified version of your patch.

Once the prcm.c cleanup series is ready, hopefully in the 3.7 time frame, we'll be able to get rid of all of these nasty stubs.

- Paul

From: R Sricharan <[email protected]>
Date: Thu, 10 May 2012 22:36:53 +0530
Subject: [PATCH] ARM: OMAP2+: PRM/CM: Move the stubbed prm and cm functions
to prcm.c file and make them __weak

Some prm and cm registers read/write and status functions are built only for some custom OMAP2+ builds and are stubbed in header files for other builds under ifdef statements. But this results in adding new CONFIG_ARCH_OMAPXXX checks when SOCs are added in the future. So move them to a common place for OMAP2+ and make them 'weak' implementations.

This way no new ifdefs would be required in the future and also cleans up the existing code.

[paul at pwsan.com: unsplit quoted strings; moved PRM functions to
mach-omap2/prm_common.c; resolved sparse warnings]

---
 arch/arm/mach-omap2/cminst44xx.h   |   25 --------------
 arch/arm/mach-omap2/prcm.c         |   23 +++++++++++++
 arch/arm/mach-omap2/prm2xxx_3xxx.h |   65 ------------------------------------
 arch/arm/mach-omap2/prm_common.c   |   62 ++++++++++++++++++++++++++++++++++
 4 files changed, 85 insertions(+), 90 deletions(-)
arch/arm/mach-omap2/cminst44xx.h +0 -25
index a018a73..d69fdef 100644
@@ -16,38 +16,13 @@ extern void omap4_cminst_clkdm_enable_hwsup(u8 part, s16 inst, u16 cdoffs);
 extern void omap4_cminst_clkdm_disable_hwsup(u8 part, s16 inst, u16 cdoffs);
 extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
 extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);
-
 extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
-
-# ifdef CONFIG_ARCH_OMAP4
 extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
 					 u16 clkctrl_offs);
-
 extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
 				       u16 clkctrl_offs);
 extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
 					u16 clkctrl_offs);
-
-# else
-
-static inline int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
-					u16 clkctrl_offs)
-{
-	return 0;
-}
-
-static inline void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
-				s16 cdoffs, u16 clkctrl_offs)
-{
-}
-
-static inline void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
-				 u16 clkctrl_offs)
-{
-}
-
-# endif
-
 /*
  * In an ideal world, we would not export these low-level functions,
  * but this will probably take some time to fix properly
arch/arm/mach-omap2/prcm.c +23 -0
index 480f40a..28cbfb2 100644
@@ -35,6 +35,7 @@
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
+#include "cminst44xx.h"
 #include "prm-regbits-24xx.h"
 #include "prm-regbits-44xx.h"
 #include "control.h"
@@ -164,3 +165,25 @@ void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
 		omap_cm_base_init();
 	}
 }
+
+/*
+ * Stubbed functions so that common files continue to build when
+ * custom builds are used
+ * XXX These are temporary and should be removed at the earliest possible
+ * opportunity
+ */
+int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
+					u16 clkctrl_offs)
+{
+	return 0;
+}
+
+void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
+				s16 cdoffs, u16 clkctrl_offs)
+{
+}
+
+void __weak omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
+				 u16 clkctrl_offs)
+{
+}
arch/arm/mach-omap2/prm2xxx_3xxx.h +0 -65

77 lines not on this page · raw message

arch/arm/mach-omap2/prm_common.c +62 -0

65 lines not on this page · raw message

Signature · 1 line
1.7.10
#12 lore raw

PATCH 2/4 ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak.

Hi Paul,

Quoted 4 lines · Paul Walmsley

Hi

On Thu, 28 Jun 2012, R, Sricharan wrote:

Quoted 8 lines
Quoted 1 line

Ping..

Since the prcm.c cleanup series isn't ready yet, I've queued this modified version of your patch.

Once the prcm.c cleanup series is ready, hopefully in the 3.7 time frame, we'll be able to get rid of all of these nasty stubs.

Thanks a lot. I think this should help to get rid of the OMAP5 dependency.

Thanks,
Sricharan

#13 lore raw

PATCH 3/4 ARM: OMAP2+: Move stubbed secure_sram_reserve function to a common.c and call it __weak

In reply to R Sricharan

omap_secure_ram_reserve_memblock is stubbed for OMAP1,2 only builds using a
ifdef check. But this results in adding CONFIG_ARCH_OMAPxx checks for
future socs that use the real function. So move this to common.c file and call it __weak.

---
 arch/arm/plat-omap/common.c                   |    9 +++++++++
 arch/arm/plat-omap/include/plat/omap-secure.h |    5 -----
 2 files changed, 9 insertions(+), 5 deletions(-)
arch/arm/plat-omap/common.c +9 -0
index 0a9b9a9..89a3723 100644
@@ -77,3 +77,12 @@ void __init omap_init_consistent_dma_size(void)
 	init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20);
 #endif
 }
+
+/*
+ * Stub function for OMAP2 so that common files
+ * continue to build when custom builds are used
+ */
+int __weak omap_secure_ram_reserve_memblock(void)
+{
+	return 0;
+}
arch/arm/plat-omap/include/plat/omap-secure.h +0 -5
index 8c7994c..0e4acd2 100644
@@ -3,12 +3,7 @@
 
 #include <linux/types.h>
 
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 extern int omap_secure_ram_reserve_memblock(void);
-#else
-static inline void omap_secure_ram_reserve_memblock(void)
-{ }
-#endif
 
 #ifdef CONFIG_OMAP4_ERRATA_I688
 extern int omap_barrier_reserve_memblock(void);
Signature · 1 line
1.7.1
#14 lore raw

PATCH 4/4 ARM: OMAP: counter-32k: Select the CR register offset using the IP scheme.

In reply to R Sricharan

OMAP socs has a legacy and a highlander version of the 32k sync counter IP. The register offsets vary between the highlander and the legacy scheme. So use the 'SCHEME' bits(30-31) of the revision register to distinguish between the two versions and choose the CR register offset accordingly.

---
 arch/arm/plat-omap/counter_32k.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
arch/arm/plat-omap/counter_32k.c +13 -3
index b2f634b..cbd939d 100644
@@ -28,7 +28,10 @@
 #include <plat/clock.h>
 
 /* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
-#define OMAP2_32KSYNCNT_CR_OFF		0x10
+#define OMAP2_32KSYNCNT_REV_OFF		0x0
+#define OMAP2_32KSYNCNT_REV_SCHEME	(0x3 << 30)
+#define OMAP2_32KSYNCNT_CR_OFF_LOW	0x10
+#define OMAP2_32KSYNCNT_CR_OFF_HIGH	0x30
 
 /*
  * 32KHz clocksource ... always available, on pretty most chips except
@@ -83,9 +86,16 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
 	int ret;
 
 	/*
-	 * 32k sync Counter register offset is@0x10
+	 * 32k sync Counter IP register offsets vary between the
+	 * highlander version and the legacy ones.
+	 * The 'SCHEME' bits(30-31) of the revision register is used
+	 * to identify the version.
 	 */
-	sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF;
+	if (__raw_readl(vbase + OMAP2_32KSYNCNT_REV_OFF) &
+						OMAP2_32KSYNCNT_REV_SCHEME)
+		sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH;
+	else
+		sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_LOW;
 
 	/*
 	 * 120000 rough estimate from the calculations in
Signature · 1 line
1.7.1
#15 lore raw

cover ARM: OMAP2+: Misc cleanup part2

In reply to R Sricharan
Quoted 14 lines

-----Original Message-----
From: R Sricharan [mailto:r.sricharan at ti.com]
Sent: Thursday, May 10, 2012 10:37 PM
To: linux-omap at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org; santosh.shilimkar at ti.com; tony at atomide.com; b-cousson at ti.com; r.sricharan at ti.com; paul at pswan.com
Subject: [PATCH 0/4] ARM: OMAP2+: Misc cleanup part2

This is a continuation of the previous cleanup series from santosh.shilimkar at ti.com [1]. Patches are outcome of the OMAP5 review suggestions from Tony/Benoit/Santosh/Rajendra.

[1] http://www.spinics.net/lists/linux-omap/msg69730.html

Quoted 9 lines

R Sricharan (4):
ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro
ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and
make them __weak.
ARM: OMAP2+: Move stubbed secure_sram_reserve function to a common.c
and call it __weak
ARM: OMAP: counter-32k: Select the CR register offset using the IP
scheme.

Forgot to add the below reviewed-by tag.

Thanks,
Sricharan