* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
@ 2010-10-01 21:34 Paul Walmsley
2010-10-01 21:34 ` [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC Paul Walmsley
` (10 more replies)
0 siblings, 11 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:34 UTC (permalink / raw)
To: linux-arm-kernel
This series fixes several problems that appeared during branch
integration testing. These patches are intended to be merged through
Tony's tree for 2.6.37.
Change summary:
Recently, the OMAP System Control Module function exports were
removed. These are OMAP core-specific functions that should not be
used by drivers. Unfortunately, several drivers used these functions,
and as a result, these can no longer be built as modules. This series
resolves this problem by reimplementing or removing the OMAP SCM
accesses. In the case of McBSP, three additional functions were added
to arch/arm/mach-omap2/mcbsp.c to handle the signal muxing and clock
framework interaction. In the case of OMAP UDC, the code that
attempted to use the result of the SCM read was simply broken, so the
SCM read has been removed. These changes fix a build breakage. To
reduce the likelihood of future usage of the SCM code by drivers, the
SCM header files have been moved from plat-omap/include/plat to
mach-omap2 (as the SCM only exists on OMAP2+ systems). The McBSP
parent fclk and signal muxing changes have received only light
testing, so any help from OMAP ASoc experts here is appreciated.
Several boards that are specific to certain OMAP SoC variants
have now been marked as such in Kconfig; this prevents them from
being built if support for the SoC that they use is not being
built.
plat-omap/common.c has been split. OMAP2+ specific code (which had a
SCM dependency) has been moved into mach-omap2/common.c. The 32KiHz
sync timer code has been moved into its own file. The remainder of
the plat-omap/common.c code is deprecated.
Finally, a patch to reduce the amount of debugging generated by
the clock framework while it disables unused clocks is included.
According to Tim Bird, those debug messages are a significant
contributor to kernel boot time when debug-level messages are kept
enabled.
regards
- Paul
---
text data bss dec hex filename
5606503 438048 5610800 11655351 b1d8b7 vmlinux.omap2plus.orig
5607439 438848 5610800 11657087 b1df7f vmlinux.omap2plus.patched
Paul Walmsley (10):
OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC
OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro
OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases
OMAP2430: clock: add MCBSP_CLKS node and clkdev aliases
OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching
OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c
OMAP: McBSP: implement functional clock switching via clock framework
OMAP: split plat-omap/common.c
OMAP: control: move plat-omap/control.h to mach-omap2/control.h
OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks
arch/arm/mach-omap2/Kconfig | 6 -
arch/arm/mach-omap2/Makefile | 3
arch/arm/mach-omap2/board-3430sdp.c | 2
arch/arm/mach-omap2/board-4430sdp.c | 3
arch/arm/mach-omap2/board-am3517evm.c | 2
arch/arm/mach-omap2/board-apollon.c | 2
arch/arm/mach-omap2/board-cm-t3517.c | 2
arch/arm/mach-omap2/board-generic.c | 16 +-
arch/arm/mach-omap2/board-h4.c | 2
arch/arm/mach-omap2/board-ldp.c | 2
arch/arm/mach-omap2/board-omap3logic.c | 2
arch/arm/mach-omap2/board-omap4panda.c | 4
arch/arm/mach-omap2/clock.c | 2
arch/arm/mach-omap2/clock2420_data.c | 40 ++++
arch/arm/mach-omap2/clock2430_data.c | 64 ++++++
arch/arm/mach-omap2/clock3xxx_data.c | 12 +
arch/arm/mach-omap2/clock44xx_data.c | 2
arch/arm/mach-omap2/common.c | 138 +++++++++++++
arch/arm/mach-omap2/control.c | 3
arch/arm/mach-omap2/control.h | 18 +-
arch/arm/mach-omap2/cpuidle34xx.c | 2
arch/arm/mach-omap2/devices.c | 3
arch/arm/mach-omap2/hsmmc.c | 2
arch/arm/mach-omap2/id.c | 3
arch/arm/mach-omap2/mcbsp.c | 83 ++++++++
arch/arm/mach-omap2/mux.c | 8 -
arch/arm/mach-omap2/pm24xx.c | 2
arch/arm/mach-omap2/pm34xx.c | 2
arch/arm/mach-omap2/prcm.c | 2
arch/arm/mach-omap2/serial.c | 2
arch/arm/mach-omap2/sleep34xx.S | 2
arch/arm/mach-omap2/usb-fs.c | 6 -
arch/arm/plat-omap/32ksynctimer.c | 184 ++++++++++++++++++
arch/arm/plat-omap/Makefile | 2
arch/arm/plat-omap/clock.c | 5
arch/arm/plat-omap/common.c | 291 ----------------------------
arch/arm/plat-omap/devices.c | 1
arch/arm/plat-omap/include/plat/mcbsp.h | 22 ++
arch/arm/plat-omap/include/plat/omap24xx.h | 2
arch/arm/plat-omap/mcbsp.c | 3
arch/arm/plat-omap/sram.c | 3
drivers/usb/gadget/omap_udc.c | 18 --
sound/soc/omap/omap-mcbsp.c | 119 +++--------
43 files changed, 633 insertions(+), 459 deletions(-)
create mode 100644 arch/arm/mach-omap2/common.c
rename arch/arm/{plat-omap/include/plat/control.h => mach-omap2/control.h} (97%)
create mode 100644 arch/arm/plat-omap/32ksynctimer.c
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
@ 2010-10-01 21:34 ` Paul Walmsley
2010-10-04 4:21 ` Varadarajan, Charulatha
2010-10-01 21:34 ` [PATCH 02/10] OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro Paul Walmsley
` (9 subsequent siblings)
10 siblings, 1 reply; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:34 UTC (permalink / raw)
To: linux-arm-kernel
Currently, if, for example, CONFIG_ARCH_OMAP2420 is not selected, OMAP2420
board files can still be included in the build. This results in link errors:
arch/arm/mach-omap2/built-in.o: In function `omap_generic_map_io':
.../arch/arm/mach-omap2/board-generic.c:51: undefined reference to `omap2_set_globals_242x'
arch/arm/mach-omap2/built-in.o: In function `omap_h4_init':
.../arch/arm/mach-omap2/board-h4.c:330: undefined reference to `omap2420_mux_init'
arch/arm/mach-omap2/built-in.o: In function `omap_h4_map_io':
.../arch/arm/mach-omap2/board-h4.c:373: undefined reference to `omap2_set_globals_242x'
arch/arm/mach-omap2/built-in.o: In function `omap_apollon_init':
.../arch/arm/mach-omap2/board-apollon.c:325: undefined reference to `omap2420_mux_init'
arch/arm/mach-omap2/built-in.o: In function `omap_apollon_map_io':
.../arch/arm/mach-omap2/board-apollon.c:353: undefined reference to `omap2_set_globals_242x'
make: *** [.tmp_vmlinux1] Error 1
Fix this by making the boards depend on the Kconfig option for the
specific SoC that they use.
Also, while here, fix the mach-omap2/board-generic.c file to remove the
dependency on OMAP2420.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/Kconfig | 6 +++---
arch/arm/mach-omap2/board-generic.c | 16 ++++++++++++++--
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 1c4b237..7f740bd 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -101,20 +101,20 @@ config MACH_OMAP2_TUSB6010
config MACH_OMAP_H4
bool "OMAP 2420 H4 board"
- depends on ARCH_OMAP2
+ depends on ARCH_OMAP2420
default y
select OMAP_PACKAGE_ZAF
select OMAP_DEBUG_DEVICES
config MACH_OMAP_APOLLON
bool "OMAP 2420 Apollon board"
- depends on ARCH_OMAP2
+ depends on ARCH_OMAP2420
default y
select OMAP_PACKAGE_ZAC
config MACH_OMAP_2430SDP
bool "OMAP 2430 SDP board"
- depends on ARCH_OMAP2
+ depends on ARCH_OMAP2430
default y
select OMAP_PACKAGE_ZAC
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 3482b99..c7ec3f3 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -48,10 +48,22 @@ static void __init omap_generic_init(void)
static void __init omap_generic_map_io(void)
{
- omap2_set_globals_242x(); /* should be 242x, 243x, or 343x */
- omap242x_map_common_io();
+ if (cpu_is_omap242x()) {
+ omap2_set_globals_242x();
+ omap242x_map_common_io();
+ } else if (cpu_is_omap242x()) {
+ omap2_set_globals_243x();
+ omap243x_map_common_io();
+ } else if (cpu_is_omap34xx()) {
+ omap2_set_globals_3xxx();
+ omap34xx_map_common_io();
+ } else if (cpu_is_omap44xx()) {
+ omap2_set_globals_443x();
+ omap44xx_map_common_io();
+ }
}
+/* XXX This machine entry name should be updated */
MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
/* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
.phys_io = 0x48000000,
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 02/10] OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
2010-10-01 21:34 ` [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC Paul Walmsley
@ 2010-10-01 21:34 ` Paul Walmsley
2010-10-01 21:34 ` [PATCH 03/10] OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases Paul Walmsley
` (8 subsequent siblings)
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:34 UTC (permalink / raw)
To: linux-arm-kernel
Conform the OMAP2420_CTRL_BASE macro name to the standard of the rest of the
OMAP*_CTRL_BASE macro names. This fixes a bug in the OMAP2420 SCM code that
prevented OMAP242X_CTRL_REGADDR from working.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/plat-omap/common.c | 2 +-
arch/arm/plat-omap/include/plat/omap24xx.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 7d668b3..9200ea7 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -269,7 +269,7 @@ static struct omap_globals omap242x_globals = {
.tap = OMAP2_L4_IO_ADDRESS(0x48014000),
.sdrc = OMAP2420_SDRC_BASE,
.sms = OMAP2420_SMS_BASE,
- .ctrl = OMAP2420_CTRL_BASE,
+ .ctrl = OMAP242X_CTRL_BASE,
.prm = OMAP2420_PRM_BASE,
.cm = OMAP2420_CM_BASE,
.uart1_phys = OMAP2_UART1_BASE,
diff --git a/arch/arm/plat-omap/include/plat/omap24xx.h b/arch/arm/plat-omap/include/plat/omap24xx.h
index 7055672..92df9e2 100644
--- a/arch/arm/plat-omap/include/plat/omap24xx.h
+++ b/arch/arm/plat-omap/include/plat/omap24xx.h
@@ -40,7 +40,7 @@
#define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000)
#define OMAP24XX_IVA_INTC_BASE 0x40000000
-#define OMAP2420_CTRL_BASE L4_24XX_BASE
+#define OMAP242X_CTRL_BASE L4_24XX_BASE
#define OMAP2420_32KSYNCT_BASE (L4_24XX_BASE + 0x4000)
#define OMAP2420_PRCM_BASE (L4_24XX_BASE + 0x8000)
#define OMAP2420_CM_BASE (L4_24XX_BASE + 0x8000)
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 03/10] OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
2010-10-01 21:34 ` [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC Paul Walmsley
2010-10-01 21:34 ` [PATCH 02/10] OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro Paul Walmsley
@ 2010-10-01 21:34 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 04/10] OMAP2430: " Paul Walmsley
` (7 subsequent siblings)
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:34 UTC (permalink / raw)
To: linux-arm-kernel
Add the MCBSP_CLKS clock and the clksel structures needed to support clock
framework-based source switching for McBSP 1 and 2. Also, add clkdev
aliases on the parent clocks for the McBSP source switching code, added
in a subsequent patch.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock2420_data.c | 40 ++++++++++++++++++++++++++++++++--
1 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 5f2066a..7086fe4 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -18,6 +18,7 @@
#include <linux/list.h>
#include <plat/clkdev_omap.h>
+#include <plat/control.h>
#include "clock.h"
#include "clock2xxx.h"
@@ -89,6 +90,12 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
.clkdm_name = "wkup_clkdm",
};
+/* Optional external clock input for McBSP CLKS */
+static struct clk mcbsp_clks = {
+ .name = "mcbsp_clks",
+ .ops = &clkops_null,
+};
+
/*
* Analog domain root source clocks
*/
@@ -1135,14 +1142,34 @@ static struct clk mcbsp1_ick = {
.recalc = &followparent_recalc,
};
+static const struct clksel_rate common_mcbsp_96m_rates[] = {
+ { .div = 1, .val = 0, .flags = RATE_IN_24XX },
+ { .div = 0 }
+};
+
+static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
+ { .div = 1, .val = 1, .flags = RATE_IN_24XX },
+ { .div = 0 }
+};
+
+static const struct clksel mcbsp_fck_clksel[] = {
+ { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
+ { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
+ { .parent = NULL }
+};
+
static struct clk mcbsp1_fck = {
.name = "mcbsp1_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
+ .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcbsp2_ick = {
@@ -1159,10 +1186,14 @@ static struct clk mcbsp2_fck = {
.name = "mcbsp2_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
+ .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcspi1_ick = {
@@ -1721,6 +1752,9 @@ static struct omap_clk omap2420_clks[] = {
CLK(NULL, "osc_ck", &osc_ck, CK_242X),
CLK(NULL, "sys_ck", &sys_ck, CK_242X),
CLK(NULL, "alt_ck", &alt_ck, CK_242X),
+ CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_242X),
+ CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_242X),
+ CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
/* internal analog sources */
CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
@@ -1728,6 +1762,8 @@ static struct omap_clk omap2420_clks[] = {
/* internal prcm root sources */
CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
CLK(NULL, "core_ck", &core_ck, CK_242X),
+ CLK("omap-mcbsp.1", "prcm_fck", &func_96m_ck, CK_242X),
+ CLK("omap-mcbsp.2", "prcm_fck", &func_96m_ck, CK_242X),
CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 04/10] OMAP2430: clock: add MCBSP_CLKS node and clkdev aliases
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (2 preceding siblings ...)
2010-10-01 21:34 ` [PATCH 03/10] OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 05/10] OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching Paul Walmsley
` (6 subsequent siblings)
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Add the MCBSP_CLKS clock and the clksel structures needed to support clock
framework-based source switching for McBSPs 1-5. Also, add clkdev
aliases on the parent clocks for the McBSP source switching code, added
in a subsequent patch.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock2430_data.c | 64 +++++++++++++++++++++++++++++++---
1 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 701a171..4548319 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -18,6 +18,7 @@
#include <linux/list.h>
#include <plat/clkdev_omap.h>
+#include <plat/control.h>
#include "clock.h"
#include "clock2xxx.h"
@@ -89,6 +90,12 @@ static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
.clkdm_name = "wkup_clkdm",
};
+/* Optional external clock input for McBSP CLKS */
+static struct clk mcbsp_clks = {
+ .name = "mcbsp_clks",
+ .ops = &clkops_null,
+};
+
/*
* Analog domain root source clocks
*/
@@ -1123,14 +1130,34 @@ static struct clk mcbsp1_ick = {
.recalc = &followparent_recalc,
};
+static const struct clksel_rate common_mcbsp_96m_rates[] = {
+ { .div = 1, .val = 0, .flags = RATE_IN_24XX },
+ { .div = 0 }
+};
+
+static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
+ { .div = 1, .val = 1, .flags = RATE_IN_24XX },
+ { .div = 0 }
+};
+
+static const struct clksel mcbsp_fck_clksel[] = {
+ { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
+ { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
+ { .parent = NULL }
+};
+
static struct clk mcbsp1_fck = {
.name = "mcbsp1_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
+ .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcbsp2_ick = {
@@ -1147,10 +1174,14 @@ static struct clk mcbsp2_fck = {
.name = "mcbsp2_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
+ .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcbsp3_ick = {
@@ -1167,10 +1198,14 @@ static struct clk mcbsp3_fck = {
.name = "mcbsp3_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
+ .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcbsp4_ick = {
@@ -1187,10 +1222,14 @@ static struct clk mcbsp4_fck = {
.name = "mcbsp4_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
+ .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcbsp5_ick = {
@@ -1207,10 +1246,14 @@ static struct clk mcbsp5_fck = {
.name = "mcbsp5_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
+ .init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
- .recalc = &followparent_recalc,
+ .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
+ .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
+ .clksel = mcbsp_fck_clksel,
+ .recalc = &omap2_clksel_recalc,
};
static struct clk mcspi1_ick = {
@@ -1808,6 +1851,12 @@ static struct omap_clk omap2430_clks[] = {
CLK(NULL, "osc_ck", &osc_ck, CK_243X),
CLK(NULL, "sys_ck", &sys_ck, CK_243X),
CLK(NULL, "alt_ck", &alt_ck, CK_243X),
+ CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_243X),
+ CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_243X),
+ CLK("omap-mcbsp.3", "pad_fck", &mcbsp_clks, CK_243X),
+ CLK("omap-mcbsp.4", "pad_fck", &mcbsp_clks, CK_243X),
+ CLK("omap-mcbsp.5", "pad_fck", &mcbsp_clks, CK_243X),
+ CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
/* internal analog sources */
CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
@@ -1815,6 +1864,11 @@ static struct omap_clk omap2430_clks[] = {
/* internal prcm root sources */
CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
CLK(NULL, "core_ck", &core_ck, CK_243X),
+ CLK("omap-mcbsp.1", "prcm_fck", &func_96m_ck, CK_243X),
+ CLK("omap-mcbsp.2", "prcm_fck", &func_96m_ck, CK_243X),
+ CLK("omap-mcbsp.3", "prcm_fck", &func_96m_ck, CK_243X),
+ CLK("omap-mcbsp.4", "prcm_fck", &func_96m_ck, CK_243X),
+ CLK("omap-mcbsp.5", "prcm_fck", &func_96m_ck, CK_243X),
CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 05/10] OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (3 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 04/10] OMAP2430: " Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 06/10] OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c Paul Walmsley
` (5 subsequent siblings)
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
The OMAP3 clock tree already contains the infrastructure to support
clock framework-based McBSP functional clock source switching. But it
did not contain the clkdev aliases for the McBSP code to refer to the
parent clocks in an SoC integration-neutral way. So, add the clkdev
aliases for the parent clocks.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock3xxx_data.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index c73906d..accbcf3 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3188,6 +3188,11 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
+ CLK("omap-mcbsp.1", "pad_fck", &mcbsp_clks, CK_3XXX),
+ CLK("omap-mcbsp.2", "pad_fck", &mcbsp_clks, CK_3XXX),
+ CLK("omap-mcbsp.3", "pad_fck", &mcbsp_clks, CK_3XXX),
+ CLK("omap-mcbsp.4", "pad_fck", &mcbsp_clks, CK_3XXX),
+ CLK("omap-mcbsp.5", "pad_fck", &mcbsp_clks, CK_3XXX),
CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
@@ -3253,6 +3258,8 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2 | CK_AM35XX),
CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2 | CK_AM35XX),
CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2 | CK_AM35XX),
+ CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck, CK_3XXX),
+ CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck, CK_3XXX),
CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
CLK("mmci-omap-hs.2", "fck", &mmchs3_fck, CK_3430ES2 | CK_AM35XX),
CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_3XXX),
@@ -3346,6 +3353,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
+ CLK("omap-mcbsp.2", "prcm_fck", &per_96m_fck, CK_3XXX),
+ CLK("omap-mcbsp.3", "prcm_fck", &per_96m_fck, CK_3XXX),
+ CLK("omap-mcbsp.4", "prcm_fck", &per_96m_fck, CK_3XXX),
CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 06/10] OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (4 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 05/10] OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework Paul Walmsley
` (4 subsequent siblings)
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
The OMAP ASoC McBSP code implemented CLKR and FSR signal muxing via
direct System Control Module writes on OMAP2+. This required the
omap_ctrl_{read,write}l() functions to be exported, which is against
policy: the only code that should call those functions directly is
OMAP core code, not device drivers. omap_ctrl_{read,write}*() are no
longer exported, so the driver no longer builds as a module.
Fix the pinmuxing part of the problem by removing calls to
omap_ctrl_{read,write}l() from the OMAP ASoC McBSP code and
implementing signal muxing functions in arch/arm/mach-omap2/mcbsp.c.
Due to the unfortunate way that McBSP support is implemented in ASoC
and the OMAP tree, these symbols must be exported for use by
sound/soc/omap/omap-mcbsp.c.
Going forward, the McBSP device driver should be moved from
arch/arm/*omap* into drivers/ or sound/soc/*, and the CPU DAI driver
should be implemented as a platform_driver as many other ASoC CPU DAI
drivers are. These two steps should resolve many of the layering
problems, which will rapidly reappear during a McBSP hwmod/PM runtime
conversion.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
arch/arm/mach-omap2/mcbsp.c | 30 +++++++++++++++++
arch/arm/plat-omap/include/plat/control.h | 2 +
arch/arm/plat-omap/include/plat/mcbsp.h | 13 +++++++
arch/arm/plat-omap/mcbsp.c | 1 +
sound/soc/omap/omap-mcbsp.c | 52 +++++++++--------------------
5 files changed, 62 insertions(+), 36 deletions(-)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 88b8790..4c9c999 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -22,7 +22,37 @@
#include <plat/dma.h>
#include <plat/cpu.h>
#include <plat/mcbsp.h>
+#include <plat/control.h>
+/* McBSP internal signal muxing functions */
+
+void omap2_mcbsp1_mux_clkr_src(u8 mux)
+{
+ u32 v;
+
+ v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+ if (mux == CLKR_SRC_CLKR)
+ v &= OMAP2_MCBSP1_CLKR_MASK;
+ else if (mux == CLKR_SRC_CLKX)
+ v |= OMAP2_MCBSP1_CLKR_MASK;
+ omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
+}
+EXPORT_SYMBOL(omap2_mcbsp1_mux_clkr_src);
+
+void omap2_mcbsp1_mux_fsr_src(u8 mux)
+{
+ u32 v;
+
+ v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+ if (mux == FSR_SRC_FSR)
+ v &= OMAP2_MCBSP1_FSR_MASK;
+ else if (mux == FSR_SRC_FSX)
+ v |= OMAP2_MCBSP1_FSR_MASK;
+ omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
+}
+EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
+
+/* Platform data */
#ifdef CONFIG_ARCH_OMAP2420
static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = {
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h
index 19c9b2a..54b0c35 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/plat-omap/include/plat/control.h
@@ -223,6 +223,8 @@
#define OMAP2_MMCSDIO1ADPCLKISEL (1 << 24) /* MMC1 loop back clock */
#define OMAP24XX_USBSTANDBYCTRL (1 << 15)
#define OMAP2_MCBSP2_CLKS_MASK (1 << 6)
+#define OMAP2_MCBSP1_FSR_MASK (1 << 4)
+#define OMAP2_MCBSP1_CLKR_MASK (1 << 3)
#define OMAP2_MCBSP1_CLKS_MASK (1 << 2)
/* CONTROL_DEVCONF1 bits */
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index b4ff6a1..886d0e6 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -312,6 +312,14 @@
#define RFSREN 0x0002
#define RSYNCERREN 0x0001
+/* CLKR signal muxing options */
+#define CLKR_SRC_CLKR 0
+#define CLKR_SRC_CLKX 1
+
+/* FSR signal muxing options */
+#define FSR_SRC_FSR 0
+#define FSR_SRC_FSX 1
+
/* we don't do multichannel for now */
struct omap_mcbsp_reg_cfg {
u16 spcr2;
@@ -501,7 +509,6 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word);
int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word);
-
/* SPI specific API */
void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg);
@@ -510,6 +517,10 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf);
int omap_mcbsp_pollwrite(unsigned int id, u16 buf);
int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type);
+/* McBSP signal muxing API */
+void omap2_mcbsp1_mux_clkr_src(u8 mux);
+void omap2_mcbsp1_mux_fsr_src(u8 mux);
+
#ifdef CONFIG_ARCH_OMAP3
/* Sidetone specific API */
int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index dcb0926..89d7671 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -27,6 +27,7 @@
#include <plat/dma.h>
#include <plat/mcbsp.h>
+#include <plat/control.h>
#include "../mach-omap2/cm-regbits-34xx.h"
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 86f2139..f50a5ab 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -661,48 +661,23 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
return 0;
}
-static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data *mcbsp_data,
- int clk_id)
-{
- int sel_bit, set = 0;
- u16 reg = OMAP2_CONTROL_DEVCONF0;
-
- if (cpu_class_is_omap1())
- return -EINVAL; /* TODO: Can this be implemented for OMAP1? */
- if (mcbsp_data->bus_id != 0)
- return -EINVAL;
-
- switch (clk_id) {
- case OMAP_MCBSP_CLKR_SRC_CLKX:
- set = 1;
- case OMAP_MCBSP_CLKR_SRC_CLKR:
- sel_bit = 3;
- break;
- case OMAP_MCBSP_FSR_SRC_FSX:
- set = 1;
- case OMAP_MCBSP_FSR_SRC_FSR:
- sel_bit = 4;
- break;
- default:
- return -EINVAL;
- }
-
- if (set)
- omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
- else
- omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
-
- return 0;
-}
-
static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
int clk_id, unsigned int freq,
int dir)
{
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
+ struct omap_mcbsp_platform_data *pdata = cpu_dai->dev->platform_data;
int err = 0;
+ /* The McBSP signal muxing functions are only available on McBSP1 */
+ if (clk_id == OMAP_MCBSP_CLKR_SRC_CLKR ||
+ clk_id == OMAP_MCBSP_CLKR_SRC_CLKX ||
+ clk_id == OMAP_MCBSP_FSR_SRC_FSR ||
+ clk_id == OMAP_MCBSP_FSR_SRC_FSX)
+ if (cpu_class_is_omap1() || mcbsp_data->bus_id != 0)
+ return -EINVAL;
+
mcbsp_data->in_freq = freq;
switch (clk_id) {
@@ -720,11 +695,18 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
regs->pcr0 |= SCLKME;
break;
+
case OMAP_MCBSP_CLKR_SRC_CLKR:
+ omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR);
+ break;
case OMAP_MCBSP_CLKR_SRC_CLKX:
+ omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX);
+ break;
case OMAP_MCBSP_FSR_SRC_FSR:
+ omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR);
+ break;
case OMAP_MCBSP_FSR_SRC_FSX:
- err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id);
+ omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX);
break;
default:
err = -ENODEV;
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (5 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 06/10] OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-05 8:35 ` Peter Ujfalusi
2010-10-01 21:35 ` [PATCH 08/10] OMAP: split plat-omap/common.c Paul Walmsley
` (3 subsequent siblings)
10 siblings, 1 reply; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Previously the OMAP McBSP ASoC driver implemented CLKS switching by
using omap_ctrl_{read,write}l() directly. This is against policy; the OMAP
System Control Module functions are not intended to be exported to drivers.
These symbols are no longer exported, so as a result, the OMAP McBSP ASoC
driver does not build as a module.
Resolve the CLKS clock changing portion of this problem by creating a
clock parent changing function that lives in
arch/arm/mach-omap2/mcbsp.c, and modify the ASoC driver to use it.
Due to the unfortunate way that McBSP support is implemented in ASoC
and the OMAP tree, this symbol must be exported for use by
sound/soc/omap/omap-mcbsp.c.
Going forward, the McBSP device driver should be moved from
arch/arm/*omap* into drivers/ or sound/soc/* and the CPU DAI driver
should be implemented as a platform_driver as many other ASoC CPU DAI
drivers are. These two steps should resolve many of the layering
problems, which will rapidly reappear during a McBSP hwmod/PM runtime
conversions.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Jarkko Nikula <jhnikula@gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
arch/arm/mach-omap2/mcbsp.c | 51 +++++++++++++++++++++++
arch/arm/plat-omap/include/plat/mcbsp.h | 11 +++++
arch/arm/plat-omap/mcbsp.c | 3 -
sound/soc/omap/omap-mcbsp.c | 69 ++++++-------------------------
4 files changed, 75 insertions(+), 59 deletions(-)
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 4c9c999..51abced 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -52,6 +52,54 @@ void omap2_mcbsp1_mux_fsr_src(u8 mux)
}
EXPORT_SYMBOL(omap2_mcbsp1_mux_fsr_src);
+/* McBSP CLKS source switching function */
+
+int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
+{
+ struct omap_mcbsp *mcbsp;
+ struct clk *fck_src;
+ char *fck_src_name;
+ int r;
+
+ if (!omap_mcbsp_check_valid_id(id)) {
+ pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
+ return -EINVAL;
+ }
+ mcbsp = id_to_mcbsp_ptr(id);
+
+ if (fck_src_id == MCBSP_CLKS_PAD_SRC)
+ fck_src_name = "pad_fck";
+ else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
+ fck_src_name = "prcm_fck";
+ else
+ return -EINVAL;
+
+ fck_src = clk_get(mcbsp->dev, fck_src_name);
+ if (IS_ERR_OR_NULL(fck_src)) {
+ pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
+ fck_src_name);
+ return -EINVAL;
+ }
+
+ clk_disable(mcbsp->fclk);
+
+ r = clk_set_parent(mcbsp->fclk, fck_src);
+ if (IS_ERR_VALUE(r)) {
+ pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
+ "clks", fck_src_name);
+ clk_put(fck_src);
+ return -EINVAL;
+ }
+
+ clk_enable(mcbsp->fclk);
+
+ clk_put(fck_src);
+
+ return 0;
+}
+EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
+
+
/* Platform data */
#ifdef CONFIG_ARCH_OMAP2420
@@ -190,18 +238,21 @@ static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = {
.dma_rx_sync = OMAP44XX_DMA_MCBSP2_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP2_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP2,
+ /* XXX .ops ? */
},
{
.phys_base = OMAP44XX_MCBSP3_BASE,
.dma_rx_sync = OMAP44XX_DMA_MCBSP3_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP3_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP3,
+ /* XXX .ops ? */
},
{
.phys_base = OMAP44XX_MCBSP4_BASE,
.dma_rx_sync = OMAP44XX_DMA_MCBSP4_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP4_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP4,
+ /* XXX .ops ? */
},
};
#define OMAP44XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap44xx_mcbsp_pdata)
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 886d0e6..4da6f94 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -320,6 +320,10 @@
#define FSR_SRC_FSR 0
#define FSR_SRC_FSX 1
+/* McBSP functional clock sources */
+#define MCBSP_CLKS_PAD_SRC 0
+#define MCBSP_CLKS_PRCM_SRC 1
+
/* we don't do multichannel for now */
struct omap_mcbsp_reg_cfg {
u16 spcr2;
@@ -406,6 +410,7 @@ struct omap_mcbsp_spi_cfg {
struct omap_mcbsp_ops {
void (*request)(unsigned int);
void (*free)(unsigned int);
+ int (*set_clks_src)(u8, u8);
};
struct omap_mcbsp_platform_data {
@@ -472,6 +477,9 @@ struct omap_mcbsp {
extern struct omap_mcbsp **mcbsp_ptr;
extern int omap_mcbsp_count, omap_mcbsp_cache_size;
+#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
+#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
+
int omap_mcbsp_init(void);
void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
int size);
@@ -509,6 +517,9 @@ int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int leng
int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word);
int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word);
+
+/* McBSP functional clock source changing function */
+extern int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id);
/* SPI specific API */
void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 89d7671..49bebbf 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -81,9 +81,6 @@ int omap_mcbsp_st_read(struct omap_mcbsp *mcbsp, u16 reg)
#define MCBSP_READ_CACHE(mcbsp, reg) \
omap_mcbsp_read(mcbsp, OMAP_MCBSP_REG_##reg, 1)
-#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
-#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
-
#define MCBSP_ST_READ(mcbsp, reg) \
omap_mcbsp_st_read(mcbsp, OMAP_ST_REG_##reg)
#define MCBSP_ST_WRITE(mcbsp, reg, val) \
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index f50a5ab..b59ad11 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -31,7 +31,6 @@
#include <sound/initval.h>
#include <sound/soc.h>
-#include <plat/control.h>
#include <plat/dma.h>
#include <plat/mcbsp.h>
#include "omap-mcbsp.h"
@@ -608,66 +607,12 @@ static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai,
return 0;
}
-static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
- int clk_id)
-{
- int sel_bit;
- u16 reg, reg_devconf1 = OMAP243X_CONTROL_DEVCONF1;
-
- if (cpu_class_is_omap1()) {
- /* OMAP1's can use only external source clock */
- if (unlikely(clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK))
- return -EINVAL;
- else
- return 0;
- }
-
- if (cpu_is_omap2420() && mcbsp_data->bus_id > 1)
- return -EINVAL;
-
- if (cpu_is_omap343x())
- reg_devconf1 = OMAP343X_CONTROL_DEVCONF1;
-
- switch (mcbsp_data->bus_id) {
- case 0:
- reg = OMAP2_CONTROL_DEVCONF0;
- sel_bit = 2;
- break;
- case 1:
- reg = OMAP2_CONTROL_DEVCONF0;
- sel_bit = 6;
- break;
- case 2:
- reg = reg_devconf1;
- sel_bit = 0;
- break;
- case 3:
- reg = reg_devconf1;
- sel_bit = 2;
- break;
- case 4:
- reg = reg_devconf1;
- sel_bit = 4;
- break;
- default:
- return -EINVAL;
- }
-
- if (clk_id == OMAP_MCBSP_SYSCLK_CLKS_FCLK)
- omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
- else
- omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
-
- return 0;
-}
-
static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
int clk_id, unsigned int freq,
int dir)
{
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
- struct omap_mcbsp_platform_data *pdata = cpu_dai->dev->platform_data;
int err = 0;
/* The McBSP signal muxing functions are only available on McBSP1 */
@@ -685,8 +630,20 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
regs->srgr2 |= CLKSM;
break;
case OMAP_MCBSP_SYSCLK_CLKS_FCLK:
+ if (cpu_class_is_omap1()) {
+ err = -EINVAL;
+ break;
+ }
+ err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
+ MCBSP_CLKS_PRCM_SRC);
+ break;
case OMAP_MCBSP_SYSCLK_CLKS_EXT:
- err = omap_mcbsp_dai_set_clks_src(mcbsp_data, clk_id);
+ if (cpu_class_is_omap1()) {
+ err = 0;
+ break;
+ }
+ err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
+ MCBSP_CLKS_PAD_SRC);
break;
case OMAP_MCBSP_SYSCLK_CLKX_EXT:
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (6 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-04 5:34 ` Shilimkar, Santosh
` (2 more replies)
2010-10-01 21:35 ` [PATCH 09/10] OMAP: control: move plat-omap/control.h to mach-omap2/control.h Paul Walmsley
` (2 subsequent siblings)
10 siblings, 3 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Split plat-omap/common.c into three pieces:
1. the 32KiHz sync timer and clocksource code, which now lives in
plat-omap/32ksynctimer.c;
2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
3. and the remainder of the OMAP-wide common code, which includes the
deprecated ATAGs code and a deprecated video RAM reservation function.
The primary motivation for doing this is to move the OMAP2+-specific parts
into an OMAP2+-specific file, so that build breakage related to the
System Control Module code can be resolved.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/Makefile | 3
arch/arm/mach-omap2/common.c | 138 ++++++++++++++++++
arch/arm/plat-omap/32ksynctimer.c | 184 +++++++++++++++++++++++
arch/arm/plat-omap/Makefile | 2
arch/arm/plat-omap/common.c | 291 -------------------------------------
arch/arm/plat-omap/devices.c | 1
arch/arm/plat-omap/sram.c | 3
7 files changed, 325 insertions(+), 297 deletions(-)
create mode 100644 arch/arm/mach-omap2/common.c
create mode 100644 arch/arm/plat-omap/32ksynctimer.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 9edacb0..d543533 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,7 +3,8 @@
#
# Common support
-obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o
+obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
+ common.o
omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o
hwmod-common = omap_hwmod.o \
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
new file mode 100644
index 0000000..4e0469d
--- /dev/null
+++ b/arch/arm/mach-omap2/common.c
@@ -0,0 +1,138 @@
+/*
+ * linux/arch/arm/mach-omap2/common.c
+ *
+ * Code common to all OMAP2+ machines.
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+#include <plat/board.h>
+#include <plat/control.h>
+#include <plat/mux.h>
+
+#include <plat/clock.h>
+
+#include "sdrc.h"
+
+/* 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);
+ omap2_set_globals_sdrc(omap2_globals);
+ omap2_set_globals_control(omap2_globals);
+ omap2_set_globals_prcm(omap2_globals);
+ omap2_set_globals_uart(omap2_globals);
+}
+
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2420)
+
+static struct omap_globals omap242x_globals = {
+ .class = OMAP242X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
+ .sdrc = OMAP2420_SDRC_BASE,
+ .sms = OMAP2420_SMS_BASE,
+ .ctrl = OMAP242X_CTRL_BASE,
+ .prm = OMAP2420_PRM_BASE,
+ .cm = OMAP2420_CM_BASE,
+ .uart1_phys = OMAP2_UART1_BASE,
+ .uart2_phys = OMAP2_UART2_BASE,
+ .uart3_phys = OMAP2_UART3_BASE,
+};
+
+void __init omap2_set_globals_242x(void)
+{
+ __omap2_set_globals(&omap242x_globals);
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2430)
+
+static struct omap_globals omap243x_globals = {
+ .class = OMAP243X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
+ .sdrc = OMAP243X_SDRC_BASE,
+ .sms = OMAP243X_SMS_BASE,
+ .ctrl = OMAP243X_CTRL_BASE,
+ .prm = OMAP2430_PRM_BASE,
+ .cm = OMAP2430_CM_BASE,
+ .uart1_phys = OMAP2_UART1_BASE,
+ .uart2_phys = OMAP2_UART2_BASE,
+ .uart3_phys = OMAP2_UART3_BASE,
+};
+
+void __init omap2_set_globals_243x(void)
+{
+ __omap2_set_globals(&omap243x_globals);
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP3)
+
+static struct omap_globals omap3_globals = {
+ .class = OMAP343X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
+ .sdrc = OMAP343X_SDRC_BASE,
+ .sms = OMAP343X_SMS_BASE,
+ .ctrl = OMAP343X_CTRL_BASE,
+ .prm = OMAP3430_PRM_BASE,
+ .cm = OMAP3430_CM_BASE,
+ .uart1_phys = OMAP3_UART1_BASE,
+ .uart2_phys = OMAP3_UART2_BASE,
+ .uart3_phys = OMAP3_UART3_BASE,
+ .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
+};
+
+void __init omap2_set_globals_3xxx(void)
+{
+ __omap2_set_globals(&omap3_globals);
+}
+
+void __init omap3_map_io(void)
+{
+ omap2_set_globals_3xxx();
+ omap34xx_map_common_io();
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP4)
+static struct omap_globals omap4_globals = {
+ .class = OMAP443X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
+ .ctrl = OMAP443X_SCM_BASE,
+ .ctrl_pad = OMAP443X_CTRL_BASE,
+ .prm = OMAP4430_PRM_BASE,
+ .cm = OMAP4430_CM_BASE,
+ .cm2 = OMAP4430_CM2_BASE,
+ .uart1_phys = OMAP4_UART1_BASE,
+ .uart2_phys = OMAP4_UART2_BASE,
+ .uart3_phys = OMAP4_UART3_BASE,
+ .uart4_phys = OMAP4_UART4_BASE,
+};
+
+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_uart(&omap4_globals);
+}
+#endif
+
diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-omap/32ksynctimer.c
new file mode 100644
index 0000000..b7f458c
--- /dev/null
+++ b/arch/arm/plat-omap/32ksynctimer.c
@@ -0,0 +1,184 @@
+/*
+ * linux/arch/arm/plat-omap/clocksource.c
+ *
+ * OMAP clocksource-related code
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+#include <plat/board.h>
+
+#include <plat/clock.h>
+
+
+/*
+ * 32KHz clocksource ... always available, on pretty most chips except
+ * OMAP 730 and 1510. Other timers could be used as clocksources, with
+ * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
+ * but systems won't necessarily want to spend resources that way.
+ */
+
+#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
+
+#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
+
+#include <linux/clocksource.h>
+
+/*
+ * offset_32k holds the init time counter value. It is then subtracted
+ * from every counter read to achieve a counter that counts time from the
+ * kernel boot (needed for sched_clock()).
+ */
+static u32 offset_32k __read_mostly;
+
+#ifdef CONFIG_ARCH_OMAP16XX
+static cycle_t omap16xx_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
+}
+#else
+#define omap16xx_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2420
+static cycle_t omap2420_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2420_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2430
+static cycle_t omap2430_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2430_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static cycle_t omap34xx_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap34xx_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static cycle_t omap44xx_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap44xx_32k_read NULL
+#endif
+
+/*
+ * Kernel assumes that sched_clock can be called early but may not have
+ * things ready yet.
+ */
+static cycle_t omap_32k_read_dummy(struct clocksource *cs)
+{
+ return 0;
+}
+
+static struct clocksource clocksource_32k = {
+ .name = "32k_counter",
+ .rating = 250,
+ .read = omap_32k_read_dummy,
+ .mask = CLOCKSOURCE_MASK(32),
+ .shift = 10,
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+/*
+ * Returns current time from boot in nsecs. It's OK for this to wrap
+ * around for now, as it's just a relative time stamp.
+ */
+unsigned long long sched_clock(void)
+{
+ return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
+ clocksource_32k.mult, clocksource_32k.shift);
+}
+
+/**
+ * read_persistent_clock - Return time from a persistent clock.
+ *
+ * Reads the time from a source which isn't disabled during PM, the
+ * 32k sync timer. Convert the cycles elapsed since last read into
+ * nsecs and adds to a monotonically increasing timespec.
+ */
+static struct timespec persistent_ts;
+static cycles_t cycles, last_cycles;
+void read_persistent_clock(struct timespec *ts)
+{
+ unsigned long long nsecs;
+ cycles_t delta;
+ struct timespec *tsp = &persistent_ts;
+
+ last_cycles = cycles;
+ cycles = clocksource_32k.read(&clocksource_32k);
+ delta = cycles - last_cycles;
+
+ nsecs = clocksource_cyc2ns(delta,
+ clocksource_32k.mult, clocksource_32k.shift);
+
+ timespec_add_ns(tsp, nsecs);
+ *ts = *tsp;
+}
+
+static int __init omap_init_clocksource_32k(void)
+{
+ static char err[] __initdata = KERN_ERR
+ "%s: can't register clocksource!\n";
+
+ if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
+ struct clk *sync_32k_ick;
+
+ if (cpu_is_omap16xx())
+ clocksource_32k.read = omap16xx_32k_read;
+ else if (cpu_is_omap2420())
+ clocksource_32k.read = omap2420_32k_read;
+ else if (cpu_is_omap2430())
+ clocksource_32k.read = omap2430_32k_read;
+ else if (cpu_is_omap34xx())
+ clocksource_32k.read = omap34xx_32k_read;
+ else if (cpu_is_omap44xx())
+ clocksource_32k.read = omap44xx_32k_read;
+ else
+ return -ENODEV;
+
+ sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
+ if (sync_32k_ick)
+ clk_enable(sync_32k_ick);
+
+ clocksource_32k.mult = clocksource_hz2mult(32768,
+ clocksource_32k.shift);
+
+ offset_32k = clocksource_32k.read(&clocksource_32k);
+
+ if (clocksource_register(&clocksource_32k))
+ printk(err, clocksource_32k.name);
+ }
+ return 0;
+}
+arch_initcall(omap_init_clocksource_32k);
+
+#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
+
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 2a15191..32a5959 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -4,7 +4,7 @@
# Common support
obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
- usb.o fb.o io.o
+ usb.o fb.o io.o 32ksynctimer.o
obj-m :=
obj-n :=
obj- :=
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 9200ea7..221a675 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -11,38 +11,15 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/console.h>
-#include <linux/serial.h>
-#include <linux/tty.h>
-#include <linux/serial_8250.h>
-#include <linux/serial_reg.h>
-#include <linux/clk.h>
#include <linux/io.h>
#include <linux/omapfb.h>
-#include <mach/hardware.h>
-#include <asm/system.h>
-#include <asm/pgtable.h>
-#include <asm/mach/map.h>
-#include <asm/setup.h>
-
#include <plat/common.h>
#include <plat/board.h>
-#include <plat/control.h>
-#include <plat/mux.h>
-#include <plat/fpga.h>
-#include <plat/serial.h>
#include <plat/vram.h>
-#include <plat/clock.h>
-
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-# include "../mach-omap2/sdrc.h"
-#endif
#define NO_LENGTH_CHECK 0xffffffff
@@ -88,271 +65,3 @@ void __init omap_reserve(void)
omapfb_reserve_sdram_memblock();
omap_vram_reserve_sdram_memblock();
}
-
-/*
- * 32KHz clocksource ... always available, on pretty most chips except
- * OMAP 730 and 1510. Other timers could be used as clocksources, with
- * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
- * but systems won't necessarily want to spend resources that way.
- */
-
-#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
-
-#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
-
-#include <linux/clocksource.h>
-
-/*
- * offset_32k holds the init time counter value. It is then subtracted
- * from every counter read to achieve a counter that counts time from the
- * kernel boot (needed for sched_clock()).
- */
-static u32 offset_32k __read_mostly;
-
-#ifdef CONFIG_ARCH_OMAP16XX
-static cycle_t omap16xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
-}
-#else
-#define omap16xx_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2420
-static cycle_t omap2420_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap2420_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2430
-static cycle_t omap2430_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap2430_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static cycle_t omap34xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap34xx_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-static cycle_t omap44xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap44xx_32k_read NULL
-#endif
-
-/*
- * Kernel assumes that sched_clock can be called early but may not have
- * things ready yet.
- */
-static cycle_t omap_32k_read_dummy(struct clocksource *cs)
-{
- return 0;
-}
-
-static struct clocksource clocksource_32k = {
- .name = "32k_counter",
- .rating = 250,
- .read = omap_32k_read_dummy,
- .mask = CLOCKSOURCE_MASK(32),
- .shift = 10,
- .flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-/*
- * Returns current time from boot in nsecs. It's OK for this to wrap
- * around for now, as it's just a relative time stamp.
- */
-unsigned long long sched_clock(void)
-{
- return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
- clocksource_32k.mult, clocksource_32k.shift);
-}
-
-/**
- * read_persistent_clock - Return time from a persistent clock.
- *
- * Reads the time from a source which isn't disabled during PM, the
- * 32k sync timer. Convert the cycles elapsed since last read into
- * nsecs and adds to a monotonically increasing timespec.
- */
-static struct timespec persistent_ts;
-static cycles_t cycles, last_cycles;
-void read_persistent_clock(struct timespec *ts)
-{
- unsigned long long nsecs;
- cycles_t delta;
- struct timespec *tsp = &persistent_ts;
-
- last_cycles = cycles;
- cycles = clocksource_32k.read(&clocksource_32k);
- delta = cycles - last_cycles;
-
- nsecs = clocksource_cyc2ns(delta,
- clocksource_32k.mult, clocksource_32k.shift);
-
- timespec_add_ns(tsp, nsecs);
- *ts = *tsp;
-}
-
-static int __init omap_init_clocksource_32k(void)
-{
- static char err[] __initdata = KERN_ERR
- "%s: can't register clocksource!\n";
-
- if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
- struct clk *sync_32k_ick;
-
- if (cpu_is_omap16xx())
- clocksource_32k.read = omap16xx_32k_read;
- else if (cpu_is_omap2420())
- clocksource_32k.read = omap2420_32k_read;
- else if (cpu_is_omap2430())
- clocksource_32k.read = omap2430_32k_read;
- else if (cpu_is_omap34xx())
- clocksource_32k.read = omap34xx_32k_read;
- else if (cpu_is_omap44xx())
- clocksource_32k.read = omap44xx_32k_read;
- else
- return -ENODEV;
-
- sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
- if (sync_32k_ick)
- clk_enable(sync_32k_ick);
-
- clocksource_32k.mult = clocksource_hz2mult(32768,
- clocksource_32k.shift);
-
- offset_32k = clocksource_32k.read(&clocksource_32k);
-
- if (clocksource_register(&clocksource_32k))
- printk(err, clocksource_32k.name);
- }
- return 0;
-}
-arch_initcall(omap_init_clocksource_32k);
-
-#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
-
-/* 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);
- omap2_set_globals_sdrc(omap2_globals);
- omap2_set_globals_control(omap2_globals);
- omap2_set_globals_prcm(omap2_globals);
- omap2_set_globals_uart(omap2_globals);
-}
-
-#endif
-
-#if defined(CONFIG_ARCH_OMAP2420)
-
-static struct omap_globals omap242x_globals = {
- .class = OMAP242X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
- .sdrc = OMAP2420_SDRC_BASE,
- .sms = OMAP2420_SMS_BASE,
- .ctrl = OMAP242X_CTRL_BASE,
- .prm = OMAP2420_PRM_BASE,
- .cm = OMAP2420_CM_BASE,
- .uart1_phys = OMAP2_UART1_BASE,
- .uart2_phys = OMAP2_UART2_BASE,
- .uart3_phys = OMAP2_UART3_BASE,
-};
-
-void __init omap2_set_globals_242x(void)
-{
- __omap2_set_globals(&omap242x_globals);
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP2430)
-
-static struct omap_globals omap243x_globals = {
- .class = OMAP243X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
- .sdrc = OMAP243X_SDRC_BASE,
- .sms = OMAP243X_SMS_BASE,
- .ctrl = OMAP243X_CTRL_BASE,
- .prm = OMAP2430_PRM_BASE,
- .cm = OMAP2430_CM_BASE,
- .uart1_phys = OMAP2_UART1_BASE,
- .uart2_phys = OMAP2_UART2_BASE,
- .uart3_phys = OMAP2_UART3_BASE,
-};
-
-void __init omap2_set_globals_243x(void)
-{
- __omap2_set_globals(&omap243x_globals);
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP3)
-
-static struct omap_globals omap3_globals = {
- .class = OMAP343X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
- .sdrc = OMAP343X_SDRC_BASE,
- .sms = OMAP343X_SMS_BASE,
- .ctrl = OMAP343X_CTRL_BASE,
- .prm = OMAP3430_PRM_BASE,
- .cm = OMAP3430_CM_BASE,
- .uart1_phys = OMAP3_UART1_BASE,
- .uart2_phys = OMAP3_UART2_BASE,
- .uart3_phys = OMAP3_UART3_BASE,
- .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
-};
-
-void __init omap2_set_globals_3xxx(void)
-{
- __omap2_set_globals(&omap3_globals);
-}
-
-void __init omap3_map_io(void)
-{
- omap2_set_globals_3xxx();
- omap34xx_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP4)
-static struct omap_globals omap4_globals = {
- .class = OMAP443X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
- .ctrl = OMAP443X_SCM_BASE,
- .ctrl_pad = OMAP443X_CTRL_BASE,
- .prm = OMAP4430_PRM_BASE,
- .cm = OMAP4430_CM_BASE,
- .cm2 = OMAP4430_CM2_BASE,
- .uart1_phys = OMAP4_UART1_BASE,
- .uart2_phys = OMAP4_UART2_BASE,
- .uart3_phys = OMAP4_UART3_BASE,
- .uart4_phys = OMAP4_UART4_BASE,
-};
-
-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_uart(&omap4_globals);
-}
-#endif
-
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index d1920be..78162a0 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -21,7 +21,6 @@
#include <asm/mach/map.h>
#include <plat/tc.h>
-#include <plat/control.h>
#include <plat/board.h>
#include <plat/mmc.h>
#include <mach/gpio.h>
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 33ee6b8..d971aeb 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -30,8 +30,6 @@
#include <plat/cpu.h>
#include <plat/vram.h>
-#include <plat/control.h>
-
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
# include "../mach-omap2/prm.h"
# include "../mach-omap2/cm.h"
@@ -68,7 +66,6 @@
#define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
#define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
#define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
-#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
#define GP_DEVICE 0x300
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 09/10] OMAP: control: move plat-omap/control.h to mach-omap2/control.h
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (7 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 08/10] OMAP: split plat-omap/common.c Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 10/10] OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks Paul Walmsley
2010-10-05 12:52 ` [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Jarkko Nikula
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Only OMAP2+ platforms have the System Control Module (SCM) IP block.
In the past, we've kept the SCM header file in plat-omap. This has
led to abuse - device drivers including it; includes being added that
create implicit dependencies on OMAP2+ builds; etc.
In response, move the SCM headers into mach-omap2/.
As part of this, remove the direct SCM access from the OMAP UDC
driver. It was clearly broken. The UDC code needs an indepth review for
use on OMAP2+ chips.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Cory Maccarrone <darkstar6262@gmail.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-4430sdp.c | 3 ++-
arch/arm/mach-omap2/board-am3517evm.c | 2 +-
arch/arm/mach-omap2/board-apollon.c | 2 +-
arch/arm/mach-omap2/board-cm-t3517.c | 2 +-
arch/arm/mach-omap2/board-h4.c | 2 +-
arch/arm/mach-omap2/board-ldp.c | 2 +-
arch/arm/mach-omap2/board-omap3logic.c | 2 +-
arch/arm/mach-omap2/board-omap4panda.c | 4 ++--
arch/arm/mach-omap2/clock2420_data.c | 2 +-
arch/arm/mach-omap2/clock2430_data.c | 2 +-
arch/arm/mach-omap2/clock3xxx_data.c | 2 +-
arch/arm/mach-omap2/clock44xx_data.c | 2 +-
arch/arm/mach-omap2/common.c | 2 +-
arch/arm/mach-omap2/control.c | 3 ++-
arch/arm/mach-omap2/control.h | 16 ++++++++--------
arch/arm/mach-omap2/cpuidle34xx.c | 2 +-
arch/arm/mach-omap2/devices.c | 3 +--
arch/arm/mach-omap2/hsmmc.c | 2 +-
arch/arm/mach-omap2/id.c | 3 ++-
arch/arm/mach-omap2/mcbsp.c | 4 +++-
arch/arm/mach-omap2/mux.c | 8 +++-----
arch/arm/mach-omap2/pm24xx.c | 2 +-
arch/arm/mach-omap2/pm34xx.c | 2 +-
arch/arm/mach-omap2/prcm.c | 2 +-
arch/arm/mach-omap2/serial.c | 2 +-
arch/arm/mach-omap2/sleep34xx.S | 2 +-
arch/arm/mach-omap2/usb-fs.c | 6 +++---
arch/arm/plat-omap/mcbsp.c | 1 -
drivers/usb/gadget/omap_udc.c | 18 ++++--------------
30 files changed, 49 insertions(+), 58 deletions(-)
rename arch/arm/{plat-omap/include/plat/control.h => mach-omap2/control.h} (97%)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 3eb9839..d3793a3 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -39,7 +39,6 @@
#include <plat/gpmc.h>
#include <plat/display.h>
-#include <plat/control.h>
#include <plat/gpmc-smc91x.h>
#include <mach/board-flash.h>
@@ -48,6 +47,7 @@
#include "sdram-qimonda-hyb18m512160af-6.h"
#include "hsmmc.h"
#include "pm.h"
+#include "control.h"
#define CONFIG_DISABLE_HFCLK 1
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 9f75dc2..e454737 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -32,11 +32,12 @@
#include <plat/board.h>
#include <plat/common.h>
-#include <plat/control.h>
#include <plat/timer-gp.h>
#include <plat/usb.h>
#include <plat/mmc.h>
+
#include "hsmmc.h"
+#include "control.h"
#define ETH_KS8851_IRQ 34
#define ETH_KS8851_POWER_ON 48
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 4d0f585..64e9e22 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -32,11 +32,11 @@
#include <plat/board.h>
#include <plat/common.h>
-#include <plat/control.h>
#include <plat/usb.h>
#include <plat/display.h>
#include "mux.h"
+#include "control.h"
#define AM35XX_EVM_PHY_MASK (0xF)
#define AM35XX_EVM_MDIO_FREQUENCY (1000000)
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index c6421a7..102719c 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -39,9 +39,9 @@
#include <plat/board.h>
#include <plat/common.h>
#include <plat/gpmc.h>
-#include <plat/control.h>
#include "mux.h"
+#include "control.h"
/* LED & Switch macros */
#define LED0_GPIO13 13
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 1115b8a..c49319f 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -40,7 +40,6 @@
#include <plat/board.h>
#include <plat/common.h>
-#include <plat/control.h>
#include <plat/usb.h>
#include <plat/nand.h>
#include <plat/gpmc.h>
@@ -48,6 +47,7 @@
#include <mach/am35xx.h>
#include "mux.h"
+#include "control.h"
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
static struct gpio_led cm_t3517_leds[] = {
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index e09bd68..08492a3 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -31,7 +31,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
-#include <plat/control.h>
#include <mach/gpio.h>
#include <plat/usb.h>
#include <plat/board.h>
@@ -42,6 +41,7 @@
#include <plat/gpmc.h>
#include "mux.h"
+#include "control.h"
#define H4_FLASH_CS 0
#define H4_SMC91X_CS 1
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 58698e3..da56324 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -42,11 +42,11 @@
#include <mach/board-zoom.h>
#include <asm/delay.h>
-#include <plat/control.h>
#include <plat/usb.h>
#include "mux.h"
#include "hsmmc.h"
+#include "control.h"
#define LDP_SMSC911X_CS 1
#define LDP_SMSC911X_GPIO 152
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 4c045cf..da8943c 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -35,6 +35,7 @@
#include "mux.h"
#include "hsmmc.h"
+#include "control.h"
#include <plat/mux.h>
#include <plat/board.h>
@@ -43,7 +44,6 @@
#include <plat/gpmc.h>
#include <plat/timer-gp.h>
#include <plat/sdrc.h>
-#include <plat/control.h>
#define OMAP3LOGIC_SMSC911X_CS 1
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index aa8296e..c8df890 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -34,12 +34,12 @@
#include <plat/board.h>
#include <plat/common.h>
-#include <plat/control.h>
#include <plat/timer-gp.h>
#include <plat/usb.h>
#include <plat/mmc.h>
-#include "hsmmc.h"
+#include "hsmmc.h"
+#include "control.h"
static struct gpio_led gpio_leds[] = {
{
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 7086fe4..21f8562 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -18,7 +18,6 @@
#include <linux/list.h>
#include <plat/clkdev_omap.h>
-#include <plat/control.h>
#include "clock.h"
#include "clock2xxx.h"
@@ -28,6 +27,7 @@
#include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h"
#include "sdrc.h"
+#include "control.h"
#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 4548319..e32afcb 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -18,7 +18,6 @@
#include <linux/list.h>
#include <plat/clkdev_omap.h>
-#include <plat/control.h>
#include "clock.h"
#include "clock2xxx.h"
@@ -28,6 +27,7 @@
#include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h"
#include "sdrc.h"
+#include "control.h"
#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index accbcf3..9b8aadf 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -20,7 +20,6 @@
#include <linux/clk.h>
#include <linux/list.h>
-#include <plat/control.h>
#include <plat/clkdev_omap.h>
#include "clock.h"
@@ -33,6 +32,7 @@
#include "cm-regbits-34xx.h"
#include "prm.h"
#include "prm-regbits-34xx.h"
+#include "control.h"
/*
* clocks
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 67fac44..1599836 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -26,7 +26,6 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/clk.h>
-#include <plat/control.h>
#include <plat/clkdev_omap.h>
#include "clock.h"
@@ -35,6 +34,7 @@
#include "cm-regbits-44xx.h"
#include "prm.h"
#include "prm-regbits-44xx.h"
+#include "control.h"
/* Root clocks */
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 4e0469d..caa42b9 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -20,12 +20,12 @@
#include <plat/common.h>
#include <plat/board.h>
-#include <plat/control.h>
#include <plat/mux.h>
#include <plat/clock.h>
#include "sdrc.h"
+#include "control.h"
/* Global address base setup code */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 8b3c469..495cd05 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -16,13 +16,14 @@
#include <linux/io.h>
#include <plat/common.h>
-#include <plat/control.h>
#include <plat/sdrc.h>
+
#include "cm-regbits-34xx.h"
#include "prm-regbits-34xx.h"
#include "cm.h"
#include "prm.h"
#include "sdrc.h"
+#include "control.h"
static void __iomem *omap2_ctrl_base;
static void __iomem *omap4_ctrl_pad_base;
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/mach-omap2/control.h
similarity index 97%
rename from arch/arm/plat-omap/include/plat/control.h
rename to arch/arm/mach-omap2/control.h
index 54b0c35..b6c6b7c 100644
--- a/arch/arm/plat-omap/include/plat/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -1,10 +1,10 @@
/*
- * arch/arm/plat-omap/include/mach/control.h
+ * arch/arm/mach-omap2/control.h
*
* OMAP2/3/4 System Control Module definitions
*
- * Copyright (C) 2007-2009 Texas Instruments, Inc.
- * Copyright (C) 2007-2008 Nokia Corporation
+ * Copyright (C) 2007-2010 Texas Instruments, Inc.
+ * Copyright (C) 2007-2008, 2010 Nokia Corporation
*
* Written by Paul Walmsley
*
@@ -13,8 +13,8 @@
* the Free Software Foundation.
*/
-#ifndef __ASM_ARCH_CONTROL_H
-#define __ASM_ARCH_CONTROL_H
+#ifndef __ARCH_ARM_MACH_OMAP2_CONTROL_H
+#define __ARCH_ARM_MACH_OMAP2_CONTROL_H
#include <mach/io.h>
#include <mach/ctrl_module_core_44xx.h>
@@ -321,12 +321,12 @@
#define FEAT_L2CACHE_256KB 3
#define OMAP3_ISP_SHIFT 5
-#define OMAP3_ISP_MASK (1<< OMAP3_ISP_SHIFT)
+#define OMAP3_ISP_MASK (1 << OMAP3_ISP_SHIFT)
#define FEAT_ISP 0
#define FEAT_ISP_NONE 1
#define OMAP3_NEON_SHIFT 4
-#define OMAP3_NEON_MASK (1<< OMAP3_NEON_SHIFT)
+#define OMAP3_NEON_MASK (1 << OMAP3_NEON_SHIFT)
#define FEAT_NEON 0
#define FEAT_NEON_NONE 1
@@ -364,5 +364,5 @@ extern void omap3_control_restore_context(void);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ASM_ARCH_CONTROL_H */
+#endif /* __ARCH_ARM_MACH_OMAP2_CONTROL_H */
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 8ea012e..61a3523 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -29,10 +29,10 @@
#include <plat/irqs.h>
#include <plat/powerdomain.h>
#include <plat/clockdomain.h>
-#include <plat/control.h>
#include <plat/serial.h>
#include "pm.h"
+#include "control.h"
#ifdef CONFIG_CPU_IDLE
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9bd4b34..4872bce 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -9,7 +9,6 @@
* (at your option) any later version.
*/
-#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
@@ -22,7 +21,6 @@
#include <asm/mach/map.h>
#include <asm/pmu.h>
-#include <plat/control.h>
#include <plat/tc.h>
#include <plat/board.h>
#include <mach/gpio.h>
@@ -30,6 +28,7 @@
#include <plat/dma.h>
#include "mux.h"
+#include "control.h"
#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 5c5cd5e..47644b9 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -14,11 +14,11 @@
#include <linux/string.h>
#include <linux/delay.h>
#include <mach/hardware.h>
-#include <plat/control.h>
#include <plat/mmc.h>
#include <plat/omap-pm.h>
#include "hsmmc.h"
+#include "control.h"
#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 04a2fa2..5f9086c 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -22,11 +22,12 @@
#include <asm/cputype.h>
#include <plat/common.h>
-#include <plat/control.h>
#include <plat/cpu.h>
#include <mach/id.h>
+#include "control.h"
+
static struct omap_chip_id omap_chip;
static unsigned int omap_revision;
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 51abced..eba9fa1 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -22,7 +22,9 @@
#include <plat/dma.h>
#include <plat/cpu.h>
#include <plat/mcbsp.h>
-#include <plat/control.h>
+
+#include "control.h"
+
/* McBSP internal signal muxing functions */
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index e33740c..074536a 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -23,12 +23,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-#include <linux/module.h>
+#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
#include <linux/list.h>
+#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
@@ -36,8 +35,7 @@
#include <asm/system.h>
-#include <plat/control.h>
-
+#include "control.h"
#include "mux.h"
#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 6aeedea..c1bceec 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -38,7 +38,6 @@
#include <mach/irqs.h>
#include <plat/clock.h>
#include <plat/sram.h>
-#include <plat/control.h>
#include <plat/dma.h>
#include <plat/board.h>
@@ -48,6 +47,7 @@
#include "cm-regbits-24xx.h"
#include "sdrc.h"
#include "pm.h"
+#include "control.h"
#include <plat/powerdomain.h>
#include <plat/clockdomain.h>
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index d2b940c..7b71813 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -32,7 +32,6 @@
#include <plat/sram.h>
#include <plat/clockdomain.h>
#include <plat/powerdomain.h>
-#include <plat/control.h>
#include <plat/serial.h>
#include <plat/sdrc.h>
#include <plat/prcm.h>
@@ -48,6 +47,7 @@
#include "prm.h"
#include "pm.h"
#include "sdrc.h"
+#include "control.h"
/* Scratchpad offsets */
#define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index d4388d3..16235c6 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -26,7 +26,6 @@
#include <plat/common.h>
#include <plat/prcm.h>
#include <plat/irqs.h>
-#include <plat/control.h>
#include "clock.h"
#include "clock2xxx.h"
@@ -34,6 +33,7 @@
#include "prm.h"
#include "prm-regbits-24xx.h"
#include "prm-regbits-44xx.h"
+#include "control.h"
static void __iomem *prm_base;
static void __iomem *cm_base;
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 566e991..4ec9c6a 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -28,11 +28,11 @@
#include <plat/common.h>
#include <plat/board.h>
#include <plat/clock.h>
-#include <plat/control.h>
#include "prm.h"
#include "pm.h"
#include "prm-regbits-34xx.h"
+#include "control.h"
#define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52
#define UART_OMAP_WER 0x17 /* Wake-up enable register */
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index ba53191..2fb205a 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -27,11 +27,11 @@
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <mach/io.h>
-#include <plat/control.h>
#include "cm.h"
#include "prm.h"
#include "sdrc.h"
+#include "control.h"
#define SDRC_SCRATCHPAD_SEM_V 0xfa00291c
diff --git a/arch/arm/mach-omap2/usb-fs.c b/arch/arm/mach-omap2/usb-fs.c
index a216d88..1481078 100644
--- a/arch/arm/mach-omap2/usb-fs.c
+++ b/arch/arm/mach-omap2/usb-fs.c
@@ -29,18 +29,18 @@
#include <asm/irq.h>
-#include <plat/control.h>
#include <plat/usb.h>
#include <plat/board.h>
+#include "control.h"
+#include "mux.h"
+
#define INT_USB_IRQ_GEN INT_24XX_USB_IRQ_GEN
#define INT_USB_IRQ_NISO INT_24XX_USB_IRQ_NISO
#define INT_USB_IRQ_ISO INT_24XX_USB_IRQ_ISO
#define INT_USB_IRQ_HGEN INT_24XX_USB_IRQ_HGEN
#define INT_USB_IRQ_OTG INT_24XX_USB_IRQ_OTG
-#include "mux.h"
-
#if defined(CONFIG_ARCH_OMAP2)
#ifdef CONFIG_USB_GADGET_OMAP
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 49bebbf..be59325 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -27,7 +27,6 @@
#include <plat/dma.h>
#include <plat/mcbsp.h>
-#include <plat/control.h>
#include "../mach-omap2/cm-regbits-34xx.h"
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index f81e4f0..7f472a5 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -54,7 +54,6 @@
#include <plat/dma.h>
#include <plat/usb.h>
-#include <plat/control.h>
#include "omap_udc.h"
@@ -2309,21 +2308,12 @@ static char *trx_mode(unsigned m, int enabled)
static int proc_otg_show(struct seq_file *s)
{
u32 tmp;
- u32 trans;
- char *ctrl_name;
+ u32 trans = 0;
+ char *ctrl_name = "(UNKNOWN)";
+ /* XXX This needs major revision for OMAP2+ */
tmp = omap_readl(OTG_REV);
- if (cpu_is_omap24xx()) {
- /*
- * REVISIT: Not clear how this works on OMAP2. trans
- * is ANDed to produce bits 7 and 8, which might make
- * sense for USB_TRANSCEIVER_CTRL on OMAP1,
- * but with CONTROL_DEVCONF, these bits have something to
- * do with the frame adjustment counter and McBSP2.
- */
- ctrl_name = "control_devconf";
- trans = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
- } else {
+ if (cpu_class_is_omap1()) {
ctrl_name = "tranceiver_ctrl";
trans = omap_readw(USB_TRANSCEIVER_CTRL);
}
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 10/10] OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (8 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 09/10] OMAP: control: move plat-omap/control.h to mach-omap2/control.h Paul Walmsley
@ 2010-10-01 21:35 ` Paul Walmsley
2010-10-05 12:52 ` [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Jarkko Nikula
10 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-01 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Reduce the amount of debugging generated by default when unused clocks
are being disabled by the clock code. The previous code would only
generate debug-level messages, but some people who wished to run
production kernels with debug-level messages enabled reported that the
large number of clock disable messages were slowing boot. Now to
enable clock-by-clock disable messages, DEBUG needs to be defined in
mach-omap2/clock.c.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Tuukka Tikkanen <tuukka.tikkanen@nokia.com>
Cc: Tim Bird <tim.bird@am.sony.com>
---
arch/arm/mach-omap2/clock.c | 2 +-
arch/arm/plat-omap/clock.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 605f531..b5babf5 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -395,7 +395,7 @@ void omap2_clk_disable_unused(struct clk *clk)
if ((regval32 & (1 << clk->enable_bit)) == v)
return;
- printk(KERN_DEBUG "Disabling unused clock \"%s\"\n", clk->name);
+ pr_debug("Disabling unused clock \"%s\"\n", clk->name);
if (cpu_is_omap34xx()) {
omap2_clk_enable(clk);
omap2_clk_disable(clk);
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 7190cbd..fc62fb5 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -60,7 +60,7 @@ void clk_disable(struct clk *clk)
spin_lock_irqsave(&clockfw_lock, flags);
if (clk->usecount == 0) {
- printk(KERN_ERR "Trying disable clock %s with 0 usecount\n",
+ pr_err("Trying disable clock %s with 0 usecount\n",
clk->name);
WARN_ON(1);
goto out;
@@ -397,6 +397,7 @@ static int __init clk_disable_unused(void)
struct clk *ck;
unsigned long flags;
+ pr_info("clock: disabling unused clocks to save power\n");
list_for_each_entry(ck, &clocks, node) {
if (ck->ops == &clkops_null)
continue;
@@ -418,7 +419,7 @@ late_initcall(clk_disable_unused);
int __init clk_init(struct clk_functions * custom_clocks)
{
if (!custom_clocks) {
- printk(KERN_ERR "No custom clock functions registered\n");
+ pr_err("No custom clock functions registered\n");
BUG();
}
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC
2010-10-01 21:34 ` [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC Paul Walmsley
@ 2010-10-04 4:21 ` Varadarajan, Charulatha
2010-10-04 5:45 ` Paul Walmsley
0 siblings, 1 reply; 43+ messages in thread
From: Varadarajan, Charulatha @ 2010-10-04 4:21 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org
> [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Paul Walmsley
> Sent: Saturday, October 02, 2010 3:05 AM
> To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Cc: Tony Lindgren
> Subject: [PATCH 01/10] OMAP2+: Kconfig: disallow builds for
> boards that don't use the currently-selected SoC
>
> Currently, if, for example, CONFIG_ARCH_OMAP2420 is not
> selected, OMAP2420
> board files can still be included in the build. This results
> in link errors:
>
> arch/arm/mach-omap2/built-in.o: In function `omap_generic_map_io':
> .../arch/arm/mach-omap2/board-generic.c:51: undefined
> reference to `omap2_set_globals_242x'
> arch/arm/mach-omap2/built-in.o: In function `omap_h4_init':
> .../arch/arm/mach-omap2/board-h4.c:330: undefined reference
> to `omap2420_mux_init'
> arch/arm/mach-omap2/built-in.o: In function `omap_h4_map_io':
> .../arch/arm/mach-omap2/board-h4.c:373: undefined reference
> to `omap2_set_globals_242x'
> arch/arm/mach-omap2/built-in.o: In function `omap_apollon_init':
> .../arch/arm/mach-omap2/board-apollon.c:325: undefined
> reference to `omap2420_mux_init'
> arch/arm/mach-omap2/built-in.o: In function `omap_apollon_map_io':
> .../arch/arm/mach-omap2/board-apollon.c:353: undefined
> reference to `omap2_set_globals_242x'
> make: *** [.tmp_vmlinux1] Error 1
>
> Fix this by making the boards depend on the Kconfig option for the
> specific SoC that they use.
>
> Also, while here, fix the mach-omap2/board-generic.c file to
> remove the
> dependency on OMAP2420.
>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> Cc: Tony Lindgren <tony@atomide.com>
> ---
> arch/arm/mach-omap2/Kconfig | 6 +++---
> arch/arm/mach-omap2/board-generic.c | 16 ++++++++++++++--
> 2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 1c4b237..7f740bd 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -101,20 +101,20 @@ config MACH_OMAP2_TUSB6010
>
> config MACH_OMAP_H4
> bool "OMAP 2420 H4 board"
> - depends on ARCH_OMAP2
> + depends on ARCH_OMAP2420
> default y
> select OMAP_PACKAGE_ZAF
> select OMAP_DEBUG_DEVICES
>
> config MACH_OMAP_APOLLON
> bool "OMAP 2420 Apollon board"
> - depends on ARCH_OMAP2
> + depends on ARCH_OMAP2420
> default y
> select OMAP_PACKAGE_ZAC
>
> config MACH_OMAP_2430SDP
> bool "OMAP 2430 SDP board"
> - depends on ARCH_OMAP2
> + depends on ARCH_OMAP2430
> default y
> select OMAP_PACKAGE_ZAC
>
> diff --git a/arch/arm/mach-omap2/board-generic.c
> b/arch/arm/mach-omap2/board-generic.c
> index 3482b99..c7ec3f3 100644
> --- a/arch/arm/mach-omap2/board-generic.c
> +++ b/arch/arm/mach-omap2/board-generic.c
> @@ -48,10 +48,22 @@ static void __init omap_generic_init(void)
>
> static void __init omap_generic_map_io(void)
> {
> - omap2_set_globals_242x(); /* should be 242x, 243x, or 343x */
> - omap242x_map_common_io();
> + if (cpu_is_omap242x()) {
> + omap2_set_globals_242x();
> + omap242x_map_common_io();
> + } else if (cpu_is_omap242x()) {
Is this intended for 242x() or 243x()?
> + omap2_set_globals_243x();
> + omap243x_map_common_io();
> + } else if (cpu_is_omap34xx()) {
> + omap2_set_globals_3xxx();
> + omap34xx_map_common_io();
> + } else if (cpu_is_omap44xx()) {
> + omap2_set_globals_443x();
> + omap44xx_map_common_io();
> + }
> }
>
> +/* XXX This machine entry name should be updated */
> MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
> /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
> .phys_io = 0x48000000,
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-01 21:35 ` [PATCH 08/10] OMAP: split plat-omap/common.c Paul Walmsley
@ 2010-10-04 5:34 ` Shilimkar, Santosh
2010-10-04 6:56 ` Felipe Balbi
2010-10-04 5:38 ` Varadarajan, Charulatha
2010-10-04 9:08 ` Cousson, Benoit
2 siblings, 1 reply; 43+ messages in thread
From: Shilimkar, Santosh @ 2010-10-04 5:34 UTC (permalink / raw)
To: linux-arm-kernel
Felipe,
> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
> owner at vger.kernel.org] On Behalf Of Paul Walmsley
> Sent: Saturday, October 02, 2010 3:06 AM
> To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
>
> Split plat-omap/common.c into three pieces:
>
> 1. the 32KiHz sync timer and clocksource code, which now lives in
> plat-omap/32ksynctimer.c;
>
I remember you have converted the 32k sync time code to a platform driver.
That was also addressing the multi-omap build and was removing all
the compile time switches.
Do you plan to rebase it and post it again ?
> 2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
>
> 3. and the remainder of the OMAP-wide common code, which includes the
> deprecated ATAGs code and a deprecated video RAM reservation function.
>
> The primary motivation for doing this is to move the OMAP2+-specific parts
> into an OMAP2+-specific file, so that build breakage related to the
> System Control Module code can be resolved.
>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> ---
> arch/arm/mach-omap2/Makefile | 3
> arch/arm/mach-omap2/common.c | 138 ++++++++++++++++++
> arch/arm/plat-omap/32ksynctimer.c | 184 +++++++++++++++++++++++
> arch/arm/plat-omap/Makefile | 2
> arch/arm/plat-omap/common.c | 291 --------------------------------
> -----
> arch/arm/plat-omap/devices.c | 1
> arch/arm/plat-omap/sram.c | 3
> 7 files changed, 325 insertions(+), 297 deletions(-)
> create mode 100644 arch/arm/mach-omap2/common.c
> create mode 100644 arch/arm/plat-omap/32ksynctimer.c
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index 9edacb0..d543533 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -3,7 +3,8 @@
> #
>
> # Common support
> -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
> pm.o
> +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
> pm.o \
> + common.o
>
> omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o
> hwmod-common = omap_hwmod.o \
> diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
> new file mode 100644
> index 0000000..4e0469d
> --- /dev/null
> +++ b/arch/arm/mach-omap2/common.c
> @@ -0,0 +1,138 @@
> +/*
> + * linux/arch/arm/mach-omap2/common.c
> + *
> + * Code common to all OMAP2+ machines.
> + *
> + * Copyright (C) 2009 Texas Instruments
> + * Copyright (C) 2010 Nokia Corporation
> + * Tony Lindgren <tony@atomide.com>
> + * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
> + * Paul Walmsley
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +
> +#include <plat/common.h>
> +#include <plat/board.h>
> +#include <plat/control.h>
> +#include <plat/mux.h>
> +
> +#include <plat/clock.h>
> +
> +#include "sdrc.h"
> +
> +/* 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);
> + omap2_set_globals_sdrc(omap2_globals);
> + omap2_set_globals_control(omap2_globals);
> + omap2_set_globals_prcm(omap2_globals);
> + omap2_set_globals_uart(omap2_globals);
> +}
> +
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP2420)
> +
> +static struct omap_globals omap242x_globals = {
> + .class = OMAP242X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
> + .sdrc = OMAP2420_SDRC_BASE,
> + .sms = OMAP2420_SMS_BASE,
> + .ctrl = OMAP242X_CTRL_BASE,
> + .prm = OMAP2420_PRM_BASE,
> + .cm = OMAP2420_CM_BASE,
> + .uart1_phys = OMAP2_UART1_BASE,
> + .uart2_phys = OMAP2_UART2_BASE,
> + .uart3_phys = OMAP2_UART3_BASE,
> +};
> +
> +void __init omap2_set_globals_242x(void)
> +{
> + __omap2_set_globals(&omap242x_globals);
> +}
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP2430)
> +
> +static struct omap_globals omap243x_globals = {
> + .class = OMAP243X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
> + .sdrc = OMAP243X_SDRC_BASE,
> + .sms = OMAP243X_SMS_BASE,
> + .ctrl = OMAP243X_CTRL_BASE,
> + .prm = OMAP2430_PRM_BASE,
> + .cm = OMAP2430_CM_BASE,
> + .uart1_phys = OMAP2_UART1_BASE,
> + .uart2_phys = OMAP2_UART2_BASE,
> + .uart3_phys = OMAP2_UART3_BASE,
> +};
> +
> +void __init omap2_set_globals_243x(void)
> +{
> + __omap2_set_globals(&omap243x_globals);
> +}
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP3)
> +
> +static struct omap_globals omap3_globals = {
> + .class = OMAP343X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
> + .sdrc = OMAP343X_SDRC_BASE,
> + .sms = OMAP343X_SMS_BASE,
> + .ctrl = OMAP343X_CTRL_BASE,
> + .prm = OMAP3430_PRM_BASE,
> + .cm = OMAP3430_CM_BASE,
> + .uart1_phys = OMAP3_UART1_BASE,
> + .uart2_phys = OMAP3_UART2_BASE,
> + .uart3_phys = OMAP3_UART3_BASE,
> + .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
> +};
> +
> +void __init omap2_set_globals_3xxx(void)
> +{
> + __omap2_set_globals(&omap3_globals);
> +}
> +
> +void __init omap3_map_io(void)
> +{
> + omap2_set_globals_3xxx();
> + omap34xx_map_common_io();
> +}
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP4)
> +static struct omap_globals omap4_globals = {
> + .class = OMAP443X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
> + .ctrl = OMAP443X_SCM_BASE,
> + .ctrl_pad = OMAP443X_CTRL_BASE,
> + .prm = OMAP4430_PRM_BASE,
> + .cm = OMAP4430_CM_BASE,
> + .cm2 = OMAP4430_CM2_BASE,
> + .uart1_phys = OMAP4_UART1_BASE,
> + .uart2_phys = OMAP4_UART2_BASE,
> + .uart3_phys = OMAP4_UART3_BASE,
> + .uart4_phys = OMAP4_UART4_BASE,
> +};
> +
> +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_uart(&omap4_globals);
> +}
> +#endif
> +
> diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-
> omap/32ksynctimer.c
> new file mode 100644
> index 0000000..b7f458c
> --- /dev/null
> +++ b/arch/arm/plat-omap/32ksynctimer.c
> @@ -0,0 +1,184 @@
> +/*
> + * linux/arch/arm/plat-omap/clocksource.c
> + *
> + * OMAP clocksource-related code
> + *
> + * Copyright (C) 2009 Texas Instruments
> + * Copyright (C) 2010 Nokia Corporation
> + * Tony Lindgren <tony@atomide.com>
> + * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
> + * Paul Walmsley
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +
> +#include <plat/common.h>
> +#include <plat/board.h>
> +
> +#include <plat/clock.h>
> +
> +
> +/*
> + * 32KHz clocksource ... always available, on pretty most chips except
> + * OMAP 730 and 1510. Other timers could be used as clocksources, with
> + * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
> + * but systems won't necessarily want to spend resources that way.
> + */
> +
> +#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
> +
> +#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
> +
> +#include <linux/clocksource.h>
> +
> +/*
> + * offset_32k holds the init time counter value. It is then subtracted
> + * from every counter read to achieve a counter that counts time from the
> + * kernel boot (needed for sched_clock()).
> + */
> +static u32 offset_32k __read_mostly;
> +
> +#ifdef CONFIG_ARCH_OMAP16XX
> +static cycle_t omap16xx_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
> +}
> +#else
> +#define omap16xx_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP2420
> +static cycle_t omap2420_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap2420_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP2430
> +static cycle_t omap2430_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap2430_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP3
> +static cycle_t omap34xx_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap34xx_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP4
> +static cycle_t omap44xx_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap44xx_32k_read NULL
> +#endif
> +
> +/*
> + * Kernel assumes that sched_clock can be called early but may not have
> + * things ready yet.
> + */
> +static cycle_t omap_32k_read_dummy(struct clocksource *cs)
> +{
> + return 0;
> +}
> +
> +static struct clocksource clocksource_32k = {
> + .name = "32k_counter",
> + .rating = 250,
> + .read = omap_32k_read_dummy,
> + .mask = CLOCKSOURCE_MASK(32),
> + .shift = 10,
> + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> +};
> +
> +/*
> + * Returns current time from boot in nsecs. It's OK for this to wrap
> + * around for now, as it's just a relative time stamp.
> + */
> +unsigned long long sched_clock(void)
> +{
> + return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
> + clocksource_32k.mult, clocksource_32k.shift);
> +}
> +
> +/**
> + * read_persistent_clock - Return time from a persistent clock.
> + *
> + * Reads the time from a source which isn't disabled during PM, the
> + * 32k sync timer. Convert the cycles elapsed since last read into
> + * nsecs and adds to a monotonically increasing timespec.
> + */
> +static struct timespec persistent_ts;
> +static cycles_t cycles, last_cycles;
> +void read_persistent_clock(struct timespec *ts)
> +{
> + unsigned long long nsecs;
> + cycles_t delta;
> + struct timespec *tsp = &persistent_ts;
> +
> + last_cycles = cycles;
> + cycles = clocksource_32k.read(&clocksource_32k);
> + delta = cycles - last_cycles;
> +
> + nsecs = clocksource_cyc2ns(delta,
> + clocksource_32k.mult, clocksource_32k.shift);
> +
> + timespec_add_ns(tsp, nsecs);
> + *ts = *tsp;
> +}
> +
> +static int __init omap_init_clocksource_32k(void)
> +{
> + static char err[] __initdata = KERN_ERR
> + "%s: can't register clocksource!\n";
> +
> + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> + struct clk *sync_32k_ick;
> +
> + if (cpu_is_omap16xx())
> + clocksource_32k.read = omap16xx_32k_read;
> + else if (cpu_is_omap2420())
> + clocksource_32k.read = omap2420_32k_read;
> + else if (cpu_is_omap2430())
> + clocksource_32k.read = omap2430_32k_read;
> + else if (cpu_is_omap34xx())
> + clocksource_32k.read = omap34xx_32k_read;
> + else if (cpu_is_omap44xx())
> + clocksource_32k.read = omap44xx_32k_read;
> + else
> + return -ENODEV;
> +
> + sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> + if (sync_32k_ick)
> + clk_enable(sync_32k_ick);
> +
> + clocksource_32k.mult = clocksource_hz2mult(32768,
> + clocksource_32k.shift);
> +
> + offset_32k = clocksource_32k.read(&clocksource_32k);
> +
> + if (clocksource_register(&clocksource_32k))
> + printk(err, clocksource_32k.name);
> + }
> + return 0;
> +}
> +arch_initcall(omap_init_clocksource_32k);
> +
> +#endif /* !(defined(CONFIG_ARCH_OMAP730) ||
> defined(CONFIG_ARCH_OMAP15XX)) */
> +
> diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
> index 2a15191..32a5959 100644
> --- a/arch/arm/plat-omap/Makefile
> +++ b/arch/arm/plat-omap/Makefile
> @@ -4,7 +4,7 @@
>
> # Common support
> obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
> - usb.o fb.o io.o
> + usb.o fb.o io.o 32ksynctimer.o
> obj-m :=
> obj-n :=
> obj- :=
> diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
> index 9200ea7..221a675 100644
> --- a/arch/arm/plat-omap/common.c
> +++ b/arch/arm/plat-omap/common.c
> @@ -11,38 +11,15 @@
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation.
> */
> -#include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/init.h>
> -#include <linux/delay.h>
> -#include <linux/console.h>
> -#include <linux/serial.h>
> -#include <linux/tty.h>
> -#include <linux/serial_8250.h>
> -#include <linux/serial_reg.h>
> -#include <linux/clk.h>
> #include <linux/io.h>
> #include <linux/omapfb.h>
>
> -#include <mach/hardware.h>
> -#include <asm/system.h>
> -#include <asm/pgtable.h>
> -#include <asm/mach/map.h>
> -#include <asm/setup.h>
> -
> #include <plat/common.h>
> #include <plat/board.h>
> -#include <plat/control.h>
> -#include <plat/mux.h>
> -#include <plat/fpga.h>
> -#include <plat/serial.h>
> #include <plat/vram.h>
>
> -#include <plat/clock.h>
> -
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> -# include "../mach-omap2/sdrc.h"
> -#endif
>
> #define NO_LENGTH_CHECK 0xffffffff
>
> @@ -88,271 +65,3 @@ void __init omap_reserve(void)
> omapfb_reserve_sdram_memblock();
> omap_vram_reserve_sdram_memblock();
> }
> -
> -/*
> - * 32KHz clocksource ... always available, on pretty most chips except
> - * OMAP 730 and 1510. Other timers could be used as clocksources, with
> - * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
> - * but systems won't necessarily want to spend resources that way.
> - */
> -
> -#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
> -
> -#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
> -
> -#include <linux/clocksource.h>
> -
> -/*
> - * offset_32k holds the init time counter value. It is then subtracted
> - * from every counter read to achieve a counter that counts time from the
> - * kernel boot (needed for sched_clock()).
> - */
> -static u32 offset_32k __read_mostly;
> -
> -#ifdef CONFIG_ARCH_OMAP16XX
> -static cycle_t omap16xx_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
> -}
> -#else
> -#define omap16xx_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP2420
> -static cycle_t omap2420_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap2420_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP2430
> -static cycle_t omap2430_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap2430_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP3
> -static cycle_t omap34xx_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap34xx_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP4
> -static cycle_t omap44xx_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap44xx_32k_read NULL
> -#endif
> -
> -/*
> - * Kernel assumes that sched_clock can be called early but may not have
> - * things ready yet.
> - */
> -static cycle_t omap_32k_read_dummy(struct clocksource *cs)
> -{
> - return 0;
> -}
> -
> -static struct clocksource clocksource_32k = {
> - .name = "32k_counter",
> - .rating = 250,
> - .read = omap_32k_read_dummy,
> - .mask = CLOCKSOURCE_MASK(32),
> - .shift = 10,
> - .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> -/*
> - * Returns current time from boot in nsecs. It's OK for this to wrap
> - * around for now, as it's just a relative time stamp.
> - */
> -unsigned long long sched_clock(void)
> -{
> - return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
> - clocksource_32k.mult, clocksource_32k.shift);
> -}
> -
> -/**
> - * read_persistent_clock - Return time from a persistent clock.
> - *
> - * Reads the time from a source which isn't disabled during PM, the
> - * 32k sync timer. Convert the cycles elapsed since last read into
> - * nsecs and adds to a monotonically increasing timespec.
> - */
> -static struct timespec persistent_ts;
> -static cycles_t cycles, last_cycles;
> -void read_persistent_clock(struct timespec *ts)
> -{
> - unsigned long long nsecs;
> - cycles_t delta;
> - struct timespec *tsp = &persistent_ts;
> -
> - last_cycles = cycles;
> - cycles = clocksource_32k.read(&clocksource_32k);
> - delta = cycles - last_cycles;
> -
> - nsecs = clocksource_cyc2ns(delta,
> - clocksource_32k.mult, clocksource_32k.shift);
> -
> - timespec_add_ns(tsp, nsecs);
> - *ts = *tsp;
> -}
> -
> -static int __init omap_init_clocksource_32k(void)
> -{
> - static char err[] __initdata = KERN_ERR
> - "%s: can't register clocksource!\n";
> -
> - if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> - struct clk *sync_32k_ick;
> -
> - if (cpu_is_omap16xx())
> - clocksource_32k.read = omap16xx_32k_read;
> - else if (cpu_is_omap2420())
> - clocksource_32k.read = omap2420_32k_read;
> - else if (cpu_is_omap2430())
> - clocksource_32k.read = omap2430_32k_read;
> - else if (cpu_is_omap34xx())
> - clocksource_32k.read = omap34xx_32k_read;
> - else if (cpu_is_omap44xx())
> - clocksource_32k.read = omap44xx_32k_read;
> - else
> - return -ENODEV;
> -
> - sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> - if (sync_32k_ick)
> - clk_enable(sync_32k_ick);
> -
> - clocksource_32k.mult = clocksource_hz2mult(32768,
> - clocksource_32k.shift);
> -
> - offset_32k = clocksource_32k.read(&clocksource_32k);
> -
> - if (clocksource_register(&clocksource_32k))
> - printk(err, clocksource_32k.name);
> - }
> - return 0;
> -}
> -arch_initcall(omap_init_clocksource_32k);
> -
> -#endif /* !(defined(CONFIG_ARCH_OMAP730) ||
> defined(CONFIG_ARCH_OMAP15XX)) */
> -
> -/* 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);
> - omap2_set_globals_sdrc(omap2_globals);
> - omap2_set_globals_control(omap2_globals);
> - omap2_set_globals_prcm(omap2_globals);
> - omap2_set_globals_uart(omap2_globals);
> -}
> -
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP2420)
> -
> -static struct omap_globals omap242x_globals = {
> - .class = OMAP242X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
> - .sdrc = OMAP2420_SDRC_BASE,
> - .sms = OMAP2420_SMS_BASE,
> - .ctrl = OMAP242X_CTRL_BASE,
> - .prm = OMAP2420_PRM_BASE,
> - .cm = OMAP2420_CM_BASE,
> - .uart1_phys = OMAP2_UART1_BASE,
> - .uart2_phys = OMAP2_UART2_BASE,
> - .uart3_phys = OMAP2_UART3_BASE,
> -};
> -
> -void __init omap2_set_globals_242x(void)
> -{
> - __omap2_set_globals(&omap242x_globals);
> -}
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP2430)
> -
> -static struct omap_globals omap243x_globals = {
> - .class = OMAP243X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
> - .sdrc = OMAP243X_SDRC_BASE,
> - .sms = OMAP243X_SMS_BASE,
> - .ctrl = OMAP243X_CTRL_BASE,
> - .prm = OMAP2430_PRM_BASE,
> - .cm = OMAP2430_CM_BASE,
> - .uart1_phys = OMAP2_UART1_BASE,
> - .uart2_phys = OMAP2_UART2_BASE,
> - .uart3_phys = OMAP2_UART3_BASE,
> -};
> -
> -void __init omap2_set_globals_243x(void)
> -{
> - __omap2_set_globals(&omap243x_globals);
> -}
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP3)
> -
> -static struct omap_globals omap3_globals = {
> - .class = OMAP343X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
> - .sdrc = OMAP343X_SDRC_BASE,
> - .sms = OMAP343X_SMS_BASE,
> - .ctrl = OMAP343X_CTRL_BASE,
> - .prm = OMAP3430_PRM_BASE,
> - .cm = OMAP3430_CM_BASE,
> - .uart1_phys = OMAP3_UART1_BASE,
> - .uart2_phys = OMAP3_UART2_BASE,
> - .uart3_phys = OMAP3_UART3_BASE,
> - .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
> -};
> -
> -void __init omap2_set_globals_3xxx(void)
> -{
> - __omap2_set_globals(&omap3_globals);
> -}
> -
> -void __init omap3_map_io(void)
> -{
> - omap2_set_globals_3xxx();
> - omap34xx_map_common_io();
> -}
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP4)
> -static struct omap_globals omap4_globals = {
> - .class = OMAP443X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
> - .ctrl = OMAP443X_SCM_BASE,
> - .ctrl_pad = OMAP443X_CTRL_BASE,
> - .prm = OMAP4430_PRM_BASE,
> - .cm = OMAP4430_CM_BASE,
> - .cm2 = OMAP4430_CM2_BASE,
> - .uart1_phys = OMAP4_UART1_BASE,
> - .uart2_phys = OMAP4_UART2_BASE,
> - .uart3_phys = OMAP4_UART3_BASE,
> - .uart4_phys = OMAP4_UART4_BASE,
> -};
> -
> -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_uart(&omap4_globals);
> -}
> -#endif
> -
> diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
> index d1920be..78162a0 100644
> --- a/arch/arm/plat-omap/devices.c
> +++ b/arch/arm/plat-omap/devices.c
> @@ -21,7 +21,6 @@
> #include <asm/mach/map.h>
>
> #include <plat/tc.h>
> -#include <plat/control.h>
> #include <plat/board.h>
> #include <plat/mmc.h>
> #include <mach/gpio.h>
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 33ee6b8..d971aeb 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -30,8 +30,6 @@
> #include <plat/cpu.h>
> #include <plat/vram.h>
>
> -#include <plat/control.h>
> -
> #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> # include "../mach-omap2/prm.h"
> # include "../mach-omap2/cm.h"
> @@ -68,7 +66,6 @@
> #define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
> #define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
> #define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
> -#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
>
> #define GP_DEVICE 0x300
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-01 21:35 ` [PATCH 08/10] OMAP: split plat-omap/common.c Paul Walmsley
2010-10-04 5:34 ` Shilimkar, Santosh
@ 2010-10-04 5:38 ` Varadarajan, Charulatha
2010-10-04 6:03 ` Paul Walmsley
2010-10-04 19:24 ` Paul Walmsley
2010-10-04 9:08 ` Cousson, Benoit
2 siblings, 2 replies; 43+ messages in thread
From: Varadarajan, Charulatha @ 2010-10-04 5:38 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org
> [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Paul Walmsley
> Sent: Saturday, October 02, 2010 3:06 AM
> To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
>
> Split plat-omap/common.c into three pieces:
>
> 1. the 32KiHz sync timer and clocksource code, which now lives in
> plat-omap/32ksynctimer.c;
>
> 2. the OMAP2+ common code, which has been moved to
> mach-omap2/common.c;
>
> 3. and the remainder of the OMAP-wide common code, which includes the
> deprecated ATAGs code and a deprecated video RAM
> reservation function.
>
> The primary motivation for doing this is to move the
> OMAP2+-specific parts
> into an OMAP2+-specific file, so that build breakage related to the
> System Control Module code can be resolved.
>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> ---
> arch/arm/mach-omap2/Makefile | 3
> arch/arm/mach-omap2/common.c | 138 ++++++++++++++++++
> arch/arm/plat-omap/32ksynctimer.c | 184 +++++++++++++++++++++++
> arch/arm/plat-omap/Makefile | 2
> arch/arm/plat-omap/common.c | 291
> -------------------------------------
> arch/arm/plat-omap/devices.c | 1
> arch/arm/plat-omap/sram.c | 3
> 7 files changed, 325 insertions(+), 297 deletions(-)
> create mode 100644 arch/arm/mach-omap2/common.c
> create mode 100644 arch/arm/plat-omap/32ksynctimer.c
>
> diff --git a/arch/arm/mach-omap2/Makefile
> b/arch/arm/mach-omap2/Makefile
> index 9edacb0..d543533 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -3,7 +3,8 @@
> #
>
> # Common support
> -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o
> timer-gp.o pm.o
> +obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o
> timer-gp.o pm.o \
> + common.o
>
> omap-2-3-common = irq.o sdrc.o
> prm2xxx_3xxx.o
> hwmod-common = omap_hwmod.o \
> diff --git a/arch/arm/mach-omap2/common.c
> b/arch/arm/mach-omap2/common.c
> new file mode 100644
> index 0000000..4e0469d
> --- /dev/null
> +++ b/arch/arm/mach-omap2/common.c
> @@ -0,0 +1,138 @@
> +/*
> + * linux/arch/arm/mach-omap2/common.c
> + *
> + * Code common to all OMAP2+ machines.
> + *
> + * Copyright (C) 2009 Texas Instruments
> + * Copyright (C) 2010 Nokia Corporation
> + * Tony Lindgren <tony@atomide.com>
> + * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
> + * Paul Walmsley
> + *
> + * This program is free software; you can redistribute it
> and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +
> +#include <plat/common.h>
> +#include <plat/board.h>
> +#include <plat/control.h>
> +#include <plat/mux.h>
> +
> +#include <plat/clock.h>
> +
> +#include "sdrc.h"
> +
> +/* 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);
> + omap2_set_globals_sdrc(omap2_globals);
> + omap2_set_globals_control(omap2_globals);
> + omap2_set_globals_prcm(omap2_globals);
> + omap2_set_globals_uart(omap2_globals);
> +}
> +
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP2420)
> +
> +static struct omap_globals omap242x_globals = {
> + .class = OMAP242X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
> + .sdrc = OMAP2420_SDRC_BASE,
> + .sms = OMAP2420_SMS_BASE,
> + .ctrl = OMAP242X_CTRL_BASE,
> + .prm = OMAP2420_PRM_BASE,
> + .cm = OMAP2420_CM_BASE,
> + .uart1_phys = OMAP2_UART1_BASE,
> + .uart2_phys = OMAP2_UART2_BASE,
> + .uart3_phys = OMAP2_UART3_BASE,
> +};
> +
> +void __init omap2_set_globals_242x(void)
> +{
> + __omap2_set_globals(&omap242x_globals);
> +}
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP2430)
> +
> +static struct omap_globals omap243x_globals = {
> + .class = OMAP243X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
> + .sdrc = OMAP243X_SDRC_BASE,
> + .sms = OMAP243X_SMS_BASE,
> + .ctrl = OMAP243X_CTRL_BASE,
> + .prm = OMAP2430_PRM_BASE,
> + .cm = OMAP2430_CM_BASE,
> + .uart1_phys = OMAP2_UART1_BASE,
> + .uart2_phys = OMAP2_UART2_BASE,
> + .uart3_phys = OMAP2_UART3_BASE,
> +};
> +
> +void __init omap2_set_globals_243x(void)
> +{
> + __omap2_set_globals(&omap243x_globals);
> +}
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP3)
Do you really need these #ifdefs?
It would be better to avoid these #ifdefs and use cpu_is* checks.
Same comment holds good across this patch.
> +
> +static struct omap_globals omap3_globals = {
> + .class = OMAP343X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
> + .sdrc = OMAP343X_SDRC_BASE,
> + .sms = OMAP343X_SMS_BASE,
> + .ctrl = OMAP343X_CTRL_BASE,
> + .prm = OMAP3430_PRM_BASE,
> + .cm = OMAP3430_CM_BASE,
> + .uart1_phys = OMAP3_UART1_BASE,
> + .uart2_phys = OMAP3_UART2_BASE,
> + .uart3_phys = OMAP3_UART3_BASE,
> + .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
> +};
> +
> +void __init omap2_set_globals_3xxx(void)
> +{
> + __omap2_set_globals(&omap3_globals);
> +}
> +
> +void __init omap3_map_io(void)
> +{
> + omap2_set_globals_3xxx();
> + omap34xx_map_common_io();
> +}
> +#endif
> +
> +#if defined(CONFIG_ARCH_OMAP4)
> +static struct omap_globals omap4_globals = {
> + .class = OMAP443X_CLASS,
> + .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
> + .ctrl = OMAP443X_SCM_BASE,
> + .ctrl_pad = OMAP443X_CTRL_BASE,
> + .prm = OMAP4430_PRM_BASE,
> + .cm = OMAP4430_CM_BASE,
> + .cm2 = OMAP4430_CM2_BASE,
> + .uart1_phys = OMAP4_UART1_BASE,
> + .uart2_phys = OMAP4_UART2_BASE,
> + .uart3_phys = OMAP4_UART3_BASE,
> + .uart4_phys = OMAP4_UART4_BASE,
> +};
> +
> +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_uart(&omap4_globals);
> +}
> +#endif
> +
> diff --git a/arch/arm/plat-omap/32ksynctimer.c
> b/arch/arm/plat-omap/32ksynctimer.c
> new file mode 100644
> index 0000000..b7f458c
> --- /dev/null
> +++ b/arch/arm/plat-omap/32ksynctimer.c
> @@ -0,0 +1,184 @@
> +/*
> + * linux/arch/arm/plat-omap/clocksource.c
No need to have file name and path here.
> + *
> + * OMAP clocksource-related code
> + *
> + * Copyright (C) 2009 Texas Instruments
> + * Copyright (C) 2010 Nokia Corporation
> + * Tony Lindgren <tony@atomide.com>
> + * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
> + * Paul Walmsley
> + *
> + * This program is free software; you can redistribute it
> and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/clk.h>
> +#include <linux/io.h>
> +
> +#include <plat/common.h>
> +#include <plat/board.h>
> +
> +#include <plat/clock.h>
> +
<<snip>>
> +static int __init omap_init_clocksource_32k(void)
> +{
> + static char err[] __initdata = KERN_ERR
> + "%s: can't register clocksource!\n";
> +
> + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> + struct clk *sync_32k_ick;
> +
> + if (cpu_is_omap16xx())
Avoid cpu_is* checks in plat-omap.
> + clocksource_32k.read = omap16xx_32k_read;
> + else if (cpu_is_omap2420())
> + clocksource_32k.read = omap2420_32k_read;
> + else if (cpu_is_omap2430())
> + clocksource_32k.read = omap2430_32k_read;
> + else if (cpu_is_omap34xx())
> + clocksource_32k.read = omap34xx_32k_read;
> + else if (cpu_is_omap44xx())
> + clocksource_32k.read = omap44xx_32k_read;
> + else
> + return -ENODEV;
> +
> + sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> + if (sync_32k_ick)
> + clk_enable(sync_32k_ick);
> +
> + clocksource_32k.mult = clocksource_hz2mult(32768,
> + clocksource_32k.shift);
> +
> + offset_32k = clocksource_32k.read(&clocksource_32k);
> +
> + if (clocksource_register(&clocksource_32k))
> + printk(err, clocksource_32k.name);
> + }
> + return 0;
> +}
> +arch_initcall(omap_init_clocksource_32k);
> +
<<snip>>
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC
2010-10-04 4:21 ` Varadarajan, Charulatha
@ 2010-10-04 5:45 ` Paul Walmsley
0 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-04 5:45 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 4 Oct 2010, Varadarajan, Charulatha wrote:
>
>
> > -----Original Message-----
> > From: linux-omap-owner at vger.kernel.org
> > [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Paul Walmsley
> > Sent: Saturday, October 02, 2010 3:05 AM
> > To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> > Cc: Tony Lindgren
> > Subject: [PATCH 01/10] OMAP2+: Kconfig: disallow builds for
> > boards that don't use the currently-selected SoC
...
> > +++ b/arch/arm/mach-omap2/board-generic.c
> > @@ -48,10 +48,22 @@ static void __init omap_generic_init(void)
> >
> > static void __init omap_generic_map_io(void)
> > {
> > - omap2_set_globals_242x(); /* should be 242x, 243x, or 343x */
> > - omap242x_map_common_io();
> > + if (cpu_is_omap242x()) {
> > + omap2_set_globals_242x();
> > + omap242x_map_common_io();
> > + } else if (cpu_is_omap242x()) {
>
> Is this intended for 242x() or 243x()?
>
> > + omap2_set_globals_243x();
> > + omap243x_map_common_io();
That's for 243x(). Thanks, updated that in the branch that's posted on
git.pwsan.com.
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 5:38 ` Varadarajan, Charulatha
@ 2010-10-04 6:03 ` Paul Walmsley
2010-10-04 8:28 ` Varadarajan, Charulatha
2010-10-04 19:24 ` Paul Walmsley
1 sibling, 1 reply; 43+ messages in thread
From: Paul Walmsley @ 2010-10-04 6:03 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 4 Oct 2010, Varadarajan, Charulatha wrote:
> > -----Original Message-----
> > From: linux-omap-owner at vger.kernel.org
> > [mailto:linux-omap-owner at vger.kernel.org] On Behalf Of Paul Walmsley
> > Sent: Saturday, October 02, 2010 3:06 AM
> > To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> > Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
> >
> > Split plat-omap/common.c into three pieces:
...
> > +#if defined(CONFIG_ARCH_OMAP2430)
> > +
> > +static struct omap_globals omap243x_globals = {
> > + .class = OMAP243X_CLASS,
> > + .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
> > + .sdrc = OMAP243X_SDRC_BASE,
> > + .sms = OMAP243X_SMS_BASE,
> > + .ctrl = OMAP243X_CTRL_BASE,
> > + .prm = OMAP2430_PRM_BASE,
> > + .cm = OMAP2430_CM_BASE,
> > + .uart1_phys = OMAP2_UART1_BASE,
> > + .uart2_phys = OMAP2_UART2_BASE,
> > + .uart3_phys = OMAP2_UART3_BASE,
> > +};
> > +
> > +void __init omap2_set_globals_243x(void)
> > +{
> > + __omap2_set_globals(&omap243x_globals);
> > +}
> > +#endif
> > +
> > +#if defined(CONFIG_ARCH_OMAP3)
>
> Do you really need these #ifdefs?
> It would be better to avoid these #ifdefs and use cpu_is* checks.
> Same comment holds good across this patch.
If you think you can do it better, please create a patch for the 2.6.38
time frame. I personally am not interested in changing any of this code
(which was not added by this patch; the patch just splits the existing
code) for the .37 merge window.
> > +static int __init omap_init_clocksource_32k(void)
> > +{
> > + static char err[] __initdata = KERN_ERR
> > + "%s: can't register clocksource!\n";
> > +
> > + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > + struct clk *sync_32k_ick;
> > +
> > + if (cpu_is_omap16xx())
>
> Avoid cpu_is* checks in plat-omap.
OK, I'll bite. Why?
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 5:34 ` Shilimkar, Santosh
@ 2010-10-04 6:56 ` Felipe Balbi
2010-10-04 7:00 ` Felipe Balbi
0 siblings, 1 reply; 43+ messages in thread
From: Felipe Balbi @ 2010-10-04 6:56 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Oct 04, 2010 at 12:34:48AM -0500, Shilimkar, Santosh wrote:
>Felipe,
>
>> -----Original Message-----
>> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
>> owner at vger.kernel.org] On Behalf Of Paul Walmsley
>> Sent: Saturday, October 02, 2010 3:06 AM
>> To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
>> Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
>>
>> Split plat-omap/common.c into three pieces:
>>
>> 1. the 32KiHz sync timer and clocksource code, which now lives in
>> plat-omap/32ksynctimer.c;
>>
>I remember you have converted the 32k sync time code to a platform driver.
>That was also addressing the multi-omap build and was removing all
>the compile time switches.
>Do you plan to rebase it and post it again ?
I still have that sitting on my gitorious tree. The patch is attached
to this mail. I compile tested (only) for omap3_defconfig, it probably
needs to start using pm_runtime functions at some point and probably
move to drivers/clocksource instead of arch/arm/plat-omap.
patch is also available at [1]
[1] git://gitorious.org/usb/usb.git clksource
8<------------------------------- cut here ---------------------------------
From 9aad17796072a2ee88aa11c0431fa99e8e9609f0 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <balbi@ti.com>
Date: Tue, 23 Mar 2010 12:54:14 +0200
Subject: [PATCH] arm: omap1/2/3/4: convert 32k-sync driver to a platform_driver
Organization: Texas Instruments\n
Convert the omap32k clocksource driver into a platform_driver
and while at that, also remove the ifdeferry around the code.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/mach-omap1/devices.c | 24 ++++
arch/arm/mach-omap2/clock2420_data.c | 2 +-
arch/arm/mach-omap2/clock2430_data.c | 2 +-
arch/arm/mach-omap2/clock3xxx_data.c | 2 +-
arch/arm/mach-omap2/devices.c | 35 +++++
arch/arm/plat-omap/Makefile | 4 +-
arch/arm/plat-omap/common.c | 158 ---------------------
arch/arm/plat-omap/counter-32k.c | 251 ++++++++++++++++++++++++++++++++++
8 files changed, 315 insertions(+), 163 deletions(-)
create mode 100644 arch/arm/plat-omap/counter-32k.c
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index aa07256..b276b4b 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -28,6 +28,29 @@
/*-------------------------------------------------------------------------*/
+#define OMAP16XX_TIMER_32K_BASE 0xfffbc400
+
+static struct resource omap_32k_resources[] = {
+ {
+ .start = OMAP16XX_TIMER_32K_BASE,
+ .end = SZ_4K,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device omap_32k_device = {
+ .name = "omap-counter-32k",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(omap_32k_resources),
+ .resource = omap_32k_resources,
+};
+
+static void omap_init_32k(void)
+{
+ if (cpu_is_omap16xx())
+ (void) platform_device_register(&omap_32k_device);
+};
+
#if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
#define OMAP_RTC_BASE 0xfffb4800
@@ -223,6 +246,7 @@ static int __init omap1_init_devices(void)
* in alphabetical order so they're easier to sort through.
*/
+ omap_init_32k();
omap_init_mbox();
omap_init_rtc();
omap_init_spi100k();
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 37d65d6..781bfeb 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1806,7 +1806,7 @@ static struct omap_clk omap2420_clks[] = {
CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_242X),
- CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
+ CLK("omap-counter-32k", "ick", &sync_32k_ick, CK_242X),
CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index b33118f..e997692 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1900,7 +1900,7 @@ static struct omap_clk omap2430_clks[] = {
CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_243X),
- CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
+ CLK("omap-counter-32k", "ick", &sync_32k_ick, CK_243X),
CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
CLK(NULL, "icr_ick", &icr_ick, CK_243X),
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index dfdce2d..257a8fe 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3343,7 +3343,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
- CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
+ CLK("omap-counter-32k", "ick", &omap_32ksync_ick, CK_3XXX),
CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2dbb265..8f1714e 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -31,6 +31,40 @@
#include "mux.h"
+static struct resource omap_32k_resources[] = {
+ {
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device omap_32k_device = {
+ .name = "omap-counter-32k",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(omap_32k_resources),
+ .resource = omap_32k_resources,
+};
+
+static void omap_init_32k(void)
+{
+ if (cpu_is_omap2420()) {
+ omap_32k_resources[0].start = OMAP2420_32KSYNCT_BASE;
+ omap_32k_resources[0].end = OMAP2420_32KSYNCT_BASE + SZ_4K;
+ } else if (cpu_is_omap2430()) {
+ omap_32k_resources[0].start = OMAP2430_32KSYNCT_BASE;
+ omap_32k_resources[0].end = OMAP2430_32KSYNCT_BASE + SZ_4K;
+ } else if (cpu_is_omap34xx()) {
+ omap_32k_resources[0].start = OMAP3430_32KSYNCT_BASE;
+ omap_32k_resources[0].end = OMAP3430_32KSYNCT_BASE + SZ_4K;
+ } else if (cpu_is_omap44xx()) {
+ omap_32k_resources[0].start = OMAP4430_32KSYNCT_BASE;
+ omap_32k_resources[0].end = OMAP4430_32KSYNCT_BASE + SZ_4K;
+ } else { /* not supported */
+ return;
+ }
+
+ (void) platform_device_register(&omap_32k_device);
+};
+
#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
static struct resource cam_resources[] = {
@@ -847,6 +881,7 @@ static int __init omap2_init_devices(void)
* in alphabetical order so they're easier to sort through.
*/
omap_hsmmc_reset();
+ omap_init_32k();
omap_init_camera();
omap_init_mbox();
omap_init_mcspi();
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 9405831..ff57f33 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -4,7 +4,7 @@
# Common support
obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
- usb.o fb.o io.o
+ usb.o fb.o io.o counter-32k.o
obj-m :=
obj-n :=
obj- :=
@@ -31,4 +31,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y)
# OMAP mailbox framework
obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
-obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
\ No newline at end of file
+obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 3008e71..b8683b2 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -89,164 +89,6 @@ void __init omap_reserve(void)
omap_vram_reserve_sdram_memblock();
}
-/*
- * 32KHz clocksource ... always available, on pretty most chips except
- * OMAP 730 and 1510. Other timers could be used as clocksources, with
- * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
- * but systems won't necessarily want to spend resources that way.
- */
-
-#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
-
-#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
-
-#include <linux/clocksource.h>
-
-/*
- * offset_32k holds the init time counter value. It is then subtracted
- * from every counter read to achieve a counter that counts time from the
- * kernel boot (needed for sched_clock()).
- */
-static u32 offset_32k __read_mostly;
-
-#ifdef CONFIG_ARCH_OMAP16XX
-static cycle_t omap16xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
-}
-#else
-#define omap16xx_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2420
-static cycle_t omap2420_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap2420_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2430
-static cycle_t omap2430_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap2430_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static cycle_t omap34xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap34xx_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-static cycle_t omap44xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap44xx_32k_read NULL
-#endif
-
-/*
- * Kernel assumes that sched_clock can be called early but may not have
- * things ready yet.
- */
-static cycle_t omap_32k_read_dummy(struct clocksource *cs)
-{
- return 0;
-}
-
-static struct clocksource clocksource_32k = {
- .name = "32k_counter",
- .rating = 250,
- .read = omap_32k_read_dummy,
- .mask = CLOCKSOURCE_MASK(32),
- .shift = 10,
- .flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-/*
- * Returns current time from boot in nsecs. It's OK for this to wrap
- * around for now, as it's just a relative time stamp.
- */
-unsigned long long sched_clock(void)
-{
- return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
- clocksource_32k.mult, clocksource_32k.shift);
-}
-
-/**
- * read_persistent_clock - Return time from a persistent clock.
- *
- * Reads the time from a source which isn't disabled during PM, the
- * 32k sync timer. Convert the cycles elapsed since last read into
- * nsecs and adds to a monotonically increasing timespec.
- */
-static struct timespec persistent_ts;
-static cycles_t cycles, last_cycles;
-void read_persistent_clock(struct timespec *ts)
-{
- unsigned long long nsecs;
- cycles_t delta;
- struct timespec *tsp = &persistent_ts;
-
- last_cycles = cycles;
- cycles = clocksource_32k.read(&clocksource_32k);
- delta = cycles - last_cycles;
-
- nsecs = clocksource_cyc2ns(delta,
- clocksource_32k.mult, clocksource_32k.shift);
-
- timespec_add_ns(tsp, nsecs);
- *ts = *tsp;
-}
-
-static int __init omap_init_clocksource_32k(void)
-{
- static char err[] __initdata = KERN_ERR
- "%s: can't register clocksource!\n";
-
- if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
- struct clk *sync_32k_ick;
-
- if (cpu_is_omap16xx())
- clocksource_32k.read = omap16xx_32k_read;
- else if (cpu_is_omap2420())
- clocksource_32k.read = omap2420_32k_read;
- else if (cpu_is_omap2430())
- clocksource_32k.read = omap2430_32k_read;
- else if (cpu_is_omap34xx())
- clocksource_32k.read = omap34xx_32k_read;
- else if (cpu_is_omap44xx())
- clocksource_32k.read = omap44xx_32k_read;
- else
- return -ENODEV;
-
- sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
- if (sync_32k_ick)
- clk_enable(sync_32k_ick);
-
- clocksource_32k.mult = clocksource_hz2mult(32768,
- clocksource_32k.shift);
-
- offset_32k = clocksource_32k.read(&clocksource_32k);
-
- if (clocksource_register(&clocksource_32k))
- printk(err, clocksource_32k.name);
- }
- return 0;
-}
-arch_initcall(omap_init_clocksource_32k);
-
-#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
-
/* Global address base setup code */
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
diff --git a/arch/arm/plat-omap/counter-32k.c b/arch/arm/plat-omap/counter-32k.c
new file mode 100644
index 0000000..6b2d0a6
--- /dev/null
+++ b/arch/arm/plat-omap/counter-32k.c
@@ -0,0 +1,251 @@
+/*
+ * counter-32k.c -- OMAP 32k Sync Timer Clocksource Driver
+ *
+ * Copyright (C) 2005-2010 Tony Lindgren <tony@atomide.com>
+ * Copyright (C) 2010 Nokia Corporation
+ * Copyright (C) 2010 Felipe Balbi <me@felipebalbi.com>
+ * Copyright (C) 2009-2010 Texas Instruments
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/time.h>
+#include <linux/clocksource.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+
+struct omap_counter_32k_device {
+ struct timespec persistent_ts;
+ struct clocksource cs;
+ cycles_t cycles;
+ cycles_t last_cycles;
+
+ struct device *dev;
+ struct clk *ick;
+ void __iomem *base;
+
+ /*
+ * offset_32k holds the init time counter value. It is then subtracted
+ * from every counter read to achieve a counter that counts time from the
+ * kernel boot (needed for sched_clock()).
+ */
+ u32 offset_32k __read_mostly;
+};
+
+#define to_omap_32k(cs) (container_of(cs, struct omap_counter_32k_device, cs))
+
+static struct omap_counter_32k_device *thecs;
+
+static inline u32 omap_counter_32k_readl(const void __iomem *base, unsigned offset)
+{
+ return __raw_readl(base + offset);
+}
+
+static cycle_t omap_counter_32k_32k_read(struct clocksource *cs)
+{
+ struct omap_counter_32k_device *omap = to_omap_32k(cs);
+
+ return omap_counter_32k_readl(omap->base, 0x10) - omap->offset_32k;
+}
+
+/*
+ * Returns current time from boot in nsecs. It's OK for this to wrap
+ * around for now, as it's just a relative time stamp.
+ */
+unsigned long long sched_clock(void)
+{
+ struct omap_counter_32k_device *omap = thecs;
+
+ if (!omap)
+ return 0;
+
+ return clocksource_cyc2ns(omap->cs.read(&omap->cs),
+ omap->cs.mult, omap->cs.shift);
+}
+
+/**
+ * read_persistent_clock - Return time from a persistent clock.
+ *
+ * Reads the time from a source which isn't disabled during PM, the
+ * 32k sync timer. Convert the cycles elapsed since last read into
+ * nsecs and adds to a monotonically increasing timespec.
+ */
+void read_persistent_clock(struct timespec *ts)
+{
+ struct omap_counter_32k_device *omap = thecs;
+ unsigned long long nsecs;
+ cycles_t delta;
+ struct timespec *tsp;
+
+ if (!omap) {
+ ts->tv_sec = 0;
+ ts->tv_nsec = 0;
+ return;
+ }
+
+ tsp = &omap->persistent_ts;
+
+ omap->last_cycles = omap->cycles;
+ omap->cycles = omap->cs.read(&omap->cs);
+ delta = omap->cycles - omap->last_cycles;
+
+ nsecs = clocksource_cyc2ns(delta,
+ omap->cs.mult, omap->cs.shift);
+
+ timespec_add_ns(tsp, nsecs);
+ *ts = *tsp;
+}
+
+static int __init omap_counter_32k_probe(struct platform_device *pdev)
+{
+ struct omap_counter_32k_device *omap;
+ struct resource *res;
+ struct clk *ick;
+
+ int ret;
+
+ void __iomem *base;
+
+ omap = kzalloc(sizeof(*omap), GFP_KERNEL);
+ if (!omap) {
+ dev_dbg(&pdev->dev, "unable to allocate memory\n");
+ ret = -ENOMEM;
+ goto err0;
+ }
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_dbg(&pdev->dev, "couldn't get resource\n");
+ ret = -ENODEV;
+ goto err1;
+ }
+
+ base = ioremap(res->start, resource_size(res));
+ if (!base) {
+ dev_dbg(&pdev->dev, "ioremap failed\n");
+ ret = -ENOMEM;
+ goto err2;
+ }
+
+ ick = clk_get(&pdev->dev, "ick");
+ if (IS_ERR(ick)) {
+ dev_dbg(&pdev->dev, "couldn't get clock\n");
+ ret = PTR_ERR(ick);
+ goto err3;
+ }
+
+ ret = clk_enable(ick);
+ if (ret) {
+ dev_dbg(&pdev->dev, "couldn't enable clock\n");
+ goto err4;
+ }
+
+ omap->base = base;
+ omap->dev = &pdev->dev;
+ omap->ick = ick;
+
+ omap->cs.name = "counter-32k";
+ omap->cs.rating = 250;
+ omap->cs.read = omap_counter_32k_32k_read;
+ omap->cs.mask = CLOCKSOURCE_MASK(32);
+ omap->cs.shift = 10;
+ omap->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS;
+ omap->cs.mult = clocksource_hz2mult(32768, omap->cs.shift);
+
+ platform_set_drvdata(pdev, omap);
+
+ ret = clocksource_register(&omap->cs);
+ if (ret) {
+ dev_dbg(&pdev->dev, "failed to register clocksource\n");
+ goto err5;
+ }
+
+ /* initialize our offset */
+ omap->offset_32k = omap_counter_32k_32k_read(&omap->cs);
+
+ /*
+ * REVISIT for now we need to keep a global static pointer
+ * to this clocksource instance. Would it make any sense
+ * to provide a get_clocksource() to fetch the clocksource
+ * we just registered ?
+ */
+ thecs = omap;
+
+ return 0;
+
+err5:
+ clk_disable(ick);
+
+err4:
+ clk_put(ick);
+
+err3:
+ iounmap(base);
+
+err2:
+err1:
+ kfree(omap);
+
+err0:
+ return ret;
+}
+
+static int __exit omap_counter_32k_remove(struct platform_device *pdev)
+{
+ struct omap_counter_32k_device *omap = platform_get_drvdata(pdev);
+
+ clocksource_unregister(&omap->cs);
+ clk_disable(omap->ick);
+ clk_put(omap->ick);
+ iounmap(omap->base);
+ kfree(omap);
+ platform_set_drvdata(pdev, NULL);
+
+ return 0;
+}
+
+static void omap_counter_32k_shutdown(struct platform_device *pdev)
+{
+ struct omap_counter_32k_device *omap = platform_get_drvdata(pdev);
+
+ clk_disable(omap->ick);
+}
+
+static struct platform_driver omap_counter_32k_driver = {
+ .remove = __exit_p(omap_counter_32k_remove),
+ .shutdown = omap_counter_32k_shutdown,
+ .driver = {
+ .name = "omap-counter-32k",
+ },
+};
+
+static int __init omap_counter_32k_init(void)
+{
+ return platform_driver_probe(&omap_counter_32k_driver, omap_counter_32k_probe);
+}
+arch_initcall(omap_counter_32k_init);
+
+static void __exit omap_counter_32k_exit(void)
+{
+ platform_driver_unregister(&omap_counter_32k_driver);
+}
+module_exit(omap_counter_32k_exit);
+
+MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
+MODULE_LICENSE("GPL v2");
--
1.7.3.rc0.35.g8ac8c
--
balbi
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 6:56 ` Felipe Balbi
@ 2010-10-04 7:00 ` Felipe Balbi
2010-10-04 7:28 ` Shilimkar, Santosh
0 siblings, 1 reply; 43+ messages in thread
From: Felipe Balbi @ 2010-10-04 7:00 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
>On Mon, Oct 04, 2010 at 12:34:48AM -0500, Shilimkar, Santosh wrote:
>>Felipe,
>>
>>> -----Original Message-----
>>> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
>>> owner at vger.kernel.org] On Behalf Of Paul Walmsley
>>> Sent: Saturday, October 02, 2010 3:06 AM
>>> To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
>>> Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
>>>
>>> Split plat-omap/common.c into three pieces:
>>>
>>> 1. the 32KiHz sync timer and clocksource code, which now lives in
>>> plat-omap/32ksynctimer.c;
>>>
>>I remember you have converted the 32k sync time code to a platform driver.
>>That was also addressing the multi-omap build and was removing all
>>the compile time switches.
>>Do you plan to rebase it and post it again ?
>
>I still have that sitting on my gitorious tree. The patch is attached
>to this mail. I compile tested (only) for omap3_defconfig, it probably
>needs to start using pm_runtime functions at some point and probably
>move to drivers/clocksource instead of arch/arm/plat-omap.
>
>patch is also available at [1]
>
>[1] git://gitorious.org/usb/usb.git clksource
I made a few changes to make checkpatch.pl --strict happy. Attached
--
balbi
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 7:00 ` Felipe Balbi
@ 2010-10-04 7:28 ` Shilimkar, Santosh
2010-10-04 18:21 ` Tony Lindgren
2010-10-04 19:32 ` Paul Walmsley
0 siblings, 2 replies; 43+ messages in thread
From: Shilimkar, Santosh @ 2010-10-04 7:28 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: Balbi, Felipe
> Sent: Monday, October 04, 2010 12:31 PM
> To: Balbi, Felipe
> Cc: Shilimkar, Santosh; Paul Walmsley; linux-omap at vger.kernel.org; linux-
> arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 08/10] OMAP: split plat-omap/common.c
>
> On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
> >On Mon, Oct 04, 2010 at 12:34:48AM -0500, Shilimkar, Santosh wrote:
> >>Felipe,
> >>
> >>> -----Original Message-----
> >>> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
> >>> owner at vger.kernel.org] On Behalf Of Paul Walmsley
> >>> Sent: Saturday, October 02, 2010 3:06 AM
> >>> To: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> >>> Subject: [PATCH 08/10] OMAP: split plat-omap/common.c
> >>>
> >>> Split plat-omap/common.c into three pieces:
> >>>
> >>> 1. the 32KiHz sync timer and clocksource code, which now lives in
> >>> plat-omap/32ksynctimer.c;
> >>>
> >>I remember you have converted the 32k sync time code to a platform
> driver.
> >>That was also addressing the multi-omap build and was removing all
> >>the compile time switches.
> >>Do you plan to rebase it and post it again ?
> >
> >I still have that sitting on my gitorious tree. The patch is attached
> >to this mail. I compile tested (only) for omap3_defconfig, it probably
> >needs to start using pm_runtime functions at some point and probably
> >move to drivers/clocksource instead of arch/arm/plat-omap.
> >
> >patch is also available at [1]
> >
> >[1] git://gitorious.org/usb/usb.git clksource
>
> I made a few changes to make checkpatch.pl --strict happy. Attached
>
Good !!
This patch addresses splitting as well as multi-omap builds and probably
also a better candidate in case we need to convert sync timer to hwmod
driver.
Paul, what's your take?
Regards,
Santosh
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 6:03 ` Paul Walmsley
@ 2010-10-04 8:28 ` Varadarajan, Charulatha
2010-10-04 18:27 ` Tony Lindgren
0 siblings, 1 reply; 43+ messages in thread
From: Varadarajan, Charulatha @ 2010-10-04 8:28 UTC (permalink / raw)
To: linux-arm-kernel
Paul,
<<snip>>
>
> > > +static int __init omap_init_clocksource_32k(void)
> > > +{
> > > + static char err[] __initdata = KERN_ERR
> > > + "%s: can't register clocksource!\n";
> > > +
> > > + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > > + struct clk *sync_32k_ick;
> > > +
> > > + if (cpu_is_omap16xx())
> >
> > Avoid cpu_is* checks in plat-omap.
>
> OK, I'll bite. Why?
I think this is being looked for all the new code introduced
in plat-omap layer for the following reasons:
Adding cpu-is-* checks makes code unmaintainable going fwd.
plat-omap layer needs to handle common code for all omap platforms.
This was raised for GPIO driver because of which, there was a
requirement to clean-up the gpio driver.
Is this stand changed? Are cpu_is* checks allowed in plat-omap?
> > > + clocksource_32k.read = omap16xx_32k_read;
> > > + else if (cpu_is_omap2420())
> > > + clocksource_32k.read = omap2420_32k_read;
> > > + else if (cpu_is_omap2430())
> > > + clocksource_32k.read = omap2430_32k_read;
> > > + else if (cpu_is_omap34xx())
> > > + clocksource_32k.read = omap34xx_32k_read;
> > > + else if (cpu_is_omap44xx())
> > > + clocksource_32k.read = omap44xx_32k_read;
> > > + else
> > > + return -ENODEV;
> > > +
> > > + sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> > > + if (sync_32k_ick)
> > > + clk_enable(sync_32k_ick);
> > > +
> > > + clocksource_32k.mult = clocksource_hz2mult(32768,
> > > + clocksource_32k.shift);
> > > +
> > > + offset_32k = clocksource_32k.read(&clocksource_32k);
> > > +
> > > + if (clocksource_register(&clocksource_32k))
> > > + printk(err, clocksource_32k.name);
> > > + }
> > > + return 0;
> > > +}
> > > +arch_initcall(omap_init_clocksource_32k);
> > > +
-V Charulatha
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-01 21:35 ` [PATCH 08/10] OMAP: split plat-omap/common.c Paul Walmsley
2010-10-04 5:34 ` Shilimkar, Santosh
2010-10-04 5:38 ` Varadarajan, Charulatha
@ 2010-10-04 9:08 ` Cousson, Benoit
2010-10-04 9:35 ` DebBarma, Tarun Kanti
2010-10-04 19:15 ` Paul Walmsley
2 siblings, 2 replies; 43+ messages in thread
From: Cousson, Benoit @ 2010-10-04 9:08 UTC (permalink / raw)
To: linux-arm-kernel
Hi Paul,
On 10/1/2010 11:35 PM, Paul Walmsley wrote:
> Split plat-omap/common.c into three pieces:
>
> 1. the 32KiHz sync timer and clocksource code, which now lives in
> plat-omap/32ksynctimer.c;
>
> 2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
>
> 3. and the remainder of the OMAP-wide common code, which includes the
> deprecated ATAGs code and a deprecated video RAM reservation function.
>
> The primary motivation for doing this is to move the OMAP2+-specific parts
> into an OMAP2+-specific file, so that build breakage related to the
> System Control Module code can be resolved.
>
> Signed-off-by: Paul Walmsley<paul@pwsan.com>
> ---
<...>
> diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-omap/32ksynctimer.c
> new file mode 100644
> index 0000000..b7f458c
> --- /dev/null
> +++ b/arch/arm/plat-omap/32ksynctimer.c
> @@ -0,0 +1,184 @@
> +/*
> + * linux/arch/arm/plat-omap/clocksource.c
What name do you want to use? 32ksynctimer.c or clocksource.c?
If this file is dedicated for the 32k sync timer, maybe we should now
use the new OMAP4 name: "counter_32k".
Noboby knows what the sync stand for, and at the end this is just a 32k
counter. Hence the new name :-)
Benoit
> + *
> + * OMAP clocksource-related code
> + *
> + * Copyright (C) 2009 Texas Instruments
> + * Copyright (C) 2010 Nokia Corporation
> + * Tony Lindgren<tony@atomide.com>
> + * Added OMAP4 support - Santosh Shilimkar<santosh.shilimkar@ti.com>
> + * Paul Walmsley
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include<linux/kernel.h>
> +#include<linux/init.h>
> +#include<linux/clk.h>
> +#include<linux/io.h>
> +
> +#include<plat/common.h>
> +#include<plat/board.h>
> +
> +#include<plat/clock.h>
> +
> +
> +/*
> + * 32KHz clocksource ... always available, on pretty most chips except
> + * OMAP 730 and 1510. Other timers could be used as clocksources, with
> + * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
> + * but systems won't necessarily want to spend resources that way.
> + */
> +
> +#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
> +
> +#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
> +
> +#include<linux/clocksource.h>
> +
> +/*
> + * offset_32k holds the init time counter value. It is then subtracted
> + * from every counter read to achieve a counter that counts time from the
> + * kernel boot (needed for sched_clock()).
> + */
> +static u32 offset_32k __read_mostly;
> +
> +#ifdef CONFIG_ARCH_OMAP16XX
> +static cycle_t omap16xx_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
> +}
> +#else
> +#define omap16xx_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP2420
> +static cycle_t omap2420_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap2420_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP2430
> +static cycle_t omap2430_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap2430_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP3
> +static cycle_t omap34xx_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap34xx_32k_read NULL
> +#endif
> +
> +#ifdef CONFIG_ARCH_OMAP4
> +static cycle_t omap44xx_32k_read(struct clocksource *cs)
> +{
> + return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
> +}
> +#else
> +#define omap44xx_32k_read NULL
> +#endif
> +
> +/*
> + * Kernel assumes that sched_clock can be called early but may not have
> + * things ready yet.
> + */
> +static cycle_t omap_32k_read_dummy(struct clocksource *cs)
> +{
> + return 0;
> +}
> +
> +static struct clocksource clocksource_32k = {
> + .name = "32k_counter",
> + .rating = 250,
> + .read = omap_32k_read_dummy,
> + .mask = CLOCKSOURCE_MASK(32),
> + .shift = 10,
> + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> +};
> +
> +/*
> + * Returns current time from boot in nsecs. It's OK for this to wrap
> + * around for now, as it's just a relative time stamp.
> + */
> +unsigned long long sched_clock(void)
> +{
> + return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
> + clocksource_32k.mult, clocksource_32k.shift);
> +}
> +
> +/**
> + * read_persistent_clock - Return time from a persistent clock.
> + *
> + * Reads the time from a source which isn't disabled during PM, the
> + * 32k sync timer. Convert the cycles elapsed since last read into
> + * nsecs and adds to a monotonically increasing timespec.
> + */
> +static struct timespec persistent_ts;
> +static cycles_t cycles, last_cycles;
> +void read_persistent_clock(struct timespec *ts)
> +{
> + unsigned long long nsecs;
> + cycles_t delta;
> + struct timespec *tsp =&persistent_ts;
> +
> + last_cycles = cycles;
> + cycles = clocksource_32k.read(&clocksource_32k);
> + delta = cycles - last_cycles;
> +
> + nsecs = clocksource_cyc2ns(delta,
> + clocksource_32k.mult, clocksource_32k.shift);
> +
> + timespec_add_ns(tsp, nsecs);
> + *ts = *tsp;
> +}
> +
> +static int __init omap_init_clocksource_32k(void)
> +{
> + static char err[] __initdata = KERN_ERR
> + "%s: can't register clocksource!\n";
> +
> + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> + struct clk *sync_32k_ick;
> +
> + if (cpu_is_omap16xx())
> + clocksource_32k.read = omap16xx_32k_read;
> + else if (cpu_is_omap2420())
> + clocksource_32k.read = omap2420_32k_read;
> + else if (cpu_is_omap2430())
> + clocksource_32k.read = omap2430_32k_read;
> + else if (cpu_is_omap34xx())
> + clocksource_32k.read = omap34xx_32k_read;
> + else if (cpu_is_omap44xx())
> + clocksource_32k.read = omap44xx_32k_read;
> + else
> + return -ENODEV;
> +
> + sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> + if (sync_32k_ick)
> + clk_enable(sync_32k_ick);
> +
> + clocksource_32k.mult = clocksource_hz2mult(32768,
> + clocksource_32k.shift);
> +
> + offset_32k = clocksource_32k.read(&clocksource_32k);
> +
> + if (clocksource_register(&clocksource_32k))
> + printk(err, clocksource_32k.name);
> + }
> + return 0;
> +}
> +arch_initcall(omap_init_clocksource_32k);
> +
> +#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
> +
> diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
> index 2a15191..32a5959 100644
> --- a/arch/arm/plat-omap/Makefile
> +++ b/arch/arm/plat-omap/Makefile
> @@ -4,7 +4,7 @@
>
> # Common support
> obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
> - usb.o fb.o io.o
> + usb.o fb.o io.o 32ksynctimer.o
> obj-m :=
> obj-n :=
> obj- :=
> diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
> index 9200ea7..221a675 100644
> --- a/arch/arm/plat-omap/common.c
> +++ b/arch/arm/plat-omap/common.c
> @@ -11,38 +11,15 @@
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation.
> */
> -#include<linux/module.h>
> #include<linux/kernel.h>
> #include<linux/init.h>
> -#include<linux/delay.h>
> -#include<linux/console.h>
> -#include<linux/serial.h>
> -#include<linux/tty.h>
> -#include<linux/serial_8250.h>
> -#include<linux/serial_reg.h>
> -#include<linux/clk.h>
> #include<linux/io.h>
> #include<linux/omapfb.h>
>
> -#include<mach/hardware.h>
> -#include<asm/system.h>
> -#include<asm/pgtable.h>
> -#include<asm/mach/map.h>
> -#include<asm/setup.h>
> -
> #include<plat/common.h>
> #include<plat/board.h>
> -#include<plat/control.h>
> -#include<plat/mux.h>
> -#include<plat/fpga.h>
> -#include<plat/serial.h>
> #include<plat/vram.h>
>
> -#include<plat/clock.h>
> -
> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> -# include "../mach-omap2/sdrc.h"
> -#endif
>
> #define NO_LENGTH_CHECK 0xffffffff
>
> @@ -88,271 +65,3 @@ void __init omap_reserve(void)
> omapfb_reserve_sdram_memblock();
> omap_vram_reserve_sdram_memblock();
> }
> -
> -/*
> - * 32KHz clocksource ... always available, on pretty most chips except
> - * OMAP 730 and 1510. Other timers could be used as clocksources, with
> - * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
> - * but systems won't necessarily want to spend resources that way.
> - */
> -
> -#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
> -
> -#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
> -
> -#include<linux/clocksource.h>
> -
> -/*
> - * offset_32k holds the init time counter value. It is then subtracted
> - * from every counter read to achieve a counter that counts time from the
> - * kernel boot (needed for sched_clock()).
> - */
> -static u32 offset_32k __read_mostly;
> -
> -#ifdef CONFIG_ARCH_OMAP16XX
> -static cycle_t omap16xx_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
> -}
> -#else
> -#define omap16xx_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP2420
> -static cycle_t omap2420_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap2420_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP2430
> -static cycle_t omap2430_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap2430_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP3
> -static cycle_t omap34xx_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap34xx_32k_read NULL
> -#endif
> -
> -#ifdef CONFIG_ARCH_OMAP4
> -static cycle_t omap44xx_32k_read(struct clocksource *cs)
> -{
> - return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
> -}
> -#else
> -#define omap44xx_32k_read NULL
> -#endif
> -
> -/*
> - * Kernel assumes that sched_clock can be called early but may not have
> - * things ready yet.
> - */
> -static cycle_t omap_32k_read_dummy(struct clocksource *cs)
> -{
> - return 0;
> -}
> -
> -static struct clocksource clocksource_32k = {
> - .name = "32k_counter",
> - .rating = 250,
> - .read = omap_32k_read_dummy,
> - .mask = CLOCKSOURCE_MASK(32),
> - .shift = 10,
> - .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> -};
> -
> -/*
> - * Returns current time from boot in nsecs. It's OK for this to wrap
> - * around for now, as it's just a relative time stamp.
> - */
> -unsigned long long sched_clock(void)
> -{
> - return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
> - clocksource_32k.mult, clocksource_32k.shift);
> -}
> -
> -/**
> - * read_persistent_clock - Return time from a persistent clock.
> - *
> - * Reads the time from a source which isn't disabled during PM, the
> - * 32k sync timer. Convert the cycles elapsed since last read into
> - * nsecs and adds to a monotonically increasing timespec.
> - */
> -static struct timespec persistent_ts;
> -static cycles_t cycles, last_cycles;
> -void read_persistent_clock(struct timespec *ts)
> -{
> - unsigned long long nsecs;
> - cycles_t delta;
> - struct timespec *tsp =&persistent_ts;
> -
> - last_cycles = cycles;
> - cycles = clocksource_32k.read(&clocksource_32k);
> - delta = cycles - last_cycles;
> -
> - nsecs = clocksource_cyc2ns(delta,
> - clocksource_32k.mult, clocksource_32k.shift);
> -
> - timespec_add_ns(tsp, nsecs);
> - *ts = *tsp;
> -}
> -
> -static int __init omap_init_clocksource_32k(void)
> -{
> - static char err[] __initdata = KERN_ERR
> - "%s: can't register clocksource!\n";
> -
> - if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> - struct clk *sync_32k_ick;
> -
> - if (cpu_is_omap16xx())
> - clocksource_32k.read = omap16xx_32k_read;
> - else if (cpu_is_omap2420())
> - clocksource_32k.read = omap2420_32k_read;
> - else if (cpu_is_omap2430())
> - clocksource_32k.read = omap2430_32k_read;
> - else if (cpu_is_omap34xx())
> - clocksource_32k.read = omap34xx_32k_read;
> - else if (cpu_is_omap44xx())
> - clocksource_32k.read = omap44xx_32k_read;
> - else
> - return -ENODEV;
> -
> - sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> - if (sync_32k_ick)
> - clk_enable(sync_32k_ick);
> -
> - clocksource_32k.mult = clocksource_hz2mult(32768,
> - clocksource_32k.shift);
> -
> - offset_32k = clocksource_32k.read(&clocksource_32k);
> -
> - if (clocksource_register(&clocksource_32k))
> - printk(err, clocksource_32k.name);
> - }
> - return 0;
> -}
> -arch_initcall(omap_init_clocksource_32k);
> -
> -#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
> -
> -/* 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);
> - omap2_set_globals_sdrc(omap2_globals);
> - omap2_set_globals_control(omap2_globals);
> - omap2_set_globals_prcm(omap2_globals);
> - omap2_set_globals_uart(omap2_globals);
> -}
> -
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP2420)
> -
> -static struct omap_globals omap242x_globals = {
> - .class = OMAP242X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
> - .sdrc = OMAP2420_SDRC_BASE,
> - .sms = OMAP2420_SMS_BASE,
> - .ctrl = OMAP242X_CTRL_BASE,
> - .prm = OMAP2420_PRM_BASE,
> - .cm = OMAP2420_CM_BASE,
> - .uart1_phys = OMAP2_UART1_BASE,
> - .uart2_phys = OMAP2_UART2_BASE,
> - .uart3_phys = OMAP2_UART3_BASE,
> -};
> -
> -void __init omap2_set_globals_242x(void)
> -{
> - __omap2_set_globals(&omap242x_globals);
> -}
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP2430)
> -
> -static struct omap_globals omap243x_globals = {
> - .class = OMAP243X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
> - .sdrc = OMAP243X_SDRC_BASE,
> - .sms = OMAP243X_SMS_BASE,
> - .ctrl = OMAP243X_CTRL_BASE,
> - .prm = OMAP2430_PRM_BASE,
> - .cm = OMAP2430_CM_BASE,
> - .uart1_phys = OMAP2_UART1_BASE,
> - .uart2_phys = OMAP2_UART2_BASE,
> - .uart3_phys = OMAP2_UART3_BASE,
> -};
> -
> -void __init omap2_set_globals_243x(void)
> -{
> - __omap2_set_globals(&omap243x_globals);
> -}
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP3)
> -
> -static struct omap_globals omap3_globals = {
> - .class = OMAP343X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
> - .sdrc = OMAP343X_SDRC_BASE,
> - .sms = OMAP343X_SMS_BASE,
> - .ctrl = OMAP343X_CTRL_BASE,
> - .prm = OMAP3430_PRM_BASE,
> - .cm = OMAP3430_CM_BASE,
> - .uart1_phys = OMAP3_UART1_BASE,
> - .uart2_phys = OMAP3_UART2_BASE,
> - .uart3_phys = OMAP3_UART3_BASE,
> - .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
> -};
> -
> -void __init omap2_set_globals_3xxx(void)
> -{
> - __omap2_set_globals(&omap3_globals);
> -}
> -
> -void __init omap3_map_io(void)
> -{
> - omap2_set_globals_3xxx();
> - omap34xx_map_common_io();
> -}
> -#endif
> -
> -#if defined(CONFIG_ARCH_OMAP4)
> -static struct omap_globals omap4_globals = {
> - .class = OMAP443X_CLASS,
> - .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
> - .ctrl = OMAP443X_SCM_BASE,
> - .ctrl_pad = OMAP443X_CTRL_BASE,
> - .prm = OMAP4430_PRM_BASE,
> - .cm = OMAP4430_CM_BASE,
> - .cm2 = OMAP4430_CM2_BASE,
> - .uart1_phys = OMAP4_UART1_BASE,
> - .uart2_phys = OMAP4_UART2_BASE,
> - .uart3_phys = OMAP4_UART3_BASE,
> - .uart4_phys = OMAP4_UART4_BASE,
> -};
> -
> -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_uart(&omap4_globals);
> -}
> -#endif
> -
> diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
> index d1920be..78162a0 100644
> --- a/arch/arm/plat-omap/devices.c
> +++ b/arch/arm/plat-omap/devices.c
> @@ -21,7 +21,6 @@
> #include<asm/mach/map.h>
>
> #include<plat/tc.h>
> -#include<plat/control.h>
> #include<plat/board.h>
> #include<plat/mmc.h>
> #include<mach/gpio.h>
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 33ee6b8..d971aeb 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -30,8 +30,6 @@
> #include<plat/cpu.h>
> #include<plat/vram.h>
>
> -#include<plat/control.h>
> -
> #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> # include "../mach-omap2/prm.h"
> # include "../mach-omap2/cm.h"
> @@ -68,7 +66,6 @@
> #define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
> #define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
> #define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
> -#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
>
> #define GP_DEVICE 0x300
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 9:08 ` Cousson, Benoit
@ 2010-10-04 9:35 ` DebBarma, Tarun Kanti
2010-10-04 9:54 ` Cousson, Benoit
2010-10-04 19:15 ` Paul Walmsley
1 sibling, 1 reply; 43+ messages in thread
From: DebBarma, Tarun Kanti @ 2010-10-04 9:35 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
> owner at vger.kernel.org] On Behalf Of Cousson, Benoit
> Sent: Monday, October 04, 2010 2:39 PM
> To: Paul Walmsley
> Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH 08/10] OMAP: split plat-omap/common.c
>
> Hi Paul,
>
> On 10/1/2010 11:35 PM, Paul Walmsley wrote:
> > Split plat-omap/common.c into three pieces:
> >
> > 1. the 32KiHz sync timer and clocksource code, which now lives in
> > plat-omap/32ksynctimer.c;
> >
> > 2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
> >
> > 3. and the remainder of the OMAP-wide common code, which includes the
> > deprecated ATAGs code and a deprecated video RAM reservation
> function.
> >
> > The primary motivation for doing this is to move the OMAP2+-specific
> parts
> > into an OMAP2+-specific file, so that build breakage related to the
> > System Control Module code can be resolved.
> >
> > Signed-off-by: Paul Walmsley<paul@pwsan.com>
> > ---
>
> <...>
>
> > diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-
> omap/32ksynctimer.c
> > new file mode 100644
> > index 0000000..b7f458c
> > --- /dev/null
> > +++ b/arch/arm/plat-omap/32ksynctimer.c
> > @@ -0,0 +1,184 @@
> > +/*
> > + * linux/arch/arm/plat-omap/clocksource.c
>
> What name do you want to use? 32ksynctimer.c or clocksource.c?
>
> If this file is dedicated for the 32k sync timer, maybe we should now
> use the new OMAP4 name: "counter_32k".
>
> Noboby knows what the sync stand for, and at the end this is just a 32k
> counter. Hence the new name :-)
One of the points to be kept in mind while naming is that we are able to relate our driver easily to the hardware device. In this regard the TRM terms this module as 32-kHz Synchronized Timer. Therefore we should be careful in our naming. With regard to the meaning of the word here is the extract from the TRM.
OMAP4430 ES2.0 TRM
...
The sync logic ensures the read transaction correctness by synchronizing the counter register read access on 32KSYNCNT_ICLK because the 32KSYNCNT_ICLK clock signal is completely asynchronous with S32KSYNCNT_FCLK.
...
>
> Benoit
>
> > + *
> > + * OMAP clocksource-related code
> > + *
> > + * Copyright (C) 2009 Texas Instruments
> > + * Copyright (C) 2010 Nokia Corporation
> > + * Tony Lindgren<tony@atomide.com>
> > + * Added OMAP4 support - Santosh Shilimkar<santosh.shilimkar@ti.com>
> > + * Paul Walmsley
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +#include<linux/kernel.h>
> > +#include<linux/init.h>
> > +#include<linux/clk.h>
> > +#include<linux/io.h>
> > +
> > +#include<plat/common.h>
> > +#include<plat/board.h>
> > +
> > +#include<plat/clock.h>
> > +
> > +
> > +/*
> > + * 32KHz clocksource ... always available, on pretty most chips except
> > + * OMAP 730 and 1510. Other timers could be used as clocksources, with
> > + * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
> > + * but systems won't necessarily want to spend resources that way.
> > + */
> > +
> > +#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
> > +
> > +#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
> > +
> > +#include<linux/clocksource.h>
> > +
> > +/*
> > + * offset_32k holds the init time counter value. It is then subtracted
> > + * from every counter read to achieve a counter that counts time from
> the
> > + * kernel boot (needed for sched_clock()).
> > + */
> > +static u32 offset_32k __read_mostly;
> > +
> > +#ifdef CONFIG_ARCH_OMAP16XX
> > +static cycle_t omap16xx_32k_read(struct clocksource *cs)
> > +{
> > + return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
> > +}
> > +#else
> > +#define omap16xx_32k_read NULL
> > +#endif
> > +
> > +#ifdef CONFIG_ARCH_OMAP2420
> > +static cycle_t omap2420_32k_read(struct clocksource *cs)
> > +{
> > + return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
> > +}
> > +#else
> > +#define omap2420_32k_read NULL
> > +#endif
> > +
> > +#ifdef CONFIG_ARCH_OMAP2430
> > +static cycle_t omap2430_32k_read(struct clocksource *cs)
> > +{
> > + return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
> > +}
> > +#else
> > +#define omap2430_32k_read NULL
> > +#endif
> > +
> > +#ifdef CONFIG_ARCH_OMAP3
> > +static cycle_t omap34xx_32k_read(struct clocksource *cs)
> > +{
> > + return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
> > +}
> > +#else
> > +#define omap34xx_32k_read NULL
> > +#endif
> > +
> > +#ifdef CONFIG_ARCH_OMAP4
> > +static cycle_t omap44xx_32k_read(struct clocksource *cs)
> > +{
> > + return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
> > +}
> > +#else
> > +#define omap44xx_32k_read NULL
> > +#endif
> > +
> > +/*
> > + * Kernel assumes that sched_clock can be called early but may not have
> > + * things ready yet.
> > + */
> > +static cycle_t omap_32k_read_dummy(struct clocksource *cs)
> > +{
> > + return 0;
> > +}
> > +
> > +static struct clocksource clocksource_32k = {
> > + .name = "32k_counter",
> > + .rating = 250,
> > + .read = omap_32k_read_dummy,
> > + .mask = CLOCKSOURCE_MASK(32),
> > + .shift = 10,
> > + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> > +};
> > +
> > +/*
> > + * Returns current time from boot in nsecs. It's OK for this to wrap
> > + * around for now, as it's just a relative time stamp.
> > + */
> > +unsigned long long sched_clock(void)
> > +{
> > + return
> clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
> > + clocksource_32k.mult,
> clocksource_32k.shift);
> > +}
> > +
> > +/**
> > + * read_persistent_clock - Return time from a persistent clock.
> > + *
> > + * Reads the time from a source which isn't disabled during PM, the
> > + * 32k sync timer. Convert the cycles elapsed since last read into
> > + * nsecs and adds to a monotonically increasing timespec.
> > + */
> > +static struct timespec persistent_ts;
> > +static cycles_t cycles, last_cycles;
> > +void read_persistent_clock(struct timespec *ts)
> > +{
> > + unsigned long long nsecs;
> > + cycles_t delta;
> > + struct timespec *tsp =&persistent_ts;
> > +
> > + last_cycles = cycles;
> > + cycles = clocksource_32k.read(&clocksource_32k);
> > + delta = cycles - last_cycles;
> > +
> > + nsecs = clocksource_cyc2ns(delta,
> > + clocksource_32k.mult,
> clocksource_32k.shift);
> > +
> > + timespec_add_ns(tsp, nsecs);
> > + *ts = *tsp;
> > +}
> > +
> > +static int __init omap_init_clocksource_32k(void)
> > +{
> > + static char err[] __initdata = KERN_ERR
> > + "%s: can't register clocksource!\n";
> > +
> > + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > + struct clk *sync_32k_ick;
> > +
> > + if (cpu_is_omap16xx())
> > + clocksource_32k.read = omap16xx_32k_read;
> > + else if (cpu_is_omap2420())
> > + clocksource_32k.read = omap2420_32k_read;
> > + else if (cpu_is_omap2430())
> > + clocksource_32k.read = omap2430_32k_read;
> > + else if (cpu_is_omap34xx())
> > + clocksource_32k.read = omap34xx_32k_read;
> > + else if (cpu_is_omap44xx())
> > + clocksource_32k.read = omap44xx_32k_read;
> > + else
> > + return -ENODEV;
> > +
> > + sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> > + if (sync_32k_ick)
> > + clk_enable(sync_32k_ick);
> > +
> > + clocksource_32k.mult = clocksource_hz2mult(32768,
> > + clocksource_32k.shift);
> > +
> > + offset_32k = clocksource_32k.read(&clocksource_32k);
> > +
> > + if (clocksource_register(&clocksource_32k))
> > + printk(err, clocksource_32k.name);
> > + }
> > + return 0;
> > +}
> > +arch_initcall(omap_init_clocksource_32k);
> > +
> > +#endif /* !(defined(CONFIG_ARCH_OMAP730) ||
> defined(CONFIG_ARCH_OMAP15XX)) */
> > +
> > diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
> > index 2a15191..32a5959 100644
> > --- a/arch/arm/plat-omap/Makefile
> > +++ b/arch/arm/plat-omap/Makefile
> > @@ -4,7 +4,7 @@
> >
> > # Common support
> > obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
> > - usb.o fb.o io.o
> > + usb.o fb.o io.o 32ksynctimer.o
> > obj-m :=
> > obj-n :=
> > obj- :=
> > diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
> > index 9200ea7..221a675 100644
> > --- a/arch/arm/plat-omap/common.c
> > +++ b/arch/arm/plat-omap/common.c
> > @@ -11,38 +11,15 @@
> > * it under the terms of the GNU General Public License version 2 as
> > * published by the Free Software Foundation.
> > */
> > -#include<linux/module.h>
> > #include<linux/kernel.h>
> > #include<linux/init.h>
> > -#include<linux/delay.h>
> > -#include<linux/console.h>
> > -#include<linux/serial.h>
> > -#include<linux/tty.h>
> > -#include<linux/serial_8250.h>
> > -#include<linux/serial_reg.h>
> > -#include<linux/clk.h>
> > #include<linux/io.h>
> > #include<linux/omapfb.h>
> >
> > -#include<mach/hardware.h>
> > -#include<asm/system.h>
> > -#include<asm/pgtable.h>
> > -#include<asm/mach/map.h>
> > -#include<asm/setup.h>
> > -
> > #include<plat/common.h>
> > #include<plat/board.h>
> > -#include<plat/control.h>
> > -#include<plat/mux.h>
> > -#include<plat/fpga.h>
> > -#include<plat/serial.h>
> > #include<plat/vram.h>
> >
> > -#include<plat/clock.h>
> > -
> > -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> > -# include "../mach-omap2/sdrc.h"
> > -#endif
> >
> > #define NO_LENGTH_CHECK 0xffffffff
> >
> > @@ -88,271 +65,3 @@ void __init omap_reserve(void)
> > omapfb_reserve_sdram_memblock();
> > omap_vram_reserve_sdram_memblock();
> > }
> > -
> > -/*
> > - * 32KHz clocksource ... always available, on pretty most chips except
> > - * OMAP 730 and 1510. Other timers could be used as clocksources, with
> > - * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
> > - * but systems won't necessarily want to spend resources that way.
> > - */
> > -
> > -#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
> > -
> > -#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
> > -
> > -#include<linux/clocksource.h>
> > -
> > -/*
> > - * offset_32k holds the init time counter value. It is then subtracted
> > - * from every counter read to achieve a counter that counts time from
> the
> > - * kernel boot (needed for sched_clock()).
> > - */
> > -static u32 offset_32k __read_mostly;
> > -
> > -#ifdef CONFIG_ARCH_OMAP16XX
> > -static cycle_t omap16xx_32k_read(struct clocksource *cs)
> > -{
> > - return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
> > -}
> > -#else
> > -#define omap16xx_32k_read NULL
> > -#endif
> > -
> > -#ifdef CONFIG_ARCH_OMAP2420
> > -static cycle_t omap2420_32k_read(struct clocksource *cs)
> > -{
> > - return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
> > -}
> > -#else
> > -#define omap2420_32k_read NULL
> > -#endif
> > -
> > -#ifdef CONFIG_ARCH_OMAP2430
> > -static cycle_t omap2430_32k_read(struct clocksource *cs)
> > -{
> > - return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
> > -}
> > -#else
> > -#define omap2430_32k_read NULL
> > -#endif
> > -
> > -#ifdef CONFIG_ARCH_OMAP3
> > -static cycle_t omap34xx_32k_read(struct clocksource *cs)
> > -{
> > - return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
> > -}
> > -#else
> > -#define omap34xx_32k_read NULL
> > -#endif
> > -
> > -#ifdef CONFIG_ARCH_OMAP4
> > -static cycle_t omap44xx_32k_read(struct clocksource *cs)
> > -{
> > - return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
> > -}
> > -#else
> > -#define omap44xx_32k_read NULL
> > -#endif
> > -
> > -/*
> > - * Kernel assumes that sched_clock can be called early but may not have
> > - * things ready yet.
> > - */
> > -static cycle_t omap_32k_read_dummy(struct clocksource *cs)
> > -{
> > - return 0;
> > -}
> > -
> > -static struct clocksource clocksource_32k = {
> > - .name = "32k_counter",
> > - .rating = 250,
> > - .read = omap_32k_read_dummy,
> > - .mask = CLOCKSOURCE_MASK(32),
> > - .shift = 10,
> > - .flags = CLOCK_SOURCE_IS_CONTINUOUS,
> > -};
> > -
> > -/*
> > - * Returns current time from boot in nsecs. It's OK for this to wrap
> > - * around for now, as it's just a relative time stamp.
> > - */
> > -unsigned long long sched_clock(void)
> > -{
> > - return
> clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
> > - clocksource_32k.mult,
> clocksource_32k.shift);
> > -}
> > -
> > -/**
> > - * read_persistent_clock - Return time from a persistent clock.
> > - *
> > - * Reads the time from a source which isn't disabled during PM, the
> > - * 32k sync timer. Convert the cycles elapsed since last read into
> > - * nsecs and adds to a monotonically increasing timespec.
> > - */
> > -static struct timespec persistent_ts;
> > -static cycles_t cycles, last_cycles;
> > -void read_persistent_clock(struct timespec *ts)
> > -{
> > - unsigned long long nsecs;
> > - cycles_t delta;
> > - struct timespec *tsp =&persistent_ts;
> > -
> > - last_cycles = cycles;
> > - cycles = clocksource_32k.read(&clocksource_32k);
> > - delta = cycles - last_cycles;
> > -
> > - nsecs = clocksource_cyc2ns(delta,
> > - clocksource_32k.mult,
> clocksource_32k.shift);
> > -
> > - timespec_add_ns(tsp, nsecs);
> > - *ts = *tsp;
> > -}
> > -
> > -static int __init omap_init_clocksource_32k(void)
> > -{
> > - static char err[] __initdata = KERN_ERR
> > - "%s: can't register clocksource!\n";
> > -
> > - if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > - struct clk *sync_32k_ick;
> > -
> > - if (cpu_is_omap16xx())
> > - clocksource_32k.read = omap16xx_32k_read;
> > - else if (cpu_is_omap2420())
> > - clocksource_32k.read = omap2420_32k_read;
> > - else if (cpu_is_omap2430())
> > - clocksource_32k.read = omap2430_32k_read;
> > - else if (cpu_is_omap34xx())
> > - clocksource_32k.read = omap34xx_32k_read;
> > - else if (cpu_is_omap44xx())
> > - clocksource_32k.read = omap44xx_32k_read;
> > - else
> > - return -ENODEV;
> > -
> > - sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
> > - if (sync_32k_ick)
> > - clk_enable(sync_32k_ick);
> > -
> > - clocksource_32k.mult = clocksource_hz2mult(32768,
> > - clocksource_32k.shift);
> > -
> > - offset_32k = clocksource_32k.read(&clocksource_32k);
> > -
> > - if (clocksource_register(&clocksource_32k))
> > - printk(err, clocksource_32k.name);
> > - }
> > - return 0;
> > -}
> > -arch_initcall(omap_init_clocksource_32k);
> > -
> > -#endif /* !(defined(CONFIG_ARCH_OMAP730) ||
> defined(CONFIG_ARCH_OMAP15XX)) */
> > -
> > -/* 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);
> > - omap2_set_globals_sdrc(omap2_globals);
> > - omap2_set_globals_control(omap2_globals);
> > - omap2_set_globals_prcm(omap2_globals);
> > - omap2_set_globals_uart(omap2_globals);
> > -}
> > -
> > -#endif
> > -
> > -#if defined(CONFIG_ARCH_OMAP2420)
> > -
> > -static struct omap_globals omap242x_globals = {
> > - .class = OMAP242X_CLASS,
> > - .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
> > - .sdrc = OMAP2420_SDRC_BASE,
> > - .sms = OMAP2420_SMS_BASE,
> > - .ctrl = OMAP242X_CTRL_BASE,
> > - .prm = OMAP2420_PRM_BASE,
> > - .cm = OMAP2420_CM_BASE,
> > - .uart1_phys = OMAP2_UART1_BASE,
> > - .uart2_phys = OMAP2_UART2_BASE,
> > - .uart3_phys = OMAP2_UART3_BASE,
> > -};
> > -
> > -void __init omap2_set_globals_242x(void)
> > -{
> > - __omap2_set_globals(&omap242x_globals);
> > -}
> > -#endif
> > -
> > -#if defined(CONFIG_ARCH_OMAP2430)
> > -
> > -static struct omap_globals omap243x_globals = {
> > - .class = OMAP243X_CLASS,
> > - .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
> > - .sdrc = OMAP243X_SDRC_BASE,
> > - .sms = OMAP243X_SMS_BASE,
> > - .ctrl = OMAP243X_CTRL_BASE,
> > - .prm = OMAP2430_PRM_BASE,
> > - .cm = OMAP2430_CM_BASE,
> > - .uart1_phys = OMAP2_UART1_BASE,
> > - .uart2_phys = OMAP2_UART2_BASE,
> > - .uart3_phys = OMAP2_UART3_BASE,
> > -};
> > -
> > -void __init omap2_set_globals_243x(void)
> > -{
> > - __omap2_set_globals(&omap243x_globals);
> > -}
> > -#endif
> > -
> > -#if defined(CONFIG_ARCH_OMAP3)
> > -
> > -static struct omap_globals omap3_globals = {
> > - .class = OMAP343X_CLASS,
> > - .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
> > - .sdrc = OMAP343X_SDRC_BASE,
> > - .sms = OMAP343X_SMS_BASE,
> > - .ctrl = OMAP343X_CTRL_BASE,
> > - .prm = OMAP3430_PRM_BASE,
> > - .cm = OMAP3430_CM_BASE,
> > - .uart1_phys = OMAP3_UART1_BASE,
> > - .uart2_phys = OMAP3_UART2_BASE,
> > - .uart3_phys = OMAP3_UART3_BASE,
> > - .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
> > -};
> > -
> > -void __init omap2_set_globals_3xxx(void)
> > -{
> > - __omap2_set_globals(&omap3_globals);
> > -}
> > -
> > -void __init omap3_map_io(void)
> > -{
> > - omap2_set_globals_3xxx();
> > - omap34xx_map_common_io();
> > -}
> > -#endif
> > -
> > -#if defined(CONFIG_ARCH_OMAP4)
> > -static struct omap_globals omap4_globals = {
> > - .class = OMAP443X_CLASS,
> > - .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
> > - .ctrl = OMAP443X_SCM_BASE,
> > - .ctrl_pad = OMAP443X_CTRL_BASE,
> > - .prm = OMAP4430_PRM_BASE,
> > - .cm = OMAP4430_CM_BASE,
> > - .cm2 = OMAP4430_CM2_BASE,
> > - .uart1_phys = OMAP4_UART1_BASE,
> > - .uart2_phys = OMAP4_UART2_BASE,
> > - .uart3_phys = OMAP4_UART3_BASE,
> > - .uart4_phys = OMAP4_UART4_BASE,
> > -};
> > -
> > -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_uart(&omap4_globals);
> > -}
> > -#endif
> > -
> > diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
> > index d1920be..78162a0 100644
> > --- a/arch/arm/plat-omap/devices.c
> > +++ b/arch/arm/plat-omap/devices.c
> > @@ -21,7 +21,6 @@
> > #include<asm/mach/map.h>
> >
> > #include<plat/tc.h>
> > -#include<plat/control.h>
> > #include<plat/board.h>
> > #include<plat/mmc.h>
> > #include<mach/gpio.h>
> > diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> > index 33ee6b8..d971aeb 100644
> > --- a/arch/arm/plat-omap/sram.c
> > +++ b/arch/arm/plat-omap/sram.c
> > @@ -30,8 +30,6 @@
> > #include<plat/cpu.h>
> > #include<plat/vram.h>
> >
> > -#include<plat/control.h>
> > -
> > #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
> > # include "../mach-omap2/prm.h"
> > # include "../mach-omap2/cm.h"
> > @@ -68,7 +66,6 @@
> > #define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
> > #define OMAP34XX_VA_ADDR_MATCH2
> OMAP2_L3_IO_ADDRESS(0x68012880)
> > #define OMAP34XX_VA_SMS_RG_ATT0
> OMAP2_L3_IO_ADDRESS(0x6C000048)
> > -#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
> >
> > #define GP_DEVICE 0x300
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 9:35 ` DebBarma, Tarun Kanti
@ 2010-10-04 9:54 ` Cousson, Benoit
0 siblings, 0 replies; 43+ messages in thread
From: Cousson, Benoit @ 2010-10-04 9:54 UTC (permalink / raw)
To: linux-arm-kernel
Hi Tarun,
On 10/4/2010 11:35 AM, DebBarma, Tarun Kanti wrote:
>
>> -----Original Message-----
>> From: linux-omap-owner at vger.kernel.org [mailto:linux-omap-
>> owner at vger.kernel.org] On Behalf Of Cousson, Benoit
>> Sent: Monday, October 04, 2010 2:39 PM
>> To: Paul Walmsley
>> Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
>> Subject: Re: [PATCH 08/10] OMAP: split plat-omap/common.c
>>
>> Hi Paul,
>>
>> On 10/1/2010 11:35 PM, Paul Walmsley wrote:
>>> Split plat-omap/common.c into three pieces:
>>>
>>> 1. the 32KiHz sync timer and clocksource code, which now lives in
>>> plat-omap/32ksynctimer.c;
>>>
>>> 2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
>>>
>>> 3. and the remainder of the OMAP-wide common code, which includes the
>>> deprecated ATAGs code and a deprecated video RAM reservation
>> function.
>>>
>>> The primary motivation for doing this is to move the OMAP2+-specific
>> parts
>>> into an OMAP2+-specific file, so that build breakage related to the
>>> System Control Module code can be resolved.
>>>
>>> Signed-off-by: Paul Walmsley<paul@pwsan.com>
>>> ---
>>
>> <...>
>>
>>> diff --git a/arch/arm/plat-omap/32ksynctimer.c b/arch/arm/plat-
>> omap/32ksynctimer.c
>>> new file mode 100644
>>> index 0000000..b7f458c
>>> --- /dev/null
>>> +++ b/arch/arm/plat-omap/32ksynctimer.c
>>> @@ -0,0 +1,184 @@
>>> +/*
>>> + * linux/arch/arm/plat-omap/clocksource.c
>>
>> What name do you want to use? 32ksynctimer.c or clocksource.c?
>>
>> If this file is dedicated for the 32k sync timer, maybe we should now
>> use the new OMAP4 name: "counter_32k".
>>
>> Noboby knows what the sync stand for, and at the end this is just a 32k
>> counter. Hence the new name :-)
> One of the points to be kept in mind while naming is that we are able to relate our driver easily to the hardware device. In this regard the TRM terms this module as 32-kHz Synchronized Timer. Therefore we should be careful in our naming. With regard to the meaning of the word here is the extract from the TRM.
The TRM will have to be fixed anyway to stick to the new convention.
We are just anticipating in order to avoid changing that again for the
next revision.
>
> OMAP4430 ES2.0 TRM
> ...
> The sync logic ensures the read transaction correctness by synchronizing the counter register read access on 32KSYNCNT_ICLK because the 32KSYNCNT_ICLK clock signal is completely asynchronous with S32KSYNCNT_FCLK.
Thanks, but if this is where the sync came from, then this is the case
for all modules with a very slow functional clock or even as soon as the
fclk is not derived from its iclk.
This is not a functionality, it is just how it should be implemented.
Regards,
Benoit
> ...
>
>>
>> Benoit
>>
>>> + *
>>> + * OMAP clocksource-related code
>>> + *
>>> + * Copyright (C) 2009 Texas Instruments
>>> + * Copyright (C) 2010 Nokia Corporation
>>> + * Tony Lindgren<tony@atomide.com>
>>> + * Added OMAP4 support - Santosh Shilimkar<santosh.shilimkar@ti.com>
>>> + * Paul Walmsley
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2 as
>>> + * published by the Free Software Foundation.
>>> + */
>>> +#include<linux/kernel.h>
>>> +#include<linux/init.h>
>>> +#include<linux/clk.h>
>>> +#include<linux/io.h>
>>> +
>>> +#include<plat/common.h>
>>> +#include<plat/board.h>
>>> +
>>> +#include<plat/clock.h>
>>> +
>>> +
>>> +/*
>>> + * 32KHz clocksource ... always available, on pretty most chips except
>>> + * OMAP 730 and 1510. Other timers could be used as clocksources, with
>>> + * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
>>> + * but systems won't necessarily want to spend resources that way.
>>> + */
>>> +
>>> +#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
>>> +
>>> +#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
>>> +
>>> +#include<linux/clocksource.h>
>>> +
>>> +/*
>>> + * offset_32k holds the init time counter value. It is then subtracted
>>> + * from every counter read to achieve a counter that counts time from
>> the
>>> + * kernel boot (needed for sched_clock()).
>>> + */
>>> +static u32 offset_32k __read_mostly;
>>> +
>>> +#ifdef CONFIG_ARCH_OMAP16XX
>>> +static cycle_t omap16xx_32k_read(struct clocksource *cs)
>>> +{
>>> + return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
>>> +}
>>> +#else
>>> +#define omap16xx_32k_read NULL
>>> +#endif
>>> +
>>> +#ifdef CONFIG_ARCH_OMAP2420
>>> +static cycle_t omap2420_32k_read(struct clocksource *cs)
>>> +{
>>> + return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
>>> +}
>>> +#else
>>> +#define omap2420_32k_read NULL
>>> +#endif
>>> +
>>> +#ifdef CONFIG_ARCH_OMAP2430
>>> +static cycle_t omap2430_32k_read(struct clocksource *cs)
>>> +{
>>> + return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
>>> +}
>>> +#else
>>> +#define omap2430_32k_read NULL
>>> +#endif
>>> +
>>> +#ifdef CONFIG_ARCH_OMAP3
>>> +static cycle_t omap34xx_32k_read(struct clocksource *cs)
>>> +{
>>> + return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
>>> +}
>>> +#else
>>> +#define omap34xx_32k_read NULL
>>> +#endif
>>> +
>>> +#ifdef CONFIG_ARCH_OMAP4
>>> +static cycle_t omap44xx_32k_read(struct clocksource *cs)
>>> +{
>>> + return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
>>> +}
>>> +#else
>>> +#define omap44xx_32k_read NULL
>>> +#endif
>>> +
>>> +/*
>>> + * Kernel assumes that sched_clock can be called early but may not have
>>> + * things ready yet.
>>> + */
>>> +static cycle_t omap_32k_read_dummy(struct clocksource *cs)
>>> +{
>>> + return 0;
>>> +}
>>> +
>>> +static struct clocksource clocksource_32k = {
>>> + .name = "32k_counter",
>>> + .rating = 250,
>>> + .read = omap_32k_read_dummy,
>>> + .mask = CLOCKSOURCE_MASK(32),
>>> + .shift = 10,
>>> + .flags = CLOCK_SOURCE_IS_CONTINUOUS,
>>> +};
>>> +
>>> +/*
>>> + * Returns current time from boot in nsecs. It's OK for this to wrap
>>> + * around for now, as it's just a relative time stamp.
>>> + */
>>> +unsigned long long sched_clock(void)
>>> +{
>>> + return
>> clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
>>> + clocksource_32k.mult,
>> clocksource_32k.shift);
>>> +}
>>> +
>>> +/**
>>> + * read_persistent_clock - Return time from a persistent clock.
>>> + *
>>> + * Reads the time from a source which isn't disabled during PM, the
>>> + * 32k sync timer. Convert the cycles elapsed since last read into
>>> + * nsecs and adds to a monotonically increasing timespec.
>>> + */
>>> +static struct timespec persistent_ts;
>>> +static cycles_t cycles, last_cycles;
>>> +void read_persistent_clock(struct timespec *ts)
>>> +{
>>> + unsigned long long nsecs;
>>> + cycles_t delta;
>>> + struct timespec *tsp =&persistent_ts;
>>> +
>>> + last_cycles = cycles;
>>> + cycles = clocksource_32k.read(&clocksource_32k);
>>> + delta = cycles - last_cycles;
>>> +
>>> + nsecs = clocksource_cyc2ns(delta,
>>> + clocksource_32k.mult,
>> clocksource_32k.shift);
>>> +
>>> + timespec_add_ns(tsp, nsecs);
>>> + *ts = *tsp;
>>> +}
>>> +
>>> +static int __init omap_init_clocksource_32k(void)
>>> +{
>>> + static char err[] __initdata = KERN_ERR
>>> + "%s: can't register clocksource!\n";
>>> +
>>> + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
>>> + struct clk *sync_32k_ick;
>>> +
>>> + if (cpu_is_omap16xx())
>>> + clocksource_32k.read = omap16xx_32k_read;
>>> + else if (cpu_is_omap2420())
>>> + clocksource_32k.read = omap2420_32k_read;
>>> + else if (cpu_is_omap2430())
>>> + clocksource_32k.read = omap2430_32k_read;
>>> + else if (cpu_is_omap34xx())
>>> + clocksource_32k.read = omap34xx_32k_read;
>>> + else if (cpu_is_omap44xx())
>>> + clocksource_32k.read = omap44xx_32k_read;
>>> + else
>>> + return -ENODEV;
>>> +
>>> + sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
>>> + if (sync_32k_ick)
>>> + clk_enable(sync_32k_ick);
>>> +
>>> + clocksource_32k.mult = clocksource_hz2mult(32768,
>>> + clocksource_32k.shift);
>>> +
>>> + offset_32k = clocksource_32k.read(&clocksource_32k);
>>> +
>>> + if (clocksource_register(&clocksource_32k))
>>> + printk(err, clocksource_32k.name);
>>> + }
>>> + return 0;
>>> +}
>>> +arch_initcall(omap_init_clocksource_32k);
>>> +
>>> +#endif /* !(defined(CONFIG_ARCH_OMAP730) ||
>> defined(CONFIG_ARCH_OMAP15XX)) */
>>> +
>>> diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
>>> index 2a15191..32a5959 100644
>>> --- a/arch/arm/plat-omap/Makefile
>>> +++ b/arch/arm/plat-omap/Makefile
>>> @@ -4,7 +4,7 @@
>>>
>>> # Common support
>>> obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
>>> - usb.o fb.o io.o
>>> + usb.o fb.o io.o 32ksynctimer.o
>>> obj-m :=
>>> obj-n :=
>>> obj- :=
>>> diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
>>> index 9200ea7..221a675 100644
>>> --- a/arch/arm/plat-omap/common.c
>>> +++ b/arch/arm/plat-omap/common.c
>>> @@ -11,38 +11,15 @@
>>> * it under the terms of the GNU General Public License version 2 as
>>> * published by the Free Software Foundation.
>>> */
>>> -#include<linux/module.h>
>>> #include<linux/kernel.h>
>>> #include<linux/init.h>
>>> -#include<linux/delay.h>
>>> -#include<linux/console.h>
>>> -#include<linux/serial.h>
>>> -#include<linux/tty.h>
>>> -#include<linux/serial_8250.h>
>>> -#include<linux/serial_reg.h>
>>> -#include<linux/clk.h>
>>> #include<linux/io.h>
>>> #include<linux/omapfb.h>
>>>
>>> -#include<mach/hardware.h>
>>> -#include<asm/system.h>
>>> -#include<asm/pgtable.h>
>>> -#include<asm/mach/map.h>
>>> -#include<asm/setup.h>
>>> -
>>> #include<plat/common.h>
>>> #include<plat/board.h>
>>> -#include<plat/control.h>
>>> -#include<plat/mux.h>
>>> -#include<plat/fpga.h>
>>> -#include<plat/serial.h>
>>> #include<plat/vram.h>
>>>
>>> -#include<plat/clock.h>
>>> -
>>> -#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
>>> -# include "../mach-omap2/sdrc.h"
>>> -#endif
>>>
>>> #define NO_LENGTH_CHECK 0xffffffff
>>>
>>> @@ -88,271 +65,3 @@ void __init omap_reserve(void)
>>> omapfb_reserve_sdram_memblock();
>>> omap_vram_reserve_sdram_memblock();
>>> }
>>> -
>>> -/*
>>> - * 32KHz clocksource ... always available, on pretty most chips except
>>> - * OMAP 730 and 1510. Other timers could be used as clocksources, with
>>> - * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
>>> - * but systems won't necessarily want to spend resources that way.
>>> - */
>>> -
>>> -#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
>>> -
>>> -#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
>>> -
>>> -#include<linux/clocksource.h>
>>> -
>>> -/*
>>> - * offset_32k holds the init time counter value. It is then subtracted
>>> - * from every counter read to achieve a counter that counts time from
>> the
>>> - * kernel boot (needed for sched_clock()).
>>> - */
>>> -static u32 offset_32k __read_mostly;
>>> -
>>> -#ifdef CONFIG_ARCH_OMAP16XX
>>> -static cycle_t omap16xx_32k_read(struct clocksource *cs)
>>> -{
>>> - return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
>>> -}
>>> -#else
>>> -#define omap16xx_32k_read NULL
>>> -#endif
>>> -
>>> -#ifdef CONFIG_ARCH_OMAP2420
>>> -static cycle_t omap2420_32k_read(struct clocksource *cs)
>>> -{
>>> - return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
>>> -}
>>> -#else
>>> -#define omap2420_32k_read NULL
>>> -#endif
>>> -
>>> -#ifdef CONFIG_ARCH_OMAP2430
>>> -static cycle_t omap2430_32k_read(struct clocksource *cs)
>>> -{
>>> - return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
>>> -}
>>> -#else
>>> -#define omap2430_32k_read NULL
>>> -#endif
>>> -
>>> -#ifdef CONFIG_ARCH_OMAP3
>>> -static cycle_t omap34xx_32k_read(struct clocksource *cs)
>>> -{
>>> - return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
>>> -}
>>> -#else
>>> -#define omap34xx_32k_read NULL
>>> -#endif
>>> -
>>> -#ifdef CONFIG_ARCH_OMAP4
>>> -static cycle_t omap44xx_32k_read(struct clocksource *cs)
>>> -{
>>> - return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
>>> -}
>>> -#else
>>> -#define omap44xx_32k_read NULL
>>> -#endif
>>> -
>>> -/*
>>> - * Kernel assumes that sched_clock can be called early but may not have
>>> - * things ready yet.
>>> - */
>>> -static cycle_t omap_32k_read_dummy(struct clocksource *cs)
>>> -{
>>> - return 0;
>>> -}
>>> -
>>> -static struct clocksource clocksource_32k = {
>>> - .name = "32k_counter",
>>> - .rating = 250,
>>> - .read = omap_32k_read_dummy,
>>> - .mask = CLOCKSOURCE_MASK(32),
>>> - .shift = 10,
>>> - .flags = CLOCK_SOURCE_IS_CONTINUOUS,
>>> -};
>>> -
>>> -/*
>>> - * Returns current time from boot in nsecs. It's OK for this to wrap
>>> - * around for now, as it's just a relative time stamp.
>>> - */
>>> -unsigned long long sched_clock(void)
>>> -{
>>> - return
>> clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
>>> - clocksource_32k.mult,
>> clocksource_32k.shift);
>>> -}
>>> -
>>> -/**
>>> - * read_persistent_clock - Return time from a persistent clock.
>>> - *
>>> - * Reads the time from a source which isn't disabled during PM, the
>>> - * 32k sync timer. Convert the cycles elapsed since last read into
>>> - * nsecs and adds to a monotonically increasing timespec.
>>> - */
>>> -static struct timespec persistent_ts;
>>> -static cycles_t cycles, last_cycles;
>>> -void read_persistent_clock(struct timespec *ts)
>>> -{
>>> - unsigned long long nsecs;
>>> - cycles_t delta;
>>> - struct timespec *tsp =&persistent_ts;
>>> -
>>> - last_cycles = cycles;
>>> - cycles = clocksource_32k.read(&clocksource_32k);
>>> - delta = cycles - last_cycles;
>>> -
>>> - nsecs = clocksource_cyc2ns(delta,
>>> - clocksource_32k.mult,
>> clocksource_32k.shift);
>>> -
>>> - timespec_add_ns(tsp, nsecs);
>>> - *ts = *tsp;
>>> -}
>>> -
>>> -static int __init omap_init_clocksource_32k(void)
>>> -{
>>> - static char err[] __initdata = KERN_ERR
>>> - "%s: can't register clocksource!\n";
>>> -
>>> - if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
>>> - struct clk *sync_32k_ick;
>>> -
>>> - if (cpu_is_omap16xx())
>>> - clocksource_32k.read = omap16xx_32k_read;
>>> - else if (cpu_is_omap2420())
>>> - clocksource_32k.read = omap2420_32k_read;
>>> - else if (cpu_is_omap2430())
>>> - clocksource_32k.read = omap2430_32k_read;
>>> - else if (cpu_is_omap34xx())
>>> - clocksource_32k.read = omap34xx_32k_read;
>>> - else if (cpu_is_omap44xx())
>>> - clocksource_32k.read = omap44xx_32k_read;
>>> - else
>>> - return -ENODEV;
>>> -
>>> - sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
>>> - if (sync_32k_ick)
>>> - clk_enable(sync_32k_ick);
>>> -
>>> - clocksource_32k.mult = clocksource_hz2mult(32768,
>>> - clocksource_32k.shift);
>>> -
>>> - offset_32k = clocksource_32k.read(&clocksource_32k);
>>> -
>>> - if (clocksource_register(&clocksource_32k))
>>> - printk(err, clocksource_32k.name);
>>> - }
>>> - return 0;
>>> -}
>>> -arch_initcall(omap_init_clocksource_32k);
>>> -
>>> -#endif /* !(defined(CONFIG_ARCH_OMAP730) ||
>> defined(CONFIG_ARCH_OMAP15XX)) */
>>> -
>>> -/* 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);
>>> - omap2_set_globals_sdrc(omap2_globals);
>>> - omap2_set_globals_control(omap2_globals);
>>> - omap2_set_globals_prcm(omap2_globals);
>>> - omap2_set_globals_uart(omap2_globals);
>>> -}
>>> -
>>> -#endif
>>> -
>>> -#if defined(CONFIG_ARCH_OMAP2420)
>>> -
>>> -static struct omap_globals omap242x_globals = {
>>> - .class = OMAP242X_CLASS,
>>> - .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
>>> - .sdrc = OMAP2420_SDRC_BASE,
>>> - .sms = OMAP2420_SMS_BASE,
>>> - .ctrl = OMAP242X_CTRL_BASE,
>>> - .prm = OMAP2420_PRM_BASE,
>>> - .cm = OMAP2420_CM_BASE,
>>> - .uart1_phys = OMAP2_UART1_BASE,
>>> - .uart2_phys = OMAP2_UART2_BASE,
>>> - .uart3_phys = OMAP2_UART3_BASE,
>>> -};
>>> -
>>> -void __init omap2_set_globals_242x(void)
>>> -{
>>> - __omap2_set_globals(&omap242x_globals);
>>> -}
>>> -#endif
>>> -
>>> -#if defined(CONFIG_ARCH_OMAP2430)
>>> -
>>> -static struct omap_globals omap243x_globals = {
>>> - .class = OMAP243X_CLASS,
>>> - .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
>>> - .sdrc = OMAP243X_SDRC_BASE,
>>> - .sms = OMAP243X_SMS_BASE,
>>> - .ctrl = OMAP243X_CTRL_BASE,
>>> - .prm = OMAP2430_PRM_BASE,
>>> - .cm = OMAP2430_CM_BASE,
>>> - .uart1_phys = OMAP2_UART1_BASE,
>>> - .uart2_phys = OMAP2_UART2_BASE,
>>> - .uart3_phys = OMAP2_UART3_BASE,
>>> -};
>>> -
>>> -void __init omap2_set_globals_243x(void)
>>> -{
>>> - __omap2_set_globals(&omap243x_globals);
>>> -}
>>> -#endif
>>> -
>>> -#if defined(CONFIG_ARCH_OMAP3)
>>> -
>>> -static struct omap_globals omap3_globals = {
>>> - .class = OMAP343X_CLASS,
>>> - .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
>>> - .sdrc = OMAP343X_SDRC_BASE,
>>> - .sms = OMAP343X_SMS_BASE,
>>> - .ctrl = OMAP343X_CTRL_BASE,
>>> - .prm = OMAP3430_PRM_BASE,
>>> - .cm = OMAP3430_CM_BASE,
>>> - .uart1_phys = OMAP3_UART1_BASE,
>>> - .uart2_phys = OMAP3_UART2_BASE,
>>> - .uart3_phys = OMAP3_UART3_BASE,
>>> - .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
>>> -};
>>> -
>>> -void __init omap2_set_globals_3xxx(void)
>>> -{
>>> - __omap2_set_globals(&omap3_globals);
>>> -}
>>> -
>>> -void __init omap3_map_io(void)
>>> -{
>>> - omap2_set_globals_3xxx();
>>> - omap34xx_map_common_io();
>>> -}
>>> -#endif
>>> -
>>> -#if defined(CONFIG_ARCH_OMAP4)
>>> -static struct omap_globals omap4_globals = {
>>> - .class = OMAP443X_CLASS,
>>> - .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
>>> - .ctrl = OMAP443X_SCM_BASE,
>>> - .ctrl_pad = OMAP443X_CTRL_BASE,
>>> - .prm = OMAP4430_PRM_BASE,
>>> - .cm = OMAP4430_CM_BASE,
>>> - .cm2 = OMAP4430_CM2_BASE,
>>> - .uart1_phys = OMAP4_UART1_BASE,
>>> - .uart2_phys = OMAP4_UART2_BASE,
>>> - .uart3_phys = OMAP4_UART3_BASE,
>>> - .uart4_phys = OMAP4_UART4_BASE,
>>> -};
>>> -
>>> -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_uart(&omap4_globals);
>>> -}
>>> -#endif
>>> -
>>> diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
>>> index d1920be..78162a0 100644
>>> --- a/arch/arm/plat-omap/devices.c
>>> +++ b/arch/arm/plat-omap/devices.c
>>> @@ -21,7 +21,6 @@
>>> #include<asm/mach/map.h>
>>>
>>> #include<plat/tc.h>
>>> -#include<plat/control.h>
>>> #include<plat/board.h>
>>> #include<plat/mmc.h>
>>> #include<mach/gpio.h>
>>> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
>>> index 33ee6b8..d971aeb 100644
>>> --- a/arch/arm/plat-omap/sram.c
>>> +++ b/arch/arm/plat-omap/sram.c
>>> @@ -30,8 +30,6 @@
>>> #include<plat/cpu.h>
>>> #include<plat/vram.h>
>>>
>>> -#include<plat/control.h>
>>> -
>>> #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
>>> # include "../mach-omap2/prm.h"
>>> # include "../mach-omap2/cm.h"
>>> @@ -68,7 +66,6 @@
>>> #define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
>>> #define OMAP34XX_VA_ADDR_MATCH2
>> OMAP2_L3_IO_ADDRESS(0x68012880)
>>> #define OMAP34XX_VA_SMS_RG_ATT0
>> OMAP2_L3_IO_ADDRESS(0x6C000048)
>>> -#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
>>>
>>> #define GP_DEVICE 0x300
>>>
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>>> the body of a message to majordomo at vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 7:28 ` Shilimkar, Santosh
@ 2010-10-04 18:21 ` Tony Lindgren
2010-10-04 19:32 ` Paul Walmsley
1 sibling, 0 replies; 43+ messages in thread
From: Tony Lindgren @ 2010-10-04 18:21 UTC (permalink / raw)
To: linux-arm-kernel
* Shilimkar, Santosh <santosh.shilimkar@ti.com> [101004 00:20]:
> > >
> > >[1] git://gitorious.org/usb/usb.git clksource
> >
> > I made a few changes to make checkpatch.pl --strict happy. Attached
> >
> Good !!
> This patch addresses splitting as well as multi-omap builds and probably
> also a better candidate in case we need to convert sync timer to hwmod
> driver.
>
> Paul, what's your take?
I think we need to first merge Paul's series to fix the omap1
compile issue and the ASoC module compile issue.
The other changes should be trivial to rebase on top of that.
Regards,
Tony
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 8:28 ` Varadarajan, Charulatha
@ 2010-10-04 18:27 ` Tony Lindgren
0 siblings, 0 replies; 43+ messages in thread
From: Tony Lindgren @ 2010-10-04 18:27 UTC (permalink / raw)
To: linux-arm-kernel
* Varadarajan, Charulatha <charu@ti.com> [101004 01:20]:
> Paul,
>
> <<snip>>
>
> >
> > > > +static int __init omap_init_clocksource_32k(void)
> > > > +{
> > > > + static char err[] __initdata = KERN_ERR
> > > > + "%s: can't register clocksource!\n";
> > > > +
> > > > + if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
> > > > + struct clk *sync_32k_ick;
> > > > +
> > > > + if (cpu_is_omap16xx())
> > >
> > > Avoid cpu_is* checks in plat-omap.
> >
> > OK, I'll bite. Why?
>
> I think this is being looked for all the new code introduced
> in plat-omap layer for the following reasons:
> Adding cpu-is-* checks makes code unmaintainable going fwd.
> plat-omap layer needs to handle common code for all omap platforms.
>
> This was raised for GPIO driver because of which, there was a
> requirement to clean-up the gpio driver.
>
> Is this stand changed? Are cpu_is* checks allowed in plat-omap?
We should only need to do cpu_is* checks in arch/arm/mach-omap2,
and only in few places during the init.
However, this patch series moves around the existing code to
avoid having oma2plus specific code be in plat-omap.
Again, further patches can be done easily on this.
Tony
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 9:08 ` Cousson, Benoit
2010-10-04 9:35 ` DebBarma, Tarun Kanti
@ 2010-10-04 19:15 ` Paul Walmsley
2010-10-04 19:26 ` Paul Walmsley
2010-10-05 11:00 ` Sergei Shtylyov
1 sibling, 2 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-04 19:15 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 4 Oct 2010, Cousson, Benoit wrote:
> > --- /dev/null
> > +++ b/arch/arm/plat-omap/32ksynctimer.c
> > @@ -0,0 +1,184 @@
> > +/*
> > + * linux/arch/arm/plat-omap/clocksource.c
>
> What name do you want to use? 32ksynctimer.c or clocksource.c?
Thanks, that's a bug.
> If this file is dedicated for the 32k sync timer, maybe we should now use the
> new OMAP4 name: "counter_32k".
>
> Noboby knows what the sync stand for, and at the end this is just a 32k
> counter. Hence the new name :-)
Yep, let's use counter_32k.c.
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 5:38 ` Varadarajan, Charulatha
2010-10-04 6:03 ` Paul Walmsley
@ 2010-10-04 19:24 ` Paul Walmsley
1 sibling, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-04 19:24 UTC (permalink / raw)
To: linux-arm-kernel
Here's the updated patch:
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 19:15 ` Paul Walmsley
@ 2010-10-04 19:26 ` Paul Walmsley
2010-10-05 11:00 ` Sergei Shtylyov
1 sibling, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-04 19:26 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 4 Oct 2010, Paul Walmsley wrote:
> On Mon, 4 Oct 2010, Cousson, Benoit wrote:
>
> > > --- /dev/null
> > > +++ b/arch/arm/plat-omap/32ksynctimer.c
> > > @@ -0,0 +1,184 @@
> > > +/*
> > > + * linux/arch/arm/plat-omap/clocksource.c
> >
> > What name do you want to use? 32ksynctimer.c or clocksource.c?
>
> Thanks, that's a bug.
>
> > If this file is dedicated for the 32k sync timer, maybe we should now use the
> > new OMAP4 name: "counter_32k".
> >
> > Noboby knows what the sync stand for, and at the end this is just a 32k
> > counter. Hence the new name :-)
>
> Yep, let's use counter_32k.c.
Here's the updated patch:
- Paul
>From 38a26f5b30116df2f0f82acdae3b0a5f8aa25ac7 Mon Sep 17 00:00:00 2001
From: Paul Walmsley <paul@pwsan.com>
Date: Fri, 1 Oct 2010 15:46:44 -0600
Subject: [PATCH] OMAP: split plat-omap/common.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Split plat-omap/common.c into three pieces:
1. the 32KiHz sync timer and clocksource code, which now lives in
plat-omap/counter_32k.c;
2. the OMAP2+ common code, which has been moved to mach-omap2/common.c;
3. and the remainder of the OMAP-wide common code, which includes the
deprecated ATAGs code and a deprecated video RAM reservation function.
The primary motivation for doing this is to move the OMAP2+-specific parts
into an OMAP2+-specific file, so that build breakage related to the
System Control Module code can be resolved.
Beno?t Cousson <b-cousson@ti.com> suggested a new filename and found
some bugs in the counter_32k.c comments - thanks Beno?t.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Beno?t Cousson <b-cousson@ti.com>
---
arch/arm/mach-omap2/Makefile | 3 +-
arch/arm/mach-omap2/common.c | 137 ++++++++++++++++++
arch/arm/plat-omap/Makefile | 2 +-
arch/arm/plat-omap/common.c | 291 --------------------------------------
arch/arm/plat-omap/counter_32k.c | 183 ++++++++++++++++++++++++
arch/arm/plat-omap/devices.c | 1 -
arch/arm/plat-omap/sram.c | 3 -
7 files changed, 323 insertions(+), 297 deletions(-)
create mode 100644 arch/arm/mach-omap2/common.c
create mode 100644 arch/arm/plat-omap/counter_32k.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 9edacb0..d543533 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,7 +3,8 @@
#
# Common support
-obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o
+obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
+ common.o
omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o
hwmod-common = omap_hwmod.o \
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
new file mode 100644
index 0000000..d613738
--- /dev/null
+++ b/arch/arm/mach-omap2/common.c
@@ -0,0 +1,137 @@
+/*
+ * linux/arch/arm/mach-omap2/common.c
+ *
+ * Code common to all OMAP2+ machines.
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+#include <plat/board.h>
+#include <plat/control.h>
+#include <plat/mux.h>
+
+#include <plat/clock.h>
+
+#include "sdrc.h"
+
+/* 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);
+ omap2_set_globals_sdrc(omap2_globals);
+ omap2_set_globals_control(omap2_globals);
+ omap2_set_globals_prcm(omap2_globals);
+ omap2_set_globals_uart(omap2_globals);
+}
+
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2420)
+
+static struct omap_globals omap242x_globals = {
+ .class = OMAP242X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
+ .sdrc = OMAP2420_SDRC_BASE,
+ .sms = OMAP2420_SMS_BASE,
+ .ctrl = OMAP242X_CTRL_BASE,
+ .prm = OMAP2420_PRM_BASE,
+ .cm = OMAP2420_CM_BASE,
+ .uart1_phys = OMAP2_UART1_BASE,
+ .uart2_phys = OMAP2_UART2_BASE,
+ .uart3_phys = OMAP2_UART3_BASE,
+};
+
+void __init omap2_set_globals_242x(void)
+{
+ __omap2_set_globals(&omap242x_globals);
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP2430)
+
+static struct omap_globals omap243x_globals = {
+ .class = OMAP243X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
+ .sdrc = OMAP243X_SDRC_BASE,
+ .sms = OMAP243X_SMS_BASE,
+ .ctrl = OMAP243X_CTRL_BASE,
+ .prm = OMAP2430_PRM_BASE,
+ .cm = OMAP2430_CM_BASE,
+ .uart1_phys = OMAP2_UART1_BASE,
+ .uart2_phys = OMAP2_UART2_BASE,
+ .uart3_phys = OMAP2_UART3_BASE,
+};
+
+void __init omap2_set_globals_243x(void)
+{
+ __omap2_set_globals(&omap243x_globals);
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP3)
+
+static struct omap_globals omap3_globals = {
+ .class = OMAP343X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
+ .sdrc = OMAP343X_SDRC_BASE,
+ .sms = OMAP343X_SMS_BASE,
+ .ctrl = OMAP343X_CTRL_BASE,
+ .prm = OMAP3430_PRM_BASE,
+ .cm = OMAP3430_CM_BASE,
+ .uart1_phys = OMAP3_UART1_BASE,
+ .uart2_phys = OMAP3_UART2_BASE,
+ .uart3_phys = OMAP3_UART3_BASE,
+ .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
+};
+
+void __init omap2_set_globals_3xxx(void)
+{
+ __omap2_set_globals(&omap3_globals);
+}
+
+void __init omap3_map_io(void)
+{
+ omap2_set_globals_3xxx();
+ omap34xx_map_common_io();
+}
+#endif
+
+#if defined(CONFIG_ARCH_OMAP4)
+static struct omap_globals omap4_globals = {
+ .class = OMAP443X_CLASS,
+ .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
+ .ctrl = OMAP443X_SCM_BASE,
+ .ctrl_pad = OMAP443X_CTRL_BASE,
+ .prm = OMAP4430_PRM_BASE,
+ .cm = OMAP4430_CM_BASE,
+ .cm2 = OMAP4430_CM2_BASE,
+ .uart1_phys = OMAP4_UART1_BASE,
+ .uart2_phys = OMAP4_UART2_BASE,
+ .uart3_phys = OMAP4_UART3_BASE,
+ .uart4_phys = OMAP4_UART4_BASE,
+};
+
+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_uart(&omap4_globals);
+}
+#endif
+
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 2a15191..a4a1285 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -4,7 +4,7 @@
# Common support
obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
- usb.o fb.o io.o
+ usb.o fb.o io.o counter_32k.o
obj-m :=
obj-n :=
obj- :=
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 9200ea7..221a675 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -11,38 +11,15 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
-#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/console.h>
-#include <linux/serial.h>
-#include <linux/tty.h>
-#include <linux/serial_8250.h>
-#include <linux/serial_reg.h>
-#include <linux/clk.h>
#include <linux/io.h>
#include <linux/omapfb.h>
-#include <mach/hardware.h>
-#include <asm/system.h>
-#include <asm/pgtable.h>
-#include <asm/mach/map.h>
-#include <asm/setup.h>
-
#include <plat/common.h>
#include <plat/board.h>
-#include <plat/control.h>
-#include <plat/mux.h>
-#include <plat/fpga.h>
-#include <plat/serial.h>
#include <plat/vram.h>
-#include <plat/clock.h>
-
-#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
-# include "../mach-omap2/sdrc.h"
-#endif
#define NO_LENGTH_CHECK 0xffffffff
@@ -88,271 +65,3 @@ void __init omap_reserve(void)
omapfb_reserve_sdram_memblock();
omap_vram_reserve_sdram_memblock();
}
-
-/*
- * 32KHz clocksource ... always available, on pretty most chips except
- * OMAP 730 and 1510. Other timers could be used as clocksources, with
- * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
- * but systems won't necessarily want to spend resources that way.
- */
-
-#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
-
-#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
-
-#include <linux/clocksource.h>
-
-/*
- * offset_32k holds the init time counter value. It is then subtracted
- * from every counter read to achieve a counter that counts time from the
- * kernel boot (needed for sched_clock()).
- */
-static u32 offset_32k __read_mostly;
-
-#ifdef CONFIG_ARCH_OMAP16XX
-static cycle_t omap16xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
-}
-#else
-#define omap16xx_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2420
-static cycle_t omap2420_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap2420_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP2430
-static cycle_t omap2430_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap2430_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP3
-static cycle_t omap34xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap34xx_32k_read NULL
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-static cycle_t omap44xx_32k_read(struct clocksource *cs)
-{
- return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
-}
-#else
-#define omap44xx_32k_read NULL
-#endif
-
-/*
- * Kernel assumes that sched_clock can be called early but may not have
- * things ready yet.
- */
-static cycle_t omap_32k_read_dummy(struct clocksource *cs)
-{
- return 0;
-}
-
-static struct clocksource clocksource_32k = {
- .name = "32k_counter",
- .rating = 250,
- .read = omap_32k_read_dummy,
- .mask = CLOCKSOURCE_MASK(32),
- .shift = 10,
- .flags = CLOCK_SOURCE_IS_CONTINUOUS,
-};
-
-/*
- * Returns current time from boot in nsecs. It's OK for this to wrap
- * around for now, as it's just a relative time stamp.
- */
-unsigned long long sched_clock(void)
-{
- return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
- clocksource_32k.mult, clocksource_32k.shift);
-}
-
-/**
- * read_persistent_clock - Return time from a persistent clock.
- *
- * Reads the time from a source which isn't disabled during PM, the
- * 32k sync timer. Convert the cycles elapsed since last read into
- * nsecs and adds to a monotonically increasing timespec.
- */
-static struct timespec persistent_ts;
-static cycles_t cycles, last_cycles;
-void read_persistent_clock(struct timespec *ts)
-{
- unsigned long long nsecs;
- cycles_t delta;
- struct timespec *tsp = &persistent_ts;
-
- last_cycles = cycles;
- cycles = clocksource_32k.read(&clocksource_32k);
- delta = cycles - last_cycles;
-
- nsecs = clocksource_cyc2ns(delta,
- clocksource_32k.mult, clocksource_32k.shift);
-
- timespec_add_ns(tsp, nsecs);
- *ts = *tsp;
-}
-
-static int __init omap_init_clocksource_32k(void)
-{
- static char err[] __initdata = KERN_ERR
- "%s: can't register clocksource!\n";
-
- if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
- struct clk *sync_32k_ick;
-
- if (cpu_is_omap16xx())
- clocksource_32k.read = omap16xx_32k_read;
- else if (cpu_is_omap2420())
- clocksource_32k.read = omap2420_32k_read;
- else if (cpu_is_omap2430())
- clocksource_32k.read = omap2430_32k_read;
- else if (cpu_is_omap34xx())
- clocksource_32k.read = omap34xx_32k_read;
- else if (cpu_is_omap44xx())
- clocksource_32k.read = omap44xx_32k_read;
- else
- return -ENODEV;
-
- sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
- if (sync_32k_ick)
- clk_enable(sync_32k_ick);
-
- clocksource_32k.mult = clocksource_hz2mult(32768,
- clocksource_32k.shift);
-
- offset_32k = clocksource_32k.read(&clocksource_32k);
-
- if (clocksource_register(&clocksource_32k))
- printk(err, clocksource_32k.name);
- }
- return 0;
-}
-arch_initcall(omap_init_clocksource_32k);
-
-#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
-
-/* 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);
- omap2_set_globals_sdrc(omap2_globals);
- omap2_set_globals_control(omap2_globals);
- omap2_set_globals_prcm(omap2_globals);
- omap2_set_globals_uart(omap2_globals);
-}
-
-#endif
-
-#if defined(CONFIG_ARCH_OMAP2420)
-
-static struct omap_globals omap242x_globals = {
- .class = OMAP242X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
- .sdrc = OMAP2420_SDRC_BASE,
- .sms = OMAP2420_SMS_BASE,
- .ctrl = OMAP242X_CTRL_BASE,
- .prm = OMAP2420_PRM_BASE,
- .cm = OMAP2420_CM_BASE,
- .uart1_phys = OMAP2_UART1_BASE,
- .uart2_phys = OMAP2_UART2_BASE,
- .uart3_phys = OMAP2_UART3_BASE,
-};
-
-void __init omap2_set_globals_242x(void)
-{
- __omap2_set_globals(&omap242x_globals);
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP2430)
-
-static struct omap_globals omap243x_globals = {
- .class = OMAP243X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
- .sdrc = OMAP243X_SDRC_BASE,
- .sms = OMAP243X_SMS_BASE,
- .ctrl = OMAP243X_CTRL_BASE,
- .prm = OMAP2430_PRM_BASE,
- .cm = OMAP2430_CM_BASE,
- .uart1_phys = OMAP2_UART1_BASE,
- .uart2_phys = OMAP2_UART2_BASE,
- .uart3_phys = OMAP2_UART3_BASE,
-};
-
-void __init omap2_set_globals_243x(void)
-{
- __omap2_set_globals(&omap243x_globals);
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP3)
-
-static struct omap_globals omap3_globals = {
- .class = OMAP343X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
- .sdrc = OMAP343X_SDRC_BASE,
- .sms = OMAP343X_SMS_BASE,
- .ctrl = OMAP343X_CTRL_BASE,
- .prm = OMAP3430_PRM_BASE,
- .cm = OMAP3430_CM_BASE,
- .uart1_phys = OMAP3_UART1_BASE,
- .uart2_phys = OMAP3_UART2_BASE,
- .uart3_phys = OMAP3_UART3_BASE,
- .uart4_phys = OMAP3_UART4_BASE, /* Only on 3630 */
-};
-
-void __init omap2_set_globals_3xxx(void)
-{
- __omap2_set_globals(&omap3_globals);
-}
-
-void __init omap3_map_io(void)
-{
- omap2_set_globals_3xxx();
- omap34xx_map_common_io();
-}
-#endif
-
-#if defined(CONFIG_ARCH_OMAP4)
-static struct omap_globals omap4_globals = {
- .class = OMAP443X_CLASS,
- .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
- .ctrl = OMAP443X_SCM_BASE,
- .ctrl_pad = OMAP443X_CTRL_BASE,
- .prm = OMAP4430_PRM_BASE,
- .cm = OMAP4430_CM_BASE,
- .cm2 = OMAP4430_CM2_BASE,
- .uart1_phys = OMAP4_UART1_BASE,
- .uart2_phys = OMAP4_UART2_BASE,
- .uart3_phys = OMAP4_UART3_BASE,
- .uart4_phys = OMAP4_UART4_BASE,
-};
-
-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_uart(&omap4_globals);
-}
-#endif
-
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
new file mode 100644
index 0000000..155fe43
--- /dev/null
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -0,0 +1,183 @@
+/*
+ * OMAP 32ksynctimer/counter_32k-related code
+ *
+ * Copyright (C) 2009 Texas Instruments
+ * Copyright (C) 2010 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * NOTE: This timer is not the same timer as the old OMAP1 MPU timer.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+
+#include <plat/common.h>
+#include <plat/board.h>
+
+#include <plat/clock.h>
+
+
+/*
+ * 32KHz clocksource ... always available, on pretty most chips except
+ * OMAP 730 and 1510. Other timers could be used as clocksources, with
+ * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
+ * but systems won't necessarily want to spend resources that way.
+ */
+
+#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
+
+#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
+
+#include <linux/clocksource.h>
+
+/*
+ * offset_32k holds the init time counter value. It is then subtracted
+ * from every counter read to achieve a counter that counts time from the
+ * kernel boot (needed for sched_clock()).
+ */
+static u32 offset_32k __read_mostly;
+
+#ifdef CONFIG_ARCH_OMAP16XX
+static cycle_t omap16xx_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
+}
+#else
+#define omap16xx_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2420
+static cycle_t omap2420_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2420_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP2430
+static cycle_t omap2430_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap2430_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static cycle_t omap34xx_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap34xx_32k_read NULL
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static cycle_t omap44xx_32k_read(struct clocksource *cs)
+{
+ return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
+}
+#else
+#define omap44xx_32k_read NULL
+#endif
+
+/*
+ * Kernel assumes that sched_clock can be called early but may not have
+ * things ready yet.
+ */
+static cycle_t omap_32k_read_dummy(struct clocksource *cs)
+{
+ return 0;
+}
+
+static struct clocksource clocksource_32k = {
+ .name = "32k_counter",
+ .rating = 250,
+ .read = omap_32k_read_dummy,
+ .mask = CLOCKSOURCE_MASK(32),
+ .shift = 10,
+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+/*
+ * Returns current time from boot in nsecs. It's OK for this to wrap
+ * around for now, as it's just a relative time stamp.
+ */
+unsigned long long sched_clock(void)
+{
+ return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k),
+ clocksource_32k.mult, clocksource_32k.shift);
+}
+
+/**
+ * read_persistent_clock - Return time from a persistent clock.
+ *
+ * Reads the time from a source which isn't disabled during PM, the
+ * 32k sync timer. Convert the cycles elapsed since last read into
+ * nsecs and adds to a monotonically increasing timespec.
+ */
+static struct timespec persistent_ts;
+static cycles_t cycles, last_cycles;
+void read_persistent_clock(struct timespec *ts)
+{
+ unsigned long long nsecs;
+ cycles_t delta;
+ struct timespec *tsp = &persistent_ts;
+
+ last_cycles = cycles;
+ cycles = clocksource_32k.read(&clocksource_32k);
+ delta = cycles - last_cycles;
+
+ nsecs = clocksource_cyc2ns(delta,
+ clocksource_32k.mult, clocksource_32k.shift);
+
+ timespec_add_ns(tsp, nsecs);
+ *ts = *tsp;
+}
+
+static int __init omap_init_clocksource_32k(void)
+{
+ static char err[] __initdata = KERN_ERR
+ "%s: can't register clocksource!\n";
+
+ if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
+ struct clk *sync_32k_ick;
+
+ if (cpu_is_omap16xx())
+ clocksource_32k.read = omap16xx_32k_read;
+ else if (cpu_is_omap2420())
+ clocksource_32k.read = omap2420_32k_read;
+ else if (cpu_is_omap2430())
+ clocksource_32k.read = omap2430_32k_read;
+ else if (cpu_is_omap34xx())
+ clocksource_32k.read = omap34xx_32k_read;
+ else if (cpu_is_omap44xx())
+ clocksource_32k.read = omap44xx_32k_read;
+ else
+ return -ENODEV;
+
+ sync_32k_ick = clk_get(NULL, "omap_32ksync_ick");
+ if (sync_32k_ick)
+ clk_enable(sync_32k_ick);
+
+ clocksource_32k.mult = clocksource_hz2mult(32768,
+ clocksource_32k.shift);
+
+ offset_32k = clocksource_32k.read(&clocksource_32k);
+
+ if (clocksource_register(&clocksource_32k))
+ printk(err, clocksource_32k.name);
+ }
+ return 0;
+}
+arch_initcall(omap_init_clocksource_32k);
+
+#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
+
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index d1920be..78162a0 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -21,7 +21,6 @@
#include <asm/mach/map.h>
#include <plat/tc.h>
-#include <plat/control.h>
#include <plat/board.h>
#include <plat/mmc.h>
#include <mach/gpio.h>
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 98c86ff..79ce946 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -30,8 +30,6 @@
#include <plat/cpu.h>
#include <plat/vram.h>
-#include <plat/control.h>
-
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
# include "../mach-omap2/prm.h"
# include "../mach-omap2/cm.h"
@@ -68,7 +66,6 @@
#define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
#define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
#define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
-#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
#define GP_DEVICE 0x300
--
1.7.1
^ permalink raw reply related [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 7:28 ` Shilimkar, Santosh
2010-10-04 18:21 ` Tony Lindgren
@ 2010-10-04 19:32 ` Paul Walmsley
2010-10-05 4:37 ` Shilimkar, Santosh
1 sibling, 1 reply; 43+ messages in thread
From: Paul Walmsley @ 2010-10-04 19:32 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 4 Oct 2010, Shilimkar, Santosh wrote:
> > -----Original Message-----
> > From: Balbi, Felipe
> > Sent: Monday, October 04, 2010 12:31 PM
> >
> > On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
> > >
> > >I still have that sitting on my gitorious tree. The patch is attached
> > >to this mail. I compile tested (only) for omap3_defconfig, it probably
> > >needs to start using pm_runtime functions at some point and probably
> > >move to drivers/clocksource instead of arch/arm/plat-omap.
> > >
> > >patch is also available at [1]
> > >
> > >[1] git://gitorious.org/usb/usb.git clksource
> >
> > I made a few changes to make checkpatch.pl --strict happy. Attached
> >
> Good !!
> This patch addresses splitting as well as multi-omap builds and probably
> also a better candidate in case we need to convert sync timer to hwmod
> driver.
>
> Paul, what's your take?
It's great that this is getting cleaned up but it's too late for 2.6.37.
We stop taking new code after -rc6 comes out so we can try to get all of
the changes integrated with each other and fix any bugs.
The best thing for you and Felipe to do is to convert the driver to use
hwmod data and pm_runtime and test on more platforms, then post it to the
list after 2.6.37 comes out.
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 19:32 ` Paul Walmsley
@ 2010-10-05 4:37 ` Shilimkar, Santosh
2010-10-05 4:55 ` Paul Walmsley
0 siblings, 1 reply; 43+ messages in thread
From: Shilimkar, Santosh @ 2010-10-05 4:37 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: Paul Walmsley [mailto:paul at pwsan.com]
> Sent: Tuesday, October 05, 2010 1:02 AM
> To: Shilimkar, Santosh
> Cc: Balbi, Felipe; linux-omap at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org
> Subject: RE: [PATCH 08/10] OMAP: split plat-omap/common.c
>
> On Mon, 4 Oct 2010, Shilimkar, Santosh wrote:
>
> > > -----Original Message-----
> > > From: Balbi, Felipe
> > > Sent: Monday, October 04, 2010 12:31 PM
> > >
> > > On Mon, Oct 04, 2010 at 01:56:24AM -0500, Balbi, Felipe wrote:
> > > >
> > > >I still have that sitting on my gitorious tree. The patch is attached
> > > >to this mail. I compile tested (only) for omap3_defconfig, it
> probably
> > > >needs to start using pm_runtime functions at some point and probably
> > > >move to drivers/clocksource instead of arch/arm/plat-omap.
> > > >
> > > >patch is also available at [1]
> > > >
> > > >[1] git://gitorious.org/usb/usb.git clksource
> > >
> > > I made a few changes to make checkpatch.pl --strict happy. Attached
> > >
> > Good !!
> > This patch addresses splitting as well as multi-omap builds and probably
> > also a better candidate in case we need to convert sync timer to hwmod
> > driver.
> >
> > Paul, what's your take?
>
> It's great that this is getting cleaned up but it's too late for 2.6.37.
> We stop taking new code after -rc6 comes out so we can try to get all of
> the changes integrated with each other and fix any bugs.
>
The patch was lying on the list for quite some time but didn't get much
attention before.
> The best thing for you and Felipe to do is to convert the driver to use
> hwmod data and pm_runtime and test on more platforms, then post it to the
> list after 2.6.37 comes out.
Probably this make sense.
Regards,
Santosh
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-05 4:37 ` Shilimkar, Santosh
@ 2010-10-05 4:55 ` Paul Walmsley
2010-10-05 5:19 ` Shilimkar, Santosh
0 siblings, 1 reply; 43+ messages in thread
From: Paul Walmsley @ 2010-10-05 4:55 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 5 Oct 2010, Shilimkar, Santosh wrote:
> > -----Original Message-----
> > From: Paul Walmsley [mailto:paul at pwsan.com]
> > Sent: Tuesday, October 05, 2010 1:02 AM
> >
> > It's great that this is getting cleaned up but it's too late for 2.6.37.
> > We stop taking new code after -rc6 comes out so we can try to get all of
> > the changes integrated with each other and fix any bugs.
> >
> The patch was lying on the list for quite some time but didn't get much
> attention before.
According to my archives, it looks like Kevin did quite a bit of review on
it and requested that it be converted to use omap_hwmod, after which there
was no response. If it was converted to use hwmod and pm_runtime, it
probably could have gone in with the other hwmod conversions in the .37
merge window.
> > The best thing for you and Felipe to do is to convert the driver to use
> > hwmod data and pm_runtime and test on more platforms, then post it to the
> > list after 2.6.37 comes out.
> Probably this make sense.
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-05 4:55 ` Paul Walmsley
@ 2010-10-05 5:19 ` Shilimkar, Santosh
0 siblings, 0 replies; 43+ messages in thread
From: Shilimkar, Santosh @ 2010-10-05 5:19 UTC (permalink / raw)
To: linux-arm-kernel
> -----Original Message-----
> From: Paul Walmsley [mailto:paul at pwsan.com]
> Sent: Tuesday, October 05, 2010 10:26 AM
> To: Shilimkar, Santosh
> Cc: Balbi, Felipe; khilman at deeprootsystems.com; linux-
> omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> Subject: RE: [PATCH 08/10] OMAP: split plat-omap/common.c
>
> On Tue, 5 Oct 2010, Shilimkar, Santosh wrote:
>
> > > -----Original Message-----
> > > From: Paul Walmsley [mailto:paul at pwsan.com]
> > > Sent: Tuesday, October 05, 2010 1:02 AM
> > >
> > > It's great that this is getting cleaned up but it's too late for
> 2.6.37.
> > > We stop taking new code after -rc6 comes out so we can try to get all
> of
> > > the changes integrated with each other and fix any bugs.
> > >
> > The patch was lying on the list for quite some time but didn't get much
> > attention before.
>
> According to my archives, it looks like Kevin did quite a bit of review on
> it and requested that it be converted to use omap_hwmod, after which there
> was no response. If it was converted to use hwmod and pm_runtime, it
> probably could have gone in with the other hwmod conversions in the .37
> merge window.
>
Thanks Paul. As aligned, the hwmod + runtime is way to go for this one then.
-Santosh
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework
2010-10-01 21:35 ` [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework Paul Walmsley
@ 2010-10-05 8:35 ` Peter Ujfalusi
2010-10-05 9:57 ` Paul Walmsley
0 siblings, 1 reply; 43+ messages in thread
From: Peter Ujfalusi @ 2010-10-05 8:35 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
I have only one question...
On Saturday 02 October 2010 00:35:32 ext Paul Walmsley wrote:
...
> +/* McBSP CLKS source switching function */
> +
> +int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
> +{
> + struct omap_mcbsp *mcbsp;
> + struct clk *fck_src;
> + char *fck_src_name;
> + int r;
> +
> + if (!omap_mcbsp_check_valid_id(id)) {
> + pr_err("%s: Invalid id (%d)\n", __func__, id + 1);
> + return -EINVAL;
> + }
> + mcbsp = id_to_mcbsp_ptr(id);
> +
> + if (fck_src_id == MCBSP_CLKS_PAD_SRC)
> + fck_src_name = "pad_fck";
> + else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
> + fck_src_name = "prcm_fck";
> + else
> + return -EINVAL;
> +
> + fck_src = clk_get(mcbsp->dev, fck_src_name);
> + if (IS_ERR_OR_NULL(fck_src)) {
> + pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
> + fck_src_name);
> + return -EINVAL;
> + }
> +
> + clk_disable(mcbsp->fclk);
> +
> + r = clk_set_parent(mcbsp->fclk, fck_src);
> + if (IS_ERR_VALUE(r)) {
> + pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
> + "clks", fck_src_name);
> + clk_put(fck_src);
> + return -EINVAL;
> + }
> +
> + clk_enable(mcbsp->fclk);
> +
> + clk_put(fck_src);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
...
> static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
> int clk_id, unsigned int freq,
> int dir)
> {
> struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
> struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
> - struct omap_mcbsp_platform_data *pdata = cpu_dai->dev->platform_data;
> int err = 0;
>
> /* The McBSP signal muxing functions are only available on McBSP1 */
> @@ -685,8 +630,20 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct
> snd_soc_dai *cpu_dai, regs->srgr2 |= CLKSM;
> break;
> case OMAP_MCBSP_SYSCLK_CLKS_FCLK:
> + if (cpu_class_is_omap1()) {
> + err = -EINVAL;
> + break;
> + }
> + err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
> + MCBSP_CLKS_PRCM_SRC);
> + break;
> case OMAP_MCBSP_SYSCLK_CLKS_EXT:
> - err = omap_mcbsp_dai_set_clks_src(mcbsp_data, clk_id);
> + if (cpu_class_is_omap1()) {
> + err = 0;
> + break;
> + }
> + err = omap2_mcbsp_set_clks_src(mcbsp_data->bus_id,
> + MCBSP_CLKS_PAD_SRC);
> break;
>
> case OMAP_MCBSP_SYSCLK_CLKX_EXT:
What is the fclk source by default.
What I mean is that most of the machine drivers are not calling the
snd_soc_dai_set_sysclk for the cpu_dai.
It has been by default to prcm_fclk (core_96 or per_96).
Is this still the case after this series?
Do we need to go through the ASoC machine drivers, and need to select explicitly
the prcm_fclk from now on?
--
P?ter
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework
2010-10-05 8:35 ` Peter Ujfalusi
@ 2010-10-05 9:57 ` Paul Walmsley
0 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-05 9:57 UTC (permalink / raw)
To: linux-arm-kernel
Hello Peter,
On Tue, 5 Oct 2010, Peter Ujfalusi wrote:
> What is the fclk source by default.
> What I mean is that most of the machine drivers are not calling the
> snd_soc_dai_set_sysclk for the cpu_dai.
> It has been by default to prcm_fclk (core_96 or per_96).
> Is this still the case after this series?
These patches shouldn't cause any change in behavior in this regard. So
if the ASoC machine driver does not explicitly tell it which clock to use,
it will use whatever the bootloader or board file configured. If the
bootloader or board file didn't configure anything, probably it will use
the chip's default reset setting, which for CONTROL_DEVCONF0.MCBSP1_CLKS
on 34xx, should be the 96MHz "prcm_fclk"[1].
In other words, the clock framework won't change the parent clock unless
the code explicitly tells it to do so, as in the case of the OMAP3 Pandora
ASoC machine driver.
> Do we need to go through the ASoC machine drivers, and need to select
> explicitly the prcm_fclk from now on?
It is a wise thing to do, since one never knows what the bootloader will
do. Probably also wise to explicitly set the CLKR/FSR muxes also.
best regards,
- Paul
1. OMAP34xx TRM rev. ZH, Table 7-79, "CONTROL_DEVCONF0"
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-04 19:15 ` Paul Walmsley
2010-10-04 19:26 ` Paul Walmsley
@ 2010-10-05 11:00 ` Sergei Shtylyov
2010-10-05 15:07 ` Paul Walmsley
1 sibling, 1 reply; 43+ messages in thread
From: Sergei Shtylyov @ 2010-10-05 11:00 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 04-10-2010 23:15, Paul Walmsley wrote:
>>> --- /dev/null
>>> +++ b/arch/arm/plat-omap/32ksynctimer.c
>>> @@ -0,0 +1,184 @@
>>> +/*
>>> + * linux/arch/arm/plat-omap/clocksource.c
>> What name do you want to use? 32ksynctimer.c or clocksource.c?
> Thanks, that's a bug.
And also note that filenames in heading comments have been long discouraged.
WBR, Sergei
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
` (9 preceding siblings ...)
2010-10-01 21:35 ` [PATCH 10/10] OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks Paul Walmsley
@ 2010-10-05 12:52 ` Jarkko Nikula
2010-10-05 18:40 ` Tony Lindgren
10 siblings, 1 reply; 43+ messages in thread
From: Jarkko Nikula @ 2010-10-05 12:52 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 01 Oct 2010 15:34:45 -0600
Paul Walmsley <paul@pwsan.com> wrote:
> mach-omap2 (as the SCM only exists on OMAP2+ systems). The McBSP
> parent fclk and signal muxing changes have received only light
> testing, so any help from OMAP ASoc experts here is appreciated.
>
Looks good to me. I pointed out one bug but as these are already in
linux-omap I sent a fix for it and two minor cleanups [1].
> Paul Walmsley (10):
> OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC
> OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro
> OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases
> OMAP2430: clock: add MCBSP_CLKS node and clkdev aliases
> OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching
> OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c
> OMAP: McBSP: implement functional clock switching via clock framework
> OMAP: split plat-omap/common.c
> OMAP: control: move plat-omap/control.h to mach-omap2/control.h
> OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks
>
Patches 3-5 are doing the right thing AFAIK the OMAP clock framework.
For patches 6-7 you could have my ack.
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
As they are touching also sound/soc/omap/omap-mcbsp.c, an ack from Mark
and Liam are needed. Links to patches 6 and 7 below and my fixes on top
of them [1].
http://marc.info/?l=linux-omap&m=128596931117788&w=2
http://marc.info/?l=linux-omap&m=128596931417805&w=2
--
Jarkko
1. http://marc.info/?l=linux-omap&m=128628175107214&w=2
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 08/10] OMAP: split plat-omap/common.c
2010-10-05 11:00 ` Sergei Shtylyov
@ 2010-10-05 15:07 ` Paul Walmsley
0 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-05 15:07 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 5 Oct 2010, Sergei Shtylyov wrote:
> Hello.
>
> On 04-10-2010 23:15, Paul Walmsley wrote:
>
> > > > --- /dev/null
> > > > +++ b/arch/arm/plat-omap/32ksynctimer.c
> > > > @@ -0,0 +1,184 @@
> > > > +/*
> > > > + * linux/arch/arm/plat-omap/clocksource.c
>
> > > What name do you want to use? 32ksynctimer.c or clocksource.c?
>
> > Thanks, that's a bug.
>
> And also note that filenames in heading comments have been long
> discouraged.
Yeah, I dropped that from the updated patch, that was a pointless attempt
at consistency with the old code.
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-05 12:52 ` [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Jarkko Nikula
@ 2010-10-05 18:40 ` Tony Lindgren
2010-10-06 5:42 ` Peter Ujfalusi
0 siblings, 1 reply; 43+ messages in thread
From: Tony Lindgren @ 2010-10-05 18:40 UTC (permalink / raw)
To: linux-arm-kernel
* Jarkko Nikula <jhnikula@gmail.com> [101005 05:43]:
> On Fri, 01 Oct 2010 15:34:45 -0600
> Paul Walmsley <paul@pwsan.com> wrote:
>
> > mach-omap2 (as the SCM only exists on OMAP2+ systems). The McBSP
> > parent fclk and signal muxing changes have received only light
> > testing, so any help from OMAP ASoc experts here is appreciated.
> >
> Looks good to me. I pointed out one bug but as these are already in
> linux-omap I sent a fix for it and two minor cleanups [1].
>
> > Paul Walmsley (10):
> > OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC
> > OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro
> > OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases
> > OMAP2430: clock: add MCBSP_CLKS node and clkdev aliases
> > OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching
> > OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c
> > OMAP: McBSP: implement functional clock switching via clock framework
> > OMAP: split plat-omap/common.c
> > OMAP: control: move plat-omap/control.h to mach-omap2/control.h
> > OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks
> >
> Patches 3-5 are doing the right thing AFAIK the OMAP clock framework.
>
> For patches 6-7 you could have my ack.
> Acked-by: Jarkko Nikula <jhnikula@gmail.com>
>
> As they are touching also sound/soc/omap/omap-mcbsp.c, an ack from Mark
> and Liam are needed. Links to patches 6 and 7 below and my fixes on top
> of them [1].
>
> http://marc.info/?l=linux-omap&m=128596931117788&w=2
> http://marc.info/?l=linux-omap&m=128596931417805&w=2
Sorry, I've already merged them as they fixed code that did not compile.
Let me know if you guys want me to rebuild those parts of omap-for-linus
to add the acks.
Tony
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-05 18:40 ` Tony Lindgren
@ 2010-10-06 5:42 ` Peter Ujfalusi
2010-10-06 14:48 ` Tony Lindgren
0 siblings, 1 reply; 43+ messages in thread
From: Peter Ujfalusi @ 2010-10-06 5:42 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 05 October 2010 21:40:17 ext Tony Lindgren wrote:
...
> > For patches 6-7 you could have my ack.
> > Acked-by: Jarkko Nikula <jhnikula@gmail.com>
> >
> > As they are touching also sound/soc/omap/omap-mcbsp.c, an ack from Mark
> > and Liam are needed. Links to patches 6 and 7 below and my fixes on top
> > of them [1].
> >
> > http://marc.info/?l=linux-omap&m=128596931117788&w=2
> > http://marc.info/?l=linux-omap&m=128596931417805&w=2
>
> Sorry, I've already merged them as they fixed code that did not compile.
>
> Let me know if you guys want me to rebuild those parts of omap-for-linus
> to add the acks.
If you decide to rebuild, than you can add my (for patch 6-7):
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
--
P?ter
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-06 5:42 ` Peter Ujfalusi
@ 2010-10-06 14:48 ` Tony Lindgren
2010-10-06 15:08 ` Liam Girdwood
2010-10-06 16:33 ` Mark Brown
0 siblings, 2 replies; 43+ messages in thread
From: Tony Lindgren @ 2010-10-06 14:48 UTC (permalink / raw)
To: linux-arm-kernel
* Peter Ujfalusi <peter.ujfalusi@nokia.com> [101005 22:33]:
> On Tuesday 05 October 2010 21:40:17 ext Tony Lindgren wrote:
>
> ...
>
> > > For patches 6-7 you could have my ack.
> > > Acked-by: Jarkko Nikula <jhnikula@gmail.com>
> > >
> > > As they are touching also sound/soc/omap/omap-mcbsp.c, an ack from Mark
> > > and Liam are needed. Links to patches 6 and 7 below and my fixes on top
> > > of them [1].
> > >
> > > http://marc.info/?l=linux-omap&m=128596931117788&w=2
> > > http://marc.info/?l=linux-omap&m=128596931417805&w=2
> >
> > Sorry, I've already merged them as they fixed code that did not compile.
> >
> > Let me know if you guys want me to rebuild those parts of omap-for-linus
> > to add the acks.
>
> If you decide to rebuild, than you can add my (for patch 6-7):
> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
OK, let's do that then we should still have some time left before the
merge window.
Mark & Liam, care to ack as well?
Regards,
Tony
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-06 14:48 ` Tony Lindgren
@ 2010-10-06 15:08 ` Liam Girdwood
2010-10-06 18:57 ` Paul Walmsley
2010-10-06 16:33 ` Mark Brown
1 sibling, 1 reply; 43+ messages in thread
From: Liam Girdwood @ 2010-10-06 15:08 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 2010-10-06 at 07:48 -0700, Tony Lindgren wrote:
> * Peter Ujfalusi <peter.ujfalusi@nokia.com> [101005 22:33]:
> > On Tuesday 05 October 2010 21:40:17 ext Tony Lindgren wrote:
> >
> > ...
> >
> > > > For patches 6-7 you could have my ack.
> > > > Acked-by: Jarkko Nikula <jhnikula@gmail.com>
> > > >
> > > > As they are touching also sound/soc/omap/omap-mcbsp.c, an ack from Mark
> > > > and Liam are needed. Links to patches 6 and 7 below and my fixes on top
> > > > of them [1].
> > > >
> > > > http://marc.info/?l=linux-omap&m=128596931117788&w=2
> > > > http://marc.info/?l=linux-omap&m=128596931417805&w=2
> > >
> > > Sorry, I've already merged them as they fixed code that did not compile.
> > >
> > > Let me know if you guys want me to rebuild those parts of omap-for-linus
> > > to add the acks.
> >
> > If you decide to rebuild, than you can add my (for patch 6-7):
> > Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
>
> OK, let's do that then we should still have some time left before the
> merge window.
>
> Mark & Liam, care to ack as well?
>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Thanks
Liam
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-06 14:48 ` Tony Lindgren
2010-10-06 15:08 ` Liam Girdwood
@ 2010-10-06 16:33 ` Mark Brown
1 sibling, 0 replies; 43+ messages in thread
From: Mark Brown @ 2010-10-06 16:33 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Oct 06, 2010 at 07:48:07AM -0700, Tony Lindgren wrote:
> OK, let's do that then we should still have some time left before the
> merge window.
> Mark & Liam, care to ack as well?
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37
2010-10-06 15:08 ` Liam Girdwood
@ 2010-10-06 18:57 ` Paul Walmsley
0 siblings, 0 replies; 43+ messages in thread
From: Paul Walmsley @ 2010-10-06 18:57 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Wed, 6 Oct 2010, Liam Girdwood wrote:
> On Wed, 2010-10-06 at 07:48 -0700, Tony Lindgren wrote:
> > * Peter Ujfalusi <peter.ujfalusi@nokia.com> [101005 22:33]:
> > > On Tuesday 05 October 2010 21:40:17 ext Tony Lindgren wrote:
> > >
> > > ...
> > >
> > > > > For patches 6-7 you could have my ack.
> > > > > Acked-by: Jarkko Nikula <jhnikula@gmail.com>
> > > > >
> > > > > As they are touching also sound/soc/omap/omap-mcbsp.c, an ack from Mark
> > > > > and Liam are needed. Links to patches 6 and 7 below and my fixes on top
> > > > > of them [1].
> > > > >
> > > > > http://marc.info/?l=linux-omap&m=128596931117788&w=2
> > > > > http://marc.info/?l=linux-omap&m=128596931417805&w=2
> > > >
> > > > Sorry, I've already merged them as they fixed code that did not compile.
> > > >
> > > > Let me know if you guys want me to rebuild those parts of omap-for-linus
> > > > to add the acks.
> > >
> > > If you decide to rebuild, than you can add my (for patch 6-7):
> > > Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> >
> > OK, let's do that then we should still have some time left before the
> > merge window.
> >
> > Mark & Liam, care to ack as well?
> >
>
> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Okay, acks from Liam, Mark, Peter, and Jarkko have been added to patches 6
and 7. Also, acks from Peter have been added to Jarkko's three patches.
Jarkko's three patches have been added on to the original ten. Will send
out an updated pull request shortly.
- Paul
^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2010-10-06 18:57 UTC | newest]
Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 21:34 [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Paul Walmsley
2010-10-01 21:34 ` [PATCH 01/10] OMAP2+: Kconfig: disallow builds for boards that don't use the currently-selected SoC Paul Walmsley
2010-10-04 4:21 ` Varadarajan, Charulatha
2010-10-04 5:45 ` Paul Walmsley
2010-10-01 21:34 ` [PATCH 02/10] OMAP2420: CTRL: fix OMAP242X_CTRL_REGADDR macro Paul Walmsley
2010-10-01 21:34 ` [PATCH 03/10] OMAP2420: clock: add MCBSP_CLKS node and clkdev aliases Paul Walmsley
2010-10-01 21:35 ` [PATCH 04/10] OMAP2430: " Paul Walmsley
2010-10-01 21:35 ` [PATCH 05/10] OMAP3xxx: clock: add clkdev aliases for McBSP fclk source switching Paul Walmsley
2010-10-01 21:35 ` [PATCH 06/10] OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c Paul Walmsley
2010-10-01 21:35 ` [PATCH 07/10] OMAP: McBSP: implement functional clock switching via clock framework Paul Walmsley
2010-10-05 8:35 ` Peter Ujfalusi
2010-10-05 9:57 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 08/10] OMAP: split plat-omap/common.c Paul Walmsley
2010-10-04 5:34 ` Shilimkar, Santosh
2010-10-04 6:56 ` Felipe Balbi
2010-10-04 7:00 ` Felipe Balbi
2010-10-04 7:28 ` Shilimkar, Santosh
2010-10-04 18:21 ` Tony Lindgren
2010-10-04 19:32 ` Paul Walmsley
2010-10-05 4:37 ` Shilimkar, Santosh
2010-10-05 4:55 ` Paul Walmsley
2010-10-05 5:19 ` Shilimkar, Santosh
2010-10-04 5:38 ` Varadarajan, Charulatha
2010-10-04 6:03 ` Paul Walmsley
2010-10-04 8:28 ` Varadarajan, Charulatha
2010-10-04 18:27 ` Tony Lindgren
2010-10-04 19:24 ` Paul Walmsley
2010-10-04 9:08 ` Cousson, Benoit
2010-10-04 9:35 ` DebBarma, Tarun Kanti
2010-10-04 9:54 ` Cousson, Benoit
2010-10-04 19:15 ` Paul Walmsley
2010-10-04 19:26 ` Paul Walmsley
2010-10-05 11:00 ` Sergei Shtylyov
2010-10-05 15:07 ` Paul Walmsley
2010-10-01 21:35 ` [PATCH 09/10] OMAP: control: move plat-omap/control.h to mach-omap2/control.h Paul Walmsley
2010-10-01 21:35 ` [PATCH 10/10] OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks Paul Walmsley
2010-10-05 12:52 ` [PATCH 00/10] OMAP: SCM/McBSP/clock: branch integration patches for 2.6.37 Jarkko Nikula
2010-10-05 18:40 ` Tony Lindgren
2010-10-06 5:42 ` Peter Ujfalusi
2010-10-06 14:48 ` Tony Lindgren
2010-10-06 15:08 ` Liam Girdwood
2010-10-06 18:57 ` Paul Walmsley
2010-10-06 16:33 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).