
This series of patches aims at proposing a generic U-Boot mechanism to detect extension boards connected to the HW platform, and apply the appropriate Device Tree overlays depending on the detected extension boards.
Indeed, numerous popular platforms, such as the BeagleBone or the RaspberryPi, feature some kind of extension board mechanism. These extension boards are often discoverable through some kind of EEPROM (connected on I2C, 1-wire, etc.) and require Device Tree overlays to be applied at the U-Boot level to provide a complete HW description to the Linux kernel. However, currently this logic is usually implemented ad-hoc in downstream forks of U-Boot.
This series proposes to bring a HW-agnostic and generic solution to this problem to upstream U-Boot. The series shows that it is generic enough by implementing its usage for 2 different families of HW platforms and expansion boards:
- The BeagleBone Black and BeagleBone AI, that use extension boards where the EEPROM describing the extension boards is connected over I2C.
- The CHIP, that uses extension boards where the EEPROM describing the extension boards is connected over 1-wire.
The patch series implements a new command called "extension", with two sub-commands:
- "extension scan" to detect available extension boards
- "extension list" will simply list the detected extension boards
- "extension apply" will allow to apply the Device Tree overlays corresponding to one extension board or to all expansion boards
Note that the name "extension" has been chosen to not refer to any particular board-specific terminology for extension boards ("cape" for BeagleBone, "DIP" for CHIP, "hat" for RaspberryPi, etc.). However, we welcome suggestions of other names and are definitely willing to use a different naming.
The "extension apply" command requires two environment variables to be defined so that it knows how to apply DT overlays. This is described in more details in PATCH 1.
This generic code requires board-specific code for the detection and enumeration of extension boards. This is simply implemented in the form of a board-specific extension_board_scan() function, which fills in a list of detected extension boards.
In detail:
- PATCH 1 move fdt_valid function to fdt_support file - PATCH 2 implements the generic command and logic - PATCH 3 implements the python test for the "extension" command - PATCH 4 implements the board-specific code for the BeagleBone platforms - PATCH 5 enables the mechanism for the BeagleBone AI - PATCH 6 to 8 enable the mechanism for the CHIP - PATCH 9 and 10 enable the mechanism for the BeagleBone Black
Thanks in advance for your review and feedback
Kory Maincent (10): fdt_support: move fdt_valid from cmd_fdt.c to fdt_support.c cmd: add support for a new "extension" command pytest: add sandbox test for "extension" command ti/common: add support for extension_scan_board function am57xx: add support for cape detect functionality arm: dts: sun5i: enable one-wire on the CHIP arm: mach-sunxi: add CHIP board target sun5i: add support for DIP detection to CHIP board arm: am335x: add support for i2c2 bus am335x: add support for cape detect functionality
arch/Kconfig | 2 + arch/arm/dts/sun5i-r8-chip.dts | 6 + arch/arm/mach-omap2/am33xx/Kconfig | 1 + arch/arm/mach-omap2/am33xx/clock_am33xx.c | 1 + arch/arm/mach-omap2/omap5/Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 16 +++ arch/sandbox/dts/Makefile | 1 + arch/sandbox/dts/overlay0.dts | 9 ++ arch/sandbox/dts/overlay1.dts | 9 ++ board/sandbox/sandbox.c | 23 +++ board/sunxi/Makefile | 1 + board/sunxi/chip.c | 104 ++++++++++++++ board/ti/am335x/board.c | 3 + board/ti/am335x/board.h | 1 + board/ti/am335x/mux.c | 15 ++ board/ti/am57xx/board.c | 1 + board/ti/common/Kconfig | 3 + board/ti/common/Makefile | 1 + board/ti/common/cape_detect.c | 96 +++++++++++++ board/ti/common/cape_detect.h | 28 ++++ cmd/Kconfig | 12 ++ cmd/Makefile | 1 + cmd/extension_board.c | 167 ++++++++++++++++++++++ cmd/fdt.c | 49 ------- common/fdt_support.c | 46 ++++++ configs/CHIP_defconfig | 1 + doc/README.extension | 80 +++++++++++ include/configs/am335x_evm.h | 2 + include/configs/am57xx_evm.h | 2 + include/extension_board.h | 31 ++++ include/fdt_support.h | 2 + test/py/tests/test_extension.py | 52 +++++++ 32 files changed, 718 insertions(+), 49 deletions(-) create mode 100644 arch/sandbox/dts/overlay0.dts create mode 100644 arch/sandbox/dts/overlay1.dts create mode 100644 board/sunxi/chip.c create mode 100644 board/ti/common/cape_detect.c create mode 100644 board/ti/common/cape_detect.h create mode 100644 cmd/extension_board.c create mode 100644 doc/README.extension create mode 100644 include/extension_board.h create mode 100644 test/py/tests/test_extension.py