Skip to contentSkip to conversation

ARM: S3C24XX: convert s3c2412 to common clock framework

PATCH New Heiko Stübner 1 participant 4 messages Jan 1, 2014

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

cover ARM: S3C24XX: convert s3c2412 to common clock framework

This series concludes the move of s3c24xx to the common clock framework by converting the only remaining cpu-type s3c2412/s3c2413.

The plls are the same as on the s3c2440/s3c2442 so no new types need to be introduced.

As before the conversion is done by a mix of datasheet data and the pre-existing clock code and as this time I have no hardware of this type, it is compile-tested only. So hopefully somebody with s3c2412 hw will be able to test it for real.

The only thing left now is to grab a broom and remove the now unused remnants of the legacy clock from s3c24xx.

Heiko Stuebner (3):
dt-bindings: add documentation for s3c2412 clock controller
clk: samsung: add clock controller driver for s3c2412
ARM: S3C24XX: convert s3c2412 to common clock framework

 .../bindings/clock/samsung,s3c2412-clock.txt       |   51 ++
 arch/arm/mach-s3c24xx/Kconfig                      |    8 +-
 arch/arm/mach-s3c24xx/Makefile                     |    2 +-
 arch/arm/mach-s3c24xx/clock-s3c2412.c              |  761 --------------------
 arch/arm/mach-s3c24xx/common.c                     |    9 +-
 arch/arm/mach-s3c24xx/common.h                     |    4 +
 arch/arm/mach-s3c24xx/mach-jive.c                  |    9 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c              |    9 +-
 arch/arm/mach-s3c24xx/mach-vstms.c                 |    9 +-
 arch/arm/mach-s3c24xx/s3c2412.c                    |   43 --
 drivers/clk/samsung/Makefile                       |    1 +
 drivers/clk/samsung/clk-s3c2412.c                  |  221 ++++++
 include/dt-bindings/clock/samsung,s3c2412-clock.h  |   73 ++
 13 files changed, 386 insertions(+), 814 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/samsung,s3c2412-clock.txt
 delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2412.c
 create mode 100644 drivers/clk/samsung/clk-s3c2412.c
 create mode 100644 include/dt-bindings/clock/samsung,s3c2412-clock.h
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/3 dt-bindings: add documentation for s3c2412 clock controller

Describe the clock controller of the s3c2412.

---
 .../bindings/clock/samsung,s3c2412-clock.txt       |   51 ++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/samsung,s3c2412-clock.txt
Documentation/devicetree/bindings/clock/samsung,s3c2412-clock.txt new file +50 -0
new file mode 100644
index 0000000..dfc25fe
@@ -0,0 +1,50 @@
+* Samsung S3C2412 Clock Controller
+
+The S3C2412 clock controller generates and supplies clock to various controllers
+within the SoC. The clock binding described here is applicable to the s3c2412
+and s3c2413 SoCs in the s3c24x family.
+
+Required Properties:
+
+- compatible: should be "samsung,s3c2412-clock"
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- #clock-cells: should be 1.
+
+Each clock is assigned an identifier and client nodes can use this identifier
+to specify the clock which they consume. Some of the clocks are available only
+on a particular SoC.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/samsung,s3c2412-clock.h header and can be used in device
+tree sources.
+
+External clocks:
+
+There are several clocks that are generated outside the SoC. It is expected
+that they are defined using standard clock bindings with following
+clock-output-names:
+ - "xti" - crystal input - required,
+ - "ext" - external clock source - optional,
+
+Example: Clock controller node:
+
+	clocks: clock-controller at 4c000000 {
+		compatible = "samsung,s3c2412-clock";
+		reg = <0x4c000000 0x20>;
+		#clock-cells = <1>;
+	};
+
+Example: UART controller node that consumes the clock generated by the clock
+  controller (refer to the standard clock bindings for information about
+  "clocks" and "clock-names" properties):
+
+	serial at 50004000 {
+		compatible = "samsung,s3c2412-uart";
+		reg = <0x50004000 0x4000>;
+		interrupts = <1 23 3 4>, <1 23 4 4>;
+		clock-names = "uart", "clk_uart_baud2", "clk_uart_baud3";
+		clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
+			 <&clocks SCLK_UART>;
+		status = "disabled";
+	};
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/3 clk: samsung: add clock controller driver for s3c2412

