mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] plat-mxc: add missing initialisation of basic_mmio_gpio shadow variables
@ 2011-07-07 12:50 Lothar Waßmann
  2011-07-07 18:43 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: Lothar Waßmann @ 2011-07-07 12:50 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Sascha Hauer, Grant Likely, linux-kernel, Lothar Waßmann

The bgpio_init() function does not initialise the shadow register for
the GPIO direction register. Thus, when configuring the first GPIO with
gpio_set_direction() all other GPIOs of the same bank will be
configured as inputs. Since the bgpio layer cannot know whether the
register is readable, the initialisation should be done by the caller
of bgpio_init().

Also, the 'data' shadow variable that is used inside basic_mmio_gpio
to cache the current value of the GPIO_DR register is initialised from
the GPIO_PSR register within bgpio_init(). Thus when setting the
output value of a certain GPIO, the other GPIO outputs of the same
bank will be set or cleared depending on the pin state of the GPIO
inputs during bgpio_init().


Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/gpio/gpio-mxc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index b351952..f7944ca 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -337,6 +337,8 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
 		goto out_iounmap;
 
 	port->bgc.gc.base = pdev->id * 32;
+	port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
+	port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);
 
 	err = gpiochip_add(&port->bgc.gc);
 	if (err)
-- 
1.5.6.5


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

end of thread, other threads:[~2011-07-07 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07 12:50 [PATCH] plat-mxc: add missing initialisation of basic_mmio_gpio shadow variables Lothar Waßmann
2011-07-07 18:43 ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®