mach-cpuimx27.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * Copyright (C) 2009 Eric Benard - eric@eukrea.com
  3. *
  4. * Based on pcm038.c which is :
  5. * Copyright 2007 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
  6. * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  20. * MA 02110-1301, USA.
  21. */
  22. #include <linux/i2c.h>
  23. #include <linux/io.h>
  24. #include <linux/mtd/plat-ram.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/serial_8250.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/time.h>
  31. #include <asm/mach/map.h>
  32. #include <mach/board-eukrea_cpuimx27.h>
  33. #include <mach/common.h>
  34. #include <mach/hardware.h>
  35. #include <mach/iomux-mx27.h>
  36. #include <mach/mxc_nand.h>
  37. #include "devices-imx27.h"
  38. #include "devices.h"
  39. static int eukrea_cpuimx27_pins[] = {
  40. /* UART1 */
  41. PE12_PF_UART1_TXD,
  42. PE13_PF_UART1_RXD,
  43. PE14_PF_UART1_CTS,
  44. PE15_PF_UART1_RTS,
  45. /* UART4 */
  46. PB26_AF_UART4_RTS,
  47. PB28_AF_UART4_TXD,
  48. PB29_AF_UART4_CTS,
  49. PB31_AF_UART4_RXD,
  50. /* FEC */
  51. PD0_AIN_FEC_TXD0,
  52. PD1_AIN_FEC_TXD1,
  53. PD2_AIN_FEC_TXD2,
  54. PD3_AIN_FEC_TXD3,
  55. PD4_AOUT_FEC_RX_ER,
  56. PD5_AOUT_FEC_RXD1,
  57. PD6_AOUT_FEC_RXD2,
  58. PD7_AOUT_FEC_RXD3,
  59. PD8_AF_FEC_MDIO,
  60. PD9_AIN_FEC_MDC,
  61. PD10_AOUT_FEC_CRS,
  62. PD11_AOUT_FEC_TX_CLK,
  63. PD12_AOUT_FEC_RXD0,
  64. PD13_AOUT_FEC_RX_DV,
  65. PD14_AOUT_FEC_RX_CLK,
  66. PD15_AOUT_FEC_COL,
  67. PD16_AIN_FEC_TX_ER,
  68. PF23_AIN_FEC_TX_EN,
  69. /* I2C1 */
  70. PD17_PF_I2C_DATA,
  71. PD18_PF_I2C_CLK,
  72. /* SDHC2 */
  73. PB4_PF_SD2_D0,
  74. PB5_PF_SD2_D1,
  75. PB6_PF_SD2_D2,
  76. PB7_PF_SD2_D3,
  77. PB8_PF_SD2_CMD,
  78. PB9_PF_SD2_CLK,
  79. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  80. /* Quad UART's IRQ */
  81. GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN,
  82. GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN,
  83. GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN,
  84. GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN,
  85. #endif
  86. };
  87. static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
  88. .width = 2,
  89. };
  90. static struct resource eukrea_cpuimx27_flash_resource = {
  91. .start = 0xc0000000,
  92. .end = 0xc3ffffff,
  93. .flags = IORESOURCE_MEM,
  94. };
  95. static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
  96. .name = "physmap-flash",
  97. .id = 0,
  98. .dev = {
  99. .platform_data = &eukrea_cpuimx27_flash_data,
  100. },
  101. .num_resources = 1,
  102. .resource = &eukrea_cpuimx27_flash_resource,
  103. };
  104. static const struct imxuart_platform_data uart_pdata __initconst = {
  105. .flags = IMXUART_HAVE_RTSCTS,
  106. };
  107. static const struct mxc_nand_platform_data
  108. cpuimx27_nand_board_info __initconst = {
  109. .width = 1,
  110. .hw_ecc = 1,
  111. };
  112. static struct platform_device *platform_devices[] __initdata = {
  113. &eukrea_cpuimx27_nor_mtd_device,
  114. &mxc_fec_device,
  115. };
  116. static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
  117. .bitrate = 100000,
  118. };
  119. static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
  120. {
  121. I2C_BOARD_INFO("pcf8563", 0x51),
  122. },
  123. };
  124. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  125. static struct plat_serial8250_port serial_platform_data[] = {
  126. {
  127. .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x200000),
  128. .irq = IRQ_GPIOB(23),
  129. .uartclk = 14745600,
  130. .regshift = 1,
  131. .iotype = UPIO_MEM,
  132. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  133. }, {
  134. .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x400000),
  135. .irq = IRQ_GPIOB(22),
  136. .uartclk = 14745600,
  137. .regshift = 1,
  138. .iotype = UPIO_MEM,
  139. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  140. }, {
  141. .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x800000),
  142. .irq = IRQ_GPIOB(27),
  143. .uartclk = 14745600,
  144. .regshift = 1,
  145. .iotype = UPIO_MEM,
  146. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  147. }, {
  148. .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x1000000),
  149. .irq = IRQ_GPIOB(30),
  150. .uartclk = 14745600,
  151. .regshift = 1,
  152. .iotype = UPIO_MEM,
  153. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  154. }, {
  155. }
  156. };
  157. static struct platform_device serial_device = {
  158. .name = "serial8250",
  159. .id = 0,
  160. .dev = {
  161. .platform_data = serial_platform_data,
  162. },
  163. };
  164. #endif
  165. static void __init eukrea_cpuimx27_init(void)
  166. {
  167. mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
  168. ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
  169. imx27_add_imx_uart0(&uart_pdata);
  170. imx27_add_mxc_nand(&cpuimx27_nand_board_info);
  171. i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
  172. ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
  173. imx27_add_i2c_imx1(&cpuimx27_i2c1_data);
  174. platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
  175. #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
  176. /* SDHC2 can be used for Wifi */
  177. mxc_register_device(&mxc_sdhc_device1, NULL);
  178. /* in which case UART4 is also used for Bluetooth */
  179. imx27_add_imx_uart3(&uart_pdata);
  180. #endif
  181. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  182. platform_device_register(&serial_device);
  183. #endif
  184. #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
  185. eukrea_mbimx27_baseboard_init();
  186. #endif
  187. }
  188. static void __init eukrea_cpuimx27_timer_init(void)
  189. {
  190. mx27_clocks_init(26000000);
  191. }
  192. static struct sys_timer eukrea_cpuimx27_timer = {
  193. .init = eukrea_cpuimx27_timer_init,
  194. };
  195. MACHINE_START(CPUIMX27, "EUKREA CPUIMX27")
  196. .phys_io = MX27_AIPI_BASE_ADDR,
  197. .io_pg_offst = ((MX27_AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  198. .boot_params = MX27_PHYS_OFFSET + 0x100,
  199. .map_io = mx27_map_io,
  200. .init_irq = mx27_init_irq,
  201. .init_machine = eukrea_cpuimx27_init,
  202. .timer = &eukrea_cpuimx27_timer,
  203. MACHINE_END