Commit 200e8d62 authored by Marek Vasut's avatar Marek Vasut

mxssb: Pull the MODE command table into header

The MODE command string-value mapping table will be re-used by
the image validator when it will be dumping the image contents,
so pull the table out from the function.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent bb696a0f
......@@ -980,31 +980,6 @@ static int sb_build_command_mode(struct sb_image_ctx *ictx, struct sb_cmd_list *
unsigned int i;
uint32_t mode = 0xffffffff;
/*
* Most of the mode names are same or at least similar
* on i.MX23 and i.MX28, but some of the mode names
* differ. The "name" field represents the mode name
* on i.MX28 as seen in Table 12-2 of the datasheet.
* The "altname" field represents the differently named
* fields on i.MX23 as seen in Table 35-3 of the
* datasheet.
*/
const struct {
const char *name;
const char *altname;
const uint8_t mode;
} modetable[] = {
{ "USB", NULL, 0x00 },
{ "I2C", NULL, 0x01 },
{ "SPI2_FLASH", "SPI1_FLASH", 0x02 },
{ "SPI3_FLASH", "SPI2_FLASH", 0x03 },
{ "NAND_BCH", NULL, 0x04 },
{ "JTAG", NULL, 0x06 },
{ "SPI3_EEPROM", "SPI2_EEPROM", 0x08 },
{ "SD_SSP0", NULL, 0x09 },
{ "SD_SSP1", NULL, 0x0A }
};
cctx = calloc(1, sizeof(*cctx));
if (!cctx)
return -ENOMEM;
......
......@@ -161,6 +161,31 @@ struct sb_command {
};
};
/*
* Most of the mode names are same or at least similar
* on i.MX23 and i.MX28, but some of the mode names
* differ. The "name" field represents the mode name
* on i.MX28 as seen in Table 12-2 of the datasheet.
* The "altname" field represents the differently named
* fields on i.MX23 as seen in Table 35-3 of the
* datasheet.
*/
static const struct {
const char *name;
const char *altname;
const uint8_t mode;
} modetable[] = {
{ "USB", NULL, 0x00 },
{ "I2C", NULL, 0x01 },
{ "SPI2_FLASH", "SPI1_FLASH", 0x02 },
{ "SPI3_FLASH", "SPI2_FLASH", 0x03 },
{ "NAND_BCH", NULL, 0x04 },
{ "JTAG", NULL, 0x06 },
{ "SPI3_EEPROM", "SPI2_EEPROM", 0x08 },
{ "SD_SSP0", NULL, 0x09 },
{ "SD_SSP1", NULL, 0x0A }
};
enum sb_tag {
ROM_NOP_CMD = 0x00,
ROM_TAG_CMD = 0x01,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment