Re: [PATCH v2 3/7] pinctrl: airoha: make the chip SCU optional
From: Lorenzo Bianconi
Date: Fri Nov 13 2026 - 10:52:41 EST
> A SoC that muxes every pin through the IOMUX block and describes no
> pin configuration has no use for the chip SCU. Skip the lookup when
> the match data names no chip SCU compatible, instead of handing a
> NULL compatible to syscon_regmap_lookup_by_compatible().
>
> No functional change for the existing SoCs, which all name one.
>
> Signed-off-by: John Crispin <john@xxxxxxxxxxx>
Reviewed-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
> ---
> Changes in v2:
> - Look up the airoha,chip-scu phandle before the check for a chip
> SCU compatible (Lorenzo).
>
> drivers/pinctrl/airoha/pinctrl-airoha.c | 25 +++++++++++++++++++------
> 1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pinctrl/airoha/pinctrl-airoha.c b/drivers/pinctrl/airoha/pinctrl-airoha.c
> index f9ae4020b764..5ae0c49e491a 100644
> --- a/drivers/pinctrl/airoha/pinctrl-airoha.c
> +++ b/drivers/pinctrl/airoha/pinctrl-airoha.c
> @@ -833,6 +833,22 @@ static const struct pinctrl_ops airoha_pctlops = {
> .dt_free_map = pinconf_generic_dt_free_map,
> };
>
> +static struct regmap *
> +airoha_pinctrl_chip_scu(struct device *dev,
> + const struct airoha_pinctrl_match_data *data)
> +{
> + struct regmap *map;
> +
> + map = syscon_regmap_lookup_by_phandle(dev->of_node, "airoha,chip-scu");
> + if (!IS_ERR_OR_NULL(map))
> + return map;
> +
> + if (!data->chip_scu_compatible)
> + return NULL;
> +
> + return syscon_regmap_lookup_by_compatible(data->chip_scu_compatible);
> +}
> +
> int airoha_pinctrl_probe(struct platform_device *pdev)
> {
> const struct airoha_pinctrl_match_data *data;
> @@ -853,12 +869,9 @@ int airoha_pinctrl_probe(struct platform_device *pdev)
> if (IS_ERR(pinctrl->regmap))
> return PTR_ERR(pinctrl->regmap);
>
> - map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "airoha,chip-scu");
> - if (IS_ERR_OR_NULL(map)) {
> - map = syscon_regmap_lookup_by_compatible(data->chip_scu_compatible);
> - if (IS_ERR(map))
> - return PTR_ERR(map);
> - }
> + map = airoha_pinctrl_chip_scu(dev, data);
> + if (IS_ERR(map))
> + return PTR_ERR(map);
>
> pinctrl->chip_scu = map;
>
> --
> 2.34.1
>
Attachment:
signature.asc
Description: PGP signature