[PATCH 3/7] pinctrl: airoha: make the chip SCU optional

Lorenzo Bianconi lorenzo at kernel.org
Wed Nov 11 03:27:53 PST 2026


> 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 at phrozen.org>
> ---
>  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..9116d3ded258 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;
> +
> +	if (!data->chip_scu_compatible)
> +		return NULL;

should you move this check after the first lookup?

Regards,
Lorenzo

> +
> +	map = syscon_regmap_lookup_by_phandle(dev->of_node, "airoha,chip-scu");
> +	if (!IS_ERR_OR_NULL(map))
> +		return map;
> +
> +	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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20261111/4bd6c622/attachment.sig>


More information about the Linux-mediatek mailing list