Skip to content

Commit 7af07ad

Browse files
committed
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>
2 parents 7afeca1 + 08d98fe commit 7af07ad

18 files changed

Lines changed: 2050 additions & 676 deletions

File tree

‎arch/arm/mach-ux500/Kconfig‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ config UX500_SOC_COMMON
99
select ARM_ERRATA_754322
1010
select ARM_ERRATA_764369
1111
select CACHE_L2X0
12+
select PINCTRL
13+
select PINCTRL_NOMADIK
1214

1315
config UX500_SOC_DB5500
1416
bool
@@ -20,6 +22,7 @@ config UX500_SOC_DB8500
2022
select REGULATOR
2123
select REGULATOR_DB8500_PRCMU
2224
select CPU_FREQ_TABLE if CPU_FREQ
25+
select PINCTRL_DB8500
2326

2427
menu "Ux500 target platform (boards)"
2528

‎arch/arm/mach-ux500/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
obj-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
77
obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
88
obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o
99
obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o

‎arch/arm/mach-ux500/board-mop500-msp.c‎

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
#include <linux/platform_device.h>
88
#include <linux/init.h>
99
#include <linux/gpio.h>
10-
#include <plat/gpio-nomadik.h>
10+
#include <linux/pinctrl/consumer.h>
1111

12+
#include <plat/gpio-nomadik.h>
1213
#include <plat/pincfg.h>
1314
#include <plat/ste_dma40.h>
1415

1516
#include <mach/devices.h>
16-
#include <ste-dma40-db8500.h>
1717
#include <mach/hardware.h>
1818
#include <mach/irqs.h>
1919
#include <mach/msp.h>
2020

21+
#include "ste-dma40-db8500.h"
2122
#include "board-mop500.h"
2223
#include "devices-db8500.h"
2324
#include "pins-db8500.h"
@@ -28,29 +29,22 @@ static DEFINE_SPINLOCK(msp_rxtx_lock);
2829
/* Reference Count */
2930
static int msp_rxtx_ref;
3031

31-
static pin_cfg_t mop500_msp1_pins_init[] = {
32-
GPIO33_MSP1_TXD | PIN_OUTPUT_LOW | PIN_SLPM_WAKEUP_DISABLE,
33-
GPIO34_MSP1_TFS | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
34-
GPIO35_MSP1_TCK | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
35-
GPIO36_MSP1_RXD | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
36-
};
37-
38-
static 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-
};
32+
/* Pin modes */
33+
struct pinctrl *msp1_p;
34+
struct pinctrl_state *msp1_def;
35+
struct pinctrl_state *msp1_sleep;
4436

4537
int msp13_i2s_init(void)
4638
{
4739
int retval = 0;
4840
unsigned long flags;
4941

5042
spin_lock_irqsave(&msp_rxtx_lock, flags);
51-
if (msp_rxtx_ref == 0)
52-
retval = nmk_config_pins(
53-
ARRAY_AND_SIZE(mop500_msp1_pins_init));
43+
if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) {
44+
retval = pinctrl_select_state(msp1_p, msp1_def);
45+
if (retval)
46+
pr_err("could not set MSP1 defstate\n");
47+
}
5448
if (!retval)
5549
msp_rxtx_ref++;
5650
spin_unlock_irqrestore(&msp_rxtx_lock, flags);
@@ -66,9 +60,11 @@ int msp13_i2s_exit(void)
6660
spin_lock_irqsave(&msp_rxtx_lock, flags);
6761
WARN_ON(!msp_rxtx_ref);
6862
msp_rxtx_ref--;
69-
if (msp_rxtx_ref == 0)
70-
retval = nmk_config_pins_sleep(
71-
ARRAY_AND_SIZE(mop500_msp1_pins_exit));
63+
if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) {
64+
retval = pinctrl_select_state(msp1_p, msp1_sleep);
65+
if (retval)
66+
pr_err("could not set MSP1 sleepstate\n");
67+
}
7268
spin_unlock_irqrestore(&msp_rxtx_lock, flags);
7369

7470
return retval;
@@ -170,7 +166,8 @@ static struct stedma40_chan_cfg msp2_dma_tx = {
170166
/* data_width is set during configuration */
171167
};
172168

173-
static int db8500_add_msp_i2s(struct device *parent, int id,
169+
static struct platform_device *db8500_add_msp_i2s(struct device *parent,
170+
int id,
174171
resource_size_t base, int irq,
175172
struct msp_i2s_platform_data *pdata)
176173
{
@@ -188,10 +185,10 @@ static int db8500_add_msp_i2s(struct device *parent, int id,
188185
if (!pdev) {
189186
pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
190187
id);
191-
return -EIO;
188+
return NULL;
192189
}
193190

194-
return 0;
191+
return pdev;
195192
}
196193

197194
/* Platform device for ASoC U8500 machine */
@@ -228,23 +225,43 @@ static struct msp_i2s_platform_data msp3_platform_data = {
228225

229226
int mop500_msp_init(struct device *parent)
230227
{
231-
int ret;
228+
struct platform_device *msp1;
232229

233230
pr_info("%s: Register platform-device 'snd-soc-u8500'.\n", __func__);
234231
platform_device_register(&snd_soc_u8500);
235232

236233
pr_info("Initialize MSP I2S-devices.\n");
237-
ret = db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
238-
&msp0_platform_data);
239-
ret |= db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
240-
&msp1_platform_data);
241-
ret |= db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
242-
&msp2_platform_data);
243-
ret |= db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
244-
&msp3_platform_data);
234+
db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
235+
&msp0_platform_data);
236+
msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
237+
&msp1_platform_data);
238+
db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
239+
&msp2_platform_data);
240+
db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
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+
}
245262

246263
pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__);
247264
platform_device_register(&ux500_pcm);
248265

249-
return ret;
266+
return 0;
250267
}

0 commit comments

Comments
 (0)