How to add custom dts entries
Ian Lepore
ian at freebsd.org
Sat Nov 3 20:46:41 UTC 2018
On Sat, 2018-11-03 at 21:07 +0100, Bernd Walter wrote:
> For a raspberry (1B modell) I have the following patches:
> [92]cicely7> cat rpi.ds18b20.dts.patch
> Index: boot/fdt/dts/arm/rpi.dts
> ===================================================================
> --- boot/fdt/dts/arm/rpi.dts (revision 303469)
> +++ boot/fdt/dts/arm/rpi.dts (working copy)
> @@ -340,6 +348,11 @@
> };
> };
>
> + onewire {
> + compatible = "w1-gpio";
> + gpios = <&gpio 4 1>;
> + };
> +
> power: regulator {
> compatible = "broadcom,bcm2835-power-mgr",
> "broadcom,bcm2708-power-mgr",
> [93]cicely7> cat rpi.apa102.dts.patch
> Index: boot/fdt/dts/arm/rpi.dts
> ===================================================================
> --- boot/fdt/dts/arm/rpi.dts (revision 303469)
> +++ boot/fdt/dts/arm/rpi.dts (working copy)
> @@ -292,6 +292,14 @@
> broadcom,function = "ALT3";
> };
> };
> +
> + spi0 {
> + apa102led0 {
> + compatible = "led,apa102";
> + spi-chipselect = <0>;
> + };
> + };
> +
> usb {
> hub {
> compatible = "usb,hub", "usb,device";
>
> And to install
> cd /usr/src/sys/modules/dtb/rpi
> make all install
>
> Obviously a few things have changed since then.
> We don't have overlay support yet, don't we?
>
> System is:
> # uname -a
> FreeBSD rpi-b 12.0-BETA3 FreeBSD 12.0-BETA3 r340039 RPI-B arm
> /usr/src is populated and my kernel driver itself build fine:
> # ls -la /boot/modules/
> total 20
> drwxr-xr-x 2 root wheel 512 Nov 3 20:54 .
> drwxr-xr-x 10 root wheel 1024 Nov 3 20:54 ..
> -r-xr-xr-x 1 root wheel 7080 Nov 3 20:54 apa102.ko
> -rw-r--r-- 1 root wheel 36 Nov 3 20:54 linker.hints
>
We do have overlay support now. I don't know much about using it,
hopefully those who do will reply with details.
There have also been updates to the SPI world. Your apa102led0 fdt node
now requires a "spi-max-frequency" property, the value is the bus speed
to use when communicating with that device, in Hz (different devices on
the same bus can now have different speeds, and there is no concept of
a default speed). Also, the chipsel number should be in a reg=
property, but we still support spi-chipselect= too for backwards
compatibility.
-- Ian
More information about the freebsd-arm
mailing list