@@ -984,6 +984,18 @@ static void scpsys_domain_cleanup(struct scpsys *scpsys)
984984 }
985985}
986986
987+ static struct device_node * scpsys_get_legacy_regmap (struct device_node * np , const char * pn )
988+ {
989+ struct device_node * local_node ;
990+
991+ for_each_child_of_node (np , local_node ) {
992+ if (of_property_present (local_node , pn ))
993+ return local_node ;
994+ }
995+
996+ return NULL ;
997+ }
998+
987999static int scpsys_get_bus_protection_legacy (struct device * dev , struct scpsys * scpsys )
9881000{
9891001 const u8 bp_blocks [3 ] = {
@@ -1005,7 +1017,7 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s
10051017 * this makes it then possible to allocate the array of bus_prot
10061018 * regmaps and convert all to the new style handling.
10071019 */
1008- node = of_find_node_with_property (np , "mediatek,infracfg" );
1020+ node = scpsys_get_legacy_regmap (np , "mediatek,infracfg" );
10091021 if (node ) {
10101022 regmap [0 ] = syscon_regmap_lookup_by_phandle (node , "mediatek,infracfg" );
10111023 of_node_put (node );
@@ -1018,7 +1030,7 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s
10181030 regmap [0 ] = NULL ;
10191031 }
10201032
1021- node = of_find_node_with_property (np , "mediatek,smi" );
1033+ node = scpsys_get_legacy_regmap (np , "mediatek,smi" );
10221034 if (node ) {
10231035 smi_np = of_parse_phandle (node , "mediatek,smi" , 0 );
10241036 of_node_put (node );
@@ -1036,7 +1048,7 @@ static int scpsys_get_bus_protection_legacy(struct device *dev, struct scpsys *s
10361048 regmap [1 ] = NULL ;
10371049 }
10381050
1039- node = of_find_node_with_property (np , "mediatek,infracfg-nao" );
1051+ node = scpsys_get_legacy_regmap (np , "mediatek,infracfg-nao" );
10401052 if (node ) {
10411053 regmap [2 ] = syscon_regmap_lookup_by_phandle (node , "mediatek,infracfg-nao" );
10421054 num_regmaps ++ ;
0 commit comments