From bf0a1296a5533f3b8aa2d07f2f4b3022d074c082 Mon Sep 17 00:00:00 2001 From: Ivan Deng Date: Thu, 16 Jan 2025 00:53:36 -0800 Subject: [PATCH 01/18] qualcommax: add missing WAN LED support to Spectrum SAX1V1K routers Fixed an issue where both WAN LEDs light up before plugging in the ethernet cable and no blinking regardless of WAN network activity. Updated the LED configuration to reflect proper status: Green indicates 2.5Gb connection speed. Yellow indicates other connection speed and traffic activity. This resolves inconsistent WAN LED behavior on Spectrum SAX1V1K routers. Signed-off-by: Ivan Deng Link: https://github.com/openwrt/openwrt/pull/17623 Signed-off-by: Robert Marko (cherry picked from commit 8e78bc39a38d2a82818bcae467d3bcbbbe8531f3) --- .../arm64/boot/dts/qcom/ipq8072-sax1v1k.dts | 21 +++++++++++++++++++ .../ipq807x/base-files/etc/board.d/01_leds | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts index fbb652a097..15ca4d8ec4 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts @@ -137,6 +137,27 @@ reg = <28>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; reset-deassert-us = <10000>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + active-low; + }; + + led@2 { + reg = <2>; + color = ; + function = LED_FUNCTION_WAN; + default-state = "keep"; + active-low; + }; + }; }; }; diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds index b5c3cbc736..ae941657f9 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds @@ -16,7 +16,8 @@ asus,rt-ax89x) ucidef_set_led_netdev "sfp" "SFP" "white:sfp" "10g-sfp" ucidef_set_led_netdev "wan" "WAN" "white:wan" "wan" ;; -dynalink,dl-wrx36) +dynalink,dl-wrx36|\ +spectrum,sax1v1k) ucidef_set_led_netdev "wan-port-link-green" "WAN-PORT-LINK-GREEN" "90000.mdio-1:1c:green:wan" "wan" "link_2500" ucidef_set_led_netdev "wan-port-link-yellow" "WAN-PORT-LINK-YELLOW" "90000.mdio-1:1c:yellow:wan" "wan" "tx rx link_10 link_100 link_1000" ;; From 7a1da5486f378a74c614d49de3ac37ddb82ccc87 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 24 Jan 2025 17:07:21 +0100 Subject: [PATCH 02/18] realtek: Fix old compatible for HPE 1920-8G PoE Supported devices are listed in the metadata as the first part of the DTS compatible. This normally follows the format "vendor,device". When updating the device name of the 180W 1920-8G PoE an underscore was used, instead of a comma, to join the vendor and device name. This will lead to warnings for users wanting to sysupgrade a device with an older compatible, as the device's info does not match the one the metadata. Fixes: 987c96e88927 ("realtek: rename hpe,1920-8g-poe to match hardware") Signed-off-by: Sander Vanheule (cherry picked from commit 6a7fa68569ac11bb2c2abb14026e8b84acd3a12f) --- target/linux/realtek/image/rtl838x.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index 866659ad14..9ade8d536b 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -124,7 +124,7 @@ define Device/hpe_1920-8g-poe-180w DEVICE_MODEL := 1920-8G-PoE+ 180W (JG922A) DEVICE_PACKAGES += realtek-poe H3C_DEVICE_ID := 0x00010025 - SUPPORTED_DEVICES += hpe_1920-8g-poe + SUPPORTED_DEVICES += hpe,1920-8g-poe endef TARGET_DEVICES += hpe_1920-8g-poe-180w From 0ba00ec205a449fd341a7b094363048a8884da63 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Wed, 22 Jan 2025 19:59:12 +0100 Subject: [PATCH 03/18] mediatek-mt7622: netgear-wax206 fix wifi leds the wifi leds of the wax206 were not reacting. This patch enables the green leds to show activity, as the blue ones are very bright. Also set the label-mac to the gmac0 Signed-off-by: Florian Maurer Link: https://github.com/openwrt/openwrt/pull/17694 Signed-off-by: Hauke Mehrtens (cherry picked from commit 9ada8578fd2768d077607b189987972ad600a804) --- target/linux/mediatek/dts/mt7622-netgear-wax206.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts index 524a498740..4881004ac3 100644 --- a/target/linux/mediatek/dts/mt7622-netgear-wax206.dts +++ b/target/linux/mediatek/dts/mt7622-netgear-wax206.dts @@ -13,6 +13,7 @@ aliases { ethernet0 = &gmac0; + label-mac-device = &gmac0; led-boot = &led_power_r; led-failsafe = &led_power_r; led-running = &led_power_g; @@ -84,6 +85,7 @@ default-state = "off"; gpios = <&pio 85 GPIO_ACTIVE_LOW>; label = "wifin:green"; + linux,default-trigger = "phy0tpt"; }; wifin_blue { @@ -96,6 +98,7 @@ default-state = "off"; gpios = <&pio 2 GPIO_ACTIVE_HIGH>; label = "wifia:green"; + linux,default-trigger = "phy1tpt"; }; wifia_blue { From 9b32a8ec9d21197202f689225ca3ead817d5a689 Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:51 +0200 Subject: [PATCH 04/18] kernel: vrx518_tc: fix RX desc phys to virt mapping It looks like VRX518 returns phys addr of data buffer in the 'data_ptr' field of the RX descriptor and an actual data offset within the buffer in the 'byte_off' field. In order to map the phys address back to virtual we need the original phys address of the allocated buffer. In the same driver applies offset to phys address before the mapping, what leads to WARN_ON triggering in plat_mem_virt() function with subsequent kernel panic: WARNING: CPU: 0 PID: 0 at .../sw_plat.c:764 0xbf306cd0 [vrx518_tc@8af9f5d0+0x25000] ... Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = aff5701e [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Noticed in ATM mode, when chip always returns byte_off = 4. In order to fix the issue, pass the phys address to plat_mem_virt() as is and apply byte_off later for proper DMA syncing and on mapped virtual address when copying RXed data into the skb. Run tested with FRITZ!Box 7530 on both ADSL and VDSL (thanks Jan) links. Fixes: 474bbe23b7 ("kernel: add Intel/Lantiq VRX518 TC driver") Tested-by: Jan Hoffmann # VDSL link Reported-and-tested-by: nebibigon93@yandex.ru # ADSL link Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-2-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 7bd579689d2304c73c263be3e030d76c551d6e87) --- package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch index edc97998b7..6596a8b913 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch @@ -855,12 +855,12 @@ This replaces it by a basic working implementation. - continue; + + // this seems to be a pointer to a DS PKT buffer -+ phyaddr = desc->data_ptr + desc->byte_off; ++ phyaddr = desc->data_ptr; + ptr = plat_mem_virt(phyaddr); -+ + len = desc->data_len; + -+ dma_sync_single_range_for_cpu(pdev, phyaddr, 0, len, DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(pdev, phyaddr, desc->byte_off + len, ++ DMA_FROM_DEVICE); + + skb = netdev_alloc_skb(g_plat_priv->netdev, len); + if (unlikely(!skb)) { @@ -871,7 +871,7 @@ This replaces it by a basic working implementation. - ring_idx_inc(rxout, idx); + + dst = skb_put(skb, len); -+ memcpy(dst, ptr, len); ++ memcpy(dst, ptr + desc->byte_off, len); + + priv->tc_ops.recv(g_plat_priv->netdev, skb); + From 6383f24378ed745c2a9fe2645df9d31470eb9599 Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:52 +0200 Subject: [PATCH 05/18] kernel: vrx518_tc: fix ADSL/ATM operation ATM TC layer have some issues which effectively prevent VRX518 from being used as ADSL modem. Specifically, there one crash during the ATM layer configuration and wrong PVC ID selection on packet receiving what breaks RX path. Fix both of the issues. Make subif iface registration optional to prevent the crash (see more details in the new patch) and update the hardcoded PVC ID to match the first allocated channel. Run tested with FRITZ!Box 7530. Fixes: 474bbe23b7 ("kernel: add Intel/Lantiq VRX518 TC driver") Reported-and-tested-by: nebibigon93@yandex.ru Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-3-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 470335450e67002366fcbcd7334b15bdf008e44d) --- .../lantiq/vrx518_tc/patches/100-compat.patch | 2 +- ...tm_tc-fix-crash-on-subif_reg-absence.patch | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch diff --git a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch index d04c1ed5df..81e32369ba 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/100-compat.patch @@ -166,7 +166,7 @@ - return (skb->DW0 >> 3) & 0xF; +// return (skb->DW0 >> 3) & 0xF; -+ return 1; ++ return 0; /* We use only one connection for now, so return the first connection id */ } static int atm_get_qid_by_vcc(struct net_device *dev, struct sk_buff *skb, diff --git a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch new file mode 100644 index 0000000000..87456424c3 --- /dev/null +++ b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch @@ -0,0 +1,75 @@ +From: Sergey Ryazanov +Date: Fri, 10 Jan 2025 00:57:27 +0000 +Subject: [PATCH] vrx518_tc: atm_tc: fix crash on subif_reg absence + +VRX518 (sw_plat) platform does not provid the subif_reg/subif_unreg ops +in the same time ATM TC layer unconditionally calls them, what leads to +the kernel crash on the atm_hook_mpoa_setup hook invocation from the ATM +stack: + + vrx518_tc:mpoa_setup_sync : sync: conn: 0, vpi: 0, vci: 35, mpoa_type: 0, mpoa_mode: 0 + Unable to handle kernel NULL pointer dereference at virtual address 00000000 + +Subif registration is optional and PTM TC do this only when the +corresponding ops are defined. Do the same for ATM TC and call +subif_reg/subif_unreg only if they are not NULL. + +While at it, move subif related data preparation under the 'if' block +in order to group and isolate that aux code. + +Run tested with FRITZ!Box 7530. + +Signed-off-by: Sergey Ryazanov +--- +--- a/dcdp/atm_tc.c ++++ b/dcdp/atm_tc.c +@@ -1232,8 +1232,9 @@ static void ppe_close(struct atm_vcc *vc + validate_oam_htu_entry(priv, 0); + spin_unlock_bh(&priv->atm_lock); + +- priv->tc_priv->tc_ops.subif_unreg(dev, (!dev) ? dev_name : dev->name, +- priv->conn[cid].subif_id, 0); ++ if (priv->tc_priv->tc_ops.subif_unreg) ++ priv->tc_priv->tc_ops.subif_unreg(dev, (!dev) ? dev_name : dev->name, ++ priv->conn[cid].subif_id, 0); + + memset(conn, 0, sizeof(*conn)); + +@@ -2791,24 +2792,26 @@ static void mpoa_setup_sync(struct atm_p + struct wtx_queue_config_t tx_qcfg; + struct uni_cell_header *cell_header; + struct atm_vcc *vcc; +- struct net_device *dev; +- char dev_name[32]; + + tc_dbg(priv->tc_priv, MSG_INIT, + "sync: conn: %d, vpi: %d, vci: %d, mpoa_type: %d, mpoa_mode: %d\n", + conn, priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci, + priv->conn[conn].mpoa_type, priv->conn[conn].mpoa_mode); + +- dev = priv->conn[conn].dev; ++ if (priv->tc_priv->tc_ops.subif_reg) { ++ struct net_device *dev; ++ char dev_name[32]; ++ ++ dev = priv->conn[conn].dev; ++ if (!dev) ++ sprintf(dev_name, "atm_%d%d", ++ priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci); + +- if (!dev) +- sprintf(dev_name, "atm_%d%d", +- priv->conn[conn].vcc->vpi, priv->conn[conn].vcc->vci); +- +- priv->tc_priv->tc_ops.subif_reg(dev, (!dev) ? dev_name : dev->name, +- &priv->conn[conn].subif_id, 0); +- tc_dbg(priv->tc_priv, MSG_INIT, +- "conn[%d]subif_id[%x]", conn, priv->conn[conn].subif_id); ++ priv->tc_priv->tc_ops.subif_reg(dev, !dev ? dev_name : dev->name, ++ &priv->conn[conn].subif_id, 0); ++ tc_dbg(priv->tc_priv, MSG_INIT, ++ "conn[%d]subif_id[%x]", conn, priv->conn[conn].subif_id); ++ } + vcc = priv->conn[conn].vcc; + + /* set htu entry */ From a96eaa645647d3f4c39bd01d2d43418abf29ad0c Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:53 +0200 Subject: [PATCH 06/18] ipq40xx: fix compatibility with linux-atm tools atm_qos struct should be the same both for user and kernel spaces. Via the __SO_ENCODE() macro it is used to define the SO_ATMQOS socket IOC. During the VRX518 support introduction, the atm_trafprm sturct nested into the atm_qos stucture was update with newer fields that are referenced by the ATM TC layer of the VRX518 TC driver. These new fields are intended to communicate information for extra traffic classes supported by the driver. But we are still using vanilla kernel headers to build the toolchain. Due to the atm.h header incoherency br2684ctl from linux-atm tools is incapable to configure the ATM bridge netdev: br2684ctl: Interface "dsl0" created sucessfully br2684ctl: Communicating over ATM 0.1.2, encapsulation: LLC br2684ctl: setsockopt SO_ATMQOS 22 <-- EINVAL errno br2684ctl: Fatal: failed to connect on socket; File descriptor in bad state There are two options to fix this incoherency. (a) update the header file in the toolchain to build linux-atm against updated atm_trafprm and atm_qos structures, or (b) revert atm_trafprm changes. Since there are no actual users of the extra ATM QoS traffic classes, just drop these extra traffic classes from vrx518_tc ATM TC layer and drop the kernel patch updating atm.h. Besides fixing the compatibility with linux-atm tools, removing the kernel patch should simplify kernel updates removing unneeded burden of maintenance. Run tested with FRITZ!Box 7530 with disabled extra traffic classes and then removed them entirely before the submission. CC: John Crispin Fixes: cfd42a0098 ("ipq40xx: add Intel/Lantiq ATM hacks") Suggested-by: Andre Heider Reported-and-tested-by: nebibigon93@yandex.ru Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-4-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 6d6dc3a3c967174598a44503f4af281574660356) --- ...1-dcdp-atm_tc-drop-extra-qos-classes.patch | 144 ++++++++++++++++++ .../lantiq/vrx518_tc/patches/200-swplat.patch | 12 +- .../lantiq/vrx518_tc/patches/202-napi.patch | 4 +- ...-dcdp-atm_tc-fix-compilation-warning.patch | 6 +- ...tm_tc-fix-crash-on-subif_reg-absence.patch | 4 +- .../patches-6.6/998-lantiq-atm-hacks.patch | 43 ------ 6 files changed, 157 insertions(+), 56 deletions(-) create mode 100644 package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch delete mode 100644 target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch diff --git a/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch b/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch new file mode 100644 index 0000000000..5c7b246545 --- /dev/null +++ b/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch @@ -0,0 +1,144 @@ +Extra ATM traffic classes requires atm_qos struct extension and a set of +new defines. What itself requires atm.h updates both in the kernel and +in the toolchain. On another hand we do not have any real users of these +traffic classes. + +In absence of real user there are no benefits to support this +functionality. There is only the burden of maintenance of extra patches +all around the building framework. So just drop these extra QoS traffic +classes in order to facilitate maintenance and avoid side effects like +breaking compatibility with existing userspace tools like linux-atm. + +Signed-off-by: Sergey Ryazanov +-- +--- a/dcdp/atm_tc.c ++++ b/dcdp/atm_tc.c +@@ -463,34 +463,9 @@ static void set_qsb(struct atm_priv *pri + /* Weighted Fair Queueing Factor (WFQF) */ + switch (qos->txtp.traffic_class) { + case ATM_CBR: +- case ATM_VBR_RT: + /* real time queue gets weighted fair queueing bypass */ + q_parm_tbl.bit.wfqf = 0; + break; +- case ATM_VBR_NRT: +- case ATM_UBR_PLUS: +- /* WFQF calculation here is based on virtual cell rates, +- to reduce granularity for high rates +- */ +- /* WFQF is maximum cell rate / garenteed cell rate */ +- /* wfqf = qsb_minimum_cell_rate * QSB_WFQ_NONUBR_MAX / +- requested_minimum_peak_cell_rate +- */ +- if (qos->txtp.min_pcr == 0) +- q_parm_tbl.bit.wfqf = QSB_WFQ_NONUBR_MAX; +- else { +- tmp = QSB_GCR_MIN * QSB_WFQ_NONUBR_MAX / +- qos->txtp.min_pcr; +- if (tmp == 0) +- q_parm_tbl.bit.wfqf = 1; +- else if (tmp > QSB_WFQ_NONUBR_MAX) +- q_parm_tbl.bit.wfqf +- = QSB_WFQ_NONUBR_MAX; +- else +- q_parm_tbl.bit.wfqf = tmp; +- } +- break; +- + case ATM_UBR: + default: + q_parm_tbl.bit.wfqf = QSB_WFQ_UBR_BYPASS; +@@ -498,42 +473,9 @@ static void set_qsb(struct atm_priv *pri + } + + /* Sustained Cell Rate (SCR) Leaky Bucket Shaper VBR.0/VBR.1 */ +- if (qos->txtp.traffic_class == ATM_VBR_RT || +- qos->txtp.traffic_class == ATM_VBR_NRT) { +- if (qos->txtp.scr == 0) { +- /* disable shaper */ +- q_vbr_parm_tbl.bit.taus = 0; +- q_vbr_parm_tbl.bit.ts = 0; +- } else { +- /* Cell Loss Priority (CLP) */ +- if ((vcc->atm_options & ATM_ATMOPT_CLP)) +- /* CLP1 */ +- q_parm_tbl.bit.vbr = 1; +- else +- /* CLP0 */ +- q_parm_tbl.bit.vbr = 0; +- /* Rate Shaper Parameter (TS) and +- Burst Tolerance Parameter for SCR (tauS) +- */ +- tmp = ((qsb_clk * param->qsb_tstep) >> 5) / +- qos->txtp.scr + 1; +- q_vbr_parm_tbl.bit.ts +- = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp; +- tmp = (qos->txtp.mbs - 1) * +- (q_vbr_parm_tbl.bit.ts - +- q_parm_tbl.bit.tp) / 64; +- if (tmp == 0) +- q_vbr_parm_tbl.bit.taus = 1; +- else if (tmp > QSB_TAUS_MAX) +- q_vbr_parm_tbl.bit.taus +- = QSB_TAUS_MAX; +- else +- q_vbr_parm_tbl.bit.taus = tmp; +- } +- } else { +- q_vbr_parm_tbl.bit.taus = 0; +- q_vbr_parm_tbl.bit.ts = 0; +- } ++ /* NB: shaper disabled since there no user interface to activate it */ ++ q_vbr_parm_tbl.bit.taus = 0; ++ q_vbr_parm_tbl.bit.ts = 0; + + /* Queue Parameter Table (QPT) */ + tc_w32(QSB_QPT_SET_MASK, QSB_RTM); +@@ -1064,15 +1006,6 @@ static int ppe_open(struct atm_vcc *vcc) + /* check bandwidth */ + if ((vcc->qos.txtp.traffic_class == ATM_CBR && + vcc->qos.txtp.max_pcr > +- (port->tx_max_cell_rate - port->tx_used_cell_rate)) +- || (vcc->qos.txtp.traffic_class == ATM_VBR_RT && +- vcc->qos.txtp.max_pcr > +- (port->tx_max_cell_rate - port->tx_used_cell_rate)) +- || (vcc->qos.txtp.traffic_class == ATM_VBR_NRT && +- vcc->qos.txtp.scr > +- (port->tx_max_cell_rate - port->tx_used_cell_rate)) +- || (vcc->qos.txtp.traffic_class == ATM_UBR_PLUS && +- vcc->qos.txtp.min_pcr > + (port->tx_max_cell_rate - port->tx_used_cell_rate))) { + tc_dbg(priv->tc_priv, MSG_INIT, "exceed TX line rate\n"); + return -EINVAL; +@@ -1128,15 +1061,8 @@ static int ppe_open(struct atm_vcc *vcc) + /* reserve bandwidth */ + switch (vcc->qos.txtp.traffic_class) { + case ATM_CBR: +- case ATM_VBR_RT: + port->tx_used_cell_rate += vcc->qos.txtp.max_pcr; + break; +- case ATM_VBR_NRT: +- port->tx_used_cell_rate += vcc->qos.txtp.scr; +- break; +- case ATM_UBR_PLUS: +- port->tx_used_cell_rate += vcc->qos.txtp.min_pcr; +- break; + } + + /* update atm_vcc structure */ +@@ -1222,15 +1148,8 @@ static void ppe_close(struct atm_vcc *vc + /* release bandwidth */ + switch (vcc->qos.txtp.traffic_class) { + case ATM_CBR: +- case ATM_VBR_RT: + port->tx_used_cell_rate -= vcc->qos.txtp.max_pcr; + break; +- case ATM_VBR_NRT: +- port->tx_used_cell_rate -= vcc->qos.txtp.scr; +- break; +- case ATM_UBR_PLUS: +- port->tx_used_cell_rate -= vcc->qos.txtp.min_pcr; +- break; + } + + /* idle for a while to let parallel operation finish */ diff --git a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch index 6596a8b913..930fa6632c 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch @@ -3,7 +3,7 @@ This replaces it by a basic working implementation. --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -603,7 +603,11 @@ static void atm_aca_init(struct atm_priv +@@ -545,7 +545,11 @@ static void atm_aca_init(struct atm_priv cfg = &priv->tc_priv->cfg; txin = ¶m.aca_txin; @@ -15,7 +15,7 @@ This replaces it by a basic working implementation. txin->hd_size_in_dw = cfg->txin.soc_desc_dwsz; txin->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_IN_PD_LIST_BASE); txin->pd_desc_num = __ACA_TX_IN_PD_LIST_NUM; -@@ -625,7 +629,11 @@ static void atm_aca_init(struct atm_priv +@@ -567,7 +571,11 @@ static void atm_aca_init(struct atm_priv txin->soc_cmlt_cnt_addr); txout = ¶m.aca_txout; @@ -27,7 +27,7 @@ This replaces it by a basic working implementation. txout->hd_size_in_dw = cfg->txout.soc_desc_dwsz; txout->pd_desc_base = SB_XBAR_ADDR(__ACA_TX_OUT_PD_LIST_BASE); txout->pd_desc_num = __ACA_TX_OUT_PD_LIST_NUM; -@@ -647,7 +655,11 @@ static void atm_aca_init(struct atm_priv +@@ -589,7 +597,11 @@ static void atm_aca_init(struct atm_priv txout->soc_cmlt_cnt_addr); rxout = ¶m.aca_rxout; @@ -39,7 +39,7 @@ This replaces it by a basic working implementation. rxout->hd_size_in_dw = cfg->rxout.soc_desc_dwsz; rxout->pd_desc_base = SB_XBAR_ADDR(__ACA_RX_OUT_PD_LIST_BASE); rxout->pd_desc_num = __ACA_RX_OUT_PD_LIST_NUM; -@@ -669,7 +681,11 @@ static void atm_aca_init(struct atm_priv +@@ -611,7 +623,11 @@ static void atm_aca_init(struct atm_priv rxout->soc_cmlt_cnt_addr); rxin = ¶m.aca_rxin; @@ -51,7 +51,7 @@ This replaces it by a basic working implementation. rxin->hd_size_in_dw = cfg->rxin.soc_desc_dwsz; rxin->pd_desc_base = SB_XBAR_ADDR(__RX_IN_PD_DES_LIST_BASE); rxin->pd_desc_num = __ACA_RX_IN_PD_LIST_NUM; -@@ -1261,7 +1277,7 @@ static int ppe_ioctl(struct atm_dev *dev +@@ -1180,7 +1196,7 @@ static int ppe_ioctl(struct atm_dev *dev static int ppe_send(struct atm_vcc *vcc, struct sk_buff *skb) { int ret, qid, mpoa_pt, mpoa_type, vid; @@ -60,7 +60,7 @@ This replaces it by a basic working implementation. struct atm_priv *priv; if (!vcc) { -@@ -1327,12 +1343,14 @@ static int ppe_send(struct atm_vcc *vcc, +@@ -1246,12 +1262,14 @@ static int ppe_send(struct atm_vcc *vcc, tc_dbg(priv->tc_priv, MSG_TX, "vid: 0x%x, qid: 0x%x\n", vid, qid); diff --git a/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch b/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch index 266beba1a7..75d18138c0 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/202-napi.patch @@ -296,7 +296,7 @@ priv->tc_ops.umt_start = plat_umt_start; --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -3650,7 +3650,7 @@ static void atm_aca_ring_config_init(str +@@ -3569,7 +3569,7 @@ static void atm_aca_ring_config_init(str static int atm_ring_init(struct atm_priv *priv) { atm_aca_ring_config_init(priv); @@ -305,7 +305,7 @@ } static int atm_init(struct tc_priv *tcpriv, u32 ep_id) -@@ -4020,7 +4020,7 @@ void atm_tc_unload(void) +@@ -3939,7 +3939,7 @@ void atm_tc_unload(void) /* unregister device */ if (priv->tc_priv->tc_ops.dev_unreg != NULL) priv->tc_priv->tc_ops.dev_unreg(NULL, diff --git a/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch b/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch index bf2d82e2b5..1b70a663cd 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/204-dcdp-atm_tc-fix-compilation-warning.patch @@ -1,6 +1,6 @@ --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -746,7 +746,8 @@ static void atm_aca_init(struct atm_priv +@@ -688,7 +688,8 @@ static void atm_aca_init(struct atm_priv ACA_TXOUT_EN | ACA_RXIN_EN | ACA_RXOUT_EN, 1); } @@ -10,7 +10,7 @@ { struct tm nowtm; char tmbuf[64]; -@@ -765,7 +766,8 @@ static int print_datetime(char *buffer, +@@ -707,7 +708,8 @@ static int print_datetime(char *buffer, nowtm.tm_hour, nowtm.tm_min, nowtm.tm_sec); @@ -20,7 +20,7 @@ return 0; } -@@ -967,7 +969,7 @@ void show_atm_pvc(struct seq_file *seq, +@@ -909,7 +911,7 @@ void show_atm_pvc(struct seq_file *seq, char buf[64]; seq_printf(seq, "\tNet device: %s\n", pvc->dev->name); diff --git a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch index 87456424c3..f268c0908c 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/207-dcdp-atm_tc-fix-crash-on-subif_reg-absence.patch @@ -23,7 +23,7 @@ Signed-off-by: Sergey Ryazanov --- --- a/dcdp/atm_tc.c +++ b/dcdp/atm_tc.c -@@ -1232,8 +1232,9 @@ static void ppe_close(struct atm_vcc *vc +@@ -1158,8 +1158,9 @@ static void ppe_close(struct atm_vcc *vc validate_oam_htu_entry(priv, 0); spin_unlock_bh(&priv->atm_lock); @@ -35,7 +35,7 @@ Signed-off-by: Sergey Ryazanov memset(conn, 0, sizeof(*conn)); -@@ -2791,24 +2792,26 @@ static void mpoa_setup_sync(struct atm_p +@@ -2710,24 +2711,26 @@ static void mpoa_setup_sync(struct atm_p struct wtx_queue_config_t tx_qcfg; struct uni_cell_header *cell_header; struct atm_vcc *vcc; diff --git a/target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch b/target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch deleted file mode 100644 index c15a4b3ae3..0000000000 --- a/target/linux/ipq40xx/patches-6.6/998-lantiq-atm-hacks.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: John Crispin -Date: Fri, 3 Aug 2012 10:27:25 +0200 -Subject: [PATCH 04/36] MIPS: lantiq: add atm hack - -Signed-off-by: John Crispin ---- a/include/uapi/linux/atm.h -+++ b/include/uapi/linux/atm.h -@@ -131,8 +131,14 @@ - #define ATM_ABR 4 - #define ATM_ANYCLASS 5 /* compatible with everything */ - -+#define ATM_VBR_NRT ATM_VBR -+#define ATM_VBR_RT 6 -+#define ATM_UBR_PLUS 7 -+#define ATM_GFR 8 -+ - #define ATM_MAX_PCR -1 /* maximum available PCR */ - -+ - struct atm_trafprm { - unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */ - int max_pcr; /* maximum PCR in cells per second */ -@@ -155,6 +161,9 @@ struct atm_trafprm { - unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */ - unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */ - unsigned int spare :9; /* spare bits */ -+ int scr; /* sustained rate in cells per second */ -+ int mbs; /* maximum burst size (MBS) in cells */ -+ int cdv; /* Cell delay variation */ - }; - - struct atm_qos { ---- a/net/atm/proc.c -+++ b/net/atm/proc.c -@@ -141,7 +141,7 @@ static void *vcc_seq_next(struct seq_fil - static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) - { - static const char *const class_name[] = { -- "off", "UBR", "CBR", "VBR", "ABR"}; -+ "off","UBR","CBR","NTR-VBR","ABR","ANY","RT-VBR","UBR+","GFR"}; - static const char *const aal_name[] = { - "---", "1", "2", "3/4", /* 0- 3 */ - "???", "5", "???", "???", /* 4- 7 */ From 04a1d0d410fe4df85e5dfc1716102eb9df0d88ad Mon Sep 17 00:00:00 2001 From: Sergey Ryazanov Date: Thu, 23 Jan 2025 00:26:54 +0200 Subject: [PATCH 07/18] kernel: vrx518_tc: bump PKG_RELEASE Bump PKG_RELEASE after the previous fixes. Signed-off-by: Sergey Ryazanov Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-5-ryazanov.s.a@gmail.com/ Signed-off-by: Hauke Mehrtens (cherry picked from commit 78f908407e2824bc69a65acec270ffb94eca4038) --- package/kernel/lantiq/vrx518_tc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/lantiq/vrx518_tc/Makefile b/package/kernel/lantiq/vrx518_tc/Makefile index a5718d9d5b..d92c6d1c63 100644 --- a/package/kernel/lantiq/vrx518_tc/Makefile +++ b/package/kernel/lantiq/vrx518_tc/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=vrx518_tc PKG_VERSION:=1.5.12.4 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_BASE_NAME:=vrx518_tc_drv UGW_VERSION=8.5.2.10 From d6fe1421614b2db6bae8e2facb9645ddbee480b3 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Tue, 3 Dec 2024 23:02:15 +0800 Subject: [PATCH 08/18] mediatek: cudy: fixes typo for spi and mtd properties Same as commit 3674689, correct 'buswidth' to 'bus-width'. Move the nmbm properties outside the partition definition. Change uppercase to lowercase, add missing read-only flag. Signed-off-by: Chukun Pan (cherry picked from commit ab375a3484db67857450ced461498ad3d7942e05) --- .../linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts | 4 ++-- .../mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts | 12 ++++++------ .../linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts | 14 +++++++------- .../linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 12 ++++++------ .../linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 10 ++++++---- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts index bd6c15225b..7101c4bab0 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000-v1.dts @@ -133,8 +133,8 @@ reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; spi-cal-enable; spi-cal-mode = "read-data"; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts index a1eb9c6e1e..2e84d2b538 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts @@ -148,6 +148,7 @@ label = "Factory"; reg = <0x180000 0x0200000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -163,6 +164,7 @@ label = "bdinfo"; reg = <0x380000 0x0040000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -174,25 +176,23 @@ #nvmem-cell-cells = <1>; }; }; - }; - partition@3C0000 { + partition@3c0000 { label = "FIP"; - reg = <0x3C0000 0x0200000>; + reg = <0x3c0000 0x0200000>; read-only; }; - partition@580000 { + partition@5c0000 { label = "ubi"; - reg = <0x5C0000 0x4000000>; + reg = <0x5c0000 0x4000000>; compatible = "linux,ubi"; }; }; }; }; - &pio { spi0_flash_pins: spi0-pins { mux { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts index 85bdabe474..b1797157ac 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts @@ -117,7 +117,6 @@ &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_flash_pins>; - status = "okay"; spi_nand: spi_nand@0 { @@ -127,18 +126,18 @@ reg = <0>; spi-max-frequency = <52000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; - mediatek,nmbm; - mediatek,bmt-max-ratio = <1>; - mediatek,bmt-max-reserved-blocks = <64>; - partition@0 { label = "BL2"; reg = <0x0000000 0x0100000>; @@ -177,6 +176,7 @@ partition@3c0000 { label = "FIP"; reg = <0x03c0000 0x0200000>; + read-only; }; partition@5c0000 { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 1f03b42b1b..31a2cf5194 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -162,6 +162,7 @@ label = "Factory"; reg = <0x180000 0x0200000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -177,6 +178,7 @@ label = "bdinfo"; reg = <0x380000 0x0040000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -188,25 +190,23 @@ #nvmem-cell-cells = <1>; }; }; - }; - partition@3C0000 { + partition@3c0000 { label = "FIP"; - reg = <0x3C0000 0x0200000>; + reg = <0x3c0000 0x0200000>; read-only; }; - partition@580000 { + partition@5c0000 { label = "ubi"; - reg = <0x5C0000 0x4000000>; + reg = <0x5c0000 0x4000000>; compatible = "linux,ubi"; }; }; }; }; - &pio { spi0_flash_pins: spi0-pins { mux { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts index cf2f79b407..ccefc1926c 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -165,6 +165,7 @@ label = "Factory"; reg = <0x180000 0x0200000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -180,6 +181,7 @@ label = "bdinfo"; reg = <0x380000 0x0040000>; read-only; + nvmem-layout { compatible = "fixed-layout"; #address-cells = <1>; @@ -193,15 +195,15 @@ }; }; - partition@3C0000 { + partition@3c0000 { label = "FIP"; - reg = <0x3C0000 0x0200000>; + reg = <0x3c0000 0x0200000>; read-only; }; - partition@580000 { + partition@5c0000 { label = "ubi"; - reg = <0x5C0000 0x4000000>; + reg = <0x5c0000 0x4000000>; compatible = "linux,ubi"; }; }; From e5f3704f9a7e1117efd53df651bce7dc01f5e58e Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Mon, 9 Dec 2024 23:17:06 +0800 Subject: [PATCH 09/18] mediatek: cudy: fixes 2.5G PHY interrupt support Fixed interrupt support for 2.5G PHY. Removed useless phy-mode on phy node. Tested on Cudy TR3000. Signed-off-by: Chukun Pan (cherry picked from commit 82b69dfaf6ca92eeffb7523295d3d81a1d54323a) --- target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts | 8 +++----- target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts index b1797157ac..abe40403af 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts @@ -77,7 +77,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac0: mac@0 { @@ -105,12 +104,11 @@ rtl8221b_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c45"; reg = <1>; - - reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; - - interrupts = <38 IRQ_TYPE_LEVEL_LOW>; reset-assert-us = <100000>; reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; }; }; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 31a2cf5194..2591de8520 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -81,7 +81,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac0: mac@0 { @@ -105,13 +104,13 @@ &mdio_bus { phy1: phy@1 { - reg = <1>; compatible = "ethernet-phy-ieee802.3-c45"; - phy-mode = "2500base-x"; - reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; - interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + reg = <1>; reset-assert-us = <100000>; reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; realtek,aldps-enable; }; }; From 95dffe39f8df7cc3685d8779426e666d5cc6e3d1 Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Wed, 4 Dec 2024 23:26:28 +0800 Subject: [PATCH 10/18] mediatek: update status led for Cudy TR3000 Use white led when running, consistent with the stock firmware. Signed-off-by: Chukun Pan (cherry picked from commit 87632219d4b8f0c96ea053e375f6f324fab0806f) --- .../linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index 2591de8520..ff3c83a12d 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -12,10 +12,10 @@ aliases { label-mac-device = &gmac1; - led-boot = &led_status; - led-failsafe = &led_status; - led-running = &led_status; - led-upgrade = &led_status; + led-boot = &led_sys_red; + led-failsafe = &led_sys_red; + led-running = &led_sys_white; + led-upgrade = &led_sys_white; serial0 = &uart0; }; @@ -34,8 +34,8 @@ mode { label = "mode"; - linux,input-type = ; linux,code = ; + linux,input-type = ; gpios = <&pio 0 GPIO_ACTIVE_LOW>; debounce-interval = <60>; }; @@ -44,18 +44,17 @@ leds { compatible = "gpio-leds"; - led_status: led_0 { + led_sys_red: led-0 { function = LED_FUNCTION_POWER; color = ; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; - led_1 { + led_sys_white: led-1 { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; - }; usb_vbus: regulator-usb { From a296d09dc48942ac3047819c4f16d0fb08a5c28c Mon Sep 17 00:00:00 2001 From: Chukun Pan Date: Thu, 5 Dec 2024 23:26:18 +0800 Subject: [PATCH 11/18] mediatek: cleanup device tree for cudy devices Fixes typo for led properties. Delete the unused rfb compatible. Signed-off-by: Chukun Pan (cherry picked from commit 64d1b1089c25d778f5f22bfc0c1590a2e83b664e) --- .../mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts | 8 ++++---- .../linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts | 2 +- .../linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts | 4 +--- .../linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts | 14 ++++++-------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts index 2e84d2b538..735cecfe42 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-ap3000outdoor-v1.dts @@ -8,7 +8,7 @@ / { model = "Cudy AP3000 Outdoor v1"; - compatible = "cudy,ap3000outdoor-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,ap3000outdoor-v1", "mediatek,mt7981"; aliases { label-mac-device = &wifi; @@ -42,18 +42,19 @@ leds { compatible = "gpio-leds"; - led_status_green: led@0 { + led_status_green: led-0 { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 10 GPIO_ACTIVE_HIGH>; }; - led_status_red: led_1 { + led_status_red: led-1 { function = LED_FUNCTION_POWER; color = ; gpios = <&pio 11 GPIO_ACTIVE_HIGH>; }; }; + gpio_export { compatible = "gpio-export"; #size-cells = <0>; @@ -89,7 +90,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac1: mac@1 { diff --git a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts index abe40403af..cfe9d45630 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-m3000-v1.dts @@ -6,7 +6,7 @@ / { model = "Cudy M3000 v1"; - compatible = "cudy,m3000-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,m3000-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac0; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts index ff3c83a12d..86d8e857f1 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-tr3000-v1.dts @@ -8,7 +8,7 @@ / { model = "Cudy TR3000 v1"; - compatible = "cudy,tr3000-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,tr3000-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac1; @@ -59,11 +59,9 @@ usb_vbus: regulator-usb { compatible = "regulator-fixed"; - regulator-name = "usb-vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpios = <&pio 9 GPIO_ACTIVE_LOW>; regulator-boot-on; }; diff --git a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts index ccefc1926c..bdc6188a4a 100644 --- a/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts +++ b/target/linux/mediatek/dts/mt7981b-cudy-wr3000s-v1.dts @@ -8,7 +8,7 @@ / { model = "Cudy WR3000S v1"; - compatible = "cudy,wr3000s-v1", "mediatek,mt7981-spim-snand-rfb"; + compatible = "cudy,wr3000s-v1", "mediatek,mt7981"; aliases { label-mac-device = &gmac0; @@ -42,33 +42,32 @@ leds { compatible = "gpio-leds"; - led_status: led@0 { + led_status: led-status { function = LED_FUNCTION_STATUS; color = ; gpios = <&pio 10 GPIO_ACTIVE_LOW>; }; - - led_internet { + led-internet { function = LED_FUNCTION_WAN_ONLINE; color = ; gpios = <&pio 11 GPIO_ACTIVE_LOW>; }; - led_wps { + led-wps { function = LED_FUNCTION_WPS; color = ; gpios = <&pio 9 GPIO_ACTIVE_LOW>; }; - led_wlan2g { + led-wlan2g { function = LED_FUNCTION_WLAN_2GHZ; color = ; gpios = <&pio 6 GPIO_ACTIVE_LOW>; linux,default-trigger = "phy0tpt"; }; - led_wlan5g { + led-wlan5g { function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&pio 7 GPIO_ACTIVE_LOW>; @@ -88,7 +87,6 @@ ð { pinctrl-names = "default"; pinctrl-0 = <&mdio_pins>; - status = "okay"; gmac0: mac@0 { From 1e9966a63ae430a5c48039fd9752bf1c465325f3 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Fri, 24 Jan 2025 22:56:59 +0100 Subject: [PATCH 12/18] kernel: Make kmod-usb-chipidea select kmod-phy-ath79-usb The USB PHY on the ar9330 and similar SoCs needs the PHY driver. In OpenWrt 23.05 it was compiled into the kernel. The kernel 6.6 configuration does not compile it in any more, make the kmod-usb-chipidea driver select it to add it to the images. Fixes: https://github.com/openwrt/openwrt/issues/17710 Fixes: 04bdf9b3323e ("ath79: disable ath79 USB phy drivers by default") Link: https://github.com/openwrt/openwrt/pull/17720 Signed-off-by: Hauke Mehrtens (cherry picked from commit b467e5a0afebbc4982213c03f90dfc6deb717b36) --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 8f934800fc..481d2be59a 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -1737,7 +1737,7 @@ $(eval $(call KernelPackage,usbip-server)) define KernelPackage/usb-chipidea TITLE:=Host and device support for Chipidea controllers - DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ath79 +kmod-usb-ehci +kmod-usb-phy-nop +kmod-usb-roles + DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget @TARGET_ath79 +kmod-usb-ehci +kmod-usb-phy-nop +kmod-usb-roles +kmod-phy-ath79-usb KCONFIG:= \ CONFIG_EXTCON \ CONFIG_USB_CHIPIDEA \ From d30773abe8cc333137a964ffedf878cc425ac9ed Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 23 Jan 2025 03:36:10 +0000 Subject: [PATCH 13/18] generic: fix probe issues with RealTek RTL8221B PHYs Import patch "net: phy: realtek: mark existing MMDs as present" When using Clause-45 mode to access RealTek RTL8221B 2.5G PHYs some versions of the PHY fail to report the MMDs present on the PHY. Mark MMDs PMAPMD, PCS and AN which are always existing according to the datasheet as present to fix that. Fixes: #16823, #17183, #17232 Signed-off-by: Daniel Golle Tested-by: Aleksander Jan Bajkowski Tested-by: Juan Pedro Paredes Caballero (cherry picked from commit 730db6b893748517949b1d3a0c0cb8b6c1288040) --- ...ealtek-mark-existing-MMDs-as-present.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch diff --git a/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch new file mode 100644 index 0000000000..1ef42e866d --- /dev/null +++ b/target/linux/generic/pending-6.6/720-07-net-phy-realtek-mark-existing-MMDs-as-present.patch @@ -0,0 +1,27 @@ +From 1addfb042a9d27788a0fb2c2935045b56fd8560e Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 23 Jan 2025 03:25:29 +0000 +Subject: [PATCH] net: phy: realtek: mark existing MMDs as present + +When using Clause-45 mode to access RealTek RTL8221B 2.5G PHYs some +versions of the PHY fail to report the MMDs present on the PHY. +Mark MMDs PMAPMD, PCS and AN which are always existing according to +the datasheet as present to fix that. + +Signed-off-by: Daniel Golle +--- + drivers/net/phy/realtek/realtek_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/net/phy/realtek/realtek_main.c ++++ b/drivers/net/phy/realtek/realtek_main.c +@@ -1034,6 +1034,9 @@ static int rtl822x_c45_get_features(stru + linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, + phydev->supported); + ++ phydev->c45_ids.mmds_present |= MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS | ++ MDIO_DEVS_AN; ++ + return genphy_c45_pma_read_abilities(phydev); + } + From a1ee311f59d5bd0838444afed7984d5757c5222b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Jan 2025 21:10:53 +0100 Subject: [PATCH 14/18] unetd: fix interface teardown Pass the correct device name in the network_del ubus call Signed-off-by: Felix Fietkau (cherry picked from commit 80ba0d958dc96fb7aba26614f71325507fabd58a) --- package/network/services/unetd/files/unetd.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package/network/services/unetd/files/unetd.sh b/package/network/services/unetd/files/unetd.sh index 2f0f0c478c..2117eab391 100644 --- a/package/network/services/unetd/files/unetd.sh +++ b/package/network/services/unetd/files/unetd.sh @@ -82,11 +82,10 @@ proto_unet_setup() { proto_unet_teardown() { local config="$1" - local iface="$2" local device json_get_vars device - device="${device:-$iface}" + device="${device:-$config}" json_init json_add_string name "$device" From 298654b9ab57b953b5c5d72cc69f1c46e0a5dd23 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Jan 2025 21:18:27 +0100 Subject: [PATCH 15/18] netifd: remove leftover wifi reload_legacy call Commit d12753929165 removed support for it Fixes: #17738 Signed-off-by: Felix Fietkau (cherry picked from commit a3154cfeb6c381576682a8cc5427a8b1bd9daf96) --- package/network/config/netifd/files/etc/init.d/network | 1 - 1 file changed, 1 deletion(-) diff --git a/package/network/config/netifd/files/etc/init.d/network b/package/network/config/netifd/files/etc/init.d/network index 86340b77e5..b8b2a219b1 100755 --- a/package/network/config/netifd/files/etc/init.d/network +++ b/package/network/config/netifd/files/etc/init.d/network @@ -30,7 +30,6 @@ reload_service() { init_switch ubus call network reload || rv=1 - [ -x /sbin/wifi ] && /sbin/wifi reload_legacy return $rv } From 150aa9aeee509dba5255885618d8df372670e8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Owoc?= Date: Sun, 26 Jan 2025 19:53:31 +0100 Subject: [PATCH 16/18] ramips: mt7620: fix patching mac address in caldata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix usage of non-existent 'caldata_patch_mac' function by using the 'caldata_patch_data' function. Fixes: #17734 Signed-off-by: PaweÅ‚ Owoc Link: https://github.com/openwrt/openwrt/pull/17737 Signed-off-by: Hauke Mehrtens (cherry picked from commit 3295f6f1c254cd7e5e5285a05581bf6abbde8999) --- .../mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index 2d1ac2e872..b68efcbba1 100644 --- a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -34,12 +34,12 @@ case "$FIRMWARE" in wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) jboot_eeprom_extract "config" 0xE000 - caldata_patch_mac $wifi_mac 0x4 + caldata_patch_data "${wifi_mac//:/}" 0x4 ;; dovado,tiny-ac) wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR) caldata_extract "factory" 0x0 0x200 - caldata_patch_mac $wifi_mac 0x4 + caldata_patch_data "${wifi_mac//:/}" 0x4 ;; *) caldata_die "Please define mtd-eeprom in $board DTS file!" From e1ba6e407bc5052fc86251581995a055ff24f736 Mon Sep 17 00:00:00 2001 From: Eric Fahlgren Date: Sun, 26 Jan 2025 09:25:13 -0800 Subject: [PATCH 17/18] octeon: ubnt-usg: add board name to supported devices The on-device board name reported by 'ubus call system board' is not present in the generated profiles.json. This results in upgrade tools being unable to match the image with the proper device. Let's add a 'SUPPORTED_DEVICES' entry for the board name to fix this. Links: https://forum.openwrt.org/t/owut-openwrt-upgrade-tool/200035/441 Links: https://github.com/openwrt/openwrt/commit/2a07270180ed0e295d854d6e9e59c78c40549efc Signed-off-by: Eric Fahlgren Link: https://github.com/openwrt/openwrt/pull/17736 Signed-off-by: Hauke Mehrtens (cherry picked from commit 7165937c3b6ebe5ac692fcde1cc69ba1c7a3d9c9) --- target/linux/octeon/image/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/octeon/image/Makefile b/target/linux/octeon/image/Makefile index f00e87c520..dec0480915 100644 --- a/target/linux/octeon/image/Makefile +++ b/target/linux/octeon/image/Makefile @@ -92,6 +92,7 @@ define Device/ubnt_unifi-usg DEVICE_PACKAGES += kmod-gpio-button-hotplug kmod-leds-gpio DEVICE_DTS := cn5020_ubnt_usg KERNEL += | append-dtb-to-elf + SUPPORTED_DEVICES += ubnt,usg endef TARGET_DEVICES += ubnt_unifi-usg From ea66541032b6dab9f53551b983c7a39d283207ef Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 27 Jan 2025 11:07:13 +0100 Subject: [PATCH 18/18] airoha: an7581: refresh and fix cpufreq patch Refresh cpufreq with merged upstream version. Also fix the PM Domain rebased patch to correctly expose the symbol for non Mediatek target. Update dtsi with new pm domain name. Signed-off-by: Christian Marangi (cherry picked from commit fbbfcbf150cd7c72f49c149e7f9b9f4d0bf43e4b) --- target/linux/airoha/an7581/config-6.6 | 1 + target/linux/airoha/dts/an7581.dtsi | 8 +-- ...oha-Add-EN7581-CPUFreq-SMCCC-driver.patch} | 47 +++++----------- ...ha-Add-Airoha-CPU-PM-Domain-support.patch} | 55 +++++++++---------- 4 files changed, 43 insertions(+), 68 deletions(-) rename target/linux/airoha/patches-6.6/{100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch => 039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch} (83%) rename target/linux/airoha/patches-6.6/{100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch => 040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch} (83%) diff --git a/target/linux/airoha/an7581/config-6.6 b/target/linux/airoha/an7581/config-6.6 index f80bf49f8c..d86aa8bbbb 100644 --- a/target/linux/airoha/an7581/config-6.6 +++ b/target/linux/airoha/an7581/config-6.6 @@ -1,4 +1,5 @@ CONFIG_64BIT=y +CONFIG_AIROHA_CPU_PM_DOMAIN=y CONFIG_AIROHA_THERMAL=y CONFIG_AIROHA_WATCHDOG=y CONFIG_AMPERE_ERRATUM_AC03_CPU_38=y diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index 820ab0bfa8..2b4c1b716b 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -81,7 +81,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -95,7 +95,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -109,7 +109,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; @@ -123,7 +123,7 @@ clocks = <&cpufreq>; clock-names = "cpu"; power-domains = <&cpufreq>; - power-domain-names = "cpu_pd"; + power-domain-names = "perf"; next-level-cache = <&l2>; #cooling-cells = <2>; }; diff --git a/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch b/target/linux/airoha/patches-6.6/039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch similarity index 83% rename from target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch rename to target/linux/airoha/patches-6.6/039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch index 6a2e54f4d1..0db82d55e1 100644 --- a/target/linux/airoha/patches-6.6/100-02-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch +++ b/target/linux/airoha/patches-6.6/039-v6.14-cpufreq-airoha-Add-EN7581-CPUFreq-SMCCC-driver.patch @@ -1,7 +1,7 @@ -From fa27cb99b297a1a9c0a5824afe5a670e424fff61 Mon Sep 17 00:00:00 2001 +From 84cf9e541cccb8cb698518a9897942e8c78f1d83 Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Wed, 16 Oct 2024 18:00:57 +0200 -Subject: [PATCH v9 2/2] cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver +Date: Thu, 9 Jan 2025 14:12:58 +0100 +Subject: [PATCH] cpufreq: airoha: Add EN7581 CPUFreq SMCCC driver Add simple CPU Freq driver for Airoha EN7581 SoC that control CPU frequency scaling with SMC APIs and register a generic "cpufreq-dt" @@ -14,29 +14,8 @@ Add SoC compatible to cpufreq-dt-plat block list as a dedicated cpufreq driver is needed with OPP v2 nodes declared in DTS. Signed-off-by: Christian Marangi +Signed-off-by: Viresh Kumar --- -Changes v9: -- Fix compile error targetting wrong branch (remove_new change and new PM OPs) -Changes v8: -- Split in dedicated PM domain driver -Changes v7: -- No changes -Changes v6: -- Improve Kconfig depends logic -- Select PM (PM_GENERIC_DOMAINS depends on it) -- Drop (int) cast for -Changes v5: -- Rename cpu_pd to perf for power domain name -- Use remove instead of remove_new -Changes v4: -- Rework to clk-only + PM set_performance_state implementation -Changes v3: -- Adapt to new cpufreq-dt APIs -- Register cpufreq-dt instead of custom freq driver -Changes v2: -- Fix kernel bot error with missing slab.h and bitfield.h header -- Limit COMPILE_TEST to ARM64 due to smcc 1.2 - drivers/cpufreq/Kconfig.arm | 8 ++ drivers/cpufreq/Makefile | 1 + drivers/cpufreq/airoha-cpufreq.c | 152 +++++++++++++++++++++++++++ @@ -104,11 +83,15 @@ Changes v2: +} + +static const char * const airoha_cpufreq_clk_names[] = { "cpu", NULL }; -+static const char * const airoha_cpufreq_genpd_names[] = { "cpu_pd", NULL }; ++static const char * const airoha_cpufreq_pd_names[] = { "perf", NULL }; + +static int airoha_cpufreq_probe(struct platform_device *pdev) +{ -+ struct dev_pm_opp_config config = { }; ++ struct dev_pm_opp_config config = { ++ .clk_names = airoha_cpufreq_clk_names, ++ .config_clks = airoha_cpufreq_config_clks_nop, ++ .genpd_names = airoha_cpufreq_pd_names, ++ }; + struct platform_device *cpufreq_dt; + struct airoha_cpufreq_priv *priv; + struct device *dev = &pdev->dev; @@ -125,18 +108,14 @@ Changes v2: + if (!priv) + return -ENOMEM; + -+ config.clk_names = airoha_cpufreq_clk_names; -+ config.config_clks = airoha_cpufreq_config_clks_nop; -+ config.genpd_names = airoha_cpufreq_genpd_names; -+ config.virt_devs = &virt_devs; -+ ++ /* Set OPP table conf with NOP config_clks */ + priv->opp_token = dev_pm_opp_set_config(cpu_dev, &config); + if (priv->opp_token < 0) + return dev_err_probe(dev, priv->opp_token, "Failed to set OPP config\n"); + + /* Set Attached PM for OPP ACTIVE */ + if (virt_devs) { -+ const char * const *name = airoha_cpufreq_genpd_names; ++ const char * const *name = airoha_cpufreq_pd_names; + int i, j; + + for (i = 0; *name; i++, name++) { @@ -177,7 +156,7 @@ Changes v2: +static void airoha_cpufreq_remove(struct platform_device *pdev) +{ + struct airoha_cpufreq_priv *priv = platform_get_drvdata(pdev); -+ const char * const *name = airoha_cpufreq_genpd_names; ++ const char * const *name = airoha_cpufreq_pd_names; + int i; + + platform_device_unregister(priv->cpufreq_dt); diff --git a/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch b/target/linux/airoha/patches-6.6/040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch similarity index 83% rename from target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch rename to target/linux/airoha/patches-6.6/040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch index 52d3f40b36..8dc8a3d304 100644 --- a/target/linux/airoha/patches-6.6/100-01-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch +++ b/target/linux/airoha/patches-6.6/040-v6.14-pmdomain-airoha-Add-Airoha-CPU-PM-Domain-support.patch @@ -1,7 +1,7 @@ -From 76e4e6ce9aaae897f80e375345bf0095e1b09ff2 Mon Sep 17 00:00:00 2001 +From 82e703dd438b71432cc0ccbb90925d1e32dd014a Mon Sep 17 00:00:00 2001 From: Christian Marangi -Date: Sat, 4 Jan 2025 19:03:09 +0100 -Subject: [PATCH v9 1/2] pmdomain: airoha: Add Airoha CPU PM Domain support +Date: Thu, 9 Jan 2025 14:12:57 +0100 +Subject: [PATCH] pmdomain: airoha: Add Airoha CPU PM Domain support Add Airoha CPU PM Domain support to control frequency and power of CPU present on Airoha EN7581 SoC. @@ -11,25 +11,21 @@ passing the performance state. The driver also expose a read-only clock that expose the current CPU frequency with SMC command. Signed-off-by: Christian Marangi +Link: https://lore.kernel.org/r/20250109131313.32317-1-ansuelsmth@gmail.com +Signed-off-by: Ulf Hansson --- -Changes v9: -- Fix compile error targetting wrong branch (remove_new change) -Changes v8: -- Add this patch -- Use SMC invoke instead of 1.2 - - drivers/pmdomain/mediatek/Kconfig | 11 ++ + drivers/pmdomain/mediatek/Kconfig | 12 ++ drivers/pmdomain/mediatek/Makefile | 1 + .../pmdomain/mediatek/airoha-cpu-pmdomain.c | 144 ++++++++++++++++++ - 3 files changed, 156 insertions(+) + 3 files changed, 157 insertions(+) create mode 100644 drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c --- a/drivers/soc/mediatek/Kconfig +++ b/drivers/soc/mediatek/Kconfig -@@ -72,6 +72,17 @@ config MTK_SCPSYS_PM_DOMAINS - Control Processor System (SCPSYS) has several power management related - tasks in the system. - +@@ -2,6 +2,17 @@ + # + # MediaTek SoC drivers + # +config AIROHA_CPU_PM_DOMAIN + tristate "Airoha CPU power domain" + default ARCH_AIROHA @@ -41,9 +37,9 @@ Changes v8: + CPU frequency and power is controlled by ATF with SMC command to + set performance states. + - config MTK_MMSYS - tristate "MediaTek MMSYS Support" - default ARCH_MEDIATEK + menu "MediaTek SoC drivers" + depends on ARCH_MEDIATEK || COMPILE_TEST + --- a/drivers/pmdomain/mediatek/Makefile +++ b/drivers/pmdomain/mediatek/Makefile @@ -1,3 +1,4 @@ @@ -53,7 +49,7 @@ Changes v8: +obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN) += airoha-cpu-pmdomain.o --- /dev/null +++ b/drivers/pmdomain/mediatek/airoha-cpu-pmdomain.c -@@ -0,0 +1,145 @@ +@@ -0,0 +1,144 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include @@ -123,9 +119,13 @@ Changes v8: +{ + struct airoha_cpu_pmdomain_priv *priv; + struct device *dev = &pdev->dev; -+ struct clk_init_data init = { }; ++ const struct clk_init_data init = { ++ .name = "cpu", ++ .ops = &airoha_cpu_pmdomain_clk_ops, ++ /* Clock with no set_rate, can't cache */ ++ .flags = CLK_GET_RATE_NOCACHE, ++ }; + struct generic_pm_domain *pd; -+ struct clk_hw *hw; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -133,18 +133,13 @@ Changes v8: + return -ENOMEM; + + /* Init and register a get-only clk for Cpufreq */ -+ init.name = "cpu"; -+ init.ops = &airoha_cpu_pmdomain_clk_ops; -+ /* Clock with no set_rate, can't cache */ -+ init.flags = CLK_GET_RATE_NOCACHE; -+ -+ hw = &priv->hw; -+ hw->init = &init; -+ ret = devm_clk_hw_register(dev, hw); ++ priv->hw.init = &init; ++ ret = devm_clk_hw_register(dev, &priv->hw); + if (ret) + return ret; + -+ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); ++ ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, ++ &priv->hw); + if (ret) + return ret; +