mach-mini2440.c 18 KB

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