calculationOfWaterPressureVariance.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*
  2. * kota2 board support
  3. *
  4. * Copyright (C) 2011 Renesas Solutions Corp.
  5. * Copyright (C) 2011 Magnus Damm
  6. * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com>
  7. * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; version 2 of the License.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #include <linux/kernel.h>
  23. #include <linux/init.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/irq.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/delay.h>
  28. #include <linux/io.h>
  29. #include <linux/regulator/fixed.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/smsc911x.h>
  32. #include <linux/gpio.h>
  33. #include <linux/input.h>
  34. #include <linux/input/sh_keysc.h>
  35. #include <linux/gpio_keys.h>
  36. #include <linux/leds.h>
  37. #include <linux/platform_data/leds-renesas-tpu.h>
  38. #include <linux/mmc/host.h>
  39. #include <linux/mmc/sh_mmcif.h>
  40. #include <linux/mfd/tmio.h>
  41. #include <linux/mmc/sh_mobile_sdhi.h>
  42. #include <mach/hardware.h>
  43. #include <mach/irqs.h>
  44. #include <mach/sh73a0.h>
  45. #include <mach/common.h>
  46. #include <asm/mach-types.h>
  47. #include <asm/mach/arch.h>
  48. #include <asm/mach/time.h>
  49. #include <asm/hardware/gic.h>
  50. #include <asm/hardware/cache-l2x0.h>
  51. #include <asm/traps.h>
  52. /* Dummy supplies, where voltage doesn't matter */
  53. static struct regulator_consumer_supply dummy_supplies[] = {
  54. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  55. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  56. };
  57. /* SMSC 9220 */
  58. static struct resource smsc9220_resources[] = {
  59. [0] = {
  60. .start = 0x14000000, /* CS5A */
  61. .end = 0x140000ff, /* A1->A7 */
  62. .flags = IORESOURCE_MEM,
  63. },
  64. [1] = {
  65. .start = SH73A0_PINT0_IRQ(2), /* PINTA2 */
  66. .flags = IORESOURCE_IRQ,
  67. },
  68. };
  69. static struct smsc911x_platform_config smsc9220_platdata = {
  70. .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
  71. .phy_interface = PHY_INTERFACE_MODE_MII,
  72. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  73. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  74. };
  75. static struct platform_device eth_device = {
  76. .name = "smsc911x",
  77. .id = 0,
  78. .dev = {
  79. .platform_data = &smsc9220_platdata,
  80. },
  81. .resource = smsc9220_resources,
  82. .num_resources = ARRAY_SIZE(smsc9220_resources),
  83. };
  84. /* KEYSC */
  85. static struct sh_keysc_info keysc_platdata = {
  86. .mode = SH_KEYSC_MODE_6,
  87. .scan_timing = 3,
  88. .delay = 100,
  89. .keycodes = {
  90. KEY_NUMERIC_STAR, KEY_NUMERIC_0, KEY_NUMERIC_POUND,
  91. 0, 0, 0, 0, 0,
  92. KEY_NUMERIC_7, KEY_NUMERIC_8, KEY_NUMERIC_9,
  93. 0, KEY_DOWN, 0, 0, 0,
  94. KEY_NUMERIC_4, KEY_NUMERIC_5, KEY_NUMERIC_6,
  95. KEY_LEFT, KEY_ENTER, KEY_RIGHT, 0, 0,
  96. KEY_NUMERIC_1, KEY_NUMERIC_2, KEY_NUMERIC_3,
  97. 0, KEY_UP, 0, 0, 0,
  98. 0, 0, 0, 0, 0, 0, 0, 0,
  99. 0, 0, 0, 0, 0, 0, 0, 0,
  100. 0, 0, 0, 0, 0, 0, 0, 0,
  101. 0, 0, 0, 0, 0, 0, 0, 0,
  102. },
  103. };
  104. static struct resource keysc_resources[] = {
  105. [0] = {
  106. .name = "KEYSC",
  107. .start = 0xe61b0000,
  108. .end = 0xe61b0098 - 1,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. [1] = {
  112. .start = gic_spi(71),
  113. .flags = IORESOURCE_IRQ,
  114. },
  115. };
  116. static struct platform_device keysc_device = {
  117. .name = "sh_keysc",
  118. .id = 0,
  119. .num_resources = ARRAY_SIZE(keysc_resources),
  120. .resource = keysc_resources,
  121. .dev = {
  122. .platform_data = &keysc_platdata,
  123. },
  124. };
  125. /* GPIO KEY */
  126. #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
  127. static struct gpio_keys_button gpio_buttons[] = {
  128. GPIO_KEY(KEY_VOLUMEUP, GPIO_PORT56, "+"), /* S2: VOL+ [IRQ9] */
  129. GPIO_KEY(KEY_VOLUMEDOWN, GPIO_PORT54, "-"), /* S3: VOL- [IRQ10] */
  130. GPIO_KEY(KEY_MENU, GPIO_PORT27, "Menu"), /* S4: MENU [IRQ30] */
  131. GPIO_KEY(KEY_HOMEPAGE, GPIO_PORT26, "Home"), /* S5: HOME [IRQ31] */
  132. GPIO_KEY(KEY_BACK, GPIO_PORT11, "Back"), /* S6: BACK [IRQ0] */
  133. GPIO_KEY(KEY_PHONE, GPIO_PORT238, "Tel"), /* S7: TEL [IRQ11] */
  134. GPIO_KEY(KEY_POWER, GPIO_PORT239, "C1"), /* S8: CAM [IRQ13] */
  135. GPIO_KEY(KEY_MAIL, GPIO_PORT224, "Mail"), /* S9: MAIL [IRQ3] */
  136. /* Omitted button "C3?": GPIO_PORT223 - S10: CUST [IRQ8] */
  137. GPIO_KEY(KEY_CAMERA, GPIO_PORT164, "C2"), /* S11: CAM_HALF [IRQ25] */
  138. /* Omitted button "?": GPIO_PORT152 - S12: CAM_FULL [No IRQ] */
  139. };
  140. static struct gpio_keys_platform_data gpio_key_info = {
  141. .buttons = gpio_buttons,
  142. .nbuttons = ARRAY_SIZE(gpio_buttons),
  143. };
  144. static struct platform_device gpio_keys_device = {
  145. .name = "gpio-keys",
  146. .id = -1,
  147. .dev = {
  148. .platform_data = &gpio_key_info,
  149. },
  150. };
  151. /* GPIO LED */
  152. #define GPIO_LED(n, g) { .name = n, .gpio = g }
  153. static struct gpio_led gpio_leds[] = {
  154. GPIO_LED("G", GPIO_PORT20), /* PORT20 [GPO0] -> LED7 -> "G" */
  155. GPIO_LED("H", GPIO_PORT21), /* PORT21 [GPO1] -> LED8 -> "H" */
  156. GPIO_LED("J", GPIO_PORT22), /* PORT22 [GPO2] -> LED9 -> "J" */
  157. };
  158. static struct gpio_led_platform_data gpio_leds_info = {
  159. .leds = gpio_leds,
  160. .num_leds = ARRAY_SIZE(gpio_leds),
  161. };
  162. static struct platform_device gpio_leds_device = {
  163. .name = "leds-gpio",
  164. .id = -1,
  165. .dev = {
  166. .platform_data = &gpio_leds_info,
  167. },
  168. };
  169. /* TPU LED */
  170. static struct led_renesas_tpu_config led_renesas_tpu12_pdata = {
  171. .name = "V2513",
  172. .pin_gpio_fn = GPIO_FN_TPU1TO2,
  173. .pin_gpio = GPIO_PORT153,
  174. .channel_offset = 0x90,
  175. .timer_bit = 2,
  176. .max_brightness = 1000,
  177. };
  178. static struct resource tpu12_resources[] = {
  179. [0] = {
  180. .name = "TPU12",
  181. .start = 0xe6610090,
  182. .end = 0xe66100b5,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. };
  186. static struct platform_device leds_tpu12_device = {
  187. .name = "leds-renesas-tpu",
  188. .id = 12,
  189. .dev = {
  190. .platform_data = &led_renesas_tpu12_pdata,
  191. },
  192. .num_resources = ARRAY_SIZE(tpu12_resources),
  193. .resource = tpu12_resources,
  194. };
  195. static struct led_renesas_tpu_config led_renesas_tpu41_pdata = {
  196. .name = "V2514",
  197. .pin_gpio_fn = GPIO_FN_TPU4TO1,
  198. .pin_gpio = GPIO_PORT199,
  199. .channel_offset = 0x50,
  200. .timer_bit = 1,
  201. .max_brightness = 1000,
  202. };
  203. static struct resource tpu41_resources[] = {
  204. [0] = {
  205. .name = "TPU41",