On 10/14/26 11:16 AM, Julien Stephan wrote:
> The scpsys bus protection so far only drove the infracfg register block.
> Some SoCs, such as the MT8365, also gate power domains through the SMI
> common space and acknowledge their way-enable protections via the
> read-only infracfg "nao" mirror.
> 

...

> @@ -431,6 +473,64 @@ static int mtk_scpsys_add_one_domain(struct udevice 
> *dev, ofnode node, int paren
>               domain->infracfg = regmap_get_range(regmap, 0);
>       }
>  
> +     /*
> +      * mediatek,infracfg-nao and mediatek,smi are deprecated but we need to
> +      * support them because mt8365.dtsi still uses them.
> +      */
> +     if (ofnode_read_bool(node, "mediatek,infracfg-nao")) {
> +             ret = ofnode_parse_phandle_with_args(node, 
> "mediatek,infracfg-nao",
> +                                                  NULL, 0, 0, &args);
> +             if (ret)
> +                     return ret;
> +
> +             regmap = syscon_node_to_regmap(args.node);
> +             if (IS_ERR(regmap))
> +                     return PTR_ERR(regmap);
> +
> +             domain->infracfg_nao = regmap_get_range(regmap, 0);
> +     }
> +
> +     if (ofnode_read_bool(node, "mediatek,smi")) {
> +             ret = ofnode_parse_phandle_with_args(node, "mediatek,smi",
> +                                                  NULL, 0, 0, &args);
> +             if (ret)
> +                     return ret;
> +
> +             /* The SMI common node has no "syscon" fallback compatible. */
> +             domain->smi = (void __iomem *)ofnode_get_addr(args.node);

This returns FDT_ADDR_T_NONE (-1) on error, not NULL.

> +             if (!domain->smi)
> +                     return -ENOENT;
> +     }
> +

Reply via email to