Skip to contentSkip to conversation

ARM: OMAP2+: Cleanup series in order to remove ARCH_OMAPx dependency

PATCH Superseded Vaibhav Hiremath 2 participants 9 messages May 8, 2012

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ARM: OMAP2+: Cleanup series in order to remove ARCH_OMAPx dependency

In current implementation, some places we are still using ARCH_OMAPx config option, making it difficult to add new devices; for example, while adding am33xx device support I came across multiple instances where I had to patch the existing code to make it work for am33xx.

This patch tries to cleanup existing code for some of the ARCH_OMAP2/3/4 dependency on the code.

NOTE: Patch series has been boot tested on omap3evm and
build tested for all possible combination of OMAP2, 3, 4 configurations.

Vaibhav Hiremath (4):
ARM: OMAP2+: CLEANUP: All OMAP2PLUS uses omap-device.o target so add
one entry
ARM: OMAP2+: CLEANUP: Move omap3 dpll ops to dpll3xxx.c
ARM: OMAP2+: CLEANUP: Remove unnecessary ifdef around

    __omap2_set_globals

ARM: OMAP2+: CLEANUP: Add new config option for different DPLL
features

 arch/arm/mach-omap2/Kconfig             |   42 +++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/clock.c             |   18 -------------
 arch/arm/mach-omap2/common.c            |    8 +-----
 arch/arm/mach-omap2/common.h            |    5 +++
 arch/arm/mach-omap2/dpll3xxx.c          |   14 ++++++++++
 arch/arm/plat-omap/Makefile             |    4 +--
 arch/arm/plat-omap/include/plat/clock.h |   14 ++++++++--
 7 files changed, 74 insertions(+), 31 deletions(-)
#1 lore raw

PATCH 1/4 ARM: OMAP2+: CLEANUP: All OMAP2PLUS uses omap-device.o target so add one entry

All OMAP2PLUS based devices, builds omap-device.o target; so just add one entry so that there is no need to patch this file for any future OMAP2+ devices.

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
---
 arch/arm/plat-omap/Makefile |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-omap/Makefile +1 -3
index ed8605f..c5b5f05 100644
@@ -10,9 +10,7 @@ obj-n :=
 obj-  :=
 
 # omap_device support (OMAP2+ only at the moment)
-obj-$(CONFIG_ARCH_OMAP2) += omap_device.o
-obj-$(CONFIG_ARCH_OMAP3) += omap_device.o
-obj-$(CONFIG_ARCH_OMAP4) += omap_device.o
+obj-$(CONFIG_ARCH_OMAP2PLUS) += omap_device.o
 
 obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
 obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/4 ARM: OMAP2+: CLEANUP: Move omap3 dpll ops to dpll3xxx.c

In reply to Vaibhav Hiremath

In order to remove unnecessary idefs, move noncore and core dpll ops to dpll3xxx.c file (where it should have been already).

The clkops (clkops_omap3_core_dpll_ops & clkops_omap3_noncore_dpll_ops) is used in clock data files, and dependency is already handled by Makefile rule.

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
---
 arch/arm/mach-omap2/clock.c    |   18 ------------------
 arch/arm/mach-omap2/dpll3xxx.c |   14 ++++++++++++++
 2 files changed, 14 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/clock.c +0 -18
index d9f4931..950a446 100644
@@ -398,24 +398,6 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
 	return omap2_clksel_set_parent(clk, new_parent);
 }
 
-/* OMAP3/4 non-CORE DPLL clkops */
-
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
-
-const struct clkops clkops_omap3_noncore_dpll_ops = {
-	.enable		= omap3_noncore_dpll_enable,
-	.disable	= omap3_noncore_dpll_disable,
-	.allow_idle	= omap3_dpll_allow_idle,
-	.deny_idle	= omap3_dpll_deny_idle,
-};
-
-const struct clkops clkops_omap3_core_dpll_ops = {
-	.allow_idle	= omap3_dpll_allow_idle,
-	.deny_idle	= omap3_dpll_deny_idle,
-};
-
-#endif
-
 /*
  * OMAP2+ clock reset and init functions
  */
arch/arm/mach-omap2/dpll3xxx.c +14 -0
index fc56745..d15f2a2 100644
@@ -615,3 +615,17 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
 		rate = clk->parent->rate * 2;
 	return rate;
 }
