ARM: SAMSUNG: Add clkdev support for Samsung platforms
cover ARM: SAMSUNG: Add clkdev support for Samsung platforms
This patch series adds clkdev support for Samsung platforms and specifically enables clkdev support for Samsung's Exynos4 platforms. The first two patches in this series are prerequisite patches for enabling clkdev on all Samsung platforms. The third patch in this series is a simple fix for clock name and id for dw_mmc controller on Exynos4 platforms.
Thomas Abraham (5):
serial: samsung: Fix unintended usage of uart port 0 as console
serial: s5pv210: Remove redundant console_initcall
ARM: EXYNOS4: Fix clock name and clock id for dw_mmc controller
ARM: SAMSUNG: Add clkdev infrastructure
ARM: EXYNOS4: Add clkdev support
arch/arm/Kconfig | 1 + arch/arm/mach-exynos4/clock.c | 63 +++++++++++++++++++++++++-- arch/arm/mach-exynos4/include/mach/clkdev.h | 7 +++ arch/arm/mach-exynos4/time.c | 2 + arch/arm/plat-samsung/clock.c | 18 ++++++++ arch/arm/plat-samsung/include/plat/clock.h | 7 +++ arch/arm/plat-samsung/pwm-clock.c | 10 ++++ drivers/tty/serial/s5pv210.c | 7 --- drivers/tty/serial/samsung.c | 9 ++-- 9 files changed, 108 insertions(+), 16 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/clkdev.h
PATCH 1/5 serial: samsung: Fix unintended usage of uart port 0 as console
In s3c24xx_serial_console_setup function, if the uart port that is being setup as a console has not been initialized, an error can be returned instead of using uart port 0 as the default console port. The uart port that was intended to be used as a console could be initialized at a later point during boot and then registered as a console. This will avoid using uart port 0 as a unintended console port.
--- drivers/tty/serial/samsung.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/tty/serial/samsung.c +2 -4
@@ -1417,10 +1417,8 @@ s3c24xx_serial_console_setup(struct console *co, char *options)/* is the port configured? */ -if (port->mapbase ==0x0 ) { - co->index =0 ; - port = &s3c24xx_serial_ports[co->index].port; - } +if (port->mapbase ==0x0 ) +return -ENODEV ; cons_uart = port;
Signature · 1 line
1.6.6.rc2
PATCH 2/5 serial: s5pv210: Remove redundant console_initcall
In reply to Thomas AbrahamUart port is registered as a console during the driver's probe. So explict registration of console with console_initcall is removed.
--- drivers/tty/serial/s5pv210.c | 7 ------- drivers/tty/serial/samsung.c | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-)
drivers/tty/serial/s5pv210.c +0 -7
@@ -136,13 +136,6 @@ static struct platform_driver s5p_serial_driver = { }, }; -static int __init s5pv210_serial_console_init (void ) -{ -return s3c24xx_serial_initconsole (&s5p_serial_driver, s5p_uart_inf); -} - -console_initcall (s5pv210_serial_console_init); -static int __init s5p_serial_init (void ) {return s3c24xx_serial_init (&s5p_serial_driver, *s5p_uart_inf);
drivers/tty/serial/samsung.c +2 -1
@@ -1450,7 +1450,8 @@ static struct console s3c24xx_serial_console = { .flags = CON_PRINTBUFFER, .index = -1, .write = s3c24xx_serial_console_write, - .setup = s3c24xx_serial_console_setup + .setup = s3c24xx_serial_console_setup, + .data = &s3c24xx_uart_drv, }; int s3c24xx_serial_initconsole(struct platform_driver *drv,
Signature · 1 line
1.6.6.rc2
PATCH 3/5 ARM: EXYNOS4: Fix clock name and clock id for dw_mmc controller
In reply to Thomas AbrahamFix the incorrect clock name and clock id for the dw_mmc controller.
--- arch/arm/mach-exynos4/clock.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-exynos4/clock.c +4 -4
@@ -473,8 +473,8 @@ static struct clk init_clocks_off[] = { .enable = exynos4_clk_ip_fsys_ctrl, .ctrlbit = (1 << 8), }, { - .name = "hsmmc", - .id = 4, + .name = "dwmmc", + .id = -1, .parent = &clk_aclk_133.clk, .enable = exynos4_clk_ip_fsys_ctrl, .ctrlbit = (1 << 9),
@@ -1072,8 +1072,8 @@ static struct clksrc_clk clksrcs[] = { .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 }, }, { .clk = { - .name = "sclk_mmc", - .id = 4, + .name = "sclk_dwmmc", + .id = -1, .parent = &clk_dout_mmc4.clk, .enable = exynos4_clksrc_mask_fsys_ctrl, .ctrlbit = (1 << 16),
Signature · 1 line
1.6.6.rc2
PATCH 4/5 ARM: SAMSUNG: Add clkdev infrastructure
In reply to Thomas AbrahamAdd infrastructure for clkdev support on samsung platforms.
--- arch/arm/plat-samsung/clock.c | 18 ++++++++++++++++++ arch/arm/plat-samsung/include/plat/clock.h | 7 +++++++ 2 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/plat-samsung/clock.c +18 -0
@@ -71,6 +71,12 @@ static int clk_null_enable(struct clk *clk, int enable)return 0 ; } +/* +* When all Samsung platforms use clkdev, pdev->id based clock lookup +* code can be removed. +*/ +#ifndef CONFIG_CLKDEV_LOOKUP +static int dev_is_s3c_uart (struct device *dev) {struct platform_device **pdev = s3c24xx_uart_devs;
@@ -139,6 +145,8 @@ void clk_put(struct clk *clk) module_put(clk->owner); } +#endif /* CONFIG_CLKDEV_LOOKUP */ +int clk_enable (struct clk *clk) {if (IS_ERR (clk) || clk ==NULL )
@@ -241,8 +249,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent)return ret; } +#ifndef CONFIG_CLKDEV_LOOKUP EXPORT_SYMBOL (clk_get);EXPORT_SYMBOL (clk_put); +#endif EXPORT_SYMBOL (clk_enable);EXPORT_SYMBOL (clk_disable);EXPORT_SYMBOL (clk_get_rate);
@@ -346,6 +356,7 @@ int s3c24xx_register_clock(struct clk *clk)if (clk->enable ==NULL ) clk->enable = clk_null_enable; +#ifndef CONFIG_CLKDEV_LOOKUP /* add to the list of available clocks */ /* Quick check to see if this clock has already been registered. */
@@ -354,6 +365,13 @@ int s3c24xx_register_clock(struct clk *clk)spin_lock (&clocks_lock);list_add (&clk->list, &clocks);spin_unlock (&clocks_lock); +#else +/* fill up the clk_lookup structure and register it*/ + clk->lookup.dev_id = clk->devname; + clk->lookup.con_id = clk->name; + clk->lookup.clk = clk; +clkdev_add (&clk->lookup); +#endif return 0 ; }
arch/arm/plat-samsung/include/plat/clock.h +7 -0
@@ -10,6 +10,9 @@*/ #include <linux/spinlock.h> +#ifdef CONFIG_CLKDEV_LOOKUP +#include <linux/clkdev.h> +#endif struct clk ;
@@ -40,6 +43,7 @@ struct clk {struct module *owner;struct clk *parent;const char *name; +const char *devname;int id;int usage;unsigned long rate;
@@ -47,6 +51,9 @@ struct clk {struct clk_ops *ops;int (*enable)(struct clk *,int enable); +#ifdef CONFIG_CLKDEV_LOOKUP +struct clk_lookup lookup; +#endif #if defined(CONFIG_PM_DEBUG ) && defined(CONFIG_DEBUG_FS )struct dentry *dent;/* For visible tree hierarchy */ #endif
Signature · 1 line
1.6.6.rc2
PATCH 5/5 ARM: EXYNOS4: Add clkdev support
In reply to Thomas AbrahamAdd clkdev support for Samsung's exynos4 platforms.
--- arch/arm/Kconfig | 1 + arch/arm/mach-exynos4/clock.c | 55 +++++++++++++++++++++++++++ arch/arm/mach-exynos4/include/mach/clkdev.h | 7 +++ arch/arm/mach-exynos4/time.c | 2 + arch/arm/plat-samsung/pwm-clock.c | 10 +++++ 5 files changed, 75 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/clkdev.h
arch/arm/Kconfig +1 -0
@@ -781,6 +781,7 @@ config ARCH_EXYNOS4 select ARCH_SPARSEMEM_ENABLE select GENERIC_GPIO select HAVE_CLK + select CLKDEV_LOOKUP select ARCH_HAS_CPUFREQ select GENERIC_CLOCKEVENTS select HAVE_S3C_RTC if RTC_CLASS
arch/arm/mach-exynos4/clock.c +55 -0
367 lines not on this page · raw message
arch/arm/mach-exynos4/include/mach/clkdev.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __MACH_EXYNOS4_CLKDEV_H__ +#define __MACH_EXYNOS4_CLKDEV_H__ + +#define __clk_get (clk) ({ 1; }) +#define __clk_put (clk) do { } while (0) + +#endif
arch/arm/mach-exynos4/time.c +2 -0
@@ -262,6 +262,7 @@ static void __init exynos4_timer_resources(void)clk_enable (timerclk); tmpdev.id =2 ; + tmpdev.dev.init_name ="s3c24xx-pwm.2" ; tin2 =clk_get (&tmpdev.dev,"pwm-tin" );if (IS_ERR (tin2))panic ("failed to get pwm-tin2 clock for system timer" );
@@ -272,6 +273,7 @@ static void __init exynos4_timer_resources(void)clk_enable (tin2); tmpdev.id =4 ; + tmpdev.dev.init_name ="s3c24xx-pwm.4" ; tin4 =clk_get (&tmpdev.dev,"pwm-tin" );if (IS_ERR (tin4))panic ("failed to get pwm-tin4 clock for system timer" );
arch/arm/plat-samsung/pwm-clock.c +10 -0
@@ -268,6 +268,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = { [0] = { .clk = { .name = "pwm-tdiv", + .devname = "s3c24xx-pwm.0", .ops = &clk_tdiv_ops, .parent = &clk_timer_scaler[0], },
@@ -275,6 +276,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = { [1] = { .clk = { .name = "pwm-tdiv", + .devname = "s3c24xx-pwm.1", .ops = &clk_tdiv_ops, .parent = &clk_timer_scaler[0], }
@@ -282,6 +284,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = { [2] = { .clk = { .name = "pwm-tdiv", + .devname = "s3c24xx-pwm.2", .ops = &clk_tdiv_ops, .parent = &clk_timer_scaler[1], },
@@ -289,6 +292,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = { [3] = { .clk = { .name = "pwm-tdiv", + .devname = "s3c24xx-pwm.3", .ops = &clk_tdiv_ops, .parent = &clk_timer_scaler[1], },
@@ -296,6 +300,7 @@ static struct pwm_tdiv_clk clk_timer_tdiv[] = { [4] = { .clk = { .name = "pwm-tdiv", + .devname = "s3c24xx-pwm.4", .ops = &clk_tdiv_ops, .parent = &clk_timer_scaler[1], },
@@ -361,26 +366,31 @@ static struct clk_ops clk_tin_ops = {static struct clk clk_tin[] = { [0 ] = { .name ="pwm-tin" , + .devname ="s3c24xx-pwm.0" , .id =0 , .ops = &clk_tin_ops, }, [1 ] = { .name ="pwm-tin" , + .devname ="s3c24xx-pwm.1" , .id =1 , .ops = &clk_tin_ops, }, [2 ] = { .name ="pwm-tin" , + .devname ="s3c24xx-pwm.2" , .id =2 , .ops = &clk_tin_ops, }, [3 ] = { .name ="pwm-tin" , + .devname ="s3c24xx-pwm.3" , .id =3 , .ops = &clk_tin_ops, }, [4 ] = { .name ="pwm-tin" , + .devname ="s3c24xx-pwm.4" , .id =4 , .ops = &clk_tin_ops, },
Signature · 1 line
1.6.6.rc2