[PATCH 1/2] pinctrl: mediatek: common: add quirk for broken set/clr modes

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Fri Jun 10 04:19:04 PDT 2022


Il 30/05/22 14:34, Fabien Parent ha scritto:
> On MT8365, the SET/CLR of the mode is broken and some pin modes won't
> be set correctly. Add a quirk for such SoCs, so that instead of using
> the SET/CLR register use the main R/W register
> to read/update/write the modes.
> 
> Signed-off-by: Fabien Parent <fparent at baylibre.com>
> ---
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 46 ++++++++++++-------
>   drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  3 ++
>   2 files changed, 33 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index f25b3e09386b..156627d9c552 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -330,23 +330,37 @@ static int mtk_pconf_set_pull_select(struct mtk_pinctrl *pctl,
>   		return -EINVAL;
>   	}
>   

That's not the right way of doing that, unless there are other SoCs that are
actually affected by this issue (and besides, any *new* pinctrl driver should
be using pinctrl-mtk-common-v2, which accounts for this quirk already).

Since MT8365 seems to be the only SoC that is affected by this issue, there's
a spec_pull_set() callback that you can use and you can indeed define your own
function in mt8365-pinctrl.c instead... but this, only if I got it right (and
I think I did, but please recheck!):

In this function, the call to spec_pull_set assigns 'arg' if 'enable == true',
else, MTK_PUPD_SET_R1R0_00...
...for "generic pull config", as stated in a comment in this function, 'arg' will
always be either 0 or 1, so you will get passed either:
     - 1, if pull-enable; or
     - MTK_PUPD_SET_R1R0_00 (100) if pull-disable.

Though, if I got the '1' part wrong, it's still doable because you care only about
one value in your case, so, if you get a MTK_PUPD_SET_R1R0_00, this means that you
have to do pull-disable.

The other args are passed as they are, so that's golden.

Regards,
Angelo



More information about the linux-arm-kernel mailing list