Supporting different temp sensors at same I2C location
Anton D. Kachalov
mouse at yandex-team.ru
Fri Dec 9 03:06:54 AEDT 2016
Hello Matt,
08.12.2016, 01:55, "Joel Stanley" <joel at jms.id.au>:
> Hi Matt,
>
>
> We can keep both drivers around without issue. It takes a few KB of
> extra flash space, but we are still a long way from overflowing the
> space set aside for the kernel.
>
> The harder bit is the device tree. We would need to update the device
> tree depending on which piece of hardware is attached. I'm not sure
> the best way to handle that.
>
We use device tree overlay support ported from Raspberry Pi kernel tree and user space:
https://github.com/raspberrypi/linux/tree/rpi-4.9.y/arch/arm/boot/dts/overlays
https://github.com/raspberrypi/userland/tree/master/host_applications/linux/apps/
our patchset (100-103):
https://github.com/ya-mouse/meta-openbmc-yandex/tree/master/meta-yandex/meta-openrack/meta-shaosi/recipes-kernel/linux/linux-obmc
and userspace ported to OpenBMC:
https://github.com/ya-mouse/meta-openbmc-yandex/tree/master/meta-yandex/meta-openrack/meta-shaosi/recipes-phosphor/dtoverlay
and sample usage during init stage to detect proper board and load specific overlay:
https://github.com/ya-mouse/meta-openbmc-yandex/blob/master/meta-yandex/meta-openrack/meta-shaosi/recipes-kernel/linux/linux-obmc/overlays/shaosi-CB.dts
https://github.com/ya-mouse/meta-openbmc-yandex/blob/master/meta-yandex/meta-openrack/meta-shaosi/recipes-phosphor/initfs/files/obmc-init.sh#L413-L417
Current limitation of overlays is that __symbols__ only created within main DTB, it is not updated by further overlays, so we cannot just populate another tree with e.g. i2c-switch and then, depending on presence pin, add or remove computing node's overlays. As workaround it's possible to create complete base DTB and then using overlays enable or disable some part of tree.
Another limitation, overlays is a kind of stack. To remove some intermediate overlay, the kernel will remove all precedent overlays and the re-apply remaining.
--
Anton D. Kachalov
More information about the openbmc
mailing list