From: Sascha Hauer <sha@pengutronix.de>
To: Marc Reilly <marc@cpdesign.com.au>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/4] ARM: beaglebone: add helper init script for checking if BBBW
Date: Tue, 15 Jun 2021 11:11:59 +0200 [thread overview]
Message-ID: <20210615091159.GE9782@pengutronix.de> (raw)
In-Reply-To: <20210613222639.13190-2-marc@cpdesign.com.au>
On Mon, Jun 14, 2021 at 08:26:37AM +1000, Marc Reilly wrote:
> This adds a check against the eeprom contents to see if the board is a
> Beaglebone black wireless. (two bytes at offset 0x12 of eeprom will be
> "BW").
> If it is, the global board.variant is updated to "boneblackwireless"
>
> Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
> ---
> .../defaultenv-beaglebone/data/bbb-eeprom-0x0C | 1 +
> .../defaultenv-beaglebone/init/check-bbb-type | 13 +++++++++++++
> 2 files changed, 14 insertions(+)
> create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C
> create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type
>
> diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C b/arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C
> new file mode 100644
> index 000000000..258b93951
> --- /dev/null
> +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C
> @@ -0,0 +1 @@
> +BW
> diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type
> new file mode 100644
> index 000000000..b7c8b3683
> --- /dev/null
> +++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +memcmp -b -s /dev/eeprom0 -d /env/data/bbb-eeprom-0x0C 0x0c 0x00 2
> +result=$?
> +echo $result
> +
> +if [ $result = 0 ]
> +then
> + echo "Beaglebone Wireless detected"
> + global.board.variant=boneblackwireless
> +else
> + echo "Beaglebone Black (non-wireless) detected"
> +fi
I think it's worth doing this in C code. A good template for this is in
https://git.pengutronix.de/cgit/barebox/tree/arch/arm/boards/skov-imx6/board.c#n435
Here the board compatible is prepended with a more specific variant, for
the BBB this would be "ti,am335x-bone-black-wireless". With this
bootspec could pick the entry with the right devicetree without further
interventions.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-06-15 18:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-13 22:26 [PATCH 1/4] common: boot: don't return too early in bootscript dryrun Marc Reilly
2021-06-13 22:26 ` [PATCH 2/4] ARM: beaglebone: add helper init script for checking if BBBW Marc Reilly
2021-06-15 9:11 ` Sascha Hauer [this message]
2021-06-13 22:26 ` [PATCH 3/4] ARM: am33xx: add define for 800Mhz MPU PLL point Marc Reilly
2021-06-15 9:14 ` Sascha Hauer
2021-06-13 22:26 ` [PATCH 4/4] ARM: beaglebone: init MPU speed to 800Mhz Marc Reilly
2021-06-14 8:51 ` [PATCH 1/4] common: boot: don't return too early in bootscript dryrun Ahmad Fatoum
2021-06-15 5:31 ` Marc Reilly
2021-06-15 8:59 ` 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=20210615091159.GE9782@pengutronix.de \
--to=sha@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=marc@cpdesign.com.au \
/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