In the process of getting a adafruit gps board, expecially pps, to work on VF2 i experimented with dt overlays a bit.
the overlay i got working:
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/starfive,jh7110-pinfunc.h>
/ {
compatible = "starfive,visionfive-v2", "starfive,jh7110";
//gpio
fragment@0 {
target-path = "/soc/gpio@13040000";
__overlay__ {
pps_pins: pps_pins@12 {
pps_pins0 {
starfive,pins = <PAD_GPIO55>;
starfive,pinmux = <PAD_GPIO55_FUNC_SEL 1>; // pin mux no special function
//starfive,pinmux = <PAD_GPIO55_FUNC_SEL 0>; // pin mux no special function
starfive,pin-ioconfig = <IO(GPIO_IE(1) | GPIO_PU(0))>; // gpio in, no pullup
starfive,pin-gpio-din = <GPI_NONE>; // no special pin function
starfive,pin-gpio-doen = <OEN_HIGH>;
};
};
};
};
//pps
fragment@1 {
target-path = "/soc";
__overlay__ {
pps: pps@12 {
compatible = "pps-gpio";
pinctrl-names = "default";
pinctrl-0 = <&pps_pins>;
gpios = <&gpio 55 0>;
status = "okay";
};
};
};
};
For this to work the devicetree has to be compiled with symbols (dtc option “-@”), otherwise “&pps_pins” has to be raplaced with the raw hex phandle for the gpio node.
If anyone has improvements/hints for this I’d be thankful, unfortunately there is few documentation on the Variables used for dt by starfive and it’s a guessing game with existing dts and the JH7110 datasheet to get things to work…
On kernels compiled with CONFIG_OF_OVERLAY and CONFIG_CONFIGFS (default for the vf2 kernel i think) one can load the compiled dtbos from linux, (example for the icludeded uart3_i2c.dtbo):
# mkdir /sys/kernel/config/device-tree/overlays/uart3
# cat /boot/dtb/starfive/vf2-overlay/vf2-overlay-uart3-i2c.dtbo > /sys/kernel/config/device-tree/overlays/uart3/dtbo
Trying to load the overlays can also be loaded via the distro boot mechanism by specifying dtoverlays with their full path in extlinux/extlinux.conf:
fdtoverlays /boot/dtb/starfive/vf2-overlay/vf2-overlay-pps-gpio.dtbo
resulted in an error message about the fdtoverlay_addr_r
If i set this to an adress in between the range for fdt_addr_r and ramdisk _add_r in uboot (there should be enough space…) it just works:
env set fdtoverlay_addr_r 0x48050000
env save
adding an fdtoverlay_addr_r to the distibuted u-boot out of the box would be a great addition