board-perseus2.c 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /*
  2. * linux/arch/arm/mach-omap1/board-perseus2.c
  3. *
  4. * Modified from board-generic.c
  5. *
  6. * Original OMAP730 support by Jean Pihet <j-pihet@ti.com>
  7. * Updated for 2.6 by Kevin Hilman <kjh@hilman.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/delay.h>
  17. #include <linux/mtd/mtd.h>
  18. #include <linux/mtd/nand.h>
  19. #include <linux/mtd/partitions.h>
  20. #include <linux/input.h>
  21. #include <asm/hardware.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/flash.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/arch/tc.h>
  27. #include <asm/arch/gpio.h>
  28. #include <asm/arch/mux.h>
  29. #include <asm/arch/fpga.h>
  30. #include <asm/arch/keypad.h>
  31. #include <asm/arch/common.h>
  32. #include <asm/arch/board.h>
  33. static int p2_keymap[] = {
  34. KEY(0,0,KEY_UP),
  35. KEY(0,1,KEY_RIGHT),
  36. KEY(0,2,KEY_LEFT),
  37. KEY(0,3,KEY_DOWN),
  38. KEY(0,4,KEY_ENTER),
  39. KEY(1,0,KEY_F10),
  40. KEY(1,1,KEY_SEND),
  41. KEY(1,2,KEY_END),
  42. KEY(1,3,KEY_VOLUMEDOWN),
  43. KEY(1,4,KEY_VOLUMEUP),
  44. KEY(1,5,KEY_RECORD),
  45. KEY(2,0,KEY_F9),
  46. KEY(2,1,KEY_3),
  47. KEY(2,2,KEY_6),
  48. KEY(2,3,KEY_9),
  49. KEY(2,4,KEY_KPDOT),
  50. KEY(3,0,KEY_BACK),
  51. KEY(3,1,KEY_2),
  52. KEY(3,2,KEY_5),
  53. KEY(3,3,KEY_8),
  54. KEY(3,4,KEY_0),
  55. KEY(3,5,KEY_KPSLASH),
  56. KEY(4,0,KEY_HOME),
  57. KEY(4,1,KEY_1),
  58. KEY(4,2,KEY_4),
  59. KEY(4,3,KEY_7),
  60. KEY(4,4,KEY_KPASTERISK),
  61. KEY(4,5,KEY_POWER),
  62. 0
  63. };
  64. static struct resource smc91x_resources[] = {
  65. [0] = {
  66. .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
  67. .end = H2P2_DBG_FPGA_ETHR_START + 0xf,
  68. .flags = IORESOURCE_MEM,
  69. },
  70. [1] = {
  71. .start = INT_730_MPU_EXT_NIRQ,
  72. .end = 0,
  73. .flags = IORESOURCE_IRQ,
  74. },
  75. };
  76. static struct mtd_partition nor_partitions[] = {
  77. /* bootloader (U-Boot, etc) in first sector */
  78. {
  79. .name = "bootloader",
  80. .offset = 0,
  81. .size = SZ_128K,
  82. .mask_flags = MTD_WRITEABLE, /* force read-only */
  83. },
  84. /* bootloader params in the next sector */
  85. {
  86. .name = "params",
  87. .offset = MTDPART_OFS_APPEND,
  88. .size = SZ_128K,
  89. .mask_flags = 0,
  90. },
  91. /* kernel */
  92. {
  93. .name = "kernel",
  94. .offset = MTDPART_OFS_APPEND,
  95. .size = SZ_2M,
  96. .mask_flags = 0
  97. },
  98. /* rest of flash is a file system */
  99. {
  100. .name = "rootfs",
  101. .offset = MTDPART_OFS_APPEND,
  102. .size = MTDPART_SIZ_FULL,
  103. .mask_flags = 0
  104. },
  105. };
  106. static struct flash_platform_data nor_data = {
  107. .map_name = "cfi_probe",
  108. .width = 2,
  109. .parts = nor_partitions,
  110. .nr_parts = ARRAY_SIZE(nor_partitions),
  111. };
  112. static struct resource nor_resource = {
  113. .start = OMAP_CS0_PHYS,
  114. .end = OMAP_CS0_PHYS + SZ_32M - 1,
  115. .flags = IORESOURCE_MEM,
  116. };
  117. static struct platform_device nor_device = {
  118. .name = "omapflash",
  119. .id = 0,
  120. .dev = {
  121. .platform_data = &nor_data,
  122. },
  123. .num_resources = 1,
  124. .resource = &nor_resource,
  125. };
  126. static struct nand_platform_data nand_data = {
  127. .options = NAND_SAMSUNG_LP_OPTIONS,
  128. };
  129. static struct resource nand_resource = {
  130. .start = OMAP_CS3_PHYS,
  131. .end = OMAP_CS3_PHYS + SZ_4K - 1,
  132. .flags = IORESOURCE_MEM,
  133. };
  134. static struct platform_device nand_device = {
  135. .name = "omapnand",
  136. .id = 0,
  137. .dev = {
  138. .platform_data = &nand_data,
  139. },
  140. .num_resources = 1,
  141. .resource = &nand_resource,
  142. };
  143. static struct platform_device smc91x_device = {
  144. .name = "smc91x",
  145. .id = 0,
  146. .num_resources = ARRAY_SIZE(smc91x_resources),
  147. .resource = smc91x_resources,
  148. };
  149. static struct resource kp_resources[] = {
  150. [0] = {
  151. .start = INT_730_MPUIO_KEYPAD,
  152. .end = INT_730_MPUIO_KEYPAD,
  153. .flags = IORESOURCE_IRQ,
  154. },
  155. };
  156. static struct omap_kp_platform_data kp_data = {
  157. .rows = 8,
  158. .cols = 8,
  159. .keymap = p2_keymap,
  160. .keymapsize = ARRAY_SIZE(p2_keymap),
  161. .delay = 4,
  162. .dbounce = 1,
  163. };
  164. static struct platform_device kp_device = {
  165. .name = "omap-keypad",
  166. .id = -1,
  167. .dev = {
  168. .platform_data = &kp_data,
  169. },
  170. .num_resources = ARRAY_SIZE(kp_resources),
  171. .resource = kp_resources,
  172. };
  173. static struct platform_device lcd_device = {
  174. .name = "lcd_p2",
  175. .id = -1,
  176. };
  177. static struct platform_device *devices[] __initdata = {
  178. &nor_device,
  179. &nand_device,
  180. &smc91x_device,
  181. &kp_device,
  182. &lcd_device,
  183. };
  184. #define P2_NAND_RB_GPIO_PIN 62
  185. static int nand_dev_ready(struct nand_platform_data *data)
  186. {
  187. return omap_get_gpio_datain(P2_NAND_RB_GPIO_PIN);
  188. }
  189. static struct omap_uart_config perseus2_uart_config __initdata = {
  190. .enabled_uarts = ((1 << 0) | (1 << 1)),
  191. };
  192. static struct omap_lcd_config perseus2_lcd_config __initdata = {
  193. .ctrl_name = "internal",
  194. };
  195. static struct omap_board_config_kernel perseus2_config[] = {
  196. { OMAP_TAG_UART, &perseus2_uart_config },
  197. { OMAP_TAG_LCD, &perseus2_lcd_config },
  198. };
  199. static void __init omap_perseus2_init(void)
  200. {
  201. if (!(omap_request_gpio(P2_NAND_RB_GPIO_PIN)))
  202. nand_data.dev_ready = nand_dev_ready;
  203. omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
  204. omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
  205. platform_add_devices(devices, ARRAY_SIZE(devices));
  206. omap_board_config = perseus2_config;
  207. omap_board_config_size = ARRAY_SIZE(perseus2_config);
  208. omap_serial_init();
  209. }
  210. static void __init perseus2_init_smc91x(void)
  211. {
  212. fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
  213. mdelay(50);
  214. fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
  215. H2P2_DBG_FPGA_LAN_RESET);
  216. mdelay(50);
  217. }
  218. static void __init omap_perseus2_init_irq(void)
  219. {
  220. omap1_init_common_hw();
  221. omap_init_irq();
  222. omap_gpio_init();
  223. perseus2_init_smc91x();
  224. }
  225. /* Only FPGA needs to be mapped here. All others are done with ioremap */
  226. static struct map_desc omap_perseus2_io_desc[] __initdata = {
  227. {
  228. .virtual = H2P2_DBG_FPGA_BASE,
  229. .pfn = __phys_to_pfn(H2P2_DBG_FPGA_START),
  230. .length = H2P2_DBG_FPGA_SIZE,
  231. .type = MT_DEVICE
  232. }
  233. };
  234. static void __init omap_perseus2_map_io(void)
  235. {
  236. omap1_map_common_io();
  237. iotable_init(omap_perseus2_io_desc,
  238. ARRAY_SIZE(omap_perseus2_io_desc));
  239. /* Early, board-dependent init */
  240. /*
  241. * Hold GSM Reset until needed
  242. */
  243. omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
  244. /*
  245. * UARTs -> done automagically by 8250 driver
  246. */
  247. /*
  248. * CSx timings, GPIO Mux ... setup
  249. */
  250. /* Flash: CS0 timings setup */
  251. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
  252. omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
  253. /*
  254. * Ethernet support through the debug board
  255. * CS1 timings setup
  256. */
  257. omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
  258. omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
  259. /*
  260. * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
  261. * It is used as the Ethernet controller interrupt
  262. */
  263. omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
  264. }
  265. MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
  266. /* Maintainer: Kevin Hilman <kjh@hilman.org> */
  267. .phys_io = 0xfff00000,
  268. .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
  269. .boot_params = 0x10000100,
  270. .map_io = omap_perseus2_map_io,
  271. .init_irq = omap_perseus2_init_irq,
  272. .init_machine = omap_perseus2_init,
  273. .timer = &omap_timer,
  274. MACHINE_END