From 7b401a9d955712d8ee0f969a2c235a7ce192434d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Mon, 24 Feb 2025 13:18:46 +0100 Subject: [PATCH 01/11] qualcommax: fix upgrade function for Linksys MX dual boot devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Function remove_oem_ubi_volume was called before CI_UBIPART variable was defined. Fixes: https://github.com/openwrt/openwrt/commit/df1f6e1e186a99b2180abac5da87f071b7f6b3fa (qualcommax: ipq807x: Remove OEM UBI volume before upgrade for Linksys MX devices) Signed-off-by: Paweł Owoc Link: https://github.com/openwrt/openwrt/pull/18090 Signed-off-by: Robert Marko --- .../ipq50xx/base-files/lib/upgrade/platform.sh | 6 +++--- .../ipq807x/base-files/lib/upgrade/platform.sh | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh index bafbc7bbdb..aa71b8992e 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -27,7 +27,7 @@ remove_oem_ubi_volume() { fi } -linksys_mx_do_upgrade() { +linksys_mx_pre_upgrade() { local setenv_script="/tmp/fw_env_upgrade" CI_UBIPART="rootfs" @@ -63,7 +63,6 @@ linksys_mx_do_upgrade() { return 1 } fi - nand_do_upgrade "$1" } platform_check_image() { @@ -75,8 +74,9 @@ platform_do_upgrade() { linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) + linksys_mx_pre_upgrade "$1" remove_oem_ubi_volume squashfs - linksys_mx_do_upgrade "$1" + nand_do_upgrade "$1" ;; *) default_do_upgrade "$1" diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh index 431491c141..ec8d0f58b0 100644 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -108,7 +108,7 @@ tplink_do_upgrade() { nand_do_upgrade "$1" } -linksys_mx_do_upgrade() { +linksys_mx_pre_upgrade() { local setenv_script="/tmp/fw_env_upgrade" CI_UBIPART="rootfs" @@ -144,7 +144,6 @@ linksys_mx_do_upgrade() { return 1 } fi - nand_do_upgrade "$1" } platform_check_image() { @@ -222,13 +221,15 @@ platform_do_upgrade() { linksys,mx4200v1|\ linksys,mx4200v2|\ linksys,mx4300) + linksys_mx_pre_upgrade "$1" remove_oem_ubi_volume squashfs - linksys_mx_do_upgrade "$1" + nand_do_upgrade "$1" ;; linksys,mx5300|\ linksys,mx8500) + linksys_mx_pre_upgrade "$1" remove_oem_ubi_volume ubifs - linksys_mx_do_upgrade "$1" + nand_do_upgrade "$1" ;; prpl,haze|\ qnap,301w) From a76651a24a440505de15c6340f53a84fb2052155 Mon Sep 17 00:00:00 2001 From: Kristian Skramstad Date: Sun, 26 Jan 2025 09:50:23 +0100 Subject: [PATCH 02/11] kernel: qca-nss-dp: update to 12.5.5 There is some new changes since 12.5.r2 to 12.5.5, so refresh and update patches. Changes: modified: package/kernel/qca-nss-dp/Makefile modified: package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch modified: package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch deleted: package/kernel/qca-nss-dp/patches/0011-01-edma_v1-rework-hw_reset-logic-to-permit-rmmod-and-in.patch deleted: package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch deleted: package/kernel/qca-nss-dp/patches/0011-03-nss_dp_main-swap-dp_exit-function-call.patch deleted: package/kernel/qca-nss-dp/patches/0011-04-nss_dp_main-call-unregister_netdev-first-in-dp_remov.patch deleted: package/kernel/qca-nss-dp/patches/0011-05-nss_dp_main-use-phy_detach-instead-of-disconnect-in-.patch deleted: package/kernel/qca-nss-dp/patches/0011-06-edma_v1-skip-edma_disable_port-in-edma_cleanup-subse.patch Log: 2024-10-16 |4c9f671| [qca-nss-dp] removed the calling of fal_port_autoneg_status_get 2024-10-16 |fb33119| Merge "[qca-nss-dp] Change Debug Level of TX Complete Errors" 2024-10-15 |e197b9d| [qca-nss-dp] Change Debug Level of TX Complete Errors 2024-10-03 |1b7aeb1| Merge remote-tracking branch origin/AU_LINUX_QSDK_GINGER_OPEN_TARGET_ALL.12.5.5.230.918 into HEAD 2024-10-01 |830ac73| Merge "[qca-nss-dp] Enable rmmod support for qca-nss-dp module." 2024-06-05 |aef242d| [qca-nss-dp] Enable rmmod support for qca-nss-dp module. 2024-09-18 |b1bfeb6| Merge "[qca-nss-dp] Move pr_info to pr_debug" 2024-09-12 |54aee26| Merge "[qca-nss-dp] Fix Loopback ring teardown path" 2024-09-10 |21f6567| Merge "[qca-nss-dp] Extend Tx Complete errors to track individual error type" 2024-09-10 |7fee76f| Merge "[qca-nss-dp] Destination VP xmit support" 2024-09-09 |0d4ecfd| [qca-nss-dp] Fix Loopback ring teardown path 2024-08-29 |438ab8e| [qca-nss-dp] Move pr_info to pr_debug 2024-08-29 |3f45e3d| Merge "[qca-nss-dp] Fix EDMA Recovery API to Prevent Multiple RX NAPI Add Calls" 2024-08-23 |7a792b1| [qca-nss-dp] Fix EDMA Recovery API to Prevent Multiple RX NAPI Add Calls 2024-07-08 |1227746| [qca-nss-dp] Add support for DDR extended buffer 2024-08-20 |d45bceb| [qca-nss-dp] Extend Tx Complete errors to track individual error type 2024-06-17 |a8f7155| [qca-nss-dp] Destination VP xmit support 2024-08-21 |a5d189b| Merge "[qca-nss-dp] Support for the PPE-VP Qdisc feature" 2024-08-16 |da97bc7| Merge "[qca-nss-dp] Restrict compilation of a file in DP module" 2024-06-22 |bf90fe9| [qca-nss-dp] Support for the PPE-VP Qdisc feature 2024-02-07 |6ceeb8f| [qca-nss-dp] Enable EDMA driver to allocate from beyond 4GB space. 2024-03-19 |4a7ff28| [qca-nss-dp] Restrict compilation of a file in DP module 2024-07-09 |73bad34| [qca-nss-dp] Check for DS node state before getting ppe queue 2024-05-03 |22cdbd6| [qca-nss-dp] Add PPE-DS Enqueue vp to queue mapping 2024-07-04 |5d6ef18| Merge "[qca-nss-dp] NAPI Budget change for KPI improvement" 2024-07-02 |cd0b543| Merge "[qca-nss-dp] Read fake_mac header indication from rx_desc" 2024-07-01 |160b988| [qca-nss-dp] NAPI Budget change for KPI improvement 2024-05-22 |54c2fd1| [qca-nss-dp]: Fixing SA warnings as part of qca-nss-dp module. 2024-06-22 |602534b| [qca-nss-dp] Read fake_mac header indication from rx_desc 2023-11-24 |10210e2| [qca-nss-dp] EDMA register changes for ipq54xx 2024-05-22 |1af0d03| Merge "[qca-nss-dp]: Change to support PPE-VP path for MLO Assist" 2024-05-15 |2acd9f3| [qca-nss-dp]: Change to support PPE-VP path for MLO Assist 2023-09-27 |1ca59f2| [qca-nss-dp] DP changes for ipq54xx 2024-04-18 |bc60c5a| Merge "[qca-nss-dp] Add support for the XGMAC latency computation" 2024-04-18 |6a67d6d| Merge "[qca-nss-dp] Fix the packets processing in the Rx NAPI" Signed-off-by: Kristian Skramstad Link: https://github.com/openwrt/openwrt/pull/17731 Signed-off-by: Robert Marko --- package/kernel/qca-nss-dp/Makefile | 6 +- ...a-phy-handle-property-to-connect-to-.patch | 12 ++-- ...p-allow-setting-netdev-name-from-DTS.patch | 2 +- ...w_reset-logic-to-permit-rmmod-and-in.patch | 43 -------------- ...-correctly-unregister-notifier-on-dp.patch | 59 ------------------- ...s_dp_main-swap-dp_exit-function-call.patch | 35 ----------- ...-unregister_netdev-first-in-dp_remov.patch | 35 ----------- ...phy_detach-instead-of-disconnect-in-.patch | 26 -------- ...a_disable_port-in-edma_cleanup-subse.patch | 37 ------------ ...012-01-syn-gmac-use-standard-DMA-api.patch | 43 +++++--------- ...e-corrent-scm-function-to-write-tcsr.patch | 5 -- .../0013-nss_dp_main-support-fixed-link.patch | 7 +-- 12 files changed, 27 insertions(+), 283 deletions(-) delete mode 100644 package/kernel/qca-nss-dp/patches/0011-01-edma_v1-rework-hw_reset-logic-to-permit-rmmod-and-in.patch delete mode 100644 package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch delete mode 100644 package/kernel/qca-nss-dp/patches/0011-03-nss_dp_main-swap-dp_exit-function-call.patch delete mode 100644 package/kernel/qca-nss-dp/patches/0011-04-nss_dp_main-call-unregister_netdev-first-in-dp_remov.patch delete mode 100644 package/kernel/qca-nss-dp/patches/0011-05-nss_dp_main-use-phy_detach-instead-of-disconnect-in-.patch delete mode 100644 package/kernel/qca-nss-dp/patches/0011-06-edma_v1-skip-edma_disable_port-in-edma_cleanup-subse.patch diff --git a/package/kernel/qca-nss-dp/Makefile b/package/kernel/qca-nss-dp/Makefile index a917f0518c..08cf471228 100644 --- a/package/kernel/qca-nss-dp/Makefile +++ b/package/kernel/qca-nss-dp/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-dp.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2024-04-16 -PKG_SOURCE_VERSION:=5bf8b91e9fc209f175f9a58723b03055ace3d581 -PKG_MIRROR_HASH:=e86b04ea674c18fb69cd09a45ccab50317b85117e40d76c8457052c2e55d7c18 +PKG_SOURCE_DATE:=2024-11-18 +PKG_SOURCE_VERSION:=4c9f671a84c866999fe938b900e76e197b62ee02 +PKG_MIRROR_HASH:=45568d7f1268b67d752f7085f6ef8397ca8ee4e5456ef121b8a285bded99dc82 PKG_BUILD_PARALLEL:=1 PKG_FLAGS:=nonshared diff --git a/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch b/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch index 518e961760..e78ee6da2f 100644 --- a/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch +++ b/package/kernel/qca-nss-dp/patches/0006-nss_dp_main-Use-a-phy-handle-property-to-connect-to-.patch @@ -43,7 +43,7 @@ Signed-off-by: Robert Marko --- a/nss_dp_main.c +++ b/nss_dp_main.c -@@ -436,7 +436,7 @@ static int nss_dp_open(struct net_device +@@ -464,7 +464,7 @@ static int nss_dp_open(struct net_device netif_start_queue(netdev); @@ -52,7 +52,7 @@ Signed-off-by: Robert Marko /* Notify data plane link is up */ if (dp_priv->data_plane_ops->link_state(dp_priv->dpc, 1)) { netdev_dbg(netdev, "Data plane set link failed\n"); -@@ -633,6 +633,12 @@ static int32_t nss_dp_of_get_pdata(struc +@@ -661,6 +661,12 @@ static int32_t nss_dp_of_get_pdata(struc return -EFAULT; } @@ -65,7 +65,7 @@ Signed-off-by: Robert Marko if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) { pr_err("%s: error reading mactype\n", np->name); return -EFAULT; -@@ -653,18 +659,6 @@ static int32_t nss_dp_of_get_pdata(struc +@@ -681,18 +687,6 @@ static int32_t nss_dp_of_get_pdata(struc return -EFAULT; #endif @@ -84,7 +84,7 @@ Signed-off-by: Robert Marko #if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)) maddr = (uint8_t *)of_get_mac_address(np); #if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0)) -@@ -753,56 +747,6 @@ static int32_t nss_dp_of_get_pdata(struc +@@ -781,56 +775,6 @@ static int32_t nss_dp_of_get_pdata(struc return 0; } @@ -141,7 +141,7 @@ Signed-off-by: Robert Marko #ifdef CONFIG_NET_SWITCHDEV /* * nss_dp_is_phy_dev() -@@ -861,7 +805,6 @@ static int32_t nss_dp_probe(struct platf +@@ -889,7 +833,6 @@ static int32_t nss_dp_probe(struct platf struct device_node *np = pdev->dev.of_node; struct nss_gmac_hal_platform_data gmac_hal_pdata; int32_t ret = 0; @@ -149,7 +149,7 @@ Signed-off-by: Robert Marko #if defined(NSS_DP_PPE_SUPPORT) uint32_t vsi_id; fal_port_t port_id; -@@ -940,22 +883,16 @@ static int32_t nss_dp_probe(struct platf +@@ -968,22 +911,16 @@ static int32_t nss_dp_probe(struct platf dp_priv->drv_flags |= NSS_DP_PRIV_FLAG(INIT_DONE); diff --git a/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch b/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch index d70284dfb5..9af770fcca 100644 --- a/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch +++ b/package/kernel/qca-nss-dp/patches/0008-nss-dp-allow-setting-netdev-name-from-DTS.patch @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko --- a/nss_dp_main.c +++ b/nss_dp_main.c -@@ -804,18 +804,29 @@ static int32_t nss_dp_probe(struct platf +@@ -832,18 +832,29 @@ static int32_t nss_dp_probe(struct platf struct nss_dp_dev *dp_priv; struct device_node *np = pdev->dev.of_node; struct nss_gmac_hal_platform_data gmac_hal_pdata; diff --git a/package/kernel/qca-nss-dp/patches/0011-01-edma_v1-rework-hw_reset-logic-to-permit-rmmod-and-in.patch b/package/kernel/qca-nss-dp/patches/0011-01-edma_v1-rework-hw_reset-logic-to-permit-rmmod-and-in.patch deleted file mode 100644 index 7e2a593657..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-01-edma_v1-rework-hw_reset-logic-to-permit-rmmod-and-in.patch +++ /dev/null @@ -1,43 +0,0 @@ -From c318c90b824c59539bf2e33618e381293398616c Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 16 Apr 2024 15:02:49 +0200 -Subject: [PATCH 1/6] edma_v1: rework hw_reset logic to permit rmmod and insmod - -Rework hw_reset logic for edma v1 to permit rmmod and insmod by using -get_exclusive_released variant (assuming the reset control was released) -and manually acquire and release it. - -This permits rmmod and insmod without triggering warning or receiving --EBUSY errors. - -Signed-off-by: Christian Marangi ---- - hal/dp_ops/edma_dp/edma_v1/edma_cfg.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_cfg.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_cfg.c -@@ -719,18 +719,22 @@ int edma_hw_reset(struct edma_hw *ehw) - struct reset_control *rst; - struct platform_device *pdev = ehw->pdev; - -- rst = devm_reset_control_get(&pdev->dev, EDMA_HW_RESET_ID); -+ rst = devm_reset_control_get_exclusive_released(&pdev->dev, EDMA_HW_RESET_ID); - if (IS_ERR(rst)) { - pr_warn("DTS Node: %s does not exist\n", EDMA_HW_RESET_ID); - return -EINVAL; - } - -+ reset_control_acquire(rst); -+ - reset_control_assert(rst); - udelay(100); - - reset_control_deassert(rst); - udelay(100); - -+ reset_control_release(rst); -+ - pr_info("EDMA HW Reset completed succesfully\n"); - - return 0; diff --git a/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch b/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch deleted file mode 100644 index 5abf178d38..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 079bfe441b274a8c06474be82e4ccc88599a5e0e Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 16 Apr 2024 16:08:46 +0200 -Subject: [PATCH 2/6] nss_dp_switchdev: correctly unregister notifier on - dp_remove - -Correctly unregister notifier on dp_remove to fix kernel panic on system -reboot. - -Signed-off-by: Christian Marangi ---- - include/nss_dp_dev.h | 1 + - nss_dp_main.c | 4 ++++ - nss_dp_switchdev.c | 13 +++++++++++++ - 3 files changed, 18 insertions(+) - ---- a/include/nss_dp_dev.h -+++ b/include/nss_dp_dev.h -@@ -349,6 +349,7 @@ void nss_dp_set_ethtool_ops(struct net_d - */ - #ifdef CONFIG_NET_SWITCHDEV - void nss_dp_switchdev_setup(struct net_device *dev); -+void nss_dp_switchdev_remove(struct net_device *dev); - bool nss_dp_is_phy_dev(struct net_device *dev); - #endif - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -970,6 +970,10 @@ static int nss_dp_remove(struct platform - if (!dp_priv) - continue; - -+ #ifdef CONFIG_NET_SWITCHDEV -+ nss_dp_switchdev_remove(dp_priv->netdev); -+ #endif -+ - dp_ops = dp_priv->data_plane_ops; - hal_ops = dp_priv->gmac_hal_ops; - ---- a/nss_dp_switchdev.c -+++ b/nss_dp_switchdev.c -@@ -648,4 +648,17 @@ void nss_dp_switchdev_setup(struct net_d - - switch_init_done = true; - } -+ -+void nss_dp_switchdev_remove(struct net_device *dev) -+{ -+ if (!switch_init_done) -+ return; -+ -+ if (nss_dp_sw_ev_nb) -+ unregister_switchdev_notifier(nss_dp_sw_ev_nb); -+ -+ unregister_switchdev_blocking_notifier(&nss_dp_switchdev_notifier); -+ -+ switch_init_done = false; -+} - #endif diff --git a/package/kernel/qca-nss-dp/patches/0011-03-nss_dp_main-swap-dp_exit-function-call.patch b/package/kernel/qca-nss-dp/patches/0011-03-nss_dp_main-swap-dp_exit-function-call.patch deleted file mode 100644 index 08088954fb..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-03-nss_dp_main-swap-dp_exit-function-call.patch +++ /dev/null @@ -1,35 +0,0 @@ -From ab7b1a361d51157118e1a61ce6530a59bcef4b61 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 16 Apr 2024 16:10:09 +0200 -Subject: [PATCH 3/6] nss_dp_main: swap dp_exit function call - -First unregister nss_dp platform devices then cleanup the HAL. - -This is to fix kernel panic by cleaning data that needs to be used by -platform driver unregister functions. - -Signed-off-by: Christian Marangi ---- - nss_dp_main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -1161,6 +1161,8 @@ int __init nss_dp_init(void) - */ - void __exit nss_dp_exit(void) - { -+ platform_driver_unregister(&nss_dp_drv); -+ - /* - * TODO Move this to soc_ops - */ -@@ -1168,8 +1170,6 @@ void __exit nss_dp_exit(void) - nss_dp_hal_cleanup(); - dp_global_ctx.common_init_done = false; - } -- -- platform_driver_unregister(&nss_dp_drv); - } - - module_init(nss_dp_init); diff --git a/package/kernel/qca-nss-dp/patches/0011-04-nss_dp_main-call-unregister_netdev-first-in-dp_remov.patch b/package/kernel/qca-nss-dp/patches/0011-04-nss_dp_main-call-unregister_netdev-first-in-dp_remov.patch deleted file mode 100644 index f8daa525fe..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-04-nss_dp_main-call-unregister_netdev-first-in-dp_remov.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 33dd3aa6d0f9cd240d63f53a49157ae44ebccf87 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 16 Apr 2024 16:12:11 +0200 -Subject: [PATCH 4/6] nss_dp_main: call unregister_netdev first in dp_remove - and carrifer_off - -In dp_remove move unregister_netdev up before calling exit and deinit -and first call netif_carrier_off to stop any traffic from happening and -prevent kernel panics for napi in the middle of transfer. - -Signed-off-by: Christian Marangi ---- - nss_dp_main.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -977,6 +977,9 @@ static int nss_dp_remove(struct platform - dp_ops = dp_priv->data_plane_ops; - hal_ops = dp_priv->gmac_hal_ops; - -+ netif_carrier_off(dp_priv->netdev); -+ unregister_netdev(dp_priv->netdev); -+ - if (dp_priv->phydev) - phy_disconnect(dp_priv->phydev); - -@@ -988,7 +991,6 @@ static int nss_dp_remove(struct platform - #endif - hal_ops->exit(dp_priv->gmac_hal_ctx); - dp_ops->deinit(dp_priv->dpc); -- unregister_netdev(dp_priv->netdev); - free_netdev(dp_priv->netdev); - dp_global_ctx.nss_dp[i] = NULL; - } diff --git a/package/kernel/qca-nss-dp/patches/0011-05-nss_dp_main-use-phy_detach-instead-of-disconnect-in-.patch b/package/kernel/qca-nss-dp/patches/0011-05-nss_dp_main-use-phy_detach-instead-of-disconnect-in-.patch deleted file mode 100644 index 1633e009ea..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-05-nss_dp_main-use-phy_detach-instead-of-disconnect-in-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 655b07b701271bc00952fe64aeb14f993a48a50e Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 16 Apr 2024 16:17:36 +0200 -Subject: [PATCH 5/6] nss_dp_main: use phy_detach instead of disconnect in - dp_remove - -Use phy_detach instead of disconnect in dp_remove. On Module remove, phy -are already disconnected but they need to be detached to be correctly -reattached later with an insmod. - -Signed-off-by: Christian Marangi ---- - nss_dp_main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/nss_dp_main.c -+++ b/nss_dp_main.c -@@ -981,7 +981,7 @@ static int nss_dp_remove(struct platform - unregister_netdev(dp_priv->netdev); - - if (dp_priv->phydev) -- phy_disconnect(dp_priv->phydev); -+ phy_detach(dp_priv->phydev); - - #if defined(NSS_DP_PPE_SUPPORT) - /* diff --git a/package/kernel/qca-nss-dp/patches/0011-06-edma_v1-skip-edma_disable_port-in-edma_cleanup-subse.patch b/package/kernel/qca-nss-dp/patches/0011-06-edma_v1-skip-edma_disable_port-in-edma_cleanup-subse.patch deleted file mode 100644 index ad784e557f..0000000000 --- a/package/kernel/qca-nss-dp/patches/0011-06-edma_v1-skip-edma_disable_port-in-edma_cleanup-subse.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c7c59c6097d94dbab8fc68dae798017bdbc5b3b9 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 16 Apr 2024 16:22:32 +0200 -Subject: [PATCH 6/6] edma_v1: skip edma_disable_port in edma_cleanup - subsequent run - -Skip edma_disable_port in edma_cleanup subsequent run as it will cause -the kernel panic as the regs are already freed by previous run of -edma_cleanup. It's use it's not clear but the call is already done in -the first run of edma_cleanup. Maybe an oversight never dropped? - -Signed-off-by: Christian Marangi ---- - hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - ---- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c -@@ -326,9 +326,15 @@ void edma_cleanup(bool is_dp_override) - * Disable EDMA only at module exit time, since NSS firmware - * depends on this setting. - */ -- if (!is_dp_override) { -- edma_disable_port(); -- } -+ /* This call will make the kernel panic as reg used by -+ * edma_disable_port are already freed by previous call of -+ * edma_cleanup. Logic is not clear of WHY this is called. -+ * Keep this here for reference if someone EVER wants -+ * to investigate. -+ */ -+ // if (!is_dp_override) { -+ // edma_disable_port(); -+ // } - return; - } - diff --git a/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch b/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch index 882bc8cad9..654f6ef99f 100644 --- a/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch +++ b/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch @@ -16,11 +16,9 @@ Signed-off-by: George Moussalem hal/dp_ops/syn_gmac_dp/syn_dp_tx.c | 23 ++++--------- 4 files changed, 42 insertions(+), 44 deletions(-) -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c -index 8cbbcaaf..1c9006c7 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c -@@ -26,6 +26,7 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info) +@@ -26,6 +26,7 @@ static int syn_dp_cfg_rx_setup_desc_queu { struct syn_dp_info_rx *rx_info = &dev_info->dp_info_rx; struct dma_desc_rx *first_desc = NULL; @@ -28,7 +26,7 @@ index 8cbbcaaf..1c9006c7 100644 struct net_device *netdev = rx_info->netdev; netdev_dbg(netdev, "Total size of memory required for Rx Descriptors in Ring Mode = %u\n", (uint32_t)((sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE))); -@@ -33,13 +34,15 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info) +@@ -33,13 +34,15 @@ static int syn_dp_cfg_rx_setup_desc_queu /* * Allocate cacheable descriptors for Rx */ @@ -46,7 +44,7 @@ index 8cbbcaaf..1c9006c7 100644 rx_info->rx_desc = first_desc; syn_dp_gmac_rx_desc_init_ring(rx_info->rx_desc, SYN_DP_RX_DESC_SIZE); -@@ -98,6 +101,10 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info) +@@ -98,6 +101,10 @@ void syn_dp_cfg_rx_cleanup_rings(struct for (i = 0; i < rx_info->busy_rx_desc_cnt; i++) { rx_skb_index = (rx_skb_index + i) & SYN_DP_RX_DESC_MAX_INDEX; rxdesc = rx_info->rx_desc; @@ -57,7 +55,7 @@ index 8cbbcaaf..1c9006c7 100644 skb = rx_info->rx_buf_pool[rx_skb_index].skb; if (unlikely(skb != NULL)) { dev_kfree_skb_any(skb); -@@ -105,7 +112,8 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info) +@@ -105,7 +112,8 @@ void syn_dp_cfg_rx_cleanup_rings(struct } } @@ -67,11 +65,9 @@ index 8cbbcaaf..1c9006c7 100644 rx_info->rx_desc = NULL; dev_info->rx_desc_dma_addr = (dma_addr_t)0; } -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c -index bf5e19a0..284e8880 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c -@@ -91,6 +91,8 @@ void syn_dp_cfg_tx_cleanup_rings(struct syn_dp_info *dev_info) +@@ -91,6 +91,8 @@ void syn_dp_cfg_tx_cleanup_rings(struct tx_skb_index = syn_dp_tx_inc_index(tx_skb_index, i); txdesc = tx_info->tx_desc; @@ -80,11 +76,9 @@ index bf5e19a0..284e8880 100644 skb = tx_info->tx_buf_pool[tx_skb_index].skb; if (unlikely(skb != NULL)) { dev_kfree_skb_any(skb); -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c -index 1ddeb7d6..1798d4e7 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c -@@ -73,16 +73,6 @@ static inline void syn_dp_rx_refill_one_desc(struct dma_desc_rx *rx_desc, +@@ -73,16 +73,6 @@ static inline void syn_dp_rx_refill_one_ */ static inline void syn_dp_rx_inval_and_flush(struct syn_dp_info_rx *rx_info, uint32_t start, uint32_t end) { @@ -101,7 +95,7 @@ index 1ddeb7d6..1798d4e7 100644 dsb(st); } -@@ -124,15 +114,19 @@ int syn_dp_rx_refill_page_mode(struct syn_dp_info_rx *rx_info) +@@ -124,15 +114,19 @@ int syn_dp_rx_refill_page_mode(struct sy break; } @@ -125,7 +119,7 @@ index 1ddeb7d6..1798d4e7 100644 rx_refill_idx = rx_info->rx_refill_idx; rx_desc = rx_info->rx_desc + rx_refill_idx; -@@ -181,8 +175,15 @@ int syn_dp_rx_refill(struct syn_dp_info_rx *rx_info) +@@ -181,8 +175,15 @@ int syn_dp_rx_refill(struct syn_dp_info_ skb_reserve(skb, SYN_DP_SKB_HEADROOM + NET_IP_ALIGN); @@ -143,7 +137,7 @@ index 1ddeb7d6..1798d4e7 100644 rx_refill_idx = rx_info->rx_refill_idx; rx_desc = rx_info->rx_desc + rx_refill_idx; -@@ -407,12 +408,6 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget) +@@ -407,12 +408,6 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_ * this code is executing. */ end = syn_dp_rx_inc_index(rx_info->rx_idx, busy); @@ -156,7 +150,7 @@ index 1ddeb7d6..1798d4e7 100644 dsb(st); -@@ -439,8 +434,12 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget) +@@ -439,8 +434,12 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_ * speculative prefetch by CPU may have occurred. */ frame_length = syn_dp_gmac_get_rx_desc_frame_length(status); @@ -171,11 +165,9 @@ index 1ddeb7d6..1798d4e7 100644 prefetch((void *)rx_buf->map_addr_virt); rx_next_idx = syn_dp_rx_inc_index(rx_idx, 1); -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c -index c97e252b..6d4adb3f 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c -@@ -104,9 +104,7 @@ static inline struct dma_desc_tx *syn_dp_tx_process_nr_frags(struct syn_dp_info_ +@@ -104,9 +104,7 @@ static inline struct dma_desc_tx *syn_dp BUG_ON(!length); #endif @@ -186,7 +178,7 @@ index c97e252b..6d4adb3f 100644 *total_length += length; tx_desc = syn_dp_tx_set_desc_sg(tx_info, dma_addr, length, DESC_OWN_BY_DMA); -@@ -150,8 +148,7 @@ int syn_dp_tx_nr_frags(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -150,8 +148,7 @@ int syn_dp_tx_nr_frags(struct syn_dp_inf /* * Flush the dma for non-paged skb data */ @@ -196,7 +188,7 @@ index c97e252b..6d4adb3f 100644 total_len = length; -@@ -256,12 +253,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -256,12 +253,7 @@ int syn_dp_tx_frag_list(struct syn_dp_in return NETDEV_TX_BUSY; } @@ -210,7 +202,7 @@ index c97e252b..6d4adb3f 100644 total_len = length; -@@ -290,9 +282,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -290,9 +282,7 @@ int syn_dp_tx_frag_list(struct syn_dp_in BUG_ON(!length); #endif @@ -221,7 +213,7 @@ index c97e252b..6d4adb3f 100644 total_len += length; -@@ -445,6 +435,7 @@ int syn_dp_tx_complete(struct syn_dp_info_tx *tx_info, int budget) +@@ -445,6 +435,7 @@ int syn_dp_tx_complete(struct syn_dp_inf break; } @@ -229,7 +221,7 @@ index c97e252b..6d4adb3f 100644 if (likely(status & DESC_TX_LAST)) { tx_skb_index = syn_dp_tx_comp_index_get(tx_info); -@@ -571,9 +562,7 @@ int syn_dp_tx(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -571,9 +562,7 @@ int syn_dp_tx(struct syn_dp_info_tx *tx_ return NETDEV_TX_BUSY; } @@ -240,6 +232,3 @@ index c97e252b..6d4adb3f 100644 /* * Queue packet to the GMAC rings --- -2.40.1 - diff --git a/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch b/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch index 10a8eef6da..25fef48fce 100644 --- a/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch +++ b/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch @@ -13,8 +13,6 @@ Signed-off-by: George Moussalem hal/soc_ops/ipq50xx/nss_ipq50xx.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -diff --git a/hal/soc_ops/ipq50xx/nss_ipq50xx.c b/hal/soc_ops/ipq50xx/nss_ipq50xx.c -index 3e4491c0..e56de1cc 100644 --- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c +++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c @@ -18,7 +18,7 @@ @@ -41,6 +39,3 @@ index 3e4491c0..e56de1cc 100644 if (err) { pr_err("%s: SCM TCSR write error: %d\n", __func__, err); } --- -2.40.1 - diff --git a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch index 668046881a..37504b87a8 100644 --- a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch +++ b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch @@ -16,11 +16,9 @@ Signed-off-by: George Moussalem nss_dp_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) -diff --git a/nss_dp_main.c b/nss_dp_main.c -index 9a09edd5..204063bf 100644 --- a/nss_dp_main.c +++ b/nss_dp_main.c -@@ -619,11 +619,20 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np, +@@ -662,11 +662,20 @@ static int32_t nss_dp_of_get_pdata(struc } dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0); @@ -44,6 +42,3 @@ index 9a09edd5..204063bf 100644 if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) { pr_err("%s: error reading mactype\n", np->name); return -EFAULT; --- -2.40.1 - From e1acc7a67b92fa964710afe0a3ae2dad5c1f00c7 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Tue, 25 Feb 2025 17:22:01 +0100 Subject: [PATCH 03/11] Revert "tools/autoconf-archive: bump to 2024.10.16" This reverts commit bbb3b985b036193d814e9742d07143330d19a71a. LuaJIT support that is included in 2024.10.16 was supposed to be optional but unfortunately, it seems that there is a bug[1] and its now breaking FRR host builds and more. So, revert the update for now. [1] https://lists.gnu.org/archive/html/autoconf-archive-maintainers/2024-11/msg00000.html Signed-off-by: Robert Marko --- tools/autoconf-archive/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/autoconf-archive/Makefile b/tools/autoconf-archive/Makefile index a0c75c1dca..a4ab423779 100644 --- a/tools/autoconf-archive/Makefile +++ b/tools/autoconf-archive/Makefile @@ -1,11 +1,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=autoconf-archive -PKG_VERSION:=2024.10.16 +PKG_VERSION:=2023.02.20 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GNU/autoconf-archive -PKG_HASH:=7bcd5d001916f3a50ed7436f4f700e3d2b1bade3ed803219c592d62502a57363 +PKG_HASH:=71d4048479ae28f1f5794619c3d72df9c01df49b1c628ef85fde37596dc31a33 include $(INCLUDE_DIR)/host-build.mk From 024e9dbace4aa41d713259e1e3c67538d425d577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Wed, 5 Feb 2025 07:27:02 +0100 Subject: [PATCH 04/11] realtek: dsa: silence log noise on route offload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding a static IPv4 route made the driver repeatedly print rtl83xx_l3_nexthop_update: Setting up fwding: ip 192.168.1.42, GW mac 0000001b21a7xxxx Route with id 3 to 192.168.99.0 / 24 rtl83xx_l3_nexthop_update: total packets: 0 Warning: TEMPLATE_FIELD_RANGE_CHK: not configured These messages are only useful to developers while debugging offloading. Demote to debug level, which in general is more useful for developers by allowing precise dynamic control. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- .../realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c | 6 +++--- .../realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c | 2 +- .../realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c index fe0980a1be..28b836f6b2 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c @@ -813,12 +813,12 @@ static int rtl83xx_l3_nexthop_update(struct rtl838x_switch_priv *priv, __be32 i } rhl_for_each_entry_rcu(r, tmp, list, linkage) { - pr_info("%s: Setting up fwding: ip %pI4, GW mac %016llx\n", + pr_debug("%s: Setting up fwding: ip %pI4, GW mac %016llx\n", __func__, &ip_addr, mac); /* Reads the ROUTING table entry associated with the route */ priv->r->route_read(r->id, r); - pr_info("Route with id %d to %pI4 / %d\n", r->id, &r->dst_ip, r->prefix_len); + pr_debug("Route with id %d to %pI4 / %d\n", r->id, &r->dst_ip, r->prefix_len); r->nh.mac = r->nh.gw = mac; r->nh.port = priv->port_ignore; @@ -865,7 +865,7 @@ static int rtl83xx_l3_nexthop_update(struct rtl838x_switch_priv *priv, __be32 i priv->r->pie_rule_add(priv, &r->pr); } else { int pkts = priv->r->packet_cntr_read(r->pr.packet_cntr); - pr_info("%s: total packets: %d\n", __func__, pkts); + pr_debug("%s: total packets: %d\n", __func__, pkts); priv->r->pie_rule_write(priv, r->pr.id, &r->pr); } diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c index 793d762489..3524021e2f 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c @@ -1680,7 +1680,7 @@ static void rtl930x_write_pie_templated(u32 r[], struct pie_rule *pr, enum templ data_m = pr->tcp_info_m; break; case TEMPLATE_FIELD_RANGE_CHK: - pr_warn("Warning: TEMPLATE_FIELD_RANGE_CHK: not configured\n"); + pr_debug("TEMPLATE_FIELD_RANGE_CHK: not configured\n"); break; default: pr_info("%s: unknown field %d\n", __func__, field_type); diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c index 2ba3a7819d..870dbde7a6 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c @@ -1077,10 +1077,10 @@ int rtl931x_pie_data_fill(enum template_field_id field_type, struct pie_rule *pr *data_m = pr->tcp_info_m; break; case TEMPLATE_FIELD_RANGE_CHK: - pr_info("TEMPLATE_FIELD_RANGE_CHK: not configured\n"); + pr_debug("TEMPLATE_FIELD_RANGE_CHK: not configured\n"); break; default: - pr_info("%s: unknown field %d\n", __func__, field_type); + pr_debug("%s: unknown field %d\n", __func__, field_type); return -1; } From d5dcb889066bb6189fe7d3a304c6b6b9e1b5bae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Tue, 4 Feb 2025 08:43:58 +0100 Subject: [PATCH 05/11] realtek: dsa: silence debug log noise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The log noise emmitted by this driver is overwhelming, even for developers looking at specific issues. Demoting to debug allows individual messages to be dynamically enabled instead. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- .../drivers/net/dsa/rtl83xx/rtl838x.c | 32 +++---- .../drivers/net/dsa/rtl83xx/rtl839x.c | 38 ++++---- .../drivers/net/dsa/rtl83xx/rtl930x.c | 92 +++++++++---------- .../drivers/net/dsa/rtl83xx/rtl931x.c | 66 ++++++------- 4 files changed, 114 insertions(+), 114 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.c index d93087f5b1..f290e768de 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl838x.c @@ -654,7 +654,7 @@ static int rtl838x_eee_port_ability(struct rtl838x_switch_priv *priv, static void rtl838x_init_eee(struct rtl838x_switch_priv *priv, bool enable) { - pr_info("Setting up EEE, state: %d\n", enable); + pr_debug("Setting up EEE, state: %d\n", enable); sw_w32_mask(0x4, 0, RTL838X_SMI_GLB_CTRL); /* Set timers for EEE */ @@ -859,7 +859,7 @@ static void rtl838x_write_pie_templated(u32 r[], struct pie_rule *pr, enum templ data_m = pr->icmp_igmp_m; break; default: - pr_info("%s: unknown field %d\n", __func__, field_type); + pr_debug("%s: unknown field %d\n", __func__, field_type); continue; } if (!(i % 2)) { @@ -1012,7 +1012,7 @@ static void rtl838x_read_pie_templated(u32 r[], struct pie_rule *pr, enum templa pr->icmp_igmp_m = data_m; break; default: - pr_info("%s: unknown field %d\n", __func__, field_type); + pr_debug("%s: unknown field %d\n", __func__, field_type); } } } @@ -1292,24 +1292,24 @@ static void rtl838x_read_pie_action(u32 r[], struct pie_rule *pr) static void rtl838x_pie_rule_dump_raw(u32 r[]) { - pr_info("Raw IACL table entry:\n"); - pr_info("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); - pr_info("Fixed : %08x\n", r[6]); - pr_info("Match M: %08x %08x %08x %08x %08x %08x\n", r[7], r[8], r[9], r[10], r[11], r[12]); - pr_info("Fixed M: %08x\n", r[13]); - pr_info("AIF : %08x %08x %08x\n", r[14], r[15], r[16]); - pr_info("Sel : %08x\n", r[17]); + pr_debug("Raw IACL table entry:\n"); + pr_debug("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); + pr_debug("Fixed : %08x\n", r[6]); + pr_debug("Match M: %08x %08x %08x %08x %08x %08x\n", r[7], r[8], r[9], r[10], r[11], r[12]); + pr_debug("Fixed M: %08x\n", r[13]); + pr_debug("AIF : %08x %08x %08x\n", r[14], r[15], r[16]); + pr_debug("Sel : %08x\n", r[17]); } // Currently not used // static void rtl838x_pie_rule_dump(struct pie_rule *pr) // { -// pr_info("Drop: %d, fwd: %d, ovid: %d, ivid: %d, flt: %d, log: %d, rmk: %d, meter: %d tagst: %d, mir: %d, nopri: %d, cpupri: %d, otpid: %d, itpid: %d, shape: %d\n", +// pr_debug("Drop: %d, fwd: %d, ovid: %d, ivid: %d, flt: %d, log: %d, rmk: %d, meter: %d tagst: %d, mir: %d, nopri: %d, cpupri: %d, otpid: %d, itpid: %d, shape: %d\n", // pr->drop, pr->fwd_sel, pr->ovid_sel, pr->ivid_sel, pr->flt_sel, pr->log_sel, pr->rmk_sel, pr->log_sel, pr->tagst_sel, pr->mir_sel, pr->nopri_sel, // pr->cpupri_sel, pr->otpid_sel, pr->itpid_sel, pr->shaper_sel); // if (pr->fwd_sel) -// pr_info("FWD: %08x\n", pr->fwd_data); -// pr_info("TID: %x, %x\n", pr->tid, pr->tid_m); +// pr_debug("FWD: %08x\n", pr->fwd_data); +// pr_debug("TID: %x, %x\n", pr->tid, pr->tid_m); // } static int rtl838x_pie_rule_read(struct rtl838x_switch_priv *priv, int idx, struct pie_rule *pr) @@ -1331,7 +1331,7 @@ static int rtl838x_pie_rule_read(struct rtl838x_switch_priv *priv, int idx, stru if (!pr->valid) return 0; - pr_info("%s: template_selectors %08x, tid: %d\n", __func__, t_select, pr->tid); + pr_debug("%s: template_selectors %08x, tid: %d\n", __func__, t_select, pr->tid); rtl838x_pie_rule_dump_raw(r); rtl838x_read_pie_templated(r, pr, fixed_templates[(t_select >> (pr->tid * 3)) & 0x7]); @@ -1783,7 +1783,7 @@ irqreturn_t rtl838x_switch_irq(int irq, void *dev_id) /* Clear status */ sw_w32(ports, RTL838X_ISR_PORT_LINK_STS_CHG); - pr_info("RTL8380 Link change: status: %x, ports %x\n", status, ports); + pr_debug("RTL8380 Link change: status: %x, ports %x\n", status, ports); for (int i = 0; i < 28; i++) { if (ports & BIT(i)) { @@ -2001,7 +2001,7 @@ void rtl838x_vlan_profile_dump(int profile) p = sw_r32(RTL838X_VLAN_PROFILE(profile)); - pr_info("VLAN profile %d: L2 learning: %d, UNKN L2MC FLD PMSK %d, \ + pr_debug("VLAN profile %d: L2 learning: %d, UNKN L2MC FLD PMSK %d, \ UNKN IPMC FLD PMSK %d, UNKN IPv6MC FLD PMSK: %d", profile, p & 1, (p >> 1) & 0x1ff, (p >> 10) & 0x1ff, (p >> 19) & 0x1ff); } diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c index ecf291f866..09422f68e2 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c @@ -362,7 +362,7 @@ static void rtl839x_fill_l2_entry(u32 r[], struct rtl838x_l2_entry *e) e->valid = true; e->type = IP6_MULTICAST; } - /* pr_info("%s: vid %d, rvid: %d\n", __func__, e->vid, e->rvid); */ + /* pr_debug("%s: vid %d, rvid: %d\n", __func__, e->vid, e->rvid); */ } /* Fills the 3 SoC table registers r[] with the information in the rtl838x_l2_entry */ @@ -814,7 +814,7 @@ void rtl8390_get_version(struct rtl838x_switch_priv *priv) model = sw_r32(RTL839X_MODEL_NAME_INFO); priv->version = RTL8390_VERSION_A + ((model & 0x3f) >> 1); - pr_info("RTL839X Chip-Info: %x, version %c\n", info, priv->version); + pr_debug("RTL839X Chip-Info: %x, version %c\n", info, priv->version); } void rtl839x_vlan_profile_dump(int profile) @@ -827,11 +827,11 @@ void rtl839x_vlan_profile_dump(int profile) p[0] = sw_r32(RTL839X_VLAN_PROFILE(profile)); p[1] = sw_r32(RTL839X_VLAN_PROFILE(profile) + 4); - pr_info("VLAN profile %d: L2 learning: %d, UNKN L2MC FLD PMSK %d, \ + pr_debug("VLAN profile %d: L2 learning: %d, UNKN L2MC FLD PMSK %d, \ UNKN IPMC FLD PMSK %d, UNKN IPv6MC FLD PMSK: %d", profile, p[1] & 1, (p[1] >> 1) & 0xfff, (p[1] >> 13) & 0xfff, (p[0]) & 0xfff); - pr_info("VLAN profile %d: raw %08x, %08x\n", profile, p[0], p[1]); + pr_debug("VLAN profile %d: raw %08x, %08x\n", profile, p[0], p[1]); } static void rtl839x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, u32 port_state[]) @@ -899,7 +899,7 @@ int rtl839x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_ee e->advertised |= ADVERTISED_1000baseT_Full; a = rtl839x_get_port_reg_le(RTL839X_MAC_EEE_ABLTY); - pr_info("Link partner: %016llx\n", a); + pr_debug("Link partner: %016llx\n", a); if (rtl839x_get_port_reg_le(RTL839X_MAC_EEE_ABLTY) & BIT_ULL(port)) { e->lp_advertised = ADVERTISED_100baseT_Full; e->lp_advertised |= ADVERTISED_1000baseT_Full; @@ -911,7 +911,7 @@ int rtl839x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_ee static void rtl839x_init_eee(struct rtl838x_switch_priv *priv, bool enable) { - pr_info("Setting up EEE, state: %d\n", enable); + pr_debug("Setting up EEE, state: %d\n", enable); /* Set wake timer for TX and pause timer both to 0x21 */ sw_w32_mask(0xff << 20| 0xff, 0x21 << 20| 0x21, RTL839X_EEE_TX_TIMER_GELITE_CTRL); @@ -1105,7 +1105,7 @@ static void rtl839x_write_pie_templated(u32 r[], struct pie_rule *pr, enum templ data_m = pr->icmp_igmp_m; break; default: - pr_info("%s: unknown field %d\n", __func__, field_type); + pr_debug("%s: unknown field %d\n", __func__, field_type); } /* On the RTL8390, the mask fields are not word aligned! */ @@ -1259,7 +1259,7 @@ void rtl839x_read_pie_templated(u32 r[], struct pie_rule *pr, enum template_fiel pr->icmp_igmp_m = data_m; break; default: - pr_info("%s: unknown field %d\n", __func__, field_type); + pr_debug("%s: unknown field %d\n", __func__, field_type); } } } @@ -1402,27 +1402,27 @@ static void rtl839x_read_pie_action(u32 r[], struct pie_rule *pr) void rtl839x_pie_rule_dump_raw(u32 r[]) { - pr_info("Raw IACL table entry:\n"); - pr_info("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); - pr_info("Fixed : %06x\n", r[6] >> 8); - pr_info("Match M: %08x %08x %08x %08x %08x %08x\n", + pr_debug("Raw IACL table entry:\n"); + pr_debug("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); + pr_debug("Fixed : %06x\n", r[6] >> 8); + pr_debug("Match M: %08x %08x %08x %08x %08x %08x\n", (r[6] << 24) | (r[7] >> 8), (r[7] << 24) | (r[8] >> 8), (r[8] << 24) | (r[9] >> 8), (r[9] << 24) | (r[10] >> 8), (r[10] << 24) | (r[11] >> 8), (r[11] << 24) | (r[12] >> 8)); - pr_info("R[13]: %08x\n", r[13]); - pr_info("Fixed M: %06x\n", ((r[12] << 16) | (r[13] >> 16)) & 0xffffff); - pr_info("Valid / not / and1 / and2 : %1x\n", (r[13] >> 12) & 0xf); - pr_info("r 13-16: %08x %08x %08x %08x\n", r[13], r[14], r[15], r[16]); + pr_debug("R[13]: %08x\n", r[13]); + pr_debug("Fixed M: %06x\n", ((r[12] << 16) | (r[13] >> 16)) & 0xffffff); + pr_debug("Valid / not / and1 / and2 : %1x\n", (r[13] >> 12) & 0xf); + pr_debug("r 13-16: %08x %08x %08x %08x\n", r[13], r[14], r[15], r[16]); } void rtl839x_pie_rule_dump(struct pie_rule *pr) { - pr_info("Drop: %d, fwd: %d, ovid: %d, ivid: %d, flt: %d, log: %d, rmk: %d, meter: %d tagst: %d, mir: %d, nopri: %d, cpupri: %d, otpid: %d, itpid: %d, shape: %d\n", + pr_debug("Drop: %d, fwd: %d, ovid: %d, ivid: %d, flt: %d, log: %d, rmk: %d, meter: %d tagst: %d, mir: %d, nopri: %d, cpupri: %d, otpid: %d, itpid: %d, shape: %d\n", pr->drop, pr->fwd_sel, pr->ovid_sel, pr->ivid_sel, pr->flt_sel, pr->log_sel, pr->rmk_sel, pr->log_sel, pr->tagst_sel, pr->mir_sel, pr->nopri_sel, pr->cpupri_sel, pr->otpid_sel, pr->itpid_sel, pr->shaper_sel); if (pr->fwd_sel) - pr_info("FWD: %08x\n", pr->fwd_data); - pr_info("TID: %x, %x\n", pr->tid, pr->tid_m); + pr_debug("FWD: %08x\n", pr->fwd_data); + pr_debug("TID: %x, %x\n", pr->tid, pr->tid_m); } static int rtl839x_pie_rule_read(struct rtl838x_switch_priv *priv, int idx, struct pie_rule *pr) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c index 3524021e2f..d45d5911a5 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl930x.c @@ -233,14 +233,14 @@ void rtl930x_vlan_profile_dump(int profile) p[3] = sw_r32(RTL930X_VLAN_PROFILE_SET(profile) + 12) & 0x1FFFFFFF; p[4] = sw_r32(RTL930X_VLAN_PROFILE_SET(profile) + 16) & 0x1FFFFFFF; - pr_info("VLAN %d: L2 learn: %d; Unknown MC PMasks: L2 %0x, IPv4 %0x, IPv6: %0x", + pr_debug("VLAN %d: L2 learn: %d; Unknown MC PMasks: L2 %0x, IPv4 %0x, IPv6: %0x", profile, p[0] & (3 << 21), p[2], p[3], p[4]); - pr_info(" Routing enabled: IPv4 UC %c, IPv6 UC %c, IPv4 MC %c, IPv6 MC %c\n", + pr_debug(" Routing enabled: IPv4 UC %c, IPv6 UC %c, IPv4 MC %c, IPv6 MC %c\n", p[0] & BIT(17) ? 'y' : 'n', p[0] & BIT(16) ? 'y' : 'n', p[0] & BIT(13) ? 'y' : 'n', p[0] & BIT(12) ? 'y' : 'n'); - pr_info(" Bridge enabled: IPv4 MC %c, IPv6 MC %c,\n", + pr_debug(" Bridge enabled: IPv4 MC %c, IPv6 MC %c,\n", p[0] & BIT(15) ? 'y' : 'n', p[0] & BIT(14) ? 'y' : 'n'); - pr_info("VLAN profile %d: raw %08x %08x %08x %08x %08x\n", + pr_debug("VLAN profile %d: raw %08x %08x %08x %08x %08x\n", profile, p[0], p[1], p[2], p[3], p[4]); } @@ -267,7 +267,7 @@ static void rtl930x_vlan_profile_setup(int profile) { u32 p[5]; - pr_info("In %s\n", __func__); + pr_debug("In %s\n", __func__); p[0] = sw_r32(RTL930X_VLAN_PROFILE_SET(profile)); p[1] = sw_r32(RTL930X_VLAN_PROFILE_SET(profile) + 4); @@ -684,15 +684,15 @@ void rtl9300_dump_debug(void) u16 r = RTL930X_STAT_PRVTE_DROP_COUNTER0; for (int i = 0; i < 10; i ++) { - pr_info("# %d %08x %08x %08x %08x %08x %08x %08x %08x\n", i * 8, + pr_debug("# %d %08x %08x %08x %08x %08x %08x %08x %08x\n", i * 8, sw_r32(r), sw_r32(r + 4), sw_r32(r + 8), sw_r32(r + 12), sw_r32(r + 16), sw_r32(r + 20), sw_r32(r + 24), sw_r32(r + 28)); r += 32; } - pr_info("# %08x %08x %08x %08x %08x\n", + pr_debug("# %08x %08x %08x %08x %08x\n", sw_r32(r), sw_r32(r + 4), sw_r32(r + 8), sw_r32(r + 12), sw_r32(r + 16)); rtl930x_print_matrix(); - pr_info("RTL930X_L2_PORT_SABLK_CTRL: %08x, RTL930X_L2_PORT_DABLK_CTRL %08x\n", + pr_debug("RTL930X_L2_PORT_SABLK_CTRL: %08x, RTL930X_L2_PORT_DABLK_CTRL %08x\n", sw_r32(RTL930X_L2_PORT_SABLK_CTRL), sw_r32(RTL930X_L2_PORT_DABLK_CTRL) ); @@ -921,13 +921,13 @@ int rtl930x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_ee if (port >= 26) return -ENOTSUPP; - pr_info("In %s, port %d\n", __func__, port); + pr_debug("In %s, port %d\n", __func__, port); link = sw_r32(RTL930X_MAC_LINK_STS); link = sw_r32(RTL930X_MAC_LINK_STS); if (!(link & BIT(port))) return 0; - pr_info("Setting advertised\n"); + pr_debug("Setting advertised\n"); if (sw_r32(rtl930x_mac_force_mode_ctrl(port)) & BIT(10)) e->advertised |= ADVERTISED_100baseT_Full; @@ -935,7 +935,7 @@ int rtl930x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_ee e->advertised |= ADVERTISED_1000baseT_Full; if (priv->ports[port].is2G5 && sw_r32(rtl930x_mac_force_mode_ctrl(port)) & BIT(13)) { - pr_info("ADVERTISING 2.5G EEE\n"); + pr_debug("ADVERTISING 2.5G EEE\n"); e->advertised |= ADVERTISED_2500baseX_Full; } @@ -944,7 +944,7 @@ int rtl930x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_ee a = sw_r32(RTL930X_MAC_EEE_ABLTY); a = sw_r32(RTL930X_MAC_EEE_ABLTY); - pr_info("Link partner: %08x\n", a); + pr_debug("Link partner: %08x\n", a); if (a & BIT(port)) { e->lp_advertised = ADVERTISED_100baseT_Full; e->lp_advertised |= ADVERTISED_1000baseT_Full; @@ -957,14 +957,14 @@ int rtl930x_eee_port_ability(struct rtl838x_switch_priv *priv, struct ethtool_ee /* Read 2x to clear latched state */ a = sw_r32(RTL930X_EEEP_PORT_CTRL(port)); a = sw_r32(RTL930X_EEEP_PORT_CTRL(port)); - pr_info("%s RTL930X_EEEP_PORT_CTRL: %08x\n", __func__, a); + pr_debug("%s RTL930X_EEEP_PORT_CTRL: %08x\n", __func__, a); return 0; } static void rtl930x_init_eee(struct rtl838x_switch_priv *priv, bool enable) { - pr_info("Setting up EEE, state: %d\n", enable); + pr_debug("Setting up EEE, state: %d\n", enable); /* Setup EEE on all ports */ for (int i = 0; i < priv->cpu_port; i++) { @@ -1079,13 +1079,13 @@ static void rtl930x_route_read(int idx, struct rtl83xx_route *rt) host_route = !!(v & BIT(21)); default_route = !!(v & BIT(20)); rt->prefix_len = -1; - pr_info("%s: host route %d, default_route %d\n", __func__, host_route, default_route); + pr_debug("%s: host route %d, default_route %d\n", __func__, host_route, default_route); switch (rt->attr.type) { case 0: /* IPv4 Unicast route */ rt->dst_ip = sw_r32(rtl_table_data(r, 4)); ip4_m = sw_r32(rtl_table_data(r, 9)); - pr_info("%s: Read ip4 mask: %08x\n", __func__, ip4_m); + pr_debug("%s: Read ip4 mask: %08x\n", __func__, ip4_m); rt->prefix_len = host_route ? 32 : -1; rt->prefix_len = (rt->prefix_len < 0 && default_route) ? 0 : -1; if (rt->prefix_len < 0) @@ -1118,11 +1118,11 @@ static void rtl930x_route_read(int idx, struct rtl83xx_route *rt) rt->attr.dst_null = !!(v & BIT(4)); rt->attr.qos_as = !!(v & BIT(3)); rt->attr.qos_prio = v & 0x7; - pr_info("%s: index %d is valid: %d\n", __func__, idx, rt->attr.valid); - pr_info("%s: next_hop: %d, hit: %d, action :%d, ttl_dec %d, ttl_check %d, dst_null %d\n", + pr_debug("%s: index %d is valid: %d\n", __func__, idx, rt->attr.valid); + pr_debug("%s: next_hop: %d, hit: %d, action :%d, ttl_dec %d, ttl_check %d, dst_null %d\n", __func__, rt->nh.id, rt->attr.hit, rt->attr.action, rt->attr.ttl_dec, rt->attr.ttl_check, rt->attr.dst_null); - pr_info("%s: GW: %pI4, prefix_len: %d\n", __func__, &rt->dst_ip, rt->prefix_len); + pr_debug("%s: GW: %pI4, prefix_len: %d\n", __func__, &rt->dst_ip, rt->prefix_len); out: rtl_table_release(r); } @@ -1267,7 +1267,7 @@ static int rtl930x_route_lookup_hw(struct rtl83xx_route *rt) sw_w32(0, RTL930X_L3_HW_LU_KEY_IP_CTRL + 4); sw_w32(0, RTL930X_L3_HW_LU_KEY_IP_CTRL + 8); v = rt->dst_ip & ip4_m; - pr_info("%s: searching for %pI4\n", __func__, &v); + pr_debug("%s: searching for %pI4\n", __func__, &v); sw_w32(v, RTL930X_L3_HW_LU_KEY_IP_CTRL + 12); } @@ -1279,7 +1279,7 @@ static int rtl930x_route_lookup_hw(struct rtl83xx_route *rt) v = sw_r32(RTL930X_L3_HW_LU_CTRL); } while (v & BIT(15)); - pr_info("%s: found: %d, index: %d\n", __func__, !!(v & BIT(14)), v & 0x1ff); + pr_debug("%s: found: %d, index: %d\n", __func__, !!(v & BIT(14)), v & 0x1ff); /* Test if search successful (BIT 14 set) */ if (v & BIT(14)) @@ -1460,7 +1460,7 @@ static void rtl930x_get_l3_nexthop(int idx, u16 *dmac_id, u16 *interface) // } // priv->intf_mtus[i] = mtu; -// pr_info("Writing MTU %d to slot %d\n", priv->intf_mtus[i], i); +// pr_debug("Writing MTU %d to slot %d\n", priv->intf_mtus[i], i); // /* Set MTU-value of the slot TODO: distinguish between IPv4/IPv6 routes / slots */ // sw_w32_mask(0xffff << ((i % 2) * 16), priv->intf_mtus[i] << ((i % 2) * 16), // RTL930X_L3_IP_MTU_CTRL(i)); @@ -1484,7 +1484,7 @@ static void rtl930x_get_l3_nexthop(int idx, u16 *dmac_id, u16 *interface) // intf->ip6_mtu = intf->ip6_mtu ? intf->ip6_mtu : intf->ip4_mtu; // mtu_id = rtl930x_l3_mtu_add(priv, intf->ip4_mtu); -// pr_info("%s: added mtu %d with mtu-id %d\n", __func__, intf->ip4_mtu, mtu_id); +// pr_debug("%s: added mtu %d with mtu-id %d\n", __func__, intf->ip4_mtu, mtu_id); // if (mtu_id < 0) // return -ENOSPC; // intf->ip4_mtu_id = mtu_id; @@ -1518,11 +1518,11 @@ static void rtl930x_set_l3_nexthop(int idx, u16 dmac_id, u16 interface) /* Access L3_NEXTHOP table (3) via register RTL9300_TBL_1 */ struct table_reg *r = rtl_table_get(RTL9300_TBL_1, 3); - pr_info("%s: Writing to L3_NEXTHOP table, index %d, dmac_id %d, interface %d\n", + pr_debug("%s: Writing to L3_NEXTHOP table, index %d, dmac_id %d, interface %d\n", __func__, idx, dmac_id, interface); sw_w32(((dmac_id & 0x7fff) << 7) | (interface & 0x7f), rtl_table_data(r, 0)); - pr_info("%s: %08x\n", __func__, sw_r32(rtl_table_data(r,0))); + pr_debug("%s: %08x\n", __func__, sw_r32(rtl_table_data(r,0))); rtl_table_write(r, idx); rtl_table_release(r); } @@ -1683,7 +1683,7 @@ static void rtl930x_write_pie_templated(u32 r[], struct pie_rule *pr, enum templ pr_debug("TEMPLATE_FIELD_RANGE_CHK: not configured\n"); break; default: - pr_info("%s: unknown field %d\n", __func__, field_type); + pr_debug("%s: unknown field %d\n", __func__, field_type); } /* On the RTL9300, the mask fields are not word aligned! */ @@ -1826,22 +1826,22 @@ static void rtl930x_write_pie_action(u32 r[], struct pie_rule *pr) void rtl930x_pie_rule_dump_raw(u32 r[]) { - pr_info("Raw IACL table entry:\n"); - pr_info("r 0 - 7: %08x %08x %08x %08x %08x %08x %08x %08x\n", + pr_debug("Raw IACL table entry:\n"); + pr_debug("r 0 - 7: %08x %08x %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]); - pr_info("r 8 - 15: %08x %08x %08x %08x %08x %08x %08x %08x\n", + pr_debug("r 8 - 15: %08x %08x %08x %08x %08x %08x %08x %08x\n", r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]); - pr_info("r 16 - 18: %08x %08x %08x\n", r[16], r[17], r[18]); - pr_info("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); - pr_info("Fixed : %06x\n", r[6] >> 8); - pr_info("Match M: %08x %08x %08x %08x %08x %08x\n", + pr_debug("r 16 - 18: %08x %08x %08x\n", r[16], r[17], r[18]); + pr_debug("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); + pr_debug("Fixed : %06x\n", r[6] >> 8); + pr_debug("Match M: %08x %08x %08x %08x %08x %08x\n", (r[6] << 24) | (r[7] >> 8), (r[7] << 24) | (r[8] >> 8), (r[8] << 24) | (r[9] >> 8), (r[9] << 24) | (r[10] >> 8), (r[10] << 24) | (r[11] >> 8), (r[11] << 24) | (r[12] >> 8)); - pr_info("R[13]: %08x\n", r[13]); - pr_info("Fixed M: %06x\n", ((r[12] << 16) | (r[13] >> 16)) & 0xffffff); - pr_info("Valid / not / and1 / and2 : %1x\n", (r[13] >> 12) & 0xf); - pr_info("r 13-16: %08x %08x %08x %08x\n", r[13], r[14], r[15], r[16]); + pr_debug("R[13]: %08x\n", r[13]); + pr_debug("Fixed M: %06x\n", ((r[12] << 16) | (r[13] >> 16)) & 0xffffff); + pr_debug("Valid / not / and1 / and2 : %1x\n", (r[13] >> 12) & 0xf); + pr_debug("r 13-16: %08x %08x %08x %08x\n", r[13], r[14], r[15], r[16]); } static int rtl930x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, struct pie_rule *pr) @@ -2018,7 +2018,7 @@ static void rtl930x_pie_init(struct rtl838x_switch_priv *priv) mutex_init(&priv->pie_mutex); - pr_info("%s\n", __func__); + pr_debug("%s\n", __func__); /* Enable ACL lookup on all ports, including CPU_PORT */ for (int i = 0; i <= priv->cpu_port; i++) sw_w32(1, RTL930X_ACL_PORT_LOOKUP_CTRL(i)); @@ -2082,7 +2082,7 @@ static void rtl930x_set_l3_egress_intf(int idx, struct rtl838x_l3_intf *intf) sw_w32(u, rtl_table_data(r, 0)); sw_w32(v, rtl_table_data(r, 1)); - pr_info("%s writing to index %d: %08x %08x\n", __func__, idx, u, v); + pr_debug("%s writing to index %d: %08x %08x\n", __func__, idx, u, v); rtl_table_write(r, idx & 0x7f); rtl_table_release(r); } @@ -2231,7 +2231,7 @@ int rtl930x_l3_setup(struct rtl838x_switch_priv *priv) sw_w32_mask(BIT(2), 0, RTL930X_L3_HOST_TBL_CTRL); /* Algorithm selection 0 = 0 */ sw_w32_mask(0, BIT(3), RTL930X_L3_HOST_TBL_CTRL); /* Algorithm selection 1 = 1 */ - pr_info("L3_IPUC_ROUTE_CTRL %08x, IPMC_ROUTE %08x, IP6UC_ROUTE %08x, IP6MC_ROUTE %08x\n", + pr_debug("L3_IPUC_ROUTE_CTRL %08x, IPMC_ROUTE %08x, IP6UC_ROUTE %08x, IP6MC_ROUTE %08x\n", sw_r32(RTL930X_L3_IPUC_ROUTE_CTRL), sw_r32(RTL930X_L3_IPMC_ROUTE_CTRL), sw_r32(RTL930X_L3_IP6UC_ROUTE_CTRL), sw_r32(RTL930X_L3_IP6MC_ROUTE_CTRL)); sw_w32_mask(0, 1, RTL930X_L3_IPUC_ROUTE_CTRL); @@ -2244,13 +2244,13 @@ int rtl930x_l3_setup(struct rtl838x_switch_priv *priv) sw_w32(0x00000501, RTL930X_L3_IPMC_ROUTE_CTRL); sw_w32(0x00012881, RTL930X_L3_IP6MC_ROUTE_CTRL); - pr_info("L3_IPUC_ROUTE_CTRL %08x, IPMC_ROUTE %08x, IP6UC_ROUTE %08x, IP6MC_ROUTE %08x\n", + pr_debug("L3_IPUC_ROUTE_CTRL %08x, IPMC_ROUTE %08x, IP6UC_ROUTE %08x, IP6MC_ROUTE %08x\n", sw_r32(RTL930X_L3_IPUC_ROUTE_CTRL), sw_r32(RTL930X_L3_IPMC_ROUTE_CTRL), sw_r32(RTL930X_L3_IP6UC_ROUTE_CTRL), sw_r32(RTL930X_L3_IP6MC_ROUTE_CTRL)); /* Trap non-ip traffic to the CPU-port (e.g. ARP so we stay reachable) */ sw_w32_mask(0x3 << 8, 0x1 << 8, RTL930X_L3_IP_ROUTE_CTRL); - pr_info("L3_IP_ROUTE_CTRL %08x\n", sw_r32(RTL930X_L3_IP_ROUTE_CTRL)); + pr_debug("L3_IP_ROUTE_CTRL %08x\n", sw_r32(RTL930X_L3_IP_ROUTE_CTRL)); /* PORT_ISO_RESTRICT_ROUTE_CTRL? */ @@ -2288,7 +2288,7 @@ static void rtl930x_packet_cntr_clear(int counter) /* Access LOG table (3) via register RTL9300_TBL_0 */ struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 3); - pr_info("In %s, id %d\n", __func__, counter); + pr_debug("In %s, id %d\n", __func__, counter); /* The table has a size of 2 registers */ if (counter % 2) sw_w32(0, rtl_table_data(r, 0)); @@ -2398,10 +2398,10 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv) struct device_node *node; u32 pm = 0; - pr_info("%s called\n", __func__); + pr_debug("%s called\n", __func__); node = of_find_compatible_node(NULL, NULL, "realtek,rtl9300-leds"); if (!node) { - pr_info("%s No compatible LED node found\n", __func__); + pr_debug("%s No compatible LED node found\n", __func__); return; } @@ -2475,7 +2475,7 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv) sw_w32(pm, RTL930X_LED_PORT_COMBO_MASK_CTRL); for (int i = 0; i < 24; i++) - pr_info("%s %08x: %08x\n",__func__, 0xbb00cc00 + i * 4, sw_r32(0xcc00 + i * 4)); + pr_debug("%s %08x: %08x\n",__func__, 0xbb00cc00 + i * 4, sw_r32(0xcc00 + i * 4)); } const struct rtl838x_reg rtl930x_reg = { diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c index 870dbde7a6..69f7c31653 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl931x.c @@ -151,7 +151,7 @@ void rtl931x_vlan_profile_dump(int index) profile[3] = (sw_r32(RTL931X_VLAN_PROFILE_SET(index) + 20) & 0x1FFFFFFFULL) << 32 | (sw_r32(RTL931X_VLAN_PROFILE_SET(index) + 24) & 0xFFFFFFFF); - pr_info("VLAN %d: L2 learning: %d, L2 Unknown MultiCast Field %llx, \ + pr_debug("VLAN %d: L2 learning: %d, L2 Unknown MultiCast Field %llx, \ IPv4 Unknown MultiCast Field %llx, IPv6 Unknown MultiCast Field: %llx", index, (u32) (profile[0] & (3 << 14)), profile[1], profile[2], profile[3]); } @@ -307,10 +307,10 @@ irqreturn_t rtl931x_switch_irq(int irq, void *dev_id) for (int i = 0; i < 56; i++) { if (ports & BIT_ULL(i)) { if (link & BIT_ULL(i)) { - pr_info("%s port %d up\n", __func__, i); + pr_debug("%s port %d up\n", __func__, i); dsa_port_phylink_mac_change(ds, i, true); } else { - pr_info("%s port %d down\n", __func__, i); + pr_debug("%s port %d down\n", __func__, i); dsa_port_phylink_mac_change(ds, i, false); } } @@ -467,9 +467,9 @@ void rtl931x_print_matrix(void) volatile u64 *ptr = RTL838X_SW_BASE + RTL839X_PORT_ISO_CTRL(0); for (int i = 0; i < 52; i += 4) - pr_info("> %16llx %16llx %16llx %16llx\n", + pr_debug("> %16llx %16llx %16llx %16llx\n", ptr[i + 0], ptr[i + 1], ptr[i + 2], ptr[i + 3]); - pr_info("CPU_PORT> %16llx\n", ptr[52]); + pr_debug("CPU_PORT> %16llx\n", ptr[52]); } void rtl931x_set_receive_management_action(int port, rma_ctrl_t type, action_type_t action) @@ -809,12 +809,12 @@ static void rtl931x_write_l2_entry_using_hash(u32 hash, u32 pos, struct rtl838x_ struct table_reg *q = rtl_table_get(RTL9310_TBL_0, 0); u32 idx = (0 << 14) | (hash << 2) | pos; /* Access SRAM, with hash and at pos in bucket */ - pr_info("%s: hash %d, pos %d\n", __func__, hash, pos); - pr_info("%s: index %d -> mac %02x:%02x:%02x:%02x:%02x:%02x\n", __func__, idx, + pr_debug("%s: hash %d, pos %d\n", __func__, hash, pos); + pr_debug("%s: index %d -> mac %02x:%02x:%02x:%02x:%02x:%02x\n", __func__, idx, e->mac[0], e->mac[1], e->mac[2], e->mac[3],e->mac[4],e->mac[5]); rtl931x_fill_l2_row(r, e); - pr_info("%s: %d: %08x %08x %08x\n", __func__, idx, r[0], r[1], r[2]); + pr_debug("%s: %d: %08x %08x %08x\n", __func__, idx, r[0], r[1], r[2]); for (int i = 0; i < 4; i++) sw_w32(r[i], rtl_table_data(q, i)); @@ -836,7 +836,7 @@ static void rtl931x_vlan_profile_setup(int profile) { u32 p[7]; - pr_info("In %s\n", __func__); + pr_debug("In %s\n", __func__); if (profile > 15) return; @@ -856,7 +856,7 @@ static void rtl931x_vlan_profile_setup(int profile) for (int i = 0; i < 7; i++) sw_w32(p[i], RTL931X_VLAN_PROFILE_SET(profile) + i * 4); - pr_info("Leaving %s\n", __func__); + pr_debug("Leaving %s\n", __func__); } static void rtl931x_l2_learning_setup(void) @@ -1235,22 +1235,22 @@ static void rtl931x_write_pie_action(u32 r[], struct pie_rule *pr) void rtl931x_pie_rule_dump_raw(u32 r[]) { - pr_info("Raw IACL table entry:\n"); - pr_info("r 0 - 7: %08x %08x %08x %08x %08x %08x %08x %08x\n", + pr_debug("Raw IACL table entry:\n"); + pr_debug("r 0 - 7: %08x %08x %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7]); - pr_info("r 8 - 15: %08x %08x %08x %08x %08x %08x %08x %08x\n", + pr_debug("r 8 - 15: %08x %08x %08x %08x %08x %08x %08x %08x\n", r[8], r[9], r[10], r[11], r[12], r[13], r[14], r[15]); - pr_info("r 16 - 18: %08x %08x %08x\n", r[16], r[17], r[18]); - pr_info("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); - pr_info("Fixed : %06x\n", r[6] >> 8); - pr_info("Match M: %08x %08x %08x %08x %08x %08x\n", + pr_debug("r 16 - 18: %08x %08x %08x\n", r[16], r[17], r[18]); + pr_debug("Match : %08x %08x %08x %08x %08x %08x\n", r[0], r[1], r[2], r[3], r[4], r[5]); + pr_debug("Fixed : %06x\n", r[6] >> 8); + pr_debug("Match M: %08x %08x %08x %08x %08x %08x\n", (r[6] << 24) | (r[7] >> 8), (r[7] << 24) | (r[8] >> 8), (r[8] << 24) | (r[9] >> 8), (r[9] << 24) | (r[10] >> 8), (r[10] << 24) | (r[11] >> 8), (r[11] << 24) | (r[12] >> 8)); - pr_info("R[13]: %08x\n", r[13]); - pr_info("Fixed M: %06x\n", ((r[12] << 16) | (r[13] >> 16)) & 0xffffff); - pr_info("Valid / not / and1 / and2 : %1x\n", (r[13] >> 12) & 0xf); - pr_info("r 13-16: %08x %08x %08x %08x\n", r[13], r[14], r[15], r[16]); + pr_debug("R[13]: %08x\n", r[13]); + pr_debug("Fixed M: %06x\n", ((r[12] << 16) | (r[13] >> 16)) & 0xffffff); + pr_debug("Valid / not / and1 / and2 : %1x\n", (r[13] >> 12) & 0xf); + pr_debug("r 13-16: %08x %08x %08x %08x\n", r[13], r[14], r[15], r[16]); } static int rtl931x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, struct pie_rule *pr) @@ -1261,7 +1261,7 @@ static int rtl931x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str int block = idx / PIE_BLOCK_SIZE; u32 t_select = sw_r32(RTL931X_PIE_BLK_TMPLTE_CTRL(block)); - pr_info("%s: %d, t_select: %08x\n", __func__, idx, t_select); + pr_debug("%s: %d, t_select: %08x\n", __func__, idx, t_select); for (int i = 0; i < 22; i++) r[i] = 0; @@ -1273,7 +1273,7 @@ static int rtl931x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str } rtl931x_write_pie_fixed_fields(r, pr); - pr_info("%s: template %d\n", __func__, (t_select >> (pr->tid * 4)) & 0xf); + pr_debug("%s: template %d\n", __func__, (t_select >> (pr->tid * 4)) & 0xf); rtl931x_write_pie_templated(r, pr, fixed_templates[(t_select >> (pr->tid * 4)) & 0xf]); rtl931x_write_pie_action(r, pr); @@ -1356,15 +1356,15 @@ static int rtl931x_pie_rule_add(struct rtl838x_switch_priv *priv, struct pie_rul min_block = max_block; max_block = priv->n_pie_blocks; } - pr_info("In %s\n", __func__); + pr_debug("In %s\n", __func__); mutex_lock(&priv->pie_mutex); for (block = min_block; block < max_block; block++) { for (j = 0; j < 2; j++) { int t = (sw_r32(RTL931X_PIE_BLK_TMPLTE_CTRL(block)) >> (j * 4)) & 0xf; - pr_info("Testing block %d, template %d, template id %d\n", block, j, t); - pr_info("%s: %08x\n", + pr_debug("Testing block %d, template %d, template id %d\n", block, j, t); + pr_debug("%s: %08x\n", __func__, sw_r32(RTL931X_PIE_BLK_TMPLTE_CTRL(block))); idx = rtl931x_pie_verify_template(priv, pr, t, block); if (idx >= 0) @@ -1379,7 +1379,7 @@ static int rtl931x_pie_rule_add(struct rtl838x_switch_priv *priv, struct pie_rul return -EOPNOTSUPP; } - pr_info("Using block: %d, index %d, template-id %d\n", block, idx, j); + pr_debug("Using block: %d, index %d, template-id %d\n", block, idx, j); set_bit(idx, priv->pie_use_bm); pr->valid = true; @@ -1400,7 +1400,7 @@ static int rtl931x_pie_rule_del(struct rtl838x_switch_priv *priv, int index_from { u32 v = (index_from << 1)| (index_to << 13 ) | BIT(0); - pr_info("%s: from %d to %d\n", __func__, index_from, index_to); + pr_debug("%s: from %d to %d\n", __func__, index_from, index_to); mutex_lock(&priv->reg_mutex); /* Write from-to and execute bit into control register */ @@ -1429,7 +1429,7 @@ static void rtl931x_pie_init(struct rtl838x_switch_priv *priv) mutex_init(&priv->pie_mutex); - pr_info("%s\n", __func__); + pr_debug("%s\n", __func__); /* Enable ACL lookup on all ports, including CPU_PORT */ for (int i = 0; i <= priv->cpu_port; i++) sw_w32(1, RTL931X_ACL_PORT_LOOKUP_CTRL(i)); @@ -1564,10 +1564,10 @@ static void rtl931x_led_init(struct rtl838x_switch_priv *priv) u64 pm_copper = 0, pm_fiber = 0; struct device_node *node; - pr_info("%s called\n", __func__); + pr_debug("%s called\n", __func__); node = of_find_compatible_node(NULL, NULL, "realtek,rtl9300-leds"); if (!node) { - pr_info("%s No compatible LED node found\n", __func__); + pr_debug("%s No compatible LED node found\n", __func__); return; } @@ -1602,7 +1602,7 @@ static void rtl931x_led_init(struct rtl838x_switch_priv *priv) u32 v; sprintf(set_name, "led_set%d", i); - pr_info(">%s<\n", set_name); + pr_debug(">%s<\n", set_name); led_set = of_get_property(node, set_name, &setlen); if (!led_set || setlen != 16) break; @@ -1620,7 +1620,7 @@ static void rtl931x_led_init(struct rtl838x_switch_priv *priv) rtl839x_set_port_reg_le(pm_copper | pm_fiber, RTL931X_LED_PORT_COMBO_MASK_CTRL); for (int i = 0; i < 32; i++) - pr_info("%s %08x: %08x\n",__func__, 0xbb000600 + i * 4, sw_r32(0x0600 + i * 4)); + pr_debug("%s %08x: %08x\n",__func__, 0xbb000600 + i * 4, sw_r32(0x0600 + i * 4)); } const struct rtl838x_reg rtl931x_reg = { From ef4b022150a44e4e6c565f8f2e73ffae9175d01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Wed, 5 Feb 2025 07:19:10 +0100 Subject: [PATCH 06/11] realtek: i2c-rtl9300: fix crash on block transfers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a typo which resulted in wrong .read hooks and unset .write hooks. This made I2C_SMBUS_BLOCK_DATA transfers dereference the NULL .write hook and Oops. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- .../linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c b/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c index 51b19978a0..9565c4756f 100644 --- a/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c +++ b/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c @@ -436,7 +436,7 @@ struct i2c_drv_data rtl9300_i2c_drv_data = { .scl1_pin = 17, .sda0_pin = 9, .read = rtl9300_i2c_read, - .read = rtl9300_i2c_write, + .write = rtl9300_i2c_write, .reg_addr_set = rtl9300_i2c_reg_addr_set, .config_xfer = rtl9300_i2c_config_xfer, .execute_xfer = rtl9300_execute_xfer, @@ -450,7 +450,7 @@ struct i2c_drv_data rtl9310_i2c_drv_data = { .scl1_pin = 14, .sda0_pin = 0, .read = rtl9310_i2c_read, - .read = rtl9310_i2c_write, + .write = rtl9310_i2c_write, .reg_addr_set = rtl9310_i2c_reg_addr_set, .config_xfer = rtl9310_i2c_config_xfer, .execute_xfer = rtl9310_execute_xfer, From 736229ba991ba69c6fdc7334353a43d9b1da1bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Tue, 4 Feb 2025 09:05:40 +0100 Subject: [PATCH 07/11] realtek: sfp: prevent duplicate hwmon devices when re-probing on interface up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-probing on interface up will register a new duplicate hwmon device. Skip the hwmon probe if we already have a sensor device. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- ...t-phy-sfp-re-probe-modules-on-DEV_UP-event.patch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index 4e1a21aa71..26216691e4 100644 --- a/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-6.6/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch @@ -10,7 +10,18 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -2416,6 +2416,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -1557,6 +1557,10 @@ static void sfp_hwmon_probe(struct work_ + struct sfp *sfp = container_of(work, struct sfp, hwmon_probe.work); + int err; + ++ /* Avoid duplicate hwmon devices when re-probing */ ++ if (sfp->hwmon_dev) ++ return; ++ + /* hwmon interface needs to access 16bit registers in atomic way to + * guarantee coherency of the diagnostic monitoring data. If it is not + * possible to guarantee coherency because EEPROM is broken in such way +@@ -2416,6 +2420,13 @@ static void sfp_sm_module(struct sfp *sf return; } From ccf54ca6732ed6b70d0039cf4c17d7c832aa5d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Wed, 5 Feb 2025 08:37:51 +0100 Subject: [PATCH 08/11] realtek: sfp: add mdio bus only for sfps with a phy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SMBus patch broke the logic and caused the driver to always register an mdio bus, regardless of the sfp. Restore original logic. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- .../714-net-phy-sfp-add-support-for-SMBus.patch | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch index 76e2d76506..cb9a1da7e6 100644 --- a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch @@ -107,21 +107,20 @@ Signed-off-by: Antoine Tenart static void sfp_i2c_mdiobus_destroy(struct sfp *sfp) { mdiobus_unregister(sfp->i2c_mii); -@@ -1871,8 +1948,15 @@ static void sfp_sm_fault(struct sfp *sfp +@@ -1875,9 +1952,15 @@ static void sfp_sm_fault(struct sfp *sfp static int sfp_sm_add_mdio_bus(struct sfp *sfp) { - if (sfp->mdio_protocol != MDIO_I2C_NONE) -- return sfp_i2c_mdiobus_create(sfp); -+ if (i2c_check_functionality(sfp->i2c, I2C_FUNC_I2C)) { -+ if (sfp->mdio_protocol != MDIO_I2C_NONE) -+ return sfp_i2c_mdiobus_create(sfp); -+ ++ if (sfp->mdio_protocol == MDIO_I2C_NONE) + return 0; -+ } + ++ if (i2c_check_functionality(sfp->i2c, I2C_FUNC_I2C)) + return sfp_i2c_mdiobus_create(sfp); + + if (i2c_check_functionality(sfp->i2c, I2C_FUNC_SMBUS_BYTE_DATA)) + return sfp_sm_mdiobus_create(sfp); - ++ return 0; } + From 4457c1eee49e263dea8ae14b9e498b4d1e8e4503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Thu, 6 Feb 2025 17:51:48 +0100 Subject: [PATCH 09/11] realtek: rtl93xx: support SFPs with phys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver use "phy-handle" as a placeholder for mac configuration data. Such handles are therefore required for all ports - even those connected directly to SFP slots and having a managed property set to "in-band-status". The DSA core will register these nodes as if they are real phys. This prevents later attachment of pluggable phys with errors like sfp sfp-p8: sfp_add_phy failed: -EBUSY Replace the virtual SFP slot handles with "pseudo-phy-handle" to keep the driver logic as-is but hide the node from the DSA core. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- .../realtek/dts/rtl9302_zyxel_xgs1250-12.dts | 2 +- .../realtek/dts/rtl9303_xikestor_sks8300-8x.dts | 16 ++++++++-------- .../files-6.6/drivers/net/dsa/rtl83xx/common.c | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts b/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts index d7252c9984..aa48511372 100644 --- a/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts +++ b/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts @@ -404,7 +404,7 @@ reg = <27>; label = "lan12"; phy-mode = "1000base-x"; - phy-handle = <&phy27>; + pseudo-phy-handle = <&phy27>; sfp = <&sfp0>; led-set = <2>; managed = "in-band-status"; diff --git a/target/linux/realtek/dts/rtl9303_xikestor_sks8300-8x.dts b/target/linux/realtek/dts/rtl9303_xikestor_sks8300-8x.dts index b143844ddd..9632159368 100644 --- a/target/linux/realtek/dts/rtl9303_xikestor_sks8300-8x.dts +++ b/target/linux/realtek/dts/rtl9303_xikestor_sks8300-8x.dts @@ -343,7 +343,7 @@ port@0 { reg = <0>; label = "lan1"; - phy-handle = <&phy0>; + pseudo-phy-handle = <&phy0>; phy-mode = "10gbase-r"; sfp = <&sfp0>; managed = "in-band-status"; @@ -353,7 +353,7 @@ port@8 { reg = <8>; label = "lan2"; - phy-handle = <&phy8>; + pseudo-phy-handle = <&phy8>; phy-mode = "10gbase-r"; sfp = <&sfp1>; managed = "in-band-status"; @@ -363,7 +363,7 @@ port@10 { reg = <16>; label = "lan3"; - phy-handle = <&phy16>; + pseudo-phy-handle = <&phy16>; phy-mode = "10gbase-r"; sfp = <&sfp2>; managed = "in-band-status"; @@ -373,7 +373,7 @@ port@14 { reg = <20>; label = "lan4"; - phy-handle = <&phy20>; + pseudo-phy-handle = <&phy20>; phy-mode = "10gbase-r"; sfp = <&sfp3>; managed = "in-band-status"; @@ -383,7 +383,7 @@ port@18 { reg = <24>; label = "lan5"; - phy-handle = <&phy24>; + pseudo-phy-handle = <&phy24>; phy-mode = "10gbase-r"; sfp = <&sfp4>; managed = "in-band-status"; @@ -393,7 +393,7 @@ port@19 { reg = <25>; label = "lan6"; - phy-handle = <&phy25>; + pseudo-phy-handle = <&phy25>; phy-mode = "10gbase-r"; sfp = <&sfp5>; managed = "in-band-status"; @@ -403,7 +403,7 @@ port@1a { reg = <26>; label = "lan7"; - phy-handle = <&phy26>; + pseudo-phy-handle = <&phy26>; phy-mode = "10gbase-r"; sfp = <&sfp6>; managed = "in-band-status"; @@ -413,7 +413,7 @@ port@1b { reg = <27>; label = "lan8"; - phy-handle = <&phy27>; + pseudo-phy-handle = <&phy27>; phy-mode = "10gbase-r"; sfp = <&sfp7>; managed = "in-band-status"; diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c index 28b836f6b2..cd532a7d3d 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c @@ -339,6 +339,22 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) continue; phy_node = of_parse_phandle(dn, "phy-handle", 0); + + /* Major cleanup is needed... + * + * We use virtual "phys" as containers for mac + * properties like the SERDES channel, even for simple + * SFP slots. "pseudo-phy-handle" is a hack to + * support this construct and still allow pluggable + * phys. + * + * The SERDES map is most likely static by port number + * for each SoC. No need to put that into the device + * tree in the first place. + */ + if (!phy_node) + phy_node = of_parse_phandle(dn, "pseudo-phy-handle", 0); + if (!phy_node) { if (pn != priv->cpu_port) dev_err(priv->dev, "Port node %d misses phy-handle\n", pn); From 1fc19bc06edc62a748327d210eea030d36541143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Thu, 6 Feb 2025 18:30:06 +0100 Subject: [PATCH 10/11] realtek: rtl93xx: mdio-smbus support for clause 45 and Rollball SFPs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These features have been added to the mdio-i2c driver and are now used by the sfp driver. The support is required for some newer SFPs. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- ...12-net-phy-add-an-MDIO-SMBus-library.patch | 316 +++++++++++++++++- ...14-net-phy-sfp-add-support-for-SMBus.patch | 2 +- 2 files changed, 299 insertions(+), 19 deletions(-) diff --git a/target/linux/realtek/patches-6.6/712-net-phy-add-an-MDIO-SMBus-library.patch b/target/linux/realtek/patches-6.6/712-net-phy-add-an-MDIO-SMBus-library.patch index 03c62b505d..229e2612ea 100644 --- a/target/linux/realtek/patches-6.6/712-net-phy-add-an-MDIO-SMBus-library.patch +++ b/target/linux/realtek/patches-6.6/712-net-phy-add-an-MDIO-SMBus-library.patch @@ -45,49 +45,308 @@ Signed-off-by: Antoine Tenart obj-$(CONFIG_MDIO_XGENE) += mdio-xgene.o --- /dev/null +++ b/drivers/net/mdio/mdio-smbus.c -@@ -0,0 +1,62 @@ +@@ -0,0 +1,341 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MDIO SMBus bridge + * + * Copyright (C) 2020 Antoine Tenart ++ * Copyright (C) 2025 Bjørn Mork + * + * Network PHYs can appear on SMBus when they are part of SFP modules. + */ +#include +#include +#include ++#include + -+static int smbus_mii_read(struct mii_bus *mii, int phy_id, int reg) ++static int smbus_mii_read_c45(struct mii_bus *mii, int phy_id, int devad, int reg) +{ ++ u16 bus_addr = i2c_mii_phy_addr(phy_id); + struct i2c_adapter *i2c = mii->priv; + union i2c_smbus_data data; -+ int ret; ++ size_t addrlen; ++ u8 buf[5], *p; ++ int i, ret; + -+ ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0, I2C_SMBUS_READ, -+ reg, I2C_SMBUS_BYTE_DATA, &data); ++ if (!i2c_mii_valid_phy_id(phy_id)) ++ return 0xffff; ++ ++ p = buf; ++ if (devad >= 0) { ++ *p++ = 0x20 | devad; ++ *p++ = reg >> 8; ++ } ++ *p++ = reg; ++ addrlen = p - buf; ++ ++ i2c_lock_bus(i2c, I2C_LOCK_SEGMENT); ++ if (addrlen > 1) { ++ for (i = 1; i < addrlen; i++) { ++ data.byte = buf[i]; ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, buf[0], I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ } ++ } ++ ++ for (i = addrlen; i < addrlen + 2; i++) { ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_READ, buf[0], I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ buf[i] = data.byte; ++ } ++ ++unlock: ++ i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT); + if (ret < 0) -+ return 0xff; -+ -+ return data.byte; ++ return 0xffff; ++ return buf[addrlen] << 8 | buf[addrlen + 1]; +} + -+static int smbus_mii_write(struct mii_bus *mii, int phy_id, int reg, u16 val) ++static int smbus_mii_write_c45(struct mii_bus *mii, int phy_id, int devad, int reg, u16 val) +{ ++ u16 bus_addr = i2c_mii_phy_addr(phy_id); + struct i2c_adapter *i2c = mii->priv; + union i2c_smbus_data data; -+ int ret; ++ size_t buflen; ++ u8 buf[5], *p; ++ int i, ret; + -+ data.byte = val; ++ if (!i2c_mii_valid_phy_id(phy_id)) ++ return 0; + -+ ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0, I2C_SMBUS_WRITE, -+ reg, I2C_SMBUS_BYTE_DATA, &data); ++ p = buf; ++ if (devad >= 0) { ++ *p++ = devad; ++ *p++ = reg >> 8; ++ } ++ *p++ = reg; ++ *p++ = val >> 8; ++ *p++ = val; ++ buflen = p - buf; ++ ++ i2c_lock_bus(i2c, I2C_LOCK_SEGMENT); ++ for (i = 1; i < buflen; i++) { ++ data.byte = buf[i]; ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, buf[0], I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ } ++unlock: ++ i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT); + return ret < 0 ? ret : 0; +} + -+struct mii_bus *mdio_smbus_alloc(struct device *parent, struct i2c_adapter *i2c) ++static int smbus_mii_read_c22(struct mii_bus *bus, int phy_id, int reg) ++{ ++ return smbus_mii_read_c45(bus, phy_id, -1, reg); ++} ++ ++static int smbus_mii_write_c22(struct mii_bus *bus, int phy_id, int reg, u16 val) ++{ ++ return smbus_mii_write_c45(bus, phy_id, -1, reg, val); ++} ++ ++/* From mdio-i2c.c: ++ * ++ * RollBall SFPs do not access internal PHY via I2C address 0x56, but ++ * instead via address 0x51, when SFP page is set to 0x03 and password to ++ * 0xffffffff. ++ * ++ * address size contents description ++ * ------- ---- -------- ----------- ++ * 0x80 1 CMD 0x01/0x02/0x04 for write/read/done ++ * 0x81 1 DEV Clause 45 device ++ * 0x82 2 REG Clause 45 register ++ * 0x84 2 VAL Register value ++ */ ++#define ROLLBALL_PHY_I2C_ADDR 0x51 ++ ++#define ROLLBALL_PASSWORD (SFP_VSL + 3) ++ ++#define ROLLBALL_CMD_ADDR 0x80 ++#define ROLLBALL_DATA_ADDR 0x81 ++ ++#define ROLLBALL_CMD_WRITE 0x01 ++#define ROLLBALL_CMD_READ 0x02 ++#define ROLLBALL_CMD_DONE 0x04 ++ ++#define SFP_PAGE_ROLLBALL_MDIO 3 ++ ++static int smbus_set_sfp_page_lock(struct i2c_adapter *i2c, int bus_addr, u8 page) ++{ ++ union i2c_smbus_data data; ++ u8 oldpage; ++ int ret; ++ ++ i2c_lock_bus(i2c, I2C_LOCK_SEGMENT); ++ ++ /* read current page */ ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_READ, SFP_PAGE, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ ++ oldpage = data.byte; ++ data.byte = page; ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, SFP_PAGE, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret == 0) ++ return oldpage; ++ ++unlock: ++ i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT); ++ ++ return ret; ++} ++ ++static int __smbus_set_sfp_page_unlock(struct i2c_adapter *i2c, int bus_addr, u8 page) ++{ ++ union i2c_smbus_data data; ++ int ret; ++ ++ data.byte = page; ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, SFP_PAGE, I2C_SMBUS_BYTE_DATA, &data); ++ i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT); ++ ++ return ret; ++} ++ ++/* Wait for the ROLLBALL_CMD_ADDR register to read ROLLBALL_CMD_DONE, ++ * indicating that the previous command has completed. ++ * ++ * Quoting from the mdio-i2c.c implementation: ++ * ++ * By experiment it takes up to 70 ms to access a register for these ++ * SFPs. Sleep 20ms between iterations and try 10 times. ++ */ ++static int __smbus_rollball_mii_poll(struct i2c_adapter *i2c , int bus_addr) ++{ ++ union i2c_smbus_data data; ++ int i, ret; ++ ++ i = 10; ++ do { ++ msleep(20); ++ ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_READ, ROLLBALL_CMD_ADDR, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ return ret; ++ ++ if (data.byte == ROLLBALL_CMD_DONE) ++ return 0; ++ } while (i-- > 0); ++ dev_dbg(&i2c->dev, "poll timed out\n"); ++ return -ETIMEDOUT; ++} ++ ++static int smbus_mii_read_rollball(struct mii_bus *bus, int phy_id, int devad, int reg) ++{ ++ struct i2c_adapter *i2c = bus->priv; ++ union i2c_smbus_data data; ++ int i, bus_addr, old, ret; ++ u8 buf[6]; ++ ++ bus_addr = i2c_mii_phy_addr(phy_id); ++ if (bus_addr != ROLLBALL_PHY_I2C_ADDR) ++ return 0xffff; ++ ++ old = smbus_set_sfp_page_lock(i2c, bus_addr, SFP_PAGE_ROLLBALL_MDIO); ++ if (old < 0) ++ return 0xffff; ++ ++ /* set address */ ++ buf[0] = ROLLBALL_CMD_READ; ++ buf[1] = devad; ++ buf[2] = reg >> 8; ++ buf[3] = reg & 0xff; ++ ++ /* send address */ ++ for (i = 0; i < 4; i++) { ++ data.byte = buf[i]; ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, ROLLBALL_CMD_ADDR + i, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ } ++ ++ /* wait for command to complete */ ++ ret = __smbus_rollball_mii_poll(i2c, bus_addr); ++ if (ret) ++ goto unlock; ++ ++ /* read result */ ++ for (i = 4; i < 6; i++) { ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_READ, ROLLBALL_CMD_ADDR + i, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ buf[i] = data.byte; ++ } ++ ++unlock: ++ __smbus_set_sfp_page_unlock(i2c, bus_addr, old); ++ if (ret < 0) ++ return 0xffff; ++ return buf[4] << 8 | buf[5]; ++} ++ ++static int smbus_mii_write_rollball(struct mii_bus *bus, int phy_id, int devad, int reg, u16 val) ++{ ++ struct i2c_adapter *i2c = bus->priv; ++ union i2c_smbus_data data; ++ int i, bus_addr, old, ret; ++ u8 buf[6]; ++ ++ bus_addr = i2c_mii_phy_addr(phy_id); ++ if (bus_addr != ROLLBALL_PHY_I2C_ADDR) ++ return 0; ++ ++ old = smbus_set_sfp_page_lock(i2c, bus_addr, SFP_PAGE_ROLLBALL_MDIO); ++ if (old < 0) ++ return old; ++ ++ /* set address */ ++ buf[0] = ROLLBALL_CMD_WRITE; ++ buf[1] = devad; ++ buf[2] = reg >> 8; ++ buf[3] = reg & 0xff; ++ buf[4] = val >> 8; ++ buf[5] = val & 0xff; ++ ++ /* send address and value */ ++ for (i = 0; i < 6; i++) { ++ data.byte = buf[i]; ++ ret = __i2c_smbus_xfer(i2c, bus_addr, 0, I2C_SMBUS_WRITE, ROLLBALL_CMD_ADDR + i, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ goto unlock; ++ } ++ ++ /* wait for command to complete */ ++ ret = __smbus_rollball_mii_poll(i2c, bus_addr); ++ ++unlock: ++ __smbus_set_sfp_page_unlock(i2c, bus_addr, old); ++ return ret; ++} ++ ++/* write "password" - four 0xff bytes - to the ROLLBALL_PASSWORD register */ ++static int smbus_mii_init_rollball(struct i2c_adapter *i2c) ++{ ++ union i2c_smbus_data data; ++ int i, ret; ++ ++ data.byte = 0xff; ++ for (i = 0; i < 4; i++) { ++ ret = i2c_smbus_xfer(i2c, ROLLBALL_PHY_I2C_ADDR, 0, I2C_SMBUS_WRITE, ROLLBALL_PASSWORD + i, I2C_SMBUS_BYTE_DATA, &data); ++ if (ret < 0) ++ return ret; ++ } ++ return 0; ++} ++ ++struct mii_bus *mdio_smbus_alloc(struct device *parent, struct i2c_adapter *i2c, ++ enum mdio_i2c_proto protocol) +{ + struct mii_bus *mii; ++ int ret; + + if (!i2c_check_functionality(i2c, I2C_FUNC_SMBUS_BYTE_DATA)) + return ERR_PTR(-EINVAL); @@ -98,10 +357,30 @@ Signed-off-by: Antoine Tenart + + snprintf(mii->id, MII_BUS_ID_SIZE, "smbus:%s", dev_name(parent)); + mii->parent = parent; -+ mii->read = smbus_mii_read; -+ mii->write = smbus_mii_write; + mii->priv = i2c; + ++ switch (protocol) { ++ case MDIO_I2C_ROLLBALL: ++ ret = smbus_mii_init_rollball(i2c); ++ if (ret < 0) { ++ dev_err(parent, ++ "Cannot initialize RollBall MDIO protocol on SMBus: %d\n", ++ ret); ++ mdiobus_free(mii); ++ return ERR_PTR(ret); ++ } ++ ++ mii->read_c45 = smbus_mii_read_rollball; ++ mii->write_c45 = smbus_mii_write_rollball; ++ break; ++ default: ++ mii->read = smbus_mii_read_c22; ++ mii->write = smbus_mii_write_c22; ++ mii->read_c45 = smbus_mii_read_c45; ++ mii->write_c45 = smbus_mii_write_c45; ++ break; ++ } ++ + return mii; +} + @@ -120,11 +399,12 @@ Signed-off-by: Antoine Tenart --- a/include/linux/mdio/mdio-i2c.h +++ b/include/linux/mdio/mdio-i2c.h -@@ -20,5 +20,8 @@ enum mdio_i2c_proto { +@@ -20,5 +20,9 @@ enum mdio_i2c_proto { struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c, enum mdio_i2c_proto protocol); -+struct mii_bus *mdio_smbus_alloc(struct device *parent, struct i2c_adapter *i2c); ++struct mii_bus *mdio_smbus_alloc(struct device *parent, struct i2c_adapter *i2c, ++ enum mdio_i2c_proto protocol); +bool i2c_mii_valid_phy_id(int phy_id); +unsigned int i2c_mii_phy_addr(int phy_id); diff --git a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch index cb9a1da7e6..96c1088442 100644 --- a/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-6.6/714-net-phy-sfp-add-support-for-SMBus.patch @@ -86,7 +86,7 @@ Signed-off-by: Antoine Tenart + struct mii_bus *sm_mii; + int ret; + -+ sm_mii = mdio_smbus_alloc(sfp->dev, sfp->i2c); ++ sm_mii = mdio_smbus_alloc(sfp->dev, sfp->i2c, sfp->mdio_protocol); + if (IS_ERR(sm_mii)) + return PTR_ERR(sm_mii); + From d6977ab33a2b0296837a81b9c92ce8380cc7d39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= Date: Wed, 12 Feb 2025 08:56:48 +0100 Subject: [PATCH 11/11] realtek: rtl930x: sgmii support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sgmii work for 1000Base-T SFPs by stupidly adding the sgmii mode wherever 1000base-x is accepted. No intelligence has been used in the process. But it "works for me". There is an obvious need for refactoring this code to make it more obvious how and why we configure the mac/phy link like we do for different modes. Signed-off-by: Bjørn Mork Link: https://github.com/openwrt/openwrt/pull/17950 Signed-off-by: Sander Vanheule --- .../files-6.6/drivers/net/dsa/rtl83xx/dsa.c | 1 + .../files-6.6/drivers/net/phy/rtl83xx-phy.c | 26 ++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c index 69151b2f6b..cdfe0fe3dc 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c @@ -814,6 +814,7 @@ static void rtl93xx_phylink_mac_config(struct dsa_switch *ds, int port, pr_info("%s SDS is %d\n", __func__, sds_num); if (sds_num >= 0 && (state->interface == PHY_INTERFACE_MODE_1000BASEX || + state->interface == PHY_INTERFACE_MODE_SGMII || state->interface == PHY_INTERFACE_MODE_10GBASER)) rtl9300_serdes_setup(port, sds_num, state->interface); diff --git a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c index 53a7e184f5..9bab139e6d 100644 --- a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c +++ b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c @@ -1921,6 +1921,7 @@ void rtl9300_sds_tx_config(int sds, phy_interface_t phy_if) switch(phy_if) { case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_SGMII: pre_amp = 0x1; main_amp = 0x9; post_amp = 0x1; @@ -2475,7 +2476,9 @@ void rtl9300_do_rx_calibration_1(int sds, phy_interface_t phy_mode) /* TODO: make this work for DAC cables of different lengths */ /* For a 10GBit serdes wit Fibre, SDS 8 or 9 */ - if (phy_mode == PHY_INTERFACE_MODE_10GBASER || PHY_INTERFACE_MODE_1000BASEX) + if (phy_mode == PHY_INTERFACE_MODE_10GBASER || + phy_mode == PHY_INTERFACE_MODE_1000BASEX || + phy_mode == PHY_INTERFACE_MODE_SGMII) rtl9300_sds_field_w(sds, 0x2e, 0x16, 3, 2, 0x02); else pr_err("%s not PHY-based or SerDes, implement DAC!\n", __func__); @@ -2573,7 +2576,9 @@ void rtl9300_sds_rxcal_3_1(int sds_num, phy_interface_t phy_mode) pr_info("start_1.3.1"); /* ##1.3.1 */ - if (phy_mode != PHY_INTERFACE_MODE_10GBASER && phy_mode != PHY_INTERFACE_MODE_1000BASEX) + if (phy_mode != PHY_INTERFACE_MODE_10GBASER && + phy_mode != PHY_INTERFACE_MODE_1000BASEX && + phy_mode != PHY_INTERFACE_MODE_SGMII) rtl9300_sds_field_w(sds_num, 0x2e, 0xc, 8, 8, 0); rtl9300_sds_field_w(sds_num, 0x2e, 0x17, 7, 7, 0x0); @@ -2589,7 +2594,9 @@ void rtl9300_sds_rxcal_3_2(int sds_num, phy_interface_t phy_mode) bool eq_hold_enabled; int i; - if (phy_mode == PHY_INTERFACE_MODE_10GBASER || phy_mode == PHY_INTERFACE_MODE_1000BASEX) { + if (phy_mode == PHY_INTERFACE_MODE_10GBASER || + phy_mode == PHY_INTERFACE_MODE_1000BASEX || + phy_mode == PHY_INTERFACE_MODE_SGMII) { /* rtl9300_rxCaliConf_serdes_myParam */ dac_long_cable_offset = 3; eq_hold_enabled = true; @@ -2599,7 +2606,7 @@ void rtl9300_sds_rxcal_3_2(int sds_num, phy_interface_t phy_mode) eq_hold_enabled = false; } - if (phy_mode == PHY_INTERFACE_MODE_1000BASEX) + if (phy_mode != PHY_INTERFACE_MODE_10GBASER) pr_warn("%s: LEQ only valid for 10GR!\n", __func__); pr_info("start_1.3.2"); @@ -2614,7 +2621,9 @@ void rtl9300_sds_rxcal_3_2(int sds_num, phy_interface_t phy_mode) pr_info("sum10:%u, avg10:%u, int10:%u", sum10, avg10, int10); - if (phy_mode == PHY_INTERFACE_MODE_10GBASER || phy_mode == PHY_INTERFACE_MODE_1000BASEX) { + if (phy_mode == PHY_INTERFACE_MODE_10GBASER || + phy_mode == PHY_INTERFACE_MODE_1000BASEX || + phy_mode == PHY_INTERFACE_MODE_SGMII) { if (dac_long_cable_offset) { rtl9300_sds_rxcal_leq_offset_manual(sds_num, 1, dac_long_cable_offset); rtl9300_sds_field_w(sds_num, 0x2e, 0x17, 7, 7, eq_hold_enabled); @@ -2644,7 +2653,9 @@ void rtl9300_do_rx_calibration_3(int sds_num, phy_interface_t phy_mode) { rtl9300_sds_rxcal_3_1(sds_num, phy_mode); - if (phy_mode == PHY_INTERFACE_MODE_10GBASER || phy_mode == PHY_INTERFACE_MODE_1000BASEX) + if (phy_mode == PHY_INTERFACE_MODE_10GBASER || + phy_mode == PHY_INTERFACE_MODE_1000BASEX || + phy_mode == PHY_INTERFACE_MODE_SGMII) rtl9300_sds_rxcal_3_2(sds_num, phy_mode); } @@ -2765,6 +2776,7 @@ int rtl9300_sds_sym_err_reset(int sds_num, phy_interface_t phy_mode) break; case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_SGMII: rtl9300_sds_field_w(sds_num, 0x1, 24, 2, 0, 0); rtl9300_sds_field_w(sds_num, 0x1, 3, 15, 8, 0); rtl9300_sds_field_w(sds_num, 0x1, 2, 15, 0, 0); @@ -2787,6 +2799,7 @@ u32 rtl9300_sds_sym_err_get(int sds_num, phy_interface_t phy_mode) break; case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_10GBASER: v = rtl930x_read_sds_phy(sds_num, 5, 1); return v & 0xff; @@ -2812,6 +2825,7 @@ int rtl9300_sds_check_calibration(int sds_num, phy_interface_t phy_mode) switch (phy_mode) { case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_SGMII: case PHY_INTERFACE_MODE_XGMII: if ((errors2 - errors1 > 100) || (errors1 >= 0xffff00) || (errors2 >= 0xffff00)) {