mach-mini2440.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /* linux/arch/arm/mach-s3c2440/mach-mini2440.c
  2. *
  3. * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
  4. * Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
  5. * and modifications by SBZ <sbz@spgui.org> and
  6. * Weibing <http://weibing.blogbus.com> and
  7. * Michel Pollet <buserror@gmail.com>
  8. *
  9. * For product information, visit http://code.google.com/p/mini2440/
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <linux/timer.h>
  20. #include <linux/init.h>
  21. #include <linux/gpio.h>
  22. #include <linux/input.h>
  23. #include <linux/io.h>
  24. #include <linux/serial_core.h>
  25. #include <linux/dm9000.h>
  26. #include <linux/i2c/at24.h>
  27. #include <linux/platform_device.h>
  28. #include <linux/gpio_keys.h>
  29. #include <linux/i2c.h>
  30. #include <linux/mmc/host.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <mach/hardware.h>
  34. #include <mach/fb.h>
  35. #include <asm/mach-types.h>
  36. #include <plat/regs-serial.h>
  37. #include <mach/regs-gpio.h>
  38. #include <mach/leds-gpio.h>
  39. #include <mach/regs-mem.h>
  40. #include <mach/regs-lcd.h>
  41. #include <mach/irqs.h>
  42. #include <plat/nand.h>
  43. #include <plat/iic.h>
  44. #include <plat/mci.h>
  45. #include <plat/udc.h>
  46. #include <linux/mtd/mtd.h>
  47. #include <linux/mtd/nand.h>
  48. #include <linux/mtd/nand_ecc.h>
  49. #include <linux/mtd/partitions.h>
  50. #include <plat/clock.h>
  51. #include <plat/devs.h>
  52. #include <plat/cpu.h>
  53. #include <sound/s3c24xx_uda134x.h>
  54. #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
  55. static struct map_desc mini2440_iodesc[] __initdata = {
  56. /* nothing to declare, move along */
  57. };
  58. #define UCON S3C2410_UCON_DEFAULT
  59. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  60. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  61. static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
  62. [0] = {
  63. .hwport = 0,
  64. .flags = 0,
  65. .ucon = UCON,
  66. .ulcon = ULCON,
  67. .ufcon = UFCON,
  68. },
  69. [1] = {
  70. .hwport = 1,
  71. .flags = 0,
  72. .ucon = UCON,
  73. .ulcon = ULCON,
  74. .ufcon = UFCON,
  75. },
  76. [2] = {
  77. .hwport = 2,
  78. .flags = 0,
  79. .ucon = UCON,
  80. .ulcon = ULCON,
  81. .ufcon = UFCON,
  82. },
  83. };
  84. /* USB device UDC support */
  85. static void mini2440_udc_pullup(enum s3c2410_udc_cmd_e cmd)
  86. {
  87. pr_debug("udc: pullup(%d)\n", cmd);
  88. switch (cmd) {
  89. case S3C2410_UDC_P_ENABLE :
  90. s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
  91. break;
  92. case S3C2410_UDC_P_DISABLE :
  93. s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
  94. break;
  95. case S3C2410_UDC_P_RESET :
  96. break;
  97. default:
  98. break;
  99. }
  100. }
  101. static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
  102. .udc_command = mini2440_udc_pullup,
  103. };
  104. /* LCD timing and setup */
  105. /*
  106. * This macro simplifies the table bellow
  107. */
  108. #define _LCD_DECLARE(_clock,_xres,margin_left,margin_right,hsync, \
  109. _yres,margin_top,margin_bottom,vsync, refresh) \
  110. .width = _xres, \
  111. .xres = _xres, \
  112. .height = _yres, \
  113. .yres = _yres, \
  114. .left_margin = margin_left, \
  115. .right_margin = margin_right, \
  116. .upper_margin = margin_top, \
  117. .lower_margin = margin_bottom, \
  118. .hsync_len = hsync, \
  119. .vsync_len = vsync, \
  120. .pixclock = ((_clock*100000000000LL) / \
  121. ((refresh) * \
  122. (hsync + margin_left + _xres + margin_right) * \
  123. (vsync + margin_top + _yres + margin_bottom))), \
  124. .bpp = 16,\
  125. .type = (S3C2410_LCDCON1_TFT16BPP |\
  126. S3C2410_LCDCON1_TFT)
  127. static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
  128. [0] = { /* mini2440 + 3.5" TFT + touchscreen */
  129. _LCD_DECLARE(
  130. 7, /* The 3.5 is quite fast */
  131. 240, 21, 38, 6, /* x timing */
  132. 320, 4, 4, 2, /* y timing */
  133. 60), /* refresh rate */
  134. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  135. S3C2410_LCDCON5_INVVLINE |
  136. S3C2410_LCDCON5_INVVFRAME |
  137. S3C2410_LCDCON5_INVVDEN |
  138. S3C2410_LCDCON5_PWREN),
  139. },
  140. [1] = { /* mini2440 + 7" TFT + touchscreen */
  141. _LCD_DECLARE(
  142. 10, /* the 7" runs slower */
  143. 800, 40, 40, 48, /* x timing */
  144. 480, 29, 3, 3, /* y timing */
  145. 50), /* refresh rate */
  146. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  147. S3C2410_LCDCON5_INVVLINE |
  148. S3C2410_LCDCON5_INVVFRAME |
  149. S3C2410_LCDCON5_PWREN),
  150. },
  151. /* The VGA shield can outout at several resolutions. All share
  152. * the same timings, however, anything smaller than 1024x768
  153. * will only be displayed in the top left corner of a 1024x768
  154. * XGA output unless you add optional dip switches to the shield.
  155. * Therefore timings for other resolutions have been ommited here.
  156. */
  157. [2] = {
  158. _LCD_DECLARE(
  159. 10,
  160. 1024, 1, 2, 2, /* y timing */
  161. 768, 200, 16, 16, /* x timing */
  162. 24), /* refresh rate, maximum stable,
  163. tested with the FPGA shield */
  164. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  165. S3C2410_LCDCON5_HWSWP),
  166. },
  167. };
  168. /* todo - put into gpio header */
  169. #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
  170. #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
  171. static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
  172. .displays = &mini2440_lcd_cfg[0], /* not constant! see init */
  173. .num_displays = 1,
  174. .default_display = 0,
  175. /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
  176. * and disable the pull down resistors on pins we are using for LCD
  177. * data. */
  178. .gpcup = (0xf << 1) | (0x3f << 10),
  179. .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
  180. S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
  181. S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
  182. S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
  183. S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
  184. .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
  185. S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
  186. S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
  187. S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
  188. S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
  189. .gpdup = (0x3f << 2) | (0x3f << 10),
  190. .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
  191. S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
  192. S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
  193. S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
  194. S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
  195. S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
  196. .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
  197. S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
  198. S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
  199. S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
  200. S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
  201. S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
  202. };
  203. /* MMC/SD */
  204. static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
  205. .gpio_detect = S3C2410_GPG(8),
  206. .gpio_wprotect = S3C2410_GPH(8),
  207. .set_power = NULL,
  208. .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
  209. };
  210. /* NAND Flash on MINI2440 board */
  211. static struct mtd_partition mini2440_default_nand_part[] __initdata = {
  212. [0] = {
  213. .name = "u-boot",
  214. .size = SZ_256K,
  215. .offset = 0,
  216. },
  217. [1] = {
  218. .name = "u-boot-env",
  219. .size = SZ_128K,
  220. .offset = SZ_256K,
  221. },
  222. [2] = {
  223. .name = "kernel",
  224. /* 5 megabytes, for a kernel with no modules
  225. * or a uImage with a ramdisk attached */
  226. .size = 0x00500000,
  227. .offset = SZ_256K + SZ_128K,
  228. },
  229. [3] = {
  230. .name = "root",
  231. .offset = SZ_256K + SZ_128K + 0x00500000,
  232. .size = MTDPART_SIZ_FULL,
  233. },
  234. };
  235. static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
  236. [0] = {
  237. .name = "nand",
  238. .nr_chips = 1,
  239. .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part),
  240. .partitions = mini2440_default_nand_part,
  241. .flash_bbt = 1, /* we use u-boot to create a BBT */
  242. },
  243. };
  244. static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
  245. .tacls = 0,
  246. .twrph0 = 25,
  247. .twrph1 = 15,
  248. .nr_sets = ARRAY_SIZE(mini2440_nand_sets),
  249. .sets = mini2440_nand_sets,
  250. .ignore_unset_ecc = 1,
  251. };
  252. /* DM9000AEP 10/100 ethernet controller */
  253. static struct resource mini2440_dm9k_resource[] __initdata = {
  254. [0] = {
  255. .start = MACH_MINI2440_DM9K_BASE,
  256. .end = MACH_MINI2440_DM9K_BASE + 3,
  257. .flags = IORESOURCE_MEM
  258. },
  259. [1] = {
  260. .start = MACH_MINI2440_DM9K_BASE + 4,
  261. .end = MACH_MINI2440_DM9K_BASE + 7,
  262. .flags = IORESOURCE_MEM
  263. },
  264. [2] = {
  265. .start = IRQ_EINT7,
  266. .end = IRQ_EINT7,
  267. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  268. }
  269. };
  270. /*
  271. * The DM9000 has no eeprom, and it's MAC address is set by
  272. * the bootloader before starting the kernel.
  273. */
  274. static struct dm9000_plat_data mini2440_dm9k_pdata __initdata = {
  275. .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
  276. };
  277. static struct platform_device mini2440_device_eth __initdata = {
  278. .name = "dm9000",
  279. .id = -1,
  280. .num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
  281. .resource = mini2440_dm9k_resource,
  282. .dev = {
  283. .platform_data = &mini2440_dm9k_pdata,
  284. },
  285. };
  286. /* CON5
  287. * +--+ /-----\
  288. * | | | |
  289. * | | | BAT |
  290. * | | \_____/
  291. * | |
  292. * | | +----+ +----+
  293. * | | | K5 | | K1 |
  294. * | | +----+ +----+
  295. * | | +----+ +----+
  296. * | | | K4 | | K2 |
  297. * | | +----+ +----+
  298. * | | +----+ +----+
  299. * | | | K6 | | K3 |
  300. * | | +----+ +----+
  301. * .....
  302. */
  303. static struct gpio_keys_button mini2440_buttons[] __initdata = {
  304. {
  305. .gpio = S3C2410_GPG(0), /* K1 */
  306. .code = KEY_F1,
  307. .desc = "Button 1",
  308. .active_low = 1,
  309. },
  310. {
  311. .gpio = S3C2410_GPG(3), /* K2 */
  312. .code = KEY_F2,
  313. .desc = "Button 2",
  314. .active_low = 1,
  315. },
  316. {
  317. .gpio = S3C2410_GPG(5), /* K3 */
  318. .code = KEY_F3,
  319. .desc = "Button 3",
  320. .active_low = 1,
  321. },
  322. {
  323. .gpio = S3C2410_GPG(6), /* K4 */
  324. .code = KEY_POWER,
  325. .desc = "Power",
  326. .active_low = 1,
  327. },
  328. {
  329. .gpio = S3C2410_GPG(7), /* K5 */
  330. .code = KEY_F5,
  331. .desc = "Button 5",
  332. .active_low = 1,
  333. },
  334. #if 0
  335. /* this pin is also known as TCLK1 and seems to already
  336. * marked as "in use" somehow in the kernel -- possibly wrongly */
  337. {
  338. .gpio = S3C2410_GPG(11), /* K6 */
  339. .code = KEY_F6,
  340. .desc = "Button 6",
  341. .active_low = 1,
  342. },
  343. #endif
  344. };
  345. static struct gpio_keys_platform_data mini2440_button_data __initdata = {
  346. .buttons = mini2440_buttons,
  347. .nbuttons = ARRAY_SIZE(mini2440_buttons),
  348. };
  349. static struct platform_device mini2440_button_device __initdata = {
  350. .name = "gpio-keys",
  351. .id = -1,
  352. .dev = {
  353. .platform_data = &mini2440_button_data,
  354. }
  355. };
  356. /* LEDS */
  357. static struct s3c24xx_led_platdata mini2440_led1_pdata __initdata = {
  358. .name = "led1",
  359. .gpio = S3C2410_GPB(5),
  360. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  361. .def_trigger = "heartbeat",
  362. };
  363. static struct s3c24xx_led_platdata mini2440_led2_pdata __initdata = {
  364. .name = "led2",
  365. .gpio = S3C2410_GPB(6),
  366. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  367. .def_trigger = "nand-disk",
  368. };
  369. static struct s3c24xx_led_platdata mini2440_led3_pdata __initdata = {
  370. .name = "led3",
  371. .gpio = S3C2410_GPB(7),
  372. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  373. .def_trigger = "mmc0",
  374. };
  375. static struct s3c24xx_led_platdata mini2440_led4_pdata __initdata = {
  376. .name = "led4",
  377. .gpio = S3C2410_GPB(8),
  378. .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
  379. .def_trigger = "",
  380. };
  381. static struct s3c24xx_led_platdata mini2440_led_backlight_pdata __initdata = {
  382. .name = "backlight",
  383. .gpio = S3C2410_GPG(4),
  384. .def_trigger = "backlight",
  385. };
  386. static struct platform_device mini2440_led1 __initdata = {
  387. .name = "s3c24xx_led",
  388. .id = 1,
  389. .dev = {
  390. .platform_data = &mini2440_led1_pdata,
  391. },
  392. };
  393. static struct platform_device mini2440_led2 __initdata = {
  394. .name = "s3c24xx_led",
  395. .id = 2,
  396. .dev = {
  397. .platform_data = &mini2440_led2_pdata,
  398. },
  399. };
  400. static struct platform_device mini2440_led3 __initdata = {
  401. .name = "s3c24xx_led",
  402. .id = 3,
  403. .dev = {
  404. .platform_data = &mini2440_led3_pdata,
  405. },
  406. };
  407. static struct platform_device mini2440_led4 __initdata = {
  408. .name = "s3c24xx_led",
  409. .id = 4,
  410. .dev = {
  411. .platform_data = &mini2440_led4_pdata,
  412. },
  413. };
  414. static struct platform_device mini2440_led_backlight __initdata = {
  415. .name = "s3c24xx_led",
  416. .id = 5,
  417. .dev = {
  418. .platform_data = &mini2440_led_backlight_pdata,
  419. },
  420. };
  421. /* AUDIO */
  422. static struct s3c24xx_uda134x_platform_data mini2440_audio_pins __initdata = {
  423. .l3_clk = S3C2410_GPB(4),
  424. .l3_mode = S3C2410_GPB(2),
  425. .l3_data = S3C2410_GPB(3),
  426. .model = UDA134X_UDA1341
  427. };
  428. static struct platform_device mini2440_audio __initdata = {
  429. .name = "s3c24xx_uda134x",
  430. .id = 0,
  431. .dev = {
  432. .platform_data = &mini2440_audio_pins,
  433. },
  434. };
  435. /*
  436. * I2C devices
  437. */
  438. static struct at24_platform_data at24c08 = {
  439. .byte_len = SZ_8K / 8,
  440. .page_size = 16,
  441. };
  442. static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
  443. {
  444. I2C_BOARD_INFO("24c08", 0x50),
  445. .platform_data = &at24c08,
  446. },
  447. };
  448. static struct platform_device *mini2440_devices[] __initdata = {
  449. &s3c_device_usb,
  450. &s3c_device_wdt,
  451. /* &s3c_device_adc,*/ /* ADC doesn't like living with touchscreen ! */
  452. &s3c_device_i2c0,
  453. &s3c_device_rtc,
  454. &s3c_device_usbgadget,
  455. &mini2440_device_eth,
  456. &mini2440_led1,
  457. &mini2440_led2,
  458. &mini2440_led3,
  459. &mini2440_led4,
  460. &mini2440_button_device,
  461. &s3c_device_nand,
  462. &s3c_device_sdi,
  463. &s3c_device_iis,
  464. &mini2440_audio,
  465. /* &s3c_device_timer[0],*/ /* buzzer pwm, no API for it */
  466. /* remaining devices are optional */
  467. };
  468. static void __init mini2440_map_io(void)
  469. {
  470. s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
  471. s3c24xx_init_clocks(12000000);
  472. s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
  473. s3c_device_nand.dev.platform_data = &mini2440_nand_info;
  474. s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
  475. }
  476. /*
  477. * mini2440_features string
  478. *
  479. * t = Touchscreen present
  480. * b = backlight control
  481. * c = camera [TODO]
  482. * 0-9 LCD configuration
  483. *
  484. */
  485. static char mini2440_features_str[12] __initdata = "0tb";
  486. static int __init mini2440_features_setup(char *str)
  487. {
  488. if (str)
  489. strlcpy(mini2440_features_str, str, sizeof(mini2440_features_str));
  490. return 1;
  491. }
  492. __setup("mini2440=", mini2440_features_setup);
  493. #define FEATURE_SCREEN (1 << 0)
  494. #define FEATURE_BACKLIGHT (1 << 1)
  495. #define FEATURE_TOUCH (1 << 2)
  496. #define FEATURE_CAMERA (1 << 3)
  497. struct mini2440_features_t {
  498. int count;
  499. int done;
  500. int lcd_index;
  501. struct platform_device *optional[8];
  502. };
  503. static void mini2440_parse_features(
  504. struct mini2440_features_t * features,
  505. const char * features_str )
  506. {
  507. const char * fp = features_str;
  508. features->count = 0;
  509. features->done = 0;
  510. features->lcd_index = -1;
  511. while (*fp) {
  512. char f = *fp++;
  513. switch (f) {
  514. case '0'...'9': /* tft screen */
  515. if (features->done & FEATURE_SCREEN) {
  516. printk(KERN_INFO "MINI2440: '%c' ignored, "
  517. "screen type already set\n", f);
  518. } else {
  519. int li = f - '0';
  520. if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
  521. printk(KERN_INFO "MINI2440: "
  522. "'%c' out of range LCD mode\n", f);
  523. else {
  524. features->optional[features->count++] =
  525. &s3c_device_lcd;
  526. features->lcd_index = li;
  527. }
  528. }
  529. features->done |= FEATURE_SCREEN;
  530. break;
  531. case 'b':
  532. if (features->done & FEATURE_BACKLIGHT)
  533. printk(KERN_INFO "MINI2440: '%c' ignored, "
  534. "backlight already set\n", f);
  535. else {
  536. features->optional[features->count++] =
  537. &mini2440_led_backlight;
  538. }
  539. features->done |= FEATURE_BACKLIGHT;
  540. break;
  541. case 't':
  542. printk(KERN_INFO "MINI2440: '%c' ignored, "
  543. "touchscreen not compiled in\n", f);
  544. break;
  545. case 'c':
  546. if (features->done & FEATURE_CAMERA)
  547. printk(KERN_INFO "MINI2440: '%c' ignored, "
  548. "camera already registered\n", f);
  549. else
  550. features->optional[features->count++] =
  551. &s3c_device_camif;
  552. features->done |= FEATURE_CAMERA;
  553. break;
  554. }
  555. }
  556. }
  557. static void __init mini2440_init(void)
  558. {
  559. struct mini2440_features_t features = { 0 };
  560. int i;
  561. printk(KERN_INFO "MINI2440: Option string mini2440=%s\n",
  562. mini2440_features_str);
  563. /* Parse the feature string */
  564. mini2440_parse_features(&features, mini2440_features_str);
  565. /* turn LCD on */
  566. s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
  567. /* Turn the backlight early on */
  568. s3c2410_gpio_setpin(S3C2410_GPG(4), 1);
  569. s3c2410_gpio_cfgpin(S3C2410_GPG(4), S3C2410_GPIO_OUTPUT);
  570. /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
  571. s3c2410_gpio_pullup(S3C2410_GPB(1), 0);
  572. s3c2410_gpio_setpin(S3C2410_GPB(1), 0);
  573. s3c2410_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT);
  574. /* Make sure the D+ pullup pin is output */
  575. s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT);
  576. /* mark the key as input, without pullups (there is one on the board) */
  577. for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
  578. s3c2410_gpio_pullup(mini2440_buttons[i].gpio, 0);
  579. s3c2410_gpio_cfgpin(mini2440_buttons[i].gpio,
  580. S3C2410_GPIO_INPUT);
  581. }
  582. if (features.lcd_index != -1) {
  583. int li;
  584. mini2440_fb_info.displays =
  585. &mini2440_lcd_cfg[features.lcd_index];
  586. printk(KERN_INFO "MINI2440: LCD");
  587. for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
  588. if (li == features.lcd_index)
  589. printk(" [%d:%dx%d]", li,
  590. mini2440_lcd_cfg[li].width,
  591. mini2440_lcd_cfg[li].height);
  592. else
  593. printk(" %d:%dx%d", li,
  594. mini2440_lcd_cfg[li].width,
  595. mini2440_lcd_cfg[li].height);
  596. printk("\n");
  597. s3c24xx_fb_set_platdata(&mini2440_fb_info);
  598. }
  599. s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
  600. s3c_i2c0_set_platdata(NULL);
  601. i2c_register_board_info(0, mini2440_i2c_devs,
  602. ARRAY_SIZE(mini2440_i2c_devs));
  603. platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
  604. if (features.count) /* the optional features */
  605. platform_add_devices(features.optional, features.count);
  606. }
  607. MACHINE_START(MINI2440, "MINI2440")
  608. /* Maintainer: Michel Pollet <buserror@gmail.com> */
  609. .phys_io = S3C2410_PA_UART,
  610. .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
  611. .boot_params = S3C2410_SDRAM_PA + 0x100,
  612. .map_io = mini2440_map_io,
  613. .init_machine = mini2440_init,
  614. .init_irq = s3c24xx_init_irq,
  615. .timer = &s3c24xx_timer,
  616. MACHINE_END