mach-jive.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright 2007 Simtec Electronics
  4. // Ben Dooks <[email protected]>
  5. //
  6. // http://armlinux.simtec.co.uk/
  7. #include <linux/kernel.h>
  8. #include <linux/types.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/list.h>
  11. #include <linux/timer.h>
  12. #include <linux/init.h>
  13. #include <linux/gpio.h>
  14. #include <linux/gpio/machine.h>
  15. #include <linux/syscore_ops.h>
  16. #include <linux/serial_core.h>
  17. #include <linux/serial_s3c.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/i2c.h>
  20. #include <video/ili9320.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/spi/spi_gpio.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/mach/irq.h>
  26. #include <linux/platform_data/mtd-nand-s3c2410.h>
  27. #include <linux/platform_data/i2c-s3c2410.h>
  28. #include "hardware-s3c24xx.h"
  29. #include "regs-gpio.h"
  30. #include <linux/platform_data/fb-s3c2410.h>
  31. #include "gpio-samsung.h"
  32. #include <asm/mach-types.h>
  33. #include <linux/mtd/mtd.h>
  34. #include <linux/mtd/rawnand.h>
  35. #include <linux/mtd/nand-ecc-sw-hamming.h>
  36. #include <linux/mtd/partitions.h>
  37. #include "gpio-cfg.h"
  38. #include "devs.h"
  39. #include "cpu.h"
  40. #include "pm.h"
  41. #include <linux/platform_data/usb-s3c2410_udc.h>
  42. #include "s3c24xx.h"
  43. #include "s3c2412-power.h"
  44. static struct map_desc jive_iodesc[] __initdata = {
  45. };
  46. #define UCON S3C2410_UCON_DEFAULT
  47. #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE
  48. #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  49. static struct s3c2410_uartcfg jive_uartcfgs[] = {
  50. [0] = {
  51. .hwport = 0,
  52. .flags = 0,
  53. .ucon = UCON,
  54. .ulcon = ULCON,
  55. .ufcon = UFCON,
  56. },
  57. [1] = {
  58. .hwport = 1,
  59. .flags = 0,
  60. .ucon = UCON,
  61. .ulcon = ULCON,
  62. .ufcon = UFCON,
  63. },
  64. [2] = {
  65. .hwport = 2,
  66. .flags = 0,
  67. .ucon = UCON,
  68. .ulcon = ULCON,
  69. .ufcon = UFCON,
  70. }
  71. };
  72. /* Jive flash assignment
  73. *
  74. * 0x00000000-0x00028000 : uboot
  75. * 0x00028000-0x0002c000 : uboot env
  76. * 0x0002c000-0x00030000 : spare
  77. * 0x00030000-0x00200000 : zimage A
  78. * 0x00200000-0x01600000 : cramfs A
  79. * 0x01600000-0x017d0000 : zimage B
  80. * 0x017d0000-0x02bd0000 : cramfs B
  81. * 0x02bd0000-0x03fd0000 : yaffs
  82. */
  83. static struct mtd_partition __initdata jive_imageA_nand_part[] = {
  84. #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
  85. /* Don't allow access to the bootloader from linux */
  86. {
  87. .name = "uboot",
  88. .offset = 0,
  89. .size = (160 * SZ_1K),
  90. .mask_flags = MTD_WRITEABLE, /* force read-only */
  91. },
  92. /* spare */
  93. {
  94. .name = "spare",
  95. .offset = (176 * SZ_1K),
  96. .size = (16 * SZ_1K),
  97. },
  98. #endif
  99. /* booted images */
  100. {
  101. .name = "kernel (ro)",
  102. .offset = (192 * SZ_1K),
  103. .size = (SZ_2M) - (192 * SZ_1K),
  104. .mask_flags = MTD_WRITEABLE, /* force read-only */
  105. }, {
  106. .name = "root (ro)",
  107. .offset = (SZ_2M),
  108. .size = (20 * SZ_1M),
  109. .mask_flags = MTD_WRITEABLE, /* force read-only */
  110. },
  111. /* yaffs */
  112. {
  113. .name = "yaffs",
  114. .offset = (44 * SZ_1M),
  115. .size = (20 * SZ_1M),
  116. },
  117. /* bootloader environment */
  118. {
  119. .name = "env",
  120. .offset = (160 * SZ_1K),
  121. .size = (16 * SZ_1K),
  122. },
  123. /* upgrade images */
  124. {
  125. .name = "zimage",
  126. .offset = (22 * SZ_1M),
  127. .size = (2 * SZ_1M) - (192 * SZ_1K),
  128. }, {
  129. .name = "cramfs",
  130. .offset = (24 * SZ_1M) - (192*SZ_1K),
  131. .size = (20 * SZ_1M),
  132. },
  133. };
  134. static struct mtd_partition __initdata jive_imageB_nand_part[] = {
  135. #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
  136. /* Don't allow access to the bootloader from linux */
  137. {
  138. .name = "uboot",
  139. .offset = 0,
  140. .size = (160 * SZ_1K),
  141. .mask_flags = MTD_WRITEABLE, /* force read-only */
  142. },
  143. /* spare */
  144. {
  145. .name = "spare",
  146. .offset = (176 * SZ_1K),
  147. .size = (16 * SZ_1K),
  148. },
  149. #endif
  150. /* booted images */
  151. {
  152. .name = "kernel (ro)",
  153. .offset = (22 * SZ_1M),
  154. .size = (2 * SZ_1M) - (192 * SZ_1K),
  155. .mask_flags = MTD_WRITEABLE, /* force read-only */
  156. },
  157. {
  158. .name = "root (ro)",
  159. .offset = (24 * SZ_1M) - (192 * SZ_1K),
  160. .size = (20 * SZ_1M),
  161. .mask_flags = MTD_WRITEABLE, /* force read-only */
  162. },
  163. /* yaffs */
  164. {
  165. .name = "yaffs",
  166. .offset = (44 * SZ_1M),
  167. .size = (20 * SZ_1M),
  168. },
  169. /* bootloader environment */
  170. {
  171. .name = "env",
  172. .offset = (160 * SZ_1K),
  173. .size = (16 * SZ_1K),
  174. },
  175. /* upgrade images */
  176. {
  177. .name = "zimage",
  178. .offset = (192 * SZ_1K),
  179. .size = (2 * SZ_1M) - (192 * SZ_1K),
  180. }, {
  181. .name = "cramfs",
  182. .offset = (2 * SZ_1M),
  183. .size = (20 * SZ_1M),
  184. },
  185. };
  186. static struct s3c2410_nand_set __initdata jive_nand_sets[] = {
  187. [0] = {
  188. .name = "flash",
  189. .nr_chips = 1,
  190. .nr_partitions = ARRAY_SIZE(jive_imageA_nand_part),
  191. .partitions = jive_imageA_nand_part,
  192. },
  193. };
  194. static struct s3c2410_platform_nand __initdata jive_nand_info = {
  195. /* set taken from osiris nand timings, possibly still conservative */
  196. .tacls = 30,
  197. .twrph0 = 55,
  198. .twrph1 = 40,
  199. .sets = jive_nand_sets,
  200. .nr_sets = ARRAY_SIZE(jive_nand_sets),
  201. .engine_type = NAND_ECC_ENGINE_TYPE_SOFT,
  202. };
  203. static int __init jive_mtdset(char *options)
  204. {
  205. struct s3c2410_nand_set *nand = &jive_nand_sets[0];
  206. unsigned long set;
  207. if (options == NULL || options[0] == '\0')
  208. return 1;
  209. if (kstrtoul(options, 10, &set)) {
  210. printk(KERN_ERR "failed to parse mtdset=%s\n", options);
  211. return 1;
  212. }
  213. switch (set) {
  214. case 1:
  215. nand->nr_partitions = ARRAY_SIZE(jive_imageB_nand_part);
  216. nand->partitions = jive_imageB_nand_part;
  217. break;
  218. case 0:
  219. /* this is already setup in the nand info */
  220. break;
  221. default:
  222. printk(KERN_ERR "Unknown mtd set %ld specified,"
  223. "using default.", set);
  224. }
  225. return 1;
  226. }
  227. /* parse the mtdset= option given to the kernel command line */
  228. __setup("mtdset=", jive_mtdset);
  229. /* LCD timing and setup */
  230. #define LCD_XRES (240)
  231. #define LCD_YRES (320)
  232. #define LCD_LEFT_MARGIN (12)
  233. #define LCD_RIGHT_MARGIN (12)
  234. #define LCD_LOWER_MARGIN (12)
  235. #define LCD_UPPER_MARGIN (12)
  236. #define LCD_VSYNC (2)
  237. #define LCD_HSYNC (2)
  238. #define LCD_REFRESH (60)
  239. #define LCD_HTOT (LCD_HSYNC + LCD_LEFT_MARGIN + LCD_XRES + LCD_RIGHT_MARGIN)
  240. #define LCD_VTOT (LCD_VSYNC + LCD_LOWER_MARGIN + LCD_YRES + LCD_UPPER_MARGIN)
  241. static struct s3c2410fb_display jive_vgg2432a4_display[] = {
  242. [0] = {
  243. .width = LCD_XRES,
  244. .height = LCD_YRES,
  245. .xres = LCD_XRES,
  246. .yres = LCD_YRES,
  247. .left_margin = LCD_LEFT_MARGIN,
  248. .right_margin = LCD_RIGHT_MARGIN,
  249. .upper_margin = LCD_UPPER_MARGIN,
  250. .lower_margin = LCD_LOWER_MARGIN,
  251. .hsync_len = LCD_HSYNC,
  252. .vsync_len = LCD_VSYNC,
  253. .pixclock = (1000000000000LL /
  254. (LCD_REFRESH * LCD_HTOT * LCD_VTOT)),
  255. .bpp = 16,
  256. .type = (S3C2410_LCDCON1_TFT16BPP |
  257. S3C2410_LCDCON1_TFT),
  258. .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
  259. S3C2410_LCDCON5_INVVLINE |
  260. S3C2410_LCDCON5_INVVFRAME |
  261. S3C2410_LCDCON5_INVVDEN |
  262. S3C2410_LCDCON5_PWREN),
  263. },
  264. };
  265. /* todo - put into gpio header */
  266. #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
  267. #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
  268. static struct s3c2410fb_mach_info jive_lcd_config = {
  269. .displays = jive_vgg2432a4_display,
  270. .num_displays = ARRAY_SIZE(jive_vgg2432a4_display),
  271. .default_display = 0,
  272. /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
  273. * and disable the pull down resistors on pins we are using for LCD
  274. * data. */
  275. .gpcup = (0xf << 1) | (0x3f << 10),
  276. .gpcup_reg = S3C2410_GPCUP,
  277. .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
  278. S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
  279. S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
  280. S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
  281. S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
  282. .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
  283. S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
  284. S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
  285. S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
  286. S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
  287. .gpccon_reg = S3C2410_GPCCON,
  288. .gpdup = (0x3f << 2) | (0x3f << 10),
  289. .gpdup_reg = S3C2410_GPDUP,
  290. .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
  291. S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
  292. S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
  293. S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
  294. S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
  295. S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
  296. .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
  297. S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
  298. S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
  299. S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
  300. S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
  301. S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
  302. .gpdcon_reg = S3C2410_GPDCON,
  303. };
  304. /* ILI9320 support. */
  305. static void jive_lcm_reset(unsigned int set)
  306. {
  307. printk(KERN_DEBUG "%s(%d)\n", __func__, set);
  308. gpio_set_value(S3C2410_GPG(13), set);
  309. }
  310. #undef LCD_UPPER_MARGIN
  311. #define LCD_UPPER_MARGIN 2
  312. static struct ili9320_platdata jive_lcm_config = {
  313. .hsize = LCD_XRES,
  314. .vsize = LCD_YRES,
  315. .reset = jive_lcm_reset,
  316. .suspend = ILI9320_SUSPEND_DEEP,
  317. .entry_mode = ILI9320_ENTRYMODE_ID(3) | ILI9320_ENTRYMODE_BGR,
  318. .display2 = (ILI9320_DISPLAY2_FP(LCD_UPPER_MARGIN) |
  319. ILI9320_DISPLAY2_BP(LCD_LOWER_MARGIN)),
  320. .display3 = 0x0,
  321. .display4 = 0x0,
  322. .rgb_if1 = (ILI9320_RGBIF1_RIM_RGB18 |
  323. ILI9320_RGBIF1_RM | ILI9320_RGBIF1_CLK_RGBIF),
  324. .rgb_if2 = ILI9320_RGBIF2_DPL,
  325. .interface2 = 0x0,
  326. .interface3 = 0x3,
  327. .interface4 = (ILI9320_INTERFACE4_RTNE(16) |
  328. ILI9320_INTERFACE4_DIVE(1)),
  329. .interface5 = 0x0,
  330. .interface6 = 0x0,
  331. };
  332. /* LCD SPI support */
  333. static struct spi_gpio_platform_data jive_lcd_spi = {
  334. .num_chipselect = 1,
  335. };
  336. static struct platform_device jive_device_lcdspi = {
  337. .name = "spi_gpio",
  338. .id = 1,
  339. .dev.platform_data = &jive_lcd_spi,
  340. };
  341. static struct gpiod_lookup_table jive_lcdspi_gpiod_table = {
  342. .dev_id = "spi_gpio",
  343. .table = {
  344. GPIO_LOOKUP("GPIOG", 8,
  345. "sck", GPIO_ACTIVE_HIGH),
  346. GPIO_LOOKUP("GPIOB", 8,
  347. "mosi", GPIO_ACTIVE_HIGH),
  348. GPIO_LOOKUP("GPIOB", 7,
  349. "cs", GPIO_ACTIVE_HIGH),
  350. { },
  351. },
  352. };
  353. /* WM8750 audio code SPI definition */
  354. static struct spi_gpio_platform_data jive_wm8750_spi = {
  355. .num_chipselect = 1,
  356. };
  357. static struct platform_device jive_device_wm8750 = {
  358. .name = "spi_gpio",
  359. .id = 2,
  360. .dev.platform_data = &jive_wm8750_spi,
  361. };
  362. static struct gpiod_lookup_table jive_wm8750_gpiod_table = {
  363. .dev_id = "spi_gpio",
  364. .table = {
  365. GPIO_LOOKUP("GPIOB", 4,
  366. "sck", GPIO_ACTIVE_HIGH),
  367. GPIO_LOOKUP("GPIOB", 9,
  368. "mosi", GPIO_ACTIVE_HIGH),
  369. GPIO_LOOKUP("GPIOH", 10,
  370. "cs", GPIO_ACTIVE_HIGH),
  371. { },
  372. },
  373. };
  374. /* JIVE SPI devices. */
  375. static struct spi_board_info __initdata jive_spi_devs[] = {
  376. [0] = {
  377. .modalias = "VGG2432A4",
  378. .bus_num = 1,
  379. .chip_select = 0,
  380. .mode = SPI_MODE_3, /* CPOL=1, CPHA=1 */
  381. .max_speed_hz = 100000,
  382. .platform_data = &jive_lcm_config,
  383. }, {
  384. .modalias = "WM8750",
  385. .bus_num = 2,
  386. .chip_select = 0,
  387. .mode = SPI_MODE_0, /* CPOL=0, CPHA=0 */
  388. .max_speed_hz = 100000,
  389. },
  390. };
  391. /* I2C bus and device configuration. */
  392. static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
  393. .frequency = 80 * 1000,
  394. .flags = S3C_IICFLG_FILTER,
  395. .sda_delay = 2,
  396. };
  397. static struct i2c_board_info jive_i2c_devs[] __initdata = {
  398. [0] = {
  399. I2C_BOARD_INFO("lis302dl", 0x1c),
  400. .irq = IRQ_EINT14,
  401. },
  402. };
  403. /* The platform devices being used. */
  404. static struct platform_device *jive_devices[] __initdata = {
  405. &s3c_device_ohci,
  406. &s3c_device_rtc,
  407. &s3c_device_wdt,
  408. &s3c_device_i2c0,
  409. &s3c_device_lcd,
  410. &jive_device_lcdspi,
  411. &jive_device_wm8750,
  412. &s3c_device_nand,
  413. &s3c_device_usbgadget,
  414. &s3c2412_device_dma,
  415. };
  416. static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
  417. };
  418. static struct gpiod_lookup_table jive_udc_gpio_table = {
  419. .dev_id = "s3c2410-usbgadget",
  420. .table = {
  421. GPIO_LOOKUP("GPIOG", 1, "vbus", GPIO_ACTIVE_HIGH),
  422. { },
  423. },
  424. };
  425. /* Jive power management device */
  426. #ifdef CONFIG_PM
  427. static int jive_pm_suspend(void)
  428. {
  429. /* Write the magic value u-boot uses to check for resume into
  430. * the INFORM0 register, and ensure INFORM1 is set to the
  431. * correct address to resume from. */
  432. __raw_writel(0x2BED, S3C2412_INFORM0);
  433. __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
  434. return 0;
  435. }
  436. static void jive_pm_resume(void)
  437. {
  438. __raw_writel(0x0, S3C2412_INFORM0);
  439. }
  440. #else
  441. #define jive_pm_suspend NULL
  442. #define jive_pm_resume NULL
  443. #endif
  444. static struct syscore_ops jive_pm_syscore_ops = {
  445. .suspend = jive_pm_suspend,
  446. .resume = jive_pm_resume,
  447. };
  448. static void __init jive_map_io(void)
  449. {
  450. s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
  451. s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
  452. s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
  453. }
  454. static void __init jive_init_time(void)
  455. {
  456. s3c2412_init_clocks(12000000);
  457. s3c24xx_timer_init();
  458. }
  459. static void jive_power_off(void)
  460. {
  461. printk(KERN_INFO "powering system down...\n");
  462. gpio_request_one(S3C2410_GPC(5), GPIOF_OUT_INIT_HIGH, NULL);
  463. gpio_free(S3C2410_GPC(5));
  464. }
  465. static void __init jive_machine_init(void)
  466. {
  467. /* register system core operations for managing low level suspend */
  468. register_syscore_ops(&jive_pm_syscore_ops);
  469. /* write our sleep configurations for the IO. Pull down all unused
  470. * IO, ensure that we have turned off all peripherals we do not
  471. * need, and configure the ones we do need. */
  472. /* Port B sleep */
  473. __raw_writel(S3C2412_SLPCON_IN(0) |
  474. S3C2412_SLPCON_PULL(1) |
  475. S3C2412_SLPCON_HIGH(2) |
  476. S3C2412_SLPCON_PULL(3) |
  477. S3C2412_SLPCON_PULL(4) |
  478. S3C2412_SLPCON_PULL(5) |
  479. S3C2412_SLPCON_PULL(6) |
  480. S3C2412_SLPCON_HIGH(7) |
  481. S3C2412_SLPCON_PULL(8) |
  482. S3C2412_SLPCON_PULL(9) |
  483. S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON);
  484. /* Port C sleep */
  485. __raw_writel(S3C2412_SLPCON_PULL(0) |
  486. S3C2412_SLPCON_PULL(1) |
  487. S3C2412_SLPCON_PULL(2) |
  488. S3C2412_SLPCON_PULL(3) |
  489. S3C2412_SLPCON_PULL(4) |
  490. S3C2412_SLPCON_PULL(5) |
  491. S3C2412_SLPCON_LOW(6) |
  492. S3C2412_SLPCON_PULL(6) |
  493. S3C2412_SLPCON_PULL(7) |
  494. S3C2412_SLPCON_PULL(8) |
  495. S3C2412_SLPCON_PULL(9) |
  496. S3C2412_SLPCON_PULL(10) |
  497. S3C2412_SLPCON_PULL(11) |
  498. S3C2412_SLPCON_PULL(12) |
  499. S3C2412_SLPCON_PULL(13) |
  500. S3C2412_SLPCON_PULL(14) |
  501. S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON);
  502. /* Port D sleep */
  503. __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON);
  504. /* Port F sleep */
  505. __raw_writel(S3C2412_SLPCON_LOW(0) |
  506. S3C2412_SLPCON_LOW(1) |
  507. S3C2412_SLPCON_LOW(2) |
  508. S3C2412_SLPCON_EINT(3) |
  509. S3C2412_SLPCON_EINT(4) |
  510. S3C2412_SLPCON_EINT(5) |
  511. S3C2412_SLPCON_EINT(6) |
  512. S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON);
  513. /* Port G sleep */
  514. __raw_writel(S3C2412_SLPCON_IN(0) |
  515. S3C2412_SLPCON_IN(1) |
  516. S3C2412_SLPCON_IN(2) |
  517. S3C2412_SLPCON_IN(3) |
  518. S3C2412_SLPCON_IN(4) |
  519. S3C2412_SLPCON_IN(5) |
  520. S3C2412_SLPCON_IN(6) |
  521. S3C2412_SLPCON_IN(7) |
  522. S3C2412_SLPCON_PULL(8) |
  523. S3C2412_SLPCON_PULL(9) |
  524. S3C2412_SLPCON_IN(10) |
  525. S3C2412_SLPCON_PULL(11) |
  526. S3C2412_SLPCON_PULL(12) |
  527. S3C2412_SLPCON_PULL(13) |
  528. S3C2412_SLPCON_IN(14) |
  529. S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON);
  530. /* Port H sleep */
  531. __raw_writel(S3C2412_SLPCON_PULL(0) |
  532. S3C2412_SLPCON_PULL(1) |
  533. S3C2412_SLPCON_PULL(2) |
  534. S3C2412_SLPCON_PULL(3) |
  535. S3C2412_SLPCON_PULL(4) |
  536. S3C2412_SLPCON_PULL(5) |
  537. S3C2412_SLPCON_PULL(6) |
  538. S3C2412_SLPCON_IN(7) |
  539. S3C2412_SLPCON_IN(8) |
  540. S3C2412_SLPCON_PULL(9) |
  541. S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON);
  542. /* initialise the power management now we've setup everything. */
  543. s3c_pm_init();
  544. /** TODO - check that this is after the cmdline option! */
  545. s3c_nand_set_platdata(&jive_nand_info);
  546. gpio_request(S3C2410_GPG(13), "lcm reset");
  547. gpio_direction_output(S3C2410_GPG(13), 0);
  548. gpio_request_one(S3C2410_GPB(6), GPIOF_OUT_INIT_LOW, NULL);
  549. gpio_free(S3C2410_GPB(6));
  550. /* Turn off suspend on both USB ports, and switch the
  551. * selectable USB port to USB device mode. */
  552. s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
  553. S3C2410_MISCCR_USBSUSPND0 |
  554. S3C2410_MISCCR_USBSUSPND1, 0x0);
  555. s3c24xx_udc_set_platdata(&jive_udc_cfg);
  556. s3c24xx_fb_set_platdata(&jive_lcd_config);
  557. spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
  558. s3c_i2c0_set_platdata(&jive_i2c_cfg);
  559. i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
  560. pm_power_off = jive_power_off;
  561. gpiod_add_lookup_table(&jive_udc_gpio_table);
  562. gpiod_add_lookup_table(&jive_lcdspi_gpiod_table);
  563. gpiod_add_lookup_table(&jive_wm8750_gpiod_table);
  564. platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
  565. }
  566. MACHINE_START(JIVE, "JIVE")
  567. /* Maintainer: Ben Dooks <[email protected]> */
  568. .atag_offset = 0x100,
  569. .nr_irqs = NR_IRQS_S3C2412,
  570. .init_irq = s3c2412_init_irq,
  571. .map_io = jive_map_io,
  572. .init_machine = jive_machine_init,
  573. .init_time = jive_init_time,
  574. MACHINE_END