Skip to content

Commit

Permalink
Xilinx DTS: Use upstream source and only change what we need to.
Browse files Browse the repository at this point in the history
Instead of checking in decompiled dtbs, use the the upstream kernel as
the source of DTS.  Then use include files to change what we need to.

* Use the Linux v6.5.8 DTS source files
* Using include files add the openamp specific definitions
* Update example/dts/,gitignore to ignore dtbo files everywhere
* Update xilinx/.gitignore to ignore the specific products of the Makefile
* This handles the current versions of zcu102 and kv260
* This handles lockstep and split mode of the R5 subsystem

The OpenAMP devicetree changes here are the work of Tanmay Shah
and the Makefile and restructure to include files is by Bill Mills.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
Signed-off-by: Bill Mills <bill.mills@linaro.org>
  • Loading branch information
wmamills committed Nov 3, 2023
1 parent 5ade828 commit 0cbde86
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 5,521 deletions.
3 changes: 3 additions & 0 deletions examples/linux/dts/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.dtb
*.dtbo
*.dts.pp
*.dtso.pp
4 changes: 4 additions & 0 deletions examples/linux/dts/xilinx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These files come from a copy command in the Makefile
# don't check them in even though they look like source files

zynqmp-sck-kv-g-revB.dtso
60 changes: 60 additions & 0 deletions examples/linux/dts/xilinx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Build Devicetree Binaries and Devicetree Binary Overlays

DTBS := zcu102-openamp-lockstep.dtb zcu102-openamp-split.dtb
DTBS += kria-openamp-lockstep.dtb kria-openamp-split.dtb

#DTBOS := zynqmp-split.dtbo

# DTBC = DTBs as a result of combining a base with one or more overlays
DTBCS := kv260-openamp-lockstep.dtb kv260-openamp-split.dtb


# any file to test we have a valid kernel source dir
XILINX_DTS_DIR := $(LINUX_SRC_DIR)/arch/arm64/boot/dts/xilinx
LINUX_INC_DIR := $(LINUX_SRC_DIR)/include/

SHELL := /bin/bash

all: $(DTBS) $(DTBOS) $(DTBCS)

check-linux-dir:
@if [ ! -d $(XILINX_DTS_DIR) ]; then \
echo "LINUX_SRC_DIR must point to a Linux source directory"; \
echo "LINUX_SRC_DIR=$(LINUX_SRC_DIR)"; \
exit 2; \
fi

.PHONY : all check-linux-dir

DTC_CPP_FLAGS= -E -x assembler-with-cpp -nostdinc -undef -D__DTS__

# Note: -@ includes symbols which is need to apply overlays
%.dtb: %.dts
# Linux DTS uses C preprocessor first
$(CC) $(DTC_CPP_FLAGS) \
-I $(XILINX_DTS_DIR) \
-I $(LINUX_INC_DIR) \
-o $<.pp $<
dtc -@ -I dts -O dtb -o $@ $<.pp

%.dtbo: %.dtso
# Linux DTS uses C preprocessor first
$(CC) $(DTC_CPP_FLAGS) \
-I $(XILINX_DTS_DIR) \
-I $(LINUX_INC_DIR) \
-o $<.pp $<
dtc -@ -I dts -O dtb -o $@ $<.pp

$(DTBS): check-linux-dir

zynqmp-sck-kv-g-revB.dtso: $(XILINX_DTS_DIR)/zynqmp-sck-kv-g-revB.dtso
cp $< $@

kv260-openamp-lockstep.dtb: kria-openamp-lockstep.dtb zynqmp-sck-kv-g-revB.dtbo
fdtoverlay -o $@ -i $^

kv260-openamp-split.dtb: kria-openamp-split.dtb zynqmp-sck-kv-g-revB.dtbo
fdtoverlay -o $@ -i $^

clean:
rm -f $(DTBS) $(DTBOS) $(DTBCS) *.pp
19 changes: 5 additions & 14 deletions examples/linux/dts/xilinx/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
#### zcu102-openamp-lockstep.dts
- Base dts from Yocto 2022.1_update3 release: https://github.com/Xilinx/yocto-manifests/tree/xlnx-rel-v2022.1_update3
- `MACHINE=zcu102-zynqmp bitbake device-tree` will generate system-top.dtb
- Remoteproc nodes are available to configure RPU and TCM in lockstep mode using Xilinx downstream driver
- Board: Xilinx zcu102
- Works for QEMU
- Generate DTB: `dtc -I dts -O dtb -o zcu102-openamp-lockstep.dtb zcu102-openamp-lockstep.dts`

#### zcu102-openamp-split.dts
- Base dts from Yocto 2022.1_update3 release: https://github.com/Xilinx/yocto-manifests/tree/xlnx-rel-v2022.1_update3
- `MACHINE=zcu102-zynqmp bitbake device-tree` will generate system-top.dtb that is base dtb
- Added Remoteproc nodes to configure RPU and TCM in split mode using Xilinx downstream driver
- Board: Xilinx zcu102
- Works for QEMU
- Generate DTB: `dtc -I dts -O dtb -o zcu102-openamp-split.dtb zcu102-openamp-split.dts`
#### Building DTBs
- You will need a copy of the Linux source tree
- For consitency use the same kernel version as the OpenAMP-CI Builds is using
- Below we assume the kernel source is at ~/my-dir/kernel-source
- `make LINUX_SRC_DIR=~/my-dir/kernel-source'
8 changes: 8 additions & 0 deletions examples/linux/dts/xilinx/kria-openamp-lockstep.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* A base DTB for all kria for lockstep mode
** A carrier card overlay will be applied to this dtb,
** either at compile or at boot time
*/

#include "zynqmp-smk-k26-revA.dts"
#include "zynqmp-openamp.dtsi"

9 changes: 9 additions & 0 deletions examples/linux/dts/xilinx/kria-openamp-split.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* A base DTB for all kria for split mode
** A carrier card overlay will be applied to this dtb,
** either at compile or at boot time
*/

#include "zynqmp-smk-k26-revA.dts"
#include "zynqmp-openamp.dtsi"
#include "zynqmp-split.dtsi"

9 changes: 9 additions & 0 deletions examples/linux/dts/xilinx/zcu102-openamp-base.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Changes specific to zcu102 but common to mode */

/ {
axi {
serial@ff010000 {
status = "disabled";
};
};
};
Loading

0 comments on commit 0cbde86

Please sign in to comment.