[openwrt/openwrt] mediatek: bpi-r64: use dt-overlay to select SATA or PCIE1

LEDE Commits lede-commits at lists.infradead.org
Wed Mar 17 19:58:37 GMT 2021


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/b40f707f71d4e1fee9b2c20d62e235c5aba5533b

commit b40f707f71d4e1fee9b2c20d62e235c5aba5533b
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Wed Mar 17 17:36:54 2021 +0000

    mediatek: bpi-r64: use dt-overlay to select SATA or PCIE1
    
    The Bananapi BPi-R64 got a SATA interface which cannot be used at the
    same time as the second mPCIe slot. The decission is made by hogging
    GPIO 90.
    Embed two addtional DT overlay blobs into the image to allow bootloader
    selection of either SATA or PCIE1 feature.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 target/linux/mediatek/Makefile                     |  2 +-
 target/linux/mediatek/image/mt7622.mk              |  1 +
 ...-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch | 80 ++++++++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile
index 2ee00e5d17..0825b8c6ed 100644
--- a/target/linux/mediatek/Makefile
+++ b/target/linux/mediatek/Makefile
@@ -6,7 +6,7 @@ ARCH:=arm
 BOARD:=mediatek
 BOARDNAME:=MediaTek Ralink ARM
 SUBTARGETS:=mt7622 mt7623 mt7629
-FEATURES:=squashfs nand separate_ramdisk fpu
+FEATURES:=squashfs nand separate_ramdisk fpu dt-overlay
 
 KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.10
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index 13f734b38c..fd043ed85f 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -73,6 +73,7 @@ define Device/bananapi_bpi-r64
   DEVICE_VENDOR := Bananapi
   DEVICE_MODEL := BPi-R64
   DEVICE_DTS := mt7622-bananapi-bpi-r64
+  DEVICE_DTS_OVERLAY := mt7622-bananapi-bpi-r64-pcie1 mt7622-bananapi-bpi-r64-sata
   DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 e2fsprogs mkf2fs f2fsck
   ARTIFACTS := sdcard.img
   IMAGES := sysupgrade.itb
diff --git a/target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch b/target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch
new file mode 100644
index 0000000000..4c6df93089
--- /dev/null
+++ b/target/linux/mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch
@@ -0,0 +1,80 @@
+--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
+@@ -279,14 +279,14 @@
+ &pcie1 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&pcie1_pins>;
+-	status = "okay";
++	status = "disabled";
+ };
+ 
+ &pio {
+ 	/* Attention: GPIO 90 is used to switch between PCIe at 1,0 and
+ 	 * SATA functions. i.e. output-high: PCIe, output-low: SATA
+ 	 */
+-	asm_sel {
++	asmsel: asm_sel {
+ 		gpio-hog;
+ 		gpios = <90 GPIO_ACTIVE_HIGH>;
+ 		output-high;
+--- /dev/null
++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-sata.dts
+@@ -0,0 +1,31 @@
++/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
++
++#include <dt-bindings/gpio/gpio.h>
++
++/dts-v1/;
++/plugin/;
++
++/ {
++	compatible = "bananapi,bpi-r64", "mediatek,mt7622";
++
++	fragment at 0 {
++		target = <&asmsel>;
++		__overlay__ {
++			gpios = <90 GPIO_ACTIVE_LOW>;
++		};
++	};
++
++	fragment at 1 {
++		target = <&sata>;
++		__overlay__ {
++			status = "okay";
++		};
++	};
++
++	fragment at 2 {
++		target = <&sata_phy>;
++		__overlay__ {
++			status = "okay";
++		};
++	};
++};
+--- /dev/null
++++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64-pcie1.dts
+@@ -0,0 +1,24 @@
++/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */
++
++#include <dt-bindings/gpio/gpio.h>
++
++/dts-v1/;
++/plugin/;
++
++/ {
++	compatible = "bananapi,bpi-r64", "mediatek,mt7622";
++
++	fragment at 0 {
++		target = <&asmsel>;
++		__overlay__ {
++			gpios = <90 GPIO_ACTIVE_HIGH>;
++		};
++	};
++
++	fragment at 1 {
++		target = <&pcie1>;
++		__overlay__ {
++			status = "okay";
++		};
++	};
++};



More information about the lede-commits mailing list