summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sandbox.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-06-11 13:07:16 -0600
committerSimon Glass <sjg@chromium.org>2018-07-09 09:11:00 -0600
commit008dcddf9937bd2576f98b48eb5bf0f60ad36014 (patch)
tree751ddfe6e97f7e2e2df1d6f542e77d0d34fa5503 /drivers/mtd/spi/sandbox.c
parentd677b00cb62a4cf4d4a24468f218581b4f57c2fe (diff)
dm: spi: Update sandbox SPI emulation driver to use ofnode
Update the parameters sandbox_sf_bind_emul to support livetree. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd/spi/sandbox.c')
-rw-r--r--drivers/mtd/spi/sandbox.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index f23c0e13e0..1b6c028251 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -556,7 +556,7 @@ static int sandbox_cmdline_cb_spi_sf(struct sandbox_state *state,
SANDBOX_CMDLINE_OPT(spi_sf, 1, "connect a SPI flash: <bus>:<cs>:<id>:<file>");
int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs,
- struct udevice *bus, int of_offset, const char *spec)
+ struct udevice *bus, ofnode node, const char *spec)
{
struct udevice *emul;
char name[20], *str;
@@ -575,7 +575,7 @@ int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs,
str = strdup(name);
if (!str)
return -ENOMEM;
- ret = device_bind(bus, drv, str, NULL, of_offset, &emul);
+ ret = device_bind_ofnode(bus, drv, str, NULL, node, &emul);
if (ret) {
free(str);
printf("Cannot create emul device for spec '%s' (err=%d)\n",
@@ -620,7 +620,8 @@ static int sandbox_sf_bind_bus_cs(struct sandbox_state *state, int busnum,
if (ret)
return ret;
- return sandbox_sf_bind_emul(state, busnum, cs, bus, -1, spec);
+ return sandbox_sf_bind_emul(state, busnum, cs, bus, ofnode_null(),
+ spec);
}
int sandbox_spi_get_emul(struct sandbox_state *state,
@@ -638,7 +639,7 @@ int sandbox_spi_get_emul(struct sandbox_state *state,
debug("%s: busnum=%u, cs=%u: binding SPI flash emulation: ",
__func__, busnum, cs);
ret = sandbox_sf_bind_emul(state, busnum, cs, bus,
- dev_of_offset(slave), slave->name);
+ dev_ofnode(slave), slave->name);
if (ret) {
debug("failed (err=%d)\n", ret);
return ret;