dm: sandbox: spi: Convert driver to support livetree
authorSimon Glass <sjg@chromium.org>
Fri, 19 May 2017 02:09:58 +0000 (20:09 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 1 Jun 2017 13:03:16 +0000 (07:03 -0600)
Update this driver to support a live device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/mtd/spi/sandbox.c

index a53f4eb..1ba6815 100644 (file)
@@ -515,11 +515,9 @@ static int sandbox_sf_xfer(struct udevice *dev, unsigned int bitlen,
 int sandbox_sf_ofdata_to_platdata(struct udevice *dev)
 {
        struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
-       const void *blob = gd->fdt_blob;
-       int node = dev_of_offset(dev);
 
-       pdata->filename = fdt_getprop(blob, node, "sandbox,filename", NULL);
-       pdata->device_name = fdt_getprop(blob, node, "compatible", NULL);
+       pdata->filename = dev_read_string(dev, "sandbox,filename");
+       pdata->device_name = dev_read_string(dev, "compatible");
        if (!pdata->filename || !pdata->device_name) {
                debug("%s: Missing properties, filename=%s, device_name=%s\n",
                      __func__, pdata->filename, pdata->device_name);