Merge branch 'master' of git://git.denx.de/u-boot-socfpga
[oweals/u-boot.git] / drivers / mtd / spi / sandbox.c
index d68ee4a293b71196b7842ed543d8b35efbb54e98..36a50fe3a15d9ebd393765cdaa5c7462c68681c7 100644 (file)
@@ -289,7 +289,7 @@ static int sandbox_sf_process_cmd(struct sandbox_spi_flash *sbsf, const u8 *rx,
                /* we only support erase here */
                if (sbsf->cmd == CMD_ERASE_CHIP) {
                        sbsf->erase_size = sbsf->data->sector_size *
-                               sbsf->data->nr_sectors;
+                               sbsf->data->n_sectors;
                } else if (sbsf->cmd == CMD_ERASE_4K && (flags & SECT_4K)) {
                        sbsf->erase_size = 4 << 10;
                } else if (sbsf->cmd == CMD_ERASE_64K && !(flags & SECT_4K)) {
@@ -359,9 +359,8 @@ static int sandbox_sf_xfer(struct udevice *dev, unsigned int bitlen,
                        debug(" id: off:%u tx:", sbsf->off);
                        if (sbsf->off < IDCODE_LEN) {
                                /* Extract correct byte from ID 0x00aabbcc */
-                               id = ((((sbsf->data)->id[0]) << 16) |
-                                       (((sbsf->data)->id[1]) << 8 |
-                                       ((sbsf->data)->id[2]))) >>
+                               id = ((JEDEC_MFR(sbsf->data) << 16) |
+                                       JEDEC_ID(sbsf->data)) >>
                                        (8 * (IDCODE_LEN - 1 - sbsf->off));
                        } else {
                                id = 0;
@@ -517,7 +516,7 @@ 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;
+       int node = dev_of_offset(dev);
 
        pdata->filename = fdt_getprop(blob, node, "sandbox,filename", NULL);
        pdata->device_name = fdt_getprop(blob, node, "compatible", NULL);
@@ -642,7 +641,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,
-                                          slave->of_offset, slave->name);
+                                          dev_of_offset(slave), slave->name);
                if (ret) {
                        debug("failed (err=%d)\n", ret);
                        return ret;