summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/raspberry-pi
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-12-19 19:34:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-01-04 09:38:12 +0100
commit8430b903308e2907845a67e182fbd4d3e44ed3fa (patch)
tree15cc242800eb432b0f0a59c18f81b558fb7c6836 /arch/arm/boards/raspberry-pi
parent801a8d40c1095588f315138988307ad5e33f1126 (diff)
downloadbarebox-8430b903308e2907845a67e182fbd4d3e44ed3fa.tar.gz
barebox-8430b903308e2907845a67e182fbd4d3e44ed3fa.tar.xz
rpi: sync revision detection with u-boot
This patch adds parts from u-boot code for doing RPi revision detection and take care about the "warranty bit". I got this bit on my RPi2. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/raspberry-pi')
-rw-r--r--arch/arm/boards/raspberry-pi/rpi.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
index f9406d4623..faf48a55cd 100644
--- a/arch/arm/boards/raspberry-pi/rpi.c
+++ b/arch/arm/boards/raspberry-pi/rpi.c
@@ -203,7 +203,22 @@ static void rpi_get_board_rev(void)
return;
}
+ /* Comments from u-boot:
+ * For details of old-vs-new scheme, see:
+ * https://github.com/pimoroni/RPi.version/blob/master/RPi/version.py
+ * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99293&p=690282
+ * (a few posts down)
+ *
+ * For the RPi 1, bit 24 is the "warranty bit", so we mask off just the
+ * lower byte to use as the board rev:
+ * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
+ * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
+ */
rpi_board_rev = msg->get_board_rev.body.resp.rev;
+ if (rpi_board_rev & 0x800000)
+ rpi_board_rev = (rpi_board_rev >> 4) & 0xff;
+ else
+ rpi_board_rev &= 0xff;
if (rpi_board_rev >= ARRAY_SIZE(models)) {
printf("RPI: Board rev %u outside known range\n",
rpi_board_rev);