board-4430sdp.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 <linux/usb/otg.h>
  20. #include <mach/hardware.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/map.h>
  24. #include <plat/board.h>
  25. #include <plat/common.h>
  26. #include <plat/control.h>
  27. #include <plat/timer-gp.h>
  28. #include <plat/usb.h>
  29. #include <asm/hardware/gic.h>
  30. #include <asm/hardware/cache-l2x0.h>
  31. static struct platform_device sdp4430_lcd_device = {
  32. .name = "sdp4430_lcd",
  33. .id = -1,
  34. };
  35. static struct platform_device *sdp4430_devices[] __initdata = {
  36. &sdp4430_lcd_device,
  37. };
  38. static struct omap_lcd_config sdp4430_lcd_config __initdata = {
  39. .ctrl_name = "internal",
  40. };
  41. static struct omap_board_config_kernel sdp4430_config[] __initdata = {
  42. { OMAP_TAG_LCD, &sdp4430_lcd_config },
  43. };
  44. #ifdef CONFIG_CACHE_L2X0
  45. noinline void omap_smc1(u32 fn, u32 arg)
  46. {
  47. register u32 r12 asm("r12") = fn;
  48. register u32 r0 asm("r0") = arg;
  49. /* This is common routine cache secure monitor API used to
  50. * modify the PL310 secure registers.
  51. * r0 contains the value to be modified and "r12" contains
  52. * the monitor API number. It uses few CPU registers
  53. * internally and hence they need be backed up including
  54. * link register "lr".
  55. * Explicitly save r11 and r12 the compiler generated code
  56. * won't save it.
  57. */
  58. asm volatile(
  59. "stmfd r13!, {r11,r12}\n"
  60. "dsb\n"
  61. "smc\n"
  62. "ldmfd r13!, {r11,r12}\n"
  63. : "+r" (r0), "+r" (r12)
  64. :
  65. : "r4", "r5", "r10", "lr", "cc");
  66. }
  67. EXPORT_SYMBOL(omap_smc1);
  68. static int __init omap_l2_cache_init(void)
  69. {
  70. void __iomem *l2cache_base;
  71. /* To avoid code running on other OMAPs in
  72. * multi-omap builds
  73. */
  74. if (!cpu_is_omap44xx())
  75. return -ENODEV;
  76. /* Static mapping, never released */
  77. l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
  78. BUG_ON(!l2cache_base);
  79. /* Enable PL310 L2 Cache controller */
  80. omap_smc1(0x102, 0x1);
  81. /* 32KB way size, 16-way associativity,
  82. * parity disabled
  83. */
  84. l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
  85. return 0;
  86. }
  87. early_initcall(omap_l2_cache_init);
  88. #endif
  89. static void __init gic_init_irq(void)
  90. {
  91. void __iomem *base;
  92. /* Static mapping, never released */
  93. base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
  94. BUG_ON(!base);
  95. gic_dist_init(0, base, 29);
  96. /* Static mapping, never released */
  97. gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
  98. BUG_ON(!gic_cpu_base_addr);
  99. gic_cpu_init(0, gic_cpu_base_addr);
  100. }
  101. static void __init omap_4430sdp_init_irq(void)
  102. {
  103. omap_board_config = sdp4430_config;
  104. omap_board_config_size = ARRAY_SIZE(sdp4430_config);
  105. omap2_init_common_hw(NULL, NULL);
  106. #ifdef CONFIG_OMAP_32K_TIMER
  107. omap2_gp_clockevent_set_gptimer(1);
  108. #endif
  109. gic_init_irq();
  110. omap_gpio_init();
  111. }
  112. static struct omap_musb_board_data musb_board_data = {
  113. .interface_type = MUSB_INTERFACE_UTMI,
  114. .mode = MUSB_PERIPHERAL,
  115. .power = 100,
  116. };
  117. static void __init omap_4430sdp_init(void)
  118. {
  119. platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
  120. omap_serial_init();
  121. /* OMAP4 SDP uses internal transceiver so register nop transceiver */
  122. usb_nop_xceiv_register();
  123. /* FIXME: allow multi-omap to boot until musb is updated for omap4 */
  124. if (!cpu_is_omap44xx())
  125. usb_musb_init(&musb_board_data);
  126. }
  127. static void __init omap_4430sdp_map_io(void)
  128. {
  129. omap2_set_globals_443x();
  130. omap44xx_map_common_io();
  131. }
  132. MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
  133. /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
  134. .phys_io = 0x48000000,
  135. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  136. .boot_params = 0x80000100,
  137. .map_io = omap_4430sdp_map_io,
  138. .init_irq = omap_4430sdp_init_irq,
  139. .init_machine = omap_4430sdp_init,
  140. .timer = &omap_timer,
  141. MACHINE_END