eukrea_cpuimx27.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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/i2c.h>
  36. #include <mach/iomux.h>
  37. #include <mach/imx-uart.h>
  38. #include <mach/mxc_nand.h>
  39. #include "devices.h"
  40. static int eukrea_cpuimx27_pins[] = {
  41. /* UART1 */
  42. PE12_PF_UART1_TXD,
  43. PE13_PF_UART1_RXD,
  44. PE14_PF_UART1_CTS,
  45. PE15_PF_UART1_RTS,
  46. /* UART4 */
  47. PB26_AF_UART4_RTS,
  48. PB28_AF_UART4_TXD,
  49. PB29_AF_UART4_CTS,
  50. PB31_AF_UART4_RXD,
  51. /* FEC */
  52. PD0_AIN_FEC_TXD0,
  53. PD1_AIN_FEC_TXD1,
  54. PD2_AIN_FEC_TXD2,
  55. PD3_AIN_FEC_TXD3,
  56. PD4_AOUT_FEC_RX_ER,
  57. PD5_AOUT_FEC_RXD1,
  58. PD6_AOUT_FEC_RXD2,
  59. PD7_AOUT_FEC_RXD3,
  60. PD8_AF_FEC_MDIO,
  61. PD9_AIN_FEC_MDC,
  62. PD10_AOUT_FEC_CRS,
  63. PD11_AOUT_FEC_TX_CLK,
  64. PD12_AOUT_FEC_RXD0,
  65. PD13_AOUT_FEC_RX_DV,
  66. PD14_AOUT_FEC_RX_CLK,
  67. PD15_AOUT_FEC_COL,
  68. PD16_AIN_FEC_TX_ER,
  69. PF23_AIN_FEC_TX_EN,
  70. /* I2C1 */
  71. PD17_PF_I2C_DATA,
  72. PD18_PF_I2C_CLK,
  73. /* SDHC2 */
  74. PB4_PF_SD2_D0,
  75. PB5_PF_SD2_D1,
  76. PB6_PF_SD2_D2,
  77. PB7_PF_SD2_D3,
  78. PB8_PF_SD2_CMD,
  79. PB9_PF_SD2_CLK,
  80. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  81. /* Quad UART's IRQ */
  82. GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN,
  83. GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN,
  84. GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN,
  85. GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN,
  86. #endif
  87. };
  88. static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
  89. .width = 2,
  90. };
  91. static struct resource eukrea_cpuimx27_flash_resource = {
  92. .start = 0xc0000000,
  93. .end = 0xc3ffffff,
  94. .flags = IORESOURCE_MEM,
  95. };
  96. static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
  97. .name = "physmap-flash",
  98. .id = 0,
  99. .dev = {
  100. .platform_data = &eukrea_cpuimx27_flash_data,
  101. },
  102. .num_resources = 1,
  103. .resource = &eukrea_cpuimx27_flash_resource,
  104. };
  105. static struct imxuart_platform_data uart_pdata[] = {
  106. {
  107. .flags = IMXUART_HAVE_RTSCTS,
  108. }, {
  109. .flags = IMXUART_HAVE_RTSCTS,
  110. },
  111. };
  112. static struct mxc_nand_platform_data eukrea_cpuimx27_nand_board_info = {
  113. .width = 1,
  114. .hw_ecc = 1,
  115. };
  116. static struct platform_device *platform_devices[] __initdata = {
  117. &eukrea_cpuimx27_nor_mtd_device,
  118. &mxc_fec_device,
  119. };
  120. static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = {
  121. .bitrate = 100000,
  122. };
  123. static struct i2c_board_info eukrea_cpuimx27_i2c_devices[] = {
  124. {
  125. I2C_BOARD_INFO("pcf8563", 0x51),
  126. },
  127. };
  128. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  129. static struct plat_serial8250_port serial_platform_data[] = {
  130. {
  131. .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x200000),
  132. .irq = IRQ_GPIOB(23),
  133. .uartclk = 14745600,
  134. .regshift = 1,
  135. .iotype = UPIO_MEM,
  136. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  137. }, {
  138. .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x400000),
  139. .irq = IRQ_GPIOB(22),
  140. .uartclk = 14745600,
  141. .regshift = 1,
  142. .iotype = UPIO_MEM,
  143. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  144. }, {
  145. .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x800000),
  146. .irq = IRQ_GPIOB(27),
  147. .uartclk = 14745600,
  148. .regshift = 1,
  149. .iotype = UPIO_MEM,
  150. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  151. }, {
  152. .mapbase = (unsigned long)(CS3_BASE_ADDR + 0x1000000),
  153. .irq = IRQ_GPIOB(30),
  154. .uartclk = 14745600,
  155. .regshift = 1,
  156. .iotype = UPIO_MEM,
  157. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
  158. }, {
  159. }
  160. };
  161. static struct platform_device serial_device = {
  162. .name = "serial8250",
  163. .id = 0,
  164. .dev = {
  165. .platform_data = serial_platform_data,
  166. },
  167. };
  168. #endif
  169. static void __init eukrea_cpuimx27_init(void)
  170. {
  171. mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
  172. ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
  173. mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
  174. mxc_register_device(&mxc_nand_device, &eukrea_cpuimx27_nand_board_info);
  175. i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
  176. ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
  177. mxc_register_device(&mxc_i2c_device0, &eukrea_cpuimx27_i2c_1_data);
  178. platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
  179. #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
  180. /* SDHC2 can be used for Wifi */
  181. mxc_register_device(&mxc_sdhc_device1, NULL);
  182. /* in which case UART4 is also used for Bluetooth */
  183. mxc_register_device(&mxc_uart_device3, &uart_pdata[1]);
  184. #endif
  185. #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
  186. platform_device_register(&serial_device);
  187. #endif
  188. #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
  189. eukrea_mbimx27_baseboard_init();
  190. #endif
  191. }
  192. static void __init eukrea_cpuimx27_timer_init(void)
  193. {
  194. mx27_clocks_init(26000000);
  195. }
  196. static struct sys_timer eukrea_cpuimx27_timer = {
  197. .init = eukrea_cpuimx27_timer_init,
  198. };
  199. MACHINE_START(CPUIMX27, "EUKREA CPUIMX27")
  200. .phys_io = AIPI_BASE_ADDR,
  201. .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  202. .boot_params = PHYS_OFFSET + 0x100,
  203. .map_io = mx27_map_io,
  204. .init_irq = mx27_init_irq,
  205. .init_machine = eukrea_cpuimx27_init,
  206. .timer = &eukrea_cpuimx27_timer,
  207. MACHINE_END