ixdp425-setup.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /*
  2. * arch/arm/mach-ixp4xx/ixdp425-setup.c
  3. *
  4. * IXDP425/IXCDP1100 board-setup
  5. *
  6. * Copyright (C) 2003-2005 MontaVista Software, Inc.
  7. *
  8. * Author: Deepak Saxena <dsaxena@plexity.net>
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/device.h>
  13. #include <linux/serial.h>
  14. #include <linux/tty.h>
  15. #include <linux/serial_8250.h>
  16. #include <linux/slab.h>
  17. #include <linux/i2c-gpio.h>
  18. #include <linux/io.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/nand.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/delay.h>
  23. #include <asm/types.h>
  24. #include <asm/setup.h>
  25. #include <asm/memory.h>
  26. #include <mach/hardware.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/irq.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/flash.h>
  31. static struct flash_platform_data ixdp425_flash_data = {
  32. .map_name = "cfi_probe",
  33. .width = 2,
  34. };
  35. static struct resource ixdp425_flash_resource = {
  36. .flags = IORESOURCE_MEM,
  37. };
  38. static struct platform_device ixdp425_flash = {
  39. .name = "IXP4XX-Flash",
  40. .id = 0,
  41. .dev = {
  42. .platform_data = &ixdp425_flash_data,
  43. },
  44. .num_resources = 1,
  45. .resource = &ixdp425_flash_resource,
  46. };
  47. #if defined(CONFIG_MTD_NAND_PLATFORM) || \
  48. defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  49. #ifdef CONFIG_MTD_PARTITIONS
  50. const char *part_probes[] = { "cmdlinepart", NULL };
  51. static struct mtd_partition ixdp425_partitions[] = {
  52. {
  53. .name = "ixp400 NAND FS 0",
  54. .offset = 0,
  55. .size = SZ_8M
  56. }, {
  57. .name = "ixp400 NAND FS 1",
  58. .offset = MTDPART_OFS_APPEND,
  59. .size = MTDPART_SIZ_FULL
  60. },
  61. };
  62. #endif
  63. static void
  64. ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
  65. {
  66. struct nand_chip *this = mtd->priv;
  67. int offset = (int)this->priv;
  68. if (ctrl & NAND_CTRL_CHANGE) {
  69. if (ctrl & NAND_NCE) {
  70. gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW);
  71. udelay(5);
  72. } else
  73. gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH);
  74. offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;
  75. offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;
  76. this->priv = (void *)offset;
  77. }
  78. if (cmd != NAND_CMD_NONE)
  79. writeb(cmd, this->IO_ADDR_W + offset);
  80. }
  81. static struct platform_nand_data ixdp425_flash_nand_data = {
  82. .chip = {
  83. .chip_delay = 30,
  84. .options = NAND_NO_AUTOINCR,
  85. #ifdef CONFIG_MTD_PARTITIONS
  86. .part_probe_types = part_probes,
  87. .partitions = ixdp425_partitions,
  88. .nr_partitions = ARRAY_SIZE(ixdp425_partitions),
  89. #endif
  90. },
  91. .ctrl = {
  92. .cmd_ctrl = ixdp425_flash_nand_cmd_ctrl
  93. }
  94. };
  95. static struct resource ixdp425_flash_nand_resource = {
  96. .flags = IORESOURCE_MEM,
  97. };
  98. static struct platform_device ixdp425_flash_nand = {
  99. .name = "gen_nand",
  100. .id = -1,
  101. .dev = {
  102. .platform_data = &ixdp425_flash_nand_data,
  103. },
  104. .num_resources = 1,
  105. .resource = &ixdp425_flash_nand_resource,
  106. };
  107. #endif /* CONFIG_MTD_NAND_PLATFORM */
  108. static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = {
  109. .sda_pin = IXDP425_SDA_PIN,
  110. .scl_pin = IXDP425_SCL_PIN,
  111. };
  112. static struct platform_device ixdp425_i2c_gpio = {
  113. .name = "i2c-gpio",
  114. .id = 0,
  115. .dev = {
  116. .platform_data = &ixdp425_i2c_gpio_data,
  117. },
  118. };
  119. static struct resource ixdp425_uart_resources[] = {
  120. {
  121. .start = IXP4XX_UART1_BASE_PHYS,
  122. .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
  123. .flags = IORESOURCE_MEM
  124. },
  125. {
  126. .start = IXP4XX_UART2_BASE_PHYS,
  127. .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
  128. .flags = IORESOURCE_MEM
  129. }
  130. };
  131. static struct plat_serial8250_port ixdp425_uart_data[] = {
  132. {
  133. .mapbase = IXP4XX_UART1_BASE_PHYS,
  134. .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
  135. .irq = IRQ_IXP4XX_UART1,
  136. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  137. .iotype = UPIO_MEM,
  138. .regshift = 2,
  139. .uartclk = IXP4XX_UART_XTAL,
  140. },
  141. {
  142. .mapbase = IXP4XX_UART2_BASE_PHYS,
  143. .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
  144. .irq = IRQ_IXP4XX_UART2,
  145. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  146. .iotype = UPIO_MEM,
  147. .regshift = 2,
  148. .uartclk = IXP4XX_UART_XTAL,
  149. },
  150. { },
  151. };
  152. static struct platform_device ixdp425_uart = {
  153. .name = "serial8250",
  154. .id = PLAT8250_DEV_PLATFORM,
  155. .dev.platform_data = ixdp425_uart_data,
  156. .num_resources = 2,
  157. .resource = ixdp425_uart_resources
  158. };
  159. /* Built-in 10/100 Ethernet MAC interfaces */
  160. static struct eth_plat_info ixdp425_plat_eth[] = {
  161. {
  162. .phy = 0,
  163. .rxq = 3,
  164. .txreadyq = 20,
  165. }, {
  166. .phy = 1,
  167. .rxq = 4,
  168. .txreadyq = 21,
  169. }
  170. };
  171. static struct platform_device ixdp425_eth[] = {
  172. {
  173. .name = "ixp4xx_eth",
  174. .id = IXP4XX_ETH_NPEB,
  175. .dev.platform_data = ixdp425_plat_eth,
  176. }, {
  177. .name = "ixp4xx_eth",
  178. .id = IXP4XX_ETH_NPEC,
  179. .dev.platform_data = ixdp425_plat_eth + 1,
  180. }
  181. };
  182. static struct platform_device *ixdp425_devices[] __initdata = {
  183. &ixdp425_i2c_gpio,
  184. &ixdp425_flash,
  185. #if defined(CONFIG_MTD_NAND_PLATFORM) || \
  186. defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  187. &ixdp425_flash_nand,
  188. #endif
  189. &ixdp425_uart,
  190. &ixdp425_eth[0],
  191. &ixdp425_eth[1],
  192. };
  193. static void __init ixdp425_init(void)
  194. {
  195. ixp4xx_sys_init();
  196. ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
  197. ixdp425_flash_resource.end =
  198. IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
  199. #if defined(CONFIG_MTD_NAND_PLATFORM) || \
  200. defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
  201. ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),
  202. ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;
  203. gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT);
  204. /* Configure expansion bus for NAND Flash */
  205. *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
  206. IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */
  207. IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */
  208. IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/
  209. IXP4XX_EXP_BUS_WR_EN |
  210. IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */
  211. #endif
  212. if (cpu_is_ixp43x()) {
  213. ixdp425_uart.num_resources = 1;
  214. ixdp425_uart_data[1].flags = 0;
  215. }
  216. platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
  217. }
  218. #ifdef CONFIG_ARCH_IXDP425
  219. MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
  220. /* Maintainer: MontaVista Software, Inc. */
  221. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  222. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  223. .map_io = ixp4xx_map_io,
  224. .init_irq = ixp4xx_init_irq,
  225. .timer = &ixp4xx_timer,
  226. .boot_params = 0x0100,
  227. .init_machine = ixdp425_init,
  228. MACHINE_END
  229. #endif
  230. #ifdef CONFIG_MACH_IXDP465
  231. MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
  232. /* Maintainer: MontaVista Software, Inc. */
  233. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  234. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  235. .map_io = ixp4xx_map_io,
  236. .init_irq = ixp4xx_init_irq,
  237. .timer = &ixp4xx_timer,
  238. .boot_params = 0x0100,
  239. .init_machine = ixdp425_init,
  240. MACHINE_END
  241. #endif
  242. #ifdef CONFIG_ARCH_PRPMC1100
  243. MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
  244. /* Maintainer: MontaVista Software, Inc. */
  245. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  246. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  247. .map_io = ixp4xx_map_io,
  248. .init_irq = ixp4xx_init_irq,
  249. .timer = &ixp4xx_timer,
  250. .boot_params = 0x0100,
  251. .init_machine = ixdp425_init,
  252. MACHINE_END
  253. #endif
  254. #ifdef CONFIG_MACH_KIXRP435
  255. MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
  256. /* Maintainer: MontaVista Software, Inc. */
  257. .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
  258. .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
  259. .map_io = ixp4xx_map_io,
  260. .init_irq = ixp4xx_init_irq,
  261. .timer = &ixp4xx_timer,
  262. .boot_params = 0x0100,
  263. .init_machine = ixdp425_init,
  264. MACHINE_END
  265. #endif