Re: [PATCH 2/4] ARM: beaglebone: add helper init script for checking if BBBW
From: Sascha Hauer <hidden>
Date: 2021-06-15 18:07:08
On Mon, Jun 14, 2021 at 08:26:37AM +1000, Marc Reilly wrote:
quoted hunk ↗ jump to hunk
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 <redacted> --- .../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-typediff --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 @@ +BWdiff --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