From: "Ivan T. Ivanov" <iivanov@suse.de>
To: Matthias Brugger <mbrugger@suse.com>,
Peter Robinson <pbrobinson@gmail.com>
Cc: Dmitry Malkin <dmitry@bedrocksystems.com>,
Thomas Fitzsimmons <fitzsim@fitzsim.org>,
Peng Fan <peng.fan@nxp.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Anatolij Gustschin <agust@denx.de>,
wahrenst@gmx.net, florian.fainelli@broadcom.com,
u-boot@lists.denx.de, "Ivan T. Ivanov" <iivanov@suse.de>
Subject: [PATCH v4 3/6] rpi5: Use devicetree to retrieve board revision
Date: Wed, 10 Jan 2024 14:29:05 +0200 [thread overview]
Message-ID: <20240110122908.31612-4-iivanov@suse.de> (raw)
In-Reply-To: <20240110122908.31612-1-iivanov@suse.de>
Firmware on RPi5 return error on board revision query
through firmware interface, but on the other hand it fills
"linux,revision" in "system" node, so use it to detect board
revision.
system {
linux,revision = <0xc04170>;
linux,serial = <0x6cf44e80 0x3c533ede>;
};
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
---
board/raspberrypi/rpi/rpi.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index cd823ad746..2851ebc985 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -171,6 +171,11 @@ static const struct rpi_model rpi_models_new_scheme[] = {
DTB_DIR "bcm2711-rpi-cm4.dtb",
true,
},
+ [0x17] = {
+ "5 Model B",
+ DTB_DIR "bcm2712-rpi-5-b.dtb",
+ true,
+ },
};
static const struct rpi_model rpi_models_old_scheme[] = {
@@ -429,15 +434,27 @@ static void get_board_revision(void)
int ret;
const struct rpi_model *models;
uint32_t models_count;
+ ofnode node;
BCM2835_MBOX_INIT_HDR(msg);
BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV);
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
if (ret) {
- printf("bcm2835: Could not query board revision\n");
/* Ignore error; not critical */
- return;
+ node = ofnode_path("/system");
+ if (!ofnode_valid(node)) {
+ printf("bcm2835: Could not find /system node\n");
+ return;
+ }
+
+ ret = ofnode_read_u32(node, "linux,revision", &revision);
+ if (ret) {
+ printf("bcm2835: Could not find linux,revision\n");
+ return;
+ }
+ } else {
+ revision = msg->get_board_rev.body.resp.rev;
}
/*
@@ -451,7 +468,6 @@ static void get_board_revision(void)
* http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
* http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
*/
- revision = msg->get_board_rev.body.resp.rev;
if (revision & 0x800000) {
rev_scheme = 1;
rev_type = (revision >> 4) & 0xff;
--
2.35.3
next prev parent reply other threads:[~2024-01-10 12:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 12:29 [PATCH v4 0/6] rpi5: initial support Ivan T. Ivanov
2024-01-10 12:29 ` [PATCH v4 1/6] rpi5: add initial memory map for bcm2712 Ivan T. Ivanov
2024-01-10 17:57 ` Florian Fainelli
2024-01-10 12:29 ` [PATCH v4 2/6] rpi5: Use devicetree as alternative way to read IO base addresses Ivan T. Ivanov
2024-01-10 18:00 ` Florian Fainelli
2024-01-16 9:11 ` Ivan T. Ivanov
2024-01-10 12:29 ` Ivan T. Ivanov [this message]
2024-01-10 12:29 ` [PATCH v4 4/6] bcm2835: Dynamically calculate bytes per pixel parameter Ivan T. Ivanov
2024-01-10 15:12 ` Matthias Brugger
2024-01-10 12:29 ` [PATCH v4 5/6] mmc: bcmstb: Add support for bcm2712 SD controller Ivan T. Ivanov
2024-01-11 22:07 ` Stefan Wahren
2024-01-12 7:44 ` Ivan T. Ivanov
2024-01-16 9:14 ` Ivan T. Ivanov
2024-01-10 12:29 ` [PATCH v4 6/6] configs: rpi_arm64: enable SDHCI BCMSTB driver Ivan T. Ivanov
2024-01-22 13:46 ` [PATCH v4 0/6] rpi5: initial support Matthias Brugger
2024-09-19 9:36 ` Stefan Agner
2024-09-19 9:52 ` Ivan T. Ivanov
2024-09-19 14:01 ` Stefan Agner
2024-09-19 14:22 ` Ivan T. Ivanov
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=20240110122908.31612-4-iivanov@suse.de \
--to=iivanov@suse.de \
--cc=agust@denx.de \
--cc=dmitry@bedrocksystems.com \
--cc=fitzsim@fitzsim.org \
--cc=florian.fainelli@broadcom.com \
--cc=jh80.chung@samsung.com \
--cc=mbrugger@suse.com \
--cc=pbrobinson@gmail.com \
--cc=peng.fan@nxp.com \
--cc=u-boot@lists.denx.de \
--cc=wahrenst@gmx.net \
/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