@@ -2194,23 +2194,8 @@ int omap_hwmod_parse_module_range(struct omap_hwmod *oh,
21942194 struct resource * res )
21952195{
21962196 struct property * prop ;
2197- const __be32 * ranges ;
21982197 const char * name ;
2199- u32 nr_addr , nr_size ;
2200- u64 base , size ;
2201- int len , error ;
2202-
2203- if (!res )
2204- return - EINVAL ;
2205-
2206- ranges = of_get_property (np , "ranges" , & len );
2207- if (!ranges )
2208- return - ENOENT ;
2209-
2210- len /= sizeof (* ranges );
2211-
2212- if (len < 3 )
2213- return - EINVAL ;
2198+ int err ;
22142199
22152200 of_property_for_each_string (np , "compatible" , prop , name )
22162201 if (!strncmp ("ti,sysc-" , name , 8 ))
@@ -2219,37 +2204,19 @@ int omap_hwmod_parse_module_range(struct omap_hwmod *oh,
22192204 if (!name )
22202205 return - ENOENT ;
22212206
2222- error = of_property_read_u32 (np , "#address-cells" , & nr_addr );
2223- if (error )
2224- return - ENOENT ;
2207+ err = of_range_to_resource (np , 0 , res );
2208+ if (err )
2209+ return err ;
22252210
2226- error = of_property_read_u32 (np , "#size-cells" , & nr_size );
2227- if (error )
2228- return - ENOENT ;
2229-
2230- if (nr_addr != 1 || nr_size != 1 ) {
2231- pr_err ("%s: invalid range for %s->%pOFn\n" , __func__ ,
2232- oh -> name , np );
2233- return - EINVAL ;
2234- }
2235-
2236- ranges ++ ;
2237- base = of_translate_address (np , ranges ++ );
2238- size = be32_to_cpup (ranges );
2239-
2240- pr_debug ("omap_hwmod: %s %pOFn at 0x%llx size 0x%llx\n" ,
2241- oh -> name , np , base , size );
2211+ pr_debug ("omap_hwmod: %s %pOFn at %pR\n" ,
2212+ oh -> name , np , & res );
22422213
22432214 if (oh && oh -> mpu_rt_idx ) {
22442215 omap_hwmod_fix_mpu_rt_idx (oh , np , res );
22452216
22462217 return 0 ;
22472218 }
22482219
2249- res -> start = base ;
2250- res -> end = base + size - 1 ;
2251- res -> flags = IORESOURCE_MEM ;
2252-
22532220 return 0 ;
22542221}
22552222
0 commit comments