2011-03-24 23:17:32

by Peter Tyser

[permalink] [raw]
Subject: [PATCH] gpio: ml_ioh_gpio: Fix output value of ioh_gpio_direction_output()

The ioh_gpio_direction_output() function was missing a write to set the
desired output value. The function would properly set the GPIO
direction, but not the output value. The value would have to manually
be set with a follow up call to ioh_gpio_set().

Add the missing write so that ioh_gpio_direction_output() sets both the
GPIO direction and value.

Signed-off-by: Peter Tyser <[email protected]>
Cc: [email protected]
Cc: Grant Likely <[email protected]>
---
This is untested - just noticed it while working on an unrelated change. An
ack or tested-by from someone with real hardware would be appreciated.

drivers/gpio/ml_ioh_gpio.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/ml_ioh_gpio.c b/drivers/gpio/ml_ioh_gpio.c
index cead8e6..7a0423c 100644
--- a/drivers/gpio/ml_ioh_gpio.c
+++ b/drivers/gpio/ml_ioh_gpio.c
@@ -116,6 +116,7 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
reg_val |= (1 << nr);
else
reg_val &= ~(1 << nr);
+ iowrite32(reg_val, &chip->reg->regs[chip->ch].po);

mutex_unlock(&chip->lock);

--
1.7.0.4


2011-03-25 00:32:00

by Tomoya MORINAGA

[permalink] [raw]
Subject: RE: [PATCH] gpio: ml_ioh_gpio: Fix output value of ioh_gpio_direction_output()

Hi Peter,

On Friday, March 25, 2011 8:17 AM, Peter Tyser wrote:

> The ioh_gpio_direction_output() function was missing a write
> to set the desired output value. The function would properly
> set the GPIO direction, but not the output value. The value
> would have to manually be set with a follow up call to ioh_gpio_set().

> This is untested - just noticed it while working on an
> unrelated change. An ack or tested-by from someone with real
> hardware would be appreciated.

Thank you for your indication.
Your saying is right.
However since your patch looks incorrect,
after testing, I will post new patch by next week.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

2011-03-25 14:47:11

by Peter Tyser

[permalink] [raw]
Subject: RE: [PATCH] gpio: ml_ioh_gpio: Fix output value of ioh_gpio_direction_output()

Hi Tomoya,

On Fri, 2011-03-25 at 09:31 +0900, Tomoya MORINAGA wrote:
> Hi Peter,
>
> On Friday, March 25, 2011 8:17 AM, Peter Tyser wrote:
>
> > The ioh_gpio_direction_output() function was missing a write
> > to set the desired output value. The function would properly
> > set the GPIO direction, but not the output value. The value
> > would have to manually be set with a follow up call to ioh_gpio_set().
>
> > This is untested - just noticed it while working on an
> > unrelated change. An ack or tested-by from someone with real
> > hardware would be appreciated.
>
> Thank you for your indication.
> Your saying is right.
> However since your patch looks incorrect,
> after testing, I will post new patch by next week.

Out of curiosity, what looks incorrect about the patch? The code to set
the GPIO value is identical to the code in ioh_gpio_set(), which was the
old code path.

Best,
Peter

2011-03-25 15:04:20

by Peter Tyser

[permalink] [raw]
Subject: [PATCH] gpio: pch_gpio: Fix output value of pch_gpio_direction_output()

The pch_gpio_direction_output() function was missing a write to set the
desired output value. The function would properly set the GPIO
direction, but not the output value. The value would have to manually
be set with a follow up call to pch_gpio_set().

Add the missing write so that pch_gpio_direction_output() sets both the
GPIO direction and value.

Signed-off-by: Peter Tyser <[email protected]>
Cc: Tomoya MORINAGA <[email protected]>
Cc: Toshiharu Okada <[email protected]>
Cc: Grant Likely <[email protected]>
---
Just noticed this driver has the same bug. This file looks nearly identical
to ml_ioh_gpio.c. They could likely be combined with minimal effort.

drivers/gpio/pch_gpio.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/pch_gpio.c b/drivers/gpio/pch_gpio.c
index c59d953..fa52862 100644
--- a/drivers/gpio/pch_gpio.c
+++ b/drivers/gpio/pch_gpio.c
@@ -105,6 +105,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
reg_val |= (1 << nr);
else
reg_val &= ~(1 << nr);
+ iowrite32(reg_val, &chip->reg->po);

mutex_unlock(&chip->lock);

--
1.7.0.4

2011-03-28 00:57:01

