aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-mackerel.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/board-mackerel.c')
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c172
1 files changed, 64 insertions, 108 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 7b53cda41851..ca609502d6cd 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -57,8 +57,6 @@
57#include <mach/sh7372.h> 57#include <mach/sh7372.h>
58 58
59#include <asm/mach/arch.h> 59#include <asm/mach/arch.h>
60#include <asm/mach/time.h>
61#include <asm/mach/map.h>
62#include <asm/mach-types.h> 60#include <asm/mach-types.h>
63 61
64/* 62/*
@@ -318,8 +316,14 @@ static struct sh_mobile_meram_info mackerel_meram_info = {
318 316
319static struct resource meram_resources[] = { 317static struct resource meram_resources[] = {
320 [0] = { 318 [0] = {
321 .name = "MERAM", 319 .name = "regs",
322 .start = 0xe8000000, 320 .start = 0xe8000000,
321 .end = 0xe807ffff,
322 .flags = IORESOURCE_MEM,
323 },
324 [1] = {
325 .name = "meram",
326 .start = 0xe8080000,
323 .end = 0xe81fffff, 327 .end = 0xe81fffff,
324 .flags = IORESOURCE_MEM, 328 .flags = IORESOURCE_MEM,
325 }, 329 },
@@ -351,29 +355,23 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
351 }, 355 },
352}; 356};
353 357
354static int mackerel_set_brightness(void *board_data, int brightness) 358static int mackerel_set_brightness(int brightness)
355{ 359{
356 gpio_set_value(GPIO_PORT31, brightness); 360 gpio_set_value(GPIO_PORT31, brightness);
357 361
358 return 0; 362 return 0;
359} 363}
360 364
361static int mackerel_get_brightness(void *board_data) 365static int mackerel_get_brightness(void)
362{ 366{
363 return gpio_get_value(GPIO_PORT31); 367 return gpio_get_value(GPIO_PORT31);
364} 368}
365 369
366static struct sh_mobile_meram_cfg lcd_meram_cfg = { 370static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
367 .icb[0] = { 371 .icb[0] = {
368 .marker_icb = 28,
369 .cache_icb = 24,
370 .meram_offset = 0x0,
371 .meram_size = 0x40, 372 .meram_size = 0x40,
372 }, 373 },
373 .icb[1] = { 374 .icb[1] = {
374 .marker_icb = 29,
375 .cache_icb = 25,
376 .meram_offset = 0x40,
377 .meram_size = 0x40, 375 .meram_size = 0x40,
378 }, 376 },
379}; 377};
@@ -384,20 +382,20 @@ static struct sh_mobile_lcdc_info lcdc_info = {
384 .ch[0] = { 382 .ch[0] = {
385 .chan = LCDC_CHAN_MAINLCD, 383 .chan = LCDC_CHAN_MAINLCD,
386 .fourcc = V4L2_PIX_FMT_RGB565, 384 .fourcc = V4L2_PIX_FMT_RGB565,
387 .lcd_cfg = mackerel_lcdc_modes, 385 .lcd_modes = mackerel_lcdc_modes,
388 .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), 386 .num_modes = ARRAY_SIZE(mackerel_lcdc_modes),
389 .interface_type = RGB24, 387 .interface_type = RGB24,
390 .clock_divider = 3, 388 .clock_divider = 3,
391 .flags = 0, 389 .flags = 0,
392 .lcd_size_cfg.width = 152, 390 .panel_cfg = {
393 .lcd_size_cfg.height = 91, 391 .width = 152,
394 .board_cfg = { 392 .height = 91,
395 .set_brightness = mackerel_set_brightness,
396 .get_brightness = mackerel_get_brightness,
397 }, 393 },
398 .bl_info = { 394 .bl_info = {
399 .name = "sh_mobile_lcdc_bl", 395 .name = "sh_mobile_lcdc_bl",
400 .max_brightness = 1, 396 .max_brightness = 1,
397 .set_brightness = mackerel_set_brightness,
398 .get_brightness = mackerel_get_brightness,
401 }, 399 },
402 .meram_cfg = &lcd_meram_cfg, 400 .meram_cfg = &lcd_meram_cfg,
403 } 401 }
@@ -426,21 +424,44 @@ static struct platform_device lcdc_device = {
426 }, 424 },
427}; 425};
428 426
429static struct sh_mobile_meram_cfg hdmi_meram_cfg = { 427/* HDMI */
428static struct sh_mobile_hdmi_info hdmi_info = {
429 .flags = HDMI_SND_SRC_SPDIF,
430};
431
432static struct resource hdmi_resources[] = {
433 [0] = {
434 .name = "HDMI",
435 .start = 0xe6be0000,
436 .end = 0xe6be00ff,
437 .flags = IORESOURCE_MEM,
438 },
439 [1] = {
440 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
441 .start = evt2irq(0x17e0),
442 .flags = IORESOURCE_IRQ,
443 },
444};
445
446static struct platform_device hdmi_device = {
447 .name = "sh-mobile-hdmi",
448 .num_resources = ARRAY_SIZE(hdmi_resources),
449 .resource = hdmi_resources,
450 .id = -1,
451 .dev = {
452 .platform_data = &hdmi_info,
453 },
454};
455
456static const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
430 .icb[0] = { 457 .icb[0] = {
431 .marker_icb = 30,
432 .cache_icb = 26,
433 .meram_offset = 0x80,
434 .meram_size = 0x100, 458 .meram_size = 0x100,
435 }, 459 },
436 .icb[1] = { 460 .icb[1] = {
437 .marker_icb = 31,
438 .cache_icb = 27,
439 .meram_offset = 0x180,
440 .meram_size = 0x100, 461 .meram_size = 0x100,
441 }, 462 },
442}; 463};
443/* HDMI */ 464
444static struct sh_mobile_lcdc_info hdmi_lcdc_info = { 465static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
445 .meram_dev = &mackerel_meram_info, 466 .meram_dev = &mackerel_meram_info,
446 .clock_source = LCDC_CLK_EXTERNAL, 467 .clock_source = LCDC_CLK_EXTERNAL,
@@ -451,6 +472,7 @@ static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
451 .clock_divider = 1, 472 .clock_divider = 1,
452 .flags = LCDC_FLAGS_DWPOL, 473 .flags = LCDC_FLAGS_DWPOL,
453 .meram_cfg = &hdmi_meram_cfg, 474 .meram_cfg = &hdmi_meram_cfg,
475 .tx_dev = &hdmi_device,
454 } 476 }
455}; 477};
456 478
@@ -478,36 +500,6 @@ static struct platform_device hdmi_lcdc_device = {
478 }, 500 },
479}; 501};
480 502
481static struct sh_mobile_hdmi_info hdmi_info = {
482 .lcd_chan = &hdmi_lcdc_info.ch[0],
483 .lcd_dev = &hdmi_lcdc_device.dev,
484 .flags = HDMI_SND_SRC_SPDIF,
485};
486
487static struct resource hdmi_resources[] = {
488 [0] = {
489 .name = "HDMI",
490 .start = 0xe6be0000,
491 .end = 0xe6be00ff,
492 .flags = IORESOURCE_MEM,
493 },
494 [1] = {
495 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
496 .start = evt2irq(0x17e0),
497 .flags = IORESOURCE_IRQ,
498 },
499};
500
501static struct platform_device hdmi_device = {
502 .name = "sh-mobile-hdmi",
503 .num_resources = ARRAY_SIZE(hdmi_resources),
504 .resource = hdmi_resources,
505 .id = -1,
506 .dev = {
507 .platform_data = &hdmi_info,
508 },
509};
510
511static struct platform_device fsi_hdmi_device = { 503static struct platform_device fsi_hdmi_device = {
512 .name = "sh_fsi2_b_hdmi", 504 .name = "sh_fsi2_b_hdmi",
513}; 505};
@@ -860,7 +852,7 @@ static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
860 return clk_enable(clk); 852 return clk_enable(clk);
861} 853}
862 854
863static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable) 855static int fsi_b_set_rate(struct device *dev, int rate, int enable)
864{ 856{
865 struct clk *fsib_clk; 857 struct clk *fsib_clk;
866 struct clk *fdiv_clk = &sh7372_fsidivb_clk; 858 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
@@ -869,10 +861,6 @@ static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
869 int ackmd_bpfmd; 861 int ackmd_bpfmd;
870 int ret; 862 int ret;
871 863
872 /* FSIA is slave mode. nothing to do here */
873 if (is_porta)
874 return 0;
875
876 /* clock start */ 864 /* clock start */
877 switch (rate) { 865 switch (rate) {
878 case 44100: 866 case 44100:
@@ -916,14 +904,16 @@ fsi_set_rate_end:
916} 904}
917 905
918static struct sh_fsi_platform_info fsi_info = { 906static struct sh_fsi_platform_info fsi_info = {
919 .porta_flags = SH_FSI_BRS_INV, 907 .port_a = {
920 908 .flags = SH_FSI_BRS_INV,
921 .portb_flags = SH_FSI_BRS_INV | 909 },
910 .port_b = {
911 .flags = SH_FSI_BRS_INV |
922 SH_FSI_BRM_INV | 912 SH_FSI_BRM_INV |
923 SH_FSI_LRS_INV | 913 SH_FSI_LRS_INV |
924 SH_FSI_FMT_SPDIF, 914 SH_FSI_FMT_SPDIF,
925 915 .set_rate = fsi_b_set_rate,
926 .set_rate = fsi_set_rate, 916 }
927}; 917};
928 918
929static struct resource fsi_resources[] = { 919static struct resource fsi_resources[] = {
@@ -1276,8 +1266,8 @@ static struct platform_device *mackerel_devices[] __initdata = {
1276 &sh_mmcif_device, 1266 &sh_mmcif_device,
1277 &ceu_device, 1267 &ceu_device,
1278 &mackerel_camera, 1268 &mackerel_camera,
1279 &hdmi_lcdc_device,
1280 &hdmi_device, 1269 &hdmi_device,
1270 &hdmi_lcdc_device,
1281 &meram_device, 1271 &meram_device,
1282}; 1272};
1283 1273
@@ -1337,31 +1327,6 @@ static struct i2c_board_info i2c1_devices[] = {
1337 }, 1327 },
1338}; 1328};
1339 1329
1340static struct map_desc mackerel_io_desc[] __initdata = {
1341 /* create a 1:1 entity map for 0xe6xxxxxx
1342 * used by CPGA, INTC and PFC.
1343 */
1344 {
1345 .virtual = 0xe6000000,
1346 .pfn = __phys_to_pfn(0xe6000000),
1347 .length = 256 << 20,
1348 .type = MT_DEVICE_NONSHARED
1349 },
1350};
1351
1352static void __init mackerel_map_io(void)
1353{
1354 iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
1355 /* DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
1356 * enough to allocate the frame buffer memory.
1357 */
1358 init_consistent_dma_size(12 << 20);
1359
1360 /* setup early devices and console here as well */
1361 sh7372_add_early_devices();
1362 shmobile_setup_console();
1363}
1364
1365#define GPIO_PORT9CR 0xE6051009 1330#define GPIO_PORT9CR 0xE6051009
1366#define GPIO_PORT10CR 0xE605100A 1331#define GPIO_PORT10CR 0xE605100A
1367#define GPIO_PORT167CR 0xE60520A7 1332#define GPIO_PORT167CR 0xE60520A7
@@ -1374,6 +1339,9 @@ static void __init mackerel_init(void)
1374 struct clk *clk; 1339 struct clk *clk;
1375 int ret; 1340 int ret;
1376 1341
1342 /* External clock source */
1343 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1344
1377 sh7372_pinmux_init(); 1345 sh7372_pinmux_init();
1378 1346
1379 /* enable SCIFA0 */ 1347 /* enable SCIFA0 */
@@ -1577,23 +1545,11 @@ static void __init mackerel_init(void)
1577 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi"); 1545 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
1578} 1546}
1579 1547
1580static void __init mackerel_timer_init(void)
1581{
1582 sh7372_clock_init();
1583 shmobile_timer.init();
1584
1585 /* External clock source */
1586 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1587}
1588
1589static struct sys_timer mackerel_timer = {
1590 .init = mackerel_timer_init,
1591};
1592
1593MACHINE_START(MACKEREL, "mackerel") 1548MACHINE_START(MACKEREL, "mackerel")
1594 .map_io = mackerel_map_io, 1549 .map_io = sh7372_map_io,
1550 .init_early = sh7372_add_early_devices,
1595 .init_irq = sh7372_init_irq, 1551 .init_irq = sh7372_init_irq,
1596 .handle_irq = shmobile_handle_irq_intc, 1552 .handle_irq = shmobile_handle_irq_intc,
1597 .init_machine = mackerel_init, 1553 .init_machine = mackerel_init,
1598 .timer = &mackerel_timer, 1554 .timer = &shmobile_timer,
1599MACHINE_END 1555MACHINE_END