[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <87e0b1106c4c78278caa0cb52784e6aa2353f340.1691047285.git.chenfeiyang@loongson.cn>
Date: Thu, 3 Aug 2023 19:30:02 +0800
From: Feiyang Chen <chenfeiyang@...ngson.cn>
To: andrew@...n.ch,
hkallweit1@...il.com,
peppe.cavallaro@...com,
alexandre.torgue@...s.st.com,
joabreu@...opsys.com,
chenhuacai@...ngson.cn
Cc: Feiyang Chen <chenfeiyang@...ngson.cn>,
linux@...linux.org.uk,
dongbiao@...ngson.cn,
loongson-kernel@...ts.loongnix.cn,
netdev@...r.kernel.org,
loongarch@...ts.linux.dev,
chris.chenfeiyang@...il.com
Subject: [PATCH v3 08/16] net: stmmac: dwmac1000: Allow platforms to set control value
Some platforms need extra control value to configure GMAC core, add
control_value variable for them.
Signed-off-by: Feiyang Chen <chenfeiyang@...ngson.cn>
---
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 4 ++++
include/linux/stmmac.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index ad712e337a50..d1c30ca9a56a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -24,6 +24,7 @@
static void dwmac1000_core_init(struct mac_device_info *hw,
struct net_device *dev)
{
+ struct stmmac_priv *priv = netdev_priv(dev);
void __iomem *ioaddr = hw->pcsr;
u32 value = readl(ioaddr + GMAC_CONTROL);
int mtu = dev->mtu;
@@ -31,6 +32,9 @@ static void dwmac1000_core_init(struct mac_device_info *hw,
/* Configure GMAC core */
value |= GMAC_CORE_INIT;
+ if (priv->plat->control_value)
+ value |= priv->plat->control_value;
+
if (mtu > 1500)
value |= GMAC_CONTROL_2K;
if (mtu > 2000)
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index ad2905cd226c..9f6037b7b5e1 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -358,5 +358,6 @@ struct plat_stmmacenet_data {
const struct dwmac_regs *dwmac_regs;
bool fix_channel_num;
bool dma_reset_times;
+ u32 control_value;
};
#endif
--
2.39.3
Powered by blists - more mailing lists