aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorYoshii Takashi <takashi.yoshii.zj@renesas.com>2010-11-19 08:20:45 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-11-24 00:54:40 -0500
commitb028f94b76319e1b86103b767ca1c22546a5e7e7 (patch)
tree983612f8af47a0fcfa6fe31f60fa3dfc1c2814e8 /arch/arm/mach-shmobile
parent2d22d486601b2eaedd1c8dd5dc1c4602cab896ef (diff)
ARM: mach-shmobile: sh73a0 i2c_shmobile support.
Platform device resource/data definition for CPU, and clkdev entries Signed-off-by: Takashi YOSHII <takashi.yoshii.zj@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c21
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c115
2 files changed, 134 insertions, 2 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 82c72512dc91..6e48aaefbab1 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -40,21 +40,30 @@ static struct clk sub_clk = {
40 .rate = 48000000, 40 .rate = 48000000,
41}; 41};
42 42
43/* Temporarily fixed 104 MHz HP clock */
44static struct clk hp_clk = {
45 .rate = 104000000,
46};
47
43static struct clk *main_clks[] = { 48static struct clk *main_clks[] = {
44 &r_clk, 49 &r_clk,
45 &sub_clk, 50 &sub_clk,
51 &hp_clk,
46}; 52};
47 53
48enum { MSTP219, 54enum { MSTP219,
49 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 55 MSTP001, MSTP116, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202,
50 MSTP331, MSTP329, MSTP403, 56 MSTP201, MSTP200, MSTP323, MSTP331, MSTP329, MSTP312, MSTP411,
57 MSTP410, MSTP403,
51 MSTP_NR }; 58 MSTP_NR };
52 59
53#define MSTP(_parent, _reg, _bit, _flags) \ 60#define MSTP(_parent, _reg, _bit, _flags) \
54 SH_CLK_MSTP32(_parent, _reg, _bit, _flags) 61 SH_CLK_MSTP32(_parent, _reg, _bit, _flags)
55 62
56static struct clk mstp_clks[MSTP_NR] = { 63static struct clk mstp_clks[MSTP_NR] = {
64 [MSTP001] = MSTP(&hp_clk, SMSTPCR0, 1, 0), /* I2C2 */
57 [MSTP219] = MSTP(&sub_clk, SMSTPCR2, 19, 0), /* SCIFA7 */ 65 [MSTP219] = MSTP(&sub_clk, SMSTPCR2, 19, 0), /* SCIFA7 */
66 [MSTP116] = MSTP(&hp_clk, SMSTPCR1, 16, 0), /* I2C0 */
58 [MSTP207] = MSTP(&sub_clk, SMSTPCR2, 7, 0), /* SCIFA5 */ 67 [MSTP207] = MSTP(&sub_clk, SMSTPCR2, 7, 0), /* SCIFA5 */
59 [MSTP206] = MSTP(&sub_clk, SMSTPCR2, 6, 0), /* SCIFB */ 68 [MSTP206] = MSTP(&sub_clk, SMSTPCR2, 6, 0), /* SCIFB */
60 [MSTP204] = MSTP(&sub_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ 69 [MSTP204] = MSTP(&sub_clk, SMSTPCR2, 4, 0), /* SCIFA0 */
@@ -64,7 +73,10 @@ static struct clk mstp_clks[MSTP_NR] = {
64 [MSTP200] = MSTP(&sub_clk, SMSTPCR2, 0, 0), /* SCIFA4 */ 73 [MSTP200] = MSTP(&sub_clk, SMSTPCR2, 0, 0), /* SCIFA4 */
65 [MSTP331] = MSTP(&sub_clk, SMSTPCR3, 31, 0), /* SCIFA6 */ 74 [MSTP331] = MSTP(&sub_clk, SMSTPCR3, 31, 0), /* SCIFA6 */
66 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 75 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
76 [MSTP323] = MSTP(&hp_clk, SMSTPCR3, 23, 0), /* I2C1 */
67 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 0, 0), /* KEYSC0 */ 77 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 0, 0), /* KEYSC0 */
78 [MSTP411] = MSTP(&hp_clk, SMSTPCR4, 11, 0), /* I2C3 */
79 [MSTP410] = MSTP(&hp_clk, SMSTPCR4, 10, 0), /* I2C4 */
68}; 80};
69 81
70#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } 82#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
@@ -82,6 +94,11 @@ static struct clk_lookup lookups[] = {
82 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 94 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
83 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ 95 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
84 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC0 */ 96 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC0 */
97 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
98 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
99 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
100 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
101 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
85}; 102};
86 103
87void __init sh73a0_clock_init(void) 104void __init sh73a0_clock_init(void)
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 0bc110615aa9..53f1ea66efbc 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -208,6 +208,111 @@ static struct platform_device cmt10_device = {
208 .num_resources = ARRAY_SIZE(cmt10_resources), 208 .num_resources = ARRAY_SIZE(cmt10_resources),
209}; 209};
210 210
211static struct resource i2c0_resources[] = {
212 [0] = {
213 .name = "IIC0",
214 .start = 0xe6820000,
215 .end = 0xe6820425 - 1,
216 .flags = IORESOURCE_MEM,
217 },
218 [1] = {
219 .start = gic_spi(167),
220 .end = gic_spi(170),
221 .flags = IORESOURCE_IRQ,
222 },
223};
224
225static struct resource i2c1_resources[] = {
226 [0] = {
227 .name = "IIC1",
228 .start = 0xe6822000,
229 .end = 0xe6822425 - 1,
230 .flags = IORESOURCE_MEM,
231 },
232 [1] = {
233 .start = gic_spi(51),
234 .end = gic_spi(54),
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
239static struct resource i2c2_resources[] = {
240 [0] = {
241 .name = "IIC2",
242 .start = 0xe6824000,
243 .end = 0xe6824425 - 1,
244 .flags = IORESOURCE_MEM,
245 },
246 [1] = {
247 .start = gic_spi(171),
248 .end = gic_spi(174),
249 .flags = IORESOURCE_IRQ,
250 },
251};
252
253static struct resource i2c3_resources[] = {
254 [0] = {
255 .name = "IIC3",
256 .start = 0xe6826000,
257 .end = 0xe6826425 - 1,
258 .flags = IORESOURCE_MEM,
259 },
260 [1] = {
261 .start = gic_spi(183),
262 .end = gic_spi(186),
263 .flags = IORESOURCE_IRQ,
264 },
265};
266
267static struct resource i2c4_resources[] = {
268 [0] = {
269 .name = "IIC4",
270 .start = 0xe6828000,
271 .end = 0xe6828425 - 1,
272 .flags = IORESOURCE_MEM,
273 },
274 [1] = {
275 .start = gic_spi(187),
276 .end = gic_spi(190),
277 .flags = IORESOURCE_IRQ,
278 },
279};
280
281static struct platform_device i2c0_device = {
282 .name = "i2c-sh_mobile",
283 .id = 0,
284 .resource = i2c0_resources,
285 .num_resources = ARRAY_SIZE(i2c0_resources),
286};
287
288static struct platform_device i2c1_device = {
289 .name = "i2c-sh_mobile",
290 .id = 1,
291 .resource = i2c1_resources,
292 .num_resources = ARRAY_SIZE(i2c1_resources),
293};
294
295static struct platform_device i2c2_device = {
296 .name = "i2c-sh_mobile",
297 .id = 2,
298 .resource = i2c2_resources,
299 .num_resources = ARRAY_SIZE(i2c2_resources),
300};
301
302static struct platform_device i2c3_device = {
303 .name = "i2c-sh_mobile",
304 .id = 3,
305 .resource = i2c3_resources,
306 .num_resources = ARRAY_SIZE(i2c3_resources),
307};
308
309static struct platform_device i2c4_device = {
310 .name = "i2c-sh_mobile",
311 .id = 4,
312 .resource = i2c4_resources,
313 .num_resources = ARRAY_SIZE(i2c4_resources),
314};
315
211static struct platform_device *sh73a0_early_devices[] __initdata = { 316static struct platform_device *sh73a0_early_devices[] __initdata = {
212 &scif0_device, 317 &scif0_device,
213 &scif1_device, 318 &scif1_device,
@@ -221,10 +326,20 @@ static struct platform_device *sh73a0_early_devices[] __initdata = {
221 &cmt10_device, 326 &cmt10_device,
222}; 327};
223 328
329static struct platform_device *sh73a0_late_devices[] __initdata = {
330 &i2c0_device,
331 &i2c1_device,
332 &i2c2_device,
333 &i2c3_device,
334 &i2c4_device,
335};
336
224void __init sh73a0_add_standard_devices(void) 337void __init sh73a0_add_standard_devices(void)
225{ 338{
226 platform_add_devices(sh73a0_early_devices, 339 platform_add_devices(sh73a0_early_devices,
227 ARRAY_SIZE(sh73a0_early_devices)); 340 ARRAY_SIZE(sh73a0_early_devices));
341 platform_add_devices(sh73a0_late_devices,
342 ARRAY_SIZE(sh73a0_late_devices));
228} 343}
229 344
230void __init sh73a0_add_early_devices(void) 345void __init sh73a0_add_early_devices(void)