board-4430sdp.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Board support file for OMAP4430 SDP.
  3. *
  4. * Copyright (C) 2009 Texas Instruments
  5. *
  6. * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
  7. *
  8. * Based on mach-omap2/board-3430sdp.c
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/io.h>
  18. #include <linux/gpio.h>
  19. #include <mach/hardware.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <plat/board.h>
  24. #include <plat/common.h>
  25. #include <plat/control.h>
  26. #include <plat/timer-gp.h>
  27. #include <asm/hardware/gic.h>
  28. #include <asm/hardware/cache-l2x0.h>
  29. static struct platform_device sdp4430_lcd_device = {
  30. .name = "sdp4430_lcd",
  31. .id = -1,
  32. };
  33. static struct platform_device *sdp4430_devices[] __initdata = {
  34. &sdp4430_lcd_device,
  35. };
  36. static struct omap_uart_config sdp4430_uart_config __initdata = {
  37. .enabled_uarts = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
  38. };
  39. static struct omap_lcd_config sdp4430_lcd_config __initdata = {
  40. .ctrl_name = "internal",
  41. };
  42. static struct omap_board_config_kernel sdp4430_config[] __initdata = {
  43. { OMAP_TAG_LCD, &sdp4430_lcd_config },
  44. };
  45. #ifdef CONFIG_CACHE_L2X0
  46. noinline void omap_smc1(u32 fn, u32 arg)
  47. {
  48. register u32 r12 asm("r12") = fn;
  49. register u32 r0 asm("r0") = arg;
  50. /* This is common routine cache secure monitor API used to
  51. * modify the PL310 secure registers.
  52. * r0 contains the value to be modified and "r12" contains
  53. * the monitor API number. It uses few CPU registers
  54. * internally and hence they need be backed up including
  55. * link register "lr".
  56. * Explicitly save r11 and r12 the compiler generated code
  57. * won't save it.
  58. */
  59. asm volatile(
  60. "stmfd r13!, {r11,r12}\n"
  61. "dsb\n"
  62. "smc\n"
  63. "ldmfd r13!, {r11,r12}\n"
  64. : "+r" (r0), "+r" (r12)
  65. :
  66. : "r4", "r5", "r10", "lr", "cc");
  67. }
  68. EXPORT_SYMBOL(omap_smc1);
  69. static int __init omap_l2_cache_init(void)
  70. {
  71. void __iomem *l2cache_base;
  72. /* To avoid code running on other OMAPs in
  73. * multi-omap builds
  74. */
  75. if (!cpu_is_omap44xx())
  76. return -ENODEV;
  77. /* Static mapping, never released */
  78. l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
  79. BUG_ON(!l2cache_base);
  80. /* Enable PL310 L2 Cache controller */
  81. omap_smc1(0x102, 0x1);
  82. /* 32KB way size, 16-way associativity,
  83. * parity disabled
  84. */
  85. l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
  86. return 0;
  87. }
  88. early_initcall(omap_l2_cache_init);
  89. #endif
  90. static void __init gic_init_irq(void)
  91. {
  92. void __iomem *base;
  93. /* Static mapping, never released */
  94. base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
  95. BUG_ON(!base);
  96. gic_dist_init(0, base, 29);
  97. /* Static mapping, never released */
  98. gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
  99. BUG_ON(!gic_cpu_base_addr);
  100. gic_cpu_init(0, gic_cpu_base_addr);
  101. }
  102. static void __init omap_4430sdp_init_irq(void)
  103. {
  104. omap_board_config = sdp4430_config;
  105. omap_board_config_size = ARRAY_SIZE(sdp4430_config);
  106. omap2_init_common_hw(NULL, NULL);
  107. #ifdef CONFIG_OMAP_32K_TIMER
  108. omap2_gp_clockevent_set_gptimer(1);
  109. #endif
  110. gic_init_irq();
  111. omap_gpio_init();
  112. }
  113. static void __init omap_4430sdp_init(void)
  114. {
  115. platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
  116. omap_serial_init();
  117. }
  118. static void __init omap_4430sdp_map_io(void)
  119. {
  120. omap2_set_globals_443x();
  121. omap2_map_common_io();
  122. }
  123. MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
  124. /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
  125. .phys_io = 0x48000000,
  126. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  127. .boot_params = 0x80000100,
  128. .map_io = omap_4430sdp_map_io,
  129. .init_irq = omap_4430sdp_init_irq,
  130. .init_machine = omap_4430sdp_init,
  131. .timer = &omap_timer,
  132. MACHINE_END