board-msm7x30.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. * 02110-1301, USA.
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/irq.h>
  19. #include <linux/gpio.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/delay.h>
  22. #include <linux/bootmem.h>
  23. #include <linux/io.h>
  24. #include <linux/smsc911x.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/setup.h>
  28. #include <mach/gpio.h>
  29. #include <mach/board.h>
  30. #include <mach/camera.h>
  31. #include <mach/memory.h>
  32. #include <mach/msm_iomap.h>
  33. #include <mach/msm_hsusb.h>
  34. #include <mach/dma.h>
  35. #include <mach/vreg.h>
  36. #include "devices.h"
  37. #include "timer.h"
  38. #include "socinfo.h"
  39. static struct resource smc91x_resources[] = {
  40. [0] = {
  41. .start = 0x8A000300,
  42. .end = 0x8A0003ff,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. .start = MSM_GPIO_TO_INT(156),
  47. .end = MSM_GPIO_TO_INT(156),
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. };
  51. static struct platform_device smc91x_device = {
  52. .name = "smc91x",
  53. .id = 0,
  54. .num_resources = ARRAY_SIZE(smc91x_resources),
  55. .resource = smc91x_resources,
  56. };
  57. static struct smsc911x_platform_config smsc911x_config = {
  58. .phy_interface = PHY_INTERFACE_MODE_MII,
  59. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  60. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  61. .flags = SMSC911X_USE_32BIT,
  62. };
  63. static struct resource smsc911x_resources[] = {
  64. [0] = {
  65. .start = 0x8D000000,
  66. .end = 0x8D000100,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. .start = MSM_GPIO_TO_INT(88),
  71. .end = MSM_GPIO_TO_INT(88),
  72. .flags = IORESOURCE_IRQ,
  73. },
  74. };
  75. static struct platform_device smsc911x_device = {
  76. .name = "smsc911x",
  77. .id = -1,
  78. .num_resources = ARRAY_SIZE(smsc911x_resources),
  79. .resource = smsc911x_resources,
  80. .dev = {
  81. .platform_data = &smsc911x_config,
  82. },
  83. };
  84. static struct msm_gpio smsc911x_gpios[] = {
  85. { GPIO_CFG(172, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr6" },
  86. { GPIO_CFG(173, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr5" },
  87. { GPIO_CFG(174, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr4" },
  88. { GPIO_CFG(175, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr3" },
  89. { GPIO_CFG(176, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr2" },
  90. { GPIO_CFG(177, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr1" },
  91. { GPIO_CFG(178, 2, GPIO_OUTPUT, GPIO_PULL_DOWN, GPIO_2MA), "ebi2_addr0" },
  92. { GPIO_CFG(88, 2, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA), "smsc911x_irq" },
  93. };
  94. static void msm7x30_cfg_smsc911x(void)
  95. {
  96. int rc;
  97. rc = msm_gpios_request_enable(smsc911x_gpios,
  98. ARRAY_SIZE(smsc911x_gpios));
  99. if (rc)
  100. pr_err("%s: unable to enable gpios\n", __func__);
  101. }
  102. static struct platform_device *devices[] __initdata = {
  103. &msm_device_smd,
  104. &msm_device_dmov,
  105. &smc91x_device,
  106. &smsc911x_device,
  107. &msm_device_nand,
  108. &msm_device_uart_dm1,
  109. };
  110. static void __init msm7x30_init_irq(void)
  111. {
  112. msm_init_irq();
  113. }
  114. static void __init msm_7x30_init_nand(void)
  115. {
  116. int rc;
  117. /* Enable GPIO 86 & 115 */
  118. rc = msm_gpios_request_enable(msm_nand_ebi2_cfg_data,
  119. ARRAY_SIZE(msm_nand_ebi2_cfg_data));
  120. if (rc)
  121. printk(KERN_ERR "%s: Failed to enable GPIO 86 & 115\n",
  122. __func__);
  123. }
  124. static void __init msm7x30_init(void)
  125. {
  126. if (socinfo_init() < 0)
  127. printk(KERN_ERR "%s: socinfo_init() failed!\n",
  128. __func__);
  129. msm_acpu_clock_init(&msm7x30_clock_data);
  130. if (machine_is_msm7x30_surf() || machine_is_msm7x30_fluid())
  131. msm7x30_cfg_smsc911x();
  132. platform_add_devices(devices, ARRAY_SIZE(devices));
  133. msm_7x30_init_nand();
  134. buses_init();
  135. }
  136. static void __init msm7x30_map_io(void)
  137. {
  138. msm_shared_ram_phys = 0x00000000;
  139. msm_map_msm7x30_io();
  140. msm7x30_allocate_memory_regions();
  141. msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30);
  142. }
  143. MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
  144. #ifdef CONFIG_MSM_DEBUG_UART
  145. .phys_io = MSM_DEBUG_UART_PHYS,
  146. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  147. #endif
  148. .boot_params = PHYS_OFFSET + 0x100,
  149. .map_io = msm7x30_map_io,
  150. .init_irq = msm7x30_init_irq,
  151. .init_machine = msm7x30_init,
  152. .timer = &msm_timer,
  153. MACHINE_END
  154. MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
  155. #ifdef CONFIG_MSM_DEBUG_UART
  156. .phys_io = MSM_DEBUG_UART_PHYS,
  157. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  158. #endif
  159. .boot_params = PHYS_OFFSET + 0x100,
  160. .map_io = msm7x30_map_io,
  161. .init_irq = msm7x30_init_irq,
  162. .init_machine = msm7x30_init,
  163. .timer = &msm_timer,
  164. MACHINE_END
  165. MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
  166. #ifdef CONFIG_MSM_DEBUG_UART
  167. .phys_io = MSM_DEBUG_UART_PHYS,
  168. .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
  169. #endif
  170. .boot_params = PHYS_OFFSET + 0x100,
  171. .map_io = msm7x30_map_io,
  172. .init_irq = msm7x30_init_irq,
  173. .init_machine = msm7x30_init,
  174. .timer = &msm_timer,
  175. MACHINE_END