[RESEND PATCH 2/3] pinctrl: renesas: Make sure the pin type is updated after setting the MUX

Lad, Prabhakar
2020-11-05T10:09:31Z

Hi Marek,

Thank you for the review.

On Wed, Nov 4, 2020 at 7:29 PM Marek Vasut <marek.vasut@gmail.com> wrote:
>
> On 11/4/20 6:27 PM, Lad Prabhakar wrote:
> > Update pin type after every successful call to sh_pfc_config_mux().
> >
> > This fixes pin functionality from being overwritten.
>
> Can you please provide more details about the problem you are fixing
> here ? What is the problem ? What triggers it ?
>
By default on startup all the pin types are configured to
PINMUX_TYPE_NONE (in sh_pfc_map_pins()), when pin is set as GPIO the
pin type is updated to PINMUX_TYPE_GPIO. But the type is not updated
when the pin is set as a function in
sh_pfc_pinctrl_pin_set()/sh_pfc_pinctrl_group_set() calls (although
these calls have a check if pin type is not PINMUX_TYPE_NONE). So with
the current implementation suppose initially the pin is configured as
USB function and later as SPI function this driver does not complain
and makes USB unusable.

With this patch on every successful call to
sh_pfc_pinctrl_pin_set()/sh_pfc_pinctrl_group_set() the pin type is
updated so that the functionality of the pin is not overwritten as
these functions already have the below check,

if (cfg->type != PINMUX_TYPE_NONE) {
ret = -EBUSY;

Cheers,
Prabhakar