Message ID | 20181017213012.233957-3-kunyi@google.com |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | Allow gpio-mmio to co-exist with pinctrl driver | expand |
On Wed, Oct 17, 2018 at 11:30 PM Kun Yi <kunyi@google.com> wrote: > Indicate that the pins are both controlled by the pinctrl driver and the > generic GPIO driver, thus GPIO driver should read the register value > before updating, instead of using the stored shadow register values. > > Signed-off-by: Kun Yi <kunyi@google.com> This is quite a rough measure, if we instead use regmap-mmio we can exercise fine control over what register are volatile and not instead of saying that all of them or some of them are. Yours, Linus Walleij
On Tue, Oct 30, 2018 at 5:08 AM Linus Walleij <linus.walleij@linaro.org> wrote: > > On Wed, Oct 17, 2018 at 11:30 PM Kun Yi <kunyi@google.com> wrote: > > > Indicate that the pins are both controlled by the pinctrl driver and the > > generic GPIO driver, thus GPIO driver should read the register value > > before updating, instead of using the stored shadow register values. > > > > Signed-off-by: Kun Yi <kunyi@google.com> > > This is quite a rough measure, if we instead use regmap-mmio > we can exercise fine control over what register are volatile and > not instead of saying that all of them or some of them are. Thanks for your review Linus! I don't have time to rewrite using regmap-mmio at the moment though. I have discussed with the driver author and we will first patch the pinctrl driver by making the pinctrl functions use the gpio-mmio accessors instead of directly reg read/writes. When I have time I will look into your suggestion to improve the driver. > > Yours, > Linus Walleij
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c index 7ad50d9268aa..ac7b69d53aff 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c @@ -1904,7 +1904,8 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) NULL, pctrl->gpio_bank[id].base + NPCM7XX_GP_N_IEM, - BGPIOF_READ_OUTPUT_REG_SET); + BGPIOF_READ_OUTPUT_REG_SET | + BGPIOF_VOLATILE_REG); if (ret) { dev_err(pctrl->dev, "bgpio_init() failed\n"); return ret;
Indicate that the pins are both controlled by the pinctrl driver and the generic GPIO driver, thus GPIO driver should read the register value before updating, instead of using the stored shadow register values. Signed-off-by: Kun Yi <kunyi@google.com> --- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)