device-tree.bbappend 3.07 KB
Newer Older
Rene Habraken's avatar
Rene Habraken committed
1
2
3
4
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += " \
	file://0001-fix-the-clock-frequency-generation.patch \
5
	file://pl-delete-nodes-zynqmp-zcu102-rev10-fmcdaq3.dtsi"
Rene Habraken's avatar
Rene Habraken committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

# Set this variable with the desired device tree
KERNEL_DTB = "file://zynqmp-zu7cg-rev1-ad9694.dts"

# used for sanity check
KERNEL_DTB_SUPPORTED_zynqmp = "zynqmp-zcu102-rev10-fmcdaq3 \
                        zynqmp-zu7cg-rev1-ad9694.dts"

KERNEL_DTB_SUPPORTED_microblaze = "kc705_fmcdaq2 \
				kcu105_adrv9371x \
				kcu105_fmcdaq2 \
				kcu105_fmcomms2-3 \
				kc705_ad9467_fmc \
				kc705_fmcomms2-3 \
				kc705_fmcjesdadc1 \
				vc707_fmcadc2 \
				vc707_fmcomms2-3 \
				vc707_fmcjesdadc1 \
				vc707_fmcadc5"

DTS_INCLUDE_PATH_zynq = "${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts"
DTS_INCLUDE_PATH_zynqmp = "${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/xilinx"
DTS_INCLUDE_PATH_microblaze = "${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts"

# Make sure that the kernel sources are available
do_configure[depends] += "virtual/kernel:do_configure"

# Important for the pre-processor
DEVICETREE_PP_FLAGS += " \
		-I${DTS_INCLUDE_PATH} \
		"
# For dtc
DEVICETREE_FLAGS += " \
		-i${DTS_INCLUDE_PATH} \
		"
# set common variables
set_common_vars() {
	KERNEL_PL_DTB_FILE="${1}"
	KERNEL_DTB_VER_FILE="${2}"
}

# Based on the selected device tree, this function will:
#	copy the device tree to ${WORKDIR}/system-user.dtsi since it is the one included by the top level device tree.
#	In some case, we need to remove some /include/ linesto avoid duplication with the top level device tree used by petalinux.
#	Remove /dts-v1/ duplicated line.
#	Add the /include "pl-delete-nodes-*" to remove all the duplicated labels between ADI device trees and pl.dtsi (generated by petalinux).
do_configure_append() {

54
        cp "/home/rene/Data/FPGA_workdir/adi/hdl/meta-adi/meta-adi-xilinx/recipes-bsp/device-tree/files/zynqmp-zu7cg-rev1-ad9694.dts" ${WORKDIR}/analog-devices.dtsi
Rene Habraken's avatar
Rene Habraken committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	[ ! -e "${WORKDIR}/pl-delete-nodes-zynqmp-zcu102-rev10-fmcdaq3.dtsi" ] && \
		{ bbfatal "Error: Could not find "pl-delete-nodes-zynqmp-zcu102-rev10-fmcdaq3.dtsi" in \"${WORKDIR}\""; }

	case ${MACHINE} in
		"plnx-zynqmp")
			set_common_vars pl-delete-nodes-zynqmp-zcu102-rev10-fmcdaq3.dtsi "${DTS_INCLUDE_PATH}/zynqmp-zcu102-revA.dts"
			[ -e "${DTS_INCLUDE_PATH}/zynqmp-zcu102-revA.dts" ] && { \
				sed -i 's,[/#]include.*\"zynqmp.dtsi\",,;s,[/#]include.*\"zynqmp-clk-ccf.dtsi\",,' "${DTS_INCLUDE_PATH}/zynqmp-zcu102-revA.dts"; }
		;;
		*)
			bbfatal "ERROR: Unsupported machine:${MACHINE}"
		;;
	esac

	sed -i s,/dts-v1/\;,, "${KERNEL_DTB_VER_FILE}"
	# If for some reason the WORKDIR is not cleaned we don't want to have
	# multiple include lines for our dtsi file. We also remove system-conf
	# since it touches in nodes that our dts already touch.
	sed -i '/analog-devices.dtsi/d;/system-conf.dtsi/d' "${WORKDIR}/system-user.dtsi"
	echo -e "#include \"analog-devices.dtsi\"" | cat - ${WORKDIR}/system-user.dtsi > temp && mv temp ${WORKDIR}/system-user.dtsi
	echo -e "/include/ \"${KERNEL_PL_DTB_FILE}\"" | cat - ${WORKDIR}/analog-devices.dtsi > temp && mv temp ${WORKDIR}/analog-devices.dtsi
}