gpio: aspeed: Use a cache of output data registers
authorBenjamin Herrenschmidt <benh@au1.ibm.com>
Thu, 17 May 2018 08:12:02 +0000 (18:12 +1000)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 23 May 2018 11:59:06 +0000 (13:59 +0200)
commited5cab43f99d1629af0e34ff565aa14efe0a8ac9
tree5b38657238a6b4209fa7eeefe60404f325807e15
parentaf7949284910a1f0b7814625051b8acf99af74d2
gpio: aspeed: Use a cache of output data registers

The current driver does a read/modify/write of the output
registers when changing a bit in __aspeed_gpio_set().

This is sub-optimal for a couple of reasons:

  - If any of the neighbouring GPIOs (sharing the shared
register) isn't (yet) configured as an output, it will
read the current input value, and then apply it to the
output latch, which may not be what the user expects. There
should be no bug in practice as aspeed_gpio_dir_out() will
establish a new value but it's not great either.

  - The GPIO block in the aspeed chip is clocked rather
slowly (typically 25Mhz). That extra MMIO read halves the maximum
speed at which we can toggle the GPIO.

This provides a significant performance improvement to the GPIO
based FSI master.

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