All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
@ 2012-10-28 12:23 Jamie Lentin
  2012-10-28 16:37 ` Michael Walle
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jamie Lentin @ 2012-10-28 12:23 UTC (permalink / raw)
  To: linux-arm-kernel

The plat-orion GPIO driver would disable any pin blinking whenever
using a pin for output. Do the same here, as a blinking LED will
continue to blink regardless of what the GPIO pin level is.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
The power LED on the DNS-320/DNS-325 is left blinking by the bootloader,
the LED turning steady indicates it's booted. The blinking needs to be
disabled before setting the GPIO pin level has any effect.

Apart from the custom init code running too soon, I think everything is
working now.

I haven't tested this on any other boards, so not sure if it's sensible
beyond the kirkwood/orion world.

 drivers/gpio/gpio-mvebu.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index cf7afb9..be65c04 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -92,6 +92,11 @@ static inline void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip)
 	return mvchip->membase + GPIO_OUT_OFF;
 }
 
+static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip)
+{
+	return mvchip->membase + GPIO_BLINK_EN_OFF;
+}
+
 static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip)
 {
 	return mvchip->membase + GPIO_IO_CONF_OFF;
@@ -206,6 +211,23 @@ static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin)
 	return (u >> pin) & 1;
 }
 
+static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value)
+{
+	struct mvebu_gpio_chip *mvchip =
+		container_of(chip, struct mvebu_gpio_chip, chip);
+	unsigned long flags;
+	u32 u;
+
+	spin_lock_irqsave(&mvchip->lock, flags);
+	u = readl_relaxed(mvebu_gpioreg_blink(mvchip));
+	if (value)
+		u |= 1 << pin;
+	else
+		u &= ~(1 << pin);
+	writel_relaxed(u, mvebu_gpioreg_blink(mvchip));
+	spin_unlock_irqrestore(&mvchip->lock, flags);
+}
+
 static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
 {
 	struct mvebu_gpio_chip *mvchip =
@@ -244,6 +266,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin,
 	if (ret)
 		return ret;
 
+	mvebu_gpio_blink(chip, pin, 0);
 	mvebu_gpio_set(chip, pin, value);
 
 	spin_lock_irqsave(&mvchip->lock, flags);
-- 
1.7.10.4

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

* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
  2012-10-28 12:23 [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output Jamie Lentin
@ 2012-10-28 16:37 ` Michael Walle
  2012-10-30 22:16 ` Linus Walleij
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Michael Walle @ 2012-10-28 16:37 UTC (permalink / raw)
  To: linux-arm-kernel

Am Sonntag 28 Oktober 2012, 13:23:24 schrieb Jamie Lentin:
> The plat-orion GPIO driver would disable any pin blinking whenever
> using a pin for output. Do the same here, as a blinking LED will
> continue to blink regardless of what the GPIO pin level is.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
> The power LED on the DNS-320/DNS-325 is left blinking by the bootloader,
> the LED turning steady indicates it's booted. The blinking needs to be
> disabled before setting the GPIO pin level has any effect.
> 
> Apart from the custom init code running too soon, I think everything is
> working now.
> 
> I haven't tested this on any other boards, so not sure if it's sensible
> beyond the kirkwood/orion world.
> 
>  drivers/gpio/gpio-mvebu.c |   23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index cf7afb9..be65c04 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -92,6 +92,11 @@ static inline void __iomem *mvebu_gpioreg_out(struct
> mvebu_gpio_chip *mvchip) return mvchip->membase + GPIO_OUT_OFF;
>  }
> 
> +static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip
> *mvchip) +{
> +	return mvchip->membase + GPIO_BLINK_EN_OFF;
> +}
> +
>  static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip
> *mvchip) {
>  	return mvchip->membase + GPIO_IO_CONF_OFF;
> @@ -206,6 +211,23 @@ static int mvebu_gpio_get(struct gpio_chip *chip,
> unsigned pin) return (u >> pin) & 1;
>  }
> 
> +static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int
> value) +{
> +	struct mvebu_gpio_chip *mvchip =
> +		container_of(chip, struct mvebu_gpio_chip, chip);
> +	unsigned long flags;
> +	u32 u;
> +
> +	spin_lock_irqsave(&mvchip->lock, flags);
> +	u = readl_relaxed(mvebu_gpioreg_blink(mvchip));
> +	if (value)
> +		u |= 1 << pin;
> +	else
> +		u &= ~(1 << pin);
> +	writel_relaxed(u, mvebu_gpioreg_blink(mvchip));
> +	spin_unlock_irqrestore(&mvchip->lock, flags);
> +}
> +
>  static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned
> pin) {
>  	struct mvebu_gpio_chip *mvchip =
> @@ -244,6 +266,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip
> *chip, unsigned pin, if (ret)
>  		return ret;
> 
> +	mvebu_gpio_blink(chip, pin, 0);
>  	mvebu_gpio_set(chip, pin, value);
> 
>  	spin_lock_irqsave(&mvchip->lock, flags);

Tested-by: Michael Walle <michael@walle.cc>


-- 
Michael

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

* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
  2012-10-28 12:23 [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output Jamie Lentin
  2012-10-28 16:37 ` Michael Walle
