Commit d817468c authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Kukjin Kim

ARM: S3C24XX: Add missing clkdev entries for s3c2440 UART

This patch restores serial port operation which has been broken since
commit 60e93575 ("serial: samsung: enable clock before clearing
pending interrupts during init")

That commit only uncovered the real issue which was missing clkdev
entries for the "uart" clocks on S3C2440. It went unnoticed so far
because return value of clk API calls were not being checked at all
in the samsung serial port driver.

This patch should be backported to at least 3.10 stable kernel, since
the serial port has not been working on s3c2440 since 3.10-rc5.

Cc: Chander Kashyap <chander.kashyap@linaro.org>
Signed-off-by: default avatarSylwester Nawrocki <sylvester.nawrocki@gmail.com>
[on S3C2440 SoC based Mini2440 board]
Tested-by: default avatarSylwester Nawrocki <sylvester.nawrocki@gmail.com>
Reviewed-by: default avatarTomasz Figa <t.figa@samsung.com>
Tested-by: default avatarJuergen Beisert <jbe@pengutronix.de>
Cc: <stable@vger.kernel.org>	[3.10]
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent cfaf8ee2
...@@ -119,66 +119,101 @@ static struct clk init_clocks_off[] = { ...@@ -119,66 +119,101 @@ static struct clk init_clocks_off[] = {
} }
}; };
static struct clk init_clocks[] = { static struct clk clk_lcd = {
{ .name = "lcd",
.name = "lcd", .parent = &clk_h,
.parent = &clk_h, .enable = s3c2410_clkcon_enable,
.enable = s3c2410_clkcon_enable, .ctrlbit = S3C2410_CLKCON_LCDC,
.ctrlbit = S3C2410_CLKCON_LCDC, };
}, {
.name = "gpio", static struct clk clk_gpio = {
.parent = &clk_p, .name = "gpio",
.enable = s3c2410_clkcon_enable, .parent = &clk_p,
.ctrlbit = S3C2410_CLKCON_GPIO, .enable = s3c2410_clkcon_enable,
}, { .ctrlbit = S3C2410_CLKCON_GPIO,
.name = "usb-host", };
.parent = &clk_h,
.enable = s3c2410_clkcon_enable, static struct clk clk_usb_host = {
.ctrlbit = S3C2410_CLKCON_USBH, .name = "usb-host",
}, { .parent = &clk_h,
.name = "usb-device", .enable = s3c2410_clkcon_enable,
.parent = &clk_h, .ctrlbit = S3C2410_CLKCON_USBH,
.enable = s3c2410_clkcon_enable, };
.ctrlbit = S3C2410_CLKCON_USBD,
}, { static struct clk clk_usb_device = {
.name = "timers", .name = "usb-device",
.parent = &clk_p, .parent = &clk_h,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_PWMT, .ctrlbit = S3C2410_CLKCON_USBD,
}, { };
.name = "uart",
.devname = "s3c2410-uart.0", static struct clk clk_timers = {
.parent = &clk_p, .name = "timers",
.enable = s3c2410_clkcon_enable, .parent = &clk_p,
.ctrlbit = S3C2410_CLKCON_UART0, .enable = s3c2410_clkcon_enable,
}, { .ctrlbit = S3C2410_CLKCON_PWMT,
.name = "uart", };
.devname = "s3c2410-uart.1",
.parent = &clk_p, struct clk s3c24xx_clk_uart0 = {
.enable = s3c2410_clkcon_enable, .name = "uart",
.ctrlbit = S3C2410_CLKCON_UART1, .devname = "s3c2410-uart.0",
}, { .parent = &clk_p,
.name = "uart", .enable = s3c2410_clkcon_enable,
.devname = "s3c2410-uart.2", .ctrlbit = S3C2410_CLKCON_UART0,
.parent = &clk_p, };
.enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_UART2, struct clk s3c24xx_clk_uart1 = {
}, { .name = "uart",
.name = "rtc", .devname = "s3c2410-uart.1",
.parent = &clk_p, .parent = &clk_p,
.enable = s3c2410_clkcon_enable, .enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_RTC, .ctrlbit = S3C2410_CLKCON_UART1,
}, { };
.name = "watchdog",
.parent = &clk_p, struct clk s3c24xx_clk_uart2 = {
.ctrlbit = 0, .name = "uart",
}, { .devname = "s3c2410-uart.2",
.name = "usb-bus-host", .parent = &clk_p,
.parent = &clk_usb_bus, .enable = s3c2410_clkcon_enable,
}, { .ctrlbit = S3C2410_CLKCON_UART2,
.name = "usb-bus-gadget", };
.parent = &clk_usb_bus,
}, static struct clk clk_rtc = {
.name = "rtc",
.parent = &clk_p,
.enable = s3c2410_clkcon_enable,
.ctrlbit = S3C2410_CLKCON_RTC,
};
static struct clk clk_watchdog = {
.name = "watchdog",
.parent = &clk_p,
.ctrlbit = 0,
};
static struct clk clk_usb_bus_host = {
.name = "usb-bus-host",
.parent = &clk_usb_bus,
};
static struct clk clk_usb_bus_gadget = {
.name = "usb-bus-gadget",
.parent = &clk_usb_bus,
};
static struct clk *init_clocks[] = {
&clk_lcd,
&clk_gpio,
&clk_usb_host,
&clk_usb_device,
&clk_timers,
&s3c24xx_clk_uart0,
&s3c24xx_clk_uart1,
&s3c24xx_clk_uart2,
&clk_rtc,
&clk_watchdog,
&clk_usb_bus_host,
&clk_usb_bus_gadget,
}; };
/* s3c2410_baseclk_add() /* s3c2410_baseclk_add()
...@@ -195,7 +230,6 @@ int __init s3c2410_baseclk_add(void) ...@@ -195,7 +230,6 @@ int __init s3c2410_baseclk_add(void)
{ {
unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW); unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
unsigned long clkcon = __raw_readl(S3C2410_CLKCON); unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
struct clk *clkp;
struct clk *xtal; struct clk *xtal;
int ret; int ret;
int ptr; int ptr;
...@@ -207,8 +241,9 @@ int __init s3c2410_baseclk_add(void) ...@@ -207,8 +241,9 @@ int __init s3c2410_baseclk_add(void)
/* register clocks from clock array */ /* register clocks from clock array */
clkp = init_clocks; for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++) {
for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) { struct clk *clkp = init_clocks[ptr];
/* ensure that we note the clock state */ /* ensure that we note the clock state */
clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0; clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
......
...@@ -166,6 +166,9 @@ static struct clk_lookup s3c2440_clk_lookup[] = { ...@@ -166,6 +166,9 @@ static struct clk_lookup s3c2440_clk_lookup[] = {
CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk), CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n), CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n),
CLKDEV_INIT("s3c2440-uart.0", "uart", &s3c24xx_clk_uart0),
CLKDEV_INIT("s3c2440-uart.1", "uart", &s3c24xx_clk_uart1),
CLKDEV_INIT("s3c2440-uart.2", "uart", &s3c24xx_clk_uart2),
CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll), CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll),
}; };
......
...@@ -83,6 +83,11 @@ extern struct clk clk_ext; ...@@ -83,6 +83,11 @@ extern struct clk clk_ext;
extern struct clksrc_clk clk_epllref; extern struct clksrc_clk clk_epllref;
extern struct clksrc_clk clk_esysclk; extern struct clksrc_clk clk_esysclk;
/* S3C24XX UART clocks */
extern struct clk s3c24xx_clk_uart0;
extern struct clk s3c24xx_clk_uart1;
extern struct clk s3c24xx_clk_uart2;
/* S3C64XX specific clocks */ /* S3C64XX specific clocks */
extern struct clk clk_h2; extern struct clk clk_h2;
extern struct clk clk_27m; extern struct clk clk_27m;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment