mach-cpuimx25.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
  3. * Copyright 2010 Eric Bénard - Eukréa Electromatique, <eric@eukrea.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #include <linux/types.h>
  20. #include <linux/init.h>
  21. #include <linux/delay.h>
  22. #include <linux/clk.h>
  23. #include <linux/irq.h>
  24. #include <linux/gpio.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/usb/otg.h>
  27. #include <linux/usb/ulpi.h>
  28. #include <linux/fsl_devices.h>
  29. #include <mach/eukrea-baseboards.h>
  30. #include <mach/hardware.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/time.h>
  34. #include <asm/memory.h>
  35. #include <asm/mach/map.h>
  36. #include <mach/common.h>
  37. #include <mach/mx25.h>
  38. #include <mach/mxc_nand.h>
  39. #include <mach/imxfb.h>
  40. #include <mach/mxc_ehci.h>
  41. #include <mach/iomux-mx25.h>
  42. #include "devices-imx25.h"
  43. #include "devices.h"
  44. static const struct imxuart_platform_data uart_pdata __initconst = {
  45. .flags = IMXUART_HAVE_RTSCTS,
  46. };
  47. static struct pad_desc eukrea_cpuimx25_pads[] = {
  48. /* FEC - RMII */
  49. MX25_PAD_FEC_MDC__FEC_MDC,
  50. MX25_PAD_FEC_MDIO__FEC_MDIO,
  51. MX25_PAD_FEC_TDATA0__FEC_TDATA0,
  52. MX25_PAD_FEC_TDATA1__FEC_TDATA1,
  53. MX25_PAD_FEC_TX_EN__FEC_TX_EN,
  54. MX25_PAD_FEC_RDATA0__FEC_RDATA0,
  55. MX25_PAD_FEC_RDATA1__FEC_RDATA1,
  56. MX25_PAD_FEC_RX_DV__FEC_RX_DV,
  57. MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
  58. /* I2C1 */
  59. MX25_PAD_I2C1_CLK__I2C1_CLK,
  60. MX25_PAD_I2C1_DAT__I2C1_DAT,
  61. };
  62. static const struct fec_platform_data mx25_fec_pdata __initconst = {
  63. .phy = PHY_INTERFACE_MODE_RMII,
  64. };
  65. static const struct mxc_nand_platform_data
  66. eukrea_cpuimx25_nand_board_info __initconst = {
  67. .width = 1,
  68. .hw_ecc = 1,
  69. .flash_bbt = 1,
  70. };
  71. static const struct imxi2c_platform_data
  72. eukrea_cpuimx25_i2c0_data __initconst = {
  73. .bitrate = 100000,
  74. };
  75. static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
  76. {
  77. I2C_BOARD_INFO("pcf8563", 0x51),
  78. },
  79. };
  80. static struct mxc_usbh_platform_data otg_pdata = {
  81. .portsc = MXC_EHCI_MODE_UTMI,
  82. .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
  83. };
  84. static struct mxc_usbh_platform_data usbh2_pdata = {
  85. .portsc = MXC_EHCI_MODE_SERIAL,
  86. .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
  87. MXC_EHCI_IPPUE_DOWN,
  88. };
  89. static struct fsl_usb2_platform_data otg_device_pdata = {
  90. .operating_mode = FSL_USB2_DR_DEVICE,
  91. .phy_mode = FSL_USB2_PHY_UTMI,
  92. };
  93. static int otg_mode_host;
  94. static int __init eukrea_cpuimx25_otg_mode(char *options)
  95. {
  96. if (!strcmp(options, "host"))
  97. otg_mode_host = 1;
  98. else if (!strcmp(options, "device"))
  99. otg_mode_host = 0;
  100. else
  101. pr_info("otg_mode neither \"host\" nor \"device\". "
  102. "Defaulting to device\n");
  103. return 0;
  104. }
  105. __setup("otg_mode=", eukrea_cpuimx25_otg_mode);
  106. static void __init eukrea_cpuimx25_init(void)
  107. {
  108. if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
  109. ARRAY_SIZE(eukrea_cpuimx25_pads)))
  110. printk(KERN_ERR "error setting cpuimx25 pads !\n");
  111. imx25_add_imx_uart0(&uart_pdata);
  112. imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
  113. mxc_register_device(&mx25_rtc_device, NULL);
  114. imx25_add_fec(&mx25_fec_pdata);
  115. i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
  116. ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
  117. imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
  118. if (otg_mode_host)
  119. mxc_register_device(&mxc_otg, &otg_pdata);
  120. else
  121. mxc_register_device(&otg_udc_device, &otg_device_pdata);
  122. mxc_register_device(&mxc_usbh2, &usbh2_pdata);
  123. #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD
  124. eukrea_mbimxsd25_baseboard_init();
  125. #endif
  126. }
  127. static void __init eukrea_cpuimx25_timer_init(void)
  128. {
  129. mx25_clocks_init();
  130. }
  131. static struct sys_timer eukrea_cpuimx25_timer = {
  132. .init = eukrea_cpuimx25_timer_init,
  133. };
  134. MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25")
  135. /* Maintainer: Eukrea Electromatique */
  136. .boot_params = MX25_PHYS_OFFSET + 0x100,
  137. .map_io = mx25_map_io,
  138. .init_irq = mx25_init_irq,
  139. .init_machine = eukrea_cpuimx25_init,
  140. .timer = &eukrea_cpuimx25_timer,
  141. MACHINE_END