@@ -384,8 +384,7 @@ static void nvec_init_i2c_slave(struct nvec_t *nvec)
384384 * @param config structure to store fdt config into
385385 * @return 0 if ok, -ve on error
386386 */
387- static int nvec_decode_fdt (const void * blob , int node ,
388- struct nvec_t * nvec )
387+ static int nvec_decode_fdt (const void * dev )
389388{
390389// int ret;
391390
@@ -396,22 +395,19 @@ static int nvec_decode_fdt(const void *blob, int node,
396395// return -ENOENT;
397396// }
398397
399- nvec -> base = (void __iomem * )fdtdec_get_addr (blob , node , "reg" );
400- if (nvec -> base == (void __iomem * )FDT_ADDR_T_NONE ) {
401- error ("No NVEC controller address" );
402- return - ENOENT ;
403- }
404- nvec -> i2c_addr = fdtdec_get_int (blob , node , "slave-addr" , -1 );
405- nvec -> i2c_clk = fdtdec_get_int (blob , node , "clock-frequency" , -1 );
398+ dev -> base = dev_read_addr_ptr (dev );
399+ if (!dev -> base )
400+ return - ENOMEM ;
401+
402+ dev -> i2c_addr = dev_read_u32_default (dev , "slave-addr" , -1 );
403+ dev -> i2c_clk = dev_read_u32_default (dev , "clock-frequency" , -1 );
406404
407405 return 0 ;
408406}
409407
410408static int nvec_probe (struct udevice * dev )
411409{
412410 struct nvec_t * nvec = dev_get_priv (dev );
413- const void * blob = gd -> fdt_blob ;
414- int node = dev -> node_ .of_offset ;
415411 int res ;
416412
417413 TRACE ();
@@ -425,7 +421,7 @@ static int nvec_probe(struct udevice *dev)
425421
426422 debug ("NVEC initialization...\n" );
427423
428- if (nvec_decode_fdt (blob , node , nvec_data ) ) {
424+ if (nvec_decode_fdt (nvec_data ) {
429425 error ("Failed to decode fdt" );
430426 return - EBUSY ;
431427 }
0 commit comments