]> git.sur5r.net Git - u-boot/blobdiff - drivers/mtd/spi/sandbox.c
sf: Kconfig: Add SPI_FLASH_BAR entry
[u-boot] / drivers / mtd / spi / sandbox.c
index 3024b988fef904884f4d6e4920d98859714f115c..895604d7367e13479787c7ecf96cbb8abeaaa88d 100644 (file)
@@ -129,7 +129,7 @@ static int sandbox_sf_probe(struct udevice *dev)
                }
        }
        if (cs == -1) {
-               printf("Error: Unknown chip select for device '%s'",
+               printf("Error: Unknown chip select for device '%s'\n",
                       dev->name);
                return -EINVAL;
        }
@@ -141,8 +141,10 @@ static int sandbox_sf_probe(struct udevice *dev)
                assert(bus->seq != -1);
                if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS)
                        spec = state->spi[bus->seq][cs].spec;
-               if (!spec)
-                       return -ENOENT;
+               if (!spec) {
+                       ret = -ENOENT;
+                       goto error;
+               }
 
                file = strchr(spec, ':');
                if (!file) {
@@ -196,6 +198,7 @@ static int sandbox_sf_probe(struct udevice *dev)
        return 0;
 
  error:
+       debug("%s: Got error %d\n", __func__, ret);
        return ret;
 }
 
@@ -587,6 +590,11 @@ int sandbox_sf_bind_emul(struct sandbox_state *state, int busnum, int cs,
 
 void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs)
 {
+       struct udevice *dev;
+
+       dev = state->spi[busnum][cs].emul;
+       device_remove(dev);
+       device_unbind(dev);
        state->spi[busnum][cs].emul = NULL;
 }