gpio: aspeed: Add "Read Data" register to read the write latch
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 29 Jun 2018 04:11:17 +0000 (14:11 +1000)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 2 Jul 2018 14:10:10 +0000 (16:10 +0200)
commitc67dda88cc5da58c5a63083e0405fe93e2476bb7
tree08c4539e77317bbdebb96e2204cfc8196c8998f1
parent44ddf559d5792b2bffcd44febf9b7b55b03e06b4
gpio: aspeed: Add "Read Data" register to read the write latch

The Aspeed GPIO hardware has a quirk: the value register, for an
output GPIO, doesn't contain the last value written (the write
latch content) but the sampled input value.

This means that when reading back shortly after writing, you can
get an incorrect value as the input value is delayed by a few
synchronizers.

The HW supports a separate read-only register "Data Read Register"
which allows you to read the write latch instead.

This adds the definition for it, and uses it for the initial
population of the GPIO value cache. It will be used more in
subsequent patches.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-aspeed.c