ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
Subsystems (6)
v3 cover ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
Resurrecting this series again after to much time.
Changed is the pll registration to follow the new system and getting the external clocks from dt fixed-rate clocks.
Hopefully I did address all comments received for v2 in july.
Tested on both non-dt and dt s3c2416. As s3c2443 is working the same way it should work, but is only compile tested.
Heiko Stuebner (5):
clk: samsung: add pll_6552 variant for s3c2416
clk: samsung: add plls used by the s3c2443
dt-bindings: add binding for clock-controller of s3c2443 and following
clk: samsung: add clock-driver for s3c2416, s3c2443 and s3c2450
ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
.../bindings/clock/samsung,s3c2443-clock.txt | 46 ++ arch/arm/boot/dts/s3c2416-smdk2416.dts | 9 + arch/arm/boot/dts/s3c2416.dtsi | 48 ++ arch/arm/mach-s3c24xx/Kconfig | 14 +- arch/arm/mach-s3c24xx/Makefile | 5 +- arch/arm/mach-s3c24xx/clock-s3c2416.c | 171 ----- arch/arm/mach-s3c24xx/clock-s3c2443.c | 212 ------ arch/arm/mach-s3c24xx/common-s3c2443.c | 675 -------------------- arch/arm/mach-s3c24xx/common.c | 16 +- arch/arm/mach-s3c24xx/common.h | 6 + arch/arm/mach-s3c24xx/mach-s3c2416-dt.c | 39 +- arch/arm/mach-s3c24xx/mach-smdk2416.c | 9 +- arch/arm/mach-s3c24xx/mach-smdk2443.c | 9 +- drivers/clk/samsung/Makefile | 1 + drivers/clk/samsung/clk-pll.c | 84 ++- drivers/clk/samsung/clk-pll.h | 3 + drivers/clk/samsung/clk-s3c2443.c | 417 ++++++++++++ include/dt-bindings/clock/samsung,s3c2443-clock.h | 92 +++ 18 files changed, 742 insertions(+), 1114 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2416.c delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2443.c delete mode 100644 arch/arm/mach-s3c24xx/common-s3c2443.c create mode 100644 drivers/clk/samsung/clk-s3c2443.c create mode 100644 include/dt-bindings/clock/samsung,s3c2443-clock.h
Signature · 1 line
1.7.10.4
PATCH v3 1/5 clk: samsung: add pll_6552 variant for s3c2416
According to the manual s3c2416 and s3c2450 use a pll 6552 and 6553 and while the pll_6553 matches exactly the one already implemented the pll_6552 differs to the one from the s3c64xx series.
The change is solely in the bit locations of the mdiv and pdiv values. All calculations are the same for both implementatons and even the proposed divider-values for specific frequencies in the manuals are the same.
Therefore implement a variant that simply uses the changed bit locations if necessary.
--- drivers/clk/samsung/clk-pll.c | 12 ++++++++++-- drivers/clk/samsung/clk-pll.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/clk/samsung/clk-pll.c +10 -2
@@ -564,7 +564,9 @@ static const struct clk_ops samsung_pll46xx_clk_min_ops = {#define PLL6552_PDIV_MASK 0x3f#define PLL6552_SDIV_MASK 0x7#define PLL6552_MDIV_SHIFT 16 +#define PLL6552_MDIV_SHIFT_2416 14#define PLL6552_PDIV_SHIFT 8 +#define PLL6552_PDIV_SHIFT_2416 5#define PLL6552_SDIV_SHIFT 0 static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw,
@@ -575,8 +577,13 @@ static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw,u64 fvco = parent_rate; pll_con =__raw_readl (pll->con_reg); - mdiv = (pll_con >>PLL6552_MDIV_SHIFT ) &PLL6552_MDIV_MASK ; - pdiv = (pll_con >>PLL6552_PDIV_SHIFT ) &PLL6552_PDIV_MASK ; +if (pll->type == pll_6552_s3c2416) { + mdiv = (pll_con >>PLL6552_MDIV_SHIFT_2416 ) &PLL6552_MDIV_MASK ; + pdiv = (pll_con >>PLL6552_PDIV_SHIFT_2416 ) &PLL6552_PDIV_MASK ; + }else { + mdiv = (pll_con >>PLL6552_MDIV_SHIFT ) &PLL6552_MDIV_MASK ; + pdiv = (pll_con >>PLL6552_PDIV_SHIFT ) &PLL6552_PDIV_MASK ; + } sdiv = (pll_con >>PLL6552_SDIV_SHIFT ) &PLL6552_SDIV_MASK ; fvco *= mdiv;
@@ -773,6 +780,7 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk, init.ops = &samsung_pll36xx_clk_ops;break ;case pll_6552: +case pll_6552_s3c2416: init.ops = &samsung_pll6552_clk_ops;break ;case pll_6553:
drivers/clk/samsung/clk-pll.h +1 -0
@@ -24,6 +24,7 @@ enum samsung_pll_type { pll_4650, pll_4650c, pll_6552, + pll_6552_s3c2416, pll_6553, };
Signature · 1 line
1.7.10.4
PATCH v3 2/5 clk: samsung: add plls used by the s3c2443
In reply to Heiko StübnerThe s3c2443 uses different plls that are not present yet. Therefore add the two needed types.
--- drivers/clk/samsung/clk-pll.c | 72 +++++++++++++++++++++++++++++++++++++++++ drivers/clk/samsung/clk-pll.h | 2 ++ 2 files changed, 74 insertions(+)
drivers/clk/samsung/clk-pll.c +72 -0
@@ -59,6 +59,72 @@ static long samsung_pll_round_rate(struct clk_hw *hw, }/* +* PLL2126 Clock Type +*/ + +#define PLL2126_MDIV_MASK (0xff) +#define PLL2126_PDIV_MASK (0x3f) +#define PLL2126_SDIV_MASK (0x3) +#define PLL2126_MDIV_SHIFT (16) +#define PLL2126_PDIV_SHIFT (8) +#define PLL2126_SDIV_SHIFT (0) + +static unsigned long samsung_pll2126_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct samsung_clk_pll *pll =to_clk_pll (hw); +u32 pll_con, mdiv, pdiv, sdiv; +u64 fvco = parent_rate; + + pll_con =__raw_readl (pll->con_reg); + mdiv = (pll_con >>PLL2126_MDIV_SHIFT ) &PLL2126_MDIV_MASK ; + pdiv = (pll_con >>PLL2126_PDIV_SHIFT ) &PLL2126_PDIV_MASK ; + sdiv = (pll_con >>PLL2126_SDIV_SHIFT ) &PLL2126_SDIV_MASK ; + + fvco *= (mdiv +8 ); +do_div (fvco, (pdiv +2 ) << sdiv); + +return (unsigned long )fvco; +} + +static const struct clk_ops samsung_pll2126_clk_ops = { + .recalc_rate = samsung_pll2126_recalc_rate, +}; + +/* +* PLL3000 Clock Type +*/ + +#define PLL3000_MDIV_MASK (0xff) +#define PLL3000_PDIV_MASK (0x3) +#define PLL3000_SDIV_MASK (0x3) +#define PLL3000_MDIV_SHIFT (16) +#define PLL3000_PDIV_SHIFT (8) +#define PLL3000_SDIV_SHIFT (0) + +static unsigned long samsung_pll3000_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct samsung_clk_pll *pll =to_clk_pll (hw); +u32 pll_con, mdiv, pdiv, sdiv; +u64 fvco = parent_rate; + + pll_con =__raw_readl (pll->con_reg); + mdiv = (pll_con >>PLL3000_MDIV_SHIFT ) &PLL3000_MDIV_MASK ; + pdiv = (pll_con >>PLL3000_PDIV_SHIFT ) &PLL3000_PDIV_MASK ; + sdiv = (pll_con >>PLL3000_SDIV_SHIFT ) &PLL3000_SDIV_MASK ; + + fvco *= (2 * (mdiv +8 )); +do_div (fvco, pdiv << sdiv); + +return (unsigned long )fvco; +} + +static const struct clk_ops samsung_pll3000_clk_ops = { + .recalc_rate = samsung_pll3000_recalc_rate, +}; + +/* * PLL35xx Clock Type */ /* Maximum lock time can be 270 * PDIV cycles */
@@ -753,6 +819,12 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk, }switch (pll_clk->type) { +case pll_2126: + init.ops = &samsung_pll2126_clk_ops; +break ; +case pll_3000: + init.ops = &samsung_pll3000_clk_ops; +break ;/* clk_ops for 35xx and 2550 are similar */ case pll_35xx:case pll_2550:
drivers/clk/samsung/clk-pll.h +2 -0
@@ -13,6 +13,8 @@#define __SAMSUNG_CLK_PLL_Henum samsung_pll_type { + pll_2126, + pll_3000, pll_35xx, pll_36xx, pll_2550,
Signature · 1 line
1.7.10.4
PATCH v3 3/5 dt-bindings: add binding for clock-controller of s3c2443 and following
In reply to Heiko StübnerStarting with the s3c2443 the s3c24xx series got a new clock tree compared to the previous s3c24xx socs. This binding describes the clock controller found in the s3c2443, s3c2416 and s3c2450 socs.
--- .../bindings/clock/samsung,s3c2443-clock.txt | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt
Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt new file +46 -0
@@ -0,0 +1,46 @@ +* Samsung S3C2443 Clock Controller + +The S3C2443 clock controller generates and supplies clock to various controllers +within the SoC. The clock binding described here is applicable to all SoCs in +the s3c24x family starting with the s3c2443. + +Required Properties: + +- compatible: should be one of the following. + - "samsung,s3c2416-clock" - controller compatible with S3C2416 SoC. + - "samsung,s3c2443-clock" - controller compatible with S3C2443 SoC. + - "samsung,s3c2450-clock" - controller compatible with S3C2450 SoC. +- 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,s3c2443-clock.h header and can be used in device +tree sources. + +Example: Clock controller node: + + clocks: clock-controller at 4c000000 { + compatible = "samsung,s3c2416-clock"; + reg = <0x4c000000 0x40>; + #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,s3c2440-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
PATCH v3 3/5 dt-bindings: add binding for clock-controller of s3c2443 and following
Hi Heiko,
Quoted 29 lines · On Tuesday 03 of December 2013 16:23:09 Heiko St?bner wrote:
Starting with the s3c2443 the s3c24xx series got a new clock tree compared to the previous s3c24xx socs. This binding describes the clock controller found in the s3c2443, s3c2416 and s3c2450 socs.
Signed-off-by Heiko Stuebner <[email protected]>--- .../bindings/clock/samsung,s3c2443-clock.txt | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txtDocumentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt new file +13
-0@@ -0,0 +1,46 @@ +* Samsung S3C2443 Clock Controller + +The S3C2443 clock controller generates and supplies clock to various controllers +within the SoC. The clock binding described here is applicable to all SoCs in +the s3c24x family starting with the s3c2443. + +Required Properties: + +- compatible: should be one of the following. + - "samsung,s3c2416-clock" - controller compatible with S3C2416 SoC. + - "samsung,s3c2443-clock" - controller compatible with S3C2443 SoC. + - "samsung,s3c2450-clock" - controller compatible with S3C2450 SoC. +- reg: physical base address of the controller and length of memory mapped
Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt new file +10
-0+ 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,s3c2443-clock.h header and can be used in device +tree sources.
I believe this driver needs some external clocks to be defined as fixed rate clocks using generic bindings. It should be noted what clocks are needed here in the documentation.
Otherwise the patch looks fine.
Best regards,
Tomasz
PATCH v3 4/5 clk: samsung: add clock-driver for s3c2416, s3c2443 and s3c2450
In reply to Heiko StübnerThe three SoCs share a common clock tree which only differs in the existence of some special clocks.
As with all parts common to these three SoCs the driver is named after the s3c2443, as it was the first SoC introducing this structure and there exists no other label to describe this s3c24xx epoch.
The clock structure is built according to the manuals of the included SoCs and might include changes in comparison to the previous clock structure. As an example the sclk_uart gate was never handled previously and the div_uart was made to be the clock used by the serial driver.
--- arch/arm/mach-s3c24xx/Kconfig | 6 + drivers/clk/samsung/Makefile | 1 + drivers/clk/samsung/clk-s3c2443.c | 417 +++++++++++++++++++++ include/dt-bindings/clock/samsung,s3c2443-clock.h | 92 +++++ 4 files changed, 516 insertions(+) create mode 100644 drivers/clk/samsung/clk-s3c2443.c create mode 100644 include/dt-bindings/clock/samsung,s3c2443-clock.h
arch/arm/mach-s3c24xx/Kconfig +6 -0
@@ -670,6 +670,12 @@ config S3C2443_COMMON Common code for the S3C2443 and similar processors, which includes the S3C2416 and S3C2450. +config S3C2443_COMMON_CLK + bool + help + Temporary symbol to build the clock driver based on the common clock + framework. + config S3C2443_DMA bool help
drivers/clk/samsung/Makefile +1 -0
@@ -8,4 +8,5 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o +obj-$(CONFIG_S3C2443_COMMON_CLK)+= clk-s3c2443.o obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
drivers/clk/samsung/clk-s3c2443.c new file +417 -0
417 lines not on this page · raw message
include/dt-bindings/clock/samsung,s3c2443-clock.h new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v3 5/5 ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
In reply to Heiko StübnerThis converts the mentioned platforms to use the newly introduced driver for the common clock framework for them.
With this the whole legacy clock structure can go away too.
--- arch/arm/boot/dts/s3c2416-smdk2416.dts | 9 + arch/arm/boot/dts/s3c2416.dtsi | 48 +++ arch/arm/mach-s3c24xx/Kconfig | 14 +- arch/arm/mach-s3c24xx/Makefile | 5 +- arch/arm/mach-s3c24xx/clock-s3c2416.c | 171 -------- arch/arm/mach-s3c24xx/clock-s3c2443.c | 212 ---------- arch/arm/mach-s3c24xx/common-s3c2443.c | 675 ------------------------------- arch/arm/mach-s3c24xx/common.c | 16 +- arch/arm/mach-s3c24xx/common.h | 6 + arch/arm/mach-s3c24xx/mach-s3c2416-dt.c | 39 +- arch/arm/mach-s3c24xx/mach-smdk2416.c | 9 +- arch/arm/mach-s3c24xx/mach-smdk2443.c | 9 +- 12 files changed, 98 insertions(+), 1115 deletions(-) delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2416.c delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2443.c delete mode 100644 arch/arm/mach-s3c24xx/common-s3c2443.c
arch/arm/boot/dts/s3c2416-smdk2416.dts +9 -0
@@ -19,6 +19,15 @@ reg = <0x30000000 0x4000000>; }; + clocks { + xti: xti { + compatible = "fixed-clock"; + clock-frequency = <12000000>; + clock-output-names = "xti"; + #clock-cells = <0>; + }; + }; + serial at 50000000 { status = "okay"; pinctrl-names = "default";
arch/arm/boot/dts/s3c2416.dtsi +48 -0
104 lines not on this page · raw message
arch/arm/mach-s3c24xx/Kconfig +4 -10
@@ -50,9 +50,9 @@ config CPU_S3C2416 select CPU_ARM926T select CPU_LLSERIAL_S3C2440 select S3C2416_PM if PM - select S3C2443_COMMON select S3C2443_DMA if S3C24XX_DMA - select SAMSUNG_CLKSRC + select COMMON_CLK + select S3C2443_COMMON_CLK help Support for the S3C2416 SoC from the S3C24XX line
@@ -85,9 +85,9 @@ config CPU_S3C2443 bool "SAMSUNG S3C2443" select CPU_ARM920T select CPU_LLSERIAL_S3C2440 - select S3C2443_COMMON select S3C2443_DMA if S3C24XX_DMA - select SAMSUNG_CLKSRC + select COMMON_CLK + select S3C2443_COMMON_CLK help Support for the S3C2443 SoC from the S3C24XX line
@@ -664,12 +664,6 @@ endif # CPU_S3C2442 if CPU_S3C2443 || CPU_S3C2416 -config S3C2443_COMMON - bool - help - Common code for the S3C2443 and similar processors, which includes - the S3C2416 and S3C2450. - config S3C2443_COMMON_CLK bool help
arch/arm/mach-s3c24xx/Makefile +2 -3
@@ -26,7 +26,7 @@ obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o -obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o +obj-$(CONFIG_CPU_S3C2416) += s3c2416.o obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o
@@ -36,7 +36,7 @@ obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o -obj-$(CONFIG_CPU_S3C2443) += s3c2443.o clock-s3c2443.o +obj-$(CONFIG_CPU_S3C2443) += s3c2443.o # PM
@@ -53,7 +53,6 @@ obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o -obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o #
arch/arm/mach-s3c24xx/clock-s3c2416.c deleted +0 -171
171 lines not on this page · raw message
arch/arm/mach-s3c24xx/clock-s3c2443.c deleted +0 -212
212 lines not on this page · raw message
arch/arm/mach-s3c24xx/common-s3c2443.c deleted +0 -675
675 lines not on this page · raw message
arch/arm/mach-s3c24xx/common.c +14 -2
@@ -145,7 +145,6 @@ static struct cpu_table cpu_ids[] __initdata = { .idcode = 0x32450003, .idmask = 0xffffffff, .map_io = s3c2416_map_io, - .init_clocks = s3c2416_init_clocks, .init_uarts = s3c2416_init_uarts, .init = s3c2416_init, .name = name_s3c2416,
@@ -154,7 +153,6 @@ static struct cpu_table cpu_ids[] __initdata = { .idcode = 0x32443001, .idmask = 0xffffffff, .map_io = s3c2443_map_io, - .init_clocks = s3c2443_init_clocks, .init_uarts = s3c2443_init_uarts, .init = s3c2443_init, .name = name_s3c2443,
@@ -535,3 +533,17 @@ struct platform_device s3c2443_device_dma = { }, };#endif + +#if defined(CONFIG_COMMON_CLK ) && defined(CONFIG_CPU_S3C2416 ) +void __init s3c2416_init_clocks (int xtal) +{ +s3c2443_common_clk_init (NULL , xtal,0 ,S3C24XX_VA_CLKPWR ); +} +#endif + +#if defined(CONFIG_COMMON_CLK ) && defined(CONFIG_CPU_S3C2443 ) +void __init s3c2443_init_clocks (int xtal) +{ +s3c2443_common_clk_init (NULL , xtal,1 ,S3C24XX_VA_CLKPWR ); +} +#endif
arch/arm/mach-s3c24xx/common.h +6 -0
@@ -114,4 +114,10 @@ extern struct platform_device s3c2412_device_dma;extern struct platform_device s3c2440_device_dma;extern struct platform_device s3c2443_device_dma; +#ifdef CONFIG_S3C2443_COMMON_CLK +void __init s3c2443_common_clk_init (struct device_node *np,unsigned long xti_f, +int current_soc, +void __iomem *reg_base); +#endif +#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c +1 -38
@@ -18,59 +18,23 @@#include <linux/clocksource.h> #include <linux/irqchip.h> #include <linux/of_platform.h> -#include <linux/serial_core.h> #include <asm/mach/arch.h> #include <mach/map.h> #include <plat/cpu.h> #include <plat/pm.h> -#include <plat/regs-serial.h> #include "common.h" -/* -* The following lookup table is used to override device names when devices -* are registered from device tree. This is temporarily added to enable -* device tree support addition for the S3C2416 architecture. -* -* For drivers that require platform data to be provided from the machine -* file, a platform data pointer can also be supplied along with the -* devices names. Usually, the platform data elements that cannot be parsed -* from the device tree by the drivers (example: function pointers) are -* supplied. But it should be noted that this is a temporary mechanism and -* at some point, the drivers should be capable of parsing all the platform -* data from the device tree. -*/ -static const struct of_dev_auxdata s3c2416_auxdata_lookup[]__initconst = { -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART , -"s3c2440-uart.0" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART +0x4000 , -"s3c2440-uart.1" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART +0x8000 , -"s3c2440-uart.2" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART +0xC000 , -"s3c2440-uart.3" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c6410-sdhci" ,S3C_PA_HSMMC0 , -"s3c-sdhci.0" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c6410-sdhci" ,S3C_PA_HSMMC1 , -"s3c-sdhci.1" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-i2c" ,S3C_PA_IIC , -"s3c2440-i2c.0" ,NULL ), - {}, -}; -static void __init s3c2416_dt_map_io (void ) {s3c24xx_init_io (NULL ,0 ); -s3c24xx_init_clocks (12000000 ); }static void __init s3c2416_dt_machine_init (void ) { -of_platform_populate (NULL , of_default_bus_match_table, - s3c2416_auxdata_lookup,NULL ); - +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL );s3c_pm_init (); }
@@ -86,6 +50,5 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)") .map_io = s3c2416_dt_map_io, .init_irq = irqchip_init, .init_machine = s3c2416_dt_machine_init, - .init_time = clocksource_of_init, .restart = s3c2416_restart,MACHINE_END
arch/arm/mach-s3c24xx/mach-smdk2416.c +7 -2
@@ -218,10 +218,15 @@ static struct platform_device *smdk2416_devices[] __initdata = { &s3c2443_device_dma, }; +static void __init smdk2416_init_time (void ) +{ +s3c2416_init_clocks (12000000 ); +samsung_timer_init (); +} +static void __init smdk2416_map_io (void ) {s3c24xx_init_io (smdk2416_iodesc,ARRAY_SIZE (smdk2416_iodesc)); -s3c24xx_init_clocks (12000000 );s3c24xx_init_uarts (smdk2416_uartcfgs,ARRAY_SIZE (smdk2416_uartcfgs));samsung_set_timer_source (SAMSUNG_PWM3 ,SAMSUNG_PWM4 ); }
@@ -256,6 +261,6 @@ MACHINE_START(SMDK2416, "SMDK2416") .init_irq = s3c2416_init_irq, .map_io = smdk2416_map_io, .init_machine = smdk2416_machine_init, - .init_time = samsung_timer_init, + .init_time = smdk2416_init_time, .restart = s3c2416_restart,MACHINE_END
arch/arm/mach-s3c24xx/mach-smdk2443.c +7 -2
@@ -121,11 +121,16 @@ static struct platform_device *smdk2443_devices[] __initdata = {static void __init smdk2443_map_io (void ) {s3c24xx_init_io (smdk2443_iodesc,ARRAY_SIZE (smdk2443_iodesc)); -s3c24xx_init_clocks (12000000 );s3c24xx_init_uarts (smdk2443_uartcfgs,ARRAY_SIZE (smdk2443_uartcfgs));samsung_set_timer_source (SAMSUNG_PWM3 ,SAMSUNG_PWM4 ); } +static void __init smdk2443_init_time (void ) +{ +s3c2443_init_clocks (12000000 ); +samsung_timer_init (); +} +static void __init smdk2443_machine_init (void ) {s3c_i2c0_set_platdata (NULL );
@@ -145,6 +150,6 @@ MACHINE_START(SMDK2443, "SMDK2443") .init_irq = s3c2443_init_irq, .map_io = smdk2443_map_io, .init_machine = smdk2443_machine_init, - .init_time = samsung_timer_init, + .init_time = smdk2443_init_time, .restart = s3c2443_restart,MACHINE_END
Signature · 1 line
1.7.10.4
PATCH v3 5/5 ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
Hi Heiko,
Quoted 15 lines · On Tuesday 03 of December 2013 16:24:11 Heiko St?bner wrote:
This converts the mentioned platforms to use the newly introduced driver for the common clock framework for them.
With this the whole legacy clock structure can go away too.
Signed-off-by Heiko Stuebner <[email protected]>--- arch/arm/boot/dts/s3c2416-smdk2416.dts | 9 + arch/arm/boot/dts/s3c2416.dtsi | 48 +++ arch/arm/mach-s3c24xx/Kconfig | 14 +- arch/arm/mach-s3c24xx/Makefile | 5 +- arch/arm/mach-s3c24xx/clock-s3c2416.c | 171 -------- arch/arm/mach-s3c24xx/clock-s3c2443.c | 212 ---------- arch/arm/mach-s3c24xx/common-s3c2443.c | 675 ------------------------------- arch/arm/mach-s3c24xx/common.c | 16 +-
Quoted 8 lines
arch/arm/mach-s3c24xx/common.h | 6 + arch/arm/mach-s3c24xx/mach-s3c2416-dt.c | 39 +- arch/arm/mach-s3c24xx/mach-smdk2416.c | 9 +- arch/arm/mach-s3c24xx/mach-smdk2443.c | 9 +- 12 files changed, 98 insertions(+), 1115 deletions(-) delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2416.c delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2443.c delete mode 100644 arch/arm/mach-s3c24xx/common-s3c2443.c
I would split this patch into one adding necessary definitions to DTS files, then one migrating the platform to CCF. Until the driver gets selected by respective Kconfig options, the entries in device tree should not have any impact on the system, but you get rid of one patch doing changes across two different trees.
Ideally this should be also done in one more step, allowing both clock frameworks to coexist first and then removing the legacy code as the last step to allow the new code to get more testing. However for this platform, which isn't really very active nowadays, it might be fine to skip this.
Quoted 33 lines
arch/arm/boot/dts/s3c2416-smdk2416.dts +9
-0@@ -19,6 +19,15 @@ reg = <0x30000000 0x4000000>; }; + clocks { + xti: xti { + compatible = "fixed-clock"; + clock-frequency = <12000000>; + clock-output-names = "xti"; + #clock-cells = <0>; + }; + }; + serial at 50000000 { status = "okay"; pinctrl-names = "default";arch/arm/boot/dts/s3c2416.dtsi +1
-0@@ -8,6 +8,7 @@ * published by the Free Software Foundation. */ +#include <dt-bindings/clock/samsung,s3c2443-clock.h> #include "s3c24xx.dtsi" #include "s3c2416-pinctrl.dtsi"
arch/arm/boot/dts/s3c2416.dtsi line 32
Quoted 4 lines
arch/arm/boot/dts/s3c2416.dtsi +1
-0@@ -28,26 +29,59 @@ compatible = "samsung,s3c2416-irq"; }; + clocks {
Don't you need compatible = "simple-bus" here for the subnodes to be instantiated?
arch/arm/boot/dts/s3c2416.dtsi line 37
Quoted 5 lines
arch/arm/boot/dts/s3c2416.dtsi +5
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges; + + clocks: clock-controller at 0x4c000000 {
Why is this in a subnode? Clock controller is a part of the SoC, so IMHO it should be on the same level as other peripherals.
Quoted 6 lines
arch/arm/boot/dts/s3c2416.dtsi +6
-0+ compatible = "samsung,s3c2416-clock"; + reg = <0x4c000000 0x40>; + #clock-cells = <1>; + }; + }; +
[snip]
arch/arm/mach-s3c24xx/Kconfig config CPU_S3C2416 · line 55
Quoted 13 lines
arch/arm/mach-s3c24xx/Kconfig +2
-2@@ -50,9 +50,9 @@ config CPU_S3C2416 select CPU_ARM926T select CPU_LLSERIAL_S3C2440 select S3C2416_PM if PM - select S3C2443_COMMON select S3C2443_DMA if S3C24XX_DMA - select SAMSUNG_CLKSRC + select COMMON_CLK + select S3C2443_COMMON_CLK
Please keep selected symbols sorted alphabetically.
arch/arm/mach-s3c24xx/Kconfig config CPU_S3C2443 · line 90
Quoted 12 lines
arch/arm/mach-s3c24xx/Kconfig +2
-2help Support for the S3C2416 SoC from the S3C24XX line@@ -85,9 +85,9 @@ config CPU_S3C2443 bool "SAMSUNG S3C2443" select CPU_ARM920T select CPU_LLSERIAL_S3C2440 - select S3C2443_COMMON select S3C2443_DMA if S3C24XX_DMA - select SAMSUNG_CLKSRC + select COMMON_CLK + select S3C2443_COMMON_CLK
Ditto.
Quoted 16 lines
arch/arm/mach-s3c24xx/Kconfig +0
-6help Support for the S3C2443 SoC from the S3C24XX line@@ -664,12 +664,6 @@ endif # CPU_S3C2442 if CPU_S3C2443 || CPU_S3C2416 -config S3C2443_COMMON - bool - help - Common code for the S3C2443 and similar processors, which includes - the S3C2416 and S3C2450. - config S3C2443_COMMON_CLK bool help
[snip]
Quoted 21 lines
arch/arm/mach-s3c24xx/common.c +0
-2@@ -145,7 +145,6 @@ static struct cpu_table cpu_ids[] __initdata = { .idcode = 0x32450003, .idmask = 0xffffffff, .map_io = s3c2416_map_io, - .init_clocks = s3c2416_init_clocks, .init_uarts = s3c2416_init_uarts, .init = s3c2416_init, .name = name_s3c2416,@@ -154,7 +153,6 @@ static struct cpu_table cpu_ids[] __initdata = { .idcode = 0x32443001, .idmask = 0xffffffff, .map_io = s3c2443_map_io, - .init_clocks = s3c2443_init_clocks, .init_uarts = s3c2443_init_uarts, .init = s3c2443_init, .name = name_s3c2443,
arch/arm/mach-s3c24xx/common.c struct platform_device s3c2443_device_dma = { · line 537
Quoted 5 lines
arch/arm/mach-s3c24xx/common.c +2
-0@@ -535,3 +533,17 @@ struct platform_device s3c2443_device_dma = { }, };#endif + +#if defined(CONFIG_COMMON_CLK ) && defined(CONFIG_CPU_S3C2416 )
Isn't CONFIG_COMMON_CLK be selected by CPU_S3C2416?
arch/arm/mach-s3c24xx/common.c struct platform_device s3c2443_device_dma = { · line 544
Quoted 7 lines
arch/arm/mach-s3c24xx/common.c +7
-0+void __init s3c2416_init_clocks (int xtal) +{ +s3c2443_common_clk_init (NULL , xtal,0 ,S3C24XX_VA_CLKPWR ); +} +#endif + +#if defined(CONFIG_COMMON_CLK ) && defined(CONFIG_CPU_S3C2443 )
Ditto.
Quoted 86 lines
arch/arm/mach-s3c24xx/common.c +5
-0+void __init s3c2443_init_clocks (int xtal) +{ +s3c2443_common_clk_init (NULL , xtal,1 ,S3C24XX_VA_CLKPWR ); +} +#endif arch/arm/mach-s3c24xx/common.h +6
-0@@ -114,4 +114,10 @@ extern struct platform_device s3c2412_device_dma;extern struct platform_device s3c2440_device_dma;extern struct platform_device s3c2443_device_dma; +#ifdef CONFIG_S3C2443_COMMON_CLK +void __init s3c2443_common_clk_init (struct device_node *np,unsigned long xti_f, +int current_soc, +void __iomem *reg_base); +#endif +#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ arch/arm/mach-s3c24xx/mach-s3c2416-dt.c +1
-37@@ -18,59 +18,23 @@#include <linux/clocksource.h> #include <linux/irqchip.h> #include <linux/of_platform.h> -#include <linux/serial_core.h> #include <asm/mach/arch.h> #include <mach/map.h> #include <plat/cpu.h> #include <plat/pm.h> -#include <plat/regs-serial.h> #include "common.h" -/* -* The following lookup table is used to override device names when devices -* are registered from device tree. This is temporarily added to enable -* device tree support addition for the S3C2416 architecture. -* -* For drivers that require platform data to be provided from the machine -* file, a platform data pointer can also be supplied along with the -* devices names. Usually, the platform data elements that cannot be parsed -* from the device tree by the drivers (example: function pointers) are -* supplied. But it should be noted that this is a temporary mechanism and -* at some point, the drivers should be capable of parsing all the platform -* data from the device tree. -*/ -static const struct of_dev_auxdata s3c2416_auxdata_lookup[]__initconst = { -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART , -"s3c2440-uart.0" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART +0x4000 , -"s3c2440-uart.1" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART +0x8000 , -"s3c2440-uart.2" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-uart" ,S3C24XX_PA_UART +0xC000 , -"s3c2440-uart.3" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c6410-sdhci" ,S3C_PA_HSMMC0 , -"s3c-sdhci.0" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c6410-sdhci" ,S3C_PA_HSMMC1 , -"s3c-sdhci.1" ,NULL ), -OF_DEV_AUXDATA ("samsung,s3c2440-i2c" ,S3C_PA_IIC , -"s3c2440-i2c.0" ,NULL ), - {}, -}; -static void __init s3c2416_dt_map_io (void ) {s3c24xx_init_io (NULL ,0 ); -s3c24xx_init_clocks (12000000 ); }static void __init s3c2416_dt_machine_init (void ) { -of_platform_populate (NULL , of_default_bus_match_table, - s3c2416_auxdata_lookup,NULL ); - +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL );s3c_pm_init (); }
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)") · line 89
Quoted 4 lines
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c +0
-1@@ -86,6 +50,5 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)") .map_io = s3c2416_dt_map_io, .init_irq = irqchip_init, .init_machine = s3c2416_dt_machine_init, - .init_time = clocksource_of_init,
Should it really be a part of this patch?
Otherwise the patch looks fine.
Best regards,
Tomasz
PATCH v3 5/5 ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
Hi Tomasz,
Am Montag, 9. Dezember 2013, 18:19:16 schrieb Tomasz Figa:
Quoted 4 lines
Quoted 4 lines
(quoted diff) +0
-0
b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.cindex f50454a..0a86953 100644arch/arm/mach-s3c24xx/mach-s3c2416-dt.c +0
-0
[...]
Quoted 10 lines
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 · line 89
Quoted 8 lines
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c +0
-1@@ -86,6 +50,5 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)") .map_io = s3c2416_dt_map_io, .init_irq = irqchip_init, .init_machine = s3c2416_dt_machine_init, - .init_time = clocksource_of_init,Should it really be a part of this patch?
Yes it is needed as part of the conversion, as somebody has to call of_clk_init(), which the init_time default-handler does.
The only other option would be to introduce a new local init_time callback, calling of_clk_init and clocksource_of_init, only to remove it again in an additional patch.
Heiko
v3 cover ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework
In reply to Heiko StübnerHi Heiko,
Quoted 34 lines · On Tuesday 03 of December 2013 16:19:57 Heiko St?bner wrote:
Resurrecting this series again after to much time.
Changed is the pll registration to follow the new system and getting the external clocks from dt fixed-rate clocks.
Hopefully I did address all comments received for v2 in july.
Tested on both non-dt and dt s3c2416. As s3c2443 is working the same way it should work, but is only compile tested.
Heiko Stuebner (5):
clk: samsung: addpll_6552variant for s3c2416
clk: samsung: add plls used by the s3c2443
dt-bindings: add binding for clock-controller of s3c2443 and following
clk: samsung: add clock-driver for s3c2416, s3c2443 and s3c2450
ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework.../bindings/clock/samsung,s3c2443-clock.txt | 46 ++ arch/arm/boot/dts/s3c2416-smdk2416.dts | 9 + arch/arm/boot/dts/s3c2416.dtsi | 48 ++ arch/arm/mach-s3c24xx/Kconfig | 14 +- arch/arm/mach-s3c24xx/Makefile | 5 +- arch/arm/mach-s3c24xx/clock-s3c2416.c | 171 ----- arch/arm/mach-s3c24xx/clock-s3c2443.c | 212 ------ arch/arm/mach-s3c24xx/common-s3c2443.c | 675 -------------------- arch/arm/mach-s3c24xx/common.c | 16 +- arch/arm/mach-s3c24xx/common.h | 6 + arch/arm/mach-s3c24xx/mach-s3c2416-dt.c | 39 +- arch/arm/mach-s3c24xx/mach-smdk2416.c | 9 +- arch/arm/mach-s3c24xx/mach-smdk2443.c | 9 +- drivers/clk/samsung/Makefile | 1 + drivers/clk/samsung/clk-pll.c | 84 ++- drivers/clk/samsung/clk-pll.h | 3 + drivers/clk/samsung/clk-s3c2443.c | 417 ++++++++++++
Quoted 8 lines
include/dt-bindings/clock/samsung,s3c2443-clock.h | 92 +++ 18 files changed, 742 insertions(+), 1114 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/samsung,s3c2443-clock.txt delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2416.c delete mode 100644 arch/arm/mach-s3c24xx/clock-s3c2443.c delete mode 100644 arch/arm/mach-s3c24xx/common-s3c2443.c create mode 100644 drivers/clk/samsung/clk-s3c2443.c create mode 100644 include/dt-bindings/clock/samsung,s3c2443-clock.h
Thanks for you great work on S3C24xx.
Except for my (minor) comments on patches 3 and 5:
Best regards,
Tomasz