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 <mrkiko.rs@gmail.com>
This commit is contained in:
Enrico Mioso 2025-07-11 13:22:56 +02:00 committed by Daniel Golle
parent 5e0f06d558
commit 072ae5a76b
6 changed files with 147 additions and 3 deletions

View file

@ -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";
};
};
};

View file

@ -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>;
};

View file

@ -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";
};
};
};

View file

@ -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 = <&reg_3p3v>;
vqmmc-supply = <&reg_3p3v>;
no-mmc;
no-sdio;
};
&eth {
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 {

View file

@ -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

View file

@ -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