littleton.c 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*
  2. * linux/arch/arm/mach-pxa/littleton.c
  3. *
  4. * Support for the Marvell Littleton Development Platform.
  5. *
  6. * Author: Jason Chagas (largely modified code)
  7. * Created: Nov 20, 2006
  8. * Copyright: (C) Copyright 2006 Marvell International Ltd.
  9. *
  10. * 2007-11-22 modified to align with latest kernel
  11. * eric miao <eric.miao@marvell.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * publishhed by the Free Software Foundation.
  16. */
  17. #include <linux/init.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/delay.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/clk.h>
  22. #include <linux/gpio.h>
  23. #include <linux/spi/spi.h>
  24. #include <linux/smc91x.h>
  25. #include <linux/i2c.h>
  26. #include <linux/leds.h>
  27. #include <linux/mfd/da903x.h>
  28. #include <linux/i2c/max732x.h>
  29. #include <asm/types.h>
  30. #include <asm/setup.h>
  31. #include <asm/memory.h>
  32. #include <asm/mach-types.h>
  33. #include <mach/hardware.h>
  34. #include <asm/irq.h>
  35. #include <asm/mach/arch.h>
  36. #include <asm/mach/map.h>
  37. #include <asm/mach/irq.h>
  38. #include <mach/pxa300.h>
  39. #include <mach/pxafb.h>
  40. #include <mach/ssp.h>
  41. #include <mach/pxa2xx_spi.h>
  42. #include <plat/i2c.h>
  43. #include <mach/pxa27x_keypad.h>
  44. #include <mach/pxa3xx_nand.h>
  45. #include <mach/littleton.h>
  46. #include "generic.h"
  47. /* Littleton MFP configurations */
  48. static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
  49. /* LCD */
  50. GPIO54_LCD_LDD_0,
  51. GPIO55_LCD_LDD_1,
  52. GPIO56_LCD_LDD_2,
  53. GPIO57_LCD_LDD_3,
  54. GPIO58_LCD_LDD_4,
  55. GPIO59_LCD_LDD_5,
  56. GPIO60_LCD_LDD_6,
  57. GPIO61_LCD_LDD_7,
  58. GPIO62_LCD_LDD_8,
  59. GPIO63_LCD_LDD_9,
  60. GPIO64_LCD_LDD_10,
  61. GPIO65_LCD_LDD_11,
  62. GPIO66_LCD_LDD_12,
  63. GPIO67_LCD_LDD_13,
  64. GPIO68_LCD_LDD_14,
  65. GPIO69_LCD_LDD_15,
  66. GPIO70_LCD_LDD_16,
  67. GPIO71_LCD_LDD_17,
  68. GPIO72_LCD_FCLK,
  69. GPIO73_LCD_LCLK,
  70. GPIO74_LCD_PCLK,
  71. GPIO75_LCD_BIAS,
  72. /* SSP2 */
  73. GPIO25_SSP2_SCLK,
  74. GPIO27_SSP2_TXD,
  75. GPIO17_GPIO, /* SFRM as chip-select */
  76. /* Debug Ethernet */
  77. GPIO90_GPIO,
  78. /* Keypad */
  79. GPIO107_KP_DKIN_0,
  80. GPIO108_KP_DKIN_1,
  81. GPIO115_KP_MKIN_0,
  82. GPIO116_KP_MKIN_1,
  83. GPIO117_KP_MKIN_2,
  84. GPIO118_KP_MKIN_3,
  85. GPIO119_KP_MKIN_4,
  86. GPIO120_KP_MKIN_5,
  87. GPIO121_KP_MKOUT_0,
  88. GPIO122_KP_MKOUT_1,
  89. GPIO123_KP_MKOUT_2,
  90. GPIO124_KP_MKOUT_3,
  91. GPIO125_KP_MKOUT_4,
  92. };
  93. static struct resource smc91x_resources[] = {
  94. [0] = {
  95. .start = (LITTLETON_ETH_PHYS + 0x300),
  96. .end = (LITTLETON_ETH_PHYS + 0xfffff),
  97. .flags = IORESOURCE_MEM,
  98. },
  99. [1] = {
  100. .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
  101. .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
  102. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  103. }
  104. };
  105. static struct smc91x_platdata littleton_smc91x_info = {
  106. .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
  107. SMC91X_NOWAIT | SMC91X_USE_DMA,
  108. };
  109. static struct platform_device smc91x_device = {
  110. .name = "smc91x",
  111. .id = 0,
  112. .num_resources = ARRAY_SIZE(smc91x_resources),
  113. .resource = smc91x_resources,
  114. .dev = {
  115. .platform_data = &littleton_smc91x_info,
  116. },
  117. };
  118. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  119. static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
  120. [0] = {
  121. /* VGA */
  122. .pixclock = 38250,
  123. .xres = 480,
  124. .yres = 640,
  125. .bpp = 16,
  126. .hsync_len = 8,
  127. .left_margin = 8,
  128. .right_margin = 24,
  129. .vsync_len = 2,
  130. .upper_margin = 2,
  131. .lower_margin = 4,
  132. .sync = 0,
  133. },
  134. [1] = {
  135. /* QVGA */
  136. .pixclock = 153000,
  137. .xres = 240,
  138. .yres = 320,
  139. .bpp = 16,
  140. .hsync_len = 8,
  141. .left_margin = 8,
  142. .right_margin = 88,
  143. .vsync_len = 2,
  144. .upper_margin = 2,
  145. .lower_margin = 2,
  146. .sync = 0,
  147. },
  148. };
  149. static struct pxafb_mach_info littleton_lcd_info = {
  150. .modes = tpo_tdo24mtea1_modes,
  151. .num_modes = 2,
  152. .lcd_conn = LCD_COLOR_TFT_16BPP,
  153. };
  154. static void littleton_init_lcd(void)
  155. {
  156. set_pxa_fb_info(&littleton_lcd_info);
  157. }
  158. #else
  159. static inline void littleton_init_lcd(void) {};
  160. #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
  161. #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
  162. static struct pxa2xx_spi_master littleton_spi_info = {
  163. .num_chipselect = 1,
  164. };
  165. static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
  166. .rx_threshold = 1,
  167. .tx_threshold = 1,
  168. .gpio_cs = LITTLETON_GPIO_LCD_CS,
  169. };
  170. static struct spi_board_info littleton_spi_devices[] __initdata = {
  171. {
  172. .modalias = "tdo24m",
  173. .max_speed_hz = 1000000,
  174. .bus_num = 2,
  175. .chip_select = 0,
  176. .controller_data= &littleton_tdo24m_chip,
  177. },
  178. };
  179. static void __init littleton_init_spi(void)
  180. {
  181. pxa2xx_set_spi_info(2, &littleton_spi_info);
  182. spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
  183. }
  184. #else
  185. static inline void littleton_init_spi(void) {}
  186. #endif
  187. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  188. static unsigned int littleton_matrix_key_map[] = {
  189. /* KEY(row, col, key_code) */
  190. KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
  191. KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
  192. KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
  193. KEY(0, 3, KEY_KPASTERISK), /* * */
  194. KEY(2, 3, KEY_KPDOT), /* # */
  195. KEY(5, 4, KEY_ENTER),
  196. KEY(5, 0, KEY_UP),
  197. KEY(5, 1, KEY_DOWN),
  198. KEY(5, 2, KEY_LEFT),
  199. KEY(5, 3, KEY_RIGHT),
  200. KEY(3, 2, KEY_HOME),
  201. KEY(4, 1, KEY_END),
  202. KEY(3, 3, KEY_BACK),
  203. KEY(4, 0, KEY_SEND),
  204. KEY(4, 2, KEY_VOLUMEUP),
  205. KEY(4, 3, KEY_VOLUMEDOWN),
  206. KEY(3, 0, KEY_F22), /* soft1 */
  207. KEY(3, 1, KEY_F23), /* soft2 */
  208. };
  209. static struct pxa27x_keypad_platform_data littleton_keypad_info = {
  210. .matrix_key_rows = 6,
  211. .matrix_key_cols = 5,
  212. .matrix_key_map = littleton_matrix_key_map,
  213. .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map),
  214. .enable_rotary0 = 1,
  215. .rotary0_up_key = KEY_UP,
  216. .rotary0_down_key = KEY_DOWN,
  217. .debounce_interval = 30,
  218. };
  219. static void __init littleton_init_keypad(void)
  220. {
  221. pxa_set_keypad_info(&littleton_keypad_info);
  222. }
  223. #else
  224. static inline void littleton_init_keypad(void) {}
  225. #endif
  226. #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
  227. static struct mtd_partition littleton_nand_partitions[] = {
  228. [0] = {
  229. .name = "Bootloader",
  230. .offset = 0,
  231. .size = 0x060000,
  232. .mask_flags = MTD_WRITEABLE, /* force read-only */
  233. },
  234. [1] = {
  235. .name = "Kernel",
  236. .offset = 0x060000,
  237. .size = 0x200000,
  238. .mask_flags = MTD_WRITEABLE, /* force read-only */
  239. },
  240. [2] = {
  241. .name = "Filesystem",
  242. .offset = 0x0260000,
  243. .size = 0x3000000, /* 48M - rootfs */
  244. },
  245. [3] = {
  246. .name = "MassStorage",
  247. .offset = 0x3260000,
  248. .size = 0x3d40000,
  249. },
  250. [4] = {
  251. .name = "BBT",
  252. .offset = 0x6FA0000,
  253. .size = 0x80000,
  254. .mask_flags = MTD_WRITEABLE, /* force read-only */
  255. },
  256. /* NOTE: we reserve some blocks at the end of the NAND flash for
  257. * bad block management, and the max number of relocation blocks
  258. * differs on different platforms. Please take care with it when
  259. * defining the partition table.
  260. */
  261. };
  262. static struct pxa3xx_nand_platform_data littleton_nand_info = {
  263. .enable_arbiter = 1,
  264. .parts = littleton_nand_partitions,
  265. .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
  266. };
  267. static void __init littleton_init_nand(void)
  268. {
  269. pxa3xx_set_nand_info(&littleton_nand_info);
  270. }
  271. #else
  272. static inline void littleton_init_nand(void) {}
  273. #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
  274. #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
  275. static struct led_info littleton_da9034_leds[] = {
  276. [0] = {
  277. .name = "littleton:keypad1",
  278. .flags = DA9034_LED_RAMP,
  279. },
  280. [1] = {
  281. .name = "littleton:keypad2",
  282. .flags = DA9034_LED_RAMP,
  283. },
  284. [2] = {
  285. .name = "littleton:vibra",
  286. .flags = 0,
  287. },
  288. };
  289. static struct da9034_touch_pdata littleton_da9034_touch = {
  290. .x_inverted = 1,
  291. .interval_ms = 20,
  292. };
  293. static struct da903x_subdev_info littleton_da9034_subdevs[] = {
  294. {
  295. .name = "da903x-led",
  296. .id = DA9034_ID_LED_1,
  297. .platform_data = &littleton_da9034_leds[0],
  298. }, {
  299. .name = "da903x-led",
  300. .id = DA9034_ID_LED_2,
  301. .platform_data = &littleton_da9034_leds[1],
  302. }, {
  303. .name = "da903x-led",
  304. .id = DA9034_ID_VIBRA,
  305. .platform_data = &littleton_da9034_leds[2],
  306. }, {
  307. .name = "da903x-backlight",
  308. .id = DA9034_ID_WLED,
  309. }, {
  310. .name = "da9034-touch",
  311. .id = DA9034_ID_TOUCH,
  312. .platform_data = &littleton_da9034_touch,
  313. },
  314. };
  315. static struct da903x_platform_data littleton_da9034_info = {
  316. .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
  317. .subdevs = littleton_da9034_subdevs,
  318. };
  319. static struct max732x_platform_data littleton_max7320_info = {
  320. .gpio_base = EXT0_GPIO_BASE,
  321. };
  322. static struct i2c_board_info littleton_i2c_info[] = {
  323. [0] = {
  324. .type = "da9034",
  325. .addr = 0x34,
  326. .platform_data = &littleton_da9034_info,
  327. .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
  328. },
  329. [1] = {
  330. .type = "max7320",
  331. .addr = 0x50,
  332. .platform_data = &littleton_max7320_info,
  333. },
  334. };
  335. static void __init littleton_init_i2c(void)
  336. {
  337. pxa_set_i2c_info(NULL);
  338. i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
  339. }
  340. #else
  341. static inline void littleton_init_i2c(void) {}
  342. #endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
  343. static void __init littleton_init(void)
  344. {
  345. /* initialize MFP configurations */
  346. pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
  347. /*
  348. * Note: we depend bootloader set the correct
  349. * value to MSC register for SMC91x.
  350. */
  351. platform_device_register(&smc91x_device);
  352. littleton_init_spi();
  353. littleton_init_i2c();
  354. littleton_init_lcd();
  355. littleton_init_keypad();
  356. littleton_init_nand();
  357. }
  358. MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
  359. .phys_io = 0x40000000,
  360. .boot_params = 0xa0000100,
  361. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  362. .map_io = pxa_map_io,
  363. .init_irq = pxa3xx_init_irq,
  364. .timer = &pxa_timer,
  365. .init_machine = littleton_init,
  366. MACHINE_END