aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-05-12 22:57:34 -0400
committerOlof Johansson <olof@lixom.net>2012-05-12 22:57:34 -0400
commit7af07ad902cce88ebbd2ce0e681d0c541e8f95fa (patch)
tree40a5aedb583c35d16505d96ea8996c413a747fe6 /arch
parent7afeca1a30360c7b5cee94fc7ff8f350d582282a (diff)
parent08d98fe0e81cd9424ef2451ed13afe91a9a26f9f (diff)
Merge tag 'ux500-gpio-pins-for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson into next/pinctrl
ux500 GPIO and pinctrl changes for kernel 3.5 * tag 'ux500-gpio-pins-for-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson: ARM: ux500: switch MSP to using pinctrl for pins ARM: ux500: alter MSP registration to return a device pointer ARM: ux500: switch to using pinctrl for uart0 ARM: ux500: delete custom pin control system ARM: ux500: switch over to Nomadik pinctrl driver pinctrl: add sleep state definition pinctrl/nomadik: implement pin configuration pinctrl/nomadik: implement pin multiplexing pinctrl/nomadik: reuse GPIO debug function for pins pinctrl/nomadik: break out single GPIO debug function pinctrl/nomadik: basic Nomadik pinctrl interface pinctrl/nomadik: !CONFIG_OF build error gpio: move the Nomadik GPIO driver to pinctrl Context conflicts resolved in drivers/pinctrl/Kconfig and drivers/pinctrl/Makefile. Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/Kconfig3
-rw-r--r--arch/arm/mach-ux500/Makefile2
-rw-r--r--arch/arm/mach-ux500/board-mop500-msp.c85
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c855
-rw-r--r--arch/arm/mach-ux500/board-mop500.c83
-rw-r--r--arch/arm/mach-ux500/board-mop500.h6
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c1
-rw-r--r--arch/arm/mach-ux500/devices-common.h12
-rw-r--r--arch/arm/mach-ux500/pins.c88
-rw-r--r--arch/arm/mach-ux500/pins.h46
-rw-r--r--arch/arm/plat-nomadik/include/plat/pincfg.h13
11 files changed, 568 insertions, 626 deletions
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index ef7099eea0f2..4adb49396665 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -9,6 +9,8 @@ config UX500_SOC_COMMON
9 select ARM_ERRATA_754322 9 select ARM_ERRATA_754322
10 select ARM_ERRATA_764369 10 select ARM_ERRATA_764369
11 select CACHE_L2X0 11 select CACHE_L2X0
12 select PINCTRL
13 select PINCTRL_NOMADIK
12 14
13config UX500_SOC_DB5500 15config UX500_SOC_DB5500
14 bool 16 bool
@@ -20,6 +22,7 @@ config UX500_SOC_DB8500
20 select REGULATOR 22 select REGULATOR
21 select REGULATOR_DB8500_PRCMU 23 select REGULATOR_DB8500_PRCMU
22 select CPU_FREQ_TABLE if CPU_FREQ 24 select CPU_FREQ_TABLE if CPU_FREQ
25 select PINCTRL_DB8500
23 26
24menu "Ux500 target platform (boards)" 27menu "Ux500 target platform (boards)"
25 28
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 015932c6bf08..11729bc62194 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-y := clock.o cpu.o devices.o devices-common.o \ 5obj-y := clock.o cpu.o devices.o devices-common.o \
6 id.o pins.o usb.o timer.o 6 id.o usb.o timer.o
7obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 7obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
8obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o 8obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o
9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o 9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
diff --git a/arch/arm/mach-ux500/board-mop500-msp.c b/arch/arm/mach-ux500/board-mop500-msp.c
index c8f6300cb7d2..996048038743 100644
--- a/arch/arm/mach-ux500/board-mop500-msp.c
+++ b/arch/arm/mach-ux500/board-mop500-msp.c
@@ -7,17 +7,18 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/gpio.h> 9#include <linux/gpio.h>
10#include <plat/gpio-nomadik.h> 10#include <linux/pinctrl/consumer.h>
11 11
12#include <plat/gpio-nomadik.h>
12#include <plat/pincfg.h> 13#include <plat/pincfg.h>
13#include <plat/ste_dma40.h> 14#include <plat/ste_dma40.h>
14 15
15#include <mach/devices.h> 16#include <mach/devices.h>
16#include <ste-dma40-db8500.h>
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19#include <mach/msp.h> 19#include <mach/msp.h>
20 20
21#include "ste-dma40-db8500.h"
21#include "board-mop500.h" 22#include "board-mop500.h"
22#include "devices-db8500.h" 23#include "devices-db8500.h"
23#include "pins-db8500.h" 24#include "pins-db8500.h"
@@ -28,19 +29,10 @@ static DEFINE_SPINLOCK(msp_rxtx_lock);
28/* Reference Count */ 29/* Reference Count */
29static int msp_rxtx_ref; 30static int msp_rxtx_ref;
30 31
31static pin_cfg_t mop500_msp1_pins_init[] = { 32/* Pin modes */
32 GPIO33_MSP1_TXD | PIN_OUTPUT_LOW | PIN_SLPM_WAKEUP_DISABLE, 33struct pinctrl *msp1_p;
33 GPIO34_MSP1_TFS | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE, 34struct pinctrl_state *msp1_def;
34 GPIO35_MSP1_TCK | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE, 35struct pinctrl_state *msp1_sleep;
35 GPIO36_MSP1_RXD | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
36};
37
38static pin_cfg_t mop500_msp1_pins_exit[] = {
39 GPIO33_MSP1_TXD | PIN_OUTPUT_LOW | PIN_SLPM_WAKEUP_ENABLE,
40 GPIO34_MSP1_TFS | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_ENABLE,
41 GPIO35_MSP1_TCK | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_ENABLE,
42 GPIO36_MSP1_RXD | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_ENABLE,
43};
44 36
45int msp13_i2s_init(void) 37int msp13_i2s_init(void)
46{ 38{
@@ -48,9 +40,11 @@ int msp13_i2s_init(void)
48 unsigned long flags; 40 unsigned long flags;
49 41
50 spin_lock_irqsave(&msp_rxtx_lock, flags); 42 spin_lock_irqsave(&msp_rxtx_lock, flags);
51 if (msp_rxtx_ref == 0) 43 if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) {
52 retval = nmk_config_pins( 44 retval = pinctrl_select_state(msp1_p, msp1_def);
53 ARRAY_AND_SIZE(mop500_msp1_pins_init)); 45 if (retval)
46 pr_err("could not set MSP1 defstate\n");
47 }
54 if (!retval) 48 if (!retval)
55 msp_rxtx_ref++; 49 msp_rxtx_ref++;
56 spin_unlock_irqrestore(&msp_rxtx_lock, flags); 50 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
@@ -66,9 +60,11 @@ int msp13_i2s_exit(void)
66 spin_lock_irqsave(&msp_rxtx_lock, flags); 60 spin_lock_irqsave(&msp_rxtx_lock, flags);
67 WARN_ON(!msp_rxtx_ref); 61 WARN_ON(!msp_rxtx_ref);
68 msp_rxtx_ref--; 62 msp_rxtx_ref--;
69 if (msp_rxtx_ref == 0) 63 if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) {
70 retval = nmk_config_pins_sleep( 64 retval = pinctrl_select_state(msp1_p, msp1_sleep);
71 ARRAY_AND_SIZE(mop500_msp1_pins_exit)); 65 if (retval)
66 pr_err("could not set MSP1 sleepstate\n");
67 }
72 spin_unlock_irqrestore(&msp_rxtx_lock, flags); 68 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
73 69
74 return retval; 70 return retval;
@@ -170,7 +166,8 @@ static struct stedma40_chan_cfg msp2_dma_tx = {
170 /* data_width is set during configuration */ 166 /* data_width is set during configuration */
171}; 167};
172 168
173static int db8500_add_msp_i2s(struct device *parent, int id, 169static struct platform_device *db8500_add_msp_i2s(struct device *parent,
170 int id,
174 resource_size_t base, int irq, 171 resource_size_t base, int irq,
175 struct msp_i2s_platform_data *pdata) 172 struct msp_i2s_platform_data *pdata)
176{ 173{
@@ -188,10 +185,10 @@ static int db8500_add_msp_i2s(struct device *parent, int id,
188 if (!pdev) { 185 if (!pdev) {
189 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n", 186 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
190 id); 187 id);
191 return -EIO; 188 return NULL;
192 } 189 }
193 190
194 return 0; 191 return pdev;
195} 192}
196 193
197/* Platform device for ASoC U8500 machine */ 194/* Platform device for ASoC U8500 machine */
@@ -228,23 +225,43 @@ static struct msp_i2s_platform_data msp3_platform_data = {
228 225
229int mop500_msp_init(struct device *parent) 226int mop500_msp_init(struct device *parent)
230{ 227{
231 int ret; 228 struct platform_device *msp1;
232 229
233 pr_info("%s: Register platform-device 'snd-soc-u8500'.\n", __func__); 230 pr_info("%s: Register platform-device 'snd-soc-u8500'.\n", __func__);
234 platform_device_register(&snd_soc_u8500); 231 platform_device_register(&snd_soc_u8500);
235 232
236 pr_info("Initialize MSP I2S-devices.\n"); 233 pr_info("Initialize MSP I2S-devices.\n");
237 ret = db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, 234 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
238 &msp0_platform_data); 235 &msp0_platform_data);
239 ret |= db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, 236 msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
240 &msp1_platform_data); 237 &msp1_platform_data);
241 ret |= db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, 238 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
242 &msp2_platform_data); 239 &msp2_platform_data);
243 ret |= db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, 240 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
244 &msp3_platform_data); 241 &msp3_platform_data);
242
243 /* Get the pinctrl handle for MSP1 */
244 if (msp1) {
245 msp1_p = pinctrl_get(&msp1->dev);
246 if (IS_ERR(msp1_p))
247 dev_err(&msp1->dev, "could not get MSP1 pinctrl\n");
248 else {
249 msp1_def = pinctrl_lookup_state(msp1_p,
250 PINCTRL_STATE_DEFAULT);
251 if (IS_ERR(msp1_def)) {
252 dev_err(&msp1->dev,
253 "could not get MSP1 defstate\n");
254 }
255 msp1_sleep = pinctrl_lookup_state(msp1_p,
256 PINCTRL_STATE_SLEEP);
257 if (IS_ERR(msp1_sleep))
258 dev_err(&msp1->dev,
259 "could not get MSP1 idlestate\n");
260 }
261 }
245 262
246 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__); 263 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__);
247 platform_device_register(&ux500_pcm); 264 platform_device_register(&ux500_pcm);
248 265
249 return ret; 266 return 0;
250} 267}
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index df5b190d331c..32fd99204464 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -8,6 +8,7 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/bug.h> 9#include <linux/bug.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pinctrl/machine.h>
11 12
12#include <asm/mach-types.h> 13#include <asm/mach-types.h>
13#include <plat/pincfg.h> 14#include <plat/pincfg.h>
@@ -16,7 +17,6 @@
16#include <mach/hardware.h> 17#include <mach/hardware.h>
17 18
18#include "pins-db8500.h" 19#include "pins-db8500.h"
19#include "pins.h"
20#include "board-mop500.h" 20#include "board-mop500.h"
21 21
22enum custom_pin_cfg_t { 22enum custom_pin_cfg_t {
@@ -26,399 +26,425 @@ enum custom_pin_cfg_t {
26 26
27static enum custom_pin_cfg_t pinsfor; 27static enum custom_pin_cfg_t pinsfor;
28 28
29static pin_cfg_t mop500_pins_common[] = { 29/* These simply sets bias for pins */
30 /* uMSP0 */ 30#define BIAS(a,b) static unsigned long a[] = { b }
31 GPIO12_MSP0_TXD, 31
32 GPIO13_MSP0_TFS, 32BIAS(pd, PIN_PULL_DOWN);
33 GPIO14_MSP0_TCK, 33BIAS(slpm_gpio_nopull, PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
34 GPIO15_MSP0_RXD, 34BIAS(in_nopull, PIN_INPUT_NOPULL);
35 35BIAS(in_nopull_sleep_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE);
36 /* MSP2: HDMI */ 36BIAS(in_pu, PIN_INPUT_PULLUP);
37 GPIO193_MSP2_TXD | PIN_INPUT_PULLDOWN, 37BIAS(in_pd, PIN_INPUT_PULLDOWN);
38 GPIO194_MSP2_TCK | PIN_INPUT_PULLDOWN, 38BIAS(in_pd_slpm_in_pu, PIN_INPUT_PULLDOWN|PIN_SLPM_INPUT_PULLUP);
39 GPIO195_MSP2_TFS | PIN_INPUT_PULLDOWN, 39BIAS(in_pu_slpm_out_lo, PIN_INPUT_PULLUP|PIN_SLPM_OUTPUT_LOW);
40 GPIO196_MSP2_RXD | PIN_OUTPUT_LOW, 40BIAS(out_hi, PIN_OUTPUT_HIGH);
41 41BIAS(out_lo, PIN_OUTPUT_LOW);
42 /* LCD TE0 */ 42BIAS(out_lo_sleep_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
43 GPIO68_LCD_VSI0 | PIN_INPUT_PULLUP, 43/* These also force them into GPIO mode */
44 44BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED);
45 /* Touch screen INTERFACE */ 45BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED);
46 GPIO84_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT1 */ 46BIAS(gpio_in_pu_slpm_gpio_nopull, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
47 47BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
48 /* STMPE1601/tc35893 keypad IRQ */ 48BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
49 GPIO218_GPIO | PIN_INPUT_PULLUP, 49BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
50 50/* Sleep modes */
51 /* UART */ 51BIAS(sleep_in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
52 /* uart-0 pins gpio configuration should be 52BIAS(sleep_in_nopull_wkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE);
53 * kept intact to prevent glitch in tx line 53BIAS(sleep_out_hi_wkup_pdis, PIN_SLPM_OUTPUT_HIGH|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
54 * when tty dev is opened. Later these pins 54BIAS(sleep_out_lo_wkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE);
55BIAS(sleep_out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
56
57/* We use these to define hog settings that are always done on boot */
58#define DB8500_MUX_HOG(group,func) \
59 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func)
60#define DB8500_PIN_HOG(pin,conf) \
61 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf)
62
63/* These are default states associated with device and changed runtime */
64#define DB8500_MUX(group,func,dev) \
65 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func)
66#define DB8500_PIN(pin,conf,dev) \
67 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf)
68
69#define DB8500_PIN_SLEEP(pin,conf,dev) \
70 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
71 pin, conf)
72
73/* Pin control settings */
74static struct pinctrl_map __initdata mop500_family_pinmap[] = {
75 /*
76 * uMSP0, mux in 4 pins, regular placement of RX/TX
77 * explicitly set the pins to no pull
78 */
79 DB8500_MUX_HOG("msp0txrx_a_1", "msp0"),
80 DB8500_MUX_HOG("msp0tfstck_a_1", "msp0"),
81 DB8500_PIN_HOG("GPIO12_AC4", in_nopull), /* TXD */
82 DB8500_PIN_HOG("GPIO15_AC3", in_nopull), /* RXD */
83 DB8500_PIN_HOG("GPIO13_AF3", in_nopull), /* TFS */
84 DB8500_PIN_HOG("GPIO14_AE3", in_nopull), /* TCK */
85 /* MSP2 for HDMI, pull down TXD, TCK, TFS */
86 DB8500_MUX_HOG("msp2_a_1", "msp2"),
87 DB8500_PIN_HOG("GPIO193_AH27", in_pd), /* TXD */
88 DB8500_PIN_HOG("GPIO194_AF27", in_pd), /* TCK */
89 DB8500_PIN_HOG("GPIO195_AG28", in_pd), /* TFS */
90 DB8500_PIN_HOG("GPIO196_AG26", out_lo), /* RXD */
91 /*
92 * LCD, set TE0 (using LCD VSI0) and D14 (touch screen interrupt) to
93 * pull-up
94 * TODO: is this really correct? Snowball doesn't have a LCD.
95 */
96 DB8500_MUX_HOG("lcdvsi0_a_1", "lcd"),
97 DB8500_PIN_HOG("GPIO68_E1", in_pu),
98 DB8500_PIN_HOG("GPIO84_C2", gpio_in_pu),
99 /*
100 * STMPE1601/tc35893 keypad IRQ GPIO 218
101 * TODO: set for snowball and HREF really??
102 */
103 DB8500_PIN_HOG("GPIO218_AH11", gpio_in_pu),
104 /*
105 * UART0, we do not mux in u0 here.
106 * uart-0 pins gpio configuration should be kept intact to prevent
107 * a glitch in tx line when the tty dev is opened. Later these pins
55 * are configured to uart mop500_pins_uart0 108 * are configured to uart mop500_pins_uart0
56 *
57 * It will be replaced with uart configuration
58 * once the issue is solved.
59 */ 109 */
60 GPIO0_GPIO | PIN_INPUT_PULLUP, 110 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */
61 GPIO1_GPIO | PIN_OUTPUT_HIGH, 111 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */
62 GPIO2_GPIO | PIN_INPUT_PULLUP, 112 DB8500_PIN_HOG("GPIO2_AH4", in_pu), /* RXD */
63 GPIO3_GPIO | PIN_OUTPUT_HIGH, 113 DB8500_PIN_HOG("GPIO3_AH3", out_hi), /* TXD */
64 114 /*
65 GPIO29_U2_RXD | PIN_INPUT_PULLUP, 115 * Mux in UART2 on altfunction C and set pull-ups.
66 GPIO30_U2_TXD | PIN_OUTPUT_HIGH, 116 * TODO: is this used on U8500 variants and Snowball really?
67 GPIO31_U2_CTSn | PIN_INPUT_PULLUP, 117 * The setting on GPIO31 conflicts with magnetometer use on hrefv60
68 GPIO32_U2_RTSn | PIN_OUTPUT_HIGH, 118 */
119 DB8500_MUX_HOG("u2rxtx_c_1", "u2"),
120 DB8500_MUX_HOG("u2ctsrts_c_1", "u2"),
121 DB8500_PIN_HOG("GPIO29_W2", in_pu), /* RXD */
122 DB8500_PIN_HOG("GPIO30_W3", out_hi), /* TXD */
123 DB8500_PIN_HOG("GPIO31_V3", in_pu), /* CTS */
124 DB8500_PIN_HOG("GPIO32_V2", out_hi), /* RTS */
125 /*
126 * The following pin sets were known as "runtime pins" before being
127 * converted to the pinctrl model. Here we model them as "default"
128 * states.
129 */
130 /* Mux in UART0 after initialization */
131 DB8500_MUX("u0_a_1", "u0", "uart0"),
132 DB8500_PIN("GPIO0_AJ5", in_pu, "uart0"), /* CTS */
133 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */
134 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */
135 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */
136 /* UART0 sleep state */
137 DB8500_PIN_SLEEP("GPIO0_AJ5", sleep_in_wkup_pdis, "uart0"),
138 DB8500_PIN_SLEEP("GPIO1_AJ3", sleep_out_hi_wkup_pdis, "uart0"),
139 DB8500_PIN_SLEEP("GPIO2_AH4", sleep_in_wkup_pdis, "uart0"),
140 DB8500_PIN_SLEEP("GPIO3_AH3", sleep_out_wkup_pdis, "uart0"),
141 /* MSP1 for ALSA codec */
142 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"),
143 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"),
144 DB8500_PIN("GPIO33_AF2", out_lo_sleep_nowkup, "ux500-msp-i2s.1"),
145 DB8500_PIN("GPIO34_AE1", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"),
146 DB8500_PIN("GPIO35_AE2", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"),
147 DB8500_PIN("GPIO36_AG2", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"),
148 /* MSP1 sleep state */
149 DB8500_PIN_SLEEP("GPIO33_AF2", sleep_out_lo_wkup, "ux500-msp-i2s.1"),
150 DB8500_PIN_SLEEP("GPIO34_AE1", sleep_in_nopull_wkup, "ux500-msp-i2s.1"),
151 DB8500_PIN_SLEEP("GPIO35_AE2", sleep_in_nopull_wkup, "ux500-msp-i2s.1"),
152 DB8500_PIN_SLEEP("GPIO36_AG2", sleep_in_nopull_wkup, "ux500-msp-i2s.1"),
153 /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */
154 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
155 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
156 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */
157 DB8500_MUX("lcdvsi1_a_1", "lcd", "av8100-hdmi"),
158 /* Mux in I2C blocks, put pins into GPIO in sleepmode no pull-up */
159 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"),
160 DB8500_PIN("GPIO147_C15", slpm_gpio_nopull, "nmk-i2c.0"),
161 DB8500_PIN("GPIO148_B16", slpm_gpio_nopull, "nmk-i2c.0"),
162 DB8500_MUX("i2c1_b_2", "i2c1", "nmk-i2c.1"),
163 DB8500_PIN("GPIO16_AD3", slpm_gpio_nopull, "nmk-i2c.1"),
164 DB8500_PIN("GPIO17_AD4", slpm_gpio_nopull, "nmk-i2c.1"),
165 DB8500_MUX("i2c2_b_2", "i2c2", "nmk-i2c.2"),
166 DB8500_PIN("GPIO10_AF5", slpm_gpio_nopull, "nmk-i2c.2"),
167 DB8500_PIN("GPIO11_AG4", slpm_gpio_nopull, "nmk-i2c.2"),
168 DB8500_MUX("i2c3_c_2", "i2c3", "nmk-i2c.3"),
169 DB8500_PIN("GPIO229_AG7", slpm_gpio_nopull, "nmk-i2c.3"),
170 DB8500_PIN("GPIO230_AF7", slpm_gpio_nopull, "nmk-i2c.3"),
171 /* Mux in SDI0 (here called MC0) used for removable MMC/SD/SDIO cards */
172 DB8500_MUX("mc0_a_1", "mc0", "sdi0"),
173 DB8500_PIN("GPIO18_AC2", out_hi, "sdi0"), /* CMDDIR */
174 DB8500_PIN("GPIO19_AC1", out_hi, "sdi0"), /* DAT0DIR */
175 DB8500_PIN("GPIO20_AB4", out_hi, "sdi0"), /* DAT2DIR */
176 DB8500_PIN("GPIO22_AA3", in_nopull, "sdi0"), /* FBCLK */
177 DB8500_PIN("GPIO23_AA4", out_lo, "sdi0"), /* CLK */
178 DB8500_PIN("GPIO24_AB2", in_pu, "sdi0"), /* CMD */
179 DB8500_PIN("GPIO25_Y4", in_pu, "sdi0"), /* DAT0 */
180 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */
181 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */
182 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */
183 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */
184 DB8500_MUX("mc1_a_1", "mc1", "sdi1"),
185 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */
186 DB8500_PIN("GPIO209_AG15", in_nopull, "sdi1"), /* FBCLK */
187 DB8500_PIN("GPIO210_AJ15", in_pu, "sdi1"), /* CMD */
188 DB8500_PIN("GPIO211_AG14", in_pu, "sdi1"), /* DAT0 */
189 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */
190 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */
191 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */
192 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */
193 DB8500_MUX("mc2_a_1", "mc2", "sdi2"),
194 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */
195 DB8500_PIN("GPIO129_B4", in_pu, "sdi2"), /* CMD */
196 DB8500_PIN("GPIO130_C8", in_nopull, "sdi2"), /* FBCLK */
197 DB8500_PIN("GPIO131_A12", in_pu, "sdi2"), /* DAT0 */
198 DB8500_PIN("GPIO132_C10", in_pu, "sdi2"), /* DAT1 */
199 DB8500_PIN("GPIO133_B10", in_pu, "sdi2"), /* DAT2 */
200 DB8500_PIN("GPIO134_B9", in_pu, "sdi2"), /* DAT3 */
201 DB8500_PIN("GPIO135_A9", in_pu, "sdi2"), /* DAT4 */
202 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */
203 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */
204 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */
205 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */
206 DB8500_MUX("mc4_a_1", "mc4", "sdi4"),
207 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */
208 DB8500_PIN("GPIO198_AG25", in_pu, "sdi4"), /* DAT2 */
209 DB8500_PIN("GPIO199_AH23", in_pu, "sdi4"), /* DAT1 */
210 DB8500_PIN("GPIO200_AH26", in_pu, "sdi4"), /* DAT0 */
211 DB8500_PIN("GPIO201_AF24", in_pu, "sdi4"), /* CMD */
212 DB8500_PIN("GPIO202_AF25", in_nopull, "sdi4"), /* FBCLK */
213 DB8500_PIN("GPIO203_AE23", out_lo, "sdi4"), /* CLK */
214 DB8500_PIN("GPIO204_AF23", in_pu, "sdi4"), /* DAT7 */
215 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */
216 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */
217 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */
218 /* Mux in USB pins, drive STP high */
219 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"),
220 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */
221 /* Mux in SPI2 pins on the "other C1" altfunction */
222 DB8500_MUX("spi2_oc1_1", "spi2", "spi2"),
223 DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */
224 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */
225 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
226 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
69}; 227};
70 228
71static pin_cfg_t mop500_pins_default[] = { 229/*
72 /* SSP0 */ 230 * These are specifically for the MOP500 and HREFP (pre-v60) version of the
73 GPIO143_SSP0_CLK, 231 * board, which utilized a TC35892 GPIO expander instead of using a lot of
74 GPIO144_SSP0_FRM, 232 * on-chip pins as the HREFv60 and later does.
75 GPIO145_SSP0_RXD | PIN_PULL_DOWN, 233 */
76 GPIO146_SSP0_TXD, 234static struct pinctrl_map __initdata mop500_pinmap[] = {
77 235 /* Mux in SSP0, pull down RXD pin */
78 /* XENON Flashgun INTERFACE */ 236 DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
79 GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */ 237 DB8500_PIN_HOG("GPIO145_C13", pd),
80 GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */ 238 /*
81 239 * XENON Flashgun on image processor GPIO (controlled from image
82 GPIO217_GPIO | PIN_INPUT_PULLUP, /* TC35892 IRQ */ 240 * processor firmware), mux in these image processor GPIO lines 0
83 241 * (XENON_FLASH_ID) and 1 (XENON_READY) on altfunction C and pull up
84 /* sdi0 (removable MMC/SD/SDIO cards) not handled by pm_runtime */ 242 * the pins.
85 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH, 243 */
86 244 DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
87 /* UART */ 245 DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
88 GPIO4_U1_RXD | PIN_INPUT_PULLUP, 246 DB8500_PIN_HOG("GPIO6_AF6", in_pu),
89 GPIO5_U1_TXD | PIN_OUTPUT_HIGH, 247 DB8500_PIN_HOG("GPIO7_AG5", in_pu),
90 GPIO6_U1_CTSn | PIN_INPUT_PULLUP, 248 /* TC35892 IRQ, pull up the line, let the driver mux in the pin */
91 GPIO7_U1_RTSn | PIN_OUTPUT_HIGH, 249 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu),
250 /* Mux in UART1 and set the pull-ups */
251 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
252 DB8500_MUX_HOG("u1ctsrts_a_1", "u1"),
253 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */
254 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */
255 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* CTS */
256 DB8500_PIN_HOG("GPIO7_AG5", out_hi), /* RTS */
257 /*
258 * Runtime stuff: make it possible to mux in the SKE keypad
259 * and bias the pins
260 */
261 DB8500_MUX("kp_a_2", "kp", "ske"),
262 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */
263 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */
264 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */
265 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */
266 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */
267 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */
268 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */
269 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */
270 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */
271 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */
272 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */
273 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */
274 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */
275 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */
276 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */
277 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */
278 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */
279 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"),
280 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"),
92}; 281};
93 282
94static pin_cfg_t hrefv60_pins[] = { 283/*
95 /* WLAN */ 284 * The HREFv60 series of platforms is using available pins on the DB8500
96 GPIO85_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */ 285 * insteaf of the Toshiba I2C GPIO expander, reusing some pins like the SSP0
97 286 * and SSP1 ports (previously connected to the AB8500) as generic GPIO lines.
98 /* XENON Flashgun INTERFACE */ 287 */
99 GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */ 288static struct pinctrl_map __initdata hrefv60_pinmap[] = {
100 GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */ 289 /* Drive WLAN_ENA low */
101 290 DB8500_PIN_HOG("GPIO85_D5", gpio_out_lo), /* WLAN_ENA */
102 /* Assistant LED INTERFACE */ 291 /*
103 GPIO21_GPIO | PIN_OUTPUT_LOW, /* XENON_EN1 */ 292 * XENON Flashgun on image processor GPIO (controlled from image
104 GPIO64_IP_GPIO4 | PIN_OUTPUT_LOW, /* XENON_EN2 */ 293 * processor firmware), mux in these image processor GPIO lines 0
105 294 * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
106 /* Magnetometer */ 295 * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
107 GPIO31_GPIO | PIN_INPUT_PULLUP, /* magnetometer_INT */ 296 * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
108 GPIO32_GPIO | PIN_INPUT_PULLDOWN, /* Magnetometer DRDY */ 297 */
109 298 DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
110 /* Display Interface */ 299 DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
111 GPIO65_GPIO | PIN_OUTPUT_HIGH, /* DISP1 NO RST */ 300 DB8500_MUX_HOG("ipgpio4_c_1", "ipgpio"),
112 GPIO66_GPIO | PIN_OUTPUT_LOW, /* DISP2 RST */ 301 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* XENON_FLASH_ID */
113 302 DB8500_PIN_HOG("GPIO7_AG5", in_pu), /* XENON_READY */
114 /* Touch screen INTERFACE */ 303 DB8500_PIN_HOG("GPIO21_AB3", gpio_out_lo), /* XENON_EN1 */
115 GPIO143_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST1 */ 304 DB8500_PIN_HOG("GPIO64_F3", out_lo), /* XENON_EN2 */
116 305 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
117 /* Touch screen INTERFACE 2 */ 306 DB8500_PIN_HOG("GPIO31_V3", gpio_in_pu), /* EN1 */
118 GPIO67_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT2 */ 307 DB8500_PIN_HOG("GPIO32_V2", gpio_in_pd), /* DRDY */
119 GPIO146_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST2 */ 308 /*
120 309 * Display Interface 1 uses GPIO 65 for RST (reset).
121 /* ETM_PTM_TRACE INTERFACE */ 310 * Display Interface 2 uses GPIO 66 for RST (reset).
122 GPIO70_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA23 */ 311 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
123 GPIO71_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA22 */ 312 */
124 GPIO72_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA21 */ 313 DB8500_PIN_HOG("GPIO65_F1", gpio_out_hi), /* DISP1 NO RST */
125 GPIO73_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA20 */ 314 DB8500_PIN_HOG("GPIO66_G3", gpio_out_lo), /* DISP2 RST */
126 GPIO74_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA19 */ 315 /*
127 316 * Touch screen uses GPIO 143 for RST1, GPIO 146 for RST2 and
128 /* NAHJ INTERFACE */ 317 * GPIO 67 for interrupts. Pull-up the IRQ line and drive both
129 GPIO76_GPIO | PIN_OUTPUT_LOW,/* NAHJ_CTRL */ 318 * reset signals low.
130 GPIO216_GPIO | PIN_OUTPUT_HIGH,/* NAHJ_CTRL_INV */ 319 */
131 320 DB8500_PIN_HOG("GPIO143_D12", gpio_out_lo), /* TOUCH_RST1 */
132 /* NFC INTERFACE */ 321 DB8500_PIN_HOG("GPIO67_G2", gpio_in_pu), /* TOUCH_INT2 */
133 GPIO77_GPIO | PIN_OUTPUT_LOW, /* NFC_ENA */ 322 DB8500_PIN_HOG("GPIO146_D13", gpio_out_lo), /* TOUCH_RST2 */
134 GPIO144_GPIO | PIN_INPUT_PULLDOWN, /* NFC_IRQ */ 323 /*
135 GPIO142_GPIO | PIN_OUTPUT_LOW, /* NFC_RESET */ 324 * Drive D19-D23 for the ETM PTM trace interface low,
136 325 * (presumably pins are unconnected therefore grounded here,
137 /* Keyboard MATRIX INTERFACE */ 326 * the "other alt C1" setting enables these pins)
138 GPIO90_MC5_CMD | PIN_OUTPUT_LOW, /* KP_O_1 */ 327 */
139 GPIO87_MC5_DAT1 | PIN_OUTPUT_LOW, /* KP_O_2 */ 328 DB8500_PIN_HOG("GPIO70_G5", gpio_out_lo),
140 GPIO86_MC5_DAT0 | PIN_OUTPUT_LOW, /* KP_O_3 */ 329 DB8500_PIN_HOG("GPIO71_G4", gpio_out_lo),
141 GPIO96_KP_O6 | PIN_OUTPUT_LOW, /* KP_O_6 */ 330 DB8500_PIN_HOG("GPIO72_H4", gpio_out_lo),
142 GPIO94_KP_O7 | PIN_OUTPUT_LOW, /* KP_O_7 */ 331 DB8500_PIN_HOG("GPIO73_H3", gpio_out_lo),
143 GPIO93_MC5_DAT4 | PIN_INPUT_PULLUP, /* KP_I_0 */ 332 DB8500_PIN_HOG("GPIO74_J3", gpio_out_lo),
144 GPIO89_MC5_DAT3 | PIN_INPUT_PULLUP, /* KP_I_2 */ 333 /* NAHJ CTRL on GPIO 76 to low, CTRL_INV on GPIO216 to high */
145 GPIO88_MC5_DAT2 | PIN_INPUT_PULLUP, /* KP_I_3 */ 334 DB8500_PIN_HOG("GPIO76_J2", gpio_out_lo), /* CTRL */
146 GPIO91_GPIO | PIN_INPUT_PULLUP, /* FORCE_SENSING_INT */ 335 DB8500_PIN_HOG("GPIO216_AG12", gpio_out_hi), /* CTRL_INV */
147 GPIO92_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_RST */ 336 /* NFC ENA and RESET to low, pulldown IRQ line */
148 GPIO97_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_WU */ 337 DB8500_PIN_HOG("GPIO77_H1", gpio_out_lo), /* NFC_ENA */
149 338 DB8500_PIN_HOG("GPIO144_B13", gpio_in_pd), /* NFC_IRQ */
150 /* DiPro Sensor Interface */ 339 DB8500_PIN_HOG("GPIO142_C11", gpio_out_lo), /* NFC_RESET */
151 GPIO139_GPIO | PIN_INPUT_PULLUP, /* DIPRO_INT */ 340 /*
152 341 * SKE keyboard partly on alt A and partly on "Other alt C1"
153 /* Audio Amplifier Interface */ 342 * Driver KP_O1,2,3,6,7 low and pull up KP_I 0,2,3 for three
154 GPIO149_GPIO | PIN_OUTPUT_HIGH, /* VAUDIO_HF_EN, enable MAX8968 */ 343 * rows of 6 keys, then pull up force sensing interrup and
155 344 * drive reset and force sensing WU low.
156 /* GBF INTERFACE */ 345 */
157 GPIO171_GPIO | PIN_OUTPUT_LOW, /* GBF_ENA_RESET */ 346 DB8500_MUX_HOG("kp_a_1", "kp"),
158 347 DB8500_MUX_HOG("kp_oc1_1", "kp"),
159 /* MSP : HDTV INTERFACE */ 348 DB8500_PIN_HOG("GPIO90_A3", out_lo), /* KP_O1 */
160 GPIO192_GPIO | PIN_INPUT_PULLDOWN, 349 DB8500_PIN_HOG("GPIO87_B3", out_lo), /* KP_O2 */
161 350 DB8500_PIN_HOG("GPIO86_C6", out_lo), /* KP_O3 */
162 /* ACCELEROMETER_INTERFACE */ 351 DB8500_PIN_HOG("GPIO96_D8", out_lo), /* KP_O6 */
163 GPIO82_GPIO | PIN_INPUT_PULLUP, /* ACC_INT1 */ 352 DB8500_PIN_HOG("GPIO94_D7", out_lo), /* KP_O7 */
164 GPIO83_GPIO | PIN_INPUT_PULLUP, /* ACC_INT2 */ 353 DB8500_PIN_HOG("GPIO93_B7", in_pu), /* KP_I0 */
165 354 DB8500_PIN_HOG("GPIO89_E6", in_pu), /* KP_I2 */
166 /* SD card detect */ 355 DB8500_PIN_HOG("GPIO88_C4", in_pu), /* KP_I3 */
167 GPIO95_GPIO | PIN_INPUT_PULLUP, 356 DB8500_PIN_HOG("GPIO91_B6", gpio_in_pu), /* FORCE_SENSING_INT */
357 DB8500_PIN_HOG("GPIO92_D6", gpio_out_lo), /* FORCE_SENSING_RST */
358 DB8500_PIN_HOG("GPIO97_D9", gpio_out_lo), /* FORCE_SENSING_WU */
359 /* DiPro Sensor interrupt */
360 DB8500_PIN_HOG("GPIO139_C9", gpio_in_pu), /* DIPRO_INT */
361 /* Audio Amplifier HF enable */
362 DB8500_PIN_HOG("GPIO149_B14", gpio_out_hi), /* VAUDIO_HF_EN, enable MAX8968 */
363 /* GBF interface, pull low to reset state */
364 DB8500_PIN_HOG("GPIO171_D23", gpio_out_lo), /* GBF_ENA_RESET */
365 /* MSP : HDTV INTERFACE GPIO line */
366 DB8500_PIN_HOG("GPIO192_AJ27", gpio_in_pd),
367 /* Accelerometer interrupt lines */
368 DB8500_PIN_HOG("GPIO82_C1", gpio_in_pu), /* ACC_INT1 */
369 DB8500_PIN_HOG("GPIO83_D3", gpio_in_pu), /* ACC_INT2 */
370 /* SD card detect GPIO pin */
371 DB8500_PIN_HOG("GPIO95_E8", gpio_in_pu),
372 /*
373 * Runtime stuff
374 * Pull up/down of some sensor GPIO pins, for proximity, HAL sensor
375 * etc.
376 */
377 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
378 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"),
379 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
380 /*
381 * Make it possible to mux in the SKE keypad and bias the pins
382 * FIXME: what's the point with this on HREFv60? KP/SKE is already
383 * muxed in at another place! Enabling this will bork.
384 */
385 DB8500_MUX("kp_a_2", "kp", "ske"),
386 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */
387 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */
388 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */
389 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */
390 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */
391 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */
392 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */
393 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */
394 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */
395 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */
396 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */
397 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */
398 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */
399 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */
400 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */
401 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */
168}; 402};
169 403
170static pin_cfg_t u9500_pins[] = { 404static struct pinctrl_map __initdata u9500_pinmap[] = {
171 GPIO4_U1_RXD | PIN_INPUT_PULLUP, 405 /* Mux in UART1 (just RX/TX) and set the pull-ups */
172 GPIO5_U1_TXD | PIN_OUTPUT_HIGH, 406 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
173 GPIO144_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */ 407 DB8500_PIN_HOG("GPIO4_AH6", in_pu),
174 408 DB8500_PIN_HOG("GPIO5_AG6", out_hi),
409 /* WLAN_IRQ line */
410 DB8500_PIN_HOG("GPIO144_B13", gpio_in_pu),
175 /* HSI */ 411 /* HSI */
176 GPIO219_HSIR_FLA0 | PIN_INPUT_PULLDOWN, 412 DB8500_MUX_HOG("hsir_a_1", "hsi"),
177 GPIO220_HSIR_DAT0 | PIN_INPUT_PULLDOWN, 413 DB8500_MUX_HOG("hsit_a_1", "hsi"),
178 GPIO221_HSIR_RDY0 | PIN_OUTPUT_LOW, 414 DB8500_PIN_HOG("GPIO219_AG10", in_pd), /* RX FLA0 */
179 GPIO222_HSIT_FLA0 | PIN_OUTPUT_LOW, 415 DB8500_PIN_HOG("GPIO220_AH10", in_pd), /* RX DAT0 */
180 GPIO223_HSIT_DAT0 | PIN_OUTPUT_LOW, 416 DB8500_PIN_HOG("GPIO221_AJ11", out_lo), /* RX RDY0 */
181 GPIO224_HSIT_RDY0 | PIN_INPUT_PULLDOWN, 417 DB8500_PIN_HOG("GPIO222_AJ9", out_lo), /* TX FLA0 */
182 GPIO225_HSIT_CAWAKE0 | PIN_INPUT_PULLDOWN, /* CA_WAKE0 */ 418 DB8500_PIN_HOG("GPIO223_AH9", out_lo), /* TX DAT0 */
183 GPIO226_GPIO | PIN_OUTPUT_HIGH, /* AC_WAKE0 */ 419 DB8500_PIN_HOG("GPIO224_AG9", in_pd), /* TX RDY0 */
420 DB8500_PIN_HOG("GPIO225_AG8", in_pd), /* CAWAKE0 */
421 DB8500_PIN_HOG("GPIO226_AF8", out_hi), /* ACWAKE0 */
184}; 422};
185 423
186static pin_cfg_t u8500_pins[] = { 424static struct pinctrl_map __initdata u8500_pinmap[] = {
187 GPIO226_GPIO | PIN_OUTPUT_LOW, /* WLAN_PMU_EN */ 425 DB8500_PIN_HOG("GPIO226_AF8", gpio_out_lo), /* WLAN_PMU_EN */
188 GPIO4_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */ 426 DB8500_PIN_HOG("GPIO4_AH6", gpio_in_pu), /* WLAN_IRQ */
189}; 427};
190 428
191static pin_cfg_t snowball_pins[] = { 429static struct pinctrl_map __initdata snowball_pinmap[] = {
192 /* SSP0, to AB8500 */ 430 /* Mux in SSP0 connected to AB8500, pull down RXD pin */
193 GPIO143_SSP0_CLK, 431 DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
194 GPIO144_SSP0_FRM, 432 DB8500_PIN_HOG("GPIO145_C13", pd),
195 GPIO145_SSP0_RXD | PIN_PULL_DOWN, 433 /* Always drive the MC0 DAT31DIR line high on these boards */
196 GPIO146_SSP0_TXD, 434 DB8500_PIN_HOG("GPIO21_AB3", out_hi),
197 435 /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */
198 /* MMC0: MicroSD card */ 436 DB8500_MUX_HOG("sm_b_1", "sm"),
199 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH, 437 /* Drive RSTn_LAN high */
200 438 DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi),
201 /* MMC2: LAN */
202 GPIO86_SM_ADQ0,
203 GPIO87_SM_ADQ1,
204 GPIO88_SM_ADQ2,
205 GPIO89_SM_ADQ3,
206 GPIO90_SM_ADQ4,
207 GPIO91_SM_ADQ5,
208 GPIO92_SM_ADQ6,
209 GPIO93_SM_ADQ7,
210
211 GPIO94_SM_ADVn,
212 GPIO95_SM_CS0n,
213 GPIO96_SM_OEn,
214 GPIO97_SM_WEn,
215
216 GPIO128_SM_CKO,
217 GPIO130_SM_FBCLK,
218 GPIO131_SM_ADQ8,
219 GPIO132_SM_ADQ9,
220 GPIO133_SM_ADQ10,
221 GPIO134_SM_ADQ11,
222 GPIO135_SM_ADQ12,
223 GPIO136_SM_ADQ13,
224 GPIO137_SM_ADQ14,
225 GPIO138_SM_ADQ15,
226
227 /* RSTn_LAN */
228 GPIO141_GPIO | PIN_OUTPUT_HIGH,
229
230 /* Accelerometer/Magnetometer */ 439 /* Accelerometer/Magnetometer */
231 GPIO163_GPIO | PIN_INPUT_PULLUP, /* ACCEL_IRQ1 */ 440 DB8500_PIN_HOG("GPIO163_C20", gpio_in_pu), /* ACCEL_IRQ1 */
232 GPIO164_GPIO | PIN_INPUT_PULLUP, /* ACCEL_IRQ2 */ 441 DB8500_PIN_HOG("GPIO164_B21", gpio_in_pu), /* ACCEL_IRQ2 */
233 GPIO165_GPIO | PIN_INPUT_PULLUP, /* MAG_DRDY */ 442 DB8500_PIN_HOG("GPIO165_C21", gpio_in_pu), /* MAG_DRDY */
234
235 /* WLAN/GBF */ 443 /* WLAN/GBF */
236 GPIO161_GPIO | PIN_OUTPUT_LOW, /* WLAN_PMU_EN */ 444 DB8500_PIN_HOG("GPIO161_D21", gpio_out_lo), /* WLAN_PMU_EN */
237 GPIO171_GPIO | PIN_OUTPUT_HIGH,/* GBF_ENA */ 445 DB8500_PIN_HOG("GPIO171_D23", gpio_out_hi), /* GBF_ENA */
238 GPIO215_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */ 446 DB8500_PIN_HOG("GPIO215_AH13", gpio_out_lo), /* WLAN_ENA */
239 GPIO216_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */ 447 DB8500_PIN_HOG("GPIO216_AG12", gpio_in_pu), /* WLAN_IRQ */
240};
241
242/*
243 * I2C
244 */
245
246static UX500_PINS(mop500_pins_i2c0,
247 GPIO147_I2C0_SCL |
248 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
249 GPIO148_I2C0_SDA |
250 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
251);
252
253static UX500_PINS(mop500_pins_i2c1,
254 GPIO16_I2C1_SCL |
255 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
256 GPIO17_I2C1_SDA |
257 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
258);
259
260static UX500_PINS(mop500_pins_i2c2,
261 GPIO10_I2C2_SDA |
262 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
263 GPIO11_I2C2_SCL |
264 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
265);
266
267static UX500_PINS(mop500_pins_i2c3,
268 GPIO229_I2C3_SDA |
269 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
270 GPIO230_I2C3_SCL |
271 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
272);
273
274static UX500_PINS(mop500_pins_mcde_tvout,
275 GPIO78_LCD_D8,
276 GPIO79_LCD_D9,
277 GPIO80_LCD_D10,
278 GPIO81_LCD_D11,
279 GPIO150_LCDA_CLK,
280);
281
282static UX500_PINS(mop500_pins_mcde_hdmi,
283 GPIO69_LCD_VSI1 | PIN_INPUT_PULLUP,
284);
285
286static UX500_PINS(mop500_pins_ske,
287 GPIO153_KP_I7 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
288 GPIO154_KP_I6 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
289 GPIO155_KP_I5 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
290 GPIO156_KP_I4 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
291 GPIO161_KP_I3 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
292 GPIO162_KP_I2 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
293 GPIO163_KP_I1 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
294 GPIO164_KP_I0 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP,
295 GPIO157_KP_O7 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
296 GPIO158_KP_O6 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
297 GPIO159_KP_O5 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
298 GPIO160_KP_O4 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
299 GPIO165_KP_O3 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
300 GPIO166_KP_O2 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
301 GPIO167_KP_O1 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
302 GPIO168_KP_O0 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW,
303);
304
305/* sdi0 (removable MMC/SD/SDIO cards) */
306static UX500_PINS(mop500_pins_sdi0,
307 GPIO18_MC0_CMDDIR | PIN_OUTPUT_HIGH,
308 GPIO19_MC0_DAT0DIR | PIN_OUTPUT_HIGH,
309 GPIO20_MC0_DAT2DIR | PIN_OUTPUT_HIGH,
310
311 GPIO22_MC0_FBCLK | PIN_INPUT_NOPULL,
312 GPIO23_MC0_CLK | PIN_OUTPUT_LOW,
313 GPIO24_MC0_CMD | PIN_INPUT_PULLUP,
314 GPIO25_MC0_DAT0 | PIN_INPUT_PULLUP,
315 GPIO26_MC0_DAT1 | PIN_INPUT_PULLUP,
316 GPIO27_MC0_DAT2 | PIN_INPUT_PULLUP,
317 GPIO28_MC0_DAT3 | PIN_INPUT_PULLUP,
318);
319
320/* sdi1 (WLAN CW1200) */
321static UX500_PINS(mop500_pins_sdi1,
322 GPIO208_MC1_CLK | PIN_OUTPUT_LOW,
323 GPIO209_MC1_FBCLK | PIN_INPUT_NOPULL,
324 GPIO210_MC1_CMD | PIN_INPUT_PULLUP,
325 GPIO211_MC1_DAT0 | PIN_INPUT_PULLUP,
326 GPIO212_MC1_DAT1 | PIN_INPUT_PULLUP,
327 GPIO213_MC1_DAT2 | PIN_INPUT_PULLUP,
328 GPIO214_MC1_DAT3 | PIN_INPUT_PULLUP,
329);
330
331/* sdi2 (POP eMMC) */
332static UX500_PINS(mop500_pins_sdi2,
333 GPIO128_MC2_CLK | PIN_OUTPUT_LOW,
334 GPIO129_MC2_CMD | PIN_INPUT_PULLUP,
335 GPIO130_MC2_FBCLK | PIN_INPUT_NOPULL,
336 GPIO131_MC2_DAT0 | PIN_INPUT_PULLUP,
337 GPIO132_MC2_DAT1 | PIN_INPUT_PULLUP,
338 GPIO133_MC2_DAT2 | PIN_INPUT_PULLUP,
339 GPIO134_MC2_DAT3 | PIN_INPUT_PULLUP,
340 GPIO135_MC2_DAT4 | PIN_INPUT_PULLUP,
341 GPIO136_MC2_DAT5 | PIN_INPUT_PULLUP,
342 GPIO137_MC2_DAT6 | PIN_INPUT_PULLUP,
343 GPIO138_MC2_DAT7 | PIN_INPUT_PULLUP,
344);
345
346/* sdi4 (PCB eMMC) */
347static UX500_PINS(mop500_pins_sdi4,
348 GPIO197_MC4_DAT3 | PIN_INPUT_PULLUP,
349 GPIO198_MC4_DAT2 | PIN_INPUT_PULLUP,
350 GPIO199_MC4_DAT1 | PIN_INPUT_PULLUP,
351 GPIO200_MC4_DAT0 | PIN_INPUT_PULLUP,
352 GPIO201_MC4_CMD | PIN_INPUT_PULLUP,
353 GPIO202_MC4_FBCLK | PIN_INPUT_NOPULL,
354 GPIO203_MC4_CLK | PIN_OUTPUT_LOW,
355 GPIO204_MC4_DAT7 | PIN_INPUT_PULLUP,
356 GPIO205_MC4_DAT6 | PIN_INPUT_PULLUP,
357 GPIO206_MC4_DAT5 | PIN_INPUT_PULLUP,
358 GPIO207_MC4_DAT4 | PIN_INPUT_PULLUP,
359);
360
361/* USB */
362static UX500_PINS(mop500_pins_usb,
363 GPIO256_USB_NXT,
364 GPIO257_USB_STP | PIN_OUTPUT_HIGH,
365 GPIO258_USB_XCLK,
366 GPIO259_USB_DIR,
367 GPIO260_USB_DAT7,
368 GPIO261_USB_DAT6,
369 GPIO262_USB_DAT5,
370 GPIO263_USB_DAT4,
371 GPIO264_USB_DAT3,
372 GPIO265_USB_DAT2,
373 GPIO266_USB_DAT1,
374 GPIO267_USB_DAT0,
375);
376
377/* SPI2 */
378static UX500_PINS(mop500_pins_spi2,
379 GPIO216_GPIO | PIN_OUTPUT_HIGH,
380 GPIO218_SPI2_RXD | PIN_INPUT_PULLDOWN,
381 GPIO215_SPI2_TXD | PIN_OUTPUT_LOW,
382 GPIO217_SPI2_CLK | PIN_OUTPUT_LOW,
383);
384
385static UX500_PINS(mop500_pins_sensors1p_v60,
386 GPIO217_GPIO| PIN_INPUT_PULLUP |
387 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
388 GPIO145_GPIO | PIN_INPUT_PULLDOWN |
389 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
390 GPIO139_GPIO | PIN_INPUT_PULLUP |
391 PIN_SLPM_GPIO | PIN_SLPM_INPUT_NOPULL,
392);
393
394static UX500_PINS(mop500_pins_sensors1p,
395 PIN_CFG_INPUT(GPIO_PROX_SENSOR, GPIO, NOPULL),
396 PIN_CFG_INPUT(GPIO_HAL_SENSOR, GPIO, NOPULL),
397);
398
399static struct ux500_pin_lookup mop500_runtime_pins[] = {
400 PIN_LOOKUP("mcde-tvout", &mop500_pins_mcde_tvout),
401 PIN_LOOKUP("av8100-hdmi", &mop500_pins_mcde_hdmi),
402 PIN_LOOKUP("nmk-i2c.0", &mop500_pins_i2c0),
403 PIN_LOOKUP("nmk-i2c.1", &mop500_pins_i2c1),
404 PIN_LOOKUP("nmk-i2c.2", &mop500_pins_i2c2),
405 PIN_LOOKUP("nmk-i2c.3", &mop500_pins_i2c3),
406 PIN_LOOKUP("sdi0", &mop500_pins_sdi0),
407 PIN_LOOKUP("sdi1", &mop500_pins_sdi1),
408 PIN_LOOKUP("sdi2", &mop500_pins_sdi2),
409 PIN_LOOKUP("sdi4", &mop500_pins_sdi4),
410 PIN_LOOKUP("musb-ux500.0", &mop500_pins_usb),
411 PIN_LOOKUP("spi2", &mop500_pins_spi2),
412};
413
414static struct ux500_pin_lookup mop500_runtime_pins_v60[] = {
415 PIN_LOOKUP("ske", &mop500_pins_ske),
416 PIN_LOOKUP("gpio-keys.0", &mop500_pins_sensors1p_v60),
417};
418
419static struct ux500_pin_lookup mop500_runtime_pins_pre_v60[] = {
420 PIN_LOOKUP("ske", &mop500_pins_ske),
421 PIN_LOOKUP("gpio-keys.0", &mop500_pins_sensors1p),
422}; 448};
423 449
424/* 450/*
@@ -444,64 +470,45 @@ int pins_for_u9500(void)
444 return 0; 470 return 0;
445} 471}
446 472
447void __init mop500_pins_init(void) 473static void __init mop500_href_family_pinmaps_init(void)
448{ 474{
449 nmk_config_pins(mop500_pins_common,
450 ARRAY_SIZE(mop500_pins_common));
451
452 ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));
453
454 ux500_pins_add(mop500_runtime_pins_pre_v60,
455 ARRAY_SIZE(mop500_runtime_pins_pre_v60));
456
457 switch (pinsfor) { 475 switch (pinsfor) {
458 case PINS_FOR_U9500: 476 case PINS_FOR_U9500:
459 nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins)); 477 pinctrl_register_mappings(u9500_pinmap,
478 ARRAY_SIZE(u9500_pinmap));
460 break; 479 break;
461
462 case PINS_FOR_DEFAULT: 480 case PINS_FOR_DEFAULT:
463 nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins)); 481 pinctrl_register_mappings(u8500_pinmap,
482 ARRAY_SIZE(u8500_pinmap));
464 default: 483 default:
465 break; 484 break;
466 } 485 }
467
468 nmk_config_pins(mop500_pins_default,
469 ARRAY_SIZE(mop500_pins_default));
470} 486}
471 487
472void __init snowball_pins_init(void) 488void __init mop500_pinmaps_init(void)
473{ 489{
474 nmk_config_pins(mop500_pins_common, 490 pinctrl_register_mappings(mop500_family_pinmap,
475 ARRAY_SIZE(mop500_pins_common)); 491 ARRAY_SIZE(mop500_family_pinmap));
476 492 pinctrl_register_mappings(mop500_pinmap,
477 ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins)); 493 ARRAY_SIZE(mop500_pinmap));
478 494 mop500_href_family_pinmaps_init();
479 nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
480
481 nmk_config_pins(snowball_pins, ARRAY_SIZE(snowball_pins));
482} 495}
483 496
484void __init hrefv60_pins_init(void) 497void __init snowball_pinmaps_init(void)
485{ 498{
486 nmk_config_pins(mop500_pins_common, 499 pinctrl_register_mappings(mop500_family_pinmap,
487 ARRAY_SIZE(mop500_pins_common)); 500 ARRAY_SIZE(mop500_family_pinmap));
488 501 pinctrl_register_mappings(snowball_pinmap,
489 ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins)); 502 ARRAY_SIZE(snowball_pinmap));
490 503 pinctrl_register_mappings(u8500_pinmap,
491 ux500_pins_add(mop500_runtime_pins_v60, 504 ARRAY_SIZE(u8500_pinmap));
492 ARRAY_SIZE(mop500_runtime_pins_v60)); 505}
493
494 nmk_config_pins(hrefv60_pins,
495 ARRAY_SIZE(hrefv60_pins));
496
497 switch (pinsfor) {
498 case PINS_FOR_U9500:
499 nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins));
500 break;
501 506
502 case PINS_FOR_DEFAULT: 507void __init hrefv60_pinmaps_init(void)
503 nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins)); 508{
504 default: 509 pinctrl_register_mappings(mop500_family_pinmap,
505 break; 510 ARRAY_SIZE(mop500_family_pinmap));
506 } 511 pinctrl_register_mappings(hrefv60_pinmap,
512 ARRAY_SIZE(hrefv60_pinmap));
513 mop500_href_family_pinmaps_init();
507} 514}
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index ca0d62599f70..1dc31652b97a 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * Copyright (C) 2008-2009 ST-Ericsson 3 * Copyright (C) 2008-2009 ST-Ericsson
3 * 4 *
@@ -29,18 +30,17 @@
29#include <linux/smsc911x.h> 30#include <linux/smsc911x.h>
30#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
31#include <linux/delay.h> 32#include <linux/delay.h>
32
33#include <linux/of.h> 33#include <linux/of.h>
34#include <linux/of_platform.h> 34#include <linux/of_platform.h>
35
36#include <linux/leds.h> 35#include <linux/leds.h>
36#include <linux/pinctrl/consumer.h>
37
37#include <asm/mach-types.h> 38#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
39#include <asm/hardware/gic.h> 40#include <asm/hardware/gic.h>
40 41
41#include <plat/i2c.h> 42#include <plat/i2c.h>
42#include <plat/ste_dma40.h> 43#include <plat/ste_dma40.h>
43#include <plat/pincfg.h>
44#include <plat/gpio-nomadik.h> 44#include <plat/gpio-nomadik.h>
45 45
46#include <mach/hardware.h> 46#include <mach/hardware.h>
@@ -48,7 +48,6 @@
48#include <mach/devices.h> 48#include <mach/devices.h>
49#include <mach/irqs.h> 49#include <mach/irqs.h>
50 50
51#include "pins-db8500.h"
52#include "ste-dma40-db8500.h" 51#include "ste-dma40-db8500.h"
53#include "devices-db8500.h" 52#include "devices-db8500.h"
54#include "board-mop500.h" 53#include "board-mop500.h"
@@ -521,14 +520,6 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
521}; 520};
522#endif 521#endif
523 522
524
525static pin_cfg_t mop500_pins_uart0[] = {
526 GPIO0_U0_CTSn | PIN_INPUT_PULLUP,
527 GPIO1_U0_RTSn | PIN_OUTPUT_HIGH,
528 GPIO2_U0_RXD | PIN_INPUT_PULLUP,
529 GPIO3_U0_TXD | PIN_OUTPUT_HIGH,
530};
531
532#define PRCC_K_SOFTRST_SET 0x18 523#define PRCC_K_SOFTRST_SET 0x18
533#define PRCC_K_SOFTRST_CLEAR 0x1C 524#define PRCC_K_SOFTRST_CLEAR 0x1C
534static void ux500_uart0_reset(void) 525static void ux500_uart0_reset(void)
@@ -549,24 +540,33 @@ static void ux500_uart0_reset(void)
549 udelay(1); 540 udelay(1);
550} 541}
551 542
543/* This needs to be referenced by callbacks */
544struct pinctrl *u0_p;
545struct pinctrl_state *u0_def;
546struct pinctrl_state *u0_sleep;
547
552static void ux500_uart0_init(void) 548static void ux500_uart0_init(void)
553{ 549{
554 int ret; 550 int ret;
555 551
556 ret = nmk_config_pins(mop500_pins_uart0, 552 if (IS_ERR(u0_p) || IS_ERR(u0_def))
557 ARRAY_SIZE(mop500_pins_uart0)); 553 return;
558 if (ret < 0) 554
559 pr_err("pl011: uart pins_enable failed\n"); 555 ret = pinctrl_select_state(u0_p, u0_def);
556 if (ret)
557 pr_err("could not set UART0 defstate\n");
560} 558}
561 559
562static void ux500_uart0_exit(void) 560static void ux500_uart0_exit(void)
563{ 561{
564 int ret; 562 int ret;
565 563
566 ret = nmk_config_pins_sleep(mop500_pins_uart0, 564 if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
567 ARRAY_SIZE(mop500_pins_uart0)); 565 return;
568 if (ret < 0) 566
569 pr_err("pl011: uart pins_disable failed\n"); 567 ret = pinctrl_select_state(u0_p, u0_sleep);
568 if (ret)
569 pr_err("could not set UART0 idlestate\n");
570} 570}
571 571
572static struct amba_pl011_data uart0_plat = { 572static struct amba_pl011_data uart0_plat = {
@@ -598,7 +598,28 @@ static struct amba_pl011_data uart2_plat = {
598 598
599static void __init mop500_uart_init(struct device *parent) 599static void __init mop500_uart_init(struct device *parent)
600{ 600{
601 db8500_add_uart0(parent, &uart0_plat); 601 struct amba_device *uart0_device;
602
603 uart0_device = db8500_add_uart0(parent, &uart0_plat);
604 if (uart0_device) {
605 u0_p = pinctrl_get(&uart0_device->dev);
606 if (IS_ERR(u0_p))
607 dev_err(&uart0_device->dev,
608 "could not get UART0 pinctrl\n");
609 else {
610 u0_def = pinctrl_lookup_state(u0_p,
611 PINCTRL_STATE_DEFAULT);
612 if (IS_ERR(u0_def)) {
613 dev_err(&uart0_device->dev,
614 "could not get UART0 defstate\n");
615 }
616 u0_sleep = pinctrl_lookup_state(u0_p,
617 PINCTRL_STATE_SLEEP);
618 if (IS_ERR(u0_sleep))
619 dev_err(&uart0_device->dev,
620 "could not get UART0 idlestate\n");
621 }
622 }
602 db8500_add_uart1(parent, &uart1_plat); 623 db8500_add_uart1(parent, &uart1_plat);
603 db8500_add_uart2(parent, &uart2_plat); 624 db8500_add_uart2(parent, &uart2_plat);
604} 625}
@@ -618,10 +639,9 @@ static void __init mop500_init_machine(void)
618 639
619 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 640 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
620 641
642 mop500_pinmaps_init();
621 parent = u8500_init_devices(); 643 parent = u8500_init_devices();
622 644
623 mop500_pins_init();
624
625 /* FIXME: parent of ab8500 should be prcmu */ 645 /* FIXME: parent of ab8500 should be prcmu */
626 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 646 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
627 mop500_platform_devs[i]->dev.parent = parent; 647 mop500_platform_devs[i]->dev.parent = parent;
@@ -651,10 +671,9 @@ static void __init snowball_init_machine(void)
651 int i2c0_devs; 671 int i2c0_devs;
652 int i; 672 int i;
653 673
674 snowball_pinmaps_init();
654 parent = u8500_init_devices(); 675 parent = u8500_init_devices();
655 676
656 snowball_pins_init();
657
658 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++) 677 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
659 snowball_platform_devs[i]->dev.parent = parent; 678 snowball_platform_devs[i]->dev.parent = parent;
660 679
@@ -689,10 +708,9 @@ static void __init hrefv60_init_machine(void)
689 */ 708 */
690 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 709 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
691 710
711 hrefv60_pinmaps_init();
692 parent = u8500_init_devices(); 712 parent = u8500_init_devices();
693 713
694 hrefv60_pins_init();
695
696 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 714 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
697 mop500_platform_devs[i]->dev.parent = parent; 715 mop500_platform_devs[i]->dev.parent = parent;
698 716
@@ -781,6 +799,14 @@ static void __init u8500_init_machine(void)
781 int i2c0_devs; 799 int i2c0_devs;
782 int i; 800 int i;
783 801
802 /* Pinmaps must be in place before devices register */
803 if (of_machine_is_compatible("st-ericsson,mop500"))
804 mop500_pinmaps_init();
805 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
806 snowball_pinmaps_init();
807 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
808 hrefv60_pinmaps_init();
809
784 parent = u8500_init_devices(); 810 parent = u8500_init_devices();
785 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 811 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
786 812
@@ -794,14 +820,12 @@ static void __init u8500_init_machine(void)
794 820
795 if (of_machine_is_compatible("st-ericsson,mop500")) { 821 if (of_machine_is_compatible("st-ericsson,mop500")) {
796 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 822 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
797 mop500_pins_init();
798 823
799 platform_add_devices(mop500_platform_devs, 824 platform_add_devices(mop500_platform_devs,
800 ARRAY_SIZE(mop500_platform_devs)); 825 ARRAY_SIZE(mop500_platform_devs));
801 826
802 mop500_sdi_init(parent); 827 mop500_sdi_init(parent);
803 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { 828 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
804 snowball_pins_init();
805 platform_add_devices(snowball_platform_devs, 829 platform_add_devices(snowball_platform_devs,
806 ARRAY_SIZE(snowball_platform_devs)); 830 ARRAY_SIZE(snowball_platform_devs));
807 831
@@ -814,7 +838,6 @@ static void __init u8500_init_machine(void)
814 */ 838 */
815 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 839 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
816 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; 840 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
817 hrefv60_pins_init();
818 platform_add_devices(mop500_platform_devs, 841 platform_add_devices(mop500_platform_devs,
819 ARRAY_SIZE(mop500_platform_devs)); 842 ARRAY_SIZE(mop500_platform_devs));
820 843
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 91dc63fe101b..bc44c07c71a9 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -85,9 +85,9 @@ extern void hrefv60_sdi_init(struct device *parent);
85extern void mop500_sdi_tc35892_init(struct device *parent); 85extern void mop500_sdi_tc35892_init(struct device *parent);
86void __init mop500_u8500uib_init(void); 86void __init mop500_u8500uib_init(void);
87void __init mop500_stuib_init(void); 87void __init mop500_stuib_init(void);
88void __init mop500_pins_init(void); 88void __init mop500_pinmaps_init(void);
89void __init hrefv60_pins_init(void); 89void __init snowball_pinmaps_init(void);
90void __init snowball_pins_init(void); 90void __init hrefv60_pinmaps_init(void);
91 91
92void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, 92void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
93 unsigned n); 93 unsigned n);
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 9bd8163896cf..d992d2b44907 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -141,6 +141,7 @@ static void __init db8500_add_gpios(struct device *parent)
141 141
142 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base), 142 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base),
143 IRQ_DB8500_GPIO0, &pdata); 143 IRQ_DB8500_GPIO0, &pdata);
144 dbx500_add_pinctrl(parent, "pinctrl-db8500");
144} 145}
145 146
146static int usb_db8500_rx_dma_cfg[] = { 147static int usb_db8500_rx_dma_cfg[] = {
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 39c74ec82add..939f7503e8db 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -93,4 +93,16 @@ struct nmk_gpio_platform_data;
93void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num, 93void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
94 int irq, struct nmk_gpio_platform_data *pdata); 94 int irq, struct nmk_gpio_platform_data *pdata);
95 95
96static inline void
97dbx500_add_pinctrl(struct device *parent, const char *name)
98{
99 struct platform_device_info pdevinfo = {
100 .parent = parent,
101 .name = name,
102 .id = -1,
103 };
104
105 platform_device_register_full(&pdevinfo);
106}
107
96#endif 108#endif
diff --git a/arch/arm/mach-ux500/pins.c b/arch/arm/mach-ux500/pins.c
deleted file mode 100644
index 38c1d47b29a1..000000000000
--- a/arch/arm/mach-ux500/pins.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2
6 */
7
8#include <linux/kernel.h>
9#include <linux/string.h>
10#include <linux/device.h>
11#include <linux/mutex.h>
12#include <linux/spinlock.h>
13#include <linux/err.h>
14#include <plat/pincfg.h>
15
16#include "pins.h"
17
18static LIST_HEAD(pin_lookups);
19static DEFINE_MUTEX(pin_lookups_mutex);
20static DEFINE_SPINLOCK(pins_lock);
21
22void __init ux500_pins_add(struct ux500_pin_lookup *pl, size_t num)
23{
24 mutex_lock(&pin_lookups_mutex);
25
26 while (num--) {
27 list_add_tail(&pl->node, &pin_lookups);
28 pl++;
29 }
30
31 mutex_unlock(&pin_lookups_mutex);
32}
33
34struct ux500_pins *ux500_pins_get(const char *name)
35{
36 struct ux500_pins *pins = NULL;
37 struct ux500_pin_lookup *pl;
38
39 mutex_lock(&pin_lookups_mutex);
40
41 list_for_each_entry(pl, &pin_lookups, node) {
42 if (!strcmp(pl->name, name)) {
43 pins = pl->pins;
44 goto out;
45 }
46 }
47
48out:
49 mutex_unlock(&pin_lookups_mutex);
50 return pins;
51}
52
53int ux500_pins_enable(struct ux500_pins *pins)
54{
55 unsigned long flags;
56 int ret = 0;
57
58 spin_lock_irqsave(&pins_lock, flags);
59
60 if (pins->usage++ == 0)
61 ret = nmk_config_pins(pins->cfg, pins->num);
62
63 spin_unlock_irqrestore(&pins_lock, flags);
64 return ret;
65}
66
67int ux500_pins_disable(struct ux500_pins *pins)
68{
69 unsigned long flags;
70 int ret = 0;
71
72 spin_lock_irqsave(&pins_lock, flags);
73
74 if (WARN_ON(pins->usage == 0))
75 goto out;
76
77 if (--pins->usage == 0)
78 ret = nmk_config_pins_sleep(pins->cfg, pins->num);
79
80out:
81 spin_unlock_irqrestore(&pins_lock, flags);
82 return ret;
83}
84
85void ux500_pins_put(struct ux500_pins *pins)
86{
87 WARN_ON(!pins);
88}
diff --git a/arch/arm/mach-ux500/pins.h b/arch/arm/mach-ux500/pins.h
deleted file mode 100644
index 0d36af2e7d92..000000000000
--- a/arch/arm/mach-ux500/pins.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2
6 */
7
8#ifndef __MACH_UX500_PINS_H
9#define __MACH_UX500_PINS_H
10
11#include <linux/list.h>
12#include <plat/pincfg.h>
13
14#define PIN_LOOKUP(_name, _pins) \
15{ \
16 .name = _name, \
17 .pins = _pins, \
18}
19
20#define UX500_PINS(name, pins...) \
21struct ux500_pins name = { \
22 .cfg = (pin_cfg_t[]) {pins}, \
23 .num = ARRAY_SIZE(((pin_cfg_t[]) {pins})), \
24}
25
26struct ux500_pins {
27 int usage;
28 int num;
29 pin_cfg_t *cfg;
30};
31
32struct ux500_pin_lookup {
33 struct list_head node;
34 const char *name;
35 struct ux500_pins *pins;
36};
37
38void __init ux500_pins_add(struct ux500_pin_lookup *pl, size_t num);
39void __init ux500_offchip_gpio_init(struct ux500_pins *pins);
40struct ux500_pins *ux500_pins_get(const char *name);
41int ux500_pins_enable(struct ux500_pins *pins);
42int ux500_pins_disable(struct ux500_pins *pins);
43void ux500_pins_put(struct ux500_pins *pins);
44int pins_for_u9500(void);
45
46#endif
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h
index c015133a7ad3..9c949c7c98a7 100644
--- a/arch/arm/plat-nomadik/include/plat/pincfg.h
+++ b/arch/arm/plat-nomadik/include/plat/pincfg.h
@@ -124,6 +124,19 @@ typedef unsigned long pin_cfg_t;
124#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT) 124#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT)
125#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT) 125#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT)
126 126
127#define PIN_GPIOMODE_SHIFT 26
128#define PIN_GPIOMODE_MASK (0x1 << PIN_GPIOMODE_SHIFT)
129#define PIN_GPIOMODE(x) (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
130#define PIN_GPIOMODE_DISABLED (0 << PIN_GPIOMODE_SHIFT)
131#define PIN_GPIOMODE_ENABLED (1 << PIN_GPIOMODE_SHIFT)
132
133#define PIN_SLEEPMODE_SHIFT 27
134#define PIN_SLEEPMODE_MASK (0x1 << PIN_SLEEPMODE_SHIFT)
135#define PIN_SLEEPMODE(x) (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
136#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
137#define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT)
138
139
127/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */ 140/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */
128#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN) 141#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN)
129#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP) 142#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP)