PageRenderTime 47ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/arch/arm/mach-msm/board-msm7x27.c

https://bitbucket.org/alquez/htc-wildfire-s-cm7-kernel
C | 178 lines | 134 code | 20 blank | 24 comment | 10 complexity | 71aac08f64f2067e68d4fc3c3ee64ffb MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  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/power_supply.h>
  23. #include <mach/hardware.h>
  24. #include <asm/mach-types.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/flash.h>
  28. #include <asm/setup.h>
  29. #ifdef CONFIG_CACHE_L2X0
  30. #include <asm/hardware/cache-l2x0.h>
  31. #endif
  32. #include <mach/vreg.h>
  33. #include <mach/mpp.h>
  34. #include <mach/gpio.h>
  35. #include <mach/board.h>
  36. #include <mach/msm_iomap.h>
  37. #include <linux/mtd/nand.h>
  38. #include <linux/mtd/partitions.h>
  39. #include "devices.h"
  40. #include "socinfo.h"
  41. #include "clock.h"
  42. static struct resource smc91x_resources[] = {
  43. [0] = {
  44. .start = 0x9C004300,
  45. .end = 0x9C0043ff,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. [1] = {
  49. .start = MSM_GPIO_TO_INT(132),
  50. .end = MSM_GPIO_TO_INT(132),
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. static struct platform_device smc91x_device = {
  55. .name = "smc91x",
  56. .id = 0,
  57. .num_resources = ARRAY_SIZE(smc91x_resources),
  58. .resource = smc91x_resources,
  59. };
  60. static struct platform_device *devices[] __initdata = {
  61. &msm_device_uart3,
  62. &msm_device_smd,
  63. &msm_device_dmov,
  64. &msm_device_nand,
  65. &smc91x_device,
  66. };
  67. extern struct sys_timer msm_timer;
  68. static void __init msm7x2x_init_irq(void)
  69. {
  70. msm_init_irq();
  71. }
  72. static void __init msm7x2x_init(void)
  73. {
  74. if (socinfo_init() < 0)
  75. BUG();
  76. if (machine_is_msm7x25_ffa() || machine_is_msm7x27_ffa()) {
  77. smc91x_resources[0].start = 0x98000300;
  78. smc91x_resources[0].end = 0x980003ff;
  79. smc91x_resources[1].start = MSM_GPIO_TO_INT(85);
  80. smc91x_resources[1].end = MSM_GPIO_TO_INT(85);
  81. if (gpio_tlmm_config(GPIO_CFG(85, 0,
  82. GPIO_INPUT,
  83. GPIO_PULL_DOWN,
  84. GPIO_2MA),
  85. GPIO_ENABLE)) {
  86. printk(KERN_ERR
  87. "%s: Err: Config GPIO-85 INT\n",
  88. __func__);
  89. }
  90. }
  91. platform_add_devices(devices, ARRAY_SIZE(devices));
  92. }
  93. static void __init msm7x2x_map_io(void)
  94. {
  95. msm_map_common_io();
  96. /* Technically dependent on the SoC but using machine_is
  97. * macros since socinfo is not available this early and there
  98. * are plans to restructure the code which will eliminate the
  99. * need for socinfo.
  100. */
  101. if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa())
  102. msm_clock_init(msm_clocks_7x27, msm_num_clocks_7x27);
  103. if (machine_is_msm7x25_surf() || machine_is_msm7x25_ffa())
  104. msm_clock_init(msm_clocks_7x25, msm_num_clocks_7x25);
  105. #ifdef CONFIG_CACHE_L2X0
  106. if (machine_is_msm7x27_surf() || machine_is_msm7x27_ffa()) {
  107. /* 7x27 has 256KB L2 cache:
  108. 64Kb/Way and 4-Way Associativity;
  109. R/W latency: 3 cycles;
  110. evmon/parity/share disabled. */
  111. l2x0_init(MSM_L2CC_BASE, 0x00068012, 0xfe000000);
  112. }
  113. #endif
  114. }
  115. MACHINE_START(MSM7X27_SURF, "QCT MSM7x27 SURF")
  116. #ifdef CONFIG_MSM_DEBUG_UART
  117. .phys_io = MSM_DEBUG_UART_PHYS,
  118. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  119. #endif
  120. .boot_params = PHYS_OFFSET + 0x100,
  121. .map_io = msm7x2x_map_io,
  122. .init_irq = msm7x2x_init_irq,
  123. .init_machine = msm7x2x_init,
  124. .timer = &msm_timer,
  125. MACHINE_END
  126. MACHINE_START(MSM7X27_FFA, "QCT MSM7x27 FFA")
  127. #ifdef CONFIG_MSM_DEBUG_UART
  128. .phys_io = MSM_DEBUG_UART_PHYS,
  129. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  130. #endif
  131. .boot_params = PHYS_OFFSET + 0x100,
  132. .map_io = msm7x2x_map_io,
  133. .init_irq = msm7x2x_init_irq,
  134. .init_machine = msm7x2x_init,
  135. .timer = &msm_timer,
  136. MACHINE_END
  137. MACHINE_START(MSM7X25_SURF, "QCT MSM7x25 SURF")
  138. #ifdef CONFIG_MSM_DEBUG_UART
  139. .phys_io = MSM_DEBUG_UART_PHYS,
  140. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  141. #endif
  142. .boot_params = PHYS_OFFSET + 0x100,
  143. .map_io = msm7x2x_map_io,
  144. .init_irq = msm7x2x_init_irq,
  145. .init_machine = msm7x2x_init,
  146. .timer = &msm_timer,
  147. MACHINE_END
  148. MACHINE_START(MSM7X25_FFA, "QCT MSM7x25 FFA")
  149. #ifdef CONFIG_MSM_DEBUG_UART
  150. .phys_io = MSM_DEBUG_UART_PHYS,
  151. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  152. #endif
  153. .boot_params = PHYS_OFFSET + 0x100,
  154. .map_io = msm7x2x_map_io,
  155. .init_irq = msm7x2x_init_irq,
  156. .init_machine = msm7x2x_init,
  157. .timer = &msm_timer,
  158. MACHINE_END