Skip to content

Commit

Permalink
gpio/mxc: add missing initialization of basic_mmio_gpio shadow variables
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
lw-karo authored and glikely committed Jul 7, 2011
1 parent 6eae1ac commit fb14921
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/gpio-mxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,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)
Expand Down

0 comments on commit fb14921

Please sign in to comment.