mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 15:38:37 +04:00
Add a DSA driver for the seven-port switch integrated in MT7620. Keep the existing swconfig path for device trees without a DSA ports node. Use RXD4 source-port and TXD4 forced-port metadata with the Ralink DSA tagger. The programming guide places TXD4 FP_BMAP at bits 27:20; use that layout instead of the stale unused bits 26:19 definition. Implement bridge isolation and STP, VLAN filtering, FDB and MDB offload, ageing, flood controls, phylink, MTU limits, and software-extended hardware MIB counters. Poll the 1000BASE-T CPU port counters every 20 ms and the remaining ports every 200 ms to leave scheduling margin before their 16-bit packet counters wrap at minimum-sized line-rate traffic. DSA invokes port_stp_state_set() before updating its cached state, so pass the pending callback state as an override when recalculating port matrices instead of leaving hardware one transition behind. Correct the shared switch MIB enable register and enable all seven port counters. The old address was inside port 0 counter space, so this also fixes legacy swconfig initialization. Register DSA through a bound child of the frame-engine device. This gives the managed conduit device link the correct lifetime across driver unbind and reprobe while the switch registers remain owned by the existing GSW platform device. Package the driver and tagger as kmod-dsa-mt7620 for per-device opt-in. This keeps DSA and switchdev out of swconfig-only MT7620 images and prevents installing the DSA package together with swconfig. Also make MDIO and frame-engine teardown safe for deferred probes and runtime reprobes. Replace the legacy MDIO busy loop and -1 return with readl_poll_timeout_atomic() and its real error, and reset a still-busy frame engine before freeing DMA rings. Resolve FE and ESW resets by name so recovery can reset FE alone, and warn if a switch node provides neither named reset. The netdev is devm-managed, so leave NAPI deletion to free_netdev after unregister instead of deleting NAPI from fe_remove while the netdev is still registered. Tested on an MT7620N rev 2 eco 6 with 100BASE-T traffic, VLAN-aware hardware bridging, 2026-byte MTU, FDB/MDB offload, pending STP state, and driver unbind/rebind. The modular driver, tagger, package contents, DSA image composition, and swconfig-only kernel configuration were also verified. An independent TP-Link Archer C5 v4 test exercised an external RTL8367S DSA switch using the RTL8_4t tagger as a regression check on the shared dsa_tag_protocol enum. It found no collision or external-switch regression; it does not validate the MT7620 integrated-switch path. Signed-off-by: Gleb Pesin <dormancygrace@gmail.com> Link: https://github.com/openwrt/openwrt/pull/24493 Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
194 lines
5.1 KiB
Makefile
194 lines
5.1 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
# Copyright (C) 2006-2016 OpenWrt.org
|
|
|
|
OTHER_MENU:=Other modules
|
|
|
|
define KernelPackage/mmc-mtk
|
|
SUBMENU:=Other modules
|
|
TITLE:=MediaTek SD/MMC Card Interface support
|
|
DEPENDS:=@(TARGET_ramips_mt7620||TARGET_ramips_mt76x8||TARGET_ramips_mt7621) +kmod-mmc
|
|
KCONFIG:= \
|
|
CONFIG_MMC \
|
|
CONFIG_MMC_CQHCI \
|
|
CONFIG_MMC_HSQ \
|
|
CONFIG_MMC_MTK
|
|
FILES:= \
|
|
$(LINUX_DIR)/drivers/mmc/host/cqhci.ko \
|
|
$(LINUX_DIR)/drivers/mmc/host/mmc_hsq.ko \
|
|
$(LINUX_DIR)/drivers/mmc/host/mtk-sd.ko
|
|
AUTOLOAD:=$(call AutoProbe,cqhci mmc_hsq mtk-sd,1)
|
|
endef
|
|
|
|
define KernelPackage/mmc-mtk/description
|
|
MediaTek(R) Secure digital and Multimedia card Interface.
|
|
This is needed if support for any SD/SDIO/MMC devices is required.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,mmc-mtk))
|
|
|
|
define KernelPackage/pwm-mediatek
|
|
SUBMENU:=Other modules
|
|
TITLE:=MediaTek PWM support
|
|
DEPENDS:=@TARGET_ramips_mt76x8
|
|
KCONFIG:= \
|
|
CONFIG_PWM=y \
|
|
CONFIG_PWM_MEDIATEK
|
|
FILES:=$(LINUX_DIR)/drivers/pwm/pwm-mediatek.ko
|
|
AUTOLOAD:=$(call AutoProbe,pwm-mediatek)
|
|
endef
|
|
|
|
define KernelPackage/pwm-mediatek/description
|
|
Generic PWM framework driver for Mediatek SoC.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,pwm-mediatek))
|
|
|
|
define KernelPackage/sdhci-mt7620
|
|
SUBMENU:=Other modules
|
|
TITLE:=MT7620 SDCI
|
|
CONFLICTS:=kmod-mmc-mtk
|
|
DEPENDS:=@(TARGET_ramips_mt7620||TARGET_ramips_mt76x8||TARGET_ramips_mt7621) +kmod-mmc
|
|
KCONFIG:= \
|
|
CONFIG_MTK_MMC \
|
|
CONFIG_MTK_AEE_KDUMP=n \
|
|
CONFIG_MTK_MMC_CD_POLL=n
|
|
FILES:= \
|
|
$(LINUX_DIR)/drivers/mmc/host/mtk-mmc/mtk_sd.ko
|
|
AUTOLOAD:=$(call AutoProbe,mtk_sd,1)
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,sdhci-mt7620))
|
|
|
|
I2C_RALINK_MODULES:= \
|
|
CONFIG_I2C_RALINK:drivers/i2c/busses/i2c-ralink
|
|
|
|
define KernelPackage/i2c-ralink
|
|
$(call i2c_defaults,$(I2C_RALINK_MODULES),59)
|
|
TITLE:=Ralink I2C Controller
|
|
DEPENDS:=+kmod-i2c-core @TARGET_ramips \
|
|
@!(TARGET_ramips_mt7621||TARGET_ramips_mt76x8)
|
|
endef
|
|
|
|
define KernelPackage/i2c-ralink/description
|
|
Kernel modules for enable ralink i2c controller.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,i2c-ralink))
|
|
|
|
|
|
I2C_MT7621_MODULES:= \
|
|
CONFIG_I2C_MT7621:drivers/i2c/busses/i2c-mt7621
|
|
|
|
define KernelPackage/i2c-mt7628
|
|
$(call i2c_defaults,$(I2C_MT7621_MODULES),59)
|
|
TITLE:=MT7621/MT7628/MT7688 I2C Controller
|
|
DEPENDS:=+kmod-i2c-core \
|
|
@(TARGET_ramips_mt7621||TARGET_ramips_mt76x8)
|
|
endef
|
|
|
|
define KernelPackage/i2c-mt7628/description
|
|
Driver support for I2C controller in the MediaTek
|
|
MT7621/MT7628/MT7688 SoCs.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,i2c-mt7628))
|
|
|
|
define KernelPackage/dma-ralink
|
|
SUBMENU:=Other modules
|
|
TITLE:=Ralink GDMA Engine
|
|
DEPENDS:=@TARGET_ramips @!TARGET_ramips_rt288x
|
|
KCONFIG:= \
|
|
CONFIG_DMADEVICES=y \
|
|
CONFIG_RALINK_GDMA
|
|
FILES:= \
|
|
$(LINUX_DIR)/drivers/dma/virt-dma.ko \
|
|
$(LINUX_DIR)/drivers/dma/ralink-gdma.ko
|
|
AUTOLOAD:=$(call AutoLoad,52,ralink-gdma)
|
|
endef
|
|
|
|
define KernelPackage/dma-ralink/description
|
|
Kernel modules for enable ralink gdma engine.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,dma-ralink))
|
|
|
|
define KernelPackage/dsa-mt7620
|
|
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
|
TITLE:=MediaTek MT7620 integrated switch DSA support
|
|
DEPENDS:=@TARGET_ramips_mt7620 +kmod-dsa
|
|
CONFLICTS:=swconfig
|
|
KCONFIG:= \
|
|
CONFIG_NET_DSA_MT7620 \
|
|
CONFIG_NET_DSA_TAG_RALINK
|
|
FILES:= \
|
|
$(LINUX_DIR)/drivers/net/ethernet/ralink/gsw_mt7620_dsa.ko \
|
|
$(LINUX_DIR)/net/dsa/tag_ralink.ko
|
|
AUTOLOAD:=$(call AutoProbe,tag_ralink gsw_mt7620_dsa)
|
|
endef
|
|
|
|
define KernelPackage/dsa-mt7620/description
|
|
DSA support for the switch integrated in the MediaTek MT7620 SoC.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,dsa-mt7620))
|
|
|
|
define KernelPackage/hsdma-mtk
|
|
SUBMENU:=Other modules
|
|
TITLE:=MediaTek HSDMA Engine
|
|
DEPENDS:=@TARGET_ramips @TARGET_ramips_mt7621
|
|
KCONFIG:= \
|
|
CONFIG_DMADEVICES=y \
|
|
CONFIG_MTK_HSDMA
|
|
FILES:= \
|
|
$(LINUX_DIR)/drivers/dma/virt-dma.ko \
|
|
$(LINUX_DIR)/drivers/dma/mediatek/hsdma-mt7621.ko
|
|
AUTOLOAD:=$(call AutoLoad,53,hsdma-mt7621)
|
|
endef
|
|
|
|
define KernelPackage/hsdma-mtk/description
|
|
Kernel modules for enable MediaTek hsdma engine.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,hsdma-mtk))
|
|
|
|
define KernelPackage/sound-mt7620
|
|
TITLE:=MT7620 PCM/I2S Alsa Driver
|
|
DEPENDS:=@TARGET_ramips @!TARGET_ramips_rt288x +kmod-dma-ralink \
|
|
+kmod-sound-soc-core +kmod-sound-soc-wm8960
|
|
KCONFIG:= \
|
|
CONFIG_SND_RALINK_SOC_I2S \
|
|
CONFIG_SND_SIMPLE_CARD \
|
|
CONFIG_SND_SIMPLE_CARD_UTILS
|
|
FILES:= \
|
|
$(LINUX_DIR)/sound/soc/ralink/snd-soc-ralink-i2s.ko \
|
|
$(LINUX_DIR)/sound/soc/generic/snd-soc-simple-card.ko \
|
|
$(LINUX_DIR)/sound/soc/generic/snd-soc-simple-card-utils.ko
|
|
AUTOLOAD:=$(call AutoLoad,90,snd-soc-ralink-i2s snd-soc-simple-card)
|
|
$(call AddDepends/sound)
|
|
endef
|
|
|
|
define KernelPackage/sound-mt7620/description
|
|
Alsa modules for ralink i2s controller.
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,sound-mt7620))
|
|
|
|
|
|
define KernelPackage/keyboard-sx951x
|
|
SUBMENU:=Other modules
|
|
TITLE:=Semtech SX9512/SX9513
|
|
DEPENDS:=@TARGET_ramips_mt7621 +kmod-input-core
|
|
KCONFIG:= \
|
|
CONFIG_KEYBOARD_SX951X \
|
|
CONFIG_INPUT_KEYBOARD=y
|
|
FILES:=$(LINUX_DIR)/drivers/input/keyboard/sx951x.ko
|
|
AUTOLOAD:=$(call AutoProbe,sx951x)
|
|
endef
|
|
|
|
define KernelPackage/keyboard-sx951x/description
|
|
Enable support for SX9512/SX9513 capacitive touch controllers
|
|
endef
|
|
|
|
$(eval $(call KernelPackage,keyboard-sx951x))
|