diff --git a/config/bootscripts/boot-sun50i-next.cmd b/config/bootscripts/boot-sun50i-next.cmd index df4aef333..94c2cd9fd 100644 --- a/config/bootscripts/boot-sun50i-next.cmd +++ b/config/bootscripts/boot-sun50i-next.cmd @@ -36,7 +36,7 @@ load ${devtype} 0 ${fdt_addr_r} /boot/dtb/allwinner/${fdtfile} || load ${devtype fdt addr ${fdt_addr_r} fdt resize for overlay_file in ${overlays}; do - if load ${devtype} 0 ${load_addr} dtb/allwinner/overlays/${overlay_file}.dtbo || load ${devtype} 0 ${load_addr} boot/dtb/allwinner/overlays/${overlay_file}.dtbo; then + if load ${devtype} 0 ${load_addr} boot/dtb/allwinner/overlays/${overlay_file}.dtbo || load ${devtype} 0 ${load_addr} dtb/allwinner/overlays/${overlay_file}.dtbo; then echo "Applying DT overlay ${overlay_file}.dtbo" fdt apply ${load_addr} fi diff --git a/config/bootscripts/boot-sunxi.cmd b/config/bootscripts/boot-sunxi.cmd index 4f4132e38..2c1031c27 100644 --- a/config/bootscripts/boot-sunxi.cmd +++ b/config/bootscripts/boot-sunxi.cmd @@ -42,7 +42,7 @@ if load ${devtype} 0 0x00000000 /boot/.next || load ${devtype} 0 0x00000000 .nex fdt addr ${fdt_addr_r} fdt resize for overlay_file in ${overlays}; do - if load ${devtype} 0 ${load_addr} dtb/overlays/${overlay_file}.dtbo || load ${devtype} 0 ${load_addr} boot/dtb/overlays/${overlay_file}.dtbo; then + if load ${devtype} 0 ${load_addr} boot/dtb/overlay/${overlay_file}.dtbo || load ${devtype} 0 ${load_addr} dtb/overlay/${overlay_file}.dtbo; then echo "Applying DT overlay ${overlay_file}.dtbo" fdt apply ${load_addr} fi diff --git a/patch/kernel/sun8i-dev/add-h3-overlays.patch b/patch/kernel/sun8i-dev/add-h3-overlays.patch new file mode 100644 index 000000000..71134c55f --- /dev/null +++ b/patch/kernel/sun8i-dev/add-h3-overlays.patch @@ -0,0 +1,248 @@ +diff --git a/arch/arm/Makefile b/arch/arm/Makefile +index 6be9ee14..750f48a2 100644 +--- a/arch/arm/Makefile ++++ b/arch/arm/Makefile +@@ -335,6 +335,9 @@ $(INSTALL_TARGETS): + %.dtb: | scripts + $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ + ++%.dtbo: | scripts ++ $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ ++ + PHONY += dtbs dtbs_install + + dtbs: prepare scripts +diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore +index 3c79f859..eaaeb17e 100644 +--- a/arch/arm/boot/.gitignore ++++ b/arch/arm/boot/.gitignore +@@ -3,4 +3,4 @@ zImage + xipImage + bootpImage + uImage +-*.dtb ++*.dtb* +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index c558ba75..40899e4a 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -954,10 +955,16 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb + dtb-$(CONFIG_ARCH_ASPEED) += aspeed-bmc-opp-palmetto.dtb \ + aspeed-ast2500-evb.dtb ++ ++targets += dtbs dtbs_install ++targets += $(dtb-y) + endif + + dtstree := $(srctree)/$(src) + dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) + + always := $(dtb-y) ++subdir-y := overlay + clean-files := *.dtb ++ ++dts-dirs += overlay +diff --git a/arch/arm/boot/dts/overlay/Makefile b/arch/arm/boot/dts/overlay/Makefile +new file mode 100644 +index 00000000..00dd8ffc +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/Makefile +@@ -0,0 +1,15 @@ ++ifeq ($(CONFIG_OF_CONFIGFS),y) ++ ++dtbo-$(CONFIG_MACH_SUN8I) += \ ++ i2c0.dtbo \ ++ spi0-spidev.dtbo \ ++ spi1-spidev.dtbo \ ++ w1.dtbo ++ ++targets += dtbs dtbs_install ++targets += $(dtbo-y) ++ ++endif ++ ++always := $(dtbo-y) ++clean-files := *.dtbo +diff --git a/arch/arm/boot/dts/overlay/i2c0.dts b/arch/arm/boot/dts/overlay/i2c0.dts +new file mode 100644 +index 00000000..cbd8d801 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/i2c0.dts +@@ -0,0 +1,19 @@ ++/dts-v1/ /plugin/; ++ ++/ { ++ compatible = "allwinner,sun8i-h3"; ++ ++ fragment@0 { ++ target-path = "/aliases"; ++ __overlay__ { ++ /* Path to the i2c0 controller node */ ++ i2c0 = "/soc@01c00000/i2c@01c2ac00"; ++ }; ++ }; ++ fragment@1 { ++ target = <&i2c0>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/spi0-spidev.dts b/arch/arm/boot/dts/overlay/spi0-spidev.dts +new file mode 100644 +index 00000000..5a01ef23 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/spi0-spidev.dts +@@ -0,0 +1,24 @@ ++/dts-v1/ /plugin/; ++ ++/ { ++ compatible = "allwinner,sun8i-h3"; ++ ++ fragment@0 { ++ target-path = "/aliases"; ++ __overlay__ { ++ /* Path to the SPI controller nodes */ ++ spi0 = "/soc@01c00000/spi@01c68000"; ++ }; ++ }; ++ fragment@1 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@0 { ++ compatible = "spidev"; ++ reg = <0x0>; ++ spi-max-frequency = <1000000>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/spi1-spidev.dts b/arch/arm/boot/dts/overlay/spi1-spidev.dts +new file mode 100644 +index 00000000..92b73bc8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/spi1-spidev.dts +@@ -0,0 +1,24 @@ ++/dts-v1/ /plugin/; ++ ++/ { ++ compatible = "allwinner,sun8i-h3"; ++ ++ fragment@0 { ++ target-path = "/aliases"; ++ __overlay__ { ++ /* Path to the SPI controller nodes */ ++ spi1 = "/soc@01c00000/spi@01c69000"; ++ }; ++ }; ++ fragment@1 { ++ target = <&spi1>; ++ __overlay__ { ++ status = "okay"; ++ spidev@0 { ++ compatible = "spidev"; ++ reg = <0x0>; ++ spi-max-frequency = <1000000>; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlay/w1.dts b/arch/arm/boot/dts/overlay/w1.dts +new file mode 100644 +index 00000000..faf3650e +--- /dev/null ++++ b/arch/arm/boot/dts/overlay/w1.dts +@@ -0,0 +1,35 @@ ++/dts-v1/ /plugin/; ++ ++/ { ++ compatible = "allwinner,sun8i-h3"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&pio 3 14 0>; // PD14 ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&pio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ allwinner,pins = "PD14"; ++ allwinner,function = "gpio_in"; // in (initially) ++ allwinner,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"allwinner,pins:0"; ++ }; ++}; +diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst +index a1be75d0..ad8dc1c9 100644 +--- a/scripts/Makefile.dtbinst ++++ b/scripts/Makefile.dtbinst +@@ -27,6 +27,7 @@ ifeq ("$(dtbinst-root)", "$(obj)") + endif + + dtbinst-files := $(dtb-y) ++dtboinst-files := $(dtbo-y) + dtbinst-dirs := $(dts-dirs) + + # Helper targets for Installing DTBs into the boot directory +@@ -35,15 +36,18 @@ quiet_cmd_dtb_install = INSTALL $< + + install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj)) + +-$(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep ++$(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs): | __dtbs_install_prep + + $(dtbinst-files): %.dtb: $(obj)/%.dtb + $(call cmd,dtb_install,$(install-dir)) + ++$(dtboinst-files): %.dtbo: $(obj)/%.dtbo ++ $(call cmd,dtb_install,$(install-dir)) ++ + $(dtbinst-dirs): + $(Q)$(MAKE) $(dtbinst)=$(obj)/$@ + +-PHONY += $(dtbinst-files) $(dtbinst-dirs) +-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs) ++PHONY += $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) ++__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(dtbinst-dirs) + + .PHONY: $(PHONY) +diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib +index 0a07f901..5ccd3490 100644 +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -312,6 +312,17 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ + $(obj)/%.dtb: $(src)/%.dts FORCE + $(call if_changed_dep,dtc) + ++quiet_cmd_dtco = DTCO $@ ++cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ ++ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ ++ $(DTC) -O dtb -o $@ -b 0 \ ++ -i $(dir $<) $(DTC_FLAGS) \ ++ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ ++ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ++ ++$(obj)/%.dtbo: $(src)/%.dts FORCE ++ $(call if_changed_dep,dtco) ++ + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) + + # Bzip2