+
+/* OMAP3/4 non-CORE DPLL clkops */
+
+const struct clkops clkops_omap3_noncore_dpll_ops = {
+	.enable		= omap3_noncore_dpll_enable,
+	.disable	= omap3_noncore_dpll_disable,
+	.allow_idle	= omap3_dpll_allow_idle,
+	.deny_idle	= omap3_dpll_deny_idle,
+};
+
+const struct clkops clkops_omap3_core_dpll_ops = {
+	.allow_idle	= omap3_dpll_allow_idle,
+	.deny_idle	= omap3_dpll_deny_idle,
+};

--
1.7.0.4

#3 lore raw

PATCH 3/4 ARM: OMAP2+: CLEANUP: Remove unnecessary ifdef around __omap2_set_globals

In reply to Vaibhav Hiremath

The function __omap2_set_globals() can be common across all platforms/architectures, even in case of omap4, internally it calls same set of functions as in __omap2_set_globals() function (except for sdrc).
This patch adds new config flag SOC_HAS_SDRC to handle sdrc, so that we can reuse same function across omap2/3/4...

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
---
 arch/arm/mach-omap2/Kconfig  |    8 ++++++++
 arch/arm/mach-omap2/common.c |    8 +-------
 arch/arm/mach-omap2/common.h |    5 +++++
 3 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/Kconfig +8 -0
index 0685dc8..2277359 100644
@@ -20,12 +20,16 @@ config ARCH_OMAP2PLUS_TYPICAL
 	help
 	  Compile a kernel suitable for booting most boards
 
+config SOC_HAS_SDRC
+	bool "SDRAM Controller support"
+
 config ARCH_OMAP2
 	bool "TI OMAP2"
 	depends on ARCH_OMAP2PLUS
 	default y
 	select CPU_V6
 	select MULTI_IRQ_HANDLER
+	select SOC_HAS_SDRC
 
 config ARCH_OMAP3
 	bool "TI OMAP3"
@@ -37,6 +41,7 @@ config ARCH_OMAP3
 	select PM_OPP if PM
 	select ARM_CPU_SUSPEND if PM
 	select MULTI_IRQ_HANDLER
+	select SOC_HAS_SDRC
 
 config ARCH_OMAP4
 	bool "TI OMAP4"
@@ -64,18 +69,21 @@ config SOC_OMAP2420
 	default y
 	select OMAP_DM_TIMER
 	select ARCH_OMAP_OTG
+	select SOC_HAS_SDRC
 
 config SOC_OMAP2430
 	bool "OMAP2430 support"
 	depends on ARCH_OMAP2
 	default y
 	select ARCH_OMAP_OTG
+	select SOC_HAS_SDRC
 
 config SOC_OMAP3430
 	bool "OMAP3430 support"
 	depends on ARCH_OMAP3
 	default y
 	select ARCH_OMAP_OTG
+	select SOC_HAS_SDRC
 
 config SOC_OMAPTI81XX
 	bool "TI81XX support"
arch/arm/mach-omap2/common.c +1 -7
index 1549c11..ad8626d 100644
@@ -29,8 +29,6 @@
 
 /* Global address base setup code */
 
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-
 static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 {
 	omap2_set_globals_tap(omap2_globals);
@@ -39,8 +37,6 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
 	omap2_set_globals_prcm(omap2_globals);
 }
 
