rk_gpio: high latency switching between input / output

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Sat, 18 Sep 2021 08:34:05 UTC
I noticed that rk_gpio has a rather high overhead when switching between input 
and output modes on a pin.  This is typically required for software I2C (bit 
banging) and 1-wire protocols.  The overhead is so bad that 1-wire in particular 
is very unreliable, barely working.

It seems that a lot of that overhead in rk_gpio_pin_setflags() comes from 
FDT_PINCTRL_IS_GPIO() and FDT_PINCTRL_SET_FLAGS().  It's easy to shave off the 
latter as the call is not necessary when only GPIO_PIN_INPUT and GPIO_PIN_OUTPUT 
flags are changing.

Not sure what can be done about FDT_PINCTRL_IS_GPIO().
On the one hand it's nice to have that sanity check, on the other hand it adds 
the overhead.  Also, it might be racy as there is no common lock for gpio and 
pinctrl.

Anyway, perhaps the overhead could be reduced if rk_pinctrl cached pin 
configurations instead of retrieving and re-parsing them every time like 
rk_pinctrl_is_gpio_locked() does.

-- 
Andriy Gapon