alarmMemoryDefinition.c 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. /*
  2. * Copyright (C) 2008-2012 ST-Ericsson
  3. *
  4. * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2, as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/io.h>
  16. #include <linux/i2c.h>
  17. #include <linux/platform_data/i2c-nomadik.h>
  18. #include <linux/platform_data/db8500_thermal.h>
  19. #include <linux/gpio.h>
  20. #include <linux/amba/bus.h>
  21. #include <linux/amba/pl022.h>
  22. #include <linux/amba/serial.h>
  23. #include <linux/spi/spi.h>
  24. #include <linux/mfd/abx500/ab8500.h>
  25. #include <linux/regulator/ab8500.h>
  26. #include <linux/regulator/fixed.h>
  27. #include <linux/mfd/tc3589x.h>
  28. #include <linux/mfd/tps6105x.h>
  29. #include <linux/mfd/abx500/ab8500-gpio.h>
  30. #include <linux/mfd/abx500/ab8500-codec.h>
  31. #include <linux/leds-lp5521.h>
  32. #include <linux/input.h>
  33. #include <linux/smsc911x.h>
  34. #include <linux/gpio_keys.h>
  35. #include <linux/delay.h>
  36. #include <linux/leds.h>
  37. #include <linux/pinctrl/consumer.h>
  38. #include <linux/platform_data/pinctrl-nomadik.h>
  39. #include <linux/platform_data/dma-ste-dma40.h>
  40. #include <asm/mach-types.h>
  41. #include <asm/mach/arch.h>
  42. #include <asm/hardware/gic.h>
  43. #include <mach/hardware.h>
  44. #include <mach/setup.h>
  45. #include <mach/devices.h>
  46. #include <mach/irqs.h>
  47. #include <linux/platform_data/crypto-ux500.h>
  48. #include "ste-dma40-db8500.h"
  49. #include "devices-db8500.h"
  50. #include "board-mop500.h"
  51. #include "board-mop500-regulators.h"
  52. static struct gpio_led snowball_led_array[] = {
  53. {
  54. .name = "user_led",
  55. .default_trigger = "heartbeat",
  56. .gpio = 142,
  57. },
  58. };
  59. static struct gpio_led_platform_data snowball_led_data = {
  60. .leds = snowball_led_array,
  61. .num_leds = ARRAY_SIZE(snowball_led_array),
  62. };
  63. static struct platform_device snowball_led_dev = {
  64. .name = "leds-gpio",
  65. .dev = {
  66. .platform_data = &snowball_led_data,
  67. },
  68. };
  69. static struct fixed_voltage_config snowball_gpio_en_3v3_data = {
  70. .supply_name = "EN-3V3",
  71. .gpio = SNOWBALL_EN_3V3_ETH_GPIO,
  72. .microvolts = 3300000,
  73. .enable_high = 1,
  74. .init_data = &gpio_en_3v3_regulator,
  75. .startup_delay = 5000, /* 1200us */
  76. };
  77. static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
  78. .name = "reg-fixed-voltage",
  79. .id = 1,
  80. .dev = {
  81. .platform_data = &snowball_gpio_en_3v3_data,
  82. },
  83. };
  84. static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
  85. .gpio_base = MOP500_AB8500_PIN_GPIO(1),
  86. .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
  87. /* config_reg is the initial configuration of ab8500 pins.
  88. * The pins can be configured as GPIO or alt functions based
  89. * on value present in GpioSel1 to GpioSel6 and AlternatFunction
  90. * register. This is the array of 7 configuration settings.
  91. * One has to compile time decide these settings. Below is the
  92. * explanation of these setting
  93. * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
  94. * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
  95. * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
  96. * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
  97. * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
  98. * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
  99. * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
  100. * as GPIO then this register selectes the alternate fucntions
  101. */
  102. .config_reg = {0x00, 0x1E, 0x80, 0x01,
  103. 0x7A, 0x00, 0x00},
  104. };
  105. /* ab8500-codec */
  106. static struct ab8500_codec_platform_data ab8500_codec_pdata = {
  107. .amics = {
  108. .mic1_type = AMIC_TYPE_DIFFERENTIAL,
  109. .mic2_type = AMIC_TYPE_DIFFERENTIAL,
  110. .mic1a_micbias = AMIC_MICBIAS_VAMIC1,
  111. .mic1b_micbias = AMIC_MICBIAS_VAMIC1,
  112. .mic2_micbias = AMIC_MICBIAS_VAMIC2
  113. },
  114. .ear_cmv = EAR_CMV_0_95V
  115. };
  116. static struct gpio_keys_button snowball_key_array[] = {
  117. {
  118. .gpio = 32,
  119. .type = EV_KEY,
  120. .code = KEY_1,
  121. .desc = "userpb",
  122. .active_low = 1,
  123. .debounce_interval = 50,
  124. .wakeup = 1,
  125. },
  126. {
  127. .gpio = 151,
  128. .type = EV_KEY,
  129. .code = KEY_2,
  130. .desc = "extkb1",
  131. .active_low = 1,
  132. .debounce_interval = 50,
  133. .wakeup = 1,
  134. },
  135. {
  136. .gpio = 152,
  137. .type = EV_KEY,
  138. .code = KEY_3,
  139. .desc = "extkb2",
  140. .active_low = 1,
  141. .debounce_interval = 50,
  142. .wakeup = 1,
  143. },
  144. {
  145. .gpio = 161,
  146. .type = EV_KEY,
  147. .code = KEY_4,
  148. .desc = "extkb3",
  149. .active_low = 1,
  150. .debounce_interval = 50,
  151. .wakeup = 1,
  152. },
  153. {
  154. .gpio = 162,
  155. .type = EV_KEY,
  156. .code = KEY_5,
  157. .desc = "extkb4",
  158. .active_low = 1,
  159. .debounce_interval = 50,
  160. .wakeup = 1,
  161. },
  162. };
  163. static struct gpio_keys_platform_data snowball_key_data = {
  164. .buttons = snowball_key_array,
  165. .nbuttons = ARRAY_SIZE(snowball_key_array),
  166. };
  167. static struct platform_device snowball_key_dev = {
  168. .name = "gpio-keys",
  169. .id = -1,
  170. .dev = {
  171. .platform_data = &snowball_key_data,
  172. }
  173. };
  174. static struct smsc911x_platform_config snowball_sbnet_cfg = {
  175. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  176. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  177. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  178. .shift = 1,
  179. };
  180. static struct resource sbnet_res[] = {
  181. {
  182. .name = "smsc911x-memory",
  183. .start = (0x5000 << 16),
  184. .end = (0x5000 << 16) + 0xffff,
  185. .flags = IORESOURCE_MEM,
  186. },
  187. {
  188. .start = NOMADIK_GPIO_TO_IRQ(140),
  189. .end = NOMADIK_GPIO_TO_IRQ(140),
  190. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  191. },
  192. };
  193. static struct platform_device snowball_sbnet_dev = {
  194. .name = "smsc911x",
  195. .num_resources = ARRAY_SIZE(sbnet_res),
  196. .resource = sbnet_res,
  197. .dev = {
  198. .platform_data = &snowball_sbnet_cfg,
  199. },
  200. };
  201. static struct ab8500_platform_data ab8500_platdata = {
  202. .irq_base = MOP500_AB8500_IRQ_BASE,
  203. .regulator_reg_init = ab8500_regulator_reg_init,
  204. .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init),
  205. .regulator = ab8500_regulators,
  206. .num_regulator = ARRAY_SIZE(ab8500_regulators),
  207. .gpio = &ab8500_gpio_pdata,
  208. .codec = &ab8500_codec_pdata,
  209. };
  210. /*
  211. * Thermal Sensor
  212. */
  213. static struct resource db8500_thsens_resources[] = {
  214. {
  215. .name = "IRQ_HOTMON_LOW",
  216. .start = IRQ_PRCMU_HOTMON_LOW,
  217. .end = IRQ_PRCMU_HOTMON_LOW,
  218. .flags = IORESOURCE_IRQ,
  219. },
  220. {
  221. .name = "IRQ_HOTMON_HIGH",
  222. .start = IRQ_PRCMU_HOTMON_HIGH,
  223. .end = IRQ_PRCMU_HOTMON_HIGH,
  224. .flags = IORESOURCE_IRQ,
  225. },
  226. };
  227. static struct db8500_thsens_platform_data db8500_thsens_data = {
  228. .trip_points[0] = {
  229. .temp = 70000,
  230. .type = THERMAL_TRIP_ACTIVE,
  231. .cdev_name = {
  232. [0] = "thermal-cpufreq-0",
  233. },
  234. },
  235. .trip_points[1] = {
  236. .temp = 75000,
  237. .type = THERMAL_TRIP_ACTIVE,
  238. .cdev_name = {
  239. [0] = "thermal-cpufreq-0",
  240. },
  241. },
  242. .trip_points[2] = {
  243. .temp = 80000,
  244. .type = THERMAL_TRIP_ACTIVE,
  245. .cdev_name = {
  246. [0] = "thermal-cpufreq-0",
  247. },
  248. },
  249. .trip_points[3] = {
  250. .temp = 85000,
  251. .type = THERMAL_TRIP_CRITICAL,
  252. },
  253. .num_trips = 4,
  254. };
  255. static struct platform_device u8500_thsens_device = {
  256. .name = "db8500-thermal",
  257. .resource = db8500_thsens_resources,
  258. .num_resources = ARRAY_SIZE(db8500_thsens_resources),
  259. .dev = {
  260. .platform_data = &db8500_thsens_data,
  261. },
  262. };
  263. static struct platform_device u8500_cpufreq_cooling_device = {
  264. .name = "db8500-cpufreq-cooling",
  265. };
  266. /*
  267. * TPS61052
  268. */
  269. static struct tps6105x_platform_data mop500_tps61052_data = {
  270. .mode = TPS6105X_MODE_VOLTAGE,
  271. .regulator_data = &tps61052_regulator,
  272. };
  273. /*
  274. * TC35892
  275. */
  276. static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
  277. {
  278. struct device *parent = NULL;
  279. #if 0
  280. /* FIXME: Is the sdi actually part of tc3589x? */
  281. parent = tc3589x->dev;
  282. #endif
  283. mop500_sdi_tc35892_init(parent);
  284. }
  285. static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
  286. .gpio_base = MOP500_EGPIO(0),
  287. .setup = mop500_tc35892_init,
  288. };
  289. static struct tc3589x_platform_data mop500_tc35892_data = {
  290. .block = TC3589x_BLOCK_GPIO,
  291. .gpio = &mop500_tc35892_gpio_data,
  292. .irq_base = MOP500_EGPIO_IRQ_BASE,
  293. };
  294. static struct lp5521_led_config lp5521_pri_led[] = {
  295. [0] = {
  296. .chan_nr = 0,