board-mop500.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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/gpio.h>
  17. #include <linux/amba/bus.h>
  18. #include <linux/amba/pl022.h>
  19. #include <linux/spi/spi.h>
  20. #include <linux/mfd/ab8500.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <plat/pincfg.h>
  24. #include <plat/i2c.h>
  25. #include <mach/hardware.h>
  26. #include <mach/setup.h>
  27. #include <mach/devices.h>
  28. #include "pins-db8500.h"
  29. #include "board-mop500.h"
  30. static pin_cfg_t mop500_pins[] = {
  31. /* SSP0 */
  32. GPIO143_SSP0_CLK,
  33. GPIO144_SSP0_FRM,
  34. GPIO145_SSP0_RXD,
  35. GPIO146_SSP0_TXD,
  36. /* I2C */
  37. GPIO147_I2C0_SCL,
  38. GPIO148_I2C0_SDA,
  39. GPIO16_I2C1_SCL,
  40. GPIO17_I2C1_SDA,
  41. GPIO10_I2C2_SDA,
  42. GPIO11_I2C2_SCL,
  43. GPIO229_I2C3_SDA,
  44. GPIO230_I2C3_SCL,
  45. };
  46. static void ab4500_spi_cs_control(u32 command)
  47. {
  48. /* set the FRM signal, which is CS - TODO */
  49. }
  50. struct pl022_config_chip ab4500_chip_info = {
  51. .lbm = LOOPBACK_DISABLED,
  52. .com_mode = INTERRUPT_TRANSFER,
  53. .iface = SSP_INTERFACE_MOTOROLA_SPI,
  54. /* we can act as master only */
  55. .hierarchy = SSP_MASTER,
  56. .slave_tx_disable = 0,
  57. .endian_rx = SSP_RX_MSB,
  58. .endian_tx = SSP_TX_MSB,
  59. .data_size = SSP_DATA_BITS_24,
  60. .rx_lev_trig = SSP_RX_1_OR_MORE_ELEM,
  61. .tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC,
  62. .clk_phase = SSP_CLK_SECOND_EDGE,
  63. .clk_pol = SSP_CLK_POL_IDLE_HIGH,
  64. .cs_control = ab4500_spi_cs_control,
  65. };
  66. static struct ab8500_platform_data ab8500_platdata = {
  67. .irq_base = MOP500_AB8500_IRQ_BASE,
  68. };
  69. static struct spi_board_info u8500_spi_devices[] = {
  70. {
  71. .modalias = "ab8500",
  72. .controller_data = &ab4500_chip_info,
  73. .platform_data = &ab8500_platdata,
  74. .max_speed_hz = 12000000,
  75. .bus_num = 0,
  76. .chip_select = 0,
  77. .mode = SPI_MODE_0,
  78. .irq = IRQ_DB8500_AB8500,
  79. },
  80. };
  81. static struct pl022_ssp_controller ssp0_platform_data = {
  82. .bus_id = 0,
  83. /* pl022 not yet supports dma */
  84. .enable_dma = 0,
  85. /* on this platform, gpio 31,142,144,214 &
  86. * 224 are connected as chip selects
  87. */
  88. .num_chipselect = 5,
  89. };
  90. #define U8500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
  91. static struct nmk_i2c_controller u8500_i2c##id##_data = { \
  92. /* \
  93. * slave data setup time, which is \
  94. * 250 ns,100ns,10ns which is 14,6,2 \
  95. * respectively for a 48 Mhz \
  96. * i2c clock \
  97. */ \
  98. .slsu = _slsu, \
  99. /* Tx FIFO threshold */ \
  100. .tft = _tft, \
  101. /* Rx FIFO threshold */ \
  102. .rft = _rft, \
  103. /* std. mode operation */ \
  104. .clk_freq = clk, \
  105. .sm = _sm, \
  106. }
  107. /*
  108. * The board uses 4 i2c controllers, initialize all of
  109. * them with slave data setup time of 250 ns,
  110. * Tx & Rx FIFO threshold values as 1 and standard
  111. * mode of operation
  112. */
  113. U8500_I2C_CONTROLLER(0, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  114. U8500_I2C_CONTROLLER(1, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  115. U8500_I2C_CONTROLLER(2, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  116. U8500_I2C_CONTROLLER(3, 0xe, 1, 1, 100000, I2C_FREQ_MODE_STANDARD);
  117. static struct amba_device *amba_devs[] __initdata = {
  118. &ux500_uart0_device,
  119. &ux500_uart1_device,
  120. &ux500_uart2_device,
  121. &u8500_ssp0_device,
  122. };
  123. /* add any platform devices here - TODO */
  124. static struct platform_device *platform_devs[] __initdata = {
  125. &u8500_i2c0_device,
  126. &ux500_i2c1_device,
  127. &ux500_i2c2_device,
  128. &ux500_i2c3_device,
  129. };
  130. static void __init u8500_init_machine(void)
  131. {
  132. int i;
  133. u8500_init_devices();
  134. nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins));
  135. u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data;
  136. ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data;
  137. ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data;
  138. ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data;
  139. u8500_ssp0_device.dev.platform_data = &ssp0_platform_data;
  140. /* Register the active AMBA devices on this board */
  141. for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
  142. amba_device_register(amba_devs[i], &iomem_resource);
  143. platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
  144. mop500_sdi_init();
  145. spi_register_board_info(u8500_spi_devices,
  146. ARRAY_SIZE(u8500_spi_devices));
  147. }
  148. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  149. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  150. .phys_io = U8500_UART2_BASE,
  151. .io_pg_offst = (IO_ADDRESS(U8500_UART2_BASE) >> 18) & 0xfffc,
  152. .boot_params = 0x100,
  153. .map_io = u8500_map_io,
  154. .init_irq = ux500_init_irq,
  155. /* we re-use nomadik timer here */
  156. .timer = &ux500_timer,
  157. .init_machine = u8500_init_machine,
  158. MACHINE_END