Skip to contentSkip to conversation

ARM: rpi: support model A+

PATCH New Stephen Warren 2 participants 4 messages Dec 24, 2014 – Dec 30, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: rpi: support model A+

Add a board rev entry for the new model A+, and augment the board rev error handling code to be a bit more verbose.

---
This series depends on "ARM: rpi: only set usbethaddr on relevant systems" for context.

 arch/arm/include/asm/arch-bcm2835/mbox.h |  1 +
 board/raspberrypi/rpi/rpi.c              | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-bcm2835/mbox.h +1 -0
index 0289ba6a917e..88d2ec11a7c2 100644
@@ -140,6 +140,7 @@ struct bcm2835_mbox_tag_hdr {
 #define BCM2835_BOARD_REV_B_REV2_f	0xf
 #define BCM2835_BOARD_REV_B_PLUS	0x10
 #define BCM2835_BOARD_REV_CM		0x11
+#define BCM2835_BOARD_REV_A_PLUS	0x12
 
 struct bcm2835_mbox_tag_get_board_rev {
 	struct bcm2835_mbox_tag_hdr tag_hdr;
board/raspberrypi/rpi/rpi.c +12 -2
index ca8e86dead6c..6227e9bc12bd 100644
@@ -149,6 +149,11 @@ static const struct {
 		"bcm2835-rpi-cm.dtb",
 		false,
 	},
+	[BCM2835_BOARD_REV_A_PLUS] = {
+		"Model A+",
+		"bcm2835-rpi-a-plus.dtb",
+		false,
+	},
 };
 
 u32 rpi_board_rev = 0;
@@ -260,12 +265,17 @@ static void get_board_rev(void)
 	}
 
 	rpi_board_rev = msg->get_board_rev.body.resp.rev;
-	if (rpi_board_rev >= ARRAY_SIZE(models))
+	if (rpi_board_rev >= ARRAY_SIZE(models)) {
+		printf("RPI: Board rev %u outside known range\n",
+		       rpi_board_rev);
 		rpi_board_rev = 0;
+	}
 
 	name = models[rpi_board_rev].name;
-	if (!name)
+	if (!name) {
+		printf("RPI: Board rev %u unknown\n", rpi_board_rev);
 		name = "Unknown model";
+	}
 	printf("RPI model: %s\n", name);
 }
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 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.

---
 board/raspberrypi/rpi/rpi.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
board/raspberrypi/rpi/rpi.c +9 -7
index 6227e9bc12bd..c18271fce823 100644
@@ -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);
 }
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 ARM: rpi: consolidate board rev error checking

Quoted 6 lines · Stephen Warren

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141229/c5d7547b/attachment.pgp>
#3 lore raw

PATCH 1/2 ARM: rpi: support model A+

In reply to Stephen Warren
Quoted 4 lines · Stephen Warren

Add a board rev entry for the new model A+, and augment the board rev error handling code to be a bit more verbose.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141229/cc8d8a0c/attachment-0001.pgp>