Skip to contentSkip to conversation

ARM: mach-shmobile: initial sh7372 clock framework

PATCH New Magnus Damm 1 participant 1 message Mar 25, 2010

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

PATCH 6/6 ARM: mach-shmobile: initial sh7372 clock framework

From: Magnus Damm <[email protected]>

Add initial sh7372 clock framework support to SH-Mobile ARM. The implementation is far from complete but is enough to dynamically deal with module stop bits for CMT1, SDHI and KEYSC.

The peripheral clock is kept as a static dummy clock to satisfy the code in sh-sci.c.

Clock parent selection, z_clk and support for 99% of the module stop bits are still on the TODO.

Also, move the clock framework init time to later to deal with the fact that the new clock framework code is using kmalloc().

---

 arch/arm/mach-shmobile/Kconfig               |    2 
 arch/arm/mach-shmobile/Makefile              |    2 
 arch/arm/mach-shmobile/board-ap4evb.c        |   16 +
 arch/arm/mach-shmobile/clock-sh7372.c        |  297 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    1 
 arch/arm/mach-shmobile/setup-sh7372.c        |    2 
 6 files changed, 314 insertions(+), 6 deletions(-)
arch/arm/mach-shmobile/Kconfig +1 -1
@@ -22,7 +22,7 @@ config ARCH_SH7372
 	bool "SH-Mobile AP4 (SH7372)"
 	select CPU_V7
 	select HAVE_CLK
-	select COMMON_CLKDEV
+	select SH_CLK_CPG
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 
arch/arm/mach-shmobile/Makefile +14 -4
@@ -13,7 +13,7 @@ obj-$(CONFIG_ARCH_SH7372)	+= setup-sh737
 # Clock framework
 clk-$(CONFIG_ARCH_SH7367)	+ clk-$(CONFIG_ARCH_SH7377)	+-clk-$(CONFIG_ARCH_SH7372)	++clk-$(CONFIG_ARCH_SH7372)	+= clock-sh7372.o
 obj-$(CONFIG_SH_CLK_CPG)	+= $(clk-y) clock.o
 
 obj-$(CONFIG_COMMON_CLKDEV)	+= clock-sh7367.o
--- 0001/arch/arm/mach-shmobile/board-ap4evb.c
+++ work/arch/arm/mach-shmobile/board-ap4evb.c	2010-03-25 15:04:45.000000000 +0900
@@ -36,6 +36,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <asm/mach/time.h>
 
 /*
  * Address	Interface		BusWidth	note
@@ -250,9 +251,8 @@ static void __init ap4evb_map_io(void)
 {
 	iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
 
-	/* setup early devices, clocks and console here as well */
+	/* setup early devices and console here as well */
 	sh7372_add_early_devices();
-	sh7367_clock_init(); /* use g3 clocks for now */
 	shmobile_setup_console();
 }
 
@@ -323,11 +323,21 @@ static void __init ap4evb_init(void)
 	platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
 }
 
+static void __init ap4evb_timer_init(void)
+{
+	sh7372_clock_init();
+	shmobile_timer.init();
+}
+
+static struct sys_timer ap4evb_timer = {
+	.init		= ap4evb_timer_init,
+};
+
 MACHINE_START(AP4EVB, "ap4evb")
 	.phys_io	= 0xe6000000,
 	.io_pg_offst	= ((0xe6000000) >> 18) & 0xfffc,
 	.map_io		= ap4evb_map_io,
 	.init_irq	= sh7372_init_irq,
 	.init_machine	= ap4evb_init,
-	.timer		= &shmobile_timer,
+	.timer		= &ap4evb_timer,
 MACHINE_END
arch/arm/mach-shmobile/clock-sh7372.c new file +297 -0

297 lines not on this page · raw message

arch/arm/mach-shmobile/include/mach/common.h +1 -0
@@ -18,6 +18,7 @@ extern void sh7377_pinmux_init(void);
 extern void sh7372_init_irq(void);
 extern void sh7372_add_early_devices(void);
 extern void sh7372_add_standard_devices(void);
+extern void sh7372_clock_init(void);
 extern void sh7372_pinmux_init(void);
 
 #endif /* __ARCH_MACH_COMMON_H */
arch/arm/mach-shmobile/setup-sh7372.c +1 -1
@@ -141,7 +141,7 @@ static struct sh_timer_config cmt10_plat
 	.name = "CMT10",
 	.channel_offset = 0x10,
 	.timer_bit = 0,
-	.clk = "r_clk",
+	.clk = "cmt1",
 	.clockevent_rating = 125,
 	.clocksource_rating = 125,
 };