linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] LPC18xx pintrl patches
@ 2015-07-14 22:25 Joachim Eastwood
  2015-07-14 22:25 ` [PATCH 1/2] pinctrl: lpc18xx: fix schmitt trigger setup Joachim Eastwood
  2015-07-14 22:25 ` [PATCH 2/2] pinctrl: lpc18xx: add support for usb1 pinconf Joachim Eastwood
  0 siblings, 2 replies; 5+ messages in thread
From: Joachim Eastwood @ 2015-07-14 22:25 UTC (permalink / raw)
  To: linus.walleij; +Cc: Joachim Eastwood, linux-gpio

Hej Linus,

This small patch set contains one new feature and one fix. While
implementing pinconf for USB1 I noticed a typo in a variable name
that meant that schmitt trigger was always begin enabled when
setting up pins. It would be nice if this fix (1st patch) to go
into 4.2 if possible.

The 2nd 'USB1 pinconf' patch is 4.3 material.

Both patches are based on 4.2-rc1. Note that the patches doesn't
touch any of the same code so they can be applied in any order.

At this point I don't except any more changes to pinctrl-lpc18xx
this time around.

Joachim Eastwood (2):
  pinctrl: lpc18xx: fix schmitt trigger setup
  pinctrl: lpc18xx: add support for usb1 pinconf

 drivers/pinctrl/pinctrl-lpc18xx.c | 58 +++++++++++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 6 deletions(-)

-- 
1.8.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] pinctrl: lpc18xx: fix schmitt trigger setup
  2015-07-14 22:25 [PATCH 0/2] LPC18xx pintrl patches Joachim Eastwood
@ 2015-07-14 22:25 ` Joachim Eastwood
  2015-07-17 12:22   ` Linus Walleij
  2015-07-14 22:25 ` [PATCH 2/2] pinctrl: lpc18xx: add support for usb1 pinconf Joachim Eastwood
  1 sibling, 1 reply; 5+ messages in thread
From: Joachim Eastwood @ 2015-07-14 22:25 UTC (permalink / raw)
  To: linus.walleij; +Cc: Joachim Eastwood, linux-gpio

The param_val variable is what determines if schmitt
trigger is enabled on a pin or not. A typo here mean
that schmitt trigger was always enabled for standard
and i2c pins.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/pinctrl/pinctrl-lpc18xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c
index ef0b697639a7..347c763a6a78 100644
--- a/drivers/pinctrl/pinctrl-lpc18xx.c
+++ b/drivers/pinctrl/pinctrl-lpc18xx.c
@@ -823,7 +823,7 @@ static int lpc18xx_pconf_set_i2c0(struct pinctrl_dev *pctldev,
 		break;
 
 	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
-		if (param)
+		if (param_val)
 			*reg &= ~(LPC18XX_SCU_I2C0_ZIF << shift);
 		else
 			*reg |= (LPC18XX_SCU_I2C0_ZIF << shift);
@@ -876,7 +876,7 @@ static int lpc18xx_pconf_set_pin(struct pinctrl_dev *pctldev,
 		break;
 
 	case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
-		if (param)
+		if (param_val)
 			*reg &= ~LPC18XX_SCU_PIN_ZIF;
 		else
 			*reg |= LPC18XX_SCU_PIN_ZIF;
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] pinctrl: lpc18xx: add support for usb1 pinconf
  2015-07-14 22:25 [PATCH 0/2] LPC18xx pintrl patches Joachim Eastwood
  2015-07-14 22:25 ` [PATCH 1/2] pinctrl: lpc18xx: fix schmitt trigger setup Joachim Eastwood
