Switch to the new device-tree vendor tree

The old vendor tree was never fully merged and doing partial merge isn't
supported with git subtree merge so a new one was created.
Switch the build to use the new DTS from sys/contrib/device-tree
This also bump the DTS used to be in sync with Linux 5.9
While here change the way to get the linux version, simply hardcode
the value in sys/dts/freebsd-compatible.dts and use awk to get that
to put it in the CFLAGS.
As a bonus we now have the bindings docs available
in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo
or to the vendor tree.
This commit is contained in:
Emmanuel Vadot 2021-01-15 15:28:46 +01:00
parent 955b980bdf
commit efdf807990
7 changed files with 10 additions and 12 deletions

View File

@ -30,9 +30,9 @@ S= ../../..
.endif
.include "$S/conf/kern.pre.mk"
INCLUDES+= -I$S/contrib/libfdt -I$S/gnu/dts/include
INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
LINUX_DTS_VERSION!= make -C $S/gnu/dts/ -V LINUX_DTS_VERSION
LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
.if !defined(DEBUG) && !defined(PROFLEVEL)

View File

@ -25,7 +25,7 @@ S= ../../..
.endif
.include "$S/conf/kern.pre.mk"
INCLUDES+= -I$S/contrib/libfdt -I$S/gnu/dts/include
INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
# Use a custom SYSTEM_LD command to generate the elf kernel, so we can
# set the text segment start address, and also strip the "arm mapping

View File

@ -32,7 +32,7 @@ DTB+= ${_dts:T:R:S/$/.dtb/}
DTBO=${DTSO:T:R:S/$/.dtbo/}
.SUFFIXES: .dtb .dts .dtbo .dtso
.PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE}
.PATH.dts: ${SYSDIR}/contrib/device-tree/src/${MACHINE} ${SYSDIR}/dts/${MACHINE}
.PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays
.export DTC ECHO

View File

@ -34,7 +34,7 @@ arm/allwinner/aw_dwc3.c optional aw_dwc3 fdt
arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt
arm/allwinner/aw_mmc.c optional mmc aw_mmc fdt | mmccam aw_mmc fdt
arm/allwinner/aw_nmi.c optional aw_nmi fdt \
compile-with "${NORMAL_C} -I$S/gnu/dts/include"
compile-with "${NORMAL_C} -I$S/contrib/device-tree/include"
arm/allwinner/aw_pwm.c optional aw_pwm fdt
arm/allwinner/aw_rsb.c optional aw_rsb fdt
arm/allwinner/aw_rtc.c optional aw_rtc fdt

View File

@ -1,3 +1,3 @@
/ {
freebsd,dts-version = LINUX_DTS_VERSION;
freebsd,dts-version = "5.9";
};

View File

@ -20,11 +20,9 @@ fi
: "${ECHO:=echo}"
: "${CPP:=cpp}"
LINUX_DTS_VERSION=$(make -C $S/gnu/dts -V LINUX_DTS_VERSION)
for d in ${dts}; do
dtb="${dtb_path}/$(basename "$d" .dts).dtb"
${ECHO} "converting $d -> $dtb"
${CPP} -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\" -P -x assembler-with-cpp -I "$S/gnu/dts/include" -I "$S/dts/${MACHINE}" -I "$S/gnu/dts/${MACHINE}" -I "$S/gnu/dts/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null |
${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/gnu/dts/${MACHINE}" -i "$S/gnu/dts/"
${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -I "$S/contrib/device-tree/src/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null |
${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" -i "$S/contrib/device-tree/src/"
done

View File

@ -23,6 +23,6 @@ fi
for d in ${dtso}; do
dtb="${dtbo_path}/$(basename "$d" .dtso).dtbo"
${ECHO} "converting $d -> $dtb"
${CPP} -P -x assembler-with-cpp -I "$S/gnu/dts/include" -I "$S/dts/${MACHINE}" -I "$S/gnu/dts/${MACHINE}" -include "$d" /dev/null |
${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/gnu/dts/${MACHINE}"
${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -include "$d" /dev/null |
${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}"
done