Skip to content

Commit

Permalink
Merge tag 'ux500-gpio-pins-for-3.5' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/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>
  • Loading branch information
Olof Johansson committed May 13, 2012
2 parents 7afeca1 + 08d98fe commit 7af07ad
Show file tree
Hide file tree
Showing 18 changed files with 2,050 additions and 676 deletions.
3 changes: 3 additions & 0 deletions arch/arm/mach-ux500/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ config UX500_SOC_COMMON
select ARM_ERRATA_754322
select ARM_ERRATA_764369
select CACHE_L2X0
select PINCTRL
select PINCTRL_NOMADIK

config UX500_SOC_DB5500
bool
Expand All @@ -20,6 +22,7 @@ config UX500_SOC_DB8500
select REGULATOR
select REGULATOR_DB8500_PRCMU
select CPU_FREQ_TABLE if CPU_FREQ
select PINCTRL_DB8500

menu "Ux500 target platform (boards)"

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-ux500/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

obj-y := clock.o cpu.o devices.o devices-common.o \
id.o pins.o usb.o timer.o
id.o usb.o timer.o
obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o
obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
Expand Down
85 changes: 51 additions & 34 deletions arch/arm/mach-ux500/board-mop500-msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
#include <linux/platform_device.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <plat/gpio-nomadik.h>
#include <linux/pinctrl/consumer.h>

#include <plat/gpio-nomadik.h>
#include <plat/pincfg.h>
#include <plat/ste_dma40.h>

#include <mach/devices.h>
#include <ste-dma40-db8500.h>
#include <mach/hardware.h>
#include <mach/irqs.h>
#include <mach/msp.h>

#include "ste-dma40-db8500.h"
#include "board-mop500.h"
#include "devices-db8500.h"
#include "pins-db8500.h"
Expand All @@ -28,29 +29,22 @@ static DEFINE_SPINLOCK(msp_rxtx_lock);
/* Reference Count */
static int msp_rxtx_ref;

static pin_cfg_t mop500_msp1_pins_init[] = {
GPIO33_MSP1_TXD | PIN_OUTPUT_LOW | PIN_SLPM_WAKEUP_DISABLE,
GPIO34_MSP1_TFS | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
GPIO35_MSP1_TCK | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
GPIO36_MSP1_RXD | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_DISABLE,
};

static pin_cfg_t mop500_msp1_pins_exit[] = {
GPIO33_MSP1_TXD | PIN_OUTPUT_LOW | PIN_SLPM_WAKEUP_ENABLE,
GPIO34_MSP1_TFS | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_ENABLE,
GPIO35_MSP1_TCK | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_ENABLE,
GPIO36_MSP1_RXD | PIN_INPUT_NOPULL | PIN_SLPM_WAKEUP_ENABLE,
};
/* Pin modes */
struct pinctrl *msp1_p;
struct pinctrl_state *msp1_def;
struct pinctrl_state *msp1_sleep;

int msp13_i2s_init(void)
{
int retval = 0;
unsigned long flags;

spin_lock_irqsave(&msp_rxtx_lock, flags);
if (msp_rxtx_ref == 0)
retval = nmk_config_pins(
ARRAY_AND_SIZE(mop500_msp1_pins_init));
if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) {
retval = pinctrl_select_state(msp1_p, msp1_def);
if (retval)
pr_err("could not set MSP1 defstate\n");
}
if (!retval)
msp_rxtx_ref++;
spin_unlock_irqrestore(&msp_rxtx_lock, flags);
Expand All @@ -66,9 +60,11 @@ int msp13_i2s_exit(void)
spin_lock_irqsave(&msp_rxtx_lock, flags);
WARN_ON(!msp_rxtx_ref);
msp_rxtx_ref--;
if (msp_rxtx_ref == 0)
retval = nmk_config_pins_sleep(
ARRAY_AND_SIZE(mop500_msp1_pins_exit));
if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) {
retval = pinctrl_select_state(msp1_p, msp1_sleep);
if (retval)
pr_err("could not set MSP1 sleepstate\n");
}
spin_unlock_irqrestore(&msp_rxtx_lock, flags);

return retval;
Expand Down Expand Up @@ -170,7 +166,8 @@ static struct stedma40_chan_cfg msp2_dma_tx = {
/* data_width is set during configuration */
};

static int db8500_add_msp_i2s(struct device *parent, int id,
static struct platform_device *db8500_add_msp_i2s(struct device *parent,
int id,
resource_size_t base, int irq,
struct msp_i2s_platform_data *pdata)
{
Expand All @@ -188,10 +185,10 @@ static int db8500_add_msp_i2s(struct device *parent, int id,
if (!pdev) {
pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
id);
return -EIO;
return NULL;
}

return 0;
return pdev;
}

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

int mop500_msp_init(struct device *parent)
{
int ret;
struct platform_device *msp1;

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

pr_info("Initialize MSP I2S-devices.\n");
ret = db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
&msp0_platform_data);
ret |= db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
&msp1_platform_data);
ret |= db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
&msp2_platform_data);
ret |= db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
&msp3_platform_data);
db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
&msp0_platform_data);
msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
&msp1_platform_data);
db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
&msp2_platform_data);
db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
&msp3_platform_data);

/* Get the pinctrl handle for MSP1 */
if (msp1) {
msp1_p = pinctrl_get(&msp1->dev);
if (IS_ERR(msp1_p))
dev_err(&msp1->dev, "could not get MSP1 pinctrl\n");
else {
msp1_def = pinctrl_lookup_state(msp1_p,
PINCTRL_STATE_DEFAULT);
if (IS_ERR(msp1_def)) {
dev_err(&msp1->dev,
"could not get MSP1 defstate\n");
}
msp1_sleep = pinctrl_lookup_state(msp1_p,
PINCTRL_STATE_SLEEP);
if (IS_ERR(msp1_sleep))
dev_err(&msp1->dev,
"could not get MSP1 idlestate\n");
}
}

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

return ret;
return 0;
}
Loading

0 comments on commit 7af07ad

Please sign in to comment.