mach-cpuimx35.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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/i2c-gpio.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/mach/arch.h>
  34. #include <asm/mach/time.h>
  35. #include <asm/mach/map.h>
  36. #include "common.h"
  37. #include "devices-imx35.h"
  38. #include "ehci.h"
  39. #include "eukrea-baseboards.h"
  40. #include "hardware.h"
  41. #include "iomux-mx35.h"
  42. static const struct imxuart_platform_data uart_pdata __initconst = {
  43. .flags = IMXUART_HAVE_RTSCTS,
  44. };
  45. static const struct imxi2c_platform_data
  46. eukrea_cpuimx35_i2c0_data __initconst = {
  47. .bitrate = 100000,
  48. };
  49. #define TSC2007_IRQGPIO IMX_GPIO_NR(3, 2)
  50. static int tsc2007_get_pendown_state(struct device *dev)
  51. {
  52. return !gpio_get_value(TSC2007_IRQGPIO);
  53. }
  54. static struct tsc2007_platform_data tsc2007_info = {
  55. .model = 2007,
  56. .x_plate_ohms = 180,
  57. .get_pendown_state = tsc2007_get_pendown_state,
  58. };
  59. static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
  60. {
  61. I2C_BOARD_INFO("pcf8563", 0x51),
  62. }, {
  63. I2C_BOARD_INFO("tsc2007", 0x48),
  64. .platform_data = &tsc2007_info,
  65. /* irq number is run-time assigned */
  66. },
  67. };
  68. static iomux_v3_cfg_t eukrea_cpuimx35_pads[] = {
  69. /* UART1 */
  70. MX35_PAD_CTS1__UART1_CTS,
  71. MX35_PAD_RTS1__UART1_RTS,
  72. MX35_PAD_TXD1__UART1_TXD_MUX,
  73. MX35_PAD_RXD1__UART1_RXD_MUX,
  74. /* FEC */
  75. MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
  76. MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
  77. MX35_PAD_FEC_RX_DV__FEC_RX_DV,
  78. MX35_PAD_FEC_COL__FEC_COL,
  79. MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
  80. MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
  81. MX35_PAD_FEC_TX_EN__FEC_TX_EN,
  82. MX35_PAD_FEC_MDC__FEC_MDC,
  83. MX35_PAD_FEC_MDIO__FEC_MDIO,
  84. MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
  85. MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
  86. MX35_PAD_FEC_CRS__FEC_CRS,
  87. MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
  88. MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
  89. MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
  90. MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
  91. MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
  92. MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
  93. /* I2C1 */
  94. MX35_PAD_I2C1_CLK__I2C1_SCL,
  95. MX35_PAD_I2C1_DAT__I2C1_SDA,
  96. /* TSC2007 IRQ */
  97. MX35_PAD_ATA_DA2__GPIO3_2,
  98. };
  99. static const struct mxc_nand_platform_data
  100. eukrea_cpuimx35_nand_board_info __initconst = {
  101. .width = 1,
  102. .hw_ecc = 1,
  103. .flash_bbt = 1,
  104. };
  105. static int eukrea_cpuimx35_otg_init(struct platform_device *pdev)
  106. {
  107. return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
  108. }
  109. static const struct mxc_usbh_platform_data otg_pdata __initconst = {
  110. .init = eukrea_cpuimx35_otg_init,
  111. .portsc = MXC_EHCI_MODE_UTMI,
  112. };
  113. static int eukrea_cpuimx35_usbh1_init(struct platform_device *pdev)
  114. {
  115. return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI |
  116. MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN);
  117. }
  118. static const struct mxc_usbh_platform_data usbh1_pdata __initconst = {
  119. .init = eukrea_cpuimx35_usbh1_init,
  120. .portsc = MXC_EHCI_MODE_SERIAL,
  121. };
  122. static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
  123. .operating_mode = FSL_USB2_DR_DEVICE,
  124. .phy_mode = FSL_USB2_PHY_UTMI,
  125. .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
  126. };
  127. static bool otg_mode_host __initdata;
  128. static int __init eukrea_cpuimx35_otg_mode(char *options)
  129. {
  130. if (!strcmp(options, "host"))
  131. otg_mode_host = true;
  132. else if (!strcmp(options, "device"))
  133. otg_mode_host = false;
  134. else
  135. pr_info("otg_mode neither \"host\" nor \"device\". "
  136. "Defaulting to device\n");
  137. return 1;
  138. }
  139. __setup("otg_mode=", eukrea_cpuimx35_otg_mode);
  140. /*
  141. * Board specific initialization.
  142. */
  143. static void __init eukrea_cpuimx35_init(void)
  144. {
  145. imx35_soc_init();
  146. mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
  147. ARRAY_SIZE(eukrea_cpuimx35_pads));
  148. imx35_add_fec(NULL);
  149. imx35_add_imx2_wdt();
  150. imx35_add_imx_uart0(&uart_pdata);
  151. imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
  152. eukrea_cpuimx35_i2c_devices[1].irq = gpio_to_irq(TSC2007_IRQGPIO);
  153. i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
  154. ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
  155. imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
  156. if (otg_mode_host)
  157. imx35_add_mxc_ehci_otg(&otg_pdata);
  158. else
  159. imx35_add_fsl_usb2_udc(&otg_device_pdata);
  160. imx35_add_mxc_ehci_hs(&usbh1_pdata);
  161. #ifdef CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD
  162. eukrea_mbimxsd35_baseboard_init();
  163. #endif
  164. }
  165. static void __init eukrea_cpuimx35_timer_init(void)
  166. {
  167. mx35_clocks_init();
  168. }
  169. MACHINE_START(EUKREA_CPUIMX35SD, "Eukrea CPUIMX35")
  170. /* Maintainer: Eukrea Electromatique */
  171. .atag_offset = 0x100,
  172. .map_io = mx35_map_io,
  173. .init_early = imx35_init_early,
  174. .init_irq = mx35_init_irq,
  175. .init_time = eukrea_cpuimx35_timer_init,
  176. .init_machine = eukrea_cpuimx35_init,
  177. .restart = mxc_restart,
  178. MACHINE_END