In reply to Heiko Stübner

This driver can handle the clock controller in the s3c2412 soc.

The clock structure is built according to the manuals of the included SoCs and might include changes in comparison to the previous clock structure.

---
 drivers/clk/samsung/Makefile                      |    1 +
 drivers/clk/samsung/clk-s3c2412.c                 |  221 +++++++++++++++++++++
 include/dt-bindings/clock/samsung,s3c2412-clock.h |   73 +++++++
 3 files changed, 295 insertions(+)
 create mode 100644 drivers/clk/samsung/clk-s3c2412.c
 create mode 100644 include/dt-bindings/clock/samsung,s3c2412-clock.h
drivers/clk/samsung/Makefile +1 -0
index 1731900..5248c27 100644
@@ -11,5 +11,6 @@ obj-$(CONFIG_SOC_EXYNOS5440)	+= clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)	+= clk-exynos-audss.o
 obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
 obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o
+obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o
 obj-$(CONFIG_S3C2443_COMMON_CLK)+= clk-s3c2443.o
 obj-$(CONFIG_ARCH_S3C64XX)	+= clk-s3c64xx.o
drivers/clk/samsung/clk-s3c2412.c new file +221 -0

221 lines not on this page · raw message

include/dt-bindings/clock/samsung,s3c2412-clock.h new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/3 ARM: S3C24XX: convert s3c2412 to common clock framework

In reply to Heiko Stübner

Convert all machines using these cpus to use the ccf clock driver instead of the legacy Samsung clock implementation.

---
 arch/arm/mach-s3c24xx/Kconfig         |    8 +-
 arch/arm/mach-s3c24xx/Makefile        |    2 +-
 arch/arm/mach-s3c24xx/clock-s3c2412.c |  761 ---------------------------------
 arch/arm/mach-s3c24xx/common.c        |    9 +-
 arch/arm/mach-s3c24xx/common.h        |    4 +
 arch/arm/mach-s3c24xx/mach-jive.c     |    9 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c |    9 +-
 arch/arm/mach-s3c24xx/mach-vstms.c    |    9 +-
 arch/arm/mach-s3c24xx/s3c2412.c       |   43 --
 9 files changed, 40 insertions(+), 814 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2412.c
arch/arm/mach-s3c24xx/Kconfig +7 -1
index 075780e..e19e314 100644
@@ -51,9 +51,10 @@ config CPU_S3C2410
 
 config CPU_S3C2412
 	bool "SAMSUNG S3C2412"
-	depends on SAMSUNG_CLOCK
+	select COMMON_CLK
 	select CPU_ARM926T
 	select CPU_LLSERIAL_S3C2440
+	select S3C2412_COMMON_CLK
 	select S3C2412_DMA if S3C24XX_DMA
 	select S3C2412_PM if PM
 	help
@@ -387,6 +388,11 @@ config S3C2412_PM_SLEEP
 
 if CPU_S3C2412
 
+config S3C2412_COMMON_CLK
+	bool
+	help
+	  Build the s3c2412 clock driver based on the common clock framework.
+
 config CPU_S3C2412_ONLY
 	bool
 	depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \
arch/arm/mach-s3c24xx/Makefile +1 -1
index 51d9578..2235d0d 100644
@@ -21,7 +21,7 @@ obj-$(CONFIG_S3C2410_DMA)	+= dma-s3c2410.o
 obj-$(CONFIG_S3C2410_PLL)	+= pll-s3c2410.o
 obj-$(CONFIG_S3C2410_PM)	+= pm-s3c2410.o sleep-s3c2410.o
 
-obj-$(CONFIG_CPU_S3C2412)	+= s3c2412.o clock-s3c2412.o
+obj-$(CONFIG_CPU_S3C2412)	+= s3c2412.o
 obj-$(CONFIG_S3C2412_DMA)	+= dma-s3c2412.o
 obj-$(CONFIG_S3C2412_PM)	+= pm-s3c2412.o
 obj-$(CONFIG_S3C2412_PM_SLEEP)	+= sleep-s3c2412.o
arch/arm/mach-s3c24xx/clock-s3c2412.c deleted +0 -761

761 lines not on this page · raw message

