dts: Update with current kernel devicetree, improve build

Now uses the same devicetree source as the kernel, verbatim, with the
required subset of kernel dt includes.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-03-15 02:26:31 +09:00
parent 35f2b2435e
commit cecf51f245
6 changed files with 223 additions and 141 deletions

View file

@ -40,7 +40,7 @@ OBJECTS := adt.o bootlogo_128.o bootlogo_256.o chickens.o exception.o exception_
string.o uart.o uartproxy.o utils.o utils_asm.o vsprintf.o wdt.o $(MINILZLIB_OBJECTS) \
$(TINF_OBJECTS) $(DLMALLOC_OBJECTS) $(LIBFDT_OBJECTS)
DTS := apple-j274.dts
DTS := t8103-j274.dts
BUILD_OBJS := $(patsubst %,build/%,$(OBJECTS))
DTBS := $(patsubst %.dts,build/dtb/%.dtb,$(DTS))
@ -57,10 +57,15 @@ clean:
format:
clang-format -i src/*.c src/*.h sysinc/*.h
build/dtb/%.dtb: dts/%.dts
build/dtb/%.dts: dts/%.dts
@echo " DTCPP $@"
@mkdir -p "$(dir $@)"
@$(CC) -E -nostdinc -I dts -x assembler-with-cpp -o $@ $<
build/dtb/%.dtb: build/dtb/%.dts
@echo " DTC $@"
@mkdir -p "$(dir $@)"
@dtc -I dts $< >$@
@dtc -I dts -i dts $< -o $@
build/%.o: src/%.S
@echo " AS $@"

View file

@ -1,138 +0,0 @@
// SPDX-License-Identifier: GPL-2.0+
/dts-v1/;
/ {
model = "Apple Mac Mini M1 2020";
compatible = "AAPL,j274", "AAPL,arm-platform";
#address-cells = <2>;
#size-cells = <2>;
chosen {
#address-cells = <2>;
#size-cells = <2>;
ranges;
bootargs = "earlycon debug";
stdout-path = "serial0:1500000";
framebuffer0: framebuffer@0 {
compatible = "simple-framebuffer";
reg = <0 0 0 0>; // To be filled by loader
status = "disabled";
};
};
memory@800000000 {
device_type = "memory";
reg = <0 0 0 0>; // To be filled by loader
};
aliases {
serial0 = &serial0;
};
cpus {
#address-cells = <2>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "AAPL,icestorm";
device_type = "cpu";
reg = <0x0 0x0>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu1: cpu@1 {
compatible = "AAPL,icestorm";
device_type = "cpu";
reg = <0x0 0x1>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu2: cpu@2 {
compatible = "AAPL,icestorm";
device_type = "cpu";
reg = <0x0 0x2>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu3: cpu@3 {
compatible = "AAPL,icestorm";
device_type = "cpu";
reg = <0x0 0x3>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu4: cpu@10100 {
compatible = "AAPL,firestorm";
device_type = "cpu";
reg = <0x0 0x10100>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu5: cpu@10101 {
compatible = "AAPL,firestorm";
device_type = "cpu";
reg = <0x0 0x10101>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu6: cpu@10102 {
compatible = "AAPL,firestorm";
device_type = "cpu";
reg = <0x0 0x10102>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
cpu7: cpu@10103 {
compatible = "AAPL,firestorm";
device_type = "cpu";
reg = <0x0 0x10103>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; // To be filled by loader
};
};
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <&aic>;
interrupts = <1 0 4>,
<1 0 4>,
<1 1 4>,
<1 0 4>;
};
clk24: clk24 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
clock-output-names = "clk24";
};
soc {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
ranges;
aic: interrupt-controller@23b100000 {
compatible = "AAPL,m1-aic", "AAPL,aic";
#interrupt-cells = <3>;
interrupt-controller;
reg = <0x2 0x3b100000 0x0 0x8000>;
};
serial0: serial@235200000 {
compatible = "AAPL,s5l-uart";
reg = <0x2 0x35200000 0x0 0x1000>;
reg-shift = <2>;
reg-io-width = <4>;
interrupt-parent = <&aic>;
interrupts = <0 605 4>;
clocks = <&clk24>, <&clk24>;
clock-names = "uart", "clk_uart_baud0";
};
};
};

View file

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0+ OR MIT */
#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_APPLE_AIC_H
#define _DT_BINDINGS_INTERRUPT_CONTROLLER_APPLE_AIC_H
#include <dt-bindings/interrupt-controller/irq.h>
#define AIC_IRQ 0
#define AIC_FIQ 1
#define AIC_TMR_HV_PHYS 0
#define AIC_TMR_HV_VIRT 1
#define AIC_TMR_GUEST_PHYS 2
#define AIC_TMR_GUEST_VIRT 3
#endif

