@@ -2194,23 +2194,8 @@ int omap_hwmod_parse_module_range(struct omap_hwmod *oh,
2194
2194
struct resource * res )
2195
2195
{
2196
2196
struct property * prop ;
2197
- const __be32 * ranges ;
2198
2197
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 ;
2214
2199
2215
2200
of_property_for_each_string (np , "compatible" , prop , name )
2216
2201
if (!strncmp ("ti,sysc-" , name , 8 ))
@@ -2219,37 +2204,19 @@ int omap_hwmod_parse_module_range(struct omap_hwmod *oh,
2219
2204
if (!name )
2220
2205
return - ENOENT ;
2221
2206
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 ;
2225
2210
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 );
2242
2213
2243
2214
if (oh && oh -> mpu_rt_idx ) {
2244
2215
omap_hwmod_fix_mpu_rt_idx (oh , np , res );
2245
2216
2246
2217
return 0 ;
2247
2218
}
2248
2219
2249
- res -> start = base ;
2250
- res -> end = base + size - 1 ;
2251
- res -> flags = IORESOURCE_MEM ;
2252
-
2253
2220
return 0 ;
2254
2221
}
2255
2222
0 commit comments