* [U-Boot] [PATCH] gpio: pca953x: Fix register reading past 8th GPIO
@ 2016-05-23 7:54 Mario Six
2016-05-23 9:15 ` Peng Fan
0 siblings, 1 reply; 4+ messages in thread
From: Mario Six @ 2016-05-23 7:54 UTC (permalink / raw)
To: u-boot
A bug in the pca953x driver prevents correct reading of GPIO input
values beyond the 8th GPIO; all values are reported as zero. Setting of
GPIO output values is not affected.
This patch fixes the reading behavior.
Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
drivers/gpio/pca953x_gpio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index 987d10e..3cbfa09 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -145,11 +145,13 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset)
int ret;
u8 val = 0;
+ int off = offset % BANK_SZ;
+
ret = pca953x_read_single(dev, PCA953X_INPUT, &val, offset);
if (ret)
return ret;
- return (val >> offset) & 0x1;
+ return (val >> off) & 0x1;
}
static int pca953x_set_value(struct udevice *dev, unsigned offset,
--
2.7.0.GIT
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] gpio: pca953x: Fix register reading past 8th GPIO
2016-05-23 7:54 [U-Boot] [PATCH] gpio: pca953x: Fix register reading past 8th GPIO Mario Six
@ 2016-05-23 9:15 ` Peng Fan
2016-06-08 2:43 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Peng Fan @ 2016-05-23 9:15 UTC (permalink / raw)
To: u-boot
Hi Mario,
On Mon, May 23, 2016 at 09:54:56AM +0200, Mario Six wrote:
>A bug in the pca953x driver prevents correct reading of GPIO input
>values beyond the 8th GPIO; all values are reported as zero. Setting of
>GPIO output values is not affected.
>
>This patch fixes the reading behavior.
>
>Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Peng Fan <van.freenix@gmail.com>
Regards,
Peng.
>---
> drivers/gpio/pca953x_gpio.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
>index 987d10e..3cbfa09 100644
>--- a/drivers/gpio/pca953x_gpio.c
>+++ b/drivers/gpio/pca953x_gpio.c
>@@ -145,11 +145,13 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset)
> int ret;
> u8 val = 0;
>
>+ int off = offset % BANK_SZ;
>+
> ret = pca953x_read_single(dev, PCA953X_INPUT, &val, offset);
> if (ret)
> return ret;
>
>- return (val >> offset) & 0x1;
>+ return (val >> off) & 0x1;
> }
>
> static int pca953x_set_value(struct udevice *dev, unsigned offset,
>--
>2.7.0.GIT
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] gpio: pca953x: Fix register reading past 8th GPIO
2016-05-23 9:15 ` Peng Fan
@ 2016-06-08 2:43 ` Simon Glass
2016-06-09 19:20 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2016-06-08 2:43 UTC (permalink / raw)
To: u-boot
On 23 May 2016 at 02:15, Peng Fan <van.freenix@gmail.com> wrote:
> Hi Mario,
>
> On Mon, May 23, 2016 at 09:54:56AM +0200, Mario Six wrote:
>>A bug in the pca953x driver prevents correct reading of GPIO input
>>values beyond the 8th GPIO; all values are reported as zero. Setting of
>>GPIO output values is not affected.
>>
>>This patch fixes the reading behavior.
>>
>>Signed-off-by: Mario Six <mario.six@gdsys.cc>
>
> Reviewed-by: Peng Fan <van.freenix@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] gpio: pca953x: Fix register reading past 8th GPIO
2016-06-08 2:43 ` Simon Glass
@ 2016-06-09 19:20 ` Simon Glass
0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-06-09 19:20 UTC (permalink / raw)
To: u-boot
On 7 June 2016 at 20:43, Simon Glass <sjg@chromium.org> wrote:
> On 23 May 2016 at 02:15, Peng Fan <van.freenix@gmail.com> wrote:
>> Hi Mario,
>>
>> On Mon, May 23, 2016 at 09:54:56AM +0200, Mario Six wrote:
>>>A bug in the pca953x driver prevents correct reading of GPIO input
>>>values beyond the 8th GPIO; all values are reported as zero. Setting of
>>>GPIO output values is not affected.
>>>
>>>This patch fixes the reading behavior.
>>>
>>>Signed-off-by: Mario Six <mario.six@gdsys.cc>
>>
>> Reviewed-by: Peng Fan <van.freenix@gmail.com>
>
> Acked-by: Simon Glass <sjg@chromium.org>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-09 19:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23 7:54 [U-Boot] [PATCH] gpio: pca953x: Fix register reading past 8th GPIO Mario Six
2016-05-23 9:15 ` Peng Fan
2016-06-08 2:43 ` Simon Glass
2016-06-09 19:20 ` Simon Glass
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.