From: Enrico Mioso Date: Fri, 11 Jul 2025 11:22:56 +0000 (+0200) Subject: mediatek: filogic: add SD card support to GatoNetworks GDSP X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=072ae5a76ba8aa595fdf485cd9a149271b06b64f;p=thirdparty%2Fopenwrt.git mediatek: filogic: add SD card support to GatoNetworks GDSP 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 --- 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 00000000000..f2175d81e66 --- /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@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 00000000000..46a07cf6835 --- /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@1 { + target = <&mmc0>; + __overlay__ { + card@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 00000000000..cc822810f63 --- /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@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 ad09ff8bcd1..2719b176560 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 = ; + bias-pull-up = ; + }; + conf-clk { + pins = "SPI1_CS"; + drive-strength = ; + bias-pull-down = ; + }; + conf-rst { + pins = "PWM0"; + drive-strength = ; + bias-pull-up = ; + }; + }; + + 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 = ; + bias-pull-up = ; + }; + conf-clk { + pins = "SPI1_CS"; + drive-strength = ; + bias-pull-down = ; + }; + conf-rst { + pins = "PWM0"; + drive-strength = ; + bias-pull-up = ; + }; + }; + 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 e08e265ab32..d0e2fff6eb4 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -269,6 +269,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 78d7e2d249c..7c7d33098e2 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@17k + cat $@.tmp >> $@ + rm $@.tmp +endef + define Build/mt798x-gpt cp $@ $@.tmp 2>/dev/null || true ptgen -g -o $@.tmp -a 1 -l 1024 \ @@ -948,15 +956,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