]> git.sur5r.net Git - u-boot/blobdiff - drivers/misc/i2c_eeprom_emul.c
Merge branch 'master' of git://git.denx.de/u-boot-sunxi
[u-boot] / drivers / misc / i2c_eeprom_emul.c
index 7343445d424a6c78ff3fe912595c68c95556fbba..29ed45923ffddbf3fdb4d2f8f51ca92446dcab74 100644 (file)
@@ -1,14 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Simulate an I2C eeprom
  *
  * Copyright (c) 2014 Google, Inc
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
-#include <fdtdec.h>
+#include <errno.h>
 #include <i2c.h>
 #include <malloc.h>
 #include <asm/test.h>
@@ -19,8 +18,6 @@
 #define debug_buffer(x, ...)
 #endif
 
-DECLARE_GLOBAL_DATA_PTR;
-
 struct sandbox_i2c_flash_plat_data {
        enum sandbox_i2c_eeprom_test_mode test_mode;
        const char *filename;
@@ -114,10 +111,8 @@ static int sandbox_i2c_eeprom_ofdata_to_platdata(struct udevice *dev)
 {
        struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev);
 
-       plat->size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-                                   "sandbox,size", 32);
-       plat->filename = fdt_getprop(gd->fdt_blob, dev->of_offset,
-                                    "sandbox,filename", NULL);
+       plat->size = dev_read_u32_default(dev, "sandbox,size", 32);
+       plat->filename = dev_read_string(dev, "sandbox,filename");
        if (!plat->filename) {
                debug("%s: No filename for device '%s'\n", __func__,
                      dev->name);