board-mop500.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*
  2. * Copyright (C) 2008-2009 ST-Ericsson
  3. *
  4. * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
  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/interrupt.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/io.h>
  16. #include <linux/i2c.h>
  17. #include <linux/gpio.h>
  18. #include <linux/amba/bus.h>
  19. #include <linux/amba/pl022.h>
  20. #include <linux/spi/spi.h>
  21. #include <linux/mfd/ab8500.h>
  22. #include <linux/mfd/tc3589x.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <plat/pincfg.h>
  26. #include <plat/i2c.h>
  27. #include <mach/hardware.h>
  28. #include <mach/setup.h>
  29. #include <mach/devices.h>
  30. #include <mach/irqs.h>
  31. #include "devices-db8500.h"
  32. #include "pins-db8500.h"
  33. #include "board-mop500.h"
  34. #include "board-mop500-regulators.h"
  35. static pin_cfg_t mop500_pins[] = {
  36. /* SSP0 */
  37. GPIO143_SSP0_CLK,
  38. GPIO144_SSP0_FRM,
  39. GPIO145_SSP0_RXD,
  40. GPIO146_SSP0_TXD,
  41. /* I2C */
  42. GPIO147_I2C0_SCL,
  43. GPIO148_I2C0_SDA,
  44. GPIO16_I2C1_SCL,
  45. GPIO17_I2C1_SDA,
  46. GPIO10_I2C2_SDA,
  47. GPIO11_I2C2_SCL,
  48. GPIO229_I2C3_SDA,
  49. GPIO230_I2C3_SCL,
  50. /* SKE keypad */
  51. GPIO153_KP_I7,
  52. GPIO154_KP_I6,
  53. GPIO155_KP_I5,
  54. GPIO156_KP_I4,
  55. GPIO157_KP_O7,
  56. GPIO158_KP_O6,
  57. GPIO159_KP_O5,
  58. GPIO160_KP_O4,
  59. GPIO161_KP_I3,
  60. GPIO162_KP_I2,
  61. GPIO163_KP_I1,
  62. GPIO164_KP_I0,
  63. GPIO165_KP_O3,
  64. GPIO166_KP_O2,
  65. GPIO167_KP_O1,
  66. GPIO168_KP_O0,
  67. /* GPIO_EXP_INT */
  68. GPIO217_GPIO,
  69. /* STMPE1601 IRQ */
  70. GPIO218_GPIO | PIN_INPUT_PULLUP,
  71. };
  72. static struct ab8500_platform_data ab8500_platdata = {
  73. .irq_base = MOP500_AB8500_IRQ_BASE,
  74. .regulator = ab8500_regulators,
  75. .num_regulator = ARRAY_SIZE(ab8500_regulators),
  76. };
  77. static struct resource ab8500_resources[] = {
  78. [0] = {
  79. .start = IRQ_DB8500_AB8500,
  80. .end = IRQ_DB8500_AB8500,
  81. .flags = IORESOURCE_IRQ
  82. }
  83. };
  84. struct platform_device ab8500_device = {
  85. .name = "ab8500-i2c",
  86. .id = 0,
  87. .dev = {
  88. .platform_data = &ab8500_platdata,
  89. },
  90. .num_resources = 1,
  91. .resource = ab8500_resources,
  92. };
  93. static struct pl022_ssp_controller ssp0_platform_data = {
  94. .bus_id = 0,
  95. /* pl022 not yet supports dma */
  96. .enable_dma = 0,
  97. /* on this platform, gpio 31,142,144,214 &
  98. * 224 are connected as chip selects
  99. */
  100. .num_chipselect = 5,
  101. };
  102. /*
  103. * TC35892
  104. */
  105. static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
  106. {
  107. mop500_sdi_tc35892_init();
  108. }
  109. static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
  110. .gpio_base = MOP500_EGPIO(0),
  111. .setup = mop500_tc35892_init,
  112. };
  113. static struct tc3589x_platform_data mop500_tc35892_data = {
  114. .block = TC3589x_BLOCK_GPIO,
  115. .gpio = &mop500_tc35892_gpio_data,
  116. .irq_base = MOP500_EGPIO_IRQ_BASE,
  117. };
  118. static struct i2c_board_info mop500_i2c0_devices[] = {
  119. {
  120. I2C_BOARD_INFO("tc3589x", 0x42),
  121. .irq = NOMADIK_GPIO_TO_IRQ(217),
  122. .platform_data = &mop500_tc35892_data,
  123. },
  124. };
  125. #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
  126. static struct nmk_i2c_controller u8500_i2c##id##_data = { \
  127. /* \
  128. * slave data setup time, which is \
  129. * 250 ns,100ns,10ns which is 14,6,2 \
  130. * respectively for a 48 Mhz \
  131. * i2c clock \
  132. */ \
  133. .slsu = _slsu, \
  134. /* Tx FIFO threshold */ \
  135. .tft = _tft, \
  136. /* Rx FIFO threshold */ \
  137. .rft = _rft, \
  138. /* std. mode operation */ \
  139. .clk_freq = clk, \
  140. .sm = _sm, \
  141. }
  142. /*
  143. * The board uses 4 i2c controllers, initialize all of
  144. * them with slave data setup time of 250 ns,
  145. * Tx & Rx FIFO threshold values as 1 and standard
  146. * mode of operation
  147. */
  148. U8500_I2C_CONTROLLER(0, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  149. U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  150. U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  151. U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  152. static void __init mop500_i2c_init(void)
  153. {
  154. db8500_add_i2c0(&u8500_i2c0_data);
  155. db8500_add_i2c1(&u8500_i2c1_data);
  156. db8500_add_i2c2(&u8500_i2c2_data);
  157. db8500_add_i2c3(&u8500_i2c3_data);
  158. }
  159. /* add any platform devices here - TODO */
  160. static struct platform_device *platform_devs[] __initdata = {
  161. };
  162. static void __init mop500_spi_init(void)
  163. {
  164. db8500_add_ssp0(&ssp0_platform_data);
  165. }
  166. static void __init mop500_uart_init(void)
  167. {
  168. db8500_add_uart0();
  169. db8500_add_uart1();
  170. db8500_add_uart2();
  171. }
  172. static void __init u8500_init_machine(void)
  173. {
  174. u8500_init_devices();
  175. nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins));
  176. platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
  177. mop500_i2c_init();
  178. mop500_sdi_init();
  179. mop500_spi_init();
  180. mop500_uart_init();
  181. mop500_keypad_init();
  182. platform_device_register(&ab8500_device);
  183. i2c_register_board_info(0, mop500_i2c0_devices,
  184. ARRAY_SIZE(mop500_i2c0_devices));
  185. }
  186. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  187. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  188. .boot_params = 0x100,
  189. .map_io = u8500_map_io,
  190. .init_irq = ux500_init_irq,
  191. /* we re-use nomadik timer here */
  192. .timer = &ux500_timer,
  193. .init_machine = u8500_init_machine,
  194. MACHINE_END