Re: [PATCH 1/2] gpio: gpio-mmio: Allow volatile shadow regs

From: Linus Walleij
Date: Tue Oct 30 2018 - 08:06:44 EST


On Wed, Oct 17, 2018 at 11:30 PM Kun Yi <kunyi@xxxxxxxxxx> wrote:

> Currently the generic GPIO driver stores the direction and data shadow register
> when the driver probes. However, in embedded SOCs the GPIO pins are often
> interleaved with pins muxed to other functions, and pinctrl driver might
> toggle the direction/data register values for these pins. With GPIO
> driver being not the only owner, it should read the shadow registers
> before updating them, otherwise some pin states would be overwritten.
>
> This patch adds a flag BGPIOF_VOLATILE_REG to allow a pinctrl driver that uses
> the generic GPIO interface to indicate the need of read-before-update.
>
> Signed-off-by: Kun Yi <kunyi@xxxxxxxxxx>

Hi Kun,

as you see the build robot has problems with the patch, please look
into it.

Architecturally I'm not so sure about this, we are introducing more
and more "shadow registers" and I feel what happens at the end
of the day is that we end up reimplementing regmap-mmio.

Please look into switching gpio-mmio.c to use regmap-mmio
and add more registers based on that.

It might be a bit complex but is a way better way forward for
everyone.

Yours,
Linus Walleij