View file

@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/*
* This header provides constants for most IRQ bindings.
*
* Most IRQ bindings include a flags cell as part of the IRQ specifier.
* In most cases, the format of the flags cell uses the standard values
* defined in this header.
*/
#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H
#define _DT_BINDINGS_INTERRUPT_CONTROLLER_IRQ_H
#define IRQ_TYPE_NONE 0
#define IRQ_TYPE_EDGE_RISING 1
#define IRQ_TYPE_EDGE_FALLING 2
#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)
#define IRQ_TYPE_LEVEL_HIGH 4
#define IRQ_TYPE_LEVEL_LOW 8
#endif

45
dts/t8103-j274.dts Normal file
View file

@ -0,0 +1,45 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* Apple Mac mini (M1, 2020)
*
* target-type: J274
*
* Copyright The Asahi Linux Contributors
*/
/dts-v1/;
#include "t8103.dtsi"
/ {
compatible = "apple,j274", "apple,t8103", "apple,arm-platform";
model = "Apple Mac mini (M1, 2020)";
aliases {
serial0 = &serial0;
};
chosen {
#address-cells = <2>;
#size-cells = <2>;
ranges;
stdout-path = "serial0";
framebuffer0: framebuffer@0 {
compatible = "apple,simple-framebuffer", "simple-framebuffer";
reg = <0 0 0 0>; /* To be filled by loader */
/* Format properties will be added by loader */
status = "disabled";
};
};
memory@800000000 {
device_type = "memory";
reg = <0x8 0 0x2 0>; /* To be filled by loader */
};
};
&serial0 {
status = "okay";
};

135
dts/t8103.dtsi Normal file
View file

@ -0,0 +1,135 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* Apple T8103 "M1" SoC
*
* Other names: H13G, "Tonga"
*
* Copyright The Asahi Linux Contributors
*/
#include <dt-bindings/interrupt-controller/apple-aic.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
compatible = "apple,t8103", "apple,arm-platform";
#address-cells = <2>;
#size-cells = <2>;
cpus {
#address-cells = <2>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "apple,icestorm";
device_type = "cpu";
reg = <0x0 0x0>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu1: cpu@1 {
compatible = "apple,icestorm";
device_type = "cpu";
reg = <0x0 0x1>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu2: cpu@2 {
compatible = "apple,icestorm";
device_type = "cpu";
reg = <0x0 0x2>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu3: cpu@3 {
compatible = "apple,icestorm";
device_type = "cpu";
reg = <0x0 0x3>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu4: cpu@10100 {
compatible = "apple,firestorm";
device_type = "cpu";
reg = <0x0 0x10100>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu5: cpu@10101 {
compatible = "apple,firestorm";
device_type = "cpu";
reg = <0x0 0x10101>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu6: cpu@10102 {
compatible = "apple,firestorm";
device_type = "cpu";
reg = <0x0 0x10102>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
cpu7: cpu@10103 {
compatible = "apple,firestorm";
device_type = "cpu";
reg = <0x0 0x10103>;
enable-method = "spin-table";
cpu-release-addr = <0 0>; /* To be filled by loader */
};
};
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <&aic>;
interrupt-names = "hyp-phys", "hyp-virt", "phys", "virt";
interrupts = <AIC_FIQ AIC_TMR_HV_PHYS IRQ_TYPE_LEVEL_HIGH>,
<AIC_FIQ AIC_TMR_HV_VIRT IRQ_TYPE_LEVEL_HIGH>,
<AIC_FIQ AIC_TMR_GUEST_PHYS IRQ_TYPE_LEVEL_HIGH>,
<AIC_FIQ AIC_TMR_GUEST_VIRT IRQ_TYPE_LEVEL_HIGH>;
};
clk24: clock-24m {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
clock-output-names = "clk24";
};
soc {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
ranges;
nonposted-mmio;
aic: interrupt-controller@23b100000 {
compatible = "apple,t8103-aic", "apple,aic";
#interrupt-cells = <3>;
interrupt-controller;
reg = <0x2 0x3b100000 0x0 0x8000>;
};
serial0: serial@235200000 {
compatible = "apple,s5l-uart";
reg = <0x2 0x35200000 0x0 0x1000>;
reg-io-width = <4>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 605 IRQ_TYPE_LEVEL_HIGH>;
/*
* TODO: figure out the clocking properly, there may
* be a third selectable clock.
*/
clocks = <&clk24>, <&clk24>;
clock-names = "uart", "clk_uart_baud0";
status = "disabled";
};
};
};