@ 2015-07-14 22:25 ` Joachim Eastwood
  2015-07-17 12:23   ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Joachim Eastwood @ 2015-07-14 22:25 UTC (permalink / raw)
  To: linus.walleij; +Cc: Joachim Eastwood, linux-gpio

The dedicated USB1 pins can be configured with pull-down and
for low power mode (suspend). Add support for this in the
pinctrl driver.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/pinctrl/pinctrl-lpc18xx.c | 54 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 50 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c
index 347c763a6a78..f0bebbe0682b 100644
--- a/drivers/pinctrl/pinctrl-lpc18xx.c
+++ b/drivers/pinctrl/pinctrl-lpc18xx.c
@@ -37,6 +37,9 @@
 #define LPC18XX_SCU_PIN_EHD_MASK	0x300
 #define LPC18XX_SCU_PIN_EHD_POS		8
 
+#define LPC18XX_SCU_USB1_EPD		BIT(2)
+#define LPC18XX_SCU_USB1_EPWR		BIT(4)
+
 #define LPC18XX_SCU_I2C0_EFP		BIT(0)
 #define LPC18XX_SCU_I2C0_EHD		BIT(2)
 #define LPC18XX_SCU_I2C0_EZI		BIT(3)
@@ -617,8 +620,31 @@ static const struct pinctrl_pin_desc lpc18xx_pins[] = {
 
 static int lpc18xx_pconf_get_usb1(enum pin_config_param param, int *arg, u32 reg)
 {
-	/* TODO */
-	return -ENOTSUPP;
+	switch (param) {
+	case PIN_CONFIG_LOW_POWER_MODE:
+		if (reg & LPC18XX_SCU_USB1_EPWR)
+			*arg = 0;
+		else
+			*arg = 1;
+		break;
+
+	case PIN_CONFIG_BIAS_DISABLE:
+		if (reg & LPC18XX_SCU_USB1_EPD)
+			return -EINVAL;
+		break;
+
+	case PIN_CONFIG_BIAS_PULL_DOWN:
+		if (reg & LPC18XX_SCU_USB1_EPD)
+			*arg = 1;
+		else
+			return -EINVAL;
+		break;
+
+	default:
+		return -ENOTSUPP;
+	}
+
+	return 0;
 }
 
 static int lpc18xx_pconf_get_i2c0(enum pin_config_param param, int *arg, u32 reg,
@@ -782,8 +808,28 @@ static int lpc18xx_pconf_set_usb1(struct pinctrl_dev *pctldev,
 				  enum pin_config_param param,
 				  u16 param_val, u32 *reg)
 {
-	/* TODO */
-	return -ENOTSUPP;
+	switch (param) {
+	case PIN_CONFIG_LOW_POWER_MODE:
+		if (param_val)
+			*reg &= ~LPC18XX_SCU_USB1_EPWR;
+		else
+			*reg |= LPC18XX_SCU_USB1_EPWR;
+		break;
+
+	case PIN_CONFIG_BIAS_DISABLE:
+		*reg &= ~LPC18XX_SCU_USB1_EPD;
+		break;
+
+	case PIN_CONFIG_BIAS_PULL_DOWN:
+		*reg |= LPC18XX_SCU_USB1_EPD;
+		break;
+
+	default:
+		dev_err(pctldev->dev, "Property not supported\n");
+		return -ENOTSUPP;
+	}
+
+	return 0;
 }
 
 static int lpc18xx_pconf_set_i2c0(struct pinctrl_dev *pctldev,
-- 
1.8.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] pinctrl: lpc18xx: fix schmitt trigger setup
  2015-07-14 22:25 ` [PATCH 1/2] pinctrl: lpc18xx: fix schmitt trigger setup Joachim Eastwood
@ 2015-07-17 12:22   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-07-17 12:22 UTC (permalink / raw)
  To: Joachim Eastwood; +Cc: linux-gpio@vger.kernel.org

On Wed, Jul 15, 2015 at 12:25 AM, Joachim Eastwood <manabian@gmail.com> wrote:

> The param_val variable is what determines if schmitt
> trigger is enabled on a pin or not. A typo here mean
> that schmitt trigger was always enabled for standard
> and i2c pins.
>
> Signed-off-by: Joachim Eastwood <manabian@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] pinctrl: lpc18xx: add support for usb1 pinconf
  2015-07-14 22:25 ` [PATCH 2/2] pinctrl: lpc18xx: add support for usb1 pinconf Joachim Eastwood
@ 2015-07-17 12:23   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-07-17 12:23 UTC (permalink / raw)
  To: Joachim Eastwood; +Cc: linux-gpio@vger.kernel.org

On Wed, Jul 15, 2015 at 12:25 AM, Joachim Eastwood <manabian@gmail.com> wrote:

> The dedicated USB1 pins can be configured with pull-down and
> for low power mode (suspend). Add support for this in the
> pinctrl driver.
>
> Signed-off-by: Joachim Eastwood <manabian@gmail.com>

Patch applied for v4.3.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-17 12:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14 22:25 [PATCH 0/2] LPC18xx pintrl patches Joachim Eastwood
2015-07-14 22:25 ` [PATCH 1/2] pinctrl: lpc18xx: fix schmitt trigger setup Joachim Eastwood
2015-07-17 12:22   ` Linus Walleij
2015-07-14 22:25 ` [PATCH 2/2] pinctrl: lpc18xx: add support for usb1 pinconf Joachim Eastwood
2015-07-17 12:23   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).