aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-03-19 16:46:32 -0400
committerArnd Bergmann <arnd@arndb.de>2012-03-20 05:41:43 -0400
commitb2f1df8d2fc14bf7e6d9d967043d4b60c2efd8dc (patch)
tree065282434bde6ef9b4357c042705c5fcef3782ea /arch/arm/mach-shmobile
parentc0206e228e34d8b414fcc63db45b831843adea06 (diff)
parent5cd9eb2736a572a9ef2689829f47ffd4262adc00 (diff)
Merge branch 'renesas/timer' into next/timer
Conflicts: arch/arm/mach-shmobile/timer.c This resolves a nonobvious merge conflict between renesas timer changes in the global timer changes with those from the renesas soc branch and last minute bug fixes that went into v3.3. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c69
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c58
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c47
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c38
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c38
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c41
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c138
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c62
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c8
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c8
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c10
-rw-r--r--arch/arm/mach-shmobile/clock-sh7377.c8
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c125
-rw-r--r--arch/arm/mach-shmobile/clock.c2
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h6
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c2
-rw-r--r--arch/arm/mach-shmobile/pfc-r8a7779.c2
-rw-r--r--arch/arm/mach-shmobile/pfc-sh7372.c41
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c45
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c54
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c32
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c32
-rw-r--r--arch/arm/mach-shmobile/setup-sh7377.c32
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c32
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c2
-rw-r--r--arch/arm/mach-shmobile/timer.c6
28 files changed, 513 insertions, 438 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index eff8a96c75ee..bd7953b59a84 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -30,6 +30,7 @@
30#include <linux/serial_sci.h> 30#include <linux/serial_sci.h>
31#include <linux/smsc911x.h> 31#include <linux/smsc911x.h>
32#include <linux/gpio.h> 32#include <linux/gpio.h>
33#include <linux/videodev2.h>
33#include <linux/input.h> 34#include <linux/input.h>
34#include <linux/input/sh_keysc.h> 35#include <linux/input/sh_keysc.h>
35#include <linux/mmc/host.h> 36#include <linux/mmc/host.h>
@@ -37,7 +38,7 @@
37#include <linux/mmc/sh_mobile_sdhi.h> 38#include <linux/mmc/sh_mobile_sdhi.h>
38#include <linux/mfd/tmio.h> 39#include <linux/mfd/tmio.h>
39#include <linux/sh_clk.h> 40#include <linux/sh_clk.h>
40#include <linux/dma-mapping.h> 41#include <linux/videodev2.h>
41#include <video/sh_mobile_lcdc.h> 42#include <video/sh_mobile_lcdc.h>
42#include <video/sh_mipi_dsi.h> 43#include <video/sh_mipi_dsi.h>
43#include <sound/sh_fsi.h> 44#include <sound/sh_fsi.h>
@@ -46,8 +47,6 @@
46#include <mach/common.h> 47#include <mach/common.h>
47#include <asm/mach-types.h> 48#include <asm/mach-types.h>
48#include <asm/mach/arch.h> 49#include <asm/mach/arch.h>
49#include <asm/mach/map.h>
50#include <asm/mach/time.h>
51#include <asm/hardware/gic.h> 50#include <asm/hardware/gic.h>
52#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
53#include <asm/traps.h> 52#include <asm/traps.h>
@@ -159,19 +158,12 @@ static struct resource sh_mmcif_resources[] = {
159 }, 158 },
160}; 159};
161 160
162static struct sh_mmcif_dma sh_mmcif_dma = {
163 .chan_priv_rx = {
164 .slave_id = SHDMA_SLAVE_MMCIF_RX,
165 },
166 .chan_priv_tx = {
167 .slave_id = SHDMA_SLAVE_MMCIF_TX,
168 },
169};
170static struct sh_mmcif_plat_data sh_mmcif_platdata = { 161static struct sh_mmcif_plat_data sh_mmcif_platdata = {
171 .sup_pclk = 0, 162 .sup_pclk = 0,
172 .ocr = MMC_VDD_165_195, 163 .ocr = MMC_VDD_165_195,
173 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 164 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
174 .dma = &sh_mmcif_dma, 165 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
166 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
175}; 167};
176 168
177static struct platform_device mmc_device = { 169static struct platform_device mmc_device = {
@@ -321,12 +313,11 @@ static struct resource mipidsi0_resources[] = {
321 }, 313 },
322}; 314};
323 315
324#define DSI0PHYCR 0xe615006c
325static int sh_mipi_set_dot_clock(struct platform_device *pdev, 316static int sh_mipi_set_dot_clock(struct platform_device *pdev,
326 void __iomem *base, 317 void __iomem *base,
327 int enable) 318 int enable)
328{ 319{
329 struct clk *pck; 320 struct clk *pck, *phy;
330 int ret; 321 int ret;
331 322
332 pck = clk_get(&pdev->dev, "dsip_clk"); 323 pck = clk_get(&pdev->dev, "dsip_clk");
@@ -335,18 +326,27 @@ static int sh_mipi_set_dot_clock(struct platform_device *pdev,
335 goto sh_mipi_set_dot_clock_pck_err; 326 goto sh_mipi_set_dot_clock_pck_err;
336 } 327 }
337 328
329 phy = clk_get(&pdev->dev, "dsiphy_clk");
330 if (IS_ERR(phy)) {
331 ret = PTR_ERR(phy);
332 goto sh_mipi_set_dot_clock_phy_err;
333 }
334
338 if (enable) { 335 if (enable) {
339 clk_set_rate(pck, clk_round_rate(pck, 24000000)); 336 clk_set_rate(pck, clk_round_rate(pck, 24000000));
340 __raw_writel(0x2a809010, DSI0PHYCR); 337 clk_set_rate(phy, clk_round_rate(pck, 510000000));
341 clk_enable(pck); 338 clk_enable(pck);
339 clk_enable(phy);
342 } else { 340 } else {
343 clk_disable(pck); 341 clk_disable(pck);
342 clk_disable(phy);
344 } 343 }
345 344
346 ret = 0; 345 ret = 0;
347 346
347 clk_put(phy);
348sh_mipi_set_dot_clock_phy_err:
348 clk_put(pck); 349 clk_put(pck);
349
350sh_mipi_set_dot_clock_pck_err: 350sh_mipi_set_dot_clock_pck_err:
351 return ret; 351 return ret;
352} 352}
@@ -485,27 +485,6 @@ static struct platform_device *ag5evm_devices[] __initdata = {
485 &sdhi1_device, 485 &sdhi1_device,
486}; 486};
487 487
488static struct map_desc ag5evm_io_desc[] __initdata = {
489 /* create a 1:1 entity map for 0xe6xxxxxx
490 * used by CPGA, INTC and PFC.
491 */
492 {
493 .virtual = 0xe6000000,
494 .pfn = __phys_to_pfn(0xe6000000),
495 .length = 256 << 20,
496 .type = MT_DEVICE_NONSHARED
497 },
498};
499
500static void __init ag5evm_map_io(void)
501{
502 iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc));
503
504 /* setup early devices and console here as well */
505 sh73a0_add_early_devices();
506 shmobile_setup_console();
507}
508
509static void __init ag5evm_init(void) 488static void __init ag5evm_init(void)
510{ 489{
511 sh73a0_pinmux_init(); 490 sh73a0_pinmux_init();
@@ -621,22 +600,12 @@ static void __init ag5evm_init(void)
621 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); 600 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
622} 601}
623 602
624static void __init ag5evm_timer_init(void)
625{
626 sh73a0_clock_init();
627 shmobile_timer.init();
628 return;
629}
630
631struct sys_timer ag5evm_timer = {
632 .init = ag5evm_timer_init,
633};
634
635MACHINE_START(AG5EVM, "ag5evm") 603MACHINE_START(AG5EVM, "ag5evm")
636 .map_io = ag5evm_map_io, 604 .map_io = sh73a0_map_io,
605 .init_early = sh73a0_add_early_devices,
637 .nr_irqs = NR_IRQS_LEGACY, 606 .nr_irqs = NR_IRQS_LEGACY,
638 .init_irq = sh73a0_init_irq, 607 .init_irq = sh73a0_init_irq,
639 .handle_irq = gic_handle_irq, 608 .handle_irq = gic_handle_irq,
640 .init_machine = ag5evm_init, 609 .init_machine = ag5evm_init,
641 .timer = &ag5evm_timer, 610 .timer = &shmobile_timer,
642MACHINE_END 611MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index aab0a349f759..4739f039650a 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -61,8 +61,6 @@
61 61
62#include <asm/mach-types.h> 62#include <asm/mach-types.h>
63#include <asm/mach/arch.h> 63#include <asm/mach/arch.h>
64#include <asm/mach/map.h>
65#include <asm/mach/time.h>
66#include <asm/setup.h> 64#include <asm/setup.h>
67 65
68/* 66/*
@@ -295,15 +293,6 @@ static struct resource sh_mmcif_resources[] = {
295 }, 293 },
296}; 294};
297 295
298static struct sh_mmcif_dma sh_mmcif_dma = {
299 .chan_priv_rx = {
300 .slave_id = SHDMA_SLAVE_MMCIF_RX,
301 },
302 .chan_priv_tx = {
303 .slave_id = SHDMA_SLAVE_MMCIF_TX,
304 },
305};
306
307static struct sh_mmcif_plat_data sh_mmcif_plat = { 296static struct sh_mmcif_plat_data sh_mmcif_plat = {
308 .sup_pclk = 0, 297 .sup_pclk = 0,
309 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 298 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -311,7 +300,8 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
311 MMC_CAP_8_BIT_DATA | 300 MMC_CAP_8_BIT_DATA |
312 MMC_CAP_NEEDS_POLL, 301 MMC_CAP_NEEDS_POLL,
313 .get_cd = slot_cn7_get_cd, 302 .get_cd = slot_cn7_get_cd,
314 .dma = &sh_mmcif_dma, 303 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
304 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
315}; 305};
316 306
317static struct platform_device sh_mmcif_device = { 307static struct platform_device sh_mmcif_device = {
@@ -802,7 +792,7 @@ static struct fsi_ak4642_info fsi2_ak4643_info = {
802static struct platform_device fsi_ak4643_device = { 792static struct platform_device fsi_ak4643_device = {
803 .name = "fsi-ak4642-audio", 793 .name = "fsi-ak4642-audio",
804 .dev = { 794 .dev = {
805 .platform_data = &fsi_info, 795 .platform_data = &fsi2_ak4643_info,
806 }, 796 },
807}; 797};
808 798
@@ -1198,27 +1188,6 @@ static struct i2c_board_info i2c1_devices[] = {
1198 }, 1188 },
1199}; 1189};
1200 1190
1201static struct map_desc ap4evb_io_desc[] __initdata = {
1202 /* create a 1:1 entity map for 0xe6xxxxxx
1203 * used by CPGA, INTC and PFC.
1204 */
1205 {
1206 .virtual = 0xe6000000,
1207 .pfn = __phys_to_pfn(0xe6000000),
1208 .length = 256 << 20,
1209 .type = MT_DEVICE_NONSHARED
1210 },
1211};
1212
1213static void __init ap4evb_map_io(void)
1214{
1215 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
1216
1217 /* setup early devices and console here as well */
1218 sh7372_add_early_devices();
1219 shmobile_setup_console();
1220}
1221
1222#define GPIO_PORT9CR 0xE6051009 1191#define GPIO_PORT9CR 0xE6051009
1223#define GPIO_PORT10CR 0xE605100A 1192#define GPIO_PORT10CR 0xE605100A
1224#define USCCR1 0xE6058144 1193#define USCCR1 0xE6058144
@@ -1227,6 +1196,9 @@ static void __init ap4evb_init(void)
1227 u32 srcr4; 1196 u32 srcr4;
1228 struct clk *clk; 1197 struct clk *clk;
1229 1198
1199 /* External clock source */
1200 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1201
1230 sh7372_pinmux_init(); 1202 sh7372_pinmux_init();
1231 1203
1232 /* enable SCIFA0 */ 1204 /* enable SCIFA0 */
@@ -1463,23 +1435,11 @@ static void __init ap4evb_init(void)
1463 pm_clk_add(&lcdc1_device.dev, "hdmi"); 1435 pm_clk_add(&lcdc1_device.dev, "hdmi");
1464} 1436}
1465 1437
1466static void __init ap4evb_timer_init(void)
1467{
1468 sh7372_clock_init();
1469 shmobile_timer.init();
1470
1471 /* External clock source */
1472 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1473}
1474
1475static struct sys_timer ap4evb_timer = {
1476 .init = ap4evb_timer_init,
1477};
1478
1479MACHINE_START(AP4EVB, "ap4evb") 1438MACHINE_START(AP4EVB, "ap4evb")
1480 .map_io = ap4evb_map_io, 1439 .map_io = sh7372_map_io,
1440 .init_early = sh7372_add_early_devices,
1481 .init_irq = sh7372_init_irq, 1441 .init_irq = sh7372_init_irq,
1482 .handle_irq = shmobile_handle_irq_intc, 1442 .handle_irq = shmobile_handle_irq_intc,
1483 .init_machine = ap4evb_init, 1443 .init_machine = ap4evb_init,
1484 .timer = &ap4evb_timer, 1444 .timer = &shmobile_timer,
1485MACHINE_END 1445MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 4d2201622323..396814a6a2c9 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -27,6 +27,7 @@
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/smsc911x.h> 29#include <linux/smsc911x.h>
30#include <linux/videodev2.h>
30#include <mach/common.h> 31#include <mach/common.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
@@ -241,7 +242,7 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
241 .clock_source = LCDC_CLK_BUS, 242 .clock_source = LCDC_CLK_BUS,
242 .ch[0] = { 243 .ch[0] = {
243 .chan = LCDC_CHAN_MAINLCD, 244 .chan = LCDC_CHAN_MAINLCD,
244 .bpp = 16, 245 .fourcc = V4L2_PIX_FMT_RGB565,
245 .interface_type = RGB24, 246 .interface_type = RGB24,
246 .clock_divider = 5, 247 .clock_divider = 5,
247 .flags = 0, 248 .flags = 0,
@@ -327,28 +328,6 @@ static struct platform_device *bonito_base_devices[] __initdata = {
327 * map I/O 328 * map I/O
328 */ 329 */
329static struct map_desc bonito_io_desc[] __initdata = { 330static struct map_desc bonito_io_desc[] __initdata = {
330 /*
331 * for CPGA/INTC/PFC
332 * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
333 */
334 {
335 .virtual = 0xe6000000,
336 .pfn = __phys_to_pfn(0xe6000000),
337 .length = 160 << 20,
338 .type = MT_DEVICE_NONSHARED
339 },
340#ifdef CONFIG_CACHE_L2X0
341 /*
342 * for l2x0_init()
343 * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
344 */
345 {
346 .virtual = 0xf0002000,
347 .pfn = __phys_to_pfn(0xf0100000),
348 .length = PAGE_SIZE,
349 .type = MT_DEVICE_NONSHARED
350 },
351#endif
352 /* 331 /*
353 * for FPGA (0x1800000-0x19ffffff) 332 * for FPGA (0x1800000-0x19ffffff)
354 * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000 333 * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000
@@ -363,11 +342,8 @@ static struct map_desc bonito_io_desc[] __initdata = {
363 342
364static void __init bonito_map_io(void) 343static void __init bonito_map_io(void)
365{ 344{
345 r8a7740_map_io();
366 iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc)); 346 iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc));
367
368 /* setup early devices and console here as well */
369 r8a7740_add_early_devices();
370 shmobile_setup_console();
371} 347}
372 348
373/* 349/*
@@ -491,7 +467,7 @@ static void __init bonito_init(void)
491 } 467 }
492} 468}
493 469
494static void __init bonito_timer_init(void) 470static void __init bonito_earlytimer_init(void)
495{ 471{
496 u16 val; 472 u16 val;
497 u8 md_ck = 0; 473 u8 md_ck = 0;
@@ -506,17 +482,22 @@ static void __init bonito_timer_init(void)
506 md_ck |= MD_CK0; 482 md_ck |= MD_CK0;
507 483
508 r8a7740_clock_init(md_ck); 484 r8a7740_clock_init(md_ck);
509 shmobile_timer.init(); 485 shmobile_earlytimer_init();
510} 486}
511 487
512struct sys_timer bonito_timer = { 488void __init bonito_add_early_devices(void)
513 .init = bonito_timer_init, 489{
514}; 490 r8a7740_add_early_devices();
491
492 /* override timer setup with board-specific code */
493 shmobile_timer.init = bonito_earlytimer_init;
494}
515 495
516MACHINE_START(BONITO, "bonito") 496MACHINE_START(BONITO, "bonito")
517 .map_io = bonito_map_io, 497 .map_io = bonito_map_io,
498 .init_early = bonito_add_early_devices,
518 .init_irq = r8a7740_init_irq, 499 .init_irq = r8a7740_init_irq,
519 .handle_irq = shmobile_handle_irq_intc, 500 .handle_irq = shmobile_handle_irq_intc,
520 .init_machine = bonito_init, 501 .init_machine = bonito_init,
521 .timer = &bonito_timer, 502 .timer = &shmobile_timer,
522MACHINE_END 503MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
index 72d557281b1f..b627e89037f5 100644
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -37,8 +37,6 @@
37#include <mach/common.h> 37#include <mach/common.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/time.h>
42 40
43/* 41/*
44 * IrDA 42 * IrDA
@@ -246,27 +244,6 @@ static struct platform_device *g3evm_devices[] __initdata = {
246 &irda_device, 244 &irda_device,
247}; 245};
248 246
249static struct map_desc g3evm_io_desc[] __initdata = {
250 /* create a 1:1 entity map for 0xe6xxxxxx
251 * used by CPGA, INTC and PFC.
252 */
253 {
254 .virtual = 0xe6000000,
255 .pfn = __phys_to_pfn(0xe6000000),
256 .length = 256 << 20,
257 .type = MT_DEVICE_NONSHARED
258 },
259};
260
261static void __init g3evm_map_io(void)
262{
263 iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));
264
265 /* setup early devices and console here as well */
266 sh7367_add_early_devices();
267 shmobile_setup_console();
268}
269
270static void __init g3evm_init(void) 247static void __init g3evm_init(void)
271{ 248{
272 sh7367_pinmux_init(); 249 sh7367_pinmux_init();
@@ -354,20 +331,11 @@ static void __init g3evm_init(void)
354 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices)); 331 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
355} 332}
356 333
357static void __init g3evm_timer_init(void)
358{
359 sh7367_clock_init();
360 shmobile_timer.init();
361}
362
363static struct sys_timer g3evm_timer = {
364 .init = g3evm_timer_init,
365};
366
367MACHINE_START(G3EVM, "g3evm") 334MACHINE_START(G3EVM, "g3evm")
368 .map_io = g3evm_map_io, 335 .map_io = sh7367_map_io,
336 .init_early = sh7367_add_early_devices,
369 .init_irq = sh7367_init_irq, 337 .init_irq = sh7367_init_irq,
370 .handle_irq = shmobile_handle_irq_intc, 338 .handle_irq = shmobile_handle_irq_intc,
371 .init_machine = g3evm_init, 339 .init_machine = g3evm_init,
372 .timer = &g3evm_timer, 340 .timer = &shmobile_timer,
373MACHINE_END 341MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index 2220b885cff5..46d757d2759d 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -38,8 +38,6 @@
38#include <mach/common.h> 38#include <mach/common.h>
39#include <asm/mach-types.h> 39#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/time.h>
43 41
44/* 42/*
45 * SDHI 43 * SDHI
@@ -260,27 +258,6 @@ static struct platform_device *g4evm_devices[] __initdata = {
260 &sdhi1_device, 258 &sdhi1_device,
261}; 259};
262 260
263static struct map_desc g4evm_io_desc[] __initdata = {
264 /* create a 1:1 entity map for 0xe6xxxxxx
265 * used by CPGA, INTC and PFC.
266 */
267 {
268 .virtual = 0xe6000000,
269 .pfn = __phys_to_pfn(0xe6000000),
270 .length = 256 << 20,
271 .type = MT_DEVICE_NONSHARED
272 },
273};
274
275static void __init g4evm_map_io(void)
276{
277 iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc));
278
279 /* setup early devices and console here as well */
280 sh7377_add_early_devices();
281 shmobile_setup_console();
282}
283
284#define GPIO_SDHID0_D0 0xe60520fc 261#define GPIO_SDHID0_D0 0xe60520fc
285#define GPIO_SDHID0_D1 0xe60520fd 262#define GPIO_SDHID0_D1 0xe60520fd
286#define GPIO_SDHID0_D2 0xe60520fe 263#define GPIO_SDHID0_D2 0xe60520fe
@@ -397,20 +374,11 @@ static void __init g4evm_init(void)
397 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); 374 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices));
398} 375}
399 376
400static void __init g4evm_timer_init(void)
401{
402 sh7377_clock_init();
403 shmobile_timer.init();
404}
405
406static struct sys_timer g4evm_timer = {
407 .init = g4evm_timer_init,
408};
409
410MACHINE_START(G4EVM, "g4evm") 377MACHINE_START(G4EVM, "g4evm")
411 .map_io = g4evm_map_io, 378 .map_io = sh7377_map_io,
379 .init_early = sh7377_add_early_devices,
412 .init_irq = sh7377_init_irq, 380 .init_irq = sh7377_init_irq,
413 .handle_irq = shmobile_handle_irq_intc, 381 .handle_irq = shmobile_handle_irq_intc,
414 .init_machine = g4evm_init, 382 .init_machine = g4evm_init,
415 .timer = &g4evm_timer, 383 .timer = &shmobile_timer,
416MACHINE_END 384MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index 857ceeec1bb0..61c067294660 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -43,7 +43,6 @@
43#include <mach/common.h> 43#include <mach/common.h>
44#include <asm/mach-types.h> 44#include <asm/mach-types.h>
45#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
46#include <asm/mach/map.h>
47#include <asm/mach/time.h> 46#include <asm/mach/time.h>
48#include <asm/hardware/gic.h> 47#include <asm/hardware/gic.h>
49#include <asm/hardware/cache-l2x0.h> 48#include <asm/hardware/cache-l2x0.h>
@@ -143,11 +142,10 @@ static struct gpio_keys_button gpio_buttons[] = {
143static struct gpio_keys_platform_data gpio_key_info = { 142static struct gpio_keys_platform_data gpio_key_info = {
144 .buttons = gpio_buttons, 143 .buttons = gpio_buttons,
145 .nbuttons = ARRAY_SIZE(gpio_buttons), 144 .nbuttons = ARRAY_SIZE(gpio_buttons),
146 .poll_interval = 250, /* polled for now */
147}; 145};
148 146
149static struct platform_device gpio_keys_device = { 147static struct platform_device gpio_keys_device = {
150 .name = "gpio-keys-polled", /* polled for now */ 148 .name = "gpio-keys",
151 .id = -1, 149 .id = -1,
152 .dev = { 150 .dev = {
153 .platform_data = &gpio_key_info, 151 .platform_data = &gpio_key_info,
@@ -410,27 +408,6 @@ static struct platform_device *kota2_devices[] __initdata = {
410 &sdhi1_device, 408 &sdhi1_device,
411}; 409};
412 410
413static struct map_desc kota2_io_desc[] __initdata = {
414 /* create a 1:1 entity map for 0xe6xxxxxx
415 * used by CPGA, INTC and PFC.
416 */
417 {
418 .virtual = 0xe6000000,
419 .pfn = __phys_to_pfn(0xe6000000),
420 .length = 256 << 20,
421 .type = MT_DEVICE_NONSHARED
422 },
423};
424
425static void __init kota2_map_io(void)
426{
427 iotable_init(kota2_io_desc, ARRAY_SIZE(kota2_io_desc));
428
429 /* setup early devices and console here as well */
430 sh73a0_add_early_devices();
431 shmobile_setup_console();
432}
433
434static void __init kota2_init(void) 411static void __init kota2_init(void)
435{ 412{
436 sh73a0_pinmux_init(); 413 sh73a0_pinmux_init();
@@ -536,22 +513,12 @@ static void __init kota2_init(void)
536 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); 513 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices));
537} 514}
538 515
539static void __init kota2_timer_init(void)
540{
541 sh73a0_clock_init();
542 shmobile_timer.init();
543 return;
544}
545
546struct sys_timer kota2_timer = {
547 .init = kota2_timer_init,
548};
549
550MACHINE_START(KOTA2, "kota2") 516MACHINE_START(KOTA2, "kota2")
551 .map_io = kota2_map_io, 517 .map_io = sh73a0_map_io,
518 .init_early = sh73a0_add_early_devices,
552 .nr_irqs = NR_IRQS_LEGACY, 519 .nr_irqs = NR_IRQS_LEGACY,
553 .init_irq = sh73a0_init_irq, 520 .init_irq = sh73a0_init_irq,
554 .handle_irq = gic_handle_irq, 521 .handle_irq = gic_handle_irq,
555 .init_machine = kota2_init, 522 .init_machine = kota2_init,
556 .timer = &kota2_timer, 523 .timer = &shmobile_timer,
557MACHINE_END 524MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 9b42fbd10f8e..71d279150471 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -43,7 +43,6 @@
43#include <linux/smsc911x.h> 43#include <linux/smsc911x.h>
44#include <linux/sh_intc.h> 44#include <linux/sh_intc.h>
45#include <linux/tca6416_keypad.h> 45#include <linux/tca6416_keypad.h>
46#include <linux/usb/r8a66597.h>
47#include <linux/usb/renesas_usbhs.h> 46#include <linux/usb/renesas_usbhs.h>
48#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
49 48
@@ -58,8 +57,6 @@
58#include <mach/sh7372.h> 57#include <mach/sh7372.h>
59 58
60#include <asm/mach/arch.h> 59#include <asm/mach/arch.h>
61#include <asm/mach/time.h>
62#include <asm/mach/map.h>
63#include <asm/mach-types.h> 60#include <asm/mach-types.h>
64 61
65/* 62/*
@@ -145,11 +142,6 @@
145 * 1-2 short | VBUS 5V | Host 142 * 1-2 short | VBUS 5V | Host
146 * open | external VBUS | Function 143 * open | external VBUS | Function
147 * 144 *
148 * *1
149 * CN31 is used as
150 * CONFIG_USB_R8A66597_HCD Host
151 * CONFIG_USB_RENESAS_USBHS Function
152 *
153 * CAUTION 145 * CAUTION
154 * 146 *
155 * renesas_usbhs driver can use external interrupt mode 147 * renesas_usbhs driver can use external interrupt mode
@@ -161,15 +153,6 @@
161 * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0", 153 * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0",
162 * because Touchscreen is using IRQ7-PORT40. 154 * because Touchscreen is using IRQ7-PORT40.
163 * It is impossible to use IRQ7 demux on this board. 155 * It is impossible to use IRQ7 demux on this board.
164 *
165 * We can use external interrupt mode USB-Function on "USB1".
166 * USB1 can become Host by r8a66597, and become Function by renesas_usbhs.
167 * But don't select both drivers in same time.
168 * These uses same IRQ number for request_irq(), and aren't supporting
169 * IRQF_SHARED / IORESOURCE_IRQ_SHAREABLE.
170 *
171 * Actually these are old/new version of USB driver.
172 * This mean its register will be broken if it supports shared IRQ,
173 */ 156 */
174 157
175/* 158/*
@@ -208,6 +191,16 @@
208 */ 191 */
209 192
210/* 193/*
194 * FSI - AK4642
195 *
196 * it needs amixer settings for playing
197 *
198 * amixer set "Headphone" on
199 * amixer set "HPOUTL Mixer DACH" on
200 * amixer set "HPOUTR Mixer DACH" on
201 */
202
203/*
211 * FIXME !! 204 * FIXME !!
212 * 205 *
213 * gpio_no_direction 206 * gpio_no_direction
@@ -676,51 +669,16 @@ static struct platform_device usbhs0_device = {
676 * Use J30 to select between Host and Function. This setting 669 * Use J30 to select between Host and Function. This setting
677 * can however not be detected by software. Hotplug of USBHS1 670 * can however not be detected by software. Hotplug of USBHS1
678 * is provided via IRQ8. 671 * is provided via IRQ8.
672 *
673 * Current USB1 works as "USB Host".
674 * - set J30 "short"
675 *
676 * If you want to use it as "USB gadget",
677 * - J30 "open"
678 * - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET
679 * - add .get_vbus = usbhs_get_vbus in usbhs1_private
679 */ 680 */
680#define IRQ8 evt2irq(0x0300) 681#define IRQ8 evt2irq(0x0300)
681
682/* USBHS1 USB Host support via r8a66597_hcd */
683static void usb1_host_port_power(int port, int power)
684{
685 if (!power) /* only power-on is supported for now */
686 return;
687
688 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
689 __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
690}
691
692static struct r8a66597_platdata usb1_host_data = {
693 .on_chip = 1,
694 .port_power = usb1_host_port_power,
695};
696
697static struct resource usb1_host_resources[] = {
698 [0] = {
699 .name = "USBHS1",
700 .start = 0xe68b0000,
701 .end = 0xe68b00e6 - 1,
702 .flags = IORESOURCE_MEM,
703 },
704 [1] = {
705 .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
706 .flags = IORESOURCE_IRQ,
707 },
708};
709
710static struct platform_device usb1_host_device = {
711 .name = "r8a66597_hcd",
712 .id = 1,
713 .dev = {
714 .dma_mask = NULL, /* not use dma */
715 .coherent_dma_mask = 0xffffffff,
716 .platform_data = &usb1_host_data,
717 },
718 .num_resources = ARRAY_SIZE(usb1_host_resources),
719 .resource = usb1_host_resources,
720};
721
722/* USBHS1 USB Function support via renesas_usbhs */
723
724#define USB_PHY_MODE (1 << 4) 682#define USB_PHY_MODE (1 << 4)
725#define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) 683#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
726#define USB_PHY_ON (1 << 1) 684#define USB_PHY_ON (1 << 1)
@@ -776,7 +734,7 @@ static void usbhs1_hardware_exit(struct platform_device *pdev)
776 734
777static int usbhs1_get_id(struct platform_device *pdev) 735static int usbhs1_get_id(struct platform_device *pdev)
778{ 736{
779 return USBHS_GADGET; 737 return USBHS_HOST;
780} 738}
781 739
782static u32 usbhs1_pipe_cfg[] = { 740static u32 usbhs1_pipe_cfg[] = {
@@ -807,7 +765,6 @@ static struct usbhs_private usbhs1_private = {
807 .hardware_exit = usbhs1_hardware_exit, 765 .hardware_exit = usbhs1_hardware_exit,
808 .get_id = usbhs1_get_id, 766 .get_id = usbhs1_get_id,
809 .phy_reset = usbhs_phy_reset, 767 .phy_reset = usbhs_phy_reset,
810 .get_vbus = usbhs_get_vbus,
811 }, 768 },
812 .driver_param = { 769 .driver_param = {
813 .buswait_bwait = 4, 770 .buswait_bwait = 4,
@@ -1184,15 +1141,6 @@ static struct resource sh_mmcif_resources[] = {
1184 }, 1141 },
1185}; 1142};
1186 1143
1187static struct sh_mmcif_dma sh_mmcif_dma = {
1188 .chan_priv_rx = {
1189 .slave_id = SHDMA_SLAVE_MMCIF_RX,
1190 },
1191 .chan_priv_tx = {
1192 .slave_id = SHDMA_SLAVE_MMCIF_TX,
1193 },
1194};
1195
1196static struct sh_mmcif_plat_data sh_mmcif_plat = { 1144static struct sh_mmcif_plat_data sh_mmcif_plat = {
1197 .sup_pclk = 0, 1145 .sup_pclk = 0,
1198 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 1146 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -1200,7 +1148,8 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
1200 MMC_CAP_8_BIT_DATA | 1148 MMC_CAP_8_BIT_DATA |
1201 MMC_CAP_NEEDS_POLL, 1149 MMC_CAP_NEEDS_POLL,
1202 .get_cd = slot_cn7_get_cd, 1150 .get_cd = slot_cn7_get_cd,
1203 .dma = &sh_mmcif_dma, 1151 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
1152 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
1204}; 1153};
1205 1154
1206static struct platform_device sh_mmcif_device = { 1155static struct platform_device sh_mmcif_device = {
@@ -1311,7 +1260,6 @@ static struct platform_device *mackerel_devices[] __initdata = {
1311 &nor_flash_device, 1260 &nor_flash_device,
1312 &smc911x_device, 1261 &smc911x_device,
1313 &lcdc_device, 1262 &lcdc_device,
1314 &usb1_host_device,
1315 &usbhs1_device, 1263 &usbhs1_device,
1316 &usbhs0_device, 1264 &usbhs0_device,
1317 &leds_device, 1265 &leds_device,
@@ -1387,25 +1335,13 @@ static struct i2c_board_info i2c1_devices[] = {
1387 }, 1335 },
1388}; 1336};
1389 1337
1390static struct map_desc mackerel_io_desc[] __initdata = {
1391 /* create a 1:1 entity map for 0xe6xxxxxx
1392 * used by CPGA, INTC and PFC.
1393 */
1394 {
1395 .virtual = 0xe6000000,
1396 .pfn = __phys_to_pfn(0xe6000000),
1397 .length = 256 << 20,
1398 .type = MT_DEVICE_NONSHARED
1399 },
1400};
1401
1402static void __init mackerel_map_io(void) 1338static void __init mackerel_map_io(void)
1403{ 1339{
1404 iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc)); 1340 sh7372_map_io();
1405 1341 /* DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
1406 /* setup early devices and console here as well */ 1342 * enough to allocate the frame buffer memory.
1407 sh7372_add_early_devices(); 1343 */
1408 shmobile_setup_console(); 1344 init_consistent_dma_size(12 << 20);
1409} 1345}
1410 1346
1411#define GPIO_PORT9CR 0xE6051009 1347#define GPIO_PORT9CR 0xE6051009
@@ -1420,6 +1356,9 @@ static void __init mackerel_init(void)
1420 struct clk *clk; 1356 struct clk *clk;
1421 int ret; 1357 int ret;
1422 1358
1359 /* External clock source */
1360 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1361
1423 sh7372_pinmux_init(); 1362 sh7372_pinmux_init();
1424 1363
1425 /* enable SCIFA0 */ 1364 /* enable SCIFA0 */
@@ -1473,9 +1412,6 @@ static void __init mackerel_init(void)
1473 gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */ 1412 gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */
1474 gpio_request(GPIO_FN_IDIN_1_113, NULL); 1413 gpio_request(GPIO_FN_IDIN_1_113, NULL);
1475 1414
1476 /* USB phy tweak to make the r8a66597_hcd host driver work */
1477 __raw_writew(0x8a0a, 0xe6058130); /* USBCR4 */
1478
1479 /* enable FSI2 port A (ak4643) */ 1415 /* enable FSI2 port A (ak4643) */
1480 gpio_request(GPIO_FN_FSIAIBT, NULL); 1416 gpio_request(GPIO_FN_FSIAIBT, NULL);
1481 gpio_request(GPIO_FN_FSIAILR, NULL); 1417 gpio_request(GPIO_FN_FSIAILR, NULL);
@@ -1626,23 +1562,11 @@ static void __init mackerel_init(void)
1626 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi"); 1562 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
1627} 1563}
1628 1564
1629static void __init mackerel_timer_init(void)
1630{
1631 sh7372_clock_init();
1632 shmobile_timer.init();
1633
1634 /* External clock source */
1635 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1636}
1637
1638static struct sys_timer mackerel_timer = {
1639 .init = mackerel_timer_init,
1640};
1641
1642MACHINE_START(MACKEREL, "mackerel") 1565MACHINE_START(MACKEREL, "mackerel")
1643 .map_io = mackerel_map_io, 1566 .map_io = mackerel_map_io,
1567 .init_early = sh7372_add_early_devices,
1644 .init_irq = sh7372_init_irq, 1568 .init_irq = sh7372_init_irq,
1645 .handle_irq = shmobile_handle_irq_intc, 1569 .handle_irq = shmobile_handle_irq_intc,
1646 .init_machine = mackerel_init, 1570 .init_machine = mackerel_init,
1647 .timer = &mackerel_timer, 1571 .timer = &shmobile_timer,
1648MACHINE_END 1572MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index f0e02c0ce99f..cbd5e4cd06d2 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -33,8 +33,6 @@
33#include <mach/common.h> 33#include <mach/common.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/time.h>
38#include <asm/hardware/gic.h> 36#include <asm/hardware/gic.h>
39#include <asm/traps.h> 37#include <asm/traps.h>
40 38
@@ -72,49 +70,6 @@ static struct platform_device *marzen_devices[] __initdata = {
72 &eth_device, 70 &eth_device,
73}; 71};
74 72
75static struct map_desc marzen_io_desc[] __initdata = {
76 /* 2M entity map for 0xf0000000 (MPCORE) */
77 {
78 .virtual = 0xf0000000,
79 .pfn = __phys_to_pfn(0xf0000000),
80 .length = SZ_2M,
81 .type = MT_DEVICE_NONSHARED
82 },
83 /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
84 {
85 .virtual = 0xfe000000,
86 .pfn = __phys_to_pfn(0xfe000000),
87 .length = SZ_16M,
88 .type = MT_DEVICE_NONSHARED
89 },
90};
91
92static void __init marzen_map_io(void)
93{
94 iotable_init(marzen_io_desc, ARRAY_SIZE(marzen_io_desc));
95}
96
97static void __init marzen_init_early(void)
98{
99 r8a7779_add_early_devices();
100
101 /* Early serial console setup is not included here due to
102 * memory map collisions. The SCIF serial ports in r8a7779
103 * are difficult to entity map 1:1 due to collision with the
104 * virtual memory range used by the coherent DMA code on ARM.
105 *
106 * Anyone wanting to debug early can remove UPF_IOREMAP from
107 * the sh-sci serial console platform data, adjust mapbase
108 * to a static M:N virt:phys mapping that needs to be added to
109 * the mappings passed with iotable_init() above.
110 *
111 * Then add a call to shmobile_setup_console() from this function.
112 *
113 * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
114 * command line.
115 */
116}
117
118static void __init marzen_init(void) 73static void __init marzen_init(void)
119{ 74{
120 r8a7779_pinmux_init(); 75 r8a7779_pinmux_init();
@@ -135,23 +90,12 @@ static void __init marzen_init(void)
135 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 90 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
136} 91}
137 92
138static void __init marzen_timer_init(void)
139{
140 r8a7779_clock_init();
141 shmobile_timer.init();
142 return;
143}
144
145struct sys_timer marzen_timer = {
146 .init = marzen_timer_init,
147};
148
149MACHINE_START(MARZEN, "marzen") 93MACHINE_START(MARZEN, "marzen")
150 .map_io = marzen_map_io, 94 .map_io = r8a7779_map_io,
151 .init_early = marzen_init_early, 95 .init_early = r8a7779_add_early_devices,
152 .nr_irqs = NR_IRQS_LEGACY, 96 .nr_irqs = NR_IRQS_LEGACY,
153 .init_irq = r8a7779_init_irq, 97 .init_irq = r8a7779_init_irq,
154 .handle_irq = gic_handle_irq, 98 .handle_irq = gic_handle_irq,
155 .init_machine = marzen_init, 99 .init_machine = marzen_init,
156 .timer = &marzen_timer, 100 .timer = &shmobile_timer,
157MACHINE_END 101MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 3b35b9afc001..99c4d743a99c 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -93,7 +93,7 @@ static unsigned long div_recalc(struct clk *clk)
93 return clk->parent->rate / (int)(clk->priv); 93 return clk->parent->rate / (int)(clk->priv);
94} 94}
95 95
96static struct clk_ops div_clk_ops = { 96static struct sh_clk_ops div_clk_ops = {
97 .recalc = div_recalc, 97 .recalc = div_recalc,
98}; 98};
99 99
@@ -125,7 +125,7 @@ static struct clk extal2_div2_clk = {
125 .parent = &extal2_clk, 125 .parent = &extal2_clk,
126}; 126};
127 127
128static struct clk_ops followparent_clk_ops = { 128static struct sh_clk_ops followparent_clk_ops = {
129 .recalc = followparent_recalc, 129 .recalc = followparent_recalc,
130}; 130};
131 131
@@ -156,7 +156,7 @@ static unsigned long pllc01_recalc(struct clk *clk)
156 return clk->parent->rate * mult; 156 return clk->parent->rate * mult;
157} 157}
158 158
159static struct clk_ops pllc01_clk_ops = { 159static struct sh_clk_ops pllc01_clk_ops = {
160 .recalc = pllc01_recalc, 160 .recalc = pllc01_recalc,
161}; 161};
162 162
@@ -376,7 +376,7 @@ void __init r8a7740_clock_init(u8 md_ck)
376 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 376 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
377 377
378 if (!ret) 378 if (!ret)
379 clk_init(); 379 shmobile_clk_init();
380 else 380 else
381 panic("failed to setup r8a7740 clocks\n"); 381 panic("failed to setup r8a7740 clocks\n");
382} 382}
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index b4b0e8cd096d..7d6e9fe47b56 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -107,7 +107,7 @@ static unsigned long mul4_recalc(struct clk *clk)
107 return clk->parent->rate * 4; 107 return clk->parent->rate * 4;
108} 108}
109 109
110static struct clk_ops mul4_clk_ops = { 110static struct sh_clk_ops mul4_clk_ops = {
111 .recalc = mul4_recalc, 111 .recalc = mul4_recalc,
112}; 112};
113 113
@@ -170,7 +170,7 @@ void __init r8a7779_clock_init(void)
170 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 170 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
171 171
172 if (!ret) 172 if (!ret)
173 clk_init(); 173 shmobile_clk_init();
174 else 174 else
175 panic("failed to setup r8a7779 clocks\n"); 175 panic("failed to setup r8a7779 clocks\n");
176} 176}
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
index 5218c34a9cc6..006e7b5d304c 100644
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -74,7 +74,7 @@ static unsigned long div2_recalc(struct clk *clk)
74 return clk->parent->rate / 2; 74 return clk->parent->rate / 2;
75} 75}
76 76
77static struct clk_ops div2_clk_ops = { 77static struct sh_clk_ops div2_clk_ops = {
78 .recalc = div2_recalc, 78 .recalc = div2_recalc,
79}; 79};
80 80
@@ -101,7 +101,7 @@ static unsigned long pllc1_recalc(struct clk *clk)
101 return clk->parent->rate * mult; 101 return clk->parent->rate * mult;
102} 102}
103 103
104static struct clk_ops pllc1_clk_ops = { 104static struct sh_clk_ops pllc1_clk_ops = {
105 .recalc = pllc1_recalc, 105 .recalc = pllc1_recalc,
106}; 106};
107 107
@@ -128,7 +128,7 @@ static unsigned long pllc2_recalc(struct clk *clk)
128 return clk->parent->rate * mult; 128 return clk->parent->rate * mult;
129} 129}
130 130
131static struct clk_ops pllc2_clk_ops = { 131static struct sh_clk_ops pllc2_clk_ops = {
132 .recalc = pllc2_recalc, 132 .recalc = pllc2_recalc,
133}; 133};
134 134
@@ -349,7 +349,7 @@ void __init sh7367_clock_init(void)
349 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 349 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
350 350
351 if (!ret) 351 if (!ret)
352 clk_init(); 352 shmobile_clk_init();
353 else 353 else
354 panic("failed to setup sh7367 clocks\n"); 354 panic("failed to setup sh7367 clocks\n");
355} 355}
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 293456d8dcfd..de243e3c8392 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -89,7 +89,7 @@ static unsigned long div2_recalc(struct clk *clk)
89 return clk->parent->rate / 2; 89 return clk->parent->rate / 2;
90} 90}
91 91
92static struct clk_ops div2_clk_ops = { 92static struct sh_clk_ops div2_clk_ops = {
93 .recalc = div2_recalc, 93 .recalc = div2_recalc,
94}; 94};
95 95
@@ -128,7 +128,7 @@ static unsigned long pllc01_recalc(struct clk *clk)
128 return clk->parent->rate * mult; 128 return clk->parent->rate * mult;
129} 129}
130 130
131static struct clk_ops pllc01_clk_ops = { 131static struct sh_clk_ops pllc01_clk_ops = {
132 .recalc = pllc01_recalc, 132 .recalc = pllc01_recalc,
133}; 133};
134 134
@@ -276,7 +276,7 @@ static int pllc2_set_parent(struct clk *clk, struct clk *parent)
276 return 0; 276 return 0;
277} 277}
278 278
279static struct clk_ops pllc2_clk_ops = { 279static struct sh_clk_ops pllc2_clk_ops = {
280 .recalc = pllc2_recalc, 280 .recalc = pllc2_recalc,
281 .round_rate = pllc2_round_rate, 281 .round_rate = pllc2_round_rate,
282 .set_rate = pllc2_set_rate, 282 .set_rate = pllc2_set_rate,
@@ -468,7 +468,7 @@ static int fsidiv_set_rate(struct clk *clk, unsigned long rate)
468 return 0; 468 return 0;
469} 469}
470 470
471static struct clk_ops fsidiv_clk_ops = { 471static struct sh_clk_ops fsidiv_clk_ops = {
472 .recalc = fsidiv_recalc, 472 .recalc = fsidiv_recalc,
473 .round_rate = fsidiv_round_rate, 473 .round_rate = fsidiv_round_rate,
474 .set_rate = fsidiv_set_rate, 474 .set_rate = fsidiv_set_rate,
@@ -710,7 +710,7 @@ void __init sh7372_clock_init(void)
710 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 710 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
711 711
712 if (!ret) 712 if (!ret)
713 clk_init(); 713 shmobile_clk_init();
714 else 714 else
715 panic("failed to setup sh7372 clocks\n"); 715 panic("failed to setup sh7372 clocks\n");
716 716
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
index 8cee7b151ae3..0798a15936c3 100644
--- a/arch/arm/mach-shmobile/clock-sh7377.c
+++ b/arch/arm/mach-shmobile/clock-sh7377.c
@@ -77,7 +77,7 @@ static unsigned long div2_recalc(struct clk *clk)
77 return clk->parent->rate / 2; 77 return clk->parent->rate / 2;
78} 78}
79 79
80static struct clk_ops div2_clk_ops = { 80static struct sh_clk_ops div2_clk_ops = {
81 .recalc = div2_recalc, 81 .recalc = div2_recalc,
82}; 82};
83 83
@@ -110,7 +110,7 @@ static unsigned long pllc1_recalc(struct clk *clk)
110 return clk->parent->rate * mult; 110 return clk->parent->rate * mult;
111} 111}
112 112
113static struct clk_ops pllc1_clk_ops = { 113static struct sh_clk_ops pllc1_clk_ops = {
114 .recalc = pllc1_recalc, 114 .recalc = pllc1_recalc,
115}; 115};
116 116
@@ -137,7 +137,7 @@ static unsigned long pllc2_recalc(struct clk *clk)
137 return clk->parent->rate * mult; 137 return clk->parent->rate * mult;
138} 138}
139 139
140static struct clk_ops pllc2_clk_ops = { 140static struct sh_clk_ops pllc2_clk_ops = {
141 .recalc = pllc2_recalc, 141 .recalc = pllc2_recalc,
142}; 142};
143 143
@@ -360,7 +360,7 @@ void __init sh7377_clock_init(void)
360 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 360 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
361 361
362 if (!ret) 362 if (!ret)
363 clk_init(); 363 shmobile_clk_init();
364 else 364 else
365 panic("failed to setup sh7377 clocks\n"); 365 panic("failed to setup sh7377 clocks\n");
366} 366}
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index afbead6a6e17..472d1f5361e5 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -88,7 +88,7 @@ static unsigned long div2_recalc(struct clk *clk)
88 return clk->parent->rate / 2; 88 return clk->parent->rate / 2;
89} 89}
90 90
91static struct clk_ops div2_clk_ops = { 91static struct sh_clk_ops div2_clk_ops = {
92 .recalc = div2_recalc, 92 .recalc = div2_recalc,
93}; 93};
94 94
@@ -97,7 +97,7 @@ static unsigned long div7_recalc(struct clk *clk)
97 return clk->parent->rate / 7; 97 return clk->parent->rate / 7;
98} 98}
99 99
100static struct clk_ops div7_clk_ops = { 100static struct sh_clk_ops div7_clk_ops = {
101 .recalc = div7_recalc, 101 .recalc = div7_recalc,
102}; 102};
103 103
@@ -106,7 +106,7 @@ static unsigned long div13_recalc(struct clk *clk)
106 return clk->parent->rate / 13; 106 return clk->parent->rate / 13;
107} 107}
108 108
109static struct clk_ops div13_clk_ops = { 109static struct sh_clk_ops div13_clk_ops = {
110 .recalc = div13_recalc, 110 .recalc = div13_recalc,
111}; 111};
112 112
@@ -122,7 +122,7 @@ static struct clk extal2_div2_clk = {
122 .parent = &sh73a0_extal2_clk, 122 .parent = &sh73a0_extal2_clk,
123}; 123};
124 124
125static struct clk_ops main_clk_ops = { 125static struct sh_clk_ops main_clk_ops = {
126 .recalc = followparent_recalc, 126 .recalc = followparent_recalc,
127}; 127};
128 128
@@ -156,7 +156,7 @@ static unsigned long pll_recalc(struct clk *clk)
156 return clk->parent->rate * mult; 156 return clk->parent->rate * mult;
157} 157}
158 158
159static struct clk_ops pll_clk_ops = { 159static struct sh_clk_ops pll_clk_ops = {
160 .recalc = pll_recalc, 160 .recalc = pll_recalc,
161}; 161};
162 162
@@ -365,6 +365,114 @@ static struct clk div6_clks[DIV6_NR] = {
365 dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3), 365 dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
366}; 366};
367 367
368/* DSI DIV */
369static unsigned long dsiphy_recalc(struct clk *clk)
370{
371 u32 value;
372
373 value = __raw_readl(clk->mapping->base);
374
375 /* FIXME */
376 if (!(value & 0x000B8000))
377 return clk->parent->rate;
378
379 value &= 0x3f;
380 value += 1;
381
382 if ((value < 12) ||
383 (value > 33)) {
384 pr_err("DSIPHY has wrong value (%d)", value);
385 return 0;
386 }
387
388 return clk->parent->rate / value;
389}
390
391static long dsiphy_round_rate(struct clk *clk, unsigned long rate)
392{
393 return clk_rate_mult_range_round(clk, 12, 33, rate);
394}
395
396static void dsiphy_disable(struct clk *clk)
397{
398 u32 value;
399
400 value = __raw_readl(clk->mapping->base);
401 value &= ~0x000B8000;
402
403 __raw_writel(value , clk->mapping->base);
404}
405
406static int dsiphy_enable(struct clk *clk)
407{
408 u32 value;
409 int multi;
410
411 value = __raw_readl(clk->mapping->base);
412 multi = (value & 0x3f) + 1;
413
414 if ((multi < 12) || (multi > 33))
415 return -EIO;
416
417 __raw_writel(value | 0x000B8000, clk->mapping->base);
418
419 return 0;
420}
421
422static int dsiphy_set_rate(struct clk *clk, unsigned long rate)
423{
424 u32 value;
425 int idx;
426
427 idx = rate / clk->parent->rate;
428 if ((idx < 12) || (idx > 33))
429 return -EINVAL;
430
431 idx += -1;
432
433 value = __raw_readl(clk->mapping->base);
434 value = (value & ~0x3f) + idx;
435
436 __raw_writel(value, clk->mapping->base);
437
438 return 0;
439}
440
441static struct sh_clk_ops dsiphy_clk_ops = {
442 .recalc = dsiphy_recalc,
443 .round_rate = dsiphy_round_rate,
444 .set_rate = dsiphy_set_rate,
445 .enable = dsiphy_enable,
446 .disable = dsiphy_disable,
447};
448
449static struct clk_mapping dsi0phy_clk_mapping = {
450 .phys = DSI0PHYCR,
451 .len = 4,
452};
453
454static struct clk_mapping dsi1phy_clk_mapping = {
455 .phys = DSI1PHYCR,
456 .len = 4,
457};
458
459static struct clk dsi0phy_clk = {
460 .ops = &dsiphy_clk_ops,
461 .parent = &div6_clks[DIV6_DSI0P], /* late install */
462 .mapping = &dsi0phy_clk_mapping,
463};
464
465static struct clk dsi1phy_clk = {
466 .ops = &dsiphy_clk_ops,
467 .parent = &div6_clks[DIV6_DSI1P], /* late install */
468 .mapping = &dsi1phy_clk_mapping,
469};
470
471static struct clk *late_main_clks[] = {
472 &dsi0phy_clk,
473 &dsi1phy_clk,
474};
475
368enum { MSTP001, 476enum { MSTP001,
369 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, 477 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
370 MSTP219, 478 MSTP219,
@@ -429,6 +537,8 @@ static struct clk_lookup lookups[] = {
429 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 537 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
430 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 538 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
431 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 539 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
540 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
541 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
432 542
433 /* MSTP32 clocks */ 543 /* MSTP32 clocks */
434 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ 544 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
@@ -504,10 +614,13 @@ void __init sh73a0_clock_init(void)
504 if (!ret) 614 if (!ret)
505 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 615 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
506 616
617 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
618 ret = clk_register(late_main_clks[k]);
619
507 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 620 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
508 621
509 if (!ret) 622 if (!ret)
510 clk_init(); 623 shmobile_clk_init();
511 else 624 else
512 panic("failed to setup sh73a0 clocks\n"); 625 panic("failed to setup sh73a0 clocks\n");
513} 626}
diff --git a/arch/arm/mach-shmobile/clock.c b/arch/arm/mach-shmobile/clock.c
index 31654d78b96b..e816ca9bd213 100644
--- a/arch/arm/mach-shmobile/clock.c
+++ b/arch/arm/mach-shmobile/clock.c
@@ -24,7 +24,7 @@
24#include <linux/sh_clk.h> 24#include <linux/sh_clk.h>
25#include <linux/export.h> 25#include <linux/export.h>
26 26
27int __init clk_init(void) 27int __init shmobile_clk_init(void)
28{ 28{
29 /* Kick the child clocks.. */ 29 /* Kick the child clocks.. */
30 recalculate_root_clocks(); 30 recalculate_root_clocks();
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 9fde3eb686a6..83ad3fe0a75f 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -1,6 +1,7 @@
1#ifndef __ARCH_MACH_COMMON_H 1#ifndef __ARCH_MACH_COMMON_H
2#define __ARCH_MACH_COMMON_H 2#define __ARCH_MACH_COMMON_H
3 3
4extern void shmobile_earlytimer_init(void);
4extern struct sys_timer shmobile_timer; 5extern struct sys_timer shmobile_timer;
5struct twd_local_timer; 6struct twd_local_timer;
6void shmobile_twd_init(struct twd_local_timer *twd_local_timer); 7void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
@@ -8,7 +9,7 @@ extern void shmobile_setup_console(void);
8extern void shmobile_secondary_vector(void); 9extern void shmobile_secondary_vector(void);
9extern int shmobile_platform_cpu_kill(unsigned int cpu); 10extern int shmobile_platform_cpu_kill(unsigned int cpu);
10struct clk; 11struct clk;
11extern int clk_init(void); 12extern int shmobile_clk_init(void);
12extern void shmobile_handle_irq_intc(struct pt_regs *); 13extern void shmobile_handle_irq_intc(struct pt_regs *);
13extern struct platform_suspend_ops shmobile_suspend_ops; 14extern struct platform_suspend_ops shmobile_suspend_ops;
14struct cpuidle_driver; 15struct cpuidle_driver;
@@ -16,6 +17,7 @@ extern void (*shmobile_cpuidle_modes[])(void);
16extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); 17extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
17 18
18extern void sh7367_init_irq(void); 19extern void sh7367_init_irq(void);
20extern void sh7367_map_io(void);
19extern void sh7367_add_early_devices(void); 21extern void sh7367_add_early_devices(void);
20extern void sh7367_add_standard_devices(void); 22extern void sh7367_add_standard_devices(void);
21extern void sh7367_clock_init(void); 23extern void sh7367_clock_init(void);
@@ -24,6 +26,7 @@ extern struct clk sh7367_extalb1_clk;
24extern struct clk sh7367_extal2_clk; 26extern struct clk sh7367_extal2_clk;
25 27
26extern void sh7377_init_irq(void); 28extern void sh7377_init_irq(void);
29extern void sh7377_map_io(void);
27extern void sh7377_add_early_devices(void); 30extern void sh7377_add_early_devices(void);
28extern void sh7377_add_standard_devices(void); 31extern void sh7377_add_standard_devices(void);
29extern void sh7377_clock_init(void); 32extern void sh7377_clock_init(void);
@@ -32,6 +35,7 @@ extern struct clk sh7377_extalc1_clk;
32extern struct clk sh7377_extal2_clk; 35extern struct clk sh7377_extal2_clk;
33 36
34extern void sh7372_init_irq(void); 37extern void sh7372_init_irq(void);
38extern void sh7372_map_io(void);
35extern void sh7372_add_early_devices(void); 39extern void sh7372_add_early_devices(void);
36extern void sh7372_add_standard_devices(void); 40extern void sh7372_add_standard_devices(void);
37extern void sh7372_clock_init(void); 41extern void sh7372_clock_init(void);
@@ -43,6 +47,7 @@ extern struct clk sh7372_extal1_clk;
43extern struct clk sh7372_extal2_clk; 47extern struct clk sh7372_extal2_clk;
44 48
45extern void sh73a0_init_irq(void); 49extern void sh73a0_init_irq(void);
50extern void sh73a0_map_io(void);
46extern void sh73a0_add_early_devices(void); 51extern void sh73a0_add_early_devices(void);
47extern void sh73a0_add_standard_devices(void); 52extern void sh73a0_add_standard_devices(void);
48extern void sh73a0_clock_init(void); 53extern void sh73a0_clock_init(void);
@@ -58,12 +63,14 @@ extern int sh73a0_boot_secondary(unsigned int cpu);
58extern void sh73a0_smp_prepare_cpus(void); 63extern void sh73a0_smp_prepare_cpus(void);
59 64
60extern void r8a7740_init_irq(void); 65extern void r8a7740_init_irq(void);
66extern void r8a7740_map_io(void);
61extern void r8a7740_add_early_devices(void); 67extern void r8a7740_add_early_devices(void);
62extern void r8a7740_add_standard_devices(void); 68extern void r8a7740_add_standard_devices(void);
63extern void r8a7740_clock_init(u8 md_ck); 69extern void r8a7740_clock_init(u8 md_ck);
64extern void r8a7740_pinmux_init(void); 70extern void r8a7740_pinmux_init(void);
65 71
66extern void r8a7779_init_irq(void); 72extern void r8a7779_init_irq(void);
73extern void r8a7779_map_io(void);
67extern void r8a7779_add_early_devices(void); 74extern void r8a7779_add_early_devices(void);
68extern void r8a7779_add_standard_devices(void); 75extern void r8a7779_add_standard_devices(void);
69extern void r8a7779_clock_init(void); 76extern void r8a7779_clock_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index 881d515a9686..cad57578ceed 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -515,8 +515,8 @@ enum {
515 SHDMA_SLAVE_MMCIF_RX, 515 SHDMA_SLAVE_MMCIF_RX,
516}; 516};
517 517
518/* PINT interrupts are located at Linux IRQ 768 and up */ 518/* PINT interrupts are located at Linux IRQ 800 and up */
519#define SH73A0_PINT0_IRQ(irq) ((irq) + 768) 519#define SH73A0_PINT0_IRQ(irq) ((irq) + 800)
520#define SH73A0_PINT1_IRQ(irq) ((irq) + 800) 520#define SH73A0_PINT1_IRQ(irq) ((irq) + 832)
521 521
522#endif /* __ASM_SH73A0_H__ */ 522#endif /* __ASM_SH73A0_H__ */
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 1eda6b0b69e3..9857595eaa79 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/module.h>
22#include <linux/irq.h> 23#include <linux/irq.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/sh_intc.h> 25#include <linux/sh_intc.h>
@@ -445,6 +446,7 @@ void __init sh73a0_init_irq(void)
445 setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]); 446 setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]);
446 447
447 n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k))); 448 n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k)));
449 WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n);
448 irq_set_chip_and_handler_name(n, &intca_gic_irq_chip, 450 irq_set_chip_and_handler_name(n, &intca_gic_irq_chip,
449 handle_level_irq, "level"); 451 handle_level_irq, "level");
450 set_irq_flags(n, IRQF_VALID); /* yuck */ 452 set_irq_flags(n, IRQF_VALID); /* yuck */
diff --git a/arch/arm/mach-shmobile/pfc-r8a7779.c b/arch/arm/mach-shmobile/pfc-r8a7779.c
index 963532f2b2c4..d14c9b048077 100644
--- a/arch/arm/mach-shmobile/pfc-r8a7779.c
+++ b/arch/arm/mach-shmobile/pfc-r8a7779.c
@@ -2120,7 +2120,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
2120 FN_AUDATA3, 0, 0, 0 } 2120 FN_AUDATA3, 0, 0, 0 }
2121 }, 2121 },
2122 { PINMUX_CFG_REG_VAR("IPSR4", 0xfffc0030, 32, 2122 { PINMUX_CFG_REG_VAR("IPSR4", 0xfffc0030, 32,
2123 3, 1, 1, 1, 1, 1, 1, 3, 3, 1, 2123 3, 1, 1, 1, 1, 1, 1, 3, 3,
2124 1, 1, 1, 1, 1, 1, 3, 3, 3, 2) { 2124 1, 1, 1, 1, 1, 1, 3, 3, 3, 2) {
2125 /* IP4_31_29 [3] */ 2125 /* IP4_31_29 [3] */
2126 FN_DU1_DB0, FN_VI2_DATA4_VI2_B4, FN_SCL2_B, FN_SD3_DAT0, 2126 FN_DU1_DB0, FN_VI2_DATA4_VI2_B4, FN_SCL2_B, FN_SD3_DAT0,
diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c
index 1bd6585a6acf..336093f9210a 100644
--- a/arch/arm/mach-shmobile/pfc-sh7372.c
+++ b/arch/arm/mach-shmobile/pfc-sh7372.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <mach/irqs.h>
26#include <mach/sh7372.h> 27#include <mach/sh7372.h>
27 28
28#define CPU_ALL_PORT(fn, pfx, sfx) \ 29#define CPU_ALL_PORT(fn, pfx, sfx) \
@@ -1594,6 +1595,43 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
1594 { }, 1595 { },
1595}; 1596};
1596 1597
1598#define EXT_IRQ16L(n) evt2irq(0x200 + ((n) << 5))
1599#define EXT_IRQ16H(n) evt2irq(0x3200 + (((n) - 16) << 5))
1600static struct pinmux_irq pinmux_irqs[] = {
1601 PINMUX_IRQ(EXT_IRQ16L(0), PORT6_FN0, PORT162_FN0),
1602 PINMUX_IRQ(EXT_IRQ16L(1), PORT12_FN0),
1603 PINMUX_IRQ(EXT_IRQ16L(2), PORT4_FN0, PORT5_FN0),
1604 PINMUX_IRQ(EXT_IRQ16L(3), PORT8_FN0, PORT16_FN0),
1605 PINMUX_IRQ(EXT_IRQ16L(4), PORT17_FN0, PORT163_FN0),
1606 PINMUX_IRQ(EXT_IRQ16L(5), PORT18_FN0),
1607 PINMUX_IRQ(EXT_IRQ16L(6), PORT39_FN0, PORT164_FN0),
1608 PINMUX_IRQ(EXT_IRQ16L(7), PORT40_FN0, PORT167_FN0),
1609 PINMUX_IRQ(EXT_IRQ16L(8), PORT41_FN0, PORT168_FN0),
1610 PINMUX_IRQ(EXT_IRQ16L(9), PORT42_FN0, PORT169_FN0),
1611 PINMUX_IRQ(EXT_IRQ16L(10), PORT65_FN0),
1612 PINMUX_IRQ(EXT_IRQ16L(11), PORT67_FN0),
1613 PINMUX_IRQ(EXT_IRQ16L(12), PORT80_FN0, PORT137_FN0),
1614 PINMUX_IRQ(EXT_IRQ16L(13), PORT81_FN0, PORT145_FN0),
1615 PINMUX_IRQ(EXT_IRQ16L(14), PORT82_FN0, PORT146_FN0),
1616 PINMUX_IRQ(EXT_IRQ16L(15), PORT83_FN0, PORT147_FN0),
1617 PINMUX_IRQ(EXT_IRQ16H(16), PORT84_FN0, PORT170_FN0),
1618 PINMUX_IRQ(EXT_IRQ16H(17), PORT85_FN0),
1619 PINMUX_IRQ(EXT_IRQ16H(18), PORT86_FN0),
1620 PINMUX_IRQ(EXT_IRQ16H(19), PORT87_FN0),
1621 PINMUX_IRQ(EXT_IRQ16H(20), PORT92_FN0),
1622 PINMUX_IRQ(EXT_IRQ16H(21), PORT93_FN0),
1623 PINMUX_IRQ(EXT_IRQ16H(22), PORT94_FN0),
1624 PINMUX_IRQ(EXT_IRQ16H(23), PORT95_FN0),
1625 PINMUX_IRQ(EXT_IRQ16H(24), PORT112_FN0),
1626 PINMUX_IRQ(EXT_IRQ16H(25), PORT119_FN0),
1627 PINMUX_IRQ(EXT_IRQ16H(26), PORT121_FN0, PORT172_FN0),
1628 PINMUX_IRQ(EXT_IRQ16H(27), PORT122_FN0, PORT180_FN0),
1629 PINMUX_IRQ(EXT_IRQ16H(28), PORT123_FN0, PORT181_FN0),
1630 PINMUX_IRQ(EXT_IRQ16H(29), PORT129_FN0, PORT182_FN0),
1631 PINMUX_IRQ(EXT_IRQ16H(30), PORT130_FN0, PORT183_FN0),
1632 PINMUX_IRQ(EXT_IRQ16H(31), PORT138_FN0, PORT184_FN0),
1633};
1634
1597static struct pinmux_info sh7372_pinmux_info = { 1635static struct pinmux_info sh7372_pinmux_info = {
1598 .name = "sh7372_pfc", 1636 .name = "sh7372_pfc",
1599 .reserved_id = PINMUX_RESERVED, 1637 .reserved_id = PINMUX_RESERVED,
@@ -1614,6 +1652,9 @@ static struct pinmux_info sh7372_pinmux_info = {
1614 1652
1615 .gpio_data = pinmux_data, 1653 .gpio_data = pinmux_data,
1616 .gpio_data_size = ARRAY_SIZE(pinmux_data), 1654 .gpio_data_size = ARRAY_SIZE(pinmux_data),
1655
1656 .gpio_irq = pinmux_irqs,
1657 .gpio_irq_size = ARRAY_SIZE(pinmux_irqs),
1617}; 1658};
1618 1659
1619void sh7372_pinmux_init(void) 1660void sh7372_pinmux_init(void)
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 986dca6b3fad..74e52341dd1b 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -25,8 +25,41 @@
25#include <linux/serial_sci.h> 25#include <linux/serial_sci.h>
26#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
27#include <mach/r8a7740.h> 27#include <mach/r8a7740.h>
28#include <mach/common.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
30#include <asm/mach/map.h>
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33
34static struct map_desc r8a7740_io_desc[] __initdata = {
35 /*
36 * for CPGA/INTC/PFC
37 * 0xe6000000-0xefffffff -> 0xe6000000-0xefffffff
38 */
39 {
40 .virtual = 0xe6000000,
41 .pfn = __phys_to_pfn(0xe6000000),
42 .length = 160 << 20,
43 .type = MT_DEVICE_NONSHARED
44 },
45#ifdef CONFIG_CACHE_L2X0
46 /*
47 * for l2x0_init()
48 * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
49 */
50 {
51 .virtual = 0xf0002000,
52 .pfn = __phys_to_pfn(0xf0100000),
53 .length = PAGE_SIZE,
54 .type = MT_DEVICE_NONSHARED
55 },
56#endif
57};
58
59void __init r8a7740_map_io(void)
60{
61 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
62}
30 63
31/* SCIFA0 */ 64/* SCIFA0 */
32static struct plat_sci_port scif0_platform_data = { 65static struct plat_sci_port scif0_platform_data = {
@@ -345,8 +378,20 @@ void __init r8a7740_add_standard_devices(void)
345 ARRAY_SIZE(r8a7740_late_devices)); 378 ARRAY_SIZE(r8a7740_late_devices));
346} 379}
347 380
381static void __init r8a7740_earlytimer_init(void)
382{
383 r8a7740_clock_init(0);
384 shmobile_earlytimer_init();
385}
386
348void __init r8a7740_add_early_devices(void) 387void __init r8a7740_add_early_devices(void)
349{ 388{
350 early_platform_add_devices(r8a7740_early_devices, 389 early_platform_add_devices(r8a7740_early_devices,
351 ARRAY_SIZE(r8a7740_early_devices)); 390 ARRAY_SIZE(r8a7740_early_devices));
391
392 /* setup early console here as well */
393 shmobile_setup_console();
394
395 /* override timer setup with soc-specific code */
396 shmobile_timer.init = r8a7740_earlytimer_init;
352} 397}
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 4725663bd032..6820d785493d 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -33,6 +33,31 @@
33#include <mach/common.h> 33#include <mach/common.h>
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38#include <asm/hardware/cache-l2x0.h>
39
40static struct map_desc r8a7779_io_desc[] __initdata = {
41 /* 2M entity map for 0xf0000000 (MPCORE) */
42 {
43 .virtual = 0xf0000000,
44 .pfn = __phys_to_pfn(0xf0000000),
45 .length = SZ_2M,
46 .type = MT_DEVICE_NONSHARED
47 },
48 /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
49 {
50 .virtual = 0xfe000000,
51 .pfn = __phys_to_pfn(0xfe000000),
52 .length = SZ_16M,
53 .type = MT_DEVICE_NONSHARED
54 },
55};
56
57void __init r8a7779_map_io(void)
58{
59 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
60}
36 61
37static struct plat_sci_port scif0_platform_data = { 62static struct plat_sci_port scif0_platform_data = {
38 .mapbase = 0xffe40000, 63 .mapbase = 0xffe40000,
@@ -219,6 +244,10 @@ static struct platform_device *r8a7779_late_devices[] __initdata = {
219 244
220void __init r8a7779_add_standard_devices(void) 245void __init r8a7779_add_standard_devices(void)
221{ 246{
247#ifdef CONFIG_CACHE_L2X0
248 /* Early BRESP enable, Shared attribute override enable, 64K*16way */
249 l2x0_init((void __iomem __force *)(0xf0100000), 0x40470000, 0x82000fff);
250#endif
222 r8a7779_pm_init(); 251 r8a7779_pm_init();
223 252
224 r8a7779_init_pm_domain(&r8a7779_sh4a); 253 r8a7779_init_pm_domain(&r8a7779_sh4a);
@@ -232,8 +261,33 @@ void __init r8a7779_add_standard_devices(void)
232 ARRAY_SIZE(r8a7779_late_devices)); 261 ARRAY_SIZE(r8a7779_late_devices));
233} 262}
234 263
264static void __init r8a7779_earlytimer_init(void)
265{
266 r8a7779_clock_init();
267 shmobile_earlytimer_init();
268}
269
235void __init r8a7779_add_early_devices(void) 270void __init r8a7779_add_early_devices(void)
236{ 271{
237 early_platform_add_devices(r8a7779_early_devices, 272 early_platform_add_devices(r8a7779_early_devices,
238 ARRAY_SIZE(r8a7779_early_devices)); 273 ARRAY_SIZE(r8a7779_early_devices));
274
275 /* Early serial console setup is not included here due to
276 * memory map collisions. The SCIF serial ports in r8a7779
277 * are difficult to entity map 1:1 due to collision with the
278 * virtual memory range used by the coherent DMA code on ARM.
279 *
280 * Anyone wanting to debug early can remove UPF_IOREMAP from
281 * the sh-sci serial console platform data, adjust mapbase
282 * to a static M:N virt:phys mapping that needs to be added to
283 * the mappings passed with iotable_init() above.
284 *
285 * Then add a call to shmobile_setup_console() from this function.
286 *
287 * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
288 * command line in case of the marzen board.
289 */
290
291 /* override timer setup with soc-specific code */
292 shmobile_timer.init = r8a7779_earlytimer_init;
239} 293}
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
index e546017f15de..a51e1a1e6996 100644
--- a/arch/arm/mach-shmobile/setup-sh7367.c
+++ b/arch/arm/mach-shmobile/setup-sh7367.c
@@ -29,8 +29,28 @@
29#include <linux/serial_sci.h> 29#include <linux/serial_sci.h>
30#include <linux/sh_timer.h> 30#include <linux/sh_timer.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/common.h>
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36#include <asm/mach/time.h>
37
38static struct map_desc sh7367_io_desc[] __initdata = {
39 /* create a 1:1 entity map for 0xe6xxxxxx
40 * used by CPGA, INTC and PFC.
41 */
42 {
43 .virtual = 0xe6000000,
44 .pfn = __phys_to_pfn(0xe6000000),
45 .length = 256 << 20,
46 .type = MT_DEVICE_NONSHARED
47 },
48};
49
50void __init sh7367_map_io(void)
51{
52 iotable_init(sh7367_io_desc, ARRAY_SIZE(sh7367_io_desc));
53}
34 54
35/* SCIFA0 */ 55/* SCIFA0 */
36static struct plat_sci_port scif0_platform_data = { 56static struct plat_sci_port scif0_platform_data = {
@@ -435,6 +455,12 @@ void __init sh7367_add_standard_devices(void)
435 ARRAY_SIZE(sh7367_devices)); 455 ARRAY_SIZE(sh7367_devices));
436} 456}
437 457
458static void __init sh7367_earlytimer_init(void)
459{
460 sh7367_clock_init();
461 shmobile_earlytimer_init();
462}
463
438#define SYMSTPCR2 0xe6158048 464#define SYMSTPCR2 0xe6158048
439#define SYMSTPCR2_CMT1 (1 << 29) 465#define SYMSTPCR2_CMT1 (1 << 29)
440 466
@@ -445,4 +471,10 @@ void __init sh7367_add_early_devices(void)
445 471
446 early_platform_add_devices(sh7367_early_devices, 472 early_platform_add_devices(sh7367_early_devices,
447 ARRAY_SIZE(sh7367_early_devices)); 473 ARRAY_SIZE(sh7367_early_devices));
474
475 /* setup early console here as well */
476 shmobile_setup_console();
477
478 /* override timer setup with soc-specific code */
479 shmobile_timer.init = sh7367_earlytimer_init;
448} 480}
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index a83cf51fc099..c14fb35de47c 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -33,8 +33,28 @@
33#include <linux/pm_domain.h> 33#include <linux/pm_domain.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/sh7372.h> 35#include <mach/sh7372.h>
36#include <mach/common.h>
37#include <asm/mach/map.h>
36#include <asm/mach-types.h> 38#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41
42static struct map_desc sh7372_io_desc[] __initdata = {
43 /* create a 1:1 entity map for 0xe6xxxxxx
44 * used by CPGA, INTC and PFC.
45 */
46 {
47 .virtual = 0xe6000000,
48 .pfn = __phys_to_pfn(0xe6000000),
49 .length = 256 << 20,
50 .type = MT_DEVICE_NONSHARED
51 },
52};
53
54void __init sh7372_map_io(void)
55{
56 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
57}
38 58
39/* SCIFA0 */ 59/* SCIFA0 */
40static struct plat_sci_port scif0_platform_data = { 60static struct plat_sci_port scif0_platform_data = {
@@ -1045,8 +1065,20 @@ void __init sh7372_add_standard_devices(void)
1045 sh7372_add_device_to_domain(&sh7372_a4r, &jpu_device); 1065 sh7372_add_device_to_domain(&sh7372_a4r, &jpu_device);
1046} 1066}
1047 1067
1068static void __init sh7372_earlytimer_init(void)
1069{
1070 sh7372_clock_init();
1071 shmobile_earlytimer_init();
1072}
1073
1048void __init sh7372_add_early_devices(void) 1074void __init sh7372_add_early_devices(void)
1049{ 1075{
1050 early_platform_add_devices(sh7372_early_devices, 1076 early_platform_add_devices(sh7372_early_devices,
1051 ARRAY_SIZE(sh7372_early_devices)); 1077 ARRAY_SIZE(sh7372_early_devices));
1078
1079 /* setup early console here as well */
1080 shmobile_setup_console();
1081
1082 /* override timer setup with soc-specific code */
1083 shmobile_timer.init = sh7372_earlytimer_init;
1052} 1084}
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c
index bb405b8e459b..9f146095098b 100644
--- a/arch/arm/mach-shmobile/setup-sh7377.c
+++ b/arch/arm/mach-shmobile/setup-sh7377.c
@@ -30,8 +30,28 @@
30#include <linux/sh_intc.h> 30#include <linux/sh_intc.h>
31#include <linux/sh_timer.h> 31#include <linux/sh_timer.h>
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/common.h>
34#include <asm/mach/map.h>
33#include <asm/mach-types.h> 35#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38
39static struct map_desc sh7377_io_desc[] __initdata = {
40 /* create a 1:1 entity map for 0xe6xxxxxx
41 * used by CPGA, INTC and PFC.
42 */
43 {
44 .virtual = 0xe6000000,
45 .pfn = __phys_to_pfn(0xe6000000),
46 .length = 256 << 20,
47 .type = MT_DEVICE_NONSHARED
48 },
49};
50
51void __init sh7377_map_io(void)
52{
53 iotable_init(sh7377_io_desc, ARRAY_SIZE(sh7377_io_desc));
54}
35 55
36/* SCIFA0 */ 56/* SCIFA0 */
37static struct plat_sci_port scif0_platform_data = { 57static struct plat_sci_port scif0_platform_data = {
@@ -456,6 +476,12 @@ void __init sh7377_add_standard_devices(void)
456 ARRAY_SIZE(sh7377_devices)); 476 ARRAY_SIZE(sh7377_devices));
457} 477}
458 478
479static void __init sh7377_earlytimer_init(void)
480{
481 sh7377_clock_init();
482 shmobile_earlytimer_init();
483}
484
459#define SMSTPCR3 0xe615013c 485#define SMSTPCR3 0xe615013c
460#define SMSTPCR3_CMT1 (1 << 29) 486#define SMSTPCR3_CMT1 (1 << 29)
461 487
@@ -466,4 +492,10 @@ void __init sh7377_add_early_devices(void)
466 492
467 early_platform_add_devices(sh7377_early_devices, 493 early_platform_add_devices(sh7377_early_devices,
468 ARRAY_SIZE(sh7377_early_devices)); 494 ARRAY_SIZE(sh7377_early_devices));
495
496 /* setup early console here as well */
497 shmobile_setup_console();
498
499 /* override timer setup with soc-specific code */
500 shmobile_timer.init = sh7377_earlytimer_init;
469} 501}
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 20e71e5cace4..b6a0734a738e 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -32,8 +32,28 @@
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <mach/sh73a0.h> 34#include <mach/sh73a0.h>
35#include <mach/common.h>
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37#include <asm/mach/map.h>
36#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/mach/time.h>
40
41static struct map_desc sh73a0_io_desc[] __initdata = {
42 /* create a 1:1 entity map for 0xe6xxxxxx
43 * used by CPGA, INTC and PFC.
44 */
45 {
46 .virtual = 0xe6000000,
47 .pfn = __phys_to_pfn(0xe6000000),
48 .length = 256 << 20,
49 .type = MT_DEVICE_NONSHARED
50 },
51};
52
53void __init sh73a0_map_io(void)
54{
55 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
56}
37 57
38static struct plat_sci_port scif0_platform_data = { 58static struct plat_sci_port scif0_platform_data = {
39 .mapbase = 0xe6c40000, 59 .mapbase = 0xe6c40000,
@@ -667,8 +687,20 @@ void __init sh73a0_add_standard_devices(void)
667 ARRAY_SIZE(sh73a0_late_devices)); 687 ARRAY_SIZE(sh73a0_late_devices));
668} 688}
669 689
690static void __init sh73a0_earlytimer_init(void)
691{
692 sh73a0_clock_init();
693 shmobile_earlytimer_init();
694}
695
670void __init sh73a0_add_early_devices(void) 696void __init sh73a0_add_early_devices(void)
671{ 697{
672 early_platform_add_devices(sh73a0_early_devices, 698 early_platform_add_devices(sh73a0_early_devices,
673 ARRAY_SIZE(sh73a0_early_devices)); 699 ARRAY_SIZE(sh73a0_early_devices));
700
701 /* setup early console here as well */
702 shmobile_setup_console();
703
704 /* override timer setup with soc-specific code */
705 shmobile_timer.init = sh73a0_earlytimer_init;
674} 706}
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 2e687932f83c..c0a9093ba3a8 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -78,7 +78,7 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu)
78 /* enable cache coherency */ 78 /* enable cache coherency */
79 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 79 modify_scu_cpu_psr(0, 3 << (cpu * 8));
80 80
81 if (((__raw_readw(__io(PSTR)) >> (4 * cpu)) & 3) == 3) 81 if (((__raw_readl(__io(PSTR)) >> (4 * cpu)) & 3) == 3)
82 __raw_writel(1 << cpu, __io(WUPCR)); /* wake up */ 82 __raw_writel(1 << cpu, __io(WUPCR)); /* wake up */
83 else 83 else
84 __raw_writel(1 << cpu, __io(SRESCR)); /* reset */ 84 __raw_writel(1 << cpu, __io(SRESCR)); /* reset */
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index be16231e86fc..2fba5f3d1c8a 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -37,11 +37,15 @@ static void __init shmobile_late_time_init(void)
37 early_platform_driver_probe("earlytimer", 2, 0); 37 early_platform_driver_probe("earlytimer", 2, 0);
38} 38}
39 39
40static void __init shmobile_timer_init(void) 40void __init shmobile_earlytimer_init(void)
41{ 41{
42 late_time_init = shmobile_late_time_init; 42 late_time_init = shmobile_late_time_init;
43} 43}
44 44
45static void __init shmobile_timer_init(void)
46{
47}
48
45void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer) 49void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer)
46{ 50{
47#ifdef CONFIG_HAVE_ARM_TWD 51#ifdef CONFIG_HAVE_ARM_TWD