aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/hwmon/vexpress.txt23
-rw-r--r--Documentation/hwmon/vexpress34
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c425
-rw-r--r--arch/arm/mach-vexpress/reset.c141
-rw-r--r--drivers/hwmon/Kconfig8
-rw-r--r--drivers/hwmon/Makefile1
-rw-r--r--drivers/hwmon/vexpress.c229
7 files changed, 796 insertions, 65 deletions
diff --git a/Documentation/devicetree/bindings/hwmon/vexpress.txt b/Documentation/devicetree/bindings/hwmon/vexpress.txt
new file mode 100644
index 000000000000..9c27ed694bbb
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/vexpress.txt
@@ -0,0 +1,23 @@
1Versatile Express hwmon sensors
2-------------------------------
3
4Requires node properties:
5- "compatible" value : one of
6 "arm,vexpress-volt"
7 "arm,vexpress-amp"
8 "arm,vexpress-temp"
9 "arm,vexpress-power"
10 "arm,vexpress-energy"
11- "arm,vexpress-sysreg,func" when controlled via vexpress-sysreg
12 (see Documentation/devicetree/bindings/arm/vexpress-sysreg.txt
13 for more details)
14
15Optional node properties:
16- label : string describing the monitored value
17
18Example:
19 energy@0 {
20 compatible = "arm,vexpress-energy";
21 arm,vexpress-sysreg,func = <13 0>;
22 label = "A15 Jcore";
23 };
diff --git a/Documentation/hwmon/vexpress b/Documentation/hwmon/vexpress
new file mode 100644
index 000000000000..557d6d5ad90d
--- /dev/null
+++ b/Documentation/hwmon/vexpress
@@ -0,0 +1,34 @@
1Kernel driver vexpress
2======================
3
4Supported systems:
5 * ARM Ltd. Versatile Express platform
6 Prefix: 'vexpress'
7 Datasheets:
8 * "Hardware Description" sections of the Technical Reference Manuals
9 for the Versatile Express boards:
10 http://infocenter.arm.com/help/topic/com.arm.doc.subset.boards.express/index.html
11 * Section "4.4.14. System Configuration registers" of the V2M-P1 TRM:
12 http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0447-/index.html
13
14Author: Pawel Moll
15
16Description
17-----------
18
19Versatile Express platform (http://www.arm.com/versatileexpress/) is a
20reference & prototyping system for ARM Ltd. processors. It can be set up
21from a wide range of boards, each of them containing (apart of the main
22chip/FPGA) a number of microcontrollers responsible for platform
23configuration and control. Theses microcontrollers can also monitor the
24board and its environment by a number of internal and external sensors,
25providing information about power lines voltages and currents, board
26temperature and power usage. Some of them also calculate consumed energy
27and provide a cumulative use counter.
28
29The configuration devices are _not_ memory mapped and must be accessed
30via a custom interface, abstracted by the "vexpress_config" API.
31
32As these devices are non-discoverable, they must be described in a Device
33Tree passed to the kernel. Details of the DT binding for them can be found
34in Documentation/devicetree/bindings/hwmon/vexpress.txt.
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index a267c6d30e37..6679d8a7c682 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -34,8 +34,6 @@ BIAS(in_nopull, PIN_INPUT_NOPULL);
34BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE); 34BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE);
35BIAS(in_pu, PIN_INPUT_PULLUP); 35BIAS(in_pu, PIN_INPUT_PULLUP);
36BIAS(in_pd, PIN_INPUT_PULLDOWN); 36BIAS(in_pd, PIN_INPUT_PULLDOWN);
37BIAS(in_pd_slpm_in_pu, PIN_INPUT_PULLDOWN|PIN_SLPM_INPUT_PULLUP);
38BIAS(in_pu_slpm_out_lo, PIN_INPUT_PULLUP|PIN_SLPM_OUTPUT_LOW);
39BIAS(out_hi, PIN_OUTPUT_HIGH); 37BIAS(out_hi, PIN_OUTPUT_HIGH);
40BIAS(out_lo, PIN_OUTPUT_LOW); 38BIAS(out_lo, PIN_OUTPUT_LOW);
41BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE); 39BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
@@ -47,14 +45,34 @@ BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SL
47BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED); 45BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
48BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED); 46BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
49/* Sleep modes */ 47/* Sleep modes */
50BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 48BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|
51BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); 49 PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE);
52BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 50BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|
53BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 51 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
54BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 52BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|
55BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE); 53 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
56BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 54BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED|
57BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 55 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED);
56BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|
57 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE);
58BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|
59 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
60BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|
61 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
62BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|
63 PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
64BIAS(slpm_in_pu_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_PULLUP|
65 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
66BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|
67 PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
68BIAS(out_lo_wkup_pdis, PIN_SLPM_OUTPUT_LOW|
69 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
70BIAS(in_wkup_pdis_en, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
71 PIN_SLPM_PDIS_ENABLED);
72BIAS(in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|
73 PIN_SLPM_PDIS_DISABLED);
74BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|
75 PIN_SLPM_PDIS_DISABLED);
58 76
59/* We use these to define hog settings that are always done on boot */ 77/* We use these to define hog settings that are always done on boot */
60#define DB8500_MUX_HOG(group,func) \ 78#define DB8500_MUX_HOG(group,func) \
@@ -70,13 +88,16 @@ BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_NOPULL|PIN_S
70 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func) 88 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func)
71#define DB8500_PIN(pin,conf,dev) \ 89#define DB8500_PIN(pin,conf,dev) \
72 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf) 90 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf)
73#define DB8500_PIN_SLEEP(pin, conf, dev) \ 91#define DB8500_PIN_IDLE(pin, conf, dev) \
74 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ 92 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_IDLE, "pinctrl-db8500", \
75 pin, conf) 93 pin, conf)
76 94#define DB8500_PIN_SLEEP(pin, conf, dev) \
77#define DB8500_PIN_SLEEP(pin,conf,dev) \
78 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ 95 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
79 pin, conf) 96 pin, conf)
97#define DB8500_MUX_STATE(group, func, dev, state) \
98 PIN_MAP_MUX_GROUP(dev, state, "pinctrl-db8500", group, func)
99#define DB8500_PIN_STATE(pin, conf, dev, state) \
100 PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-db8500", pin, conf)
80 101
81/* Pin control settings */ 102/* Pin control settings */
82static struct pinctrl_map __initdata mop500_family_pinmap[] = { 103static struct pinctrl_map __initdata mop500_family_pinmap[] = {
@@ -113,7 +134,7 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
113 * UART0, we do not mux in u0 here. 134 * UART0, we do not mux in u0 here.
114 * uart-0 pins gpio configuration should be kept intact to prevent 135 * uart-0 pins gpio configuration should be kept intact to prevent
115 * a glitch in tx line when the tty dev is opened. Later these pins 136 * a glitch in tx line when the tty dev is opened. Later these pins
116 * are configured to uart mop500_pins_uart0 137 * are configured by uart driver
117 */ 138 */
118 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */ 139 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */
119 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */ 140 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */
@@ -124,12 +145,13 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
124 * TODO: is this used on U8500 variants and Snowball really? 145 * TODO: is this used on U8500 variants and Snowball really?
125 * The setting on GPIO31 conflicts with magnetometer use on hrefv60 146 * The setting on GPIO31 conflicts with magnetometer use on hrefv60
126 */ 147 */
127 DB8500_MUX_HOG("u2rxtx_c_1", "u2"), 148 /* default state for UART2 */
128 DB8500_MUX_HOG("u2ctsrts_c_1", "u2"), 149 DB8500_MUX("u2rxtx_c_1", "u2", "uart2"),
129 DB8500_PIN_HOG("GPIO29_W2", in_pu), /* RXD */ 150 DB8500_PIN("GPIO29_W2", in_pu, "uart2"), /* RXD */
130 DB8500_PIN_HOG("GPIO30_W3", out_hi), /* TXD */ 151 DB8500_PIN("GPIO30_W3", out_hi, "uart2"), /* TXD */
131 DB8500_PIN_HOG("GPIO31_V3", in_pu), /* CTS */ 152 /* Sleep state for UART2 */
132 DB8500_PIN_HOG("GPIO32_V2", out_hi), /* RTS */ 153 DB8500_PIN_SLEEP("GPIO29_W2", in_wkup_pdis, "uart2"),
154 DB8500_PIN_SLEEP("GPIO30_W3", out_wkup_pdis, "uart2"),
133 /* 155 /*
134 * The following pin sets were known as "runtime pins" before being 156 * The following pin sets were known as "runtime pins" before being
135 * converted to the pinctrl model. Here we model them as "default" 157 * converted to the pinctrl model. Here we model them as "default"
@@ -141,11 +163,18 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
141 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */ 163 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */
142 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */ 164 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */
143 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */ 165 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */
144 /* UART0 sleep state */ 166 /* Sleep state for UART0 */
145 DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"), 167 DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"),
146 DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"), 168 DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"),
147 DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"), 169 DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"),
148 DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"), 170 DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"),
171 /* Mux in UART1 after initialization */
172 DB8500_MUX("u1rxtx_a_1", "u1", "uart1"),
173 DB8500_PIN("GPIO4_AH6", in_pu, "uart1"), /* RXD */
174 DB8500_PIN("GPIO5_AG6", out_hi, "uart1"), /* TXD */
175 /* Sleep state for UART1 */
176 DB8500_PIN_SLEEP("GPIO4_AH6", slpm_in_wkup_pdis, "uart1"),
177 DB8500_PIN_SLEEP("GPIO5_AG6", slpm_out_wkup_pdis, "uart1"),
149 /* MSP1 for ALSA codec */ 178 /* MSP1 for ALSA codec */
150 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"), 179 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"),
151 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"), 180 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"),
@@ -162,7 +191,10 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
162 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"), 191 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
163 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"), 192 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
164 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */ 193 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */
165 DB8500_MUX("lcdvsi1_a_1", "lcd", "av8100-hdmi"), 194 DB8500_MUX("lcdvsi1_a_1", "lcd", "0-0070"),
195 DB8500_PIN("GPIO69_E2", in_pu, "0-0070"),
196 /* LCD VSI1 sleep state */
197 DB8500_PIN_SLEEP("GPIO69_E2", slpm_in_wkup_pdis, "0-0070"),
166 /* Mux in i2c0 block, default state */ 198 /* Mux in i2c0 block, default state */
167 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"), 199 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"),
168 /* i2c0 sleep state */ 200 /* i2c0 sleep state */
@@ -195,6 +227,18 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
195 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */ 227 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */
196 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */ 228 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */
197 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */ 229 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */
230 /* SDI0 sleep state */
231 DB8500_PIN_SLEEP("GPIO18_AC2", slpm_out_hi_wkup_pdis, "sdi0"),
232 DB8500_PIN_SLEEP("GPIO19_AC1", slpm_out_hi_wkup_pdis, "sdi0"),
233 DB8500_PIN_SLEEP("GPIO20_AB4", slpm_out_hi_wkup_pdis, "sdi0"),
234 DB8500_PIN_SLEEP("GPIO22_AA3", slpm_in_wkup_pdis, "sdi0"),
235 DB8500_PIN_SLEEP("GPIO23_AA4", slpm_out_lo_wkup_pdis, "sdi0"),
236 DB8500_PIN_SLEEP("GPIO24_AB2", slpm_in_wkup_pdis, "sdi0"),
237 DB8500_PIN_SLEEP("GPIO25_Y4", slpm_in_wkup_pdis, "sdi0"),
238 DB8500_PIN_SLEEP("GPIO26_Y2", slpm_in_wkup_pdis, "sdi0"),
239 DB8500_PIN_SLEEP("GPIO27_AA2", slpm_in_wkup_pdis, "sdi0"),
240 DB8500_PIN_SLEEP("GPIO28_AA1", slpm_in_wkup_pdis, "sdi0"),
241
198 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */ 242 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */
199 DB8500_MUX("mc1_a_1", "mc1", "sdi1"), 243 DB8500_MUX("mc1_a_1", "mc1", "sdi1"),
200 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */ 244 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */
@@ -204,6 +248,15 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
204 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */ 248 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */
205 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */ 249 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */
206 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */ 250 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */
251 /* SDI1 sleep state */
252 DB8500_PIN_SLEEP("GPIO208_AH16", slpm_out_lo_wkup_pdis, "sdi1"), /* CLK */
253 DB8500_PIN_SLEEP("GPIO209_AG15", slpm_in_wkup_pdis, "sdi1"), /* FBCLK */
254 DB8500_PIN_SLEEP("GPIO210_AJ15", slpm_in_wkup_pdis, "sdi1"), /* CMD */
255 DB8500_PIN_SLEEP("GPIO211_AG14", slpm_in_wkup_pdis, "sdi1"), /* DAT0 */
256 DB8500_PIN_SLEEP("GPIO212_AF13", slpm_in_wkup_pdis, "sdi1"), /* DAT1 */
257 DB8500_PIN_SLEEP("GPIO213_AG13", slpm_in_wkup_pdis, "sdi1"), /* DAT2 */
258 DB8500_PIN_SLEEP("GPIO214_AH15", slpm_in_wkup_pdis, "sdi1"), /* DAT3 */
259
207 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */ 260 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */
208 DB8500_MUX("mc2_a_1", "mc2", "sdi2"), 261 DB8500_MUX("mc2_a_1", "mc2", "sdi2"),
209 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */ 262 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */
@@ -217,6 +270,19 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
217 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */ 270 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */
218 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */ 271 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */
219 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */ 272 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */
273 /* SDI2 sleep state */
274 DB8500_PIN_SLEEP("GPIO128_A5", out_lo_wkup_pdis, "sdi2"), /* CLK */
275 DB8500_PIN_SLEEP("GPIO129_B4", in_wkup_pdis_en, "sdi2"), /* CMD */
276 DB8500_PIN_SLEEP("GPIO130_C8", in_wkup_pdis_en, "sdi2"), /* FBCLK */
277 DB8500_PIN_SLEEP("GPIO131_A12", in_wkup_pdis, "sdi2"), /* DAT0 */
278 DB8500_PIN_SLEEP("GPIO132_C10", in_wkup_pdis, "sdi2"), /* DAT1 */
279 DB8500_PIN_SLEEP("GPIO133_B10", in_wkup_pdis, "sdi2"), /* DAT2 */
280 DB8500_PIN_SLEEP("GPIO134_B9", in_wkup_pdis, "sdi2"), /* DAT3 */
281 DB8500_PIN_SLEEP("GPIO135_A9", in_wkup_pdis, "sdi2"), /* DAT4 */
282 DB8500_PIN_SLEEP("GPIO136_C7", in_wkup_pdis, "sdi2"), /* DAT5 */
283 DB8500_PIN_SLEEP("GPIO137_A7", in_wkup_pdis, "sdi2"), /* DAT6 */
284 DB8500_PIN_SLEEP("GPIO138_C5", in_wkup_pdis, "sdi2"), /* DAT7 */
285
220 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */ 286 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */
221 DB8500_MUX("mc4_a_1", "mc4", "sdi4"), 287 DB8500_MUX("mc4_a_1", "mc4", "sdi4"),
222 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */ 288 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */
@@ -230,6 +296,19 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
230 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */ 296 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */
231 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */ 297 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */
232 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */ 298 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */
299 /*SDI4 sleep state */
300 DB8500_PIN_SLEEP("GPIO197_AH24", slpm_in_wkup_pdis, "sdi4"), /* DAT3 */
301 DB8500_PIN_SLEEP("GPIO198_AG25", slpm_in_wkup_pdis, "sdi4"), /* DAT2 */
302 DB8500_PIN_SLEEP("GPIO199_AH23", slpm_in_wkup_pdis, "sdi4"), /* DAT1 */
303 DB8500_PIN_SLEEP("GPIO200_AH26", slpm_in_wkup_pdis, "sdi4"), /* DAT0 */
304 DB8500_PIN_SLEEP("GPIO201_AF24", slpm_in_wkup_pdis, "sdi4"), /* CMD */
305 DB8500_PIN_SLEEP("GPIO202_AF25", slpm_in_wkup_pdis, "sdi4"), /* FBCLK */
306 DB8500_PIN_SLEEP("GPIO203_AE23", slpm_out_lo_wkup_pdis, "sdi4"), /* CLK */
307 DB8500_PIN_SLEEP("GPIO204_AF23", slpm_in_wkup_pdis, "sdi4"), /* DAT7 */
308 DB8500_PIN_SLEEP("GPIO205_AG23", slpm_in_wkup_pdis, "sdi4"), /* DAT6 */
309 DB8500_PIN_SLEEP("GPIO206_AG24", slpm_in_wkup_pdis, "sdi4"), /* DAT5 */
310 DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */
311
233 /* Mux in USB pins, drive STP high */ 312 /* Mux in USB pins, drive STP high */
234 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), 313 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"),
235 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ 314 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */
@@ -239,10 +318,232 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
239 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */ 318 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */
240 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ 319 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
241 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ 320 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
321 /* SPI2 idle state */
322 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
323 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
324 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
242 /* SPI2 sleep state */ 325 /* SPI2 sleep state */
326 DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */
243 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ 327 DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */
244 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ 328 DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */
245 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ 329 DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */
330
331 /* ske default state */
332 DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
333 DB8500_PIN("GPIO153_B17", in_pd, "nmk-ske-keypad"), /* I7 */
334 DB8500_PIN("GPIO154_C16", in_pd, "nmk-ske-keypad"), /* I6 */
335 DB8500_PIN("GPIO155_C19", in_pd, "nmk-ske-keypad"), /* I5 */
336 DB8500_PIN("GPIO156_C17", in_pd, "nmk-ske-keypad"), /* I4 */
337 DB8500_PIN("GPIO161_D21", in_pd, "nmk-ske-keypad"), /* I3 */
338 DB8500_PIN("GPIO162_D20", in_pd, "nmk-ske-keypad"), /* I2 */
339 DB8500_PIN("GPIO163_C20", in_pd, "nmk-ske-keypad"), /* I1 */
340 DB8500_PIN("GPIO164_B21", in_pd, "nmk-ske-keypad"), /* I0 */
341 DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
342 DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
343 DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
344 DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
345 DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
346 DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
347 DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
348 DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
349 /* ske sleep state */
350 DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
351 DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
352 DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
353 DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
354 DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
355 DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
356 DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
357 DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
358 DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
359 DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
360 DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
361 DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
362 DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
363 DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
364 DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
365 DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
366
367 /* STM APE pins states */
368 DB8500_MUX_STATE("stmape_c_1", "stmape",
369 "stm", "ape_mipi34"),
370 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
371 "stm", "ape_mipi34"), /* clk */
372 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
373 "stm", "ape_mipi34"), /* dat3 */
374 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
375 "stm", "ape_mipi34"), /* dat2 */
376 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
377 "stm", "ape_mipi34"), /* dat1 */
378 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
379 "stm", "ape_mipi34"), /* dat0 */
380
381 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
382 "stm", "ape_mipi34_sleep"), /* clk */
383 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
384 "stm", "ape_mipi34_sleep"), /* dat3 */
385 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
386 "stm", "ape_mipi34_sleep"), /* dat2 */
387 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
388 "stm", "ape_mipi34_sleep"), /* dat1 */
389 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
390 "stm", "ape_mipi34_sleep"), /* dat0 */
391
392 DB8500_MUX_STATE("stmape_oc1_1", "stmape",
393 "stm", "ape_microsd"),
394 DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
395 "stm", "ape_microsd"), /* clk */
396 DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
397 "stm", "ape_microsd"), /* dat0 */
398 DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
399 "stm", "ape_microsd"), /* dat1 */
400 DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
401 "stm", "ape_microsd"), /* dat2 */
402 DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
403 "stm", "ape_microsd"), /* dat3 */
404
405 DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
406 "stm", "ape_microsd_sleep"), /* clk */
407 DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
408 "stm", "ape_microsd_sleep"), /* dat0 */
409 DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
410 "stm", "ape_microsd_sleep"), /* dat1 */
411 DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
412 "stm", "ape_microsd_sleep"), /* dat2 */
413 DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
414 "stm", "ape_microsd_sleep"), /* dat3 */
415
416 /* STM Modem pins states */
417 DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
418 "stm", "mod_mipi34"),
419 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
420 "stm", "mod_mipi34"),
421 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
422 "stm", "mod_mipi34"),
423 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
424 "stm", "mod_mipi34"), /* clk */
425 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
426 "stm", "mod_mipi34"), /* dat3 */
427 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
428 "stm", "mod_mipi34"), /* dat2 */
429 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
430 "stm", "mod_mipi34"), /* dat1 */
431 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
432 "stm", "mod_mipi34"), /* dat0 */
433 DB8500_PIN_STATE("GPIO75_H2", in_pu,
434 "stm", "mod_mipi34"), /* uartmod rx */
435 DB8500_PIN_STATE("GPIO76_J2", out_lo,
436 "stm", "mod_mipi34"), /* uartmod tx */
437
438 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
439 "stm", "mod_mipi34_sleep"), /* clk */
440 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
441 "stm", "mod_mipi34_sleep"), /* dat3 */
442 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
443 "stm", "mod_mipi34_sleep"), /* dat2 */
444 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
445 "stm", "mod_mipi34_sleep"), /* dat1 */
446 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
447 "stm", "mod_mipi34_sleep"), /* dat0 */
448 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
449 "stm", "mod_mipi34_sleep"), /* uartmod rx */
450 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
451 "stm", "mod_mipi34_sleep"), /* uartmod tx */
452
453 DB8500_MUX_STATE("stmmod_b_1", "stmmod",
454 "stm", "mod_microsd"),
455 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
456 "stm", "mod_microsd"),
457 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
458 "stm", "mod_microsd"),
459 DB8500_PIN_STATE("GPIO23_AA4", in_nopull,
460 "stm", "mod_microsd"), /* clk */
461 DB8500_PIN_STATE("GPIO25_Y4", in_nopull,
462 "stm", "mod_microsd"), /* dat0 */
463 DB8500_PIN_STATE("GPIO26_Y2", in_nopull,
464 "stm", "mod_microsd"), /* dat1 */
465 DB8500_PIN_STATE("GPIO27_AA2", in_nopull,
466 "stm", "mod_microsd"), /* dat2 */
467 DB8500_PIN_STATE("GPIO28_AA1", in_nopull,
468 "stm", "mod_microsd"), /* dat3 */
469 DB8500_PIN_STATE("GPIO75_H2", in_pu,
470 "stm", "mod_microsd"), /* uartmod rx */
471 DB8500_PIN_STATE("GPIO76_J2", out_lo,
472 "stm", "mod_microsd"), /* uartmod tx */
473
474 DB8500_PIN_STATE("GPIO23_AA4", slpm_out_lo_wkup_pdis,
475 "stm", "mod_microsd_sleep"), /* clk */
476 DB8500_PIN_STATE("GPIO25_Y4", slpm_in_wkup_pdis,
477 "stm", "mod_microsd_sleep"), /* dat0 */
478 DB8500_PIN_STATE("GPIO26_Y2", slpm_in_wkup_pdis,
479 "stm", "mod_microsd_sleep"), /* dat1 */
480 DB8500_PIN_STATE("GPIO27_AA2", slpm_in_wkup_pdis,
481 "stm", "mod_microsd_sleep"), /* dat2 */
482 DB8500_PIN_STATE("GPIO28_AA1", slpm_in_wkup_pdis,
483 "stm", "mod_microsd_sleep"), /* dat3 */
484 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
485 "stm", "mod_microsd_sleep"), /* uartmod rx */
486 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
487 "stm", "mod_microsd_sleep"), /* uartmod tx */
488
489 /* STM dual Modem/APE pins state */
490 DB8500_MUX_STATE("stmmod_oc3_2", "stmmod",
491 "stm", "mod_mipi34_ape_mipi60"),
492 DB8500_MUX_STATE("stmape_c_2", "stmape",
493 "stm", "mod_mipi34_ape_mipi60"),
494 DB8500_MUX_STATE("uartmodrx_oc3_1", "uartmod",
495 "stm", "mod_mipi34_ape_mipi60"),
496 DB8500_MUX_STATE("uartmodtx_oc3_1", "uartmod",
497 "stm", "mod_mipi34_ape_mipi60"),
498 DB8500_PIN_STATE("GPIO70_G5", in_nopull,
499 "stm", "mod_mipi34_ape_mipi60"), /* clk */
500 DB8500_PIN_STATE("GPIO71_G4", in_nopull,
501 "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
502 DB8500_PIN_STATE("GPIO72_H4", in_nopull,
503 "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
504 DB8500_PIN_STATE("GPIO73_H3", in_nopull,
505 "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
506 DB8500_PIN_STATE("GPIO74_J3", in_nopull,
507 "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
508 DB8500_PIN_STATE("GPIO75_H2", in_pu,
509 "stm", "mod_mipi34_ape_mipi60"), /* uartmod rx */
510 DB8500_PIN_STATE("GPIO76_J2", out_lo,
511 "stm", "mod_mipi34_ape_mipi60"), /* uartmod tx */
512 DB8500_PIN_STATE("GPIO155_C19", in_nopull,
513 "stm", "mod_mipi34_ape_mipi60"), /* clk */
514 DB8500_PIN_STATE("GPIO156_C17", in_nopull,
515 "stm", "mod_mipi34_ape_mipi60"), /* dat3 */
516 DB8500_PIN_STATE("GPIO157_A18", in_nopull,
517 "stm", "mod_mipi34_ape_mipi60"), /* dat2 */
518 DB8500_PIN_STATE("GPIO158_C18", in_nopull,
519 "stm", "mod_mipi34_ape_mipi60"), /* dat1 */
520 DB8500_PIN_STATE("GPIO159_B19", in_nopull,
521 "stm", "mod_mipi34_ape_mipi60"), /* dat0 */
522
523 DB8500_PIN_STATE("GPIO70_G5", slpm_out_lo_pdis,
524 "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
525 DB8500_PIN_STATE("GPIO71_G4", slpm_out_lo_pdis,
526 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
527 DB8500_PIN_STATE("GPIO72_H4", slpm_out_lo_pdis,
528 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
529 DB8500_PIN_STATE("GPIO73_H3", slpm_out_lo_pdis,
530 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
531 DB8500_PIN_STATE("GPIO74_J3", slpm_out_lo_pdis,
532 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
533 DB8500_PIN_STATE("GPIO75_H2", slpm_in_wkup_pdis,
534 "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod rx */
535 DB8500_PIN_STATE("GPIO76_J2", slpm_out_lo_wkup_pdis,
536 "stm", "mod_mipi34_ape_mipi60_sleep"), /* uartmod tx */
537 DB8500_PIN_STATE("GPIO155_C19", slpm_in_wkup_pdis,
538 "stm", "mod_mipi34_ape_mipi60_sleep"), /* clk */
539 DB8500_PIN_STATE("GPIO156_C17", slpm_in_wkup_pdis,
540 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat3 */
541 DB8500_PIN_STATE("GPIO157_A18", slpm_in_wkup_pdis,
542 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat2 */
543 DB8500_PIN_STATE("GPIO158_C18", slpm_in_wkup_pdis,
544 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat1 */
545 DB8500_PIN_STATE("GPIO159_B19", slpm_in_wkup_pdis,
546 "stm", "mod_mipi34_ape_mipi60_sleep"), /* dat0 */
246}; 547};
247 548
248/* 549/*
@@ -268,32 +569,48 @@ static struct pinctrl_map __initdata mop500_pinmap[] = {
268 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu), 569 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu),
269 /* Mux in UART1 and set the pull-ups */ 570 /* Mux in UART1 and set the pull-ups */
270 DB8500_MUX_HOG("u1rxtx_a_1", "u1"), 571 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
271 DB8500_MUX_HOG("u1ctsrts_a_1", "u1"),
272 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */ 572 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */
273 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */ 573 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */
274 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* CTS */
275 DB8500_PIN_HOG("GPIO7_AG5", out_hi), /* RTS */
276 /* 574 /*
277 * Runtime stuff: make it possible to mux in the SKE keypad 575 * Runtime stuff: make it possible to mux in the SKE keypad
278 * and bias the pins 576 * and bias the pins
279 */ 577 */
280 DB8500_MUX("kp_a_2", "kp", "ske"), 578 /* ske default state */
281 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */ 579 DB8500_MUX("kp_a_2", "kp", "nmk-ske-keypad"),
282 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */ 580 DB8500_PIN("GPIO153_B17", in_pu, "nmk-ske-keypad"), /* I7 */
283 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */ 581 DB8500_PIN("GPIO154_C16", in_pu, "nmk-ske-keypad"), /* I6 */
284 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */ 582 DB8500_PIN("GPIO155_C19", in_pu, "nmk-ske-keypad"), /* I5 */
285 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */ 583 DB8500_PIN("GPIO156_C17", in_pu, "nmk-ske-keypad"), /* I4 */
286 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */ 584 DB8500_PIN("GPIO161_D21", in_pu, "nmk-ske-keypad"), /* I3 */
287 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */ 585 DB8500_PIN("GPIO162_D20", in_pu, "nmk-ske-keypad"), /* I2 */
288 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */ 586 DB8500_PIN("GPIO163_C20", in_pu, "nmk-ske-keypad"), /* I1 */
289 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */ 587 DB8500_PIN("GPIO164_B21", in_pu, "nmk-ske-keypad"), /* I0 */
290 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */ 588 DB8500_PIN("GPIO157_A18", out_lo, "nmk-ske-keypad"), /* O7 */
291 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */ 589 DB8500_PIN("GPIO158_C18", out_lo, "nmk-ske-keypad"), /* O6 */
292 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */ 590 DB8500_PIN("GPIO159_B19", out_lo, "nmk-ske-keypad"), /* O5 */
293 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */ 591 DB8500_PIN("GPIO160_B20", out_lo, "nmk-ske-keypad"), /* O4 */
294 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */ 592 DB8500_PIN("GPIO165_C21", out_lo, "nmk-ske-keypad"), /* O3 */
295 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */ 593 DB8500_PIN("GPIO166_A22", out_lo, "nmk-ske-keypad"), /* O2 */
296 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */ 594 DB8500_PIN("GPIO167_B24", out_lo, "nmk-ske-keypad"), /* O1 */
595 DB8500_PIN("GPIO168_C22", out_lo, "nmk-ske-keypad"), /* O0 */
596 /* ske sleep state */
597 DB8500_PIN_SLEEP("GPIO153_B17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I7 */
598 DB8500_PIN_SLEEP("GPIO154_C16", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I6 */
599 DB8500_PIN_SLEEP("GPIO155_C19", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I5 */
600 DB8500_PIN_SLEEP("GPIO156_C17", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I4 */
601 DB8500_PIN_SLEEP("GPIO161_D21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I3 */
602 DB8500_PIN_SLEEP("GPIO162_D20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I2 */
603 DB8500_PIN_SLEEP("GPIO163_C20", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I1 */
604 DB8500_PIN_SLEEP("GPIO164_B21", slpm_in_pu_wkup_pdis_en, "nmk-ske-keypad"), /* I0 */
605 DB8500_PIN_SLEEP("GPIO157_A18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O7 */
606 DB8500_PIN_SLEEP("GPIO158_C18", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O6 */
607 DB8500_PIN_SLEEP("GPIO159_B19", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O5 */
608 DB8500_PIN_SLEEP("GPIO160_B20", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O4 */
609 DB8500_PIN_SLEEP("GPIO165_C21", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O3 */
610 DB8500_PIN_SLEEP("GPIO166_A22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O2 */
611 DB8500_PIN_SLEEP("GPIO167_B24", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O1 */
612 DB8500_PIN_SLEEP("GPIO168_C22", slpm_out_lo_pdis, "nmk-ske-keypad"), /* O0 */
613
297 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */ 614 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */
298 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"), 615 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"),
299 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"), 616 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"),
@@ -396,28 +713,6 @@ static struct pinctrl_map __initdata hrefv60_pinmap[] = {
396 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"), 713 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
397 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"), 714 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"),
398 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"), 715 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
399 /*
400 * Make it possible to mux in the SKE keypad and bias the pins
401 * FIXME: what's the point with this on HREFv60? KP/SKE is already
402 * muxed in at another place! Enabling this will bork.
403 */
404 DB8500_MUX("kp_a_2", "kp", "ske"),
405 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */
406 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */
407 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */
408 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */
409 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */
410 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */
411 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */
412 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */
413 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */
414 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */
415 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */
416 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */
417 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */
418 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */
419 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */
420 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */
421}; 716};
422 717
423static struct pinctrl_map __initdata u9500_pinmap[] = { 718static struct pinctrl_map __initdata u9500_pinmap[] = {
diff --git a/arch/arm/mach-vexpress/reset.c b/arch/arm/mach-vexpress/reset.c
new file mode 100644
index 000000000000..465923aa3819
--- /dev/null
+++ b/arch/arm/mach-vexpress/reset.c
@@ -0,0 +1,141 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#include <linux/jiffies.h>
15#include <linux/of.h>
16#include <linux/of_device.h>
17#include <linux/platform_device.h>
18#include <linux/stat.h>
19#include <linux/vexpress.h>
20
21static void vexpress_reset_do(struct device *dev, const char *what)
22{
23 int err = -ENOENT;
24 struct vexpress_config_func *func =
25 vexpress_config_func_get_by_dev(dev);
26
27 if (func) {
28 unsigned long timeout;
29
30 err = vexpress_config_write(func, 0, 0);
31
32 timeout = jiffies + HZ;
33 while (time_before(jiffies, timeout))
34 cpu_relax();
35 }
36
37 dev_emerg(dev, "Unable to %s (%d)\n", what, err);
38}
39
40static struct device *vexpress_power_off_device;
41
42void vexpress_power_off(void)
43{
44 vexpress_reset_do(vexpress_power_off_device, "power off");
45}
46
47static struct device *vexpress_restart_device;
48
49void vexpress_restart(char str, const char *cmd)
50{
51 vexpress_reset_do(vexpress_restart_device, "restart");
52}
53
54static ssize_t vexpress_reset_active_show(struct device *dev,
55 struct device_attribute *attr, char *buf)
56{
57 return sprintf(buf, "%d\n", vexpress_restart_device == dev);
58}
59
60static ssize_t vexpress_reset_active_store(struct device *dev,
61 struct device_attribute *attr, const char *buf, size_t count)
62{
63 long value;
64 int err = kstrtol(buf, 0, &value);
65
66 if (!err && value)
67 vexpress_restart_device = dev;
68
69 return err ? err : count;
70}
71
72DEVICE_ATTR(active, S_IRUGO | S_IWUSR, vexpress_reset_active_show,
73 vexpress_reset_active_store);
74
75
76enum vexpress_reset_func { FUNC_RESET, FUNC_SHUTDOWN, FUNC_REBOOT };
77
78static struct of_device_id vexpress_reset_of_match[] = {
79 {
80 .compatible = "arm,vexpress-reset",
81 .data = (void *)FUNC_RESET,
82 }, {
83 .compatible = "arm,vexpress-shutdown",
84 .data = (void *)FUNC_SHUTDOWN
85 }, {
86 .compatible = "arm,vexpress-reboot",
87 .data = (void *)FUNC_REBOOT
88 },
89 {}
90};
91
92static int vexpress_reset_probe(struct platform_device *pdev)
93{
94 enum vexpress_reset_func func;
95 const struct of_device_id *match =
96 of_match_device(vexpress_reset_of_match, &pdev->dev);
97
98 if (match)
99 func = (enum vexpress_reset_func)match->data;
100 else
101 func = pdev->id_entry->driver_data;
102
103 switch (func) {
104 case FUNC_SHUTDOWN:
105 vexpress_power_off_device = &pdev->dev;
106 break;
107 case FUNC_RESET:
108 if (!vexpress_restart_device)
109 vexpress_restart_device = &pdev->dev;
110 device_create_file(&pdev->dev, &dev_attr_active);
111 break;
112 case FUNC_REBOOT:
113 vexpress_restart_device = &pdev->dev;
114 device_create_file(&pdev->dev, &dev_attr_active);
115 break;
116 };
117
118 return 0;
119}
120
121static const struct platform_device_id vexpress_reset_id_table[] = {
122 { .name = "vexpress-reset", .driver_data = FUNC_RESET, },
123 { .name = "vexpress-shutdown", .driver_data = FUNC_SHUTDOWN, },
124 { .name = "vexpress-reboot", .driver_data = FUNC_REBOOT, },
125 {}
126};
127
128static struct platform_driver vexpress_reset_driver = {
129 .probe = vexpress_reset_probe,
130 .driver = {
131 .name = "vexpress-reset",
132 .of_match_table = vexpress_reset_of_match,
133 },
134 .id_table = vexpress_reset_id_table,
135};
136
137static int __init vexpress_reset_init(void)
138{
139 return platform_driver_register(&vexpress_reset_driver);
140}
141device_initcall(vexpress_reset_init);
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index c4633de64465..db213fe958a5 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1197,6 +1197,14 @@ config SENSORS_TWL4030_MADC
1197 This driver can also be built as a module. If so it will be called 1197 This driver can also be built as a module. If so it will be called
1198 twl4030-madc-hwmon. 1198 twl4030-madc-hwmon.
1199 1199
1200config SENSORS_VEXPRESS
1201 tristate "Versatile Express"
1202 depends on VEXPRESS_CONFIG
1203 help
1204 This driver provides support for hardware sensors available on
1205 the ARM Ltd's Versatile Express platform. It can provide wide
1206 range of information like temperature, power, energy.
1207
1200config SENSORS_VIA_CPUTEMP 1208config SENSORS_VIA_CPUTEMP
1201 tristate "VIA CPU temperature sensor" 1209 tristate "VIA CPU temperature sensor"
1202 depends on X86 1210 depends on X86
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 8d5fcb5e8e9f..aac8b7c619d6 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -121,6 +121,7 @@ obj-$(CONFIG_SENSORS_TMP102) += tmp102.o
121obj-$(CONFIG_SENSORS_TMP401) += tmp401.o 121obj-$(CONFIG_SENSORS_TMP401) += tmp401.o
122obj-$(CONFIG_SENSORS_TMP421) += tmp421.o 122obj-$(CONFIG_SENSORS_TMP421) += tmp421.o
123obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o 123obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o
124obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress.o
124obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o 125obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o
125obj-$(CONFIG_SENSORS_VIA686A) += via686a.o 126obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
126obj-$(CONFIG_SENSORS_VT1211) += vt1211.o 127obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
diff --git a/drivers/hwmon/vexpress.c b/drivers/hwmon/vexpress.c
new file mode 100644
index 000000000000..59fd1268e58a
--- /dev/null
+++ b/drivers/hwmon/vexpress.c
@@ -0,0 +1,229 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#define DRVNAME "vexpress-hwmon"
15#define pr_fmt(fmt) DRVNAME ": " fmt
16
17#include <linux/device.h>
18#include <linux/err.h>
19#include <linux/hwmon.h>
20#include <linux/hwmon-sysfs.h>
21#include <linux/module.h>
22#include <linux/of_device.h>
23#include <linux/platform_device.h>
24#include <linux/vexpress.h>
25
26struct vexpress_hwmon_data {
27 struct device *hwmon_dev;
28 struct vexpress_config_func *func;
29};
30
31static ssize_t vexpress_hwmon_name_show(struct device *dev,
32 struct device_attribute *dev_attr, char *buffer)
33{
34 const char *compatible = of_get_property(dev->of_node, "compatible",
35 NULL);
36
37 return sprintf(buffer, "%s\n", compatible);
38}
39
40static ssize_t vexpress_hwmon_label_show(struct device *dev,
41 struct device_attribute *dev_attr, char *buffer)
42{
43 const char *label = of_get_property(dev->of_node, "label", NULL);
44
45 if (!label)
46 return -ENOENT;
47
48 return snprintf(buffer, PAGE_SIZE, "%s\n", label);
49}
50
51static ssize_t vexpress_hwmon_u32_show(struct device *dev,
52 struct device_attribute *dev_attr, char *buffer)
53{
54 struct vexpress_hwmon_data *data = dev_get_drvdata(dev);
55 int err;
56 u32 value;
57
58 err = vexpress_config_read(data->func, 0, &value);
59 if (err)
60 return err;
61
62 return snprintf(buffer, PAGE_SIZE, "%u\n", value /
63 to_sensor_dev_attr(dev_attr)->index);
64}
65
66static ssize_t vexpress_hwmon_u64_show(struct device *dev,
67 struct device_attribute *dev_attr, char *buffer)
68{
69 struct vexpress_hwmon_data *data = dev_get_drvdata(dev);
70 int err;
71 u32 value_hi, value_lo;
72
73 err = vexpress_config_read(data->func, 0, &value_lo);
74 if (err)
75 return err;
76
77 err = vexpress_config_read(data->func, 1, &value_hi);
78 if (err)
79 return err;
80
81 return snprintf(buffer, PAGE_SIZE, "%llu\n",
82 div_u64(((u64)value_hi << 32) | value_lo,
83 to_sensor_dev_attr(dev_attr)->index));
84}
85
86static DEVICE_ATTR(name, S_IRUGO, vexpress_hwmon_name_show, NULL);
87
88#define VEXPRESS_HWMON_ATTRS(_name, _label_attr, _input_attr) \
89struct attribute *vexpress_hwmon_attrs_##_name[] = { \
90 &dev_attr_name.attr, \
91 &dev_attr_##_label_attr.attr, \
92 &sensor_dev_attr_##_input_attr.dev_attr.attr, \
93 NULL \
94}
95
96#if !defined(CONFIG_REGULATOR_VEXPRESS)
97static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
98static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show,
99 NULL, 1000);
100static VEXPRESS_HWMON_ATTRS(volt, in1_label, in1_input);
101static struct attribute_group vexpress_hwmon_group_volt = {
102 .attrs = vexpress_hwmon_attrs_volt,
103};
104#endif
105
106static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
107static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show,
108 NULL, 1000);
109static VEXPRESS_HWMON_ATTRS(amp, curr1_label, curr1_input);
110static struct attribute_group vexpress_hwmon_group_amp = {
111 .attrs = vexpress_hwmon_attrs_amp,
112};
113
114static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
115static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show,
116 NULL, 1000);
117static VEXPRESS_HWMON_ATTRS(temp, temp1_label, temp1_input);
118static struct attribute_group vexpress_hwmon_group_temp = {
119 .attrs = vexpress_hwmon_attrs_temp,
120};
121
122static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
123static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show,
124 NULL, 1);
125static VEXPRESS_HWMON_ATTRS(power, power1_label, power1_input);
126static struct attribute_group vexpress_hwmon_group_power = {
127 .attrs = vexpress_hwmon_attrs_power,
128};
129
130static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL);
131static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show,
132 NULL, 1);
133static VEXPRESS_HWMON_ATTRS(energy, energy1_label, energy1_input);
134static struct attribute_group vexpress_hwmon_group_energy = {
135 .attrs = vexpress_hwmon_attrs_energy,
136};
137
138static struct of_device_id vexpress_hwmon_of_match[] = {
139#if !defined(CONFIG_REGULATOR_VEXPRESS)
140 {
141 .compatible = "arm,vexpress-volt",
142 .data = &vexpress_hwmon_group_volt,
143 },
144#endif
145 {
146 .compatible = "arm,vexpress-amp",
147 .data = &vexpress_hwmon_group_amp,
148 }, {
149 .compatible = "arm,vexpress-temp",
150 .data = &vexpress_hwmon_group_temp,
151 }, {
152 .compatible = "arm,vexpress-power",
153 .data = &vexpress_hwmon_group_power,
154 }, {
155 .compatible = "arm,vexpress-energy",
156 .data = &vexpress_hwmon_group_energy,
157 },
158 {}
159};
160MODULE_DEVICE_TABLE(of, vexpress_hwmon_of_match);
161
162static int vexpress_hwmon_probe(struct platform_device *pdev)
163{
164 int err;
165 const struct of_device_id *match;
166 struct vexpress_hwmon_data *data;
167
168 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
169 if (!data)
170 return -ENOMEM;
171 platform_set_drvdata(pdev, data);
172
173 match = of_match_device(vexpress_hwmon_of_match, &pdev->dev);
174 if (!match)
175 return -ENODEV;
176
177 data->func = vexpress_config_func_get_by_dev(&pdev->dev);
178 if (!data->func)
179 return -ENODEV;
180
181 err = sysfs_create_group(&pdev->dev.kobj, match->data);
182 if (err)
183 goto error;
184
185 data->hwmon_dev = hwmon_device_register(&pdev->dev);
186 if (IS_ERR(data->hwmon_dev)) {
187 err = PTR_ERR(data->hwmon_dev);
188 goto error;
189 }
190
191 return 0;
192
193error:
194 sysfs_remove_group(&pdev->dev.kobj, match->data);
195 vexpress_config_func_put(data->func);
196 return err;
197}
198
199static int __devexit vexpress_hwmon_remove(struct platform_device *pdev)
200{
201 struct vexpress_hwmon_data *data = platform_get_drvdata(pdev);
202 const struct of_device_id *match;
203
204 hwmon_device_unregister(data->hwmon_dev);
205
206 match = of_match_device(vexpress_hwmon_of_match, &pdev->dev);
207 sysfs_remove_group(&pdev->dev.kobj, match->data);
208
209 vexpress_config_func_put(data->func);
210
211 return 0;
212}
213
214static struct platform_driver vexpress_hwmon_driver = {
215 .probe = vexpress_hwmon_probe,
216 .remove = __devexit_p(vexpress_hwmon_remove),
217 .driver = {
218 .name = DRVNAME,
219 .owner = THIS_MODULE,
220 .of_match_table = vexpress_hwmon_of_match,
221 },
222};
223
224module_platform_driver(vexpress_hwmon_driver);
225
226MODULE_AUTHOR("Pawel Moll <pawel.moll@arm.com>");
227MODULE_DESCRIPTION("Versatile Express hwmon sensors driver");
228MODULE_LICENSE("GPL");
229MODULE_ALIAS("platform:vexpress-hwmon");