Skip to content
Snippets Groups Projects
Commit 914627fe authored by Stephen Warren's avatar Stephen Warren Committed by Tom Rini
Browse files

ARM: rpi: consolidate board rev error checking


Create a fake model table entry with default values, so we can error
check the board rev value once when querying it from the firmware, rather
than error-checking for invalid board rev values every time the model
table is used.

Signed-off-by: default avatarStephen Warren <swarren@wwwdotorg.org>
parent 47705eff
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,11 @@ static const struct { ...@@ -84,6 +84,11 @@ static const struct {
const char *fdtfile; const char *fdtfile;
bool has_onboard_eth; bool has_onboard_eth;
} models[] = { } models[] = {
[0] = {
"Unknown model",
"bcm2835-rpi-other.dtb",
false,
},
[BCM2835_BOARD_REV_B_I2C0_2] = { [BCM2835_BOARD_REV_B_I2C0_2] = {
"Model B (no P5)", "Model B (no P5)",
"bcm2835-rpi-b-i2c0.dtb", "bcm2835-rpi-b-i2c0.dtb",
...@@ -185,9 +190,6 @@ static void set_fdtfile(void) ...@@ -185,9 +190,6 @@ static void set_fdtfile(void)
return; return;
fdtfile = models[rpi_board_rev].fdtfile; fdtfile = models[rpi_board_rev].fdtfile;
if (!fdtfile)
fdtfile = "bcm2835-rpi-other.dtb";
setenv("fdtfile", fdtfile); setenv("fdtfile", fdtfile);
} }
...@@ -270,12 +272,12 @@ static void get_board_rev(void) ...@@ -270,12 +272,12 @@ static void get_board_rev(void)
rpi_board_rev); rpi_board_rev);
rpi_board_rev = 0; rpi_board_rev = 0;
} }
if (!models[rpi_board_rev].name) {
name = models[rpi_board_rev].name;
if (!name) {
printf("RPI: Board rev %u unknown\n", rpi_board_rev); printf("RPI: Board rev %u unknown\n", rpi_board_rev);
name = "Unknown model"; rpi_board_rev = 0;
} }
name = models[rpi_board_rev].name;
printf("RPI model: %s\n", name); printf("RPI model: %s\n", name);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment