mach-cpuimx35.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /*
  2. * Copyright (C) 2010 Eric Benard - eric@eukrea.com
  3. * Copyright (C) 2009 Sascha Hauer, Pengutronix
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  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. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include <linux/types.h>
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/mtd/physmap.h>
  23. #include <linux/memory.h>
  24. #include <linux/gpio.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/delay.h>
  27. #include <linux/i2c.h>
  28. #include <linux/i2c/tsc2007.h>
  29. #include <linux/usb/otg.h>
  30. #include <linux/usb/ulpi.h>
  31. #include <linux/fsl_devices.h>
  32. #include <linux/i2c-gpio.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/time.h>
  36. #include <asm/mach/map.h>
  37. #include <mach/eukrea-baseboards.h>
  38. #include <mach/hardware.h>
  39. #include <mach/common.h>
  40. #include <mach/iomux-mx35.h>
  41. #include <mach/mxc_nand.h>
  42. #include <mach/mxc_ehci.h>
  43. #include <mach/ulpi.h>
  44. #include "devices-imx35.h"
  45. #include "devices.h"
  46. static const struct imxuart_platform_data uart_pdata __initconst = {
  47. .flags = IMXUART_HAVE_RTSCTS,
  48. };
  49. static const struct imxi2c_platform_data
  50. eukrea_cpuimx35_i2c0_data __initconst = {
  51. .bitrate = 100000,
  52. };
  53. static struct tsc2007_platform_data tsc2007_info = {
  54. .model = 2007,
  55. .x_plate_ohms = 180,
  56. };
  57. #define TSC2007_IRQGPIO (2 * 32 + 2)
  58. static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
  59. {
  60. I2C_BOARD_INFO("pcf8563", 0x51),
  61. }, {
  62. I2C_BOARD_INFO("tsc2007", 0x48),
  63. .type = "tsc2007",
  64. .platform_data = &tsc2007_info,
  65. .irq = gpio_to_irq(TSC2007_IRQGPIO),
  66. },
  67. };
  68. static struct platform_device *devices[] __initdata = {
  69. &imx_wdt_device0,
  70. };
  71. static struct pad_desc eukrea_cpuimx35_pads[] = {
  72. /* UART1 */
  73. MX35_PAD_CTS1__UART1_CTS,
  74. MX35_PAD_RTS1__UART1_RTS,
  75. MX35_PAD_TXD1__UART1_TXD_MUX,
  76. MX35_PAD_RXD1__UART1_RXD_MUX,
  77. /* FEC */
  78. MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
  79. MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
  80. MX35_PAD_FEC_RX_DV__FEC_RX_DV,
  81. MX35_PAD_FEC_COL__FEC_COL,
  82. MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
  83. MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
  84. MX35_PAD_FEC_TX_EN__FEC_TX_EN,
  85. MX35_PAD_FEC_MDC__FEC_MDC,
  86. MX35_PAD_FEC_MDIO__FEC_MDIO,
  87. MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
  88. MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
  89. MX35_PAD_FEC_CRS__FEC_CRS,
  90. MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
  91. MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
  92. MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
  93. MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
  94. MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
  95. MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
  96. /* I2C1 */
  97. MX35_PAD_I2C1_CLK__I2C1_SCL,
  98. MX35_PAD_I2C1_DAT__I2C1_SDA,
  99. /* TSC2007 IRQ */
  100. MX35_PAD_ATA_DA2__GPIO3_2,
  101. };
  102. static const struct mxc_nand_platform_data
  103. eukrea_cpuimx35_nand_board_info __initconst = {
  104. .width = 1,
  105. .hw_ecc = 1,
  106. .flash_bbt = 1,
  107. };
  108. static struct mxc_usbh_platform_data __maybe_unused otg_pdata = {
  109. .portsc = MXC_EHCI_MODE_UTMI,
  110. .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
  111. };
  112. static struct mxc_usbh_platform_data __maybe_unused usbh1_pdata = {
  113. .portsc = MXC_EHCI_MODE_SERIAL,
  114. .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
  115. MXC_EHCI_IPPUE_DOWN,
  116. };
  117. static struct fsl_usb2_platform_data otg_device_pdata = {
  118. .operating_mode = FSL_USB2_DR_DEVICE,
  119. .phy_mode = FSL_USB2_PHY_UTMI,
  120. };
  121. static int otg_mode_host;
  122. static int __init eukrea_cpuimx35_otg_mode(char *options)
  123. {
  124. if (!strcmp(options, "host"))
  125. otg_mode_host = 1;
  126. else if (!strcmp(options, "device"))
  127. otg_mode_host = 0;
  128. else
  129. pr_info("otg_mode neither \"host\" nor \"device\". "
  130. "Defaulting to device\n");
  131. return 0;
  132. }
  133. __setup("otg_mode=", eukrea_cpuimx35_otg_mode);
  134. /*
  135. * Board specific initialization.
  136. */
  137. static void __init mxc_board_init(void)
  138. {
  139. mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
  140. ARRAY_SIZE(eukrea_cpuimx35_pads));
  141. imx35_add_fec(NULL);
  142. platform_add_devices(devices, ARRAY_SIZE(devices));
  143. imx35_add_imx_uart0(&uart_pdata);
  144. imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
  145. i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
  146. ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
  147. imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
  148. #if defined(CONFIG_USB_ULPI)
  149. if (otg_mode_host) {
  150. otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
  151. ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
  152. mxc_register_device(&mxc_otg_host, &otg_pdata);
  153. }
  154. mxc_register_device(&mxc_usbh1, &usbh1_pdata);
  155. #endif
  156. if (!otg_mode_host)
  157. mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
  158. #ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
  159. eukrea_mbimxsd35_baseboard_init();
  160. #endif
  161. }
  162. static void __init eukrea_cpuimx35_timer_init(void)
  163. {
  164. mx35_clocks_init();
  165. }
  166. struct sys_timer eukrea_cpuimx35_timer = {
  167. .init = eukrea_cpuimx35_timer_init,
  168. };
  169. MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35")
  170. /* Maintainer: Eukrea Electromatique */
  171. .phys_io = MX35_AIPS1_BASE_ADDR,
  172. .io_pg_offst = ((MX35_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  173. .boot_params = MX3x_PHYS_OFFSET + 0x100,
  174. .map_io = mx35_map_io,
  175. .init_irq = mx35_init_irq,
  176. .init_machine = mxc_board_init,
  177. .timer = &eukrea_cpuimx35_timer,
  178. MACHINE_END