board-mop500.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * Copyright (C) 2008-2012 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/clk.h>
  16. #include <linux/io.h>
  17. #include <linux/platform_data/db8500_thermal.h>
  18. #include <linux/gpio.h>
  19. #include <linux/amba/bus.h>
  20. #include <linux/amba/pl022.h>
  21. #include <linux/amba/serial.h>
  22. #include <linux/spi/spi.h>
  23. #include <linux/mfd/abx500/ab8500.h>
  24. #include <linux/regulator/ab8500.h>
  25. #include <linux/regulator/fixed.h>
  26. #include <linux/regulator/driver.h>
  27. #include <linux/mfd/tps6105x.h>
  28. #include <linux/mfd/abx500/ab8500-gpio.h>
  29. #include <linux/platform_data/leds-lp55xx.h>
  30. #include <linux/input.h>
  31. #include <linux/delay.h>
  32. #include <linux/leds.h>
  33. #include <linux/pinctrl/consumer.h>
  34. #include <linux/platform_data/pinctrl-nomadik.h>
  35. #include <linux/platform_data/dma-ste-dma40.h>
  36. #include <asm/mach-types.h>
  37. #include "setup.h"
  38. #include "devices.h"
  39. #include "irqs.h"
  40. #include "ste-dma40-db8500.h"
  41. #include "db8500-regs.h"
  42. #include "devices-db8500.h"
  43. #include "board-mop500.h"
  44. #include "board-mop500-regulators.h"
  45. struct ab8500_platform_data ab8500_platdata = {
  46. .irq_base = MOP500_AB8500_IRQ_BASE,
  47. .regulator = &ab8500_regulator_plat_data,
  48. };
  49. #ifdef CONFIG_STE_DMA40
  50. static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
  51. .mode = STEDMA40_MODE_LOGICAL,
  52. .dir = DMA_DEV_TO_MEM,
  53. .dev_type = DB8500_DMA_DEV8_SSP0,
  54. };
  55. static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
  56. .mode = STEDMA40_MODE_LOGICAL,
  57. .dir = DMA_MEM_TO_DEV,
  58. .dev_type = DB8500_DMA_DEV8_SSP0,
  59. };
  60. #endif
  61. struct pl022_ssp_controller ssp0_plat = {
  62. .bus_id = 0,
  63. #ifdef CONFIG_STE_DMA40
  64. .enable_dma = 1,
  65. .dma_filter = stedma40_filter,
  66. .dma_rx_param = &ssp0_dma_cfg_rx,
  67. .dma_tx_param = &ssp0_dma_cfg_tx,
  68. #else
  69. .enable_dma = 0,
  70. #endif
  71. /* on this platform, gpio 31,142,144,214 &
  72. * 224 are connected as chip selects
  73. */
  74. .num_chipselect = 5,
  75. };
  76. static void __init mop500_spi_init(struct device *parent)
  77. {
  78. db8500_add_ssp0(parent, &ssp0_plat);
  79. }
  80. #ifdef CONFIG_STE_DMA40
  81. static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
  82. .mode = STEDMA40_MODE_LOGICAL,
  83. .dir = DMA_DEV_TO_MEM,
  84. .dev_type = DB8500_DMA_DEV13_UART0,
  85. };
  86. static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
  87. .mode = STEDMA40_MODE_LOGICAL,
  88. .dir = DMA_MEM_TO_DEV,
  89. .dev_type = DB8500_DMA_DEV13_UART0,
  90. };
  91. static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
  92. .mode = STEDMA40_MODE_LOGICAL,
  93. .dir = DMA_DEV_TO_MEM,
  94. .dev_type = DB8500_DMA_DEV12_UART1,
  95. };
  96. static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
  97. .mode = STEDMA40_MODE_LOGICAL,
  98. .dir = DMA_MEM_TO_DEV,
  99. .dev_type = DB8500_DMA_DEV12_UART1,
  100. };
  101. static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
  102. .mode = STEDMA40_MODE_LOGICAL,
  103. .dir = DMA_DEV_TO_MEM,
  104. .dev_type = DB8500_DMA_DEV11_UART2,
  105. };
  106. static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
  107. .mode = STEDMA40_MODE_LOGICAL,
  108. .dir = DMA_MEM_TO_DEV,
  109. .dev_type = DB8500_DMA_DEV11_UART2,
  110. };
  111. #endif
  112. struct amba_pl011_data uart0_plat = {
  113. #ifdef CONFIG_STE_DMA40
  114. .dma_filter = stedma40_filter,
  115. .dma_rx_param = &uart0_dma_cfg_rx,
  116. .dma_tx_param = &uart0_dma_cfg_tx,
  117. #endif
  118. };
  119. struct amba_pl011_data uart1_plat = {
  120. #ifdef CONFIG_STE_DMA40
  121. .dma_filter = stedma40_filter,
  122. .dma_rx_param = &uart1_dma_cfg_rx,
  123. .dma_tx_param = &uart1_dma_cfg_tx,
  124. #endif
  125. };
  126. struct amba_pl011_data uart2_plat = {
  127. #ifdef CONFIG_STE_DMA40
  128. .dma_filter = stedma40_filter,
  129. .dma_rx_param = &uart2_dma_cfg_rx,
  130. .dma_tx_param = &uart2_dma_cfg_tx,
  131. #endif
  132. };
  133. static void __init mop500_uart_init(struct device *parent)
  134. {
  135. db8500_add_uart0(parent, &uart0_plat);
  136. db8500_add_uart1(parent, &uart1_plat);
  137. db8500_add_uart2(parent, &uart2_plat);
  138. }
  139. static void __init mop500_init_machine(void)
  140. {
  141. struct device *parent = NULL;
  142. platform_device_register(&db8500_prcmu_device);
  143. mop500_pinmaps_init();
  144. parent = u8500_init_devices();
  145. mop500_spi_init(parent);
  146. mop500_uart_init(parent);
  147. /* This board has full regulator constraints */
  148. regulator_has_full_constraints();
  149. }
  150. static void __init snowball_init_machine(void)
  151. {
  152. struct device *parent = NULL;
  153. platform_device_register(&db8500_prcmu_device);
  154. snowball_pinmaps_init();
  155. parent = u8500_init_devices();
  156. mop500_spi_init(parent);
  157. mop500_uart_init(parent);
  158. /* This board has full regulator constraints */
  159. regulator_has_full_constraints();
  160. }
  161. static void __init hrefv60_init_machine(void)
  162. {
  163. struct device *parent = NULL;
  164. platform_device_register(&db8500_prcmu_device);
  165. hrefv60_pinmaps_init();
  166. parent = u8500_init_devices();
  167. mop500_spi_init(parent);
  168. mop500_uart_init(parent);
  169. /* This board has full regulator constraints */
  170. regulator_has_full_constraints();
  171. }
  172. MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
  173. /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
  174. .atag_offset = 0x100,
  175. .smp = smp_ops(ux500_smp_ops),
  176. .map_io = u8500_map_io,
  177. .init_irq = ux500_init_irq,
  178. /* we re-use nomadik timer here */
  179. .init_time = ux500_timer_init,
  180. .init_machine = mop500_init_machine,
  181. .init_late = ux500_init_late,
  182. .restart = ux500_restart,
  183. MACHINE_END
  184. MACHINE_START(U8520, "ST-Ericsson U8520 Platform HREFP520")
  185. .atag_offset = 0x100,
  186. .map_io = u8500_map_io,
  187. .init_irq = ux500_init_irq,
  188. .init_time = ux500_timer_init,
  189. .init_machine = mop500_init_machine,
  190. .init_late = ux500_init_late,
  191. .restart = ux500_restart,
  192. MACHINE_END
  193. MACHINE_START(HREFV60, "ST-Ericsson U8500 Platform HREFv60+")
  194. .atag_offset = 0x100,
  195. .smp = smp_ops(ux500_smp_ops),
  196. .map_io = u8500_map_io,
  197. .init_irq = ux500_init_irq,
  198. .init_time = ux500_timer_init,
  199. .init_machine = hrefv60_init_machine,
  200. .init_late = ux500_init_late,
  201. .restart = ux500_restart,
  202. MACHINE_END
  203. MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
  204. .atag_offset = 0x100,
  205. .smp = smp_ops(ux500_smp_ops),
  206. .map_io = u8500_map_io,
  207. .init_irq = ux500_init_irq,
  208. /* we re-use nomadik timer here */
  209. .init_time = ux500_timer_init,
  210. .init_machine = snowball_init_machine,
  211. .init_late = NULL,
  212. .restart = ux500_restart,
  213. MACHINE_END