The NextThing's C.H.I.P. can have expansion boards called DIPs. Those DIPs are connected through the external headers, and comes with an identification mechanism based on 1-Wire EEPROMs.
That auto-detection works great, because 1-Wire allows the enumeration, and the EEPROMs are guaranteed to have different addresses, which allows us to stack as many DIPs as possible, without any constraints. Since those DIPs can be close to anything, ranging from a simple PWM-based buzzer to a full featured device such as the PocketCHIP (which comes with a touchscreen, a keyboard, a battery, etc), some adjustments might be needed in U-Boot to be able to present something that just works to the user. In particular, we need to: - Apply an overlay if the device is something that should be dealt with early in the boot process (display, storage device) - Adjust the U-Boot environment if the DIP has a display to change the default video output - Adjust the kernel command line in previous case for Linux to have the same default In order to achieve that, we introduced some logic optionally hooked into the sunxi board, two new uclasses for 1-Wire and EEPROMs, and a bunch of new environment variables: - dip-auto-video to control the automatic video set up (default to yes) - dip_overlay_cmd that is a script to load the overlay $dip_overlay_name to $dip_addr_r, from whatever place it was stored in, and later apply it. - kernelarg_video to host the default kernel output in the kernel command line I think the biggest drawback at the moment is that we maintain a list of DIPs and the actions needed directly into the C code, which will make it quite hard to customise for end users and tedious to maintain in the long term. I couldn't really get my head around a better solution, so feel free to suggest alternative approaches. Let me know what you think, Maxime Maxime Ripard (9): fdtdec: Fix alias retrieval sunxi: chip: Add 1-wire node w1: Add 1-Wire uclass w1: Add 1-Wire gpio driver EEPROM: Add an EEPROM uclass eeprom: Add DS2431 support video: Allow board hook before video init sunxi: Add CHIP's DIP support config: chip: Enable DIP support arch/arm/dts/sun5i-r8-chip.dts | 15 ++- board/sunxi/Kconfig | 9 +- board/sunxi/Makefile | 1 +- board/sunxi/board.c | 6 +- board/sunxi/dip.c | 227 ++++++++++++++++++++++++++++++- configs/CHIP_defconfig | 5 +- drivers/Kconfig | 4 +- drivers/Makefile | 2 +- drivers/eeprom/Kconfig | 23 +++- drivers/eeprom/Makefile | 3 +- drivers/eeprom/ds2431.c | 38 +++++- drivers/eeprom/eeprom-uclass.c | 57 +++++++- drivers/video/cfb_console.c | 9 +- drivers/w1/Kconfig | 23 +++- drivers/w1/Makefile | 3 +- drivers/w1/w1-gpio.c | 160 +++++++++++++++++++++- drivers/w1/w1-uclass.c | 259 ++++++++++++++++++++++++++++++++++- include/dm/uclass-id.h | 2 +- include/eeprom.h | 21 +++- include/w1.h | 47 ++++++- lib/fdtdec.c | 3 +- 21 files changed, 916 insertions(+), 1 deletion(-) create mode 100644 board/sunxi/dip.c create mode 100644 drivers/eeprom/Kconfig create mode 100644 drivers/eeprom/Makefile create mode 100644 drivers/eeprom/ds2431.c create mode 100644 drivers/eeprom/eeprom-uclass.c create mode 100644 drivers/w1/Kconfig create mode 100644 drivers/w1/Makefile create mode 100644 drivers/w1/w1-gpio.c create mode 100644 drivers/w1/w1-uclass.c create mode 100644 include/eeprom.h create mode 100644 include/w1.h base-commit: d8bdfc80da39211d95f10d24e79f2e867305f71b -- git-series 0.8.11 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot