board-mop500.c 4.0 KB

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