OSDN Git Service

gpio: rcar: Optimize GPIO pin state read on R-Car Gen3
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 8 Jan 2021 10:20:25 +0000 (11:20 +0100)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 15 Feb 2021 10:43:27 +0000 (11:43 +0100)
commitecba1eaa7906b0ce864e7eee27ea6cf5d6844e8a
treec574a0d51ddb6de3ba093bdad02c9b6d19701b72
parent2a84708c2f2f9d134abd21d1f2fe6ce5a87dffaa
gpio: rcar: Optimize GPIO pin state read on R-Car Gen3

Currently, the R-Car GPIO driver treats R-Car Gen2 and R-Car Gen3 GPIO
controllers the same.  However, there exist small differences, like the
behavior of the General Input Register (INDT):
  - On R-Car Gen1, R-Car Gen2, and RZ/G1, INDT only reflects the state
    of an input pin if the GPIO is configured for input,
  - On R-Car Gen3 and RZ/G2, INDT always reflects the state of the input
    pins.
Hence to accommodate all variants, the driver does not use the INDT
register to read the status of a GPIO line when configured for output,
at the expense of doing 2 or 3 register reads instead of 1.

Given register accesses are slow, change the .get() and .get_multiple()
callbacks to always use INDT to read pin state on SoCs where this is
supported.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-rcar.c