-#endif
-
 #if defined(CONFIG_SOC_OMAP2420)
 
 static struct omap_globals omap242x_globals = {
@@ -170,9 +166,7 @@ static struct omap_globals omap4_globals = {
 
 void __init omap2_set_globals_443x(void)
 {
-	omap2_set_globals_tap(&omap4_globals);
-	omap2_set_globals_control(&omap4_globals);
-	omap2_set_globals_prcm(&omap4_globals);
+	__omap2_set_globals(&omap4_globals);
 }
 
 void __init omap4_map_io(void)
arch/arm/mach-omap2/common.h +5 -0
index 0e95efc..70dee99 100644
@@ -122,7 +122,12 @@ void omap2_set_globals_am33xx(void);
 
 /* These get called from omap2_set_globals_xxxx(), do not call these */
 void omap2_set_globals_tap(struct omap_globals *);
+#if defined(CONFIG_SOC_HAS_SDRC)
 void omap2_set_globals_sdrc(struct omap_globals *);
+#else
+static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
+{ }
+#endif
 void omap2_set_globals_control(struct omap_globals *);
 void omap2_set_globals_prcm(struct omap_globals *);
 
Signature · 1 line
1.7.0.4
maintainer
#4 lore raw

PATCH 3/4 ARM: OMAP2+: CLEANUP: Remove unnecessary ifdef around __omap2_set_globals

Quoted 9 lines · Vaibhav Hiremath
arch/arm/mach-omap2/Kconfig +3 -0
@@ -20,12 +20,16 @@ config ARCH_OMAP2PLUS_TYPICAL
 	help
 	  Compile a kernel suitable for booting most boards
 
+config SOC_HAS_SDRC
+	bool "SDRAM Controller support"
+

arch/arm/mach-omap2/Kconfig config ARCH_OMAP2PLUS_TYPICAL · line 35

Quoted 10 lines
arch/arm/mach-omap2/Kconfig +1 -0
 config ARCH_OMAP2
 	bool "TI OMAP2"
 	depends on ARCH_OMAP2PLUS
 	default y
 	select CPU_V6
 	select MULTI_IRQ_HANDLER
+	select SOC_HAS_SDRC
 
 config ARCH_OMAP3
 	bool "TI OMAP3"

These still need to have OMAP in them, and ideally the type of the block. Something like SOC_HAS_OMAP2_SDRC?

Regards,

Tony

#5 lore raw

RFC PATCH 4/4 ARM: OMAP2+: CLEANUP: Add new config option for different DPLL features

In reply to Vaibhav Hiremath

This patch cleans up dpll_data structure, making structure fields definition based on feature availability for given SoC, managed using Kconfig rules.

SOC_HAS_DPLL_IDLE: idle state
SOC_HAS_DPLL_RECAL: recalibration capability
SOC_HAS_DPLL_DCO_SEL: dco selection
SOC_HAS_DPLL_SDDIV: sigma-delta div factor
SOC_HAS_DPLL_FREQSEL: frequency selection

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
---
 arch/arm/mach-omap2/Kconfig             |   34 +++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/clock.h |   14 ++++++++++--
 2 files changed, 45 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/Kconfig +34 -0
index 2277359..93bf5e2 100644
@@ -20,6 +20,21 @@ config ARCH_OMAP2PLUS_TYPICAL
 	help
 	  Compile a kernel suitable for booting most boards
 
+config SOC_HAS_DPLL_IDLE
+	bool "DPLL idle state support"
+
+config SOC_HAS_DPLL_RECAL
+	bool "DPLL Recalibration support"
+
+config SOC_HAS_DPLL_DCO_SEL
+	bool "DPLL DCO (Digitally Controlled Oscilators) support"
+
+config SOC_HAS_DPLL_SDDIV
+	bool "DPLL Sigma-Delta Divider support"
+
+config SOC_HAS_DPLL_FREQSEL
+	bool "DPLL Freq Select support"
+
 config SOC_HAS_SDRC
 	bool "SDRAM Controller support"
 
@@ -42,6 +57,11 @@ config ARCH_OMAP3
 	select ARM_CPU_SUSPEND if PM
 	select MULTI_IRQ_HANDLER
 	select SOC_HAS_SDRC
+	select SOC_HAS_DPLL_IDLE
+	select SOC_HAS_DPLL_RECAL
+	select SOC_HAS_DPLL_DCO_SEL
+	select SOC_HAS_DPLL_SDDIV
+	select SOC_HAS_DPLL_FREQSEL
 
 config ARCH_OMAP4
 	bool "TI OMAP4"
@@ -59,6 +79,9 @@ config ARCH_OMAP4
 	select PM_OPP if PM
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
 	select ARM_CPU_SUSPEND if PM
+	select SOC_HAS_DPLL_IDLE
+	select SOC_HAS_DPLL_RECAL
+	select SOC_HAS_DPLL_SDDIV
 
 comment "OMAP Core Type"
 	depends on ARCH_OMAP2
@@ -84,16 +107,27 @@ config SOC_OMAP3430
 	default y
 	select ARCH_OMAP_OTG
 	select SOC_HAS_SDRC
+	select SOC_HAS_DPLL_IDLE
+	select SOC_HAS_DPLL_RECAL
+	select SOC_HAS_DPLL_DCO_SEL
+	select SOC_HAS_DPLL_SDDIV
+	select SOC_HAS_DPLL_FREQSEL
 
 config SOC_OMAPTI81XX
 	bool "TI81XX support"
 	depends on ARCH_OMAP3
 	default y
+	select SOC_HAS_DPLL_IDLE
+	select SOC_HAS_DPLL_RECAL
+	select SOC_HAS_DPLL_SDDIV
 
 config SOC_OMAPAM33XX
 	bool "AM33XX support"
 	depends on ARCH_OMAP3
 	default y
+	select SOC_HAS_DPLL_IDLE
+	select SOC_HAS_DPLL_RECAL
+	select SOC_HAS_DPLL_SDDIV
 
 config OMAP_PACKAGE_ZAF
        bool
arch/arm/plat-omap/include/plat/clock.h +11 -3
index d0ef57c..aa81c04 100644
@@ -156,18 +156,26 @@ struct dpll_data {
 	u8			min_divider;
 	u16			max_divider;
 	u8			modes;
-#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
+#if defined(CONFIG_SOC_HAS_DPLL_IDLE)
 	void __iomem		*autoidle_reg;
 	void __iomem		*idlest_reg;
 	u32			autoidle_mask;
-	u32			freqsel_mask;
 	u32			idlest_mask;
+#endif
+#if defined(CONFIG_SOC_HAS_DPLL_FREQSEL)
+	u32			freqsel_mask;
+#endif
+#if defined(CONFIG_SOC_HAS_DPLL_DCO_SEL)
 	u32			dco_mask;
+#endif
+#if defined(CONFIG_SOC_HAS_DPLL_SDDIV)
 	u32			sddiv_mask;
+#endif
+#if defined(CONFIG_SOC_HAS_DPLL_RECAL)
 	u8			auto_recal_bit;
 	u8			recal_en_bit;
 	u8			recal_st_bit;
-#  endif
+#endif
 	u8			flags;
 };
 

--
1.7.0.4

maintainer
#6 lore raw

RFC PATCH 4/4 ARM: OMAP2+: CLEANUP: Add new config option for different DPLL features

Quoted 9 lines · Vaibhav Hiremath

This patch cleans up dpll_data structure, making structure fields definition based on feature availability for given SoC, managed using Kconfig rules.

SOC_HAS_DPLL_IDLE: idle state
SOC_HAS_DPLL_RECAL: recalibration capability
SOC_HAS_DPLL_DCO_SEL: dco selection
SOC_HAS_DPLL_SDDIV: sigma-delta div factor
SOC_HAS_DPLL_FREQSEL: frequency selection

These too should be SOC_HAS_OMAPXYZ_DPLL_IDLE etc.

Regards,

Tony

#7 lore raw

RFC PATCH 4/4 ARM: OMAP2+: CLEANUP: Add new config option for different DPLL features

Quoted 5 lines · Tony Lindgren
Quoted 4 lines · Vaibhav Hiremath

This patch cleans up dpll_data structure, making structure fields definition based on feature availability for given SoC, managed using Kconfig rules.

Quoted 8 lines
Quoted 5 lines

SOC_HAS_DPLL_IDLE: idle state
SOC_HAS_DPLL_RECAL: recalibration capability
SOC_HAS_DPLL_DCO_SEL: dco selection
SOC_HAS_DPLL_SDDIV: sigma-delta div factor
SOC_HAS_DPLL_FREQSEL: frequency selection

These too should be SOC_HAS_OMAPXYZ_DPLL_IDLE etc.

Thanks Tony, I will change the option accordingly.
Do you have any further comments on this series? If, no, I will change the option name and submit immediately.

Thanks,
Vaibhav

maintainer
#8 lore raw

RFC PATCH 4/4 ARM: OMAP2+: CLEANUP: Add new config option for different DPLL features

Quoted 12 lines · Hiremath, Vaibhav
Quoted 11 lines · Tony Lindgren
Quoted 9 lines · Vaibhav Hiremath

This patch cleans up dpll_data structure, making structure fields definition based on feature availability for given SoC, managed using Kconfig rules.

SOC_HAS_DPLL_IDLE: idle state
SOC_HAS_DPLL_RECAL: recalibration capability
SOC_HAS_DPLL_DCO_SEL: dco selection
SOC_HAS_DPLL_SDDIV: sigma-delta div factor
SOC_HAS_DPLL_FREQSEL: frequency selection

Quoted 6 lines
Quoted 2 lines

These too should be SOC_HAS_OMAPXYZ_DPLL_IDLE etc.

Thanks Tony, I will change the option accordingly.
Do you have any further comments on this series? If, no, I will change the option name and submit immediately.

Thanks, looks OK to me otherwise.

Tony