[PATCH V2 1/2] mediatek: filogic: add SD card support to GatoNetworks GDSP
Enrico Mioso
mrkiko.rs at gmail.com
Fri Jul 11 04:22:56 PDT 2025
The device is equipped with a GPS module, reporting data via /dev/ttyS1.
A TF card reader is also present. Only one of those components can be
used at once, since they share some PINs.
This commit adds two devicetree overlays to allow for the user to select
the desired configuration. Another overlay configuration to allow booting
from SD card is provided.
Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
.../dts/mt7981b-gatonetworks-gdsp-gps.dtso | 15 ++++
.../mt7981b-gatonetworks-gdsp-sd-boot.dtso | 30 ++++++++
.../dts/mt7981b-gatonetworks-gdsp-sd.dtso | 15 ++++
.../dts/mt7981b-gatonetworks-gdsp.dts | 69 ++++++++++++++++++-
.../base-files/lib/upgrade/platform.sh | 1 +
target/linux/mediatek/image/filogic.mk | 20 +++++-
6 files changed, 147 insertions(+), 3 deletions(-)
create mode 100644 target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-gps.dtso
create mode 100644 target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd-boot.dtso
create mode 100644 target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd.dtso
diff --git a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-gps.dtso b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-gps.dtso
new file mode 100644
index 0000000000..f2175d81e6
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-gps.dtso
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "gatonetworks,gdsp", "mediatek,mt7981";
+
+ fragment at 0 {
+ target = <&uart1>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd-boot.dtso b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd-boot.dtso
new file mode 100644
index 0000000000..46a07cf683
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd-boot.dtso
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "gatonetworks,gdsp", "mediatek,mt7981";
+
+ fragment at 1 {
+ target = <&mmc0>;
+ __overlay__ {
+ card at 0 {
+ compatible = "mmc-card";
+ reg = <0>;
+
+ partitions {
+ compatible = "gpt-partitions";
+
+ sdmmc_fit: block-partition-fit {
+ partname = "FIT";
+ };
+ };
+ };
+ };
+ };
+};
+
+&{/chosen} {
+ rootdisk = <&sdmmc_fit>;
+};
diff --git a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd.dtso b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd.dtso
new file mode 100644
index 0000000000..cc822810f6
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp-sd.dtso
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "gatonetworks,gdsp", "mediatek,mt7981";
+
+ fragment at 0 {
+ target = <&mmc0>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts
index ad09ff8bcd..2719b17656 100644
--- a/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts
+++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts
@@ -127,6 +127,23 @@
status = "okay";
};
+&mmc0 {
+ status = "disabled";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default", "state_uhs";
+ pinctrl-0 = <&mmc0_pins_default>;
+ pinctrl-1 = <&mmc0_pins_uhs>;
+ bus-width = <4>;
+ max-frequency = <50000000>;
+ cap-sd-highspeed;
+ vmmc-supply = <®_3p3v>;
+ vqmmc-supply = <®_3p3v>;
+ no-mmc;
+ no-sdio;
+};
+
ð {
status = "okay";
@@ -334,6 +351,56 @@
};
};
+ mmc0_pins_default: mmc0-pins-default {
+ mux {
+ function = "flash";
+ groups = "emmc_45";
+ };
+ conf-cmd-dat {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO",
+ "SPI0_CS", "SPI0_HOLD", "SPI0_WP",
+ "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO";
+ input-enable;
+ drive-strength = <MTK_DRIVE_4mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+ };
+ conf-clk {
+ pins = "SPI1_CS";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
+ };
+ conf-rst {
+ pins = "PWM0";
+ drive-strength = <MTK_DRIVE_4mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+ };
+ };
+
+ mmc0_pins_uhs: mmc0-pins-uhs {
+ mux {
+ function = "flash";
+ groups = "emmc_45";
+ };
+ conf-cmd-dat {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO",
+ "SPI0_CS", "SPI0_HOLD", "SPI0_WP",
+ "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO";
+ input-enable;
+ drive-strength = <MTK_DRIVE_4mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+ };
+ conf-clk {
+ pins = "SPI1_CS";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
+ };
+ conf-rst {
+ pins = "PWM0";
+ drive-strength = <MTK_DRIVE_4mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+ };
+ };
+
uart2_pins: uart2-pins {
mux {
function = "uart";
@@ -368,7 +435,7 @@
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
- status = "okay";
+ status = "disabled";
};
&uart2 {
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index bd7501d8da..d8574fb65d 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -262,6 +262,7 @@ platform_copy_config() {
bananapi,bpi-r4-2g5|\
bananapi,bpi-r4-poe|\
cmcc,rax3000m|\
+ gatonetworks,gdsp|\
mediatek,mt7988a-rfb)
if [ "$CI_METHOD" = "emmc" ]; then
emmc_copy_config
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 14b8ecd02a..ab375eb1e4 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -30,6 +30,14 @@ define Build/mt7988-bl31-uboot
cat $(STAGING_DIR_IMAGE)/mt7988_$1-u-boot.fip >> $@
endef
+define Build/simplefit
+ cp $@ $@.tmp 2>/dev/null || true
+ ptgen -g -o $@.tmp -a 1 -l 1024 \
+ -t 0x2e -N FIT -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M at 17k
+ cat $@.tmp >> $@
+ rm $@.tmp
+endef
+
define Build/mt798x-gpt
cp $@ $@.tmp 2>/dev/null || true
ptgen -g -o $@.tmp -a 1 -l 1024 \
@@ -942,15 +950,23 @@ define Device/gatonetworks_gdsp
DEVICE_VENDOR := GatoNetworks
DEVICE_MODEL := gdsp
DEVICE_DTS := mt7981b-gatonetworks-gdsp
+ DEVICE_DTS_OVERLAY := \
+ mt7981b-gatonetworks-gdsp-gps \
+ mt7981b-gatonetworks-gdsp-sd \
+ mt7981b-gatonetworks-gdsp-sd-boot
DEVICE_DTS_DIR := ../dts
+ DEVICE_DTC_FLAGS := --pad 4096
IMAGES := sysupgrade.itb
IMAGE_SIZE := 32768k
- DEVICE_PACKAGES := fitblk kmod-mt7915e kmod-mt7981-firmware \
+ DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs fitblk \
+ kmod-mt7915e kmod-mt7981-firmware \
kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 \
mt7981-wo-firmware -kmod-phy-aquantia
- ARTIFACTS := preloader.bin bl31-uboot.fip
+ ARTIFACTS := preloader.bin bl31-uboot.fip sdcard.img.gz
ARTIFACT/preloader.bin := mt7981-bl2 nor-ddr3
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot gatonetworks_gdsp
+ ARTIFACT/sdcard.img.gz := simplefit |\
+ append-image squashfs-sysupgrade.itb | check-size | gzip
KERNEL := kernel-bin | gzip
KERNEL_INITRAMFS := kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
--
2.49.0
More information about the openwrt-devel
mailing list