arch/arm/mach-s3c24xx/common.c +7 -2
index 29f5812..a7b1269 100644
@@ -122,7 +122,6 @@ static struct cpu_table cpu_ids[] __initdata = {
 		.idcode		= 0x32412001,
 		.idmask		= 0xffffffff,
 		.map_io		= s3c2412_map_io,
-		.init_clocks	= s3c2412_init_clocks,
 		.init_uarts	= s3c2412_init_uarts,
 		.init		= s3c2412_init,
 		.name		= name_s3c2412,
@@ -131,7 +130,6 @@ static struct cpu_table cpu_ids[] __initdata = {
 		.idcode		= 0x32412003,
 		.idmask		= 0xffffffff,
 		.map_io		= s3c2412_map_io,
-		.init_clocks	= s3c2412_init_clocks,
 		.init_uarts	= s3c2412_init_uarts,
 		.init		= s3c2412_init,
 		.name		= name_s3c2412,
@@ -539,6 +537,13 @@ void __init s3c2410_init_clocks(int xtal)
 }
 #endif
 
+#ifdef CONFIG_CPU_S3C2412
+void __init s3c2412_init_clocks(int xtal)
+{
+	s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
+}
+#endif
+
 #ifdef CONFIG_CPU_S3C2416
 void __init s3c2416_init_clocks(int xtal)
 {
arch/arm/mach-s3c24xx/common.h +4 -0
index 30124d1d..0f548c5 100644
@@ -121,6 +121,10 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
 				    int current_soc,
 				    void __iomem *reg_base);
 #endif
+#ifdef CONFIG_S3C2412_COMMON_CLK
+void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
+				    unsigned long ext_f, void __iomem *reg_base);
+#endif
 #ifdef CONFIG_S3C2443_COMMON_CLK
 void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
 				    int current_soc,
arch/arm/mach-s3c24xx/mach-jive.c +7 -2
index 43c23e2..6c1a34f 100644
@@ -506,11 +506,16 @@ static struct syscore_ops jive_pm_syscore_ops = {
 static void __init jive_map_io(void)
 {
 	s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
-	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
 	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
+static void __init jive_init_time(void)
+{
+	s3c2412_init_clocks(12000000);
+	samsung_timer_init();
+}
+
 static void jive_power_off(void)
 {
 	printk(KERN_INFO "powering system down...\n");
@@ -664,6 +669,6 @@ MACHINE_START(JIVE, "JIVE")
 	.init_irq	= s3c2412_init_irq,
 	.map_io		= jive_map_io,
 	.init_machine	= jive_machine_init,
-	.init_time	= samsung_timer_init,
+	.init_time	= jive_init_time,
 	.restart	= s3c2412_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/mach-smdk2413.c +7 -2
index c9d31ef..cb1a0c7 100644
@@ -105,11 +105,16 @@ static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
 static void __init smdk2413_map_io(void)
 {
 	s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
-	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
 	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
+static void __init smdk2413_init_time(void)
+{
+	s3c2412_init_clocks(12000000);
+	samsung_timer_init();
+}
+
 static void __init smdk2413_machine_init(void)
 {	/* Turn off suspend on both USB ports, and switch the
 	 * selectable USB port to USB device mode. */
@@ -158,6 +163,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
 	.init_irq	= s3c2412_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
-	.init_time	= samsung_timer_init,
+	.init_time	= smdk2413_init_time,
 	.restart	= s3c2412_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/mach-vstms.c +7 -2
index f7ec9c5..d4ebaf4 100644
@@ -142,11 +142,16 @@ static void __init vstms_fixup(struct tag *tags, char **cmdline,
 static void __init vstms_map_io(void)
 {
 	s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
-	s3c24xx_init_clocks(12000000);
 	s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
 	samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
 }
 
+static void __init vstms_init_time(void)
+{
+	s3c2412_init_clocks(12000000);
+	samsung_timer_init();
+}
+
 static void __init vstms_init(void)
 {
 	s3c_i2c0_set_platdata(NULL);
@@ -162,6 +167,6 @@ MACHINE_START(VSTMS, "VSTMS")
 	.init_irq	= s3c2412_init_irq,
 	.init_machine	= vstms_init,
 	.map_io		= vstms_map_io,
-	.init_time	= samsung_timer_init,
+	.init_time	= vstms_init_time,
 	.restart	= s3c2412_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/s3c2412.c +0 -43

49 lines not on this page · raw message

Signature · 1 line
1.7.10.4