rtuDataAnalysis.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /*
  2. * AP4EVB board support
  3. *
  4. * Copyright (C) 2010 Magnus Damm
  5. * Copyright (C) 2008 Yoshihiro Shimoda
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/clk.h>
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/irq.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/delay.h>
  27. #include <linux/mfd/tmio.h>
  28. #include <linux/mmc/host.h>
  29. #include <linux/mmc/sh_mobile_sdhi.h>
  30. #include <linux/mtd/mtd.h>
  31. #include <linux/mtd/partitions.h>
  32. #include <linux/mtd/physmap.h>
  33. #include <linux/mmc/sh_mmcif.h>
  34. #include <linux/i2c.h>
  35. #include <linux/i2c/tsc2007.h>
  36. #include <linux/io.h>
  37. #include <linux/regulator/fixed.h>
  38. #include <linux/regulator/machine.h>
  39. #include <linux/smsc911x.h>
  40. #include <linux/sh_intc.h>
  41. #include <linux/sh_clk.h>
  42. #include <linux/gpio.h>
  43. #include <linux/input.h>
  44. #include <linux/leds.h>
  45. #include <linux/input/sh_keysc.h>
  46. #include <linux/usb/r8a66597.h>
  47. #include <linux/pm_clock.h>
  48. #include <linux/dma-mapping.h>
  49. #include <media/sh_mobile_ceu.h>
  50. #include <media/sh_mobile_csi2.h>
  51. #include <media/soc_camera.h>
  52. #include <sound/sh_fsi.h>
  53. #include <sound/simple_card.h>
  54. #include <video/sh_mobile_hdmi.h>
  55. #include <video/sh_mobile_lcdc.h>
  56. #include <video/sh_mipi_dsi.h>
  57. #include <mach/common.h>
  58. #include <mach/irqs.h>
  59. #include <mach/sh7372.h>
  60. #include <asm/mach-types.h>
  61. #include <asm/mach/arch.h>
  62. #include <asm/setup.h>
  63. #include "sh-gpio.h"
  64. /*
  65. * Address Interface BusWidth note
  66. * ------------------------------------------------------------------
  67. * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
  68. * 0x0800_0000 user area -
  69. * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
  70. * 0x1400_0000 Ether (LAN9220) 16bit
  71. * 0x1600_0000 user area - cannot use with NAND
  72. * 0x1800_0000 user area -
  73. * 0x1A00_0000 -
  74. * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
  75. */
  76. /*
  77. * NOR Flash ROM
  78. *
  79. * SW1 | SW2 | SW7 | NOR Flash ROM
  80. * bit1 | bit1 bit2 | bit1 | Memory allocation
  81. * ------+------------+------+------------------
  82. * OFF | ON OFF | ON | Area 0
  83. * OFF | ON OFF | OFF | Area 4
  84. */
  85. /*
  86. * NAND Flash ROM
  87. *
  88. * SW1 | SW2 | SW7 | NAND Flash ROM
  89. * bit1 | bit1 bit2 | bit2 | Memory allocation
  90. * ------+------------+------+------------------
  91. * OFF | ON OFF | ON | FCE 0
  92. * OFF | ON OFF | OFF | FCE 1
  93. */
  94. /*
  95. * SMSC 9220
  96. *
  97. * SW1 SMSC 9220
  98. * -----------------------
  99. * ON access disable
  100. * OFF access enable
  101. */
  102. /*
  103. * LCD / IRQ / KEYSC / IrDA
  104. *
  105. * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (QHD-TouchScreen)
  106. * LCD = 2nd LCDC (WVGA)
  107. *
  108. * | SW43 |
  109. * SW3 | ON | OFF |
  110. * -------------+-----------------------+---------------+
  111. * ON | KEY / IrDA | LCD |
  112. * OFF | KEY / IrDA / IRQ | IRQ |
  113. *
  114. *
  115. * QHD / WVGA display
  116. *
  117. * You can choice display type on menuconfig.
  118. * Then, check above dip-switch.
  119. */
  120. /*
  121. * USB
  122. *
  123. * J7 : 1-2 MAX3355E VBUS
  124. * 2-3 DC 5.0V
  125. *
  126. * S39: bit2: off
  127. */
  128. /*
  129. * FSI/FSMI
  130. *
  131. * SW41 : ON : SH-Mobile AP4 Audio Mode
  132. * : OFF : Bluetooth Audio Mode
  133. */
  134. /*
  135. * MMC0/SDHI1 (CN7)
  136. *
  137. * J22 : select card voltage
  138. * 1-2 pin : 1.8v
  139. * 2-3 pin : 3.3v
  140. *
  141. * SW1 | SW33
  142. * | bit1 | bit2 | bit3 | bit4
  143. * ------------+------+------+------+-------
  144. * MMC0 OFF | OFF | ON | ON | X
  145. * SDHI1 OFF | ON | X | OFF | ON
  146. *
  147. * voltage lebel
  148. * CN7 : 1.8v
  149. * CN12: 3.3v
  150. */
  151. /* Dummy supplies, where voltage doesn't matter */
  152. static struct regulator_consumer_supply fixed1v8_power_consumers[] =
  153. {
  154. /* J22 default position: 1.8V */
  155. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
  156. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
  157. REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
  158. REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
  159. };
  160. static struct regulator_consumer_supply fixed3v3_power_consumers[] =
  161. {
  162. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  163. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  164. };
  165. static struct regulator_consumer_supply dummy_supplies[] = {
  166. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  167. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  168. };
  169. /* MTD */
  170. static struct mtd_partition nor_flash_partitions[] = {
  171. {
  172. .name = "loader",
  173. .offset = 0x00000000,
  174. .size = 512 * 1024,
  175. .mask_flags = MTD_WRITEABLE,
  176. },
  177. {
  178. .name = "bootenv",
  179. .offset = MTDPART_OFS_APPEND,
  180. .size = 512 * 1024,
  181. .mask_flags = MTD_WRITEABLE,
  182. },
  183. {
  184. .name = "kernel_ro",
  185. .offset = MTDPART_OFS_APPEND,
  186. .size = 8 * 1024 * 1024,
  187. .mask_flags = MTD_WRITEABLE,
  188. },
  189. {
  190. .name = "kernel",
  191. .offset = MTDPART_OFS_APPEND,
  192. .size = 8 * 1024 * 1024,
  193. },
  194. {
  195. .name = "data",
  196. .offset = MTDPART_OFS_APPEND,
  197. .size = MTDPART_SIZ_FULL,
  198. },
  199. };
  200. static struct physmap_flash_data nor_flash_data = {
  201. .width = 2,
  202. .parts = nor_flash_partitions,
  203. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  204. };
  205. static struct resource nor_flash_resources[] = {
  206. [0] = {
  207. .start = 0x20000000, /* CS0 shadow instead of regular CS0 */
  208. .end = 0x28000000 - 1, /* needed by USB MASK ROM boot */
  209. .flags = IORESOURCE_MEM,
  210. }
  211. };
  212. static struct platform_device nor_flash_device = {
  213. .name = "physmap-flash",
  214. .dev = {
  215. .platform_data = &nor_flash_data,
  216. },
  217. .num_resources = ARRAY_SIZE(nor_flash_resources),
  218. .resource = nor_flash_resources,
  219. };
  220. /* SMSC 9220 */
  221. static struct resource smc911x_resources[] = {
  222. {
  223. .start = 0x14000000,
  224. .end = 0x16000000 - 1,
  225. .flags = IORESOURCE_MEM,
  226. }, {
  227. .start = evt2irq(0x02c0) /* IRQ6A */,
  228. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  229. },
  230. };
  231. static struct smsc911x_platform_config smsc911x_info = {
  232. .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
  233. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  234. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  235. };
  236. static struct platform_device smc911x_device = {
  237. .name = "smsc911x",
  238. .id = -1,
  239. .num_resources = ARRAY_SIZE(smc911x_resources),
  240. .resource = smc911x_resources,
  241. .dev = {
  242. .platform_data = &smsc911x_info,