mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 17:01:14 +00:00
9e86e0b33b
Changelogs: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.67 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.68 https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.69 Upstreamed patches: target/linux/generic/backport-6.1/740-v6.9-01-netfilter-flowtable-validate-pppoe-header.patch [1] target/linux/generic/backport-6.1/740-v6.9-02-netfilter-flowtable-incorrect-pppoe-tuple.patch [2] target/linux/generic/backport-6.1/790-48-STABLE-net-dsa-mt7530-trap-link-local-frames-regardless-of-.patch [3] target/linux/generic/backport-6.1/790-50-v6.10-net-dsa-mt7530-fix-mirroring-frames-received-on-loca.patch [4] target/linux/generic/backport-6.1/790-16-v6.4-net-dsa-mt7530-set-all-CPU-ports-in-MT7531_CPU_PMAP.patch [5] target/linux/generic/backport-6.1/790-46-v6.9-net-dsa-mt7530-fix-improper-frames-on-all-25MHz-and-.patch [6] target/linux/generic/backport-6.1/790-47-v6.10-net-dsa-mt7530-fix-enabling-EEE-on-MT7531-switch-on-.patch [7] target/linux/mediatek/patches-6.1/220-v6.3-clk-mediatek-clk-gate-Propagate-struct-device-with-m.patch [8] target/linux/mediatek/patches-6.1/222-v6.3-clk-mediatek-clk-mtk-Propagate-struct-device-for-com.patch [9] target/linux/mediatek/patches-6.1/223-v6.3-clk-mediatek-clk-mux-Propagate-struct-device-for-mtk.patch [10] target/linux/mediatek/patches-6.1/226-v6.3-clk-mediatek-clk-mtk-Extend-mtk_clk_simple_probe.patch [11] Symbol changes: MITIGATION_SPECTRE_BHI (new) [12] SPECTRE_BHI_{ON,OFF} (deprecated) [12] References: [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=8bf7c76a2a207ca2b4cfda0a279192adf27678d7 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=f1c3c61701a0b12f4906152c1626a5de580ea3d2 [3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=19643bf8c9b5bb5eea5163bf2f6a3eee6fb5b99b [4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=e86c9db58eba290e858e2bb80efcde9e3973a5ef [5] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=013c787d231188a6408e2991150d3c9bf9a2aa0b [6] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=41a004ffba9b1fd8a5a7128ebd0dfa3ed39c3316 [7] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=7d51db455ca03e5270cc585a75a674abd063fa6c [8] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=082b831488a41257b7ac7ffa1d80a0b60d98394d [9] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=6f5f72a684a2823f21efbfd20c7e4b528c44a781 [10] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=a4fe8813a7868ba5867e42e60de7a2b8baac30ff [11] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=c1d87d56af063c87961511ee25f6b07a5676d27d [12] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.89&id=d844df110084ef8bd950a52194865f3f63b561ca Signed-off-by: Shiji Yang <yangshiji66@qq.com>
228 lines
7.2 KiB
Diff
228 lines
7.2 KiB
Diff
From b0d590a5cdd95ed863717b279751d6166083889f Mon Sep 17 00:00:00 2001
|
||
From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
|
||
Date: Mon, 22 Jan 2024 08:35:54 +0300
|
||
Subject: [PATCH 25/48] net: dsa: mt7530: store port 5 SGMII capability of
|
||
MT7531
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Introduce the p5_sgmii field to store the information for whether port 5
|
||
has got SGMII or not. Instead of reading the MT7531_TOP_SIG_SR register
|
||
multiple times, the register will be read once and the value will be
|
||
stored on the p5_sgmii field. This saves unnecessary reads of the
|
||
register.
|
||
|
||
Move the comment about MT7531AE and MT7531BE to mt7531_setup(), where the
|
||
switch is identified.
|
||
|
||
Get rid of mt7531_dual_sgmii_supported() now that priv->p5_sgmii stores the
|
||
information. Address the code where mt7531_dual_sgmii_supported() is used.
|
||
|
||
Get rid of mt7531_is_rgmii_port() which just prints the opposite of
|
||
priv->p5_sgmii.
|
||
|
||
Instead of calling mt7531_pll_setup() then returning, do not call it if
|
||
port 5 is SGMII.
|
||
|
||
Remove P5_INTF_SEL_GMAC5_SGMII. The p5_interface_select enum is supposed to
|
||
represent the mode that port 5 is being used in, not the hardware
|
||
information of port 5. Set p5_intf_sel to P5_INTF_SEL_GMAC5 instead, if
|
||
port 5 is not dsa_is_unused_port().
|
||
|
||
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
|
||
Acked-by: Daniel Golle <daniel@makrotopia.org>
|
||
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
||
Link: https://lore.kernel.org/r/20240122-for-netnext-mt7530-improvements-1-v3-3-042401f2b279@arinc9.com
|
||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||
---
|
||
drivers/net/dsa/mt7530-mdio.c | 7 ++---
|
||
drivers/net/dsa/mt7530.c | 48 ++++++++++++-----------------------
|
||
drivers/net/dsa/mt7530.h | 6 +++--
|
||
3 files changed, 22 insertions(+), 39 deletions(-)
|
||
|
||
--- a/drivers/net/dsa/mt7530-mdio.c
|
||
+++ b/drivers/net/dsa/mt7530-mdio.c
|
||
@@ -81,17 +81,14 @@ static const struct regmap_bus mt7530_re
|
||
};
|
||
|
||
static int
|
||
-mt7531_create_sgmii(struct mt7530_priv *priv, bool dual_sgmii)
|
||
+mt7531_create_sgmii(struct mt7530_priv *priv)
|
||
{
|
||
struct regmap_config *mt7531_pcs_config[2] = {};
|
||
struct phylink_pcs *pcs;
|
||
struct regmap *regmap;
|
||
int i, ret = 0;
|
||
|
||
- /* MT7531AE has two SGMII units for port 5 and port 6
|
||
- * MT7531BE has only one SGMII unit for port 6
|
||
- */
|
||
- for (i = dual_sgmii ? 0 : 1; i < 2; i++) {
|
||
+ for (i = priv->p5_sgmii ? 0 : 1; i < 2; i++) {
|
||
mt7531_pcs_config[i] = devm_kzalloc(priv->dev,
|
||
sizeof(struct regmap_config),
|
||
GFP_KERNEL);
|
||
--- a/drivers/net/dsa/mt7530.c
|
||
+++ b/drivers/net/dsa/mt7530.c
|
||
@@ -487,15 +487,6 @@ mt7530_pad_clk_setup(struct dsa_switch *
|
||
return 0;
|
||
}
|
||
|
||
-static bool mt7531_dual_sgmii_supported(struct mt7530_priv *priv)
|
||
-{
|
||
- u32 val;
|
||
-
|
||
- val = mt7530_read(priv, MT7531_TOP_SIG_SR);
|
||
-
|
||
- return (val & PAD_DUAL_SGMII_EN) != 0;
|
||
-}
|
||
-
|
||
static int
|
||
mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
|
||
{
|
||
@@ -510,9 +501,6 @@ mt7531_pll_setup(struct mt7530_priv *pri
|
||
u32 xtal;
|
||
u32 val;
|
||
|
||
- if (mt7531_dual_sgmii_supported(priv))
|
||
- return;
|
||
-
|
||
val = mt7530_read(priv, MT7531_CREV);
|
||
top_sig = mt7530_read(priv, MT7531_TOP_SIG_SR);
|
||
hwstrap = mt7530_read(priv, MT7531_HWTRAP);
|
||
@@ -927,8 +915,6 @@ static const char *p5_intf_modes(unsigne
|
||
return "PHY P4";
|
||
case P5_INTF_SEL_GMAC5:
|
||
return "GMAC5";
|
||
- case P5_INTF_SEL_GMAC5_SGMII:
|
||
- return "GMAC5_SGMII";
|
||
default:
|
||
return "unknown";
|
||
}
|
||
@@ -2697,6 +2683,12 @@ mt7531_setup(struct dsa_switch *ds)
|
||
return -ENODEV;
|
||
}
|
||
|
||
+ /* MT7531AE has got two SGMII units. One for port 5, one for port 6.
|
||
+ * MT7531BE has got only one SGMII unit which is for port 6.
|
||
+ */
|
||
+ val = mt7530_read(priv, MT7531_TOP_SIG_SR);
|
||
+ priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN);
|
||
+
|
||
/* all MACs must be forced link-down before sw reset */
|
||
for (i = 0; i < MT7530_NUM_PORTS; i++)
|
||
mt7530_write(priv, MT7530_PMCR_P(i), MT7531_FORCE_LNK);
|
||
@@ -2706,21 +2698,18 @@ mt7531_setup(struct dsa_switch *ds)
|
||
SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
|
||
SYS_CTRL_REG_RST);
|
||
|
||
- mt7531_pll_setup(priv);
|
||
-
|
||
- if (mt7531_dual_sgmii_supported(priv)) {
|
||
- priv->p5_intf_sel = P5_INTF_SEL_GMAC5_SGMII;
|
||
-
|
||
+ if (!priv->p5_sgmii) {
|
||
+ mt7531_pll_setup(priv);
|
||
+ } else {
|
||
/* Let ds->slave_mii_bus be able to access external phy. */
|
||
mt7530_rmw(priv, MT7531_GPIO_MODE1, MT7531_GPIO11_RG_RXD2_MASK,
|
||
MT7531_EXT_P_MDC_11);
|
||
mt7530_rmw(priv, MT7531_GPIO_MODE1, MT7531_GPIO12_RG_RXD3_MASK,
|
||
MT7531_EXT_P_MDIO_12);
|
||
- } else {
|
||
- priv->p5_intf_sel = P5_INTF_SEL_GMAC5;
|
||
}
|
||
- dev_dbg(ds->dev, "P5 support %s interface\n",
|
||
- p5_intf_modes(priv->p5_intf_sel));
|
||
+
|
||
+ if (!dsa_is_unused_port(ds, 5))
|
||
+ priv->p5_intf_sel = P5_INTF_SEL_GMAC5;
|
||
|
||
mt7530_rmw(priv, MT7531_GPIO_MODE0, MT7531_GPIO0_MASK,
|
||
MT7531_GPIO0_INTERRUPT);
|
||
@@ -2787,11 +2776,6 @@ static void mt7530_mac_port_get_caps(str
|
||
}
|
||
}
|
||
|
||
-static bool mt7531_is_rgmii_port(struct mt7530_priv *priv, u32 port)
|
||
-{
|
||
- return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII);
|
||
-}
|
||
-
|
||
static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port,
|
||
struct phylink_config *config)
|
||
{
|
||
@@ -2804,7 +2788,7 @@ static void mt7531_mac_port_get_caps(str
|
||
break;
|
||
|
||
case 5: /* 2nd cpu port supports either rgmii or sgmii/8023z */
|
||
- if (mt7531_is_rgmii_port(priv, port)) {
|
||
+ if (!priv->p5_sgmii) {
|
||
phy_interface_set_rgmii(config->supported_interfaces);
|
||
break;
|
||
}
|
||
@@ -2871,7 +2855,7 @@ static int mt7531_rgmii_setup(struct mt7
|
||
{
|
||
u32 val;
|
||
|
||
- if (!mt7531_is_rgmii_port(priv, port)) {
|
||
+ if (priv->p5_sgmii) {
|
||
dev_err(priv->dev, "RGMII mode is not available for port %d\n",
|
||
port);
|
||
return -EINVAL;
|
||
@@ -3114,7 +3098,7 @@ mt7531_cpu_port_config(struct dsa_switch
|
||
|
||
switch (port) {
|
||
case 5:
|
||
- if (mt7531_is_rgmii_port(priv, port))
|
||
+ if (!priv->p5_sgmii)
|
||
interface = PHY_INTERFACE_MODE_RGMII;
|
||
else
|
||
interface = PHY_INTERFACE_MODE_2500BASEX;
|
||
@@ -3272,7 +3256,7 @@ mt753x_setup(struct dsa_switch *ds)
|
||
mt7530_free_irq_common(priv);
|
||
|
||
if (priv->create_sgmii) {
|
||
- ret = priv->create_sgmii(priv, mt7531_dual_sgmii_supported(priv));
|
||
+ ret = priv->create_sgmii(priv);
|
||
if (ret && priv->irq)
|
||
mt7530_free_irq(priv);
|
||
}
|
||
--- a/drivers/net/dsa/mt7530.h
|
||
+++ b/drivers/net/dsa/mt7530.h
|
||
@@ -717,7 +717,6 @@ enum p5_interface_select {
|
||
P5_INTF_SEL_PHY_P0,
|
||
P5_INTF_SEL_PHY_P4,
|
||
P5_INTF_SEL_GMAC5,
|
||
- P5_INTF_SEL_GMAC5_SGMII,
|
||
};
|
||
|
||
struct mt7530_priv;
|
||
@@ -779,6 +778,8 @@ struct mt753x_info {
|
||
* registers
|
||
* @p6_interface Holding the current port 6 interface
|
||
* @p5_intf_sel: Holding the current port 5 interface select
|
||
+ * @p5_sgmii: Flag for distinguishing if port 5 of the MT7531 switch
|
||
+ * has got SGMII
|
||
* @irq: IRQ number of the switch
|
||
* @irq_domain: IRQ domain of the switch irq_chip
|
||
* @irq_enable: IRQ enable bits, synced to SYS_INT_EN
|
||
@@ -800,6 +801,7 @@ struct mt7530_priv {
|
||
phy_interface_t p6_interface;
|
||
phy_interface_t p5_interface;
|
||
enum p5_interface_select p5_intf_sel;
|
||
+ bool p5_sgmii;
|
||
u8 mirror_rx;
|
||
u8 mirror_tx;
|
||
struct mt7530_port ports[MT7530_NUM_PORTS];
|
||
@@ -809,7 +811,7 @@ struct mt7530_priv {
|
||
int irq;
|
||
struct irq_domain *irq_domain;
|
||
u32 irq_enable;
|
||
- int (*create_sgmii)(struct mt7530_priv *priv, bool dual_sgmii);
|
||
+ int (*create_sgmii)(struct mt7530_priv *priv);
|
||
u8 active_cpu_ports;
|
||
};
|
||
|