by Tomoya MORINAGA

[permalink] [raw]
Subject: RE: [PATCH] gpio: ml_ioh_gpio: Fix output value of ioh_gpio_direction_output()

Hi Peter

On Friday, March 25, 2011 11:47 PM, Peter Tyser wrote:
> Out of curiosity, what looks incorrect about the patch? The
> code to set the GPIO value is identical to the code in
> ioh_gpio_set(), which was the old code path.

Sorry, I miss-understood.
Your patch looks good.
In fact, I could confirm the GPIO driver with your patch works well on evaluation board.

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.

2011-03-31 21:16:39

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] gpio: pch_gpio: Fix output value of pch_gpio_direction_output()

On Fri, Mar 25, 2011 at 10:04:00AM -0500, Peter Tyser wrote:
> The pch_gpio_direction_output() function was missing a write to set the
> desired output value. The function would properly set the GPIO
> direction, but not the output value. The value would have to manually
> be set with a follow up call to pch_gpio_set().
>
> Add the missing write so that pch_gpio_direction_output() sets both the
> GPIO direction and value.
>
> Signed-off-by: Peter Tyser <[email protected]>
> Cc: Tomoya MORINAGA <[email protected]>
> Cc: Toshiharu Okada <[email protected]>
> Cc: Grant Likely <[email protected]>
> ---
> Just noticed this driver has the same bug. This file looks nearly identical
> to ml_ioh_gpio.c. They could likely be combined with minimal effort.

Ah, yeah. Almost exactly the same.

Tomoya, why is this driver cloned?

g.

2011-03-31 21:17:58

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] gpio: pch_gpio: Fix output value of pch_gpio_direction_output()

On Fri, Mar 25, 2011 at 10:04:00AM -0500, Peter Tyser wrote:
> The pch_gpio_direction_output() function was missing a write to set the
> desired output value. The function would properly set the GPIO
> direction, but not the output value. The value would have to manually
> be set with a follow up call to pch_gpio_set().
>
> Add the missing write so that pch_gpio_direction_output() sets both the
> GPIO direction and value.
>
> Signed-off-by: Peter Tyser <[email protected]>
> Cc: Tomoya MORINAGA <[email protected]>
> Cc: Toshiharu Okada <[email protected]>
> Cc: Grant Likely <[email protected]>

Applied, thanks.

g.
> ---
> Just noticed this driver has the same bug. This file looks nearly identical
> to ml_ioh_gpio.c. They could likely be combined with minimal effort.
>
> drivers/gpio/pch_gpio.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/pch_gpio.c b/drivers/gpio/pch_gpio.c
> index c59d953..fa52862 100644
> --- a/drivers/gpio/pch_gpio.c
> +++ b/drivers/gpio/pch_gpio.c
> @@ -105,6 +105,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
> reg_val |= (1 << nr);
> else
> reg_val &= ~(1 << nr);
> + iowrite32(reg_val, &chip->reg->po);
>
> mutex_unlock(&chip->lock);
>
> --
> 1.7.0.4
>

2011-03-31 21:18:16

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] gpio: ml_ioh_gpio: Fix output value of ioh_gpio_direction_output()

On Thu, Mar 24, 2011 at 06:17:14PM -0500, Peter Tyser wrote:
> The ioh_gpio_direction_output() function was missing a write to set the
> desired output value. The function would properly set the GPIO
> direction, but not the output value. The value would have to manually
> be set with a follow up call to ioh_gpio_set().
>
> Add the missing write so that ioh_gpio_direction_output() sets both the
> GPIO direction and value.
>
> Signed-off-by: Peter Tyser <[email protected]>
> Cc: [email protected]
> Cc: Grant Likely <[email protected]>
> ---
> This is untested - just noticed it while working on an unrelated change. An
> ack or tested-by from someone with real hardware would be appreciated.

Applied, thanks.

g.

>
> drivers/gpio/ml_ioh_gpio.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/ml_ioh_gpio.c b/drivers/gpio/ml_ioh_gpio.c
> index cead8e6..7a0423c 100644
> --- a/drivers/gpio/ml_ioh_gpio.c
> +++ b/drivers/gpio/ml_ioh_gpio.c
> @@ -116,6 +116,7 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
> reg_val |= (1 << nr);
> else
> reg_val &= ~(1 << nr);
> + iowrite32(reg_val, &chip->reg->regs[chip->ch].po);
>
> mutex_unlock(&chip->lock);
>
> --
> 1.7.0.4
>