board-ldp.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 <mach/hardware.h>
  25. #include <asm/mach-types.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <mach/board-ldp.h>
  29. #include <mach/mcspi.h>
  30. #include <mach/gpio.h>
  31. #include <mach/board.h>
  32. #include <mach/common.h>
  33. #include <mach/gpmc.h>
  34. #include <asm/io.h>
  35. #include <asm/delay.h>
  36. #include <mach/control.h>
  37. #include "mmc-twl4030.h"
  38. #define SDP3430_SMC91X_CS 3
  39. static struct resource ldp_smc911x_resources[] = {
  40. [0] = {
  41. .start = OMAP34XX_ETHR_START,
  42. .end = OMAP34XX_ETHR_START + SZ_4K,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. .start = 0,
  47. .end = 0,
  48. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  49. },
  50. };
  51. static struct platform_device ldp_smc911x_device = {
  52. .name = "smc911x",
  53. .id = -1,
  54. .num_resources = ARRAY_SIZE(ldp_smc911x_resources),
  55. .resource = ldp_smc911x_resources,
  56. };
  57. static struct platform_device *ldp_devices[] __initdata = {
  58. &ldp_smc911x_device,
  59. };
  60. static inline void __init ldp_init_smc911x(void)
  61. {
  62. int eth_cs;
  63. unsigned long cs_mem_base;
  64. int eth_gpio = 0;
  65. eth_cs = LDP_SMC911X_CS;
  66. if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
  67. printk(KERN_ERR "Failed to request GPMC mem for smc911x\n");
  68. return;
  69. }
  70. ldp_smc911x_resources[0].start = cs_mem_base + 0x0;
  71. ldp_smc911x_resources[0].end = cs_mem_base + 0xff;
  72. udelay(100);
  73. eth_gpio = LDP_SMC911X_GPIO;
  74. ldp_smc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
  75. if (gpio_request(eth_gpio, "smc911x irq") < 0) {
  76. printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
  77. eth_gpio);
  78. return;
  79. }
  80. gpio_direction_input(eth_gpio);
  81. }
  82. static void __init omap_ldp_init_irq(void)
  83. {
  84. omap2_init_common_hw();
  85. omap_init_irq();
  86. omap_gpio_init();
  87. ldp_init_smc911x();
  88. }
  89. static struct omap_uart_config ldp_uart_config __initdata = {
  90. .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
  91. };
  92. static struct omap_board_config_kernel ldp_config[] __initdata = {
  93. { OMAP_TAG_UART, &ldp_uart_config },
  94. };
  95. static struct twl4030_gpio_platform_data ldp_gpio_data = {
  96. .gpio_base = OMAP_MAX_GPIO_LINES,
  97. .irq_base = TWL4030_GPIO_IRQ_BASE,
  98. .irq_end = TWL4030_GPIO_IRQ_END,
  99. };
  100. static struct twl4030_platform_data ldp_twldata = {
  101. .irq_base = TWL4030_IRQ_BASE,
  102. .irq_end = TWL4030_IRQ_END,
  103. /* platform_data for children goes here */
  104. .gpio = &ldp_gpio_data,
  105. };
  106. static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
  107. {
  108. I2C_BOARD_INFO("twl4030", 0x48),
  109. .flags = I2C_CLIENT_WAKE,
  110. .irq = INT_34XX_SYS_NIRQ,
  111. .platform_data = &ldp_twldata,
  112. },
  113. };
  114. static int __init omap_i2c_init(void)
  115. {
  116. omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
  117. ARRAY_SIZE(ldp_i2c_boardinfo));
  118. omap_register_i2c_bus(2, 400, NULL, 0);
  119. omap_register_i2c_bus(3, 400, NULL, 0);
  120. return 0;
  121. }
  122. static struct twl4030_hsmmc_info mmc[] __initdata = {
  123. {
  124. .mmc = 1,
  125. .wires = 4,
  126. .gpio_cd = -EINVAL,
  127. .gpio_wp = -EINVAL,
  128. },
  129. {} /* Terminator */
  130. };
  131. static void __init omap_ldp_init(void)
  132. {
  133. omap_i2c_init();
  134. platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
  135. omap_board_config = ldp_config;
  136. omap_board_config_size = ARRAY_SIZE(ldp_config);
  137. omap_serial_init();
  138. twl4030_mmc_init(mmc);
  139. }
  140. static void __init omap_ldp_map_io(void)
  141. {
  142. omap2_set_globals_343x();
  143. omap2_map_common_io();
  144. }
  145. MACHINE_START(OMAP_LDP, "OMAP LDP board")
  146. .phys_io = 0x48000000,
  147. .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
  148. .boot_params = 0x80000100,
  149. .map_io = omap_ldp_map_io,
  150. .init_irq = omap_ldp_init_irq,
  151. .init_machine = omap_ldp_init,
  152. .timer = &omap_timer,
  153. MACHINE_END