Date: Sat, 18 Sep 2021 11:34:05 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: arm@FreeBSD.org Cc: Emmanuel Vadot <manu@freebsd.org> Subject: rk_gpio: high latency switching between input / output Message-ID: <4472ded5-1815-e7c0-0238-efd6935062e0@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4472ded5-1815-e7c0-0238-efd6935062e0>