@@ -1284,6 +1284,19 @@ mtk_get_tag_protocol(struct dsa_switch *ds, int port,
}
}
+static void
+mt7530_set_jumbo(struct mt7530_priv *priv, u8 kilobytes)
+{
+ if (kilobytes > 15)
+ kilobytes = 15;
+
+ if (kilobytes > 1)
+ mt7530_rmw(priv, MT7530_GMACCR, MAX_RX_JUMBO_MASK | MAX_RX_PKT_LEN_MASK,
+ MAX_RX_JUMBO_KB(kilobytes) | MAX_RX_PKT_LEN_JMB);
+ else
+ mt7530_rmw(priv, MT7530_GMACCR, MAX_RX_PKT_LEN_MASK, MAX_RX_PKT_LEN_1536);
+}
+
static int
mt7530_setup(struct dsa_switch *ds)
{
@@ -1428,6 +1441,9 @@ mt7530_setup(struct dsa_switch *ds)
if (ret < 0)
return ret;
+ /* Enable jumbo frame up to 15 KB */
+ mt7530_set_jumbo(priv, 15);
+
return 0;
}
@@ -223,6 +223,13 @@ enum mt7530_vlan_port_attr {
#define PMSR_DPX BIT(1)
#define PMSR_LINK BIT(0)
+#define MT7530_GMACCR 0x30e0
+#define MAX_RX_JUMBO_KB(x) ((x) << 2)
+#define MAX_RX_JUMBO_MASK MAX_RX_JUMBO_KB(0xf)
+#define MAX_RX_PKT_LEN_MASK 0x3
+#define MAX_RX_PKT_LEN_1536 0x1
+#define MAX_RX_PKT_LEN_JMB MAX_RX_PKT_LEN_MASK
+
/* Register for MIB */
#define MT7530_PORT_MIB_COUNTER(x) (0x4000 + (x) * 0x100)
#define MT7530_MIB_CCR 0x4fe0
Enable jumbo frame for MT7530 It allows frames up to 15 KB (including FCS) Signed-off-by: DENG Qingfang <dqfext@gmail.com> --- drivers/net/dsa/mt7530.c | 16 ++++++++++++++++ drivers/net/dsa/mt7530.h | 7 +++++++ 2 files changed, 23 insertions(+)