board-msm7x27.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright (C) 2007 Google, Inc.
  3. * Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
  4. * Author: Brian Swetland <swetland@google.com>
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/input.h>
  20. #include <linux/io.h>
  21. #include <linux/delay.h>
  22. #include <linux/bootmem.h>
  23. #include <linux/power_supply.h>
  24. #include <mach/hardware.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/flash.h>
  29. #include <asm/setup.h>
  30. #ifdef CONFIG_CACHE_L2X0
  31. #include <asm/hardware/cache-l2x0.h>
  32. #endif
  33. #include <mach/vreg.h>
  34. #include <mach/mpp.h>
  35. #include <mach/gpio.h>
  36. #include <mach/board.h>
  37. #include <mach/msm_iomap.h>
  38. #include <linux/mtd/nand.h>
  39. #include <linux/mtd/partitions.h>
  40. #include "devices.h"
  41. #include "socinfo.h"
  42. #include "clock.h"
  43. static struct resource smc91x_resources[] = {
  44. [0] = {
  45. .start = 0x9C004300,
  46. .end = 0x9C0043ff,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. [1] = {
  50. .start = MSM_GPIO_TO_INT(132),
  51. .end = MSM_GPIO_TO_INT(132),
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. static struct platform_device smc91x_device = {
  56. .name = "smc91x",
  57. .id = 0,
  58. .num_resources = ARRAY_SIZE(smc91x_resources),
  59. .resource = smc91x_resources,
  60. };
  61. static struct platform_device *devices[] __initdata = {
  62. &msm_device_uart3,
  63. &msm_device_smd,
  64. &msm_device_dmov,
  65. &msm_device_nand,
  66. &smc91x_device,
  67. };
  68. extern struct sys_timer msm_timer;
  69. static void __init msm7x2x_init_irq(void)
  70. {
  71. msm_init_irq();
  72. }
  73. static void __init msm7x2x_init(void)
  74. {
  75. if (socinfo_init() < 0)
  76. BUG();
  77. if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
  78. smc91x_resources[0].start = 0x98000300;
  79. smc91x_resources[0].end = 0x980003ff;
  80. smc91x_resources[1].start = MSM_GPIO_TO_INT(85);
  81. smc91x_resources[1].end = MSM_GPIO_TO_INT(85);
  82. if (gpio_tlmm_config(GPIO_CFG(85, 0,
  83. GPIO_INPUT,
  84. GPIO_PULL_DOWN,
  85. GPIO_2MA),
  86. GPIO_ENABLE)) {
  87. printk(KERN_ERR
  88. "%s: Err: Config GPIO-85 INT\n",
  89. __func__);
  90. }
  91. }
  92. platform_add_devices(devices, ARRAY_SIZE(devices));
  93. }
  94. static void __init msm7x2x_map_io(void)
  95. {
  96. msm_map_common_io();
  97. /* Technically dependent on the SoC but using machine_is
  98. * macros since socinfo is not available this early and there
  99. * are plans to restructure the code which will eliminate the
  100. * need for socinfo.
  101. */
  102. if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa())
  103. msm_clock_init(msm_clocks_7x27, msm_num_clocks_7x27);
  104. if (machine_is_msm7x25_surf() || machine_is_msm7x25_ffa())
  105. msm_clock_init(msm_clocks_7x25, msm_num_clocks_7x25);
  106. #ifdef CONFIG_CACHE_L2X0
  107. if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) {
  108. /* 7x27 has 256KB L2 cache:
  109. 64Kb/Way and 4-Way Associativity;
  110. R/W latency: 3 cycles;
  111. evmon/parity/share disabled. */
  112. l2x0_init(MSM_L2CC_BASE, 0x00068012, 0xfe000000);
  113. }
  114. #endif
  115. }
  116. MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
  117. #ifdef CONFIG_MSM_DEBUG_UART
  118. .phys_io = MSM_DEBUG_UART_PHYS,
  119. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  120. #endif
  121. .boot_params = PHYS_OFFSET + 0x100,
  122. .map_io = msm7x2x_map_io,
  123. .init_irq = msm7x2x_init_irq,
  124. .init_machine = msm7x2x_init,
  125. .timer = &msm_timer,
  126. MACHINE_END
  127. MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
  128. #ifdef CONFIG_MSM_DEBUG_UART
  129. .phys_io = MSM_DEBUG_UART_PHYS,
  130. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  131. #endif
  132. .boot_params = PHYS_OFFSET + 0x100,
  133. .map_io = msm7x2x_map_io,
  134. .init_irq = msm7x2x_init_irq,
  135. .init_machine = msm7x2x_init,
  136. .timer = &msm_timer,
  137. MACHINE_END
  138. MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
  139. #ifdef CONFIG_MSM_DEBUG_UART
  140. .phys_io = MSM_DEBUG_UART_PHYS,
  141. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  142. #endif
  143. .boot_params = PHYS_OFFSET + 0x100,
  144. .map_io = msm7x2x_map_io,
  145. .init_irq = msm7x2x_init_irq,
  146. .init_machine = msm7x2x_init,
  147. .timer = &msm_timer,
  148. MACHINE_END
  149. MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA")
  150. #ifdef CONFIG_MSM_DEBUG_UART
  151. .phys_io = MSM_DEBUG_UART_PHYS,
  152. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  153. #endif
  154. .boot_params = PHYS_OFFSET + 0x100,
  155. .map_io = msm7x2x_map_io,
  156. .init_irq = msm7x2x_init_irq,
  157. .init_machine = msm7x2x_init,
  158. .timer = &msm_timer,
  159. MACHINE_END