Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.56 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2009 Integration Software and Electronic Engineering.
  3. *
  4. * Modified from mach-omap2/board-generic.c
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10.  
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/delay.h>
  15. #include <linux/err.h>
  16. #include <linux/clk.h>
  17. #include <linux/io.h>
  18. #include <linux/gpio.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/input.h>
  21.  
  22. #include <linux/spi/spi.h>
  23. #include <linux/regulator/machine.h>
  24. #include <linux/regulator/fixed.h>
  25. #include <linux/i2c/twl.h>
  26.  
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29.  
  30. #include <plat/board.h>
  31. #include <plat/common.h>
  32. #include <plat/gpmc.h>
  33. #include <plat/usb.h>
  34. #include <plat/display.h>
  35. #include <plat/onenand.h>
  36.  
  37. #include "devices.h"
  38. #include "mux.h"
  39. #include "hsmmc.h"
  40. #include "sdram-numonyx-m65kxxxxam.h"
  41.  
  42. #define IGEP2_SMSC911X_CS 5
  43. #define IGEP2_SMSC911X_GPIO 176
  44. #define IGEP2_GPIO_USBH_NRESET 24
  45. #define IGEP2_GPIO_LED0_GREEN 26
  46. #define IGEP2_GPIO_LED0_RED 27
  47. #define IGEP2_GPIO_LED1_RED 28
  48. #define IGEP2_GPIO_DVI_PUP 170
  49.  
  50. #define IGEP2_RB_GPIO_WIFI_NPD 94
  51. #define IGEP2_RB_GPIO_WIFI_NRESET 95
  52. #define IGEP2_RB_GPIO_BT_NRESET 137
  53. #define IGEP2_RC_GPIO_WIFI_NPD 138
  54. #define IGEP2_RC_GPIO_WIFI_NRESET 139
  55. #define IGEP2_RC_GPIO_BT_NRESET 137
  56.  
  57. /*
  58. * IGEP2 Hardware Revision Table
  59. *
  60. * --------------------------------------------------------------------------
  61. * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
  62. * --------------------------------------------------------------------------
  63. * | 0 | B | high | gpio94 | gpio95 | - |
  64. * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
  65. * | 1 | C | low | gpio138 | gpio139 | gpio137 |
  66. * --------------------------------------------------------------------------
  67. */
  68.  
  69. #define IGEP2_BOARD_HWREV_B 0
  70. #define IGEP2_BOARD_HWREV_C 1
  71.  
  72. static u8 hwrev;
  73.  
  74. static void __init igep2_get_revision(void)
  75. {
  76. u8 ret;
  77.  
  78. omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
  79.  
  80. if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) &&
  81. (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
  82. ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
  83. if (ret == 0) {
  84. pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
  85. hwrev = IGEP2_BOARD_HWREV_C;
  86. } else if (ret == 1) {
  87. pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
  88. hwrev = IGEP2_BOARD_HWREV_B;
  89. } else {
  90. pr_err("IGEP2: Unknow Hardware Revision\n");
  91. hwrev = -1;
  92. }
  93. } else {
  94. pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
  95. pr_err("IGEP2: Unknow Hardware Revision\n");
  96. }
  97.  
  98. gpio_free(IGEP2_GPIO_LED1_RED);
  99. }
  100.  
  101. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  102. defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
  103.  
  104. #define ONENAND_MAP 0x20000000
  105.  
  106. /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
  107. * Since the device is equipped with two DataRAMs, and two-plane NAND
  108. * Flash memory array, these two component enables simultaneous program
  109. * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
  110. * while Plane2 has only odd blocks such as block1, block3, block5.
  111. * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
  112. */
  113.  
  114. static struct mtd_partition igep2_onenand_partitions[] = {
  115. {
  116. .name = "X-Loader",
  117. .offset = 0,
  118. .size = 2 * (64*(2*2048))
  119. },
  120. {
  121. .name = "U-Boot",
  122. .offset = MTDPART_OFS_APPEND,
  123. .size = 6 * (64*(2*2048)),
  124. },
  125. {
  126. .name = "Environment",
  127. .offset = MTDPART_OFS_APPEND,
  128. .size = 2 * (64*(2*2048)),
  129. },
  130. {
  131. .name = "Kernel",
  132. .offset = MTDPART_OFS_APPEND,
  133. .size = 12 * (64*(2*2048)),
  134. },
  135. {
  136. .name = "File System",
  137. .offset = MTDPART_OFS_APPEND,
  138. .size = MTDPART_SIZ_FULL,
  139. },
  140. };
  141.  
  142. static struct omap_onenand_platform_data igep2_onenand_data = {
  143. .parts = igep2_onenand_partitions,
  144. .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
  145. .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
  146. };
  147.  
  148. static struct platform_device igep2_onenand_device = {
  149. .name = "omap2-onenand",
  150. .id = -1,
  151. .dev = {
  152. .platform_data = &igep2_onenand_data,
  153. },
  154. };
  155.  
  156. void __init igep2_flash_init(void)
  157. {
  158. u8 cs = 0;
  159. u8 onenandcs = GPMC_CS_NUM + 1;
  160.  
  161. for (cs = 0; cs < GPMC_CS_NUM; cs++) {
  162. u32 ret;
  163. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
  164.  
  165. /* Check if NAND/oneNAND is configured */
  166. if ((ret & 0xC00) == 0x800)
  167. /* NAND found */
  168. pr_err("IGEP2: Unsupported NAND found\n");
  169. else {
  170. ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
  171. if ((ret & 0x3F) == (ONENAND_MAP >> 24))
  172. /* ONENAND found */
  173. onenandcs = cs;
  174. }
  175. }
  176.  
  177. if (onenandcs > GPMC_CS_NUM) {
  178. pr_err("IGEP2: Unable to find configuration in GPMC\n");
  179. return;
  180. }
  181.  
  182. igep2_onenand_data.cs = onenandcs;
  183.  
  184. if (platform_device_register(&igep2_onenand_device) < 0)
  185. pr_err("IGEP2: Unable to register OneNAND device\n");
  186. }
  187.  
  188. #else
  189. void __init igep2_flash_init(void) {}
  190. #endif
  191.  
  192. #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
  193.  
  194. #include <linux/smsc911x.h>
  195.  
  196. static struct smsc911x_platform_config igep2_smsc911x_config = {
  197. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  198. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  199. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS ,
  200. .phy_interface = PHY_INTERFACE_MODE_MII,
  201. };
  202.  
  203. static struct resource igep2_smsc911x_resources[] = {
  204. {
  205. .flags = IORESOURCE_MEM,
  206. },
  207. {
  208. .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
  209. .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
  210. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  211. },
  212. };
  213.  
  214. static struct platform_device igep2_smsc911x_device = {
  215. .name = "smsc911x",
  216. .id = 0,
  217. .num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
  218. .resource = igep2_smsc911x_resources,
  219. .dev = {
  220. .platform_data = &igep2_smsc911x_config,
  221. },
  222. };
  223.  
  224. static inline void __init igep2_init_smsc911x(void)
  225. {
  226. unsigned long cs_mem_base;
  227.  
  228. if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
  229. pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
  230. gpmc_cs_free(IGEP2_SMSC911X_CS);
  231. return;
  232. }
  233.  
  234. igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
  235. igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
  236.  
  237. if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
  238. (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
  239. gpio_export(IGEP2_SMSC911X_GPIO, 0);
  240. } else {
  241. pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
  242. return;
  243. }
  244.  
  245. platform_device_register(&igep2_smsc911x_device);
  246. }
  247.  
  248. #else
  249. static inline void __init igep2_init_smsc911x(void) { }
  250. #endif
  251.  
  252. static struct regulator_consumer_supply igep2_vmmc1_supply =
  253. REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
  254.  
  255. /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
  256. static struct regulator_init_data igep2_vmmc1 = {
  257. .constraints = {
  258. .min_uV = 1850000,
  259. .max_uV = 3150000,
  260. .valid_modes_mask = REGULATOR_MODE_NORMAL
  261. | REGULATOR_MODE_STANDBY,
  262. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  263. | REGULATOR_CHANGE_MODE
  264. | REGULATOR_CHANGE_STATUS,
  265. },
  266. .num_consumer_supplies = 1,
  267. .consumer_supplies = &igep2_vmmc1_supply,
  268. };
  269.  
  270. static struct regulator_consumer_supply igep2_vio_supply =
  271. REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.1");
  272.  
  273. static struct regulator_init_data igep2_vio = {
  274. .constraints = {
  275. .min_uV = 1800000,
  276. .max_uV = 1800000,
  277. .apply_uV = 1,
  278. .valid_modes_mask = REGULATOR_MODE_NORMAL
  279. | REGULATOR_MODE_STANDBY,
  280. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
  281. | REGULATOR_CHANGE_MODE
  282. | REGULATOR_CHANGE_STATUS,
  283. },
  284. .num_consumer_supplies = 1,
  285. .consumer_supplies = &igep2_vio_supply,
  286. };
  287.  
  288. static struct regulator_consumer_supply igep2_vmmc2_supply =
  289. REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
  290.  
  291. static struct regulator_init_data igep2_vmmc2 = {
  292. .constraints = {
  293. .valid_modes_mask = REGULATOR_MODE_NORMAL,
  294. .always_on = 1,
  295. },
  296. .num_consumer_supplies = 1,
  297. .consumer_supplies = &igep2_vmmc2_supply,
  298. };
  299.  
  300. static struct fixed_voltage_config igep2_vwlan = {
  301. .supply_name = "vwlan",
  302. .microvolts = 3300000,
  303. .gpio = -EINVAL,
  304. .enabled_at_boot = 1,
  305. .init_data = &igep2_vmmc2,
  306. };
  307.  
  308. static struct platform_device igep2_vwlan_device = {
  309. .name = "reg-fixed-voltage",
  310. .id = 0,
  311. .dev = {
  312. .platform_data = &igep2_vwlan,
  313. },
  314. };
  315.  
  316. static struct omap2_hsmmc_info mmc[] = {
  317. {
  318. .mmc = 1,
  319. .wires = 4,
  320. .gpio_cd = -EINVAL,
  321. .gpio_wp = -EINVAL,
  322. },
  323. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  324. {
  325. .mmc = 2,
  326. .wires = 4,
  327. .gpio_cd = -EINVAL,
  328. .gpio_wp = -EINVAL,
  329. },
  330. #endif
  331. {} /* Terminator */
  332. };
  333.  
  334. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  335. #include <linux/leds.h>
  336.  
  337. static struct gpio_led igep2_gpio_leds[] = {
  338. [0] = {
  339. .name = "gpio-led:red:d0",
  340. .gpio = IGEP2_GPIO_LED0_RED,
  341. .default_trigger = "default-off"
  342. },
  343. [1] = {
  344. .name = "gpio-led:green:d0",
  345. .gpio = IGEP2_GPIO_LED0_GREEN,
  346. .default_trigger = "default-off",
  347. },
  348. [2] = {
  349. .name = "gpio-led:red:d1",
  350. .gpio = IGEP2_GPIO_LED1_RED,
  351. .default_trigger = "default-off",
  352. },
  353. [3] = {
  354. .name = "gpio-led:green:d1",
  355. .default_trigger = "heartbeat",
  356. .gpio = -EINVAL, /* gets replaced */
  357. },
  358. };
  359.  
  360. static struct gpio_led_platform_data igep2_led_pdata = {
  361. .leds = igep2_gpio_leds,
  362. .num_leds = ARRAY_SIZE(igep2_gpio_leds),
  363. };
  364.  
  365. static struct platform_device igep2_led_device = {
  366. .name = "leds-gpio",
  367. .id = -1,
  368. .dev = {
  369. .platform_data = &igep2_led_pdata,
  370. },
  371. };
  372.  
  373. static void __init igep2_leds_init(void)
  374. {
  375. platform_device_register(&igep2_led_device);
  376. }
  377.  
  378. #else
  379. static inline void igep2_leds_init(void)
  380. {
  381. if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
  382. (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
  383. gpio_export(IGEP2_GPIO_LED0_RED, 0);
  384. gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
  385. } else
  386. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
  387.  
  388. if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
  389. (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
  390. gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
  391. gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
  392. } else
  393. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
  394.  
  395. if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
  396. (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
  397. gpio_export(IGEP2_GPIO_LED1_RED, 0);
  398. gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
  399. } else
  400. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
  401.  
  402. }
  403. #endif
  404.  
  405.  
  406. static struct spi_board_info igep2_b_spi_board_info[] __initdata = {
  407. {
  408. .modalias = "spidev",
  409. .bus_num = 1,
  410. .chip_select = 3,
  411. .max_speed_hz = 20000000,
  412. .mode = SPI_MODE_2,
  413. },
  414. };
  415.  
  416. static struct spi_board_info igep2_spi_board_info[] __initdata = {
  417. {
  418. .modalias = "spidev",
  419. .bus_num = 2,
  420. .chip_select = 0,
  421. .max_speed_hz = 20000000,
  422. .mode = SPI_MODE_2,
  423. },
  424. };
  425.  
  426. static int igep2_twl_gpio_setup(struct device *dev,
  427. unsigned gpio, unsigned ngpio)
  428. {
  429. /* gpio + 0 is "mmc0_cd" (input/IRQ) */
  430. mmc[0].gpio_cd = gpio + 0;
  431. omap2_hsmmc_init(mmc);
  432.  
  433. /*
  434. * REVISIT: need ehci-omap hooks for external VBUS
  435. * power switch and overcurrent detect
  436. */
  437. gpio_request(gpio + 1, "GPIO_EHCI_NOC");
  438. gpio_direction_input(gpio + 1);
  439.  
  440. /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
  441. gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USB_CPEN");
  442. gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
  443.  
  444. /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
  445. #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
  446. if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0)
  447. && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) {
  448. gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
  449. gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0);
  450. } else
  451. pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
  452. #else
  453. igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
  454. #endif
  455.  
  456. return 0;
  457. };
  458.  
  459. static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
  460. .gpio_base = OMAP_MAX_GPIO_LINES,
  461. .irq_base = TWL4030_GPIO_IRQ_BASE,
  462. .irq_end = TWL4030_GPIO_IRQ_END,
  463. .use_leds = true,
  464. .setup = igep2_twl_gpio_setup,
  465. };
  466.  
  467. static struct twl4030_usb_data igep2_usb_data = {
  468. .usb_mode = T2_USB_MODE_ULPI,
  469. };
  470.  
  471. static int igep2_enable_dvi(struct omap_dss_device *dssdev)
  472. {
  473. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
  474.  
  475. return 0;
  476. }
  477.  
  478. static void igep2_disable_dvi(struct omap_dss_device *dssdev)
  479. {
  480. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
  481. }
  482.  
  483. static struct omap_dss_device igep2_dvi_device = {
  484. .type = OMAP_DISPLAY_TYPE_DPI,
  485. .name = "dvi",
  486. .driver_name = "generic_panel",
  487. .phy.dpi.data_lines = 24,
  488. .platform_enable = igep2_enable_dvi,
  489. .platform_disable = igep2_disable_dvi,
  490. };
  491.  
  492. /* Powertip 4.3 inch (480 x RGB x 272) TFT with Touch-Panel */
  493. static struct omap_dss_device igep0022_lcd43_device = {
  494. .type = OMAP_DISPLAY_TYPE_DPI,
  495. .name = "lcd-43",
  496. .driver_name = "ph480272t",
  497. .phy.dpi.data_lines = 24,
  498. };
  499.  
  500. /* Seiko 7.0 inch WVGA (800 x RGB x 480) TFT with Touch-Panel */
  501. static struct omap_dss_device igep0022_lcd70_device = {
  502. .type = OMAP_DISPLAY_TYPE_DPI,
  503. .name = "lcd-70",
  504. .driver_name = "70wvw1tz3",
  505. .phy.dpi.data_lines = 24,
  506. };
  507.  
  508. static struct omap_dss_device *igep2_dss_devices[] = {
  509. &igep2_dvi_device,
  510. &igep0022_lcd43_device,
  511. &igep0022_lcd70_device,
  512. };
  513.  
  514. static struct omap_dss_board_info igep2_dss_data = {
  515. .num_devices = ARRAY_SIZE(igep2_dss_devices),
  516. .devices = igep2_dss_devices,
  517. .default_device = &igep2_dvi_device,
  518. };
  519.  
  520. static struct platform_device igep2_dss_device = {
  521. .name = "omapdss",
  522. .id = -1,
  523. .dev = {
  524. .platform_data = &igep2_dss_data,
  525. },
  526. };
  527.  
  528. static struct regulator_consumer_supply igep2_vpll2_supply = {
  529. .supply = "vdds_dsi",
  530. .dev = &igep2_dss_device.dev,
  531. };
  532.  
  533. static struct regulator_init_data igep2_vpll2 = {
  534. .constraints = {
  535. .name = "VDVI",
  536. .min_uV = 1800000,
  537. .max_uV = 1800000,
  538. .apply_uV = true,
  539. .valid_modes_mask = REGULATOR_MODE_NORMAL
  540. | REGULATOR_MODE_STANDBY,
  541. .valid_ops_mask = REGULATOR_CHANGE_MODE
  542. | REGULATOR_CHANGE_STATUS,
  543. },
  544. .num_consumer_supplies = 1,
  545. .consumer_supplies = &igep2_vpll2_supply,
  546. };
  547.  
  548. static void __init igep2_display_init(void)
  549. {
  550. if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
  551. gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
  552. pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
  553. }
  554.  
  555. static struct platform_device *igep2_devices[] __initdata = {
  556. &igep2_dss_device,
  557. &igep2_vwlan_device,
  558. };
  559.  
  560. static void __init igep2_init_irq(void)
  561. {
  562. omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
  563. omap_init_irq();
  564. omap_gpio_init();
  565. }
  566.  
  567. static struct twl4030_codec_audio_data igep2_audio_data = {
  568. .audio_mclk = 26000000,
  569. };
  570.  
  571. static struct twl4030_codec_data igep2_codec_data = {
  572. .audio_mclk = 26000000,
  573. .audio = &igep2_audio_data,
  574. };
  575.  
  576. static int igep2_keymap[] = {
  577. KEY(0, 0, KEY_LEFT),
  578. KEY(0, 1, KEY_RIGHT),
  579. KEY(0, 2, KEY_A),
  580. KEY(0, 3, KEY_B),
  581. KEY(1, 0, KEY_DOWN),
  582. KEY(1, 1, KEY_UP),
  583. KEY(1, 2, KEY_E),
  584. KEY(1, 3, KEY_F),
  585. KEY(2, 0, KEY_ENTER),
  586. KEY(2, 1, KEY_I),
  587. KEY(2, 2, KEY_J),
  588. KEY(2, 3, KEY_K),
  589. KEY(3, 0, KEY_M),
  590. KEY(3, 1, KEY_N),
  591. KEY(3, 2, KEY_O),
  592. KEY(3, 3, KEY_P)
  593. };
  594.  
  595. static struct matrix_keymap_data igep2_keymap_data = {
  596. .keymap = igep2_keymap,
  597. .keymap_size = ARRAY_SIZE(igep2_keymap),
  598. };
  599.  
  600. static struct twl4030_keypad_data igep2_twl4030_keypad_data = {
  601. .keymap_data = &igep2_keymap_data,
  602. .rows = 4,
  603. .cols = 4,
  604. .rep = 1,
  605. };
  606.  
  607. static struct twl4030_madc_platform_data igep2_twl4030_madc_pdata = {
  608. .irq_line = 1,
  609. };
  610.  
  611. static struct twl4030_platform_data igep2_twldata = {
  612. .irq_base = TWL4030_IRQ_BASE,
  613. .irq_end = TWL4030_IRQ_END,
  614.  
  615. /* platform_data for children goes here */
  616. .usb = &igep2_usb_data,
  617. .codec = &igep2_codec_data,
  618. .gpio = &igep2_twl4030_gpio_pdata,
  619. .keypad = &igep2_twl4030_keypad_data,
  620. .madc = &igep2_twl4030_madc_pdata,
  621. .vmmc1 = &igep2_vmmc1,
  622. .vpll2 = &igep2_vpll2,
  623. .vio = &igep2_vio,
  624. };
  625.  
  626. static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
  627. {
  628. I2C_BOARD_INFO("twl4030", 0x48),
  629. .flags = I2C_CLIENT_WAKE,
  630. .irq = INT_34XX_SYS_NIRQ,
  631. .platform_data = &igep2_twldata,
  632. },
  633. };
  634.  
  635. static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
  636. {
  637. I2C_BOARD_INFO("eeprom", 0x50),
  638. },
  639. };
  640.  
  641. static int __init igep2_i2c_init(void)
  642. {
  643. omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
  644. ARRAY_SIZE(igep2_i2c1_boardinfo));
  645.  
  646. /*
  647. * Bus 3 is attached to the DVI port where devices like the pico DLP
  648. * projector don't work reliably with 400kHz
  649. */
  650. omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
  651. ARRAY_SIZE(igep2_i2c3_boardinfo));
  652.  
  653. return 0;
  654. }
  655.  
  656. static struct omap_musb_board_data musb_board_data = {
  657. .interface_type = MUSB_INTERFACE_ULPI,
  658. .mode = MUSB_OTG,
  659. .power = 100,
  660. };
  661.  
  662. static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
  663. .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
  664. .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  665. .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
  666.  
  667. .phy_reset = true,
  668. .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
  669. .reset_gpio_port[1] = -EINVAL,
  670. .reset_gpio_port[2] = -EINVAL,
  671. };
  672.  
  673. #ifdef CONFIG_OMAP_MUX
  674. static struct omap_board_mux board_mux[] __initdata = {
  675. { .reg_offset = OMAP_MUX_TERMINATOR },
  676. };
  677. #else
  678. #define board_mux NULL
  679. #endif
  680.  
  681. #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
  682.  
  683. static void __init igep2_wlan_bt_init(void)
  684. {
  685. unsigned npd, wreset, btreset;
  686.  
  687. /* GPIO's for WLAN-BT combo depends on hardware revision */
  688. if (hwrev == IGEP2_BOARD_HWREV_B) {
  689. npd = IGEP2_RB_GPIO_WIFI_NPD;
  690. wreset = IGEP2_RB_GPIO_WIFI_NRESET;
  691. btreset = IGEP2_RB_GPIO_BT_NRESET;
  692. } else if (hwrev == IGEP2_BOARD_HWREV_C) {
  693. npd = IGEP2_RC_GPIO_WIFI_NPD;
  694. wreset = IGEP2_RC_GPIO_WIFI_NRESET;
  695. btreset = IGEP2_RC_GPIO_BT_NRESET;
  696. } else
  697. return;
  698.  
  699. /* Set GPIO's for WLAN-BT combo module */
  700. if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
  701. (gpio_direction_output(npd, 1) == 0)) {
  702. gpio_export(npd, 0);
  703. } else
  704. pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
  705.  
  706. if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
  707. (gpio_direction_output(wreset, 1) == 0)) {
  708. gpio_export(wreset, 0);
  709. gpio_set_value(wreset, 0);
  710. udelay(10);
  711. gpio_set_value(wreset, 1);
  712. } else
  713. pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
  714.  
  715. if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
  716. (gpio_direction_output(btreset, 1) == 0)) {
  717. gpio_export(btreset, 0);
  718. } else
  719. pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
  720. }
  721. #else
  722. static inline void igep2_wlan_bt_init(void) { }
  723. #endif
  724.  
  725. #include <linux/videodev2.h>
  726.  
  727.  
  728.  
  729. #include "../../../drivers/media/video/isp/isp.h"
  730.  
  731. #include "../../../drivers/media/video/isp/ispreg.h"
  732.  
  733.  
  734.  
  735. static struct i2c_board_info igep0022_camera_i2c_devices[] = {
  736.  
  737. {
  738.  
  739. I2C_BOARD_INFO("tvp5150", (0xb8 >> 1)),
  740.  
  741. /* .platform_data = &rx51_et8ek8_platform_data, */
  742.  
  743. },
  744.  
  745. };
  746.  
  747.  
  748.  
  749. static struct isp_subdev_i2c_board_info igep0022_camera_primary_subdevs[] = {
  750.  
  751. {
  752.  
  753. .board_info = &igep0022_camera_i2c_devices[0],
  754.  
  755. .i2c_adapter_id = 2,
  756.  
  757. },
  758.  
  759. { NULL, 0, },
  760.  
  761. };
  762.  
  763.  
  764.  
  765. static struct isp_v4l2_subdevs_group igep0022_camera_subdevs[] = {
  766.  
  767. {
  768.  
  769. .subdevs = igep0022_camera_primary_subdevs,
  770.  
  771. .interface = ISP_INTERFACE_PARALLEL,
  772.  
  773. .bus = { .parallel = {
  774.  
  775. .width = 8,
  776.  
  777. .data_lane_shift = 0,
  778.  
  779. .clk_pol = 0,
  780.  
  781. .bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
  782.  
  783. } },
  784.  
  785. },
  786.  
  787. { NULL, 0, },
  788.  
  789. };
  790.  
  791.  
  792.  
  793. static struct isp_platform_data igep0022_isp_pdata = {
  794.  
  795. .subdevs = igep0022_camera_subdevs,
  796.  
  797. };
  798.  
  799. /* Expansion board: IGEP0022 */
  800. extern void __init igep0022_init(void);
  801.  
  802. static void __init igep2_init(void)
  803. {
  804. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  805.  
  806. /* Get IGEP2 hardware revision */
  807. igep2_get_revision();
  808. /* Register I2C busses and drivers */
  809. igep2_i2c_init();
  810. platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
  811. if (hwrev == IGEP2_BOARD_HWREV_B)
  812. spi_register_board_info(igep2_b_spi_board_info,
  813. ARRAY_SIZE(igep2_b_spi_board_info));
  814. else
  815. spi_register_board_info(igep2_spi_board_info,
  816. ARRAY_SIZE(igep2_spi_board_info));
  817. omap_serial_init();
  818. usb_musb_init(&musb_board_data);
  819. usb_ehci_init(&ehci_pdata);
  820.  
  821. igep2_flash_init();
  822. igep2_leds_init();
  823. igep2_display_init();
  824. igep2_init_smsc911x();
  825.  
  826. /*
  827. * WLAN-BT combo module from MuRata wich has a Marvell WLAN
  828. * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
  829. */
  830. igep2_wlan_bt_init();
  831.  
  832. /* Expansion board: IGEP0022 */
  833. igep0022_init();
  834.  
  835. /* Camera interface */
  836.  
  837. if (omap3_init_camera(&igep0022_isp_pdata) < 0)
  838.  
  839. pr_warning("IGEP2: Unable to register camera platform \n");
  840. }
  841.  
  842. MACHINE_START(IGEP0020, "IGEP v2 board")
  843. .phys_io = 0x48000000,
  844. .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
  845. .boot_params = 0x80000100,
  846. .map_io = omap3_map_io,
  847. .reserve = omap_reserve,
  848. .init_irq = igep2_init_irq,
  849. .init_machine = igep2_init,
  850. .timer = &omap_timer,
  851. MACHINE_END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement