board-qsd8x50.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* Copyright (c) 2008-2009, 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/usb/msm_hsusb.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/io.h>
  26. #include <asm/setup.h>
  27. #include <mach/board.h>
  28. #include <mach/irqs.h>
  29. #include <mach/sirc.h>
  30. #include <mach/gpio.h>
  31. #include "devices.h"
  32. extern struct sys_timer msm_timer;
  33. static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300;
  34. static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156;
  35. /* Leave smc91x resources empty here, as we'll fill them in
  36. * at run-time: they vary from board to board, and the true
  37. * configuration won't be known until boot.
  38. */
  39. static struct resource smc91x_resources[] = {
  40. [0] = {
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .flags = IORESOURCE_IRQ,
  45. },
  46. };
  47. static struct platform_device smc91x_device = {
  48. .name = "smc91x",
  49. .id = 0,
  50. .num_resources = ARRAY_SIZE(smc91x_resources),
  51. .resource = smc91x_resources,
  52. };
  53. static int __init msm_init_smc91x(void)
  54. {
  55. if (machine_is_qsd8x50_surf()) {
  56. smc91x_resources[0].start = qsd8x50_surf_smc91x_base;
  57. smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff;
  58. smc91x_resources[1].start =
  59. gpio_to_irq(qsd8x50_surf_smc91x_gpio);
  60. smc91x_resources[1].end =
  61. gpio_to_irq(qsd8x50_surf_smc91x_gpio);
  62. platform_device_register(&smc91x_device);
  63. }
  64. return 0;
  65. }
  66. module_init(msm_init_smc91x);
  67. static int hsusb_phy_init_seq[] = {
  68. 0x08, 0x31, /* Increase HS Driver Amplitude */
  69. 0x20, 0x32, /* Enable and set Pre-Emphasis Depth to 10% */
  70. -1
  71. };
  72. static struct msm_otg_platform_data msm_otg_pdata = {
  73. .phy_init_seq = hsusb_phy_init_seq,
  74. .mode = USB_PERIPHERAL,
  75. .otg_control = OTG_PHY_CONTROL,
  76. };
  77. static struct platform_device *devices[] __initdata = {
  78. &msm_device_uart3,
  79. &msm_device_smd,
  80. &msm_device_otg,
  81. &msm_device_hsusb,
  82. &msm_device_hsusb_host,
  83. };
  84. static void __init qsd8x50_map_io(void)
  85. {
  86. msm_map_qsd8x50_io();
  87. msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50);
  88. }
  89. static void __init qsd8x50_init_irq(void)
  90. {
  91. msm_init_irq();
  92. msm_init_sirc();
  93. }
  94. static void __init qsd8x50_init(void)
  95. {
  96. msm_device_otg.dev.platform_data = &msm_otg_pdata;
  97. msm_device_hsusb.dev.parent = &msm_device_otg.dev;
  98. msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
  99. platform_add_devices(devices, ARRAY_SIZE(devices));
  100. }
  101. MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
  102. #ifdef CONFIG_MSM_DEBUG_UART
  103. #endif
  104. .boot_params = PHYS_OFFSET + 0x100,
  105. .map_io = qsd8x50_map_io,
  106. .init_irq = qsd8x50_init_irq,
  107. .init_machine = qsd8x50_init,
  108. .timer = &msm_timer,
  109. MACHINE_END
  110. MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
  111. #ifdef CONFIG_MSM_DEBUG_UART
  112. #endif
  113. .boot_params = PHYS_OFFSET + 0x100,
  114. .map_io = qsd8x50_map_io,
  115. .init_irq = qsd8x50_init_irq,
  116. .init_machine = qsd8x50_init,
  117. .timer = &msm_timer,
  118. MACHINE_END