board-ldp.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * linux/arch/arm/mach-omap2/board-ldp.c
  3. *
  4. * Copyright (C) 2008 Texas Instruments Inc.
  5. * Nishant Kamat <nskamat@ti.com>
  6. *
  7. * Modified from mach-omap2/board-3430sdp.c
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/delay.h>
  17. #include <linux/input.h>
  18. #include <linux/workqueue.h>
  19. #include <linux/err.h>
  20. #include <linux/clk.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/spi/ads7846.h>
  23. #include <linux/i2c/twl4030.h>
  24. #include <linux/io.h>
  25. #include <linux/smsc911x.h>
  26. #include <mach/hardware.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <mach/mcspi.h>
  31. #include <mach/gpio.h>
  32. #include <mach/board.h>
  33. #include <mach/common.h>
  34. #include <mach/gpmc.h>
  35. #include <asm/delay.h>
  36. #include <mach/control.h>
  37. #include <mach/usb.h>
  38. #include "mmc-twl4030.h"
  39. #define LDP_SMSC911X_CS 1
  40. #define LDP_SMSC911X_GPIO 152
  41. #define DEBUG_BASE 0x08000000
  42. #define LDP_ETHR_START DEBUG_BASE
  43. static struct resource ldp_smsc911x_resources[] = {
  44. [0] = {
  45. .start = LDP_ETHR_START,
  46. .end = LDP_ETHR_START + SZ_4K,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. [1] = {
  50. .start = 0,
  51. .end = 0,
  52. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  53. },
  54. };
  55. static struct smsc911x_platform_config ldp_smsc911x_config = {
  56. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  57. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  58. .flags = SMSC911X_USE_32BIT,
  59. .phy_interface = PHY_INTERFACE_MODE_MII,
  60. };
  61. static struct platform_device ldp_smsc911x_device = {
  62. .name = "smsc911x",
  63. .id = -1,
  64. .num_resources = ARRAY_SIZE(ldp_smsc911x_resources),
  65. .resource = ldp_smsc911x_resources,
  66. .dev = {
  67. .platform_data = &ldp_smsc911x_config,
  68. },
  69. };
  70. static inline void __init ldp_init_smsc911x(void)
  71. {
  72. int eth_cs;
  73. unsigned long cs_mem_base;
  74. int eth_gpio = 0;
  75. eth_cs = LDP_SMSC911X_CS;
  76. if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
  77. printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n");
  78. return;
  79. }
  80. ldp_smsc911x_resources[0].start = cs_mem_base + 0x0;
  81. ldp_smsc911x_resources[0].end = cs_mem_base + 0xff;
  82. udelay(100);
  83. eth_gpio = LDP_SMSC911X_GPIO;
  84. ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
  85. if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
  86. printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
  87. eth_gpio);
  88. return;
  89. }
  90. gpio_direction_input(eth_gpio);
  91. }
  92. static void __init omap_ldp_init_irq(void)
  93. {
  94. omap2_init_common_hw(NULL);
  95. omap_init_irq();
  96. omap_gpio_init();
  97. ldp_init_smsc911x();
  98. }
  99. static struct omap_uart_config ldp_uart_config __initdata = {
  100. .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
  101. };
  102. static struct platform_device ldp_lcd_device = {
  103. .name = "ldp_lcd",
  104. .id = -1,
  105. };
  106. static struct omap_lcd_config ldp_lcd_config __initdata = {
  107. .ctrl_name = "internal",
  108. };
  109. static struct omap_board_config_kernel ldp_config[] __initdata = {
  110. { OMAP_TAG_UART, &ldp_uart_config },
  111. { OMAP_TAG_LCD, &ldp_lcd_config },
  112. };
  113. static struct twl4030_gpio_platform_data ldp_gpio_data = {
  114. .gpio_base = OMAP_MAX_GPIO_LINES,
  115. .irq_base = TWL4030_GPIO_IRQ_BASE,
  116. .irq_end = TWL4030_GPIO_IRQ_END,
  117. };
  118. static struct twl4030_platform_data ldp_twldata = {
  119. .irq_base = TWL4030_IRQ_BASE,
  120. .irq_end = TWL4030_IRQ_END,
  121. /* platform_data for children goes here */
  122. .gpio = &ldp_gpio_data,
  123. };
  124. static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
  125. {
  126. I2C_BOARD_INFO("twl4030", 0x48),
  127. .flags = I2C_CLIENT_WAKE,
  128. .irq = INT_34XX_SYS_NIRQ,
  129. .platform_data = &ldp_twldata,
  130. },
  131. };
  132. static int __init omap_i2c_init(void)
  133. {
  134. omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
  135. ARRAY_SIZE(ldp_i2c_boardinfo));
  136. omap_register_i2c_bus(2, 400, NULL, 0);
  137. omap_register_i2c_bus(3, 400, NULL, 0);
  138. return 0;
  139. }
  140. static struct twl4030_hsmmc_info mmc[] __initdata = {
  141. {
  142. .mmc = 1,
  143. .wires = 4,
  144. .gpio_cd = -EINVAL,
  145. .gpio_wp = -EINVAL,
  146. },
  147. {} /* Terminator */
  148. };
  149. static struct platform_device *ldp_devices[] __initdata = {
  150. &ldp_smsc911x_device,
  151. &ldp_lcd_device,
  152. };
  153. static void __init omap_ldp_init(void)
  154. {
  155. omap_i2c_init();
  156. platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
  157. omap_board_config = ldp_config;
  158. omap_board_config_size = ARRAY_SIZE(ldp_config);
  159. omap_serial_init();
  160. twl4030_mmc_init(mmc);
  161. usb_musb_init();
  162. }
  163. static void __init omap_ldp_map_io(void)
  164. {
  165. omap2_set_globals_343x();
  166. omap2_map_common_io();
  167. }
  168. MACHINE_START(OMAP_LDP, "OMAP LDP board")
  169. .phys_io = 0x48000000,
  170. .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
  171. .boot_params = 0x80000100,
  172. .map_io = omap_ldp_map_io,
  173. .init_irq = omap_ldp_init_irq,
  174. .init_machine = omap_ldp_init,
  175. .timer = &omap_timer,
  176. MACHINE_END