board-mop500.c 4.9 KB

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