kernel: generic backport 6.1: rename mistyped .patch file
[openwrt/openwrt.git] / target / linux / generic / pending-6.6 / 745-11-net-dsa-mt7530-refactor-MT7530_PMEEECR_P.patch
1 From 2dff9759602b069f97ccc939e15a47ca051b2983 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
3 Date: Mon, 22 Apr 2024 10:15:18 +0300
4 Subject: [PATCH 11/15] net: dsa: mt7530: refactor MT7530_PMEEECR_P()
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The MT7530_PMEEECR_P() register is on MT7530, MT7531, and the switch on the
10 MT7988 SoC. Rename the definition for them to MT753X_PMEEECR_P(). Use the
11 FIELD_PREP and FIELD_GET macros. Rename GET_LPI_THRESH() and
12 SET_LPI_THRESH() to LPI_THRESH_GET() and LPI_THRESH_SET().
13
14 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
15 ---
16 drivers/net/dsa/mt7530.c | 8 ++++----
17 drivers/net/dsa/mt7530.h | 13 +++++++------
18 2 files changed, 11 insertions(+), 10 deletions(-)
19
20 --- a/drivers/net/dsa/mt7530.c
21 +++ b/drivers/net/dsa/mt7530.c
22 @@ -3035,10 +3035,10 @@ static int mt753x_get_mac_eee(struct dsa
23 struct ethtool_eee *e)
24 {
25 struct mt7530_priv *priv = ds->priv;
26 - u32 eeecr = mt7530_read(priv, MT7530_PMEEECR_P(port));
27 + u32 eeecr = mt7530_read(priv, MT753X_PMEEECR_P(port));
28
29 e->tx_lpi_enabled = !(eeecr & LPI_MODE_EN);
30 - e->tx_lpi_timer = GET_LPI_THRESH(eeecr);
31 + e->tx_lpi_timer = LPI_THRESH_GET(eeecr);
32
33 return 0;
34 }
35 @@ -3052,11 +3052,11 @@ static int mt753x_set_mac_eee(struct dsa
36 if (e->tx_lpi_timer > 0xFFF)
37 return -EINVAL;
38
39 - set = SET_LPI_THRESH(e->tx_lpi_timer);
40 + set = LPI_THRESH_SET(e->tx_lpi_timer);
41 if (!e->tx_lpi_enabled)
42 /* Force LPI Mode without a delay */
43 set |= LPI_MODE_EN;
44 - mt7530_rmw(priv, MT7530_PMEEECR_P(port), mask, set);
45 + mt7530_rmw(priv, MT753X_PMEEECR_P(port), mask, set);
46
47 return 0;
48 }
49 --- a/drivers/net/dsa/mt7530.h
50 +++ b/drivers/net/dsa/mt7530.h
51 @@ -364,13 +364,14 @@ enum mt7530_vlan_port_acc_frm {
52 PMCR_FORCE_SPEED_100 | \
53 PMCR_FORCE_FDX | PMCR_FORCE_LNK)
54
55 -#define MT7530_PMEEECR_P(x) (0x3004 + (x) * 0x100)
56 -#define WAKEUP_TIME_1000(x) (((x) & 0xFF) << 24)
57 -#define WAKEUP_TIME_100(x) (((x) & 0xFF) << 16)
58 +#define MT753X_PMEEECR_P(x) (0x3004 + (x) * 0x100)
59 +#define WAKEUP_TIME_1000_MASK GENMASK(31, 24)
60 +#define WAKEUP_TIME_1000(x) FIELD_PREP(WAKEUP_TIME_1000_MASK, x)
61 +#define WAKEUP_TIME_100_MASK GENMASK(23, 16)
62 +#define WAKEUP_TIME_100(x) FIELD_PREP(WAKEUP_TIME_100_MASK, x)
63 #define LPI_THRESH_MASK GENMASK(15, 4)
64 -#define LPI_THRESH_SHT 4
65 -#define SET_LPI_THRESH(x) (((x) << LPI_THRESH_SHT) & LPI_THRESH_MASK)
66 -#define GET_LPI_THRESH(x) (((x) & LPI_THRESH_MASK) >> LPI_THRESH_SHT)
67 +#define LPI_THRESH_GET(x) FIELD_GET(LPI_THRESH_MASK, x)
68 +#define LPI_THRESH_SET(x) FIELD_PREP(LPI_THRESH_MASK, x)
69 #define LPI_MODE_EN BIT(0)
70
71 #define MT7530_PMSR_P(x) (0x3008 + (x) * 0x100)