diff --git a/linux/files/avp64-linux-defconfig b/linux/files/avp64-linux-defconfig index 21a403c..8a6685b 100644 --- a/linux/files/avp64-linux-defconfig +++ b/linux/files/avp64-linux-defconfig @@ -28,8 +28,6 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.4" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="/app/files/avp64_linux_kernel.config" -BR2_LINUX_KERNEL_DTS_SUPPORT=y -BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="/app/files/avp64_linux.dts /app/files/avp64_linux_dualcore.dts" BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y BR2_PACKAGE_GDB=y BR2_PACKAGE_STRACE=y diff --git a/linux/files/avp64_linux_dualcore.dts b/linux/files/avp64_linux_dualcore.dts deleted file mode 100644 index 6842b13..0000000 --- a/linux/files/avp64_linux_dualcore.dts +++ /dev/null @@ -1,156 +0,0 @@ -/****************************************************************************** - * * - * Copyright 2020 Lukas Jünger * - * * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * - ******************************************************************************/ - -/dts-v1/; - -/ { - model = "Foundation-v8A"; - compatible = "arm,foundation-aarch64", "arm,vexpress"; - interrupt-parent = <&gic>; - #address-cells = <1>; - #size-cells = <1>; - - aliases { - serial0 = &v2m_serial0; - serial1 = &v2m_serial1; - serial2 = &v2m_serial2; - serial3 = &v2m_serial3; - }; - - cpus { - #address-cells = <2>; - #size-cells = <0>; - - cpu0: cpu@0 { - device_type = "cpu"; - compatible = "arm,armv8"; - reg = <0x0 0x0>; - }; - - cpu1: cpu@1 { - device_type = "cpu"; - compatible = "arm,armv8"; - enable-method = "spin-table"; - cpu-release-addr = <0x0 0x00004000>; - reg = <0x0 0x1>; - }; - }; - - chosen { - bootargs = "earlycon console=ttyAMA0 root=/dev/mmcblk0p1 rootwait debug"; - stdout-path = "/amba/uart@10009000"; - }; - - memory@40000000 { - device_type= "memory"; - reg = <0x00000000 0x10000000>; - }; - -timer { - compatible = "arm,armv8-timer", "arm,armv7-timer"; - interrupts = <1 13 0xFF04>, - <1 14 0xFF04>, - <1 11 0xFF04>, - <1 10 0xFF04>; - clock-frequency = <1000000000>; - }; - -amba { - #address-cells = <0x1>; - #size-cells = <0x1>; - compatible = "arm,amba-bus", "simple-bus"; - ranges; - - rng: rng@10007000 { - compatible = "timeriomem_rng"; - reg = <0x10007000 0x4>; - quality = <1000>; - period = <0>; - }; - - v2m_serial0: uart@10009000 { - compatible = "arm,pl011", "arm,primecell"; - reg = <0x10009000 0x1000>; - interrupts = <0 5 4>; - clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; - clock-names = "uartclk", "apb_pclk"; - }; - - v2m_serial1: uart@1000a000 { - compatible = "arm,pl011", "arm,primecell"; - reg = <0x1000a000 0x1000>; - interrupts = <0 6 4>; - clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; - clock-names = "uartclk", "apb_pclk"; - }; - - v2m_serial2: uart@1000b000 { - compatible = "arm,pl011", "arm,primecell"; - reg = <0x1000b000 0x1000>; - interrupts = <0 7 4>; - clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; - clock-names = "uartclk", "apb_pclk"; - }; - - v2m_serial3: uart@1000c000 { - compatible = "arm,pl011", "arm,primecell"; - reg = <0x1000c000 0x1000>; - interrupts = <0 8 4>; - clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; - clock-names = "uartclk", "apb_pclk"; - }; - - gic: interrupt-controller@10140000 { - compatible = "arm,cortex-a9-gic"; - #interrupt-cells = <3>; - #address-cells = <0>; - interrupt-controller; - reg = <0x10140000 0x1000>, - <0x10141000 0x100>; - }; - - ethoc: ethernet@1000d000 { - compatible = "opencores,ethoc"; - reg = <0x1000d000 0x2000>; - interrupts = <0 9 4>; - }; - - sdhci: mmc@1000f000 { - compatible = "fujitsu,mb86s70-sdhci-3.0"; - reg = <0x1000f000 0x1000>; - interrupts = <0 10 4>; - clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; - clock-names = "iface", "core"; - }; - - }; - - v2m_clk24mhz: clk24mhz { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <24000000>; - clock-output-names = "v2m:clk24mhz", "iface", "core"; - }; - - v2m_refclk1mhz: refclk1mhz { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <1000000>; - clock-output-names = "v2m:refclk1mhz"; - }; -}; diff --git a/linux/files/dt/Makefile b/linux/files/dt/Makefile new file mode 100644 index 0000000..f0dd494 --- /dev/null +++ b/linux/files/dt/Makefile @@ -0,0 +1,35 @@ +O ?= . +CPP ?= cpp +DTC ?= dtc + +CPPFLAGS := -nostdinc -undef -x assembler-with-cpp + +OBJ := ${O}/avp64x1.dtb ${O}/avp64x2.dtb ${O}/avp64x4.dtb ${O}/avp64x8.dtb + +all: $(OBJ) + +clean: + $(RM) $(OBJ) + +${O}/%.dtb: ${O}/%.dts + @mkdir -p ${O} + $(DTC) -I dts -O dtb -o $@ $< + +${O}/avp64x1.dts: avp64.dts + @mkdir -p ${O} + $(CPP) $(CPPFLAGS) -D NRCPU=1 -o $@ $< + +${O}/avp64x2.dts: avp64.dts + @mkdir -p ${O} + $(CPP) $(CPPFLAGS) -D NRCPU=2 -o $@ $< + +${O}/avp64x4.dts: avp64.dts + @mkdir -p ${O} + $(CPP) $(CPPFLAGS) -D NRCPU=4 -o $@ $< + +${O}/avp64x8.dts: avp64.dts + @mkdir -p ${O} + $(CPP) $(CPPFLAGS) -D NRCPU=8 -o $@ $< + +.PHONY: all clean +.INTERMEDIATE: $(OBJ:dtb=dts) diff --git a/linux/files/avp64_linux.dts b/linux/files/dt/avp64.dts similarity index 76% rename from linux/files/avp64_linux.dts rename to linux/files/dt/avp64.dts index e479a74..fbb45ee 100644 --- a/linux/files/avp64_linux.dts +++ b/linux/files/dt/avp64.dts @@ -1,6 +1,6 @@ /****************************************************************************** * * - * Copyright 2020 Lukas Jünger * + * Copyright 2023 Lukas Jünger, Nils Bosbach * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * @@ -16,6 +16,10 @@ * * ******************************************************************************/ +#ifndef NRCPU +#error NRCPU undefined +#endif + /dts-v1/; / { @@ -42,6 +46,61 @@ reg = <0x0 0x0>; }; +#if NRCPU > 1 + cpu1: cpu@1 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x1>; + }; +#if NRCPU > 2 + cpu2: cpu@2 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x2>; + }; + cpu3: cpu@3 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x3>; + }; +#if NRCPU > 4 + cpu4: cpu@4 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x4>; + }; + cpu5: cpu@5 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x5>; + }; + cpu6: cpu@6 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x6>; + }; + cpu7: cpu@7 { + device_type = "cpu"; + compatible = "arm,armv8"; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x00004000>; + reg = <0x0 0x7>; + }; +#endif // NRCPU > 4 +#endif // NRCPU > 2 +#endif // NRCPU > 1 }; chosen { @@ -148,14 +207,13 @@ amba { }; }; - gpio0: gpio@0x10149000 { + gpio0: gpio@10149000 { compatible = "brcm,bcm6345-gpio"; reg = <0x10149000 4>; reg-names = "dat"; gpio-controller; #gpio-cells = <2>; - //big-endian; - }; + }; }; v2m_clk24mhz: clk24mhz { diff --git a/linux/files/post-image.sh b/linux/files/post-image.sh index 957663d..03621b7 100755 --- a/linux/files/post-image.sh +++ b/linux/files/post-image.sh @@ -29,3 +29,6 @@ genimage \ --inputpath "${BINARIES_DIR}" \ --outputpath "${BINARIES_DIR}" \ --config "${GENIMAGE_CFG}" + +# compile device trees +make -C /app/files/dt O=/app/build/buildroot/output/dt