X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fmtd%2Fspi%2Fsandbox.c;h=895604d7367e13479787c7ecf96cbb8abeaaa88d;hb=84d31b3b8f2f2134e1534354cba82ca8cb671962;hp=fecf6d4bc34283739aac742e38dcd05ba6bb56b9;hpb=ff56bba2d6952176a826bddcd9baf84f61b419a3;p=u-boot diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index fecf6d4bc3..895604d736 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -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; } @@ -315,7 +318,7 @@ int sandbox_erase_part(struct sandbox_spi_flash *sbsf, int size) int ret; while (size > 0) { - todo = min(size, sizeof(sandbox_sf_0xff)); + todo = min(size, (int)sizeof(sandbox_sf_0xff)); ret = os_write(sbsf->fd, sandbox_sf_0xff, todo); if (ret != todo) 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; } @@ -609,7 +617,7 @@ static int sandbox_sf_bind_bus_cs(struct sandbox_state *state, int busnum, return -EEXIST; } - ret = spi_bind_device(bus, cs, "spi_flash_std", spec, &slave); + ret = device_bind_driver(bus, "spi_flash_std", spec, &slave); if (ret) return ret;