@ 2012-10-30 22:16 ` Linus Walleij
  2012-10-30 22:27   ` Thomas Petazzoni
  2012-10-30 22:26 ` Thomas Petazzoni
  2012-10-30 23:41 ` Linus Walleij
  3 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2012-10-30 22:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Oct 28, 2012 at 1:23 PM, Jamie Lentin <jm@lentin.co.uk> wrote:

> The plat-orion GPIO driver would disable any pin blinking whenever
> using a pin for output. Do the same here, as a blinking LED will
> continue to blink regardless of what the GPIO pin level is.
>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
> The power LED on the DNS-320/DNS-325 is left blinking by the bootloader,
> the LED turning steady indicates it's booted. The blinking needs to be
> disabled before setting the GPIO pin level has any effect.
>
> Apart from the custom init code running too soon, I think everything is
> working now.
>
> I haven't tested this on any other boards, so not sure if it's sensible
> beyond the kirkwood/orion world.

Can I have some ACK on this thing from Andrew or Thomas say...

Also is this a thing for the stable kernel -rc series or next
merge window? I couldn't quite figure out if it was a regression.

Yours,
Linus Walleij

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

* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
  2012-10-28 12:23 [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output Jamie Lentin
  2012-10-28 16:37 ` Michael Walle
  2012-10-30 22:16 ` Linus Walleij
@ 2012-10-30 22:26 ` Thomas Petazzoni
  2012-10-30 23:41 ` Linus Walleij
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2012-10-30 22:26 UTC (permalink / raw)
  To: linux-arm-kernel


On Sun, 28 Oct 2012 12:23:24 +0000, Jamie Lentin wrote:
> The plat-orion GPIO driver would disable any pin blinking whenever
> using a pin for output. Do the same here, as a blinking LED will
> continue to blink regardless of what the GPIO pin level is.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
  2012-10-30 22:16 ` Linus Walleij
@ 2012-10-30 22:27   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2012-10-30 22:27 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Linus Walleij,

On Tue, 30 Oct 2012 23:16:26 +0100, Linus Walleij wrote:

> Can I have some ACK on this thing from Andrew or Thomas say...

I just gave a formal ACK to the patch.

> Also is this a thing for the stable kernel -rc series or next
> merge window? I couldn't quite figure out if it was a regression.

I don't think it is really necessary to have it in the 3.7-rc series.
The driver has been introduced in 3.7, but technically speaking,
nothing is using it yet. Users will only be introduced in 3.8.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output
  2012-10-28 12:23 [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output Jamie Lentin
                   ` (2 preceding siblings ...)
  2012-10-30 22:26 ` Thomas Petazzoni
@ 2012-10-30 23:41 ` Linus Walleij
  3 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2012-10-30 23:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Oct 28, 2012 at 1:23 PM, Jamie Lentin <jm@lentin.co.uk> wrote:

> The plat-orion GPIO driver would disable any pin blinking whenever
> using a pin for output. Do the same here, as a blinking LED will
> continue to blink regardless of what the GPIO pin level is.
>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>

OK applied to my fixes branch with Thomas' ACK.

Yours,
Linus Walleij

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

end of thread, other threads:[~2012-10-30 23:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-28 12:23 [PATCH] mvebu-gpio: Disable blinking when enabling a GPIO for output Jamie Lentin
2012-10-28 16:37 ` Michael Walle
2012-10-30 22:16 ` Linus Walleij
2012-10-30 22:27   ` Thomas Petazzoni
2012-10-30 22:26 ` Thomas Petazzoni
2012-10-30 23:41 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.