pcm037.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /*
  2. * Copyright (C) 2008 Sascha Hauer, Pengutronix
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #include <linux/types.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <linux/mtd/plat-ram.h>
  23. #include <linux/memory.h>
  24. #include <linux/gpio.h>
  25. #include <linux/smsc911x.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/i2c.h>
  28. #include <linux/i2c/at24.h>
  29. #include <mach/hardware.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/time.h>
  33. #include <asm/mach/map.h>
  34. #include <mach/common.h>
  35. #include <mach/imx-uart.h>
  36. #include <mach/iomux-mx3.h>
  37. #include <mach/board-pcm037.h>
  38. #include <mach/mxc_nand.h>
  39. #include <mach/mmc.h>
  40. #ifdef CONFIG_I2C_IMX
  41. #include <mach/i2c.h>
  42. #endif
  43. #include "devices.h"
  44. static struct physmap_flash_data pcm037_flash_data = {
  45. .width = 2,
  46. };
  47. static struct resource pcm037_flash_resource = {
  48. .start = 0xa0000000,
  49. .end = 0xa1ffffff,
  50. .flags = IORESOURCE_MEM,
  51. };
  52. static struct platform_device pcm037_flash = {
  53. .name = "physmap-flash",
  54. .id = 0,
  55. .dev = {
  56. .platform_data = &pcm037_flash_data,
  57. },
  58. .resource = &pcm037_flash_resource,
  59. .num_resources = 1,
  60. };
  61. static struct imxuart_platform_data uart_pdata = {
  62. .flags = IMXUART_HAVE_RTSCTS,
  63. };
  64. static struct resource smsc911x_resources[] = {
  65. [0] = {
  66. .start = CS1_BASE_ADDR + 0x300,
  67. .end = CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
  68. .flags = IORESOURCE_MEM,
  69. },
  70. [1] = {
  71. .start = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
  72. .end = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
  73. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  74. },
  75. };
  76. static struct smsc911x_platform_config smsc911x_info = {
  77. .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY |
  78. SMSC911X_SAVE_MAC_ADDRESS,
  79. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  80. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  81. .phy_interface = PHY_INTERFACE_MODE_MII,
  82. };
  83. static struct platform_device pcm037_eth = {
  84. .name = "smsc911x",
  85. .id = -1,
  86. .num_resources = ARRAY_SIZE(smsc911x_resources),
  87. .resource = smsc911x_resources,
  88. .dev = {
  89. .platform_data = &smsc911x_info,
  90. },
  91. };
  92. static struct platdata_mtd_ram pcm038_sram_data = {
  93. .bankwidth = 2,
  94. };
  95. static struct resource pcm038_sram_resource = {
  96. .start = CS4_BASE_ADDR,
  97. .end = CS4_BASE_ADDR + 512 * 1024 - 1,
  98. .flags = IORESOURCE_MEM,
  99. };
  100. static struct platform_device pcm037_sram_device = {
  101. .name = "mtd-ram",
  102. .id = 0,
  103. .dev = {
  104. .platform_data = &pcm038_sram_data,
  105. },
  106. .num_resources = 1,
  107. .resource = &pcm038_sram_resource,
  108. };
  109. static struct mxc_nand_platform_data pcm037_nand_board_info = {
  110. .width = 1,
  111. .hw_ecc = 1,
  112. };
  113. #ifdef CONFIG_I2C_IMX
  114. static int i2c_1_pins[] = {
  115. MX31_PIN_CSPI2_MOSI__SCL,
  116. MX31_PIN_CSPI2_MISO__SDA,
  117. };
  118. static int pcm037_i2c_1_init(struct device *dev)
  119. {
  120. return mxc_iomux_setup_multiple_pins(i2c_1_pins, ARRAY_SIZE(i2c_1_pins),
  121. "i2c-1");
  122. }
  123. static void pcm037_i2c_1_exit(struct device *dev)
  124. {
  125. mxc_iomux_release_multiple_pins(i2c_1_pins, ARRAY_SIZE(i2c_1_pins));
  126. }
  127. static struct imxi2c_platform_data pcm037_i2c_1_data = {
  128. .bitrate = 100000,
  129. .init = pcm037_i2c_1_init,
  130. .exit = pcm037_i2c_1_exit,
  131. };
  132. static struct at24_platform_data board_eeprom = {
  133. .byte_len = 4096,
  134. .page_size = 32,
  135. .flags = AT24_FLAG_ADDR16,
  136. };
  137. static struct i2c_board_info pcm037_i2c_devices[] = {
  138. {
  139. I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
  140. .platform_data = &board_eeprom,
  141. }, {
  142. I2C_BOARD_INFO("rtc-pcf8563", 0x51),
  143. .type = "pcf8563",
  144. }
  145. };
  146. #endif
  147. static int sdhc1_pins[] = {
  148. MX31_PIN_SD1_DATA3__SD1_DATA3,
  149. MX31_PIN_SD1_DATA2__SD1_DATA2,
  150. MX31_PIN_SD1_DATA1__SD1_DATA1,
  151. MX31_PIN_SD1_DATA0__SD1_DATA0,
  152. MX31_PIN_SD1_CLK__SD1_CLK,
  153. MX31_PIN_SD1_CMD__SD1_CMD,
  154. };
  155. static int pcm970_sdhc1_init(struct device *dev, irq_handler_t h, void *data)
  156. {
  157. return mxc_iomux_setup_multiple_pins(sdhc1_pins, ARRAY_SIZE(sdhc1_pins),
  158. "sdhc-1");
  159. }
  160. static void pcm970_sdhc1_exit(struct device *dev, void *data)
  161. {
  162. mxc_iomux_release_multiple_pins(sdhc1_pins, ARRAY_SIZE(sdhc1_pins));
  163. }
  164. /* No card and rw detection at the moment */
  165. static struct imxmmc_platform_data sdhc_pdata = {
  166. .init = pcm970_sdhc1_init,
  167. .exit = pcm970_sdhc1_exit,
  168. };
  169. static struct platform_device *devices[] __initdata = {
  170. &pcm037_flash,
  171. &pcm037_eth,
  172. &pcm037_sram_device,
  173. };
  174. static int uart0_pins[] = {
  175. MX31_PIN_CTS1__CTS1,
  176. MX31_PIN_RTS1__RTS1,
  177. MX31_PIN_TXD1__TXD1,
  178. MX31_PIN_RXD1__RXD1
  179. };
  180. static int uart2_pins[] = {
  181. MX31_PIN_CSPI3_MOSI__RXD3,
  182. MX31_PIN_CSPI3_MISO__TXD3
  183. };
  184. /*
  185. * Board specific initialization.
  186. */
  187. static void __init mxc_board_init(void)
  188. {
  189. platform_add_devices(devices, ARRAY_SIZE(devices));
  190. mxc_iomux_setup_multiple_pins(uart0_pins, ARRAY_SIZE(uart0_pins), "uart-0");
  191. mxc_register_device(&mxc_uart_device0, &uart_pdata);
  192. mxc_iomux_setup_multiple_pins(uart2_pins, ARRAY_SIZE(uart2_pins), "uart-2");
  193. mxc_register_device(&mxc_uart_device2, &uart_pdata);
  194. mxc_iomux_setup_pin(MX31_PIN_BATT_LINE__OWIRE, "batt-0wire");
  195. mxc_register_device(&mxc_w1_master_device, NULL);
  196. /* SMSC9215 IRQ pin */
  197. if (!mxc_iomux_setup_pin(IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
  198. "pcm037-eth"))
  199. gpio_direction_input(MX31_PIN_GPIO3_1);
  200. #ifdef CONFIG_I2C_IMX
  201. i2c_register_board_info(1, pcm037_i2c_devices,
  202. ARRAY_SIZE(pcm037_i2c_devices));
  203. mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data);
  204. #endif
  205. mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
  206. mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
  207. }
  208. static void __init pcm037_timer_init(void)
  209. {
  210. mx31_clocks_init(26000000);
  211. }
  212. struct sys_timer pcm037_timer = {
  213. .init = pcm037_timer_init,
  214. };
  215. MACHINE_START(PCM037, "Phytec Phycore pcm037")
  216. /* Maintainer: Pengutronix */
  217. .phys_io = AIPS1_BASE_ADDR,
  218. .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  219. .boot_params = PHYS_OFFSET + 0x100,
  220. .map_io = mxc_map_io,
  221. .init_irq = mxc_init_irq,
  222. .init_machine = mxc_board_init,
  223. .timer = &pcm037_timer,
  224. MACHINE_END