diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2010-10-07 04:19:10 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2010-10-08 00:50:18 -0400 |
commit | 7cf4b482f06df0b590a9bc1561a5a81d67e0fe4c (patch) | |
tree | 694533686d5343b47e5bc0c4658080fcfbcc2a1c | |
parent | 4341f9b38fe33aab51439ae59593e149a6f61d9f (diff) |
ARM: SAMSUNG: Add a workaround for get_clock() for serial driver
Serial drivers call get_clock() very early, before platform bus
has been set up, this requires a special check to let them get
a proper clock. Without this patch, a serial console is broken
on S5PV310 and S5PC210 boards.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[kgene.kim@samsung.com: fix coding-style]
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
-rw-r--r-- | arch/arm/plat-samsung/clock.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 90a20512d68d..e8d20b0bc50e 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -48,6 +48,9 @@ | |||
48 | #include <plat/clock.h> | 48 | #include <plat/clock.h> |
49 | #include <plat/cpu.h> | 49 | #include <plat/cpu.h> |
50 | 50 | ||
51 | #include <linux/serial_core.h> | ||
52 | #include <plat/regs-serial.h> /* for s3c24xx_uart_devs */ | ||
53 | |||
51 | /* clock information */ | 54 | /* clock information */ |
52 | 55 | ||
53 | static LIST_HEAD(clocks); | 56 | static LIST_HEAD(clocks); |
@@ -65,6 +68,28 @@ static int clk_null_enable(struct clk *clk, int enable) | |||
65 | return 0; | 68 | return 0; |
66 | } | 69 | } |
67 | 70 | ||
71 | static int dev_is_s3c_uart(struct device *dev) | ||
72 | { | ||
73 | struct platform_device **pdev = s3c24xx_uart_devs; | ||
74 | int i; | ||
75 | for (i = 0; i < ARRAY_SIZE(s3c24xx_uart_devs); i++, pdev++) | ||
76 | if (*pdev && dev == &(*pdev)->dev) | ||
77 | return 1; | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | /* | ||
82 | * Serial drivers call get_clock() very early, before platform bus | ||
83 | * has been set up, this requires a special check to let them get | ||
84 | * a proper clock | ||
85 | */ | ||
86 | |||
87 | static int dev_is_platform_device(struct device *dev) | ||
88 | { | ||
89 | return dev->bus == &platform_bus_type || | ||
90 | (dev->bus == NULL && dev_is_s3c_uart(dev)); | ||
91 | } | ||
92 | |||
68 | /* Clock API calls */ | 93 | /* Clock API calls */ |
69 | 94 | ||
70 | struct clk *clk_get(struct device *dev, const char *id) | 95 | struct clk *clk_get(struct device *dev, const char *id) |
@@ -73,7 +98,7 @@ struct clk *clk_get(struct device *dev, const char *id) | |||
73 | struct clk *clk = ERR_PTR(-ENOENT); | 98 | struct clk *clk = ERR_PTR(-ENOENT); |
74 | int idno; | 99 | int idno; |
75 | 100 | ||
76 | if (dev == NULL || dev->bus != &platform_bus_type) | 101 | if (dev == NULL || !dev_is_platform_device(dev)) |
77 | idno = -1; | 102 | idno = -1; |
78 | else | 103 | else |
79 | idno = to_platform_device(dev)->id; | 104 | idno = to_platform_device(dev)->id; |