[openwrt/openwrt] kernel: add Qualcomm SSDK driver

LEDE Commits lede-commits at lists.infradead.org
Mon Jan 16 03:52:57 PST 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/c608f7032576296943f6d0914f226ebcfa1cbe4f

commit c608f7032576296943f6d0914f226ebcfa1cbe4f
Author: Robert Marko <robimarko at gmail.com>
AuthorDate: Sat Aug 20 12:30:50 2022 +0200

    kernel: add Qualcomm SSDK driver
    
    Qualcomm SSDK is driver for Qualcomm Atheros switches and PHY-s.
    
    It is quite complicated and used by rest of the Qualcomm SDK stack for
    anything switch or PHY related.
    
    It is required for IPQ807x support as currently, there is no better driver
    for the built-in switch or UNIPHY.
    
    So, lets add the fixed-up version that supports kernel 5.15 for use on
    ipq807x target until a better driver is available.
    
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/kernel/qca-ssdk/Makefile                   |  82 +++++++++++++++++
 .../patches/0001-SSDK-config-add-kernel-5.10.patch |  56 +++++++++++
 ...SSDK-replace-ioremap_nocache-with-ioremap.patch | 102 +++++++++++++++++++++
 ...form-use-of_mdio_find_bus-to-get-MDIO-bus.patch |  40 ++++++++
 .../0004-SSDK-dts-fix-of_get_mac_address.patch     |  42 +++++++++
 .../patches/0005-SSDK-config-add-kernel-5.15.patch |  56 +++++++++++
 .../0006-qca8081-convert-to-5.11-IRQ-model.patch   |  83 +++++++++++++++++
 ...qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch |  67 ++++++++++++++
 ...qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch |  29 ++++++
 ...ix-compilation-error-for-parse_uci_option.patch |  22 +++++
 .../0010-QSDK-config-Avoid-Werror-heroics.patch    |  30 ++++++
 ...ssdk-remove-bridge-fdb-entry-for-the-auth.patch |  48 ++++++++++
 12 files changed, 657 insertions(+)

diff --git a/package/kernel/qca-ssdk/Makefile b/package/kernel/qca-ssdk/Makefile
new file mode 100644
index 0000000000..c9829d1516
--- /dev/null
+++ b/package/kernel/qca-ssdk/Makefile
@@ -0,0 +1,82 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=qca-ssdk
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_DATE:=2022-09-12
+PKG_SOURCE_VERSION:=628b22bc3d5ee81414b75ab3de6a255c82754dec
+PKG_MIRROR_HASH:=859344f79504b9953639dc5aa27042249f68e3a9a269e66d7f7a25e1ab38c110
+
+PKG_FLAGS:=nonshared
+
+include $(INCLUDE_DIR)/kernel.mk
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/qca-ssdk
+  SECTION:=kernel
+  CATEGORY:=Kernel modules
+  SUBMENU:=Network Devices
+  TITLE:=Qualcom SSDK switch driver
+  DEPENDS:=@(TARGET_ipq807x)
+  FILES:=$(PKG_BUILD_DIR)/build/bin/qca-ssdk.ko
+  AUTOLOAD:=$(call AutoLoad,30,qca-ssdk)
+endef
+
+define KernelPackage/qca-ssdk/Description
+  Driver for Qualcomm Atheros switches.
+endef
+
+GCC_VERSION=$(shell echo "$(CONFIG_GCC_VERSION)" | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
+
+ifdef CONFIG_TOOLCHAIN_BIN_PATH
+TOOLCHAIN_BIN_PATH=$(CONFIG_TOOLCHAIN_BIN_PATH)
+else
+TOOLCHAIN_BIN_PATH=$(TOOLCHAIN_DIR)/bin
+endif
+
+MAKE_FLAGS+= \
+	TARGET_NAME=$(CONFIG_TARGET_NAME) \
+	TOOL_PATH=$(TOOLCHAIN_BIN_PATH) \
+	SYS_PATH=$(LINUX_DIR) \
+	TOOLPREFIX=$(TARGET_CROSS) \
+	KVER=$(LINUX_VERSION) \
+	ARCH=$(LINUX_KARCH) \
+	TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \
+	GCC_VERSION=$(GCC_VERSION) \
+	EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \
+	$(KERNEL_MAKE_FLAGS)
+
+ifeq ($(CONFIG_TARGET_BOARD), "ipq807x")
+    MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable
+endif
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include/qca-ssdk
+	$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/api
+	$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/ref
+	$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/fal
+	$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/sal
+	$(INSTALL_DIR) $(1)/usr/include/qca-ssdk/init
+	$(CP) -rf $(PKG_BUILD_DIR)/include/api/sw_ioctl.h $(1)/usr/include/qca-ssdk/api
+	if [ -f $(PKG_BUILD_DIR)/include/ref/ref_vsi.h ]; then \
+	$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_vsi.h $(1)/usr/include/qca-ssdk/ref/; \
+	fi
+	if [ -f $(PKG_BUILD_DIR)/include/ref/ref_fdb.h ]; then \
+	$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_fdb.h $(1)/usr/include/qca-ssdk/ref/; \
+	fi
+	if [ -f $(PKG_BUILD_DIR)/include/ref/ref_port_ctrl.h ]; then \
+	$(CP) -rf $(PKG_BUILD_DIR)/include/ref/ref_port_ctrl.h $(1)/usr/include/qca-ssdk/ref/; \
+	fi
+	if [ -f $(PKG_BUILD_DIR)/include/init/ssdk_init.h ]; then \
+	$(CP) -rf $(PKG_BUILD_DIR)/include/init/ssdk_init.h $(1)/usr/include/qca-ssdk/init/; \
+	fi
+	$(CP) -rf $(PKG_BUILD_DIR)/include/fal $(1)/usr/include/qca-ssdk
+	$(CP) -rf $(PKG_BUILD_DIR)/include/common/*.h $(1)/usr/include/qca-ssdk
+	$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/linux/*.h $(1)/usr/include/qca-ssdk
+	$(CP) -rf $(PKG_BUILD_DIR)/include/sal/os/*.h $(1)/usr/include/qca-ssdk
+
+endef
+
+$(eval $(call KernelPackage,qca-ssdk))
diff --git a/package/kernel/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch b/package/kernel/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch
new file mode 100644
index 0000000000..be83d6f1ee
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10.patch
@@ -0,0 +1,56 @@
+From 6ee395e1cab32d1d4899d7846ea99e6e2dc0a9e4 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Wed, 12 May 2021 13:41:12 +0200
+Subject: [PATCH 01/11] SSDK: config: add kernel 5.10
+
+This is purely to identify it and be able to set
+flags correctly.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ config            | 6 +++++-
+ make/linux_opt.mk | 4 ++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+--- a/config
++++ b/config
+@@ -24,6 +24,10 @@ ifeq ($(KVER),$(filter 5.4%,$(KVER)))
+ 	OS_VER=5_4
+ endif
+ 
++ifeq ($(KVER),$(filter 5.10%,$(KVER)))
++OS_VER=5_10
++endif
++
+ ifeq ($(KVER), 3.4.0)
+ 	OS_VER=3_4
+ endif
+@@ -132,7 +136,7 @@ ifeq ($(ARCH), arm)
+ endif
+ 
+ ifeq ($(ARCH), arm64)
+-	ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4%,$(KVER)))
++	ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.10%,$(KVER)))
+ 		CPU_CFLAG=  -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
+ 	endif
+ endif
+--- a/make/linux_opt.mk
++++ b/make/linux_opt.mk
+@@ -437,7 +437,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
+       KASAN_SHADOW_SCALE_SHIFT := 3
+   endif
+ 
+-  ifeq (5_4, $(OS_VER))
++  ifeq ($(OS_VER),$(filter 5_4 5_10, $(OS_VER)))
+       ifeq ($(ARCH), arm64)
+           KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
+        endif
+@@ -468,7 +468,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
+ 
+   endif
+ 
+-  ifeq ($(OS_VER),$(filter 4_4 5_4, $(OS_VER)))
++  ifeq ($(OS_VER),$(filter 4_4 5_4 5_10, $(OS_VER)))
+                 MODULE_CFLAG += -DKVER34
+                 MODULE_CFLAG += -DKVER32
+             MODULE_CFLAG += -DLNX26_22
diff --git a/package/kernel/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch b/package/kernel/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch
new file mode 100644
index 0000000000..5589c8e229
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0002-SSDK-replace-ioremap_nocache-with-ioremap.patch
@@ -0,0 +1,102 @@
+From 845a89b05aae807fb837f8e8f27f95c89de6023f Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Wed, 12 May 2021 13:45:45 +0200
+Subject: [PATCH 02/11] SSDK: replace ioremap_nocache with ioremap
+
+ioremap_nocache was dropped upstream, simply use the
+generic variety.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ src/init/ssdk_clk.c  | 10 +++++-----
+ src/init/ssdk_init.c |  2 +-
+ src/init/ssdk_plat.c |  6 +++---
+ 3 files changed, 9 insertions(+), 9 deletions(-)
+
+--- a/src/init/ssdk_clk.c
++++ b/src/init/ssdk_clk.c
+@@ -721,7 +721,7 @@ ssdk_mp_tcsr_get(a_uint32_t tcsr_offset,
+ {
+ 	void __iomem *tcsr_base = NULL;
+ 
+-	tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
++	tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
+ 	if (!tcsr_base)
+ 	{
+ 		SSDK_ERROR("Failed to map tcsr eth address!\n");
+@@ -738,7 +738,7 @@ ssdk_mp_tcsr_set(a_uint32_t tcsr_offset,
+ {
+ 	void __iomem *tcsr_base = NULL;
+ 
+-	tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
++	tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
+ 	if (!tcsr_base)
+ 	{
+ 		SSDK_ERROR("Failed to map tcsr eth address!\n");
+@@ -786,7 +786,7 @@ ssdk_mp_cmnblk_stable_check(void)
+ 	a_uint32_t reg_val;
+ 	int i, loops = 20;
+ 
+-	pll_lock = ioremap_nocache(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE);
++	pll_lock = ioremap(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE);
+ 	if (!pll_lock) {
+ 		SSDK_ERROR("Failed to map CMN PLL LOCK register!\n");
+ 		return A_FALSE;
+@@ -843,7 +843,7 @@ static void ssdk_cmnblk_pll_src_set(enum
+ 	void __iomem *cmn_pll_src_base = NULL;
+ 	a_uint32_t reg_val;
+ 
+-	cmn_pll_src_base = ioremap_nocache(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE);
++	cmn_pll_src_base = ioremap(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE);
+ 	if (!cmn_pll_src_base) {
+ 		SSDK_ERROR("Failed to map cmn pll source address!\n");
+ 		return;
+@@ -869,7 +869,7 @@ static void ssdk_cmnblk_init(enum cmnblk
+ 		return;
+ 	}
+ 
+-	gcc_pll_base = ioremap_nocache(CMN_BLK_ADDR, CMN_BLK_SIZE);
++	gcc_pll_base = ioremap(CMN_BLK_ADDR, CMN_BLK_SIZE);
+ 	if (!gcc_pll_base) {
+ 		SSDK_ERROR("Failed to map gcc pll address!\n");
+ 		return;
+--- a/src/init/ssdk_init.c
++++ b/src/init/ssdk_init.c
+@@ -3134,7 +3134,7 @@ static int ssdk_dess_mac_mode_init(a_uin
+ 							(a_uint8_t *)&reg_value, 4);
+ 			mdelay(10);
+ 			/*softreset psgmii, fixme*/
+-			gcc_addr = ioremap_nocache(0x1812000, 0x200);
++			gcc_addr = ioremap(0x1812000, 0x200);
+ 			if (!gcc_addr) {
+ 				SSDK_ERROR("gcc map fail!\n");
+ 				return 0;
+--- a/src/init/ssdk_plat.c
++++ b/src/init/ssdk_plat.c
+@@ -1708,7 +1708,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin
+ 	reg_mode = ssdk_uniphy_reg_access_mode_get(dev_id);
+ 	if(reg_mode == HSL_REG_LOCAL_BUS) {
+ 		ssdk_uniphy_reg_map_info_get(dev_id, &map);
+-		qca_phy_priv_global[dev_id]->uniphy_hw_addr = ioremap_nocache(map.base_addr,
++		qca_phy_priv_global[dev_id]->uniphy_hw_addr = ioremap(map.base_addr,
+ 									map.size);
+ 		if (!qca_phy_priv_global[dev_id]->uniphy_hw_addr) {
+ 			SSDK_ERROR("%s ioremap fail.", __func__);
+@@ -1723,7 +1723,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin
+ 	reg_mode = ssdk_switch_reg_access_mode_get(dev_id);
+ 	if (reg_mode == HSL_REG_LOCAL_BUS) {
+ 		ssdk_switch_reg_map_info_get(dev_id, &map);
+-		qca_phy_priv_global[dev_id]->hw_addr = ioremap_nocache(map.base_addr,
++		qca_phy_priv_global[dev_id]->hw_addr = ioremap(map.base_addr,
+ 								map.size);
+ 		if (!qca_phy_priv_global[dev_id]->hw_addr) {
+ 			SSDK_ERROR("%s ioremap fail.", __func__);
+@@ -1764,7 +1764,7 @@ ssdk_plat_init(ssdk_init_cfg *cfg, a_uin
+ 			return -1;
+ 		}
+ 
+-		qca_phy_priv_global[dev_id]->psgmii_hw_addr = ioremap_nocache(map.base_addr,
++		qca_phy_priv_global[dev_id]->psgmii_hw_addr = ioremap(map.base_addr,
+ 								map.size);
+ 		if (!qca_phy_priv_global[dev_id]->psgmii_hw_addr) {
+ 			SSDK_ERROR("%s ioremap fail.", __func__);
diff --git a/package/kernel/qca-ssdk/patches/0003-SSDK-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch b/package/kernel/qca-ssdk/patches/0003-SSDK-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch
new file mode 100644
index 0000000000..f9535fb387
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0003-SSDK-platform-use-of_mdio_find_bus-to-get-MDIO-bus.patch
@@ -0,0 +1,40 @@
+From 85f988dbc15559a5a2fee606e6ef400aa39fe444 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Wed, 12 May 2021 17:15:46 +0200
+Subject: [PATCH 03/11] SSDK: platform: use of_mdio_find_bus() to get MDIO bus
+
+Kernel has a generic of_mdio_find_bus() which can get the appropriate
+MDIO bus based on the DT node.
+So, drop the getting MDIO from platform data, which no longer works
+in 5.4 and later and use of_mdio_find_bus().
+
+Signed-off-by: Baruch Siach <baruch at tkos.co.il>
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ src/init/ssdk_plat.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+--- a/src/init/ssdk_plat.c
++++ b/src/init/ssdk_plat.c
+@@ -753,7 +753,6 @@ static int miibus_get(a_uint32_t dev_id)
+ 	struct device_node *mdio_node = NULL;
+ 	struct device_node *switch_node = NULL;
+ 	struct platform_device *mdio_plat = NULL;
+-	struct qca_mdio_data *mdio_data = NULL;
+ 	struct qca_phy_priv *priv;
+ 	hsl_reg_mode reg_mode = HSL_REG_LOCAL_BUS;
+ 	priv = qca_phy_priv_global[dev_id];
+@@ -788,12 +787,7 @@ static int miibus_get(a_uint32_t dev_id)
+ 
+ 	if(reg_mode == HSL_REG_LOCAL_BUS)
+ 	{
+-		mdio_data = dev_get_drvdata(&mdio_plat->dev);
+-		if (!mdio_data) {
+-			SSDK_ERROR("cannot get mdio_data reference from device data\n");
+-			return 1;
+-		}
+-		priv->miibus = mdio_data->mii_bus;
++		priv->miibus = of_mdio_find_bus(mdio_node);
+ 	}
+ 	else
+ 		priv->miibus = dev_get_drvdata(&mdio_plat->dev);
diff --git a/package/kernel/qca-ssdk/patches/0004-SSDK-dts-fix-of_get_mac_address.patch b/package/kernel/qca-ssdk/patches/0004-SSDK-dts-fix-of_get_mac_address.patch
new file mode 100644
index 0000000000..1dd948643f
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0004-SSDK-dts-fix-of_get_mac_address.patch
@@ -0,0 +1,42 @@
+From 079c20aa182c6b623d49e1f375e022dedac7373c Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Fri, 13 Aug 2021 20:03:21 +0200
+Subject: [PATCH 04/11] SSDK: dts: fix of_get_mac_address()
+
+Recently OpenWrt backported the updated of_get_mac_address()
+function which returns and error code instead.
+
+So, patch the SSDK to use it and fix the compilation error.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ src/init/ssdk_dts.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/src/init/ssdk_dts.c
++++ b/src/init/ssdk_dts.c
+@@ -921,8 +921,9 @@ static void ssdk_dt_parse_intf_mac(void)
+ {
+ 	struct device_node *dp_node = NULL;
+ 	a_uint32_t dp = 0;
+-	a_uint8_t *maddr = NULL;
++	u8 maddr[ETH_ALEN];
+ 	char dp_name[8] = {0};
++	int ret;
+ 
+ 	for (dp = 1; dp <= SSDK_MAX_NR_ETH; dp++) {
+ 		snprintf(dp_name, sizeof(dp_name), "dp%d", dp);
+@@ -930,11 +931,11 @@ static void ssdk_dt_parse_intf_mac(void)
+ 		if (!dp_node) {
+ 			continue;
+ 		}
+-		maddr = (a_uint8_t *)of_get_mac_address(dp_node);
++		ret = of_get_mac_address(dp_node, maddr);
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
+ 		if (maddr && is_valid_ether_addr(maddr)) {
+ #else
+-		if (!IS_ERR(maddr) && is_valid_ether_addr(maddr)) {
++		if (!ret && is_valid_ether_addr(maddr)) {
+ #endif
+ 			ssdk_dt_global.num_intf_mac++;
+ 			ether_addr_copy(ssdk_dt_global.intf_mac[dp-1].uc, maddr);
diff --git a/package/kernel/qca-ssdk/patches/0005-SSDK-config-add-kernel-5.15.patch b/package/kernel/qca-ssdk/patches/0005-SSDK-config-add-kernel-5.15.patch
new file mode 100644
index 0000000000..045f7ae40b
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0005-SSDK-config-add-kernel-5.15.patch
@@ -0,0 +1,56 @@
+From 0c509f8d8e5a6a03933a112d4487fd1c005442d6 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Fri, 24 Dec 2021 19:39:02 +0100
+Subject: [PATCH 05/11] SSDK: config: add kernel 5.15
+
+This is purely to identify it and be able to set
+flags correctly.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ config            | 6 +++++-
+ make/linux_opt.mk | 4 ++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+--- a/config
++++ b/config
+@@ -28,6 +28,10 @@ ifeq ($(KVER),$(filter 5.10%,$(KVER)))
+ OS_VER=5_10
+ endif
+ 
++ifeq ($(KVER),$(filter 5.15%,$(KVER)))
++OS_VER=5_15
++endif
++
+ ifeq ($(KVER), 3.4.0)
+ 	OS_VER=3_4
+ endif
+@@ -136,7 +140,7 @@ ifeq ($(ARCH), arm)
+ endif
+ 
+ ifeq ($(ARCH), arm64)
+-	ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.10%,$(KVER)))
++	ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.10% 5.15%,$(KVER)))
+ 		CPU_CFLAG=  -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
+ 	endif
+ endif
+--- a/make/linux_opt.mk
++++ b/make/linux_opt.mk
+@@ -437,7 +437,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
+       KASAN_SHADOW_SCALE_SHIFT := 3
+   endif
+ 
+-  ifeq ($(OS_VER),$(filter 5_4 5_10, $(OS_VER)))
++  ifeq ($(OS_VER),$(filter 5_4 5_10 5_15, $(OS_VER)))
+       ifeq ($(ARCH), arm64)
+           KASAN_OPTION += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT)
+        endif
+@@ -468,7 +468,7 @@ ifeq (KSLIB, $(MODULE_TYPE))
+ 
+   endif
+ 
+-  ifeq ($(OS_VER),$(filter 4_4 5_4 5_10, $(OS_VER)))
++  ifeq ($(OS_VER),$(filter 4_4 5_4 5_10 5_15, $(OS_VER)))
+                 MODULE_CFLAG += -DKVER34
+                 MODULE_CFLAG += -DKVER32
+             MODULE_CFLAG += -DLNX26_22
diff --git a/package/kernel/qca-ssdk/patches/0006-qca8081-convert-to-5.11-IRQ-model.patch b/package/kernel/qca-ssdk/patches/0006-qca8081-convert-to-5.11-IRQ-model.patch
new file mode 100644
index 0000000000..4eb7483d2b
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0006-qca8081-convert-to-5.11-IRQ-model.patch
@@ -0,0 +1,83 @@
+From 9278b2794d984f5a8ec2350b9607a35aea2cc106 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Fri, 24 Dec 2021 20:02:32 +0100
+Subject: [PATCH 06/11] qca8081: convert to 5.11 IRQ model
+
+Kernel 5.11 introduced new IRQ handling model for PHY-s,
+so provide those if 5.11 or later is used.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ src/hsl/phy/qca808x.c | 46 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+
+--- a/src/hsl/phy/qca808x.c
++++ b/src/hsl/phy/qca808x.c
+@@ -247,6 +247,7 @@ static int qca808x_config_intr(struct ph
+ 	return err;
+ }
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ static int qca808x_ack_interrupt(struct phy_device *phydev)
+ {
+ 	int err;
+@@ -266,6 +267,47 @@ static int qca808x_ack_interrupt(struct
+ 
+ 	return (err < 0) ? err : 0;
+ }
++#endif
++
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0))
++static irqreturn_t qca808x_handle_interrupt(struct phy_device *phydev)
++{
++	a_uint16_t irq_status, int_enabled;
++	a_uint32_t dev_id = 0, phy_id = 0;
++	qca808x_priv *priv = phydev->priv;
++	const struct qca808x_phy_info *pdata = priv->phy_info;
++
++	if (!pdata) {
++		return SW_FAIL;
++	}
++
++	dev_id = pdata->dev_id;
++	phy_id = pdata->phy_addr;
++
++	irq_status = qca808x_phy_reg_read(dev_id, phy_id,
++					  QCA808X_PHY_INTR_STATUS);
++	if (irq_status < 0) {
++		phy_error(phydev);
++		return IRQ_NONE;
++	}
++
++	/* Read the current enabled interrupts */
++	int_enabled = qca808x_phy_reg_read(dev_id, phy_id,
++					   QCA808X_PHY_INTR_MASK);
++	if (int_enabled < 0) {
++		phy_error(phydev);
++		return IRQ_NONE;
++	}
++
++	/* See if this was one of our enabled interrupts */
++	if (!(irq_status & int_enabled))
++		return IRQ_NONE;
++
++	phy_trigger_machine(phydev);
++
++	return IRQ_HANDLED;
++}
++#endif
+ 
+ /* switch linux negtiation capability to fal avariable */
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
+@@ -638,7 +680,11 @@ struct phy_driver qca808x_phy_driver = {
+ 	.config_intr	= qca808x_config_intr,
+ 	.config_aneg	= qca808x_config_aneg,
+ 	.aneg_done	= qca808x_aneg_done,
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ 	.ack_interrupt	= qca808x_ack_interrupt,
++#else
++	.handle_interrupt = qca808x_handle_interrupt,
++#endif
+ 	.read_status	= qca808x_read_status,
+ 	.suspend	= qca808x_suspend,
+ 	.resume		= qca808x_resume,
diff --git a/package/kernel/qca-ssdk/patches/0007-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch b/package/kernel/qca-ssdk/patches/0007-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch
new file mode 100644
index 0000000000..b8ebb08047
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0007-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch
@@ -0,0 +1,67 @@
+From 20a7945b82a4aefcb9ca0a14978412e4ae0057c9 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Tue, 11 Jan 2022 00:28:42 +0100
+Subject: [PATCH 07/11] qca807x: add a LED quirk for Xiaomi AX9000
+
+Xiaomi AX9000 has a single LED for each of 4 gigabit ethernet ports that
+are connected to QCA8075, and that LED is connected to the 100M LED pin.
+
+So, by default it will only work when in 10 or 100Mbit mode, this is quite
+annoying and makes no sense(If they have connected it to the 1000Mbit LED
+pin then it would have worked for 10/100 by default as well).
+
+So, to solve this add a check for system compatible as we cant parse if
+from DTS in any other way and set the 100M LED to blink on 1000Base-T
+as well.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ include/hsl/phy/malibu_phy.h |  2 ++
+ src/hsl/phy/malibu_phy.c     | 11 +++++++++++
+ 2 files changed, 13 insertions(+)
+
+--- a/include/hsl/phy/malibu_phy.h
++++ b/include/hsl/phy/malibu_phy.h
+@@ -94,6 +94,7 @@ extern "C"
+ #define MALIBU_DAC_CTRL_MASK  0x380
+ #define MALIBU_DAC_CTRL_VALUE  0x280
+ #define MALIBU_LED_1000_CTRL1_100_10_MASK  0x30
++#define MALIBU_LED_100_CTRL1_1000_MASK  0x40
+ 
+ #define MALIBU_PHY_EEE_ADV_100M 0x0002
+ #define MALIBU_PHY_EEE_ADV_1000M 0x0004
+@@ -118,6 +119,7 @@ extern "C"
+ #define MALIBU_PHY_MMD7_EGRESS_COUNTER_HIGH       0x802d
+ #define MALIBU_PHY_MMD7_EGRESS_COUNTER_LOW       0x802e
+ #define MALIBU_PHY_MMD7_EGRESS_ERROR_COUNTER       0x802f
++#define MALIBU_PHY_MMD7_LED_100_CTRL1       0x8074
+ #define MALIBU_PHY_MMD7_LED_1000_CTRL1       0x8076
+ 
+ 
+--- a/src/hsl/phy/malibu_phy.c
++++ b/src/hsl/phy/malibu_phy.c
+@@ -15,6 +15,8 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++#include <linux/of.h>
++
+ #include "sw.h"
+ #include "fal_port_ctrl.h"
+ #include "hsl_api.h"
+@@ -2708,6 +2710,15 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
+ 			led_status |= MALIBU_LED_1000_CTRL1_100_10_MASK;
+ 			malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
+ 				MALIBU_PHY_MMD7_LED_1000_CTRL1, led_status);
++			if (of_machine_is_compatible("xiaomi,ax9000")) {
++				/* add 1000M link LED behavior for Xiaomi AX9000 */
++				led_status = malibu_phy_mmd_read(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
++					MALIBU_PHY_MMD7_LED_100_CTRL1);
++				led_status &= ~MALIBU_LED_100_CTRL1_1000_MASK;
++				led_status |= MALIBU_LED_100_CTRL1_1000_MASK;
++				malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
++					MALIBU_PHY_MMD7_LED_100_CTRL1, led_status);
++			}
+ 			/*disable Extended next page*/
+ 			phy_data = malibu_phy_reg_read(dev_id, phy_addr, MALIBU_AUTONEG_ADVERT);
+ 			phy_data &= ~MALIBU_EXTENDED_NEXT_PAGE_EN;
diff --git a/package/kernel/qca-ssdk/patches/0008-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch b/package/kernel/qca-ssdk/patches/0008-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch
new file mode 100644
index 0000000000..27423af7ea
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0008-qca807x-add-a-LED-quirk-for-Xiaomi-AX3600.patch
@@ -0,0 +1,29 @@
+From bad774f43ec253e7e743e23bde87444c9d9cefdc Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko at gmail.com>
+Date: Wed, 26 Jan 2022 14:47:33 +0100
+Subject: [PATCH 08/11] qca807x: add a LED quirk for Xiaomi AX3600
+
+AX3600 requires the same LED quirk so that PHY LED-s will blink even
+once Linux resets the PHY.
+
+So, just check for its compatible.
+
+Signed-off-by: Robert Marko <robimarko at gmail.com>
+---
+ src/hsl/phy/malibu_phy.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/src/hsl/phy/malibu_phy.c
++++ b/src/hsl/phy/malibu_phy.c
+@@ -2710,8 +2710,9 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
+ 			led_status |= MALIBU_LED_1000_CTRL1_100_10_MASK;
+ 			malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
+ 				MALIBU_PHY_MMD7_LED_1000_CTRL1, led_status);
+-			if (of_machine_is_compatible("xiaomi,ax9000")) {
+-				/* add 1000M link LED behavior for Xiaomi AX9000 */
++			/* add 1000M link LED behavior for Xiaomi boards */
++			if (of_machine_is_compatible("xiaomi,ax9000") ||
++			    of_machine_is_compatible("xiaomi,ax3600")) {
+ 				led_status = malibu_phy_mmd_read(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
+ 					MALIBU_PHY_MMD7_LED_100_CTRL1);
+ 				led_status &= ~MALIBU_LED_100_CTRL1_1000_MASK;
diff --git a/package/kernel/qca-ssdk/patches/0009-include-fix-compilation-error-for-parse_uci_option.patch b/package/kernel/qca-ssdk/patches/0009-include-fix-compilation-error-for-parse_uci_option.patch
new file mode 100644
index 0000000000..1cdb47b2c1
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0009-include-fix-compilation-error-for-parse_uci_option.patch
@@ -0,0 +1,22 @@
+From be352dd54d163c005611906ac6b87692c9b8a1e6 Mon Sep 17 00:00:00 2001
+From: Ansuel Smith <ansuelsmth at gmail.com>
+Date: Sat, 7 May 2022 19:03:55 +0200
+Subject: [PATCH 09/11] include: fix compilation error for parse_uci_option
+
+Fix missing include for parse_uci_option
+
+Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
+---
+ include/ref/ref_uci.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/include/ref/ref_uci.h
++++ b/include/ref/ref_uci.h
+@@ -22,6 +22,7 @@
+ extern "C" {
+ #endif                          /* __cplusplus */
+ 
++#include <linux/switch.h>
+ 
+ #if defined(IN_SWCONFIG)
+ int
diff --git a/package/kernel/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch b/package/kernel/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch
new file mode 100644
index 0000000000..f5884f279b
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch
@@ -0,0 +1,30 @@
+From ecd1e0c57fdf7f8916fa20f085e08bb4b6ba0396 Mon Sep 17 00:00:00 2001
+From: Alexandru Gagniuc <mr.nuke.me at gmail.com>
+Date: Fri, 23 Sep 2022 08:21:13 -0500
+Subject: [PATCH 10/11] QSDK: config: Avoid -Werror heroics
+
+Trying to compile the QSDK with warnings as errors is a very brave
+endeavor. It's also stupid as it doesn't work on ipq60xx:
+
+   isisc_acl_prv.h:99: error: "FIELD_GET" redefined [-Werror]
+   99 | #define FIELD_GET(reg, field, val) \
+      |
+
+Instead of dealing with the braindead code, just disable Werror.
+
+Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
+---
+ config | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/config
++++ b/config
+@@ -141,7 +141,7 @@ endif
+ 
+ ifeq ($(ARCH), arm64)
+ 	ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.10% 5.15%,$(KVER)))
+-		CPU_CFLAG=  -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
++		CPU_CFLAG=  -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large
+ 	endif
+ endif
+ 
diff --git a/package/kernel/qca-ssdk/patches/0011-Revert-qca-ssdk-remove-bridge-fdb-entry-for-the-auth.patch b/package/kernel/qca-ssdk/patches/0011-Revert-qca-ssdk-remove-bridge-fdb-entry-for-the-auth.patch
new file mode 100644
index 0000000000..14db66876a
--- /dev/null
+++ b/package/kernel/qca-ssdk/patches/0011-Revert-qca-ssdk-remove-bridge-fdb-entry-for-the-auth.patch
@@ -0,0 +1,48 @@
+From c06e6edfb740d0ba0b804fa16d6222e257349089 Mon Sep 17 00:00:00 2001
+From: Alexandru Gagniuc <mr.nuke.me at gmail.com>
+Date: Fri, 23 Sep 2022 08:30:03 -0500
+Subject: [PATCH 11/11] Revert "qca-ssdk: remove bridge fdb entry for the
+ authentication failed mac"
+
+This change causes an undefined reference to "br_fdb_delete_by_netdev".
+This reverts commit 144f02b982c8c707aaf84b57d8c277d03d877236.
+
+Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
+---
+ src/ref/ref_acl.c | 11 -----------
+ 1 file changed, 11 deletions(-)
+
+--- a/src/ref/ref_acl.c
++++ b/src/ref/ref_acl.c
+@@ -23,7 +23,6 @@
+ #include "ssdk_init.h"
+ #include "ssdk_plat.h"
+ #include <linux/etherdevice.h>
+-#include <linux/if_bridge.h>
+ 
+ /* entry 0-1 is for global deny all and accept eapol rule
+    entry 2-9 is for phy port1 specific mac accept rule
+@@ -128,7 +127,6 @@ _ref_acl_mac_entry_create_rule(a_uint32_
+ {
+ 	sw_error_t rv = SW_OK;
+ 	fal_acl_rule_t rule = {0};
+-	struct net_device *eth_dev = NULL;
+ 	a_uint32_t port_id = ssdk_ifname_to_port(dev_id, entry->ifname);
+ 	SSDK_DEBUG("port_id %d entry_idx %d\n", port_id, entry_idx);
+ 
+@@ -224,15 +222,6 @@ _ref_acl_mac_entry_create_rule(a_uint32_
+ 		ref_acl_mac_entry[dev_id][entry_idx].port_map = BIT(port_id);
+ 		ref_acl_mac_entry[dev_id][entry_idx].acl_policy = 1;
+ 	}
+-	else if (!is_deny_all_mac(entry->src_mac.uc) && !entry->acl_policy)
+-	{
+-		eth_dev = dev_get_by_name(&init_net, entry->ifname);
+-		if (eth_dev)
+-		{
+-			br_fdb_delete_by_netdev(eth_dev, entry->src_mac.uc, 0);
+-			dev_put(eth_dev);
+-		}
+-	}
+ 	return rv;
+ }
+ 




More information about the lede-commits mailing list