board-mop500.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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/localtimer.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <plat/mtu.h>
  23. #include <mach/hardware.h>
  24. #include <mach/setup.h>
  25. #define __MEM_4K_RESOURCE(x) \
  26. .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
  27. /* These are active devices on this board */
  28. static struct amba_device uart0_device = {
  29. .dev = { .init_name = "uart0" },
  30. __MEM_4K_RESOURCE(U8500_UART0_BASE),
  31. .irq = {IRQ_UART0, NO_IRQ},
  32. };
  33. static struct amba_device uart1_device = {
  34. .dev = { .init_name = "uart1" },
  35. __MEM_4K_RESOURCE(U8500_UART1_BASE),
  36. .irq = {IRQ_UART1, NO_IRQ},
  37. };
  38. static struct amba_device uart2_device = {
  39. .dev = { .init_name = "uart2" },
  40. __MEM_4K_RESOURCE(U8500_UART2_BASE),
  41. .irq = {IRQ_UART2, NO_IRQ},
  42. };
  43. static void ab4500_spi_cs_control(u32 command)
  44. {
  45. /* set the FRM signal, which is CS - TODO */
  46. }
  47. struct pl022_config_chip ab4500_chip_info = {
  48. .lbm = LOOPBACK_DISABLED,
  49. .com_mode = INTERRUPT_TRANSFER,
  50. .iface = SSP_INTERFACE_MOTOROLA_SPI,
  51. /* we can act as master only */
  52. .hierarchy = SSP_MASTER,
  53. .slave_tx_disable = 0,
  54. .endian_rx = SSP_RX_MSB,
  55. .endian_tx = SSP_TX_MSB,
  56. .data_size = SSP_DATA_BITS_24,
  57. .rx_lev_trig = SSP_RX_1_OR_MORE_ELEM,
  58. .tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC,
  59. .clk_phase = SSP_CLK_SECOND_EDGE,
  60. .clk_pol = SSP_CLK_POL_IDLE_HIGH,
  61. .cs_control = ab4500_spi_cs_control,
  62. };
  63. static struct spi_board_info u8500_spi_devices[] = {
  64. {
  65. .modalias = "ab4500",
  66. .controller_data = &ab4500_chip_info,
  67. .max_speed_hz = 12000000,
  68. .bus_num = 0,
  69. .chip_select = 0,
  70. .mode = SPI_MODE_0,
  71. .irq = IRQ_AB4500,
  72. },
  73. };
  74. static struct pl022_ssp_controller ssp0_platform_data = {
  75. .bus_id = 0,
  76. /* pl022 not yet supports dma */
  77. .enable_dma = 0,
  78. /* on this platform, gpio 31,142,144,214 &
  79. * 224 are connected as chip selects
  80. */
  81. .num_chipselect = 5,
  82. };
  83. static struct amba_device pl022_device = {
  84. .dev = {
  85. .coherent_dma_mask = ~0,
  86. .init_name = "pl022",
  87. .platform_data = &ssp0_platform_data,
  88. },
  89. .res = {
  90. .start = U8500_SSP0_BASE,
  91. .end = U8500_SSP0_BASE + SZ_4K - 1,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. .irq = {IRQ_SSP0, NO_IRQ },
  95. /* ST-Ericsson modified id */
  96. .periphid = SSP_PER_ID,
  97. };
  98. static struct amba_device *amba_devs[] __initdata = {
  99. &uart0_device,
  100. &uart1_device,
  101. &uart2_device,
  102. &pl022_device,
  103. };
  104. static void __init u8500_timer_init(void)
  105. {
  106. #ifdef CONFIG_LOCAL_TIMERS
  107. /* Setup the local timer base */
  108. twd_base = __io_address(U8500_TWD_BASE);
  109. #endif
  110. /* Setup the MTU base */
  111. mtu_base = __io_address(U8500_MTU0_BASE);
  112. nmdk_timer_init();
  113. }
  114. static struct sys_timer u8500_timer = {
  115. .init = u8500_timer_init,
  116. };
  117. static void __init u8500_init_machine(void)
  118. {
  119. int i;
  120. /* Register the active AMBA devices on this board */
  121. for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
  122. amba_device_register(amba_devs[i], &iomem_resource);
  123. spi_register_board_info(u8500_spi_devices,
  124. ARRAY_SIZE(u8500_spi_devices));
  125. u8500_init_devices();
  126. }
  127. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  128. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  129. .phys_io = U8500_UART2_BASE,
  130. .io_pg_offst = (IO_ADDRESS(U8500_UART2_BASE) >> 18) & 0xfffc,
  131. .boot_params = 0x100,
  132. .map_io = u8500_map_io,
  133. .init_irq = u8500_init_irq,
  134. /* we re-use nomadik timer here */
  135. .timer = &u8500_timer,
  136. .init_machine = u8500_init_machine,
  137. MACHINE_END