definitionOfSprayWaveMemory.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /*
  2. * Copyright (C) 2010 Christian Glindkamp <christian.glindkamp@taskit.de>
  3. * taskit GmbH
  4. * 2010 Igor Plyatov <plyatov@gmail.com>
  5. * GeoSIG Ltd
  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; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #include <linux/platform_device.h>
  22. #include <linux/gpio.h>
  23. #include <linux/w1-gpio.h>
  24. #include <linux/i2c.h>
  25. #include <linux/i2c/pcf857x.h>
  26. #include <linux/gpio_keys.h>
  27. #include <linux/input.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/mach/arch.h>
  30. #include <mach/at91sam9_smc.h>
  31. #include "at91_aic.h"
  32. #include "board.h"
  33. #include "sam9_smc.h"
  34. #include "generic.h"
  35. #include "gsia18s.h"
  36. #include "stamp9g20.h"
  37. static void __init gsia18s_init_early(void)
  38. {
  39. stamp9g20_init_early();
  40. }
  41. /*
  42. * Two USB Host ports
  43. */
  44. static struct at91_usbh_data __initdata usbh_data = {
  45. .ports = 2,
  46. .vbus_pin = {-EINVAL, -EINVAL},
  47. .overcurrent_pin= {-EINVAL, -EINVAL},
  48. };
  49. /*
  50. * USB Device port
  51. */
  52. static struct at91_udc_data __initdata udc_data = {
  53. .vbus_pin = AT91_PIN_PA22,
  54. .pullup_pin = -EINVAL, /* pull-up driven by UDC */
  55. };
  56. /*
  57. * MACB Ethernet device
  58. */
  59. static struct macb_platform_data __initdata macb_data = {
  60. .phy_irq_pin = AT91_PIN_PA28,
  61. .is_rmii = 1,
  62. };
  63. /*
  64. * LEDs and GPOs
  65. */
  66. static struct gpio_led gpio_leds[] = {
  67. {
  68. .name = "gpo:spi1reset",
  69. .gpio = AT91_PIN_PC1,
  70. .active_low = 0,
  71. .default_trigger = "none",
  72. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  73. },
  74. {
  75. .name = "gpo:trig_net_out",
  76. .gpio = AT91_PIN_PB20,
  77. .active_low = 0,
  78. .default_trigger = "none",
  79. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  80. },
  81. {
  82. .name = "gpo:trig_net_dir",
  83. .gpio = AT91_PIN_PB19,
  84. .active_low = 0,
  85. .default_trigger = "none",
  86. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  87. },
  88. {
  89. .name = "gpo:charge_dis",
  90. .gpio = AT91_PIN_PC2,
  91. .active_low = 0,
  92. .default_trigger = "none",
  93. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  94. },
  95. {
  96. .name = "led:event",
  97. .gpio = AT91_PIN_PB17,
  98. .active_low = 1,
  99. .default_trigger = "none",
  100. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  101. },
  102. {
  103. .name = "led:lan",
  104. .gpio = AT91_PIN_PB18,
  105. .active_low = 1,
  106. .default_trigger = "none",
  107. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  108. },
  109. {
  110. .name = "led:error",
  111. .gpio = AT91_PIN_PB16,
  112. .active_low = 1,
  113. .default_trigger = "none",
  114. .default_state = LEDS_GPIO_DEFSTATE_ON,
  115. }
  116. };
  117. static struct gpio_led_platform_data gpio_led_info = {
  118. .leds = gpio_leds,
  119. .num_leds = ARRAY_SIZE(gpio_leds),
  120. };
  121. static struct platform_device leds = {
  122. .name = "leds-gpio",
  123. .id = 0,
  124. .dev = {
  125. .platform_data = &gpio_led_info,
  126. }
  127. };
  128. static void __init gsia18s_leds_init(void)
  129. {
  130. platform_device_register(&leds);
  131. }
  132. /* PCF8574 0x20 GPIO - U1 on the GS_IA18-CB_V3 board */
  133. static struct gpio_led pcf_gpio_leds1[] = {
  134. { /* bit 0 */
  135. .name = "gpo:hdc_power",
  136. .gpio = PCF_GPIO_HDC_POWER,
  137. .active_low = 0,
  138. .default_trigger = "none",
  139. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  140. },
  141. { /* bit 1 */
  142. .name = "gpo:wifi_setup",
  143. .gpio = PCF_GPIO_WIFI_SETUP,
  144. .active_low = 1,
  145. .default_trigger = "none",
  146. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  147. },
  148. { /* bit 2 */
  149. .name = "gpo:wifi_enable",
  150. .gpio = PCF_GPIO_WIFI_ENABLE,
  151. .active_low = 1,
  152. .default_trigger = "none",
  153. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  154. },
  155. { /* bit 3 */
  156. .name = "gpo:wifi_reset",
  157. .gpio = PCF_GPIO_WIFI_RESET,
  158. .active_low = 1,
  159. .default_trigger = "none",
  160. .default_state = LEDS_GPIO_DEFSTATE_ON,
  161. },
  162. /* bit 4 used as GPI */
  163. { /* bit 5 */
  164. .name = "gpo:gps_setup",
  165. .gpio = PCF_GPIO_GPS_SETUP,
  166. .active_low = 1,
  167. .default_trigger = "none",
  168. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  169. },
  170. { /* bit 6 */
  171. .name = "gpo:gps_standby",
  172. .gpio = PCF_GPIO_GPS_STANDBY,
  173. .active_low = 0,
  174. .default_trigger = "none",
  175. .default_state = LEDS_GPIO_DEFSTATE_ON,
  176. },
  177. { /* bit 7 */
  178. .name = "gpo:gps_power",
  179. .gpio = PCF_GPIO_GPS_POWER,
  180. .active_low = 0,
  181. .default_trigger = "none",
  182. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  183. }
  184. };
  185. static struct gpio_led_platform_data pcf_gpio_led_info1 = {
  186. .leds = pcf_gpio_leds1,
  187. .num_leds = ARRAY_SIZE(pcf_gpio_leds1),
  188. };
  189. static struct platform_device pcf_leds1 = {
  190. .name = "leds-gpio", /* GS_IA18-CB_board */
  191. .id = 1,
  192. .dev = {
  193. .platform_data = &pcf_gpio_led_info1,
  194. }
  195. };
  196. /* PCF8574 0x22 GPIO - U1 on the GS_2G_OPT1-A_V0 board (Alarm) */
  197. static struct gpio_led pcf_gpio_leds2[] = {
  198. { /* bit 0 */
  199. .name = "gpo:alarm_1",
  200. .gpio = PCF_GPIO_ALARM1,
  201. .active_low = 1,
  202. .default_trigger = "none",
  203. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  204. },
  205. { /* bit 1 */
  206. .name = "gpo:alarm_2",
  207. .gpio = PCF_GPIO_ALARM2,
  208. .active_low = 1,
  209. .default_trigger = "none",
  210. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  211. },
  212. { /* bit 2 */
  213. .name = "gpo:alarm_3",
  214. .gpio = PCF_GPIO_ALARM3,
  215. .active_low = 1,
  216. .default_trigger = "none",
  217. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  218. },
  219. { /* bit 3 */
  220. .name = "gpo:alarm_4",
  221. .gpio = PCF_GPIO_ALARM4,
  222. .active_low = 1,
  223. .default_trigger = "none",
  224. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  225. },
  226. /* bits 4, 5, 6 not used */
  227. { /* bit 7 */
  228. .name = "gpo:alarm_v_relay_on",
  229. .gpio = PCF_GPIO_ALARM_V_RELAY_ON,
  230. .active_low = 0,
  231. .default_trigger = "none",
  232. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  233. },
  234. };
  235. static struct gpio_led_platform_data pcf_gpio_led_info2 = {
  236. .leds = pcf_gpio_leds2,
  237. .num_leds = ARRAY_SIZE(pcf_gpio_leds2),
  238. };
  239. static struct platform_device pcf_leds2 = {
  240. .name = "leds-gpio",
  241. .id = 2,
  242. .dev = {
  243. .platform_data = &pcf_gpio_led_info2,
  244. }
  245. };
  246. /* PCF8574 0x24 GPIO U1 on the GS_2G-OPT23-A_V0 board (Modem) */
  247. static struct gpio_led pcf_gpio_leds3[] = {
  248. { /* bit 0 */
  249. .name = "gpo:modem_power",
  250. .gpio = PCF_GPIO_MODEM_POWER,
  251. .active_low = 1,
  252. .default_trigger = "none",
  253. .default_state = LEDS_GPIO_DEFSTATE_OFF,
  254. },
  255. /* bits 1 and 2 not used */
  256. { /* bit 3 */
  257. .name = "gpo:modem_reset",
  258. .gpio = PCF_GPIO_MODEM_RESET,
  259. .active_low = 1,
  260. .default_trigger = "none",
  261. .default_state = LEDS_GPIO_DEFSTATE_ON,
  262. },
  263. /* bits 4, 5 and 6 not used */
  264. { /* bit 7 */
  265. .name = "gpo:trx_reset",
  266. .gpio = PCF_GPIO_TRX_RESET,
  267. .active_low = 1,
  268. .default_trigger = "none",
  269. .default_state = LEDS_GPIO_DEFSTATE_ON,
  270. }
  271. };
  272. static struct gpio_led_platform_data pcf_gpio_led_info3 = {
  273. .leds = pcf_gpio_leds3,
  274. .num_leds = ARRAY_SIZE(pcf_gpio_leds3),
  275. };
  276. static struct platform_device pcf_leds3 = {
  277. .name = "leds-gpio",
  278. .id = 3,
  279. .dev = {
  280. .platform_data = &pcf_gpio_led_info3,
  281. }
  282. };
  283. static void __init gsia18s_pcf_leds_init(void)
  284. {
  285. platform_device_register(&pcf_leds1);
  286. platform_device_register(&pcf_leds2);