dataMonitoring.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. *
  3. * arch/arm/mach-u300/core.c
  4. *
  5. *
  6. * Copyright (C) 2007-2012 ST-Ericsson SA
  7. * License terms: GNU General Public License (GPL) version 2
  8. * Core platform support, IRQ handling and device definitions.
  9. * Author: Linus Walleij <linus.walleij@stericsson.com>
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/spinlock.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/bitops.h>
  16. #include <linux/device.h>
  17. #include <linux/mm.h>
  18. #include <linux/termios.h>
  19. #include <linux/dmaengine.h>
  20. #include <linux/amba/bus.h>
  21. #include <linux/amba/mmci.h>
  22. #include <linux/amba/serial.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/gpio.h>
  25. #include <linux/clk.h>
  26. #include <linux/err.h>
  27. #include <linux/mtd/nand.h>
  28. #include <linux/mtd/fsmc.h>
  29. #include <linux/pinctrl/machine.h>
  30. #include <linux/pinctrl/pinconf-generic.h>
  31. #include <linux/dma-mapping.h>
  32. #include <linux/platform_data/clk-u300.h>
  33. #include <linux/platform_data/pinctrl-coh901.h>
  34. #include <asm/types.h>
  35. #include <asm/setup.h>
  36. #include <asm/memory.h>
  37. #include <asm/hardware/vic.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach-types.h>
  40. #include <asm/mach/arch.h>
  41. #include <mach/coh901318.h>
  42. #include <mach/hardware.h>
  43. #include <mach/syscon.h>
  44. #include <mach/irqs.h>
  45. #include "timer.h"
  46. #include "spi.h"
  47. #include "i2c.h"
  48. #include "u300-gpio.h"
  49. #include "dma_channels.h"
  50. /*
  51. * Static I/O mappings that are needed for booting the U300 platforms. The
  52. * only things we need are the areas where we find the timer, syscon and
  53. * intcon, since the remaining device drivers will map their own memory
  54. * physical to virtual as the need arise.
  55. */
  56. static struct map_desc u300_io_desc[] __initdata = {
  57. {
  58. .virtual = U300_SLOW_PER_VIRT_BASE,
  59. .pfn = __phys_to_pfn(U300_SLOW_PER_PHYS_BASE),
  60. .length = SZ_64K,
  61. .type = MT_DEVICE,
  62. },
  63. {
  64. .virtual = U300_AHB_PER_VIRT_BASE,
  65. .pfn = __phys_to_pfn(U300_AHB_PER_PHYS_BASE),
  66. .length = SZ_32K,
  67. .type = MT_DEVICE,
  68. },
  69. {
  70. .virtual = U300_FAST_PER_VIRT_BASE,
  71. .pfn = __phys_to_pfn(U300_FAST_PER_PHYS_BASE),
  72. .length = SZ_32K,
  73. .type = MT_DEVICE,
  74. },
  75. };
  76. static void __init u300_map_io(void)
  77. {
  78. iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc));
  79. }
  80. /*
  81. * Declaration of devices found on the U300 board and
  82. * their respective memory locations.
  83. */
  84. static struct amba_pl011_data uart0_plat_data = {
  85. #ifdef CONFIG_COH901318
  86. .dma_filter = coh901318_filter_id,
  87. .dma_rx_param = (void *) U300_DMA_UART0_RX,
  88. .dma_tx_param = (void *) U300_DMA_UART0_TX,
  89. #endif
  90. };
  91. /* Slow device at 0x3000 offset */
  92. static AMBA_APB_DEVICE(uart0, "uart0", 0, U300_UART0_BASE,
  93. { IRQ_U300_UART0 }, &uart0_plat_data);
  94. /* The U335 have an additional UART1 on the APP CPU */
  95. static struct amba_pl011_data uart1_plat_data = {
  96. #ifdef CONFIG_COH901318
  97. .dma_filter = coh901318_filter_id,
  98. .dma_rx_param = (void *) U300_DMA_UART1_RX,
  99. .dma_tx_param = (void *) U300_DMA_UART1_TX,
  100. #endif
  101. };
  102. /* Fast device at 0x7000 offset */
  103. static AMBA_APB_DEVICE(uart1, "uart1", 0, U300_UART1_BASE,
  104. { IRQ_U300_UART1 }, &uart1_plat_data);
  105. /* AHB device at 0x4000 offset */
  106. static AMBA_APB_DEVICE(pl172, "pl172", 0, U300_EMIF_CFG_BASE, { }, NULL);
  107. /* Fast device at 0x6000 offset */
  108. static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE,
  109. { IRQ_U300_SPI }, NULL);
  110. /* Fast device at 0x1000 offset */
  111. #define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 }
  112. static struct mmci_platform_data mmcsd_platform_data = {
  113. /*
  114. * Do not set ocr_mask or voltage translation function,
  115. * we have a regulator we can control instead.
  116. */
  117. .f_max = 24000000,
  118. .gpio_wp = -1,
  119. .gpio_cd = U300_GPIO_PIN_MMC_CD,
  120. .cd_invert = true,
  121. .capabilities = MMC_CAP_MMC_HIGHSPEED |
  122. MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  123. #ifdef CONFIG_COH901318
  124. .dma_filter = coh901318_filter_id,
  125. .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
  126. /* Don't specify a TX channel, this RX channel is bidirectional */
  127. #endif
  128. };
  129. static AMBA_APB_DEVICE(mmcsd, "mmci", 0, U300_MMCSD_BASE,
  130. U300_MMCSD_IRQS, &mmcsd_platform_data);
  131. /*
  132. * The order of device declaration may be important, since some devices
  133. * have dependencies on other devices being initialized first.
  134. */
  135. static struct amba_device *amba_devs[] __initdata = {
  136. &uart0_device,
  137. &uart1_device,
  138. &pl022_device,
  139. &pl172_device,
  140. &mmcsd_device,
  141. };
  142. /* Here follows a list of all hw resources that the platform devices
  143. * allocate. Note, clock dependencies are not included
  144. */
  145. static struct resource gpio_resources[] = {
  146. {
  147. .start = U300_GPIO_BASE,
  148. .end = (U300_GPIO_BASE + SZ_4K - 1),
  149. .flags = IORESOURCE_MEM,
  150. },
  151. {
  152. .name = "gpio0",
  153. .start = IRQ_U300_GPIO_PORT0,
  154. .end = IRQ_U300_GPIO_PORT0,
  155. .flags = IORESOURCE_IRQ,
  156. },
  157. {
  158. .name = "gpio1",
  159. .start = IRQ_U300_GPIO_PORT1,
  160. .end = IRQ_U300_GPIO_PORT1,
  161. .flags = IORESOURCE_IRQ,
  162. },
  163. {
  164. .name = "gpio2",
  165. .start = IRQ_U300_GPIO_PORT2,
  166. .end = IRQ_U300_GPIO_PORT2,
  167. .flags = IORESOURCE_IRQ,
  168. },
  169. {
  170. .name = "gpio3",
  171. .start = IRQ_U300_GPIO_PORT3,
  172. .end = IRQ_U300_GPIO_PORT3,
  173. .flags = IORESOURCE_IRQ,
  174. },
  175. {