projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sf: Remove non-meaningful comments
[oweals/u-boot.git]
/
drivers
/
mtd
/
spi
/
sandbox.c
diff --git
a/drivers/mtd/spi/sandbox.c
b/drivers/mtd/spi/sandbox.c
index d576d31243a7a90a7213466d7b3ce600a2d1d84f..4944059fa3f16c1d8710089f18e92246854bea3b 100644
(file)
--- a/
drivers/mtd/spi/sandbox.c
+++ b/
drivers/mtd/spi/sandbox.c
@@
-88,7
+88,7
@@
struct sandbox_spi_flash {
/* The current flash status (see STAT_XXX defines above) */
u16 status;
/* Data describing the flash we're emulating */
/* The current flash status (see STAT_XXX defines above) */
u16 status;
/* Data describing the flash we're emulating */
- const struct spi_flash_
params
*data;
+ const struct spi_flash_
info
*data;
/* The file on disk to serv up data from */
int fd;
};
/* The file on disk to serv up data from */
int fd;
};
@@
-112,7
+112,7
@@
static int sandbox_sf_probe(struct udevice *dev)
struct sandbox_spi_flash *sbsf = dev_get_priv(dev);
const char *file;
size_t len, idname_len;
struct sandbox_spi_flash *sbsf = dev_get_priv(dev);
const char *file;
size_t len, idname_len;
- const struct spi_flash_
params
*data;
+ const struct spi_flash_
info
*data;
struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
struct sandbox_state *state = state_get_current();
struct udevice *bus = dev->parent;
struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
struct sandbox_state *state = state_get_current();
struct udevice *bus = dev->parent;
@@
-129,7
+129,7
@@
static int sandbox_sf_probe(struct udevice *dev)
}
}
if (cs == -1) {
}
}
if (cs == -1) {
- printf("Error: Unknown chip select for device '%s'",
+ printf("Error: Unknown chip select for device '%s'
\n
",
dev->name);
return -EINVAL;
}
dev->name);
return -EINVAL;
}
@@
-142,13
+142,15
@@
static int sandbox_sf_probe(struct udevice *dev)
if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS)
spec = state->spi[bus->seq][cs].spec;
if (!spec) {
if (bus->seq < CONFIG_SANDBOX_SPI_MAX_BUS)
spec = state->spi[bus->seq][cs].spec;
if (!spec) {
+ debug("%s: No spec found for bus %d, cs %d\n",
+ __func__, bus->seq, cs);
ret = -ENOENT;
goto error;
}
file = strchr(spec, ':');
if (!file) {
ret = -ENOENT;
goto error;
}
file = strchr(spec, ':');
if (!file) {
- printf("
sandbox_sf: unable to parse file\n"
);
+ printf("
%s: unable to parse file\n", __func__
);
ret = -EINVAL;
goto error;
}
ret = -EINVAL;
goto error;
}
@@
-166,7
+168,7
@@
static int sandbox_sf_probe(struct udevice *dev)
}
debug("%s: device='%s'\n", __func__, spec);
}
debug("%s: device='%s'\n", __func__, spec);
- for (data = spi_flash_
params_table
; data->name; data++) {
+ for (data = spi_flash_
ids
; data->name; data++) {
len = strlen(data->name);
if (idname_len != len)
continue;
len = strlen(data->name);
if (idname_len != len)
continue;
@@
-174,7
+176,7
@@
static int sandbox_sf_probe(struct udevice *dev)
break;
}
if (!data->name) {
break;
}
if (!data->name) {
- printf("
sandbox_sf: unknown flash '%*s'\n"
, (int)idname_len,
+ printf("
%s: unknown flash '%*s'\n", __func__
, (int)idname_len,
spec);
ret = -EINVAL;
goto error;
spec);
ret = -EINVAL;
goto error;
@@
-185,8
+187,7
@@
static int sandbox_sf_probe(struct udevice *dev)
sbsf->fd = os_open(pdata->filename, 02);
if (sbsf->fd == -1) {
sbsf->fd = os_open(pdata->filename, 02);
if (sbsf->fd == -1) {
- free(sbsf);
- printf("sandbox_sf: unable to open file '%s'\n",
+ printf("%s: unable to open file '%s'\n", __func__,
pdata->filename);
ret = -EIO;
goto error;
pdata->filename);
ret = -EIO;
goto error;
@@
-288,13
+289,10
@@
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 *
/* we only support erase here */
if (sbsf->cmd == CMD_ERASE_CHIP) {
sbsf->erase_size = sbsf->data->sector_size *
- sbsf->data->n
r
_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_4K && (flags & SECT_4K)) {
sbsf->erase_size = 4 << 10;
- } else if (sbsf->cmd == CMD_ERASE_32K && (flags & SECT_32K)) {
- sbsf->erase_size = 32 << 10;
- } else if (sbsf->cmd == CMD_ERASE_64K &&
- !(flags & (SECT_4K | SECT_32K))) {
+ } else if (sbsf->cmd == CMD_ERASE_64K && !(flags & SECT_4K)) {
sbsf->erase_size = 64 << 10;
} else {
debug(" cmd unknown: %#x\n", sbsf->cmd);
sbsf->erase_size = 64 << 10;
} else {
debug(" cmd unknown: %#x\n", sbsf->cmd);
@@
-361,7
+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 */
debug(" id: off:%u tx:", sbsf->off);
if (sbsf->off < IDCODE_LEN) {
/* Extract correct byte from ID 0x00aabbcc */
- id = sbsf->data->jedec >>
+ id = ((JEDEC_MFR(sbsf->data) << 16) |
+ JEDEC_ID(sbsf->data)) >>
(8 * (IDCODE_LEN - 1 - sbsf->off));
} else {
id = 0;
(8 * (IDCODE_LEN - 1 - sbsf->off));
} else {
id = 0;
@@
-553,6
+552,9
@@
static int sandbox_cmdline_cb_spi_sf(struct sandbox_state *state,
* yet. Perhaps we can figure something out.
*/
state->spi[bus][cs].spec = spec;
* yet. Perhaps we can figure something out.
*/
state->spi[bus][cs].spec = spec;
+ debug("%s: Setting up spec '%s' for bus %ld, cs %ld\n", __func__,
+ spec, bus, cs);
+
return 0;
}
SANDBOX_CMDLINE_OPT(spi_sf, 1, "connect a SPI flash: <bus>:<cs>:<id>:<file>");
return 0;
}
SANDBOX_CMDLINE_OPT(spi_sf, 1, "connect a SPI flash: <bus>:<cs>:<id>:<file>");
@@
-671,6
+673,8
@@
int dm_scan_other(bool pre_reloc_only)
__func__, busnum, cs);
return ret;
}
__func__, busnum, cs);
return ret;
}
+ debug("%s: Setting up spec '%s' for bus %d, cs %d\n",
+ __func__, spec, busnum, cs);
}
}
}
}
}
}