summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorStephen Warren <swarren@wwwdotorg.org>2014-12-23 20:01:44 -0700
committerTom Rini <trini@ti.com>2014-12-29 16:31:22 -0500
commit914627fe1c575112cd2aa14ab83cfa249e6810d6 (patch)
treed24a7608d3c7bcbfcc4352cae8d139e23ec91a0c /board
parent47705eff7a822105dfddaa03aadfe95f05849892 (diff)
downloadu-boot-imx-914627fe1c575112cd2aa14ab83cfa249e6810d6.zip
u-boot-imx-914627fe1c575112cd2aa14ab83cfa249e6810d6.tar.gz
u-boot-imx-914627fe1c575112cd2aa14ab83cfa249e6810d6.tar.bz2
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: Stephen Warren <swarren@wwwdotorg.org>
Diffstat (limited to 'board')
-rw-r--r--board/raspberrypi/rpi/rpi.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 6227e9b..c18271f 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -84,6 +84,11 @@ static const struct {
const char *fdtfile;
bool has_onboard_eth;
} models[] = {
+ [0] = {
+ "Unknown model",
+ "bcm2835-rpi-other.dtb",
+ false,
+ },
[BCM2835_BOARD_REV_B_I2C0_2] = {
"Model B (no P5)",
"bcm2835-rpi-b-i2c0.dtb",
@@ -185,9 +190,6 @@ static void set_fdtfile(void)
return;
fdtfile = models[rpi_board_rev].fdtfile;
- if (!fdtfile)
- fdtfile = "bcm2835-rpi-other.dtb";
-
setenv("fdtfile", fdtfile);
}
@@ -270,12 +272,12 @@ static void get_board_rev(void)
rpi_board_rev);
rpi_board_rev = 0;
}
-
- name = models[rpi_board_rev].name;
- if (!name) {
+ if (!models[rpi_board_rev].name) {
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);
}