littleton.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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/spi/pxa2xx_spi.h>
  25. #include <linux/smc91x.h>
  26. #include <linux/i2c.h>
  27. #include <linux/leds.h>
  28. #include <linux/mfd/da903x.h>
  29. #include <linux/i2c/max732x.h>
  30. #include <linux/i2c/pxa-i2c.h>
  31. #include <asm/types.h>
  32. #include <asm/setup.h>
  33. #include <asm/memory.h>
  34. #include <asm/mach-types.h>
  35. #include <mach/hardware.h>
  36. #include <asm/irq.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/irq.h>
  40. #include "pxa300.h"
  41. #include <linux/platform_data/video-pxafb.h>
  42. #include <linux/platform_data/mmc-pxamci.h>
  43. #include <linux/platform_data/keypad-pxa27x.h>
  44. #include "littleton.h"
  45. #include <linux/platform_data/mtd-nand-pxa3xx.h>
  46. #include "generic.h"
  47. #define GPIO_MMC1_CARD_DETECT mfp_to_gpio(MFP_PIN_GPIO15)
  48. /* Littleton MFP configurations */
  49. static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
  50. /* LCD */
  51. GPIO54_LCD_LDD_0,
  52. GPIO55_LCD_LDD_1,
  53. GPIO56_LCD_LDD_2,
  54. GPIO57_LCD_LDD_3,
  55. GPIO58_LCD_LDD_4,
  56. GPIO59_LCD_LDD_5,
  57. GPIO60_LCD_LDD_6,
  58. GPIO61_LCD_LDD_7,
  59. GPIO62_LCD_LDD_8,
  60. GPIO63_LCD_LDD_9,
  61. GPIO64_LCD_LDD_10,
  62. GPIO65_LCD_LDD_11,
  63. GPIO66_LCD_LDD_12,
  64. GPIO67_LCD_LDD_13,
  65. GPIO68_LCD_LDD_14,
  66. GPIO69_LCD_LDD_15,
  67. GPIO70_LCD_LDD_16,
  68. GPIO71_LCD_LDD_17,
  69. GPIO72_LCD_FCLK,
  70. GPIO73_LCD_LCLK,
  71. GPIO74_LCD_PCLK,
  72. GPIO75_LCD_BIAS,
  73. /* SSP2 */
  74. GPIO25_SSP2_SCLK,
  75. GPIO27_SSP2_TXD,
  76. GPIO17_GPIO, /* SFRM as chip-select */
  77. /* Debug Ethernet */
  78. GPIO90_GPIO,
  79. /* Keypad */
  80. GPIO107_KP_DKIN_0,
  81. GPIO108_KP_DKIN_1,
  82. GPIO115_KP_MKIN_0,
  83. GPIO116_KP_MKIN_1,
  84. GPIO117_KP_MKIN_2,
  85. GPIO118_KP_MKIN_3,
  86. GPIO119_KP_MKIN_4,
  87. GPIO120_KP_MKIN_5,
  88. GPIO121_KP_MKOUT_0,
  89. GPIO122_KP_MKOUT_1,
  90. GPIO123_KP_MKOUT_2,
  91. GPIO124_KP_MKOUT_3,
  92. GPIO125_KP_MKOUT_4,
  93. /* MMC1 */
  94. GPIO3_MMC1_DAT0,
  95. GPIO4_MMC1_DAT1,
  96. GPIO5_MMC1_DAT2,
  97. GPIO6_MMC1_DAT3,
  98. GPIO7_MMC1_CLK,
  99. GPIO8_MMC1_CMD,
  100. GPIO15_GPIO, /* card detect */
  101. /* UART3 */
  102. GPIO107_UART3_CTS,
  103. GPIO108_UART3_RTS,
  104. GPIO109_UART3_TXD,
  105. GPIO110_UART3_RXD,
  106. };
  107. static struct resource smc91x_resources[] = {
  108. [0] = {
  109. .start = (LITTLETON_ETH_PHYS + 0x300),
  110. .end = (LITTLETON_ETH_PHYS + 0xfffff),
  111. .flags = IORESOURCE_MEM,
  112. },
  113. [1] = {
  114. .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
  115. .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
  116. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  117. }
  118. };
  119. static struct smc91x_platdata littleton_smc91x_info = {
  120. .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
  121. SMC91X_NOWAIT | SMC91X_USE_DMA,
  122. };
  123. static struct platform_device smc91x_device = {
  124. .name = "smc91x",
  125. .id = 0,
  126. .num_resources = ARRAY_SIZE(smc91x_resources),
  127. .resource = smc91x_resources,
  128. .dev = {
  129. .platform_data = &littleton_smc91x_info,
  130. },
  131. };
  132. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  133. static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
  134. [0] = {
  135. /* VGA */
  136. .pixclock = 38250,
  137. .xres = 480,
  138. .yres = 640,
  139. .bpp = 16,
  140. .hsync_len = 8,
  141. .left_margin = 8,
  142. .right_margin = 24,
  143. .vsync_len = 2,
  144. .upper_margin = 2,
  145. .lower_margin = 4,
  146. .sync = 0,
  147. },
  148. [1] = {
  149. /* QVGA */
  150. .pixclock = 153000,
  151. .xres = 240,
  152. .yres = 320,
  153. .bpp = 16,
  154. .hsync_len = 8,
  155. .left_margin = 8,
  156. .right_margin = 88,
  157. .vsync_len = 2,
  158. .upper_margin = 2,
  159. .lower_margin = 2,
  160. .sync = 0,
  161. },
  162. };
  163. static struct pxafb_mach_info littleton_lcd_info = {
  164. .modes = tpo_tdo24mtea1_modes,
  165. .num_modes = 2,
  166. .lcd_conn = LCD_COLOR_TFT_16BPP,
  167. };
  168. static void littleton_init_lcd(void)
  169. {
  170. pxa_set_fb_info(NULL, &littleton_lcd_info);
  171. }
  172. #else
  173. static inline void littleton_init_lcd(void) {};
  174. #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
  175. #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
  176. static struct pxa2xx_spi_master littleton_spi_info = {
  177. .num_chipselect = 1,
  178. };
  179. static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
  180. .rx_threshold = 1,
  181. .tx_threshold = 1,
  182. .gpio_cs = LITTLETON_GPIO_LCD_CS,
  183. };
  184. static struct spi_board_info littleton_spi_devices[] __initdata = {
  185. {
  186. .modalias = "tdo24m",
  187. .max_speed_hz = 1000000,
  188. .bus_num = 2,
  189. .chip_select = 0,
  190. .controller_data= &littleton_tdo24m_chip,
  191. },
  192. };
  193. static void __init littleton_init_spi(void)
  194. {
  195. pxa2xx_set_spi_info(2, &littleton_spi_info);
  196. spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
  197. }
  198. #else
  199. static inline void littleton_init_spi(void) {}
  200. #endif
  201. #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
  202. static const unsigned int littleton_matrix_key_map[] = {
  203. /* KEY(row, col, key_code) */
  204. KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
  205. KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
  206. KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
  207. KEY(0, 3, KEY_KPASTERISK), /* * */
  208. KEY(2, 3, KEY_KPDOT), /* # */
  209. KEY(5, 4, KEY_ENTER),
  210. KEY(5, 0, KEY_UP),
  211. KEY(5, 1, KEY_DOWN),
  212. KEY(5, 2, KEY_LEFT),
  213. KEY(5, 3, KEY_RIGHT),
  214. KEY(3, 2, KEY_HOME),
  215. KEY(4, 1, KEY_END),
  216. KEY(3, 3, KEY_BACK),
  217. KEY(4, 0, KEY_SEND),
  218. KEY(4, 2, KEY_VOLUMEUP),
  219. KEY(4, 3, KEY_VOLUMEDOWN),
  220. KEY(3, 0, KEY_F22), /* soft1 */
  221. KEY(3, 1, KEY_F23), /* soft2 */
  222. };
  223. static struct matrix_keymap_data littleton_matrix_keymap_data = {
  224. .keymap = littleton_matrix_key_map,
  225. .keymap_size = ARRAY_SIZE(littleton_matrix_key_map),
  226. };
  227. static struct pxa27x_keypad_platform_data littleton_keypad_info = {
  228. .matrix_key_rows = 6,
  229. .matrix_key_cols = 5,
  230. .matrix_keymap_data = &littleton_matrix_keymap_data,
  231. .enable_rotary0 = 1,
  232. .rotary0_up_key = KEY_UP,
  233. .rotary0_down_key = KEY_DOWN,
  234. .debounce_interval = 30,
  235. };
  236. static void __init littleton_init_keypad(void)
  237. {
  238. pxa_set_keypad_info(&littleton_keypad_info);
  239. }
  240. #else
  241. static inline void littleton_init_keypad(void) {}
  242. #endif
  243. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  244. static struct pxamci_platform_data littleton_mci_platform_data = {
  245. .detect_delay_ms = 200,
  246. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  247. .gpio_card_detect = GPIO_MMC1_CARD_DETECT,
  248. .gpio_card_ro = -1,
  249. .gpio_power = -1,
  250. };
  251. static void __init littleton_init_mmc(void)
  252. {
  253. pxa_set_mci_info(&littleton_mci_platform_data);
  254. }
  255. #else
  256. static inline void littleton_init_mmc(void) {}
  257. #endif
  258. #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
  259. static struct mtd_partition littleton_nand_partitions[] = {
  260. [0] = {
  261. .name = "Bootloader",
  262. .offset = 0,
  263. .size = 0x060000,
  264. .mask_flags = MTD_WRITEABLE, /* force read-only */
  265. },
  266. [1] = {
  267. .name = "Kernel",
  268. .offset = 0x060000,
  269. .size = 0x200000,
  270. .mask_flags = MTD_WRITEABLE, /* force read-only */
  271. },
  272. [2] = {
  273. .name = "Filesystem",
  274. .offset = 0x0260000,
  275. .size = 0x3000000, /* 48M - rootfs */
  276. },
  277. [3] = {
  278. .name = "MassStorage",
  279. .offset = 0x3260000,
  280. .size = 0x3d40000,
  281. },
  282. [4] = {
  283. .name = "BBT",
  284. .offset = 0x6FA0000,
  285. .size = 0x80000,
  286. .mask_flags = MTD_WRITEABLE, /* force read-only */
  287. },
  288. /* NOTE: we reserve some blocks at the end of the NAND flash for
  289. * bad block management, and the max number of relocation blocks
  290. * differs on different platforms. Please take care with it when
  291. * defining the partition table.
  292. */
  293. };
  294. static struct pxa3xx_nand_platform_data littleton_nand_info = {
  295. .enable_arbiter = 1,
  296. .num_cs = 1,
  297. .parts[0] = littleton_nand_partitions,
  298. .nr_parts[0] = ARRAY_SIZE(littleton_nand_partitions),
  299. };
  300. static void __init littleton_init_nand(void)
  301. {
  302. pxa3xx_set_nand_info(&littleton_nand_info);
  303. }
  304. #else
  305. static inline void littleton_init_nand(void) {}
  306. #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
  307. #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
  308. static struct led_info littleton_da9034_leds[] = {
  309. [0] = {
  310. .name = "littleton:keypad1",
  311. .flags = DA9034_LED_RAMP,
  312. },
  313. [1] = {
  314. .name = "littleton:keypad2",
  315. .flags = DA9034_LED_RAMP,
  316. },
  317. [2] = {
  318. .name = "littleton:vibra",
  319. .flags = 0,
  320. },
  321. };
  322. static struct da9034_touch_pdata littleton_da9034_touch = {
  323. .x_inverted = 1,
  324. .interval_ms = 20,
  325. };
  326. static struct da903x_subdev_info littleton_da9034_subdevs[] = {
  327. {
  328. .name = "da903x-led",
  329. .id = DA9034_ID_LED_1,
  330. .platform_data = &littleton_da9034_leds[0],
  331. }, {
  332. .name = "da903x-led",
  333. .id = DA9034_ID_LED_2,
  334. .platform_data = &littleton_da9034_leds[1],
  335. }, {
  336. .name = "da903x-led",
  337. .id = DA9034_ID_VIBRA,
  338. .platform_data = &littleton_da9034_leds[2],
  339. }, {
  340. .name = "da903x-backlight",
  341. .id = DA9034_ID_WLED,
  342. }, {
  343. .name = "da9034-touch",
  344. .id = DA9034_ID_TOUCH,
  345. .platform_data = &littleton_da9034_touch,
  346. },
  347. };
  348. static struct da903x_platform_data littleton_da9034_info = {
  349. .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
  350. .subdevs = littleton_da9034_subdevs,
  351. };
  352. static struct max732x_platform_data littleton_max7320_info = {
  353. .gpio_base = EXT0_GPIO_BASE,
  354. };
  355. static struct i2c_board_info littleton_i2c_info[] = {
  356. [0] = {
  357. .type = "da9034",
  358. .addr = 0x34,
  359. .platform_data = &littleton_da9034_info,
  360. .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
  361. },
  362. [1] = {
  363. .type = "max7320",
  364. .addr = 0x50,
  365. .platform_data = &littleton_max7320_info,
  366. },
  367. };
  368. static void __init littleton_init_i2c(void)
  369. {
  370. pxa_set_i2c_info(NULL);
  371. i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
  372. }
  373. #else
  374. static inline void littleton_init_i2c(void) {}
  375. #endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
  376. static void __init littleton_init(void)
  377. {
  378. /* initialize MFP configurations */
  379. pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
  380. pxa_set_ffuart_info(NULL);
  381. pxa_set_btuart_info(NULL);
  382. pxa_set_stuart_info(NULL);
  383. /*
  384. * Note: we depend bootloader set the correct
  385. * value to MSC register for SMC91x.
  386. */
  387. platform_device_register(&smc91x_device);
  388. littleton_init_spi();
  389. littleton_init_i2c();
  390. littleton_init_mmc();
  391. littleton_init_lcd();
  392. littleton_init_keypad();
  393. littleton_init_nand();
  394. }
  395. MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
  396. .atag_offset = 0x100,
  397. .map_io = pxa3xx_map_io,
  398. .nr_irqs = LITTLETON_NR_IRQS,
  399. .init_irq = pxa3xx_init_irq,
  400. .handle_irq = pxa3xx_handle_irq,
  401. .init_time = pxa_timer_init,
  402. .init_machine = littleton_init,
  403. .restart = pxa_restart,
  404. MACHINE_END