mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: barebox@lists.infradead.org
Cc: dthompson@nexusisp.com, carlo.caione@gmail.com
Subject: [PATCH 6/7] rpi: sync revision detection with u-boot
Date: Sat, 19 Dec 2015 19:34:03 +0100	[thread overview]
Message-ID: <1450550044-14674-7-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1450550044-14674-1-git-send-email-alex.aring@gmail.com>

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>
---
 arch/arm/boards/raspberry-pi/rpi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
index f9406d4..faf48a5 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);
-- 
2.6.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-12-19 18:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-19 18:33 [PATCH 0/7] bcm283x: add support for raspberry pi 2 Alexander Aring
2015-12-19 18:33 ` [PATCH 1/7] memtest: fix missing arguments in help string Alexander Aring
2015-12-19 18:33 ` [PATCH 2/7] led: add missing includes Alexander Aring
2015-12-19 18:34 ` [PATCH 3/7] arm: bcm2835: fix indentation Alexander Aring
2015-12-19 18:34 ` [PATCH 4/7] bcm2835: introduce mach-bcm283x Alexander Aring
2015-12-19 18:34 ` [PATCH 5/7] bcm283x: mbox: align to cachesize Alexander Aring
2015-12-19 18:34 ` Alexander Aring [this message]
2015-12-19 18:34 ` [PATCH 7/7] arm: bcm283x: add rpi2 support Alexander Aring
2016-01-04  8:38 ` [PATCH 0/7] bcm283x: add support for raspberry pi 2 Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450550044-14674-7-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=carlo.caione@gmail.com \
    --cc=dthompson@nexusisp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox