Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7af07ad9 authored by Olof Johansson's avatar Olof Johansson
Browse files

Merge tag 'ux500-gpio-pins-for-3.5' of...

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: default avatarOlof Johansson <olof@lixom.net>
parents 7afeca1a 08d98fe0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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
@@ -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)"

+1 −1
Original line number Diff line number Diff line
@@ -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
+51 −34
Original line number Diff line number Diff line
@@ -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"
@@ -28,19 +29,10 @@ 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)
{
@@ -48,9 +40,11 @@ int msp13_i2s_init(void)
	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);
@@ -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;
@@ -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)
{
@@ -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 */
@@ -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,
	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 = 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,
	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,
	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;
}
+431 −424

File changed.

Preview size limit exceeded, changes collapsed.

+53 −30
Original line number Diff line number Diff line

/*
 * Copyright (C) 2008-2009 ST-Ericsson
 *
@@ -29,18 +30,17 @@
#include <linux/smsc911x.h>
#include <linux/gpio_keys.h>
#include <linux/delay.h>

#include <linux/of.h>
#include <linux/of_platform.h>

#include <linux/leds.h>
#include <linux/pinctrl/consumer.h>

#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/hardware/gic.h>

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

#include <mach/hardware.h>
@@ -48,7 +48,6 @@
#include <mach/devices.h>
#include <mach/irqs.h>

#include "pins-db8500.h"
#include "ste-dma40-db8500.h"
#include "devices-db8500.h"
#include "board-mop500.h"
@@ -521,14 +520,6 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
};
#endif


static pin_cfg_t mop500_pins_uart0[] = {
	GPIO0_U0_CTSn   | PIN_INPUT_PULLUP,
	GPIO1_U0_RTSn   | PIN_OUTPUT_HIGH,
	GPIO2_U0_RXD    | PIN_INPUT_PULLUP,
	GPIO3_U0_TXD    | PIN_OUTPUT_HIGH,
};

#define PRCC_K_SOFTRST_SET      0x18
#define PRCC_K_SOFTRST_CLEAR    0x1C
static void ux500_uart0_reset(void)
@@ -549,24 +540,33 @@ static void ux500_uart0_reset(void)
	udelay(1);
}

/* This needs to be referenced by callbacks */
struct pinctrl *u0_p;
struct pinctrl_state *u0_def;
struct pinctrl_state *u0_sleep;

static void ux500_uart0_init(void)
{
	int ret;

	ret = nmk_config_pins(mop500_pins_uart0,
			ARRAY_SIZE(mop500_pins_uart0));
	if (ret < 0)
		pr_err("pl011: uart pins_enable failed\n");
	if (IS_ERR(u0_p) || IS_ERR(u0_def))
		return;

	ret = pinctrl_select_state(u0_p, u0_def);
	if (ret)
		pr_err("could not set UART0 defstate\n");
}

static void ux500_uart0_exit(void)
{
	int ret;

	ret = nmk_config_pins_sleep(mop500_pins_uart0,
			ARRAY_SIZE(mop500_pins_uart0));
	if (ret < 0)
		pr_err("pl011: uart pins_disable failed\n");
	if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
		return;

	ret = pinctrl_select_state(u0_p, u0_sleep);
	if (ret)
		pr_err("could not set UART0 idlestate\n");
}

static struct amba_pl011_data uart0_plat = {
@@ -598,7 +598,28 @@ static struct amba_pl011_data uart2_plat = {

static void __init mop500_uart_init(struct device *parent)
{
	db8500_add_uart0(parent, &uart0_plat);
	struct amba_device *uart0_device;

	uart0_device = db8500_add_uart0(parent, &uart0_plat);
	if (uart0_device) {
		u0_p = pinctrl_get(&uart0_device->dev);
		if (IS_ERR(u0_p))
			dev_err(&uart0_device->dev,
				"could not get UART0 pinctrl\n");
		else {
			u0_def = pinctrl_lookup_state(u0_p,
						      PINCTRL_STATE_DEFAULT);
			if (IS_ERR(u0_def)) {
				dev_err(&uart0_device->dev,
					"could not get UART0 defstate\n");
			}
			u0_sleep = pinctrl_lookup_state(u0_p,
							PINCTRL_STATE_SLEEP);
			if (IS_ERR(u0_sleep))
				dev_err(&uart0_device->dev,
					"could not get UART0 idlestate\n");
		}
	}
	db8500_add_uart1(parent, &uart1_plat);
	db8500_add_uart2(parent, &uart2_plat);
}
@@ -618,10 +639,9 @@ static void __init mop500_init_machine(void)

	mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;

	mop500_pinmaps_init();
	parent = u8500_init_devices();

	mop500_pins_init();

	/* FIXME: parent of ab8500 should be prcmu */
	for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
		mop500_platform_devs[i]->dev.parent = parent;
@@ -651,10 +671,9 @@ static void __init snowball_init_machine(void)
	int i2c0_devs;
	int i;

	snowball_pinmaps_init();
	parent = u8500_init_devices();

	snowball_pins_init();

	for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
		snowball_platform_devs[i]->dev.parent = parent;

@@ -689,10 +708,9 @@ static void __init hrefv60_init_machine(void)
	 */
	mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;

	hrefv60_pinmaps_init();
	parent = u8500_init_devices();

	hrefv60_pins_init();

	for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
		mop500_platform_devs[i]->dev.parent = parent;

@@ -781,6 +799,14 @@ static void __init u8500_init_machine(void)
	int i2c0_devs;
	int i;

	/* Pinmaps must be in place before devices register */
	if (of_machine_is_compatible("st-ericsson,mop500"))
		mop500_pinmaps_init();
	else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
		snowball_pinmaps_init();
	else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
		hrefv60_pinmaps_init();

	parent = u8500_init_devices();
	i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);

@@ -794,14 +820,12 @@ static void __init u8500_init_machine(void)

	if (of_machine_is_compatible("st-ericsson,mop500")) {
		mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
		mop500_pins_init();

		platform_add_devices(mop500_platform_devs,
				ARRAY_SIZE(mop500_platform_devs));

		mop500_sdi_init(parent);
	} else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
		snowball_pins_init();
		platform_add_devices(snowball_platform_devs,
				ARRAY_SIZE(snowball_platform_devs));

@@ -814,7 +838,6 @@ static void __init u8500_init_machine(void)
		 */
		mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
		i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
		hrefv60_pins_init();
		platform_add_devices(mop500_platform_devs,
				ARRAY_SIZE(mop500_platform_devs));

Loading