hiddenDangerAnalysis.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. /*
  2. * mackerel board support
  3. *
  4. * Copyright (C) 2010 Renesas Solutions Corp.
  5. * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  6. *
  7. * based on ap4evb
  8. * Copyright (C) 2010 Magnus Damm
  9. * Copyright (C) 2008 Yoshihiro Shimoda
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; version 2 of the License.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #include <linux/delay.h>
  25. #include <linux/kernel.h>
  26. #include <linux/init.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/irq.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/gpio.h>
  31. #include <linux/input.h>
  32. #include <linux/io.h>
  33. #include <linux/i2c.h>
  34. #include <linux/leds.h>
  35. #include <linux/mfd/tmio.h>
  36. #include <linux/mmc/host.h>
  37. #include <linux/mmc/sh_mmcif.h>
  38. #include <linux/mmc/sh_mobile_sdhi.h>
  39. #include <linux/mtd/mtd.h>
  40. #include <linux/mtd/partitions.h>
  41. #include <linux/mtd/physmap.h>
  42. #include <linux/mtd/sh_flctl.h>
  43. #include <linux/pm_clock.h>
  44. #include <linux/regulator/fixed.h>
  45. #include <linux/regulator/machine.h>
  46. #include <linux/smsc911x.h>
  47. #include <linux/sh_intc.h>
  48. #include <linux/tca6416_keypad.h>
  49. #include <linux/usb/renesas_usbhs.h>
  50. #include <linux/dma-mapping.h>
  51. #include <video/sh_mobile_hdmi.h>
  52. #include <video/sh_mobile_lcdc.h>
  53. #include <media/sh_mobile_ceu.h>
  54. #include <media/soc_camera.h>
  55. #include <media/soc_camera_platform.h>
  56. #include <sound/sh_fsi.h>
  57. #include <sound/simple_card.h>
  58. #include <mach/common.h>
  59. #include <mach/irqs.h>
  60. #include <mach/sh7372.h>
  61. #include <asm/mach/arch.h>
  62. #include <asm/mach-types.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. * CPU mode
  78. *
  79. * SW4 | Boot Area| Master | Remarks
  80. * 1 | 2 | 3 | 4 | 5 | 6 | 8 | | Processor|
  81. * ----+-----+-----+-----+-----+-----+-----+----------+----------+--------------
  82. * ON | ON | OFF | ON | ON | OFF | OFF | External | System | External ROM
  83. * ON | ON | ON | ON | ON | OFF | OFF | External | System | ROM Debug
  84. * ON | ON | X | ON | OFF | OFF | OFF | Built-in | System | ROM Debug
  85. * X | OFF | X | X | X | X | OFF | Built-in | System | MaskROM
  86. * OFF | X | X | X | X | X | OFF | Built-in | System | MaskROM
  87. * X | X | X | OFF | X | X | OFF | Built-in | System | MaskROM
  88. * OFF | ON | OFF | X | X | OFF | ON | External | System | Standalone
  89. * ON | OFF | OFF | X | X | OFF | ON | External | Realtime | Standalone
  90. */
  91. /*
  92. * NOR Flash ROM
  93. *
  94. * SW1 | SW2 | SW7 | NOR Flash ROM
  95. * bit1 | bit1 bit2 | bit1 | Memory allocation
  96. * ------+------------+------+------------------
  97. * OFF | ON OFF | ON | Area 0
  98. * OFF | ON OFF | OFF | Area 4
  99. */
  100. /*
  101. * SMSC 9220
  102. *
  103. * SW1 SMSC 9220
  104. * -----------------------
  105. * ON access disable
  106. * OFF access enable
  107. */
  108. /*
  109. * NAND Flash ROM
  110. *
  111. * SW1 | SW2 | SW7 | NAND Flash ROM
  112. * bit1 | bit1 bit2 | bit2 | Memory allocation
  113. * ------+------------+------+------------------
  114. * OFF | ON OFF | ON | FCE 0
  115. * OFF | ON OFF | OFF | FCE 1
  116. */
  117. /*
  118. * External interrupt pin settings
  119. *
  120. * IRQX | pin setting | device | level
  121. * ------+--------------------+--------------------+-------
  122. * IRQ0 | ICR1A.IRQ0SA=0010 | SDHI2 card detect | Low
  123. * IRQ6 | ICR1A.IRQ6SA=0011 | Ether(LAN9220) | High
  124. * IRQ7 | ICR1A.IRQ7SA=0010 | LCD Touch Panel | Low
  125. * IRQ8 | ICR2A.IRQ8SA=0010 | MMC/SD card detect | Low
  126. * IRQ9 | ICR2A.IRQ9SA=0010 | KEY(TCA6408) | Low
  127. * IRQ21 | ICR4A.IRQ21SA=0011 | Sensor(ADXL345) | High
  128. * IRQ22 | ICR4A.IRQ22SA=0011 | Sensor(AK8975) | High
  129. */
  130. /*
  131. * USB
  132. *
  133. * USB0 : CN22 : Function
  134. * USB1 : CN31 : Function/Host *1
  135. *
  136. * J30 (for CN31) *1
  137. * ----------+---------------+-------------
  138. * 1-2 short | VBUS 5V | Host
  139. * open | external VBUS | Function
  140. *
  141. * CAUTION
  142. *
  143. * renesas_usbhs driver can use external interrupt mode
  144. * (which come from USB-PHY) or autonomy mode (it use own interrupt)
  145. * for detecting connection/disconnection when Function.
  146. * USB will be power OFF while it has been disconnecting
  147. * if external interrupt mode, and it is always power ON if autonomy mode,
  148. *
  149. * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0",
  150. * because Touchscreen is using IRQ7-PORT40.
  151. * It is impossible to use IRQ7 demux on this board.
  152. */
  153. /*
  154. * SDHI0 (CN12)
  155. *
  156. * SW56 : OFF
  157. *
  158. */
  159. /* MMC /SDHI1 (CN7)
  160. *
  161. * I/O voltage : 1.8v
  162. *
  163. * Power voltage : 1.8v or 3.3v
  164. * J22 : select power voltage *1
  165. * 1-2 pin : 1.8v
  166. * 2-3 pin : 3.3v
  167. *
  168. * *1
  169. * Please change J22 depends the card to be used.
  170. * MMC's OCR field set to support either voltage for the card inserted.
  171. *
  172. * SW1 | SW33
  173. * | bit1 | bit2 | bit3 | bit4
  174. * -------------+------+------+------+-------
  175. * MMC0 OFF | OFF | X | ON | X (Use MMCIF)
  176. * SDHI1 OFF | ON | X | OFF | X (Use MFD_SH_MOBILE_SDHI)
  177. *
  178. */
  179. /*
  180. * SDHI2 (CN23)
  181. *
  182. * microSD card sloct
  183. *
  184. */
  185. /*
  186. * FSI - AK4642
  187. *
  188. * it needs amixer settings for playing
  189. *
  190. * amixer set "Headphone" on
  191. * amixer set "HPOUTL Mixer DACH" on
  192. * amixer set "HPOUTR Mixer DACH" on
  193. */
  194. /* Fixed 3.3V and 1.8V regulators to be used by multiple devices */
  195. static struct regulator_consumer_supply fixed1v8_power_consumers[] =
  196. {
  197. /*
  198. * J22 on mackerel switches mmcif.0 and sdhi.1 between 1.8V and 3.3V
  199. * Since we cannot support both voltages, we support the default 1.8V
  200. */
  201. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
  202. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
  203. REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
  204. REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
  205. };
  206. static struct regulator_consumer_supply fixed3v3_power_consumers[] =
  207. {
  208. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  209. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  210. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
  211. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
  212. };
  213. /* Dummy supplies, where voltage doesn't matter */
  214. static struct regulator_consumer_supply dummy_supplies[] = {
  215. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  216. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  217. };
  218. /* MTD */
  219. static struct mtd_partition nor_flash_partitions[] = {
  220. {
  221. .name = "loader",
  222. .offset = 0x00000000,
  223. .size = 512 * 1024,
  224. .mask_flags = MTD_WRITEABLE,
  225. },
  226. {
  227. .name = "bootenv",
  228. .offset = MTDPART_OFS_APPEND,
  229. .size = 512 * 1024,
  230. .mask_flags = MTD_WRITEABLE,
  231. },
  232. {
  233. .name = "kernel_ro",
  234. .offset = MTDPART_OFS_APPEND,
  235. .size = 8 * 1024 * 1024,
  236. .mask_flags = MTD_WRITEABLE,
  237. },
  238. {
  239. .name = "kernel",
  240. .offset = MTDPART_OFS_APPEND,
  241. .size = 8 * 1024 * 1024,
  242. },
  243. {
  244. .name = "data",
  245. .offset = MTDPART_OFS_APPEND,
  246. .size = MTDPART_SIZ_FULL,
  247. },
  248. };
  249. static struct physmap_flash_data nor_flash_data = {
  250. .width = 2,
  251. .parts = nor_flash_partitions,
  252. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  253. };
  254. static struct resource nor_flash_resources[] = {
  255. [0] = {
  256. .start = 0x20000000, /* CS0 shadow instead of regular CS0 */
  257. .end = 0x28000000 - 1, /* needed by USB MASK ROM boot */
  258. .flags = IORESOURCE_MEM,
  259. }
  260. };
  261. static struct platform_device nor_flash_device = {
  262. .name = "physmap-flash",
  263. .dev = {
  264. .platform_data = &nor_flash_data,
  265. },
  266. .num_resources = ARRAY_SIZE(nor_flash_resources),
  267. .resource = nor_flash_resources,
  268. };
  269. /* SMSC */
  270. static struct resource smc911x_resources[] = {
  271. {
  272. .start = 0x14000000,
  273. .end = 0x16000000 - 1,
  274. .flags = IORESOURCE_MEM,
  275. }, {