realizationOfDataCalculation.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /*
  2. * linux/arch/arm/mach-omap1/board-h3.c
  3. *
  4. * This file contains OMAP1710 H3 specific code.
  5. *
  6. * Copyright (C) 2004 Texas Instruments, Inc.
  7. * Copyright (C) 2002 MontaVista Software, Inc.
  8. * Copyright (C) 2001 RidgeRun, Inc.
  9. * Author: RidgeRun, Inc.
  10. * Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #include <linux/gpio.h>
  17. #include <linux/types.h>
  18. #include <linux/init.h>
  19. #include <linux/major.h>
  20. #include <linux/kernel.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/errno.h>
  23. #include <linux/workqueue.h>
  24. #include <linux/i2c.h>
  25. #include <linux/mtd/mtd.h>
  26. #include <linux/mtd/nand.h>
  27. #include <linux/mtd/partitions.h>
  28. #include <linux/mtd/physmap.h>
  29. #include <linux/input.h>
  30. #include <linux/spi/spi.h>
  31. #include <linux/i2c/tps65010.h>
  32. #include <linux/smc91x.h>
  33. #include <linux/omapfb.h>
  34. #include <linux/platform_data/gpio-omap.h>
  35. #include <linux/leds.h>
  36. #include <asm/setup.h>
  37. #include <asm/page.h>
  38. #include <asm/mach-types.h>
  39. #include <asm/mach/arch.h>
  40. #include <asm/mach/map.h>
  41. #include <mach/mux.h>
  42. #include <mach/tc.h>
  43. #include <linux/platform_data/keypad-omap.h>
  44. #include <linux/omap-dma.h>
  45. #include <mach/flash.h>
  46. #include <mach/hardware.h>
  47. #include <mach/irqs.h>
  48. #include <mach/usb.h>
  49. #include "common.h"
  50. #include "board-h3.h"
  51. /* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
  52. #define OMAP1710_ETHR_START 0x04000300
  53. #define H3_TS_GPIO 48
  54. static const unsigned int h3_keymap[] = {
  55. KEY(0, 0, KEY_LEFT),
  56. KEY(1, 0, KEY_RIGHT),
  57. KEY(2, 0, KEY_3),
  58. KEY(3, 0, KEY_F10),
  59. KEY(4, 0, KEY_F5),
  60. KEY(5, 0, KEY_9),
  61. KEY(0, 1, KEY_DOWN),
  62. KEY(1, 1, KEY_UP),
  63. KEY(2, 1, KEY_2),
  64. KEY(3, 1, KEY_F9),
  65. KEY(4, 1, KEY_F7),
  66. KEY(5, 1, KEY_0),
  67. KEY(0, 2, KEY_ENTER),
  68. KEY(1, 2, KEY_6),
  69. KEY(2, 2, KEY_1),
  70. KEY(3, 2, KEY_F2),
  71. KEY(4, 2, KEY_F6),
  72. KEY(5, 2, KEY_HOME),
  73. KEY(0, 3, KEY_8),
  74. KEY(1, 3, KEY_5),
  75. KEY(2, 3, KEY_F12),
  76. KEY(3, 3, KEY_F3),
  77. KEY(4, 3, KEY_F8),
  78. KEY(5, 3, KEY_END),
  79. KEY(0, 4, KEY_7),
  80. KEY(1, 4, KEY_4),
  81. KEY(2, 4, KEY_F11),
  82. KEY(3, 4, KEY_F1),
  83. KEY(4, 4, KEY_F4),
  84. KEY(5, 4, KEY_ESC),
  85. KEY(0, 5, KEY_F13),
  86. KEY(1, 5, KEY_F14),
  87. KEY(2, 5, KEY_F15),
  88. KEY(3, 5, KEY_F16),
  89. KEY(4, 5, KEY_SLEEP),
  90. };
  91. static struct mtd_partition nor_partitions[] = {
  92. /* bootloader (U-Boot, etc) in first sector */
  93. {
  94. .name = "bootloader",
  95. .offset = 0,
  96. .size = SZ_128K,
  97. .mask_flags = MTD_WRITEABLE, /* force read-only */
  98. },
  99. /* bootloader params in the next sector */
  100. {
  101. .name = "params",
  102. .offset = MTDPART_OFS_APPEND,
  103. .size = SZ_128K,
  104. .mask_flags = 0,
  105. },
  106. /* kernel */
  107. {
  108. .name = "kernel",
  109. .offset = MTDPART_OFS_APPEND,
  110. .size = SZ_2M,
  111. .mask_flags = 0
  112. },
  113. /* file system */
  114. {
  115. .name = "filesystem",
  116. .offset = MTDPART_OFS_APPEND,
  117. .size = MTDPART_SIZ_FULL,
  118. .mask_flags = 0
  119. }
  120. };
  121. static struct physmap_flash_data nor_data = {
  122. .width = 2,
  123. .set_vpp = omap1_set_vpp,
  124. .parts = nor_partitions,
  125. .nr_parts = ARRAY_SIZE(nor_partitions),
  126. };
  127. static struct resource nor_resource = {
  128. /* This is on CS3, wherever it's mapped */
  129. .flags = IORESOURCE_MEM,
  130. };
  131. static struct platform_device nor_device = {
  132. .name = "physmap-flash",
  133. .id = 0,
  134. .dev = {
  135. .platform_data = &nor_data,
  136. },
  137. .num_resources = 1,
  138. .resource = &nor_resource,
  139. };
  140. static struct mtd_partition nand_partitions[] = {
  141. #if 0
  142. /* REVISIT: enable these partitions if you make NAND BOOT work */
  143. {
  144. .name = "xloader",
  145. .offset = 0,
  146. .size = 64 * 1024,
  147. .mask_flags = MTD_WRITEABLE, /* force read-only */
  148. },
  149. {
  150. .name = "bootloader",
  151. .offset = MTDPART_OFS_APPEND,
  152. .size = 256 * 1024,
  153. .mask_flags = MTD_WRITEABLE, /* force read-only */
  154. },
  155. {
  156. .name = "params",
  157. .offset = MTDPART_OFS_APPEND,
  158. .size = 192 * 1024,
  159. },
  160. {
  161. .name = "kernel",
  162. .offset = MTDPART_OFS_APPEND,
  163. .size = 2 * SZ_1M,
  164. },
  165. #endif
  166. {
  167. .name = "filesystem",
  168. .size = MTDPART_SIZ_FULL,
  169. .offset = MTDPART_OFS_APPEND,
  170. },
  171. };
  172. #define H3_NAND_RB_GPIO_PIN 10
  173. static int nand_dev_ready(struct mtd_info *mtd)
  174. {
  175. return gpio_get_value(H3_NAND_RB_GPIO_PIN);
  176. }
  177. static struct platform_nand_data nand_platdata = {
  178. .chip = {
  179. .nr_chips = 1,
  180. .chip_offset = 0,
  181. .nr_partitions = ARRAY_SIZE(nand_partitions),
  182. .partitions = nand_partitions,
  183. .options = NAND_SAMSUNG_LP_OPTIONS,
  184. },
  185. .ctrl = {
  186. .cmd_ctrl = omap1_nand_cmd_ctl,
  187. .dev_ready = nand_dev_ready,
  188. },
  189. };
  190. static struct resource nand_resource = {
  191. .flags = IORESOURCE_MEM,
  192. };
  193. static struct platform_device nand_device = {
  194. .name = "gen_nand",
  195. .id = 0,
  196. .dev = {
  197. .platform_data = &nand_platdata,
  198. },
  199. .num_resources = 1,
  200. .resource = &nand_resource,
  201. };
  202. static struct smc91x_platdata smc91x_info = {
  203. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  204. .leda = RPC_LED_100_10,
  205. .ledb = RPC_LED_TX_RX,
  206. };
  207. static struct resource smc91x_resources[] = {
  208. [0] = {
  209. .start = OMAP1710_ETHR_START, /* Physical */
  210. .end = OMAP1710_ETHR_START + 0xf,
  211. .flags = IORESOURCE_MEM,
  212. },
  213. [1] = {
  214. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  215. },
  216. };
  217. static struct platform_device smc91x_device = {
  218. .name = "smc91x",
  219. .id = 0,
  220. .dev = {
  221. .platform_data = &smc91x_info,
  222. },
  223. .num_resources = ARRAY_SIZE(smc91x_resources),
  224. .resource = smc91x_resources,
  225. };
  226. static void __init h3_init_smc91x(void)
  227. {
  228. omap_cfg_reg(W15_1710_GPIO40);
  229. if (gpio_request(40, "SMC91x irq") < 0) {
  230. printk("Error requesting gpio 40 for smc91x irq\n");
  231. return;
  232. }
  233. }
  234. #define GPTIMER_BASE 0xFFFB1400
  235. #define GPTIMER_REGS(x) (0xFFFB1400 + (x * 0x800))
  236. #define GPTIMER_REGS_SIZE 0x46
  237. static struct resource intlat_resources[] = {
  238. [0] = {
  239. .start = GPTIMER_REGS(0), /* Physical */
  240. .end = GPTIMER_REGS(0) + GPTIMER_REGS_SIZE,
  241. .flags = IORESOURCE_MEM,
  242. },
  243. [1] = {
  244. .start = INT_1610_GPTIMER1,
  245. .end = INT_1610_GPTIMER1,
  246. .flags = IORESOURCE_IRQ,
  247. },
  248. };
  249. static struct platform_device intlat_device = {
  250. .name = "omap_intlat",
  251. .id = 0,
  252. .num_resources = ARRAY_SIZE(intlat_resources),
  253. .resource = intlat_resources,
  254. };
  255. static struct resource h3_kp_resources[] = {
  256. [0] = {
  257. .start = INT_KEYBOARD,
  258. .end = INT_KEYBOARD,
  259. .flags = IORESOURCE_IRQ,
  260. },
  261. };
  262. static const struct matrix_keymap_data h3_keymap_data = {
  263. .keymap = h3_keymap,
  264. .keymap_size = ARRAY_SIZE(h3_keymap),
  265. };
  266. static struct omap_kp_platform_data h3_kp_data = {
  267. .rows = 8,
  268. .cols = 8,
  269. .keymap_data = &h3_keymap_data,
  270. .rep = true,
  271. .delay = 9,
  272. .dbounce = true,