From: Weijie Gao <weijie.gao@mediatek.com>
To: <u-boot@lists.denx.de>
Cc: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
"Joe Hershberger" <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>,
Weijie Gao <weijie.gao@mediatek.com>
Subject: [PATCH v2 13/14] net: mediatek: add support for MediaTek MT7621 SoC
Date: Fri, 19 Nov 2021 09:37:06 +0800 [thread overview]
Message-ID: <880f4d18b3927801577d3c2e4eec128bf3830706.1637285375.git.weijie.gao@mediatek.com> (raw)
In-Reply-To: <cover.1637285375.git.weijie.gao@mediatek.com>
This patch adds GMAC support for MediaTek MT7621 SoC.
MT7621 has the same GMAC/Switch configuration as MT7623.
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
v2 changes: none
---
drivers/net/mtk_eth.c | 27 +++++++++++++++++++++------
drivers/net/mtk_eth.h | 8 ++++++++
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index 26f02847a2..3b42c99c2a 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -145,7 +145,8 @@ enum mtk_switch {
enum mtk_soc {
SOC_MT7623,
SOC_MT7629,
- SOC_MT7622
+ SOC_MT7622,
+ SOC_MT7621
};
struct mtk_eth_priv {
@@ -669,12 +670,18 @@ static int mt7530_pad_clk_setup(struct mtk_eth_priv *priv, int mode)
static int mt7530_setup(struct mtk_eth_priv *priv)
{
u16 phy_addr, phy_val;
- u32 val;
+ u32 val, txdrv;
int i;
- /* Select 250MHz clk for RGMII mode */
- mtk_ethsys_rmw(priv, ETHSYS_CLKCFG0_REG,
- ETHSYS_TRGMII_CLK_SEL362_5, 0);
+ if (priv->soc != SOC_MT7621) {
+ /* Select 250MHz clk for RGMII mode */
+ mtk_ethsys_rmw(priv, ETHSYS_CLKCFG0_REG,
+ ETHSYS_TRGMII_CLK_SEL362_5, 0);
+
+ txdrv = 8;
+ } else {
+ txdrv = 4;
+ }
/* Modify HWTRAP first to allow direct access to internal PHYs */
mt753x_reg_read(priv, HWTRAP_REG, &val);
@@ -732,7 +739,8 @@ static int mt7530_setup(struct mtk_eth_priv *priv)
/* Lower Tx Driving for TRGMII path */
for (i = 0 ; i < NUM_TRGMII_CTRL ; i++)
mt753x_reg_write(priv, MT7530_TRGMII_TD_ODT(i),
- (8 << TD_DM_DRVP_S) | (8 << TD_DM_DRVN_S));
+ (txdrv << TD_DM_DRVP_S) |
+ (txdrv << TD_DM_DRVN_S));
for (i = 0 ; i < NUM_TRGMII_CTRL; i++)
mt753x_reg_rmw(priv, MT7530_TRGMII_RD(i), RD_TAP_M, 16);
@@ -1437,6 +1445,12 @@ static int mtk_eth_of_to_plat(struct udevice *dev)
return -ENODEV;
}
+ if (priv->soc == SOC_MT7621) {
+ /* ioremap is needed for MIPS platform */
+ priv->ethsys_base =
+ ioremap_nocache((phys_addr_t)priv->ethsys_base, 0x100);
+ }
+
/* Reset controllers */
ret = reset_get_by_name(dev, "fe", &priv->rst_fe);
if (ret) {
@@ -1542,6 +1556,7 @@ static const struct udevice_id mtk_eth_ids[] = {
{ .compatible = "mediatek,mt7629-eth", .data = SOC_MT7629 },
{ .compatible = "mediatek,mt7623-eth", .data = SOC_MT7623 },
{ .compatible = "mediatek,mt7622-eth", .data = SOC_MT7622 },
+ { .compatible = "mediatek,mt7621-eth", .data = SOC_MT7621 },
{}
};
diff --git a/drivers/net/mtk_eth.h b/drivers/net/mtk_eth.h
index 057ecfaabf..4a8c66c671 100644
--- a/drivers/net/mtk_eth.h
+++ b/drivers/net/mtk_eth.h
@@ -412,4 +412,12 @@
#define PHY_POWER_SAVING_M 0x300
#define PHY_POWER_SAVING_TX 0x0
+#ifndef CONFIG_SYS_NONCACHED_MEMORY
+/*
+ * noncached_alloc is provided only for ARM. Add a prototype here for other
+ * platforms to suppress compilation warning.
+ */
+phys_addr_t noncached_alloc(size_t size, size_t align);
+#endif
+
#endif /* _MTK_ETH_H_ */
--
2.17.1
next prev parent reply other threads:[~2021-11-19 1:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 1:35 [PATCH v2 00/14] Add support for MediaTek MT7621 SoC Weijie Gao
2021-11-19 1:35 ` [PATCH v2 01/14] mips: mtmips: add " Weijie Gao
2021-11-19 1:35 ` [PATCH v2 02/14] mips: mtmips: add two reference boards for mt7621 Weijie Gao
2021-11-19 1:35 ` [PATCH v2 03/14] clk: mtmips: add clock driver for MediaTek MT7621 SoC Weijie Gao
2021-11-26 17:44 ` Sean Anderson
2021-12-03 10:06 ` Weijie Gao
2021-12-15 16:11 ` Sean Anderson
2021-12-27 8:06 ` Weijie Gao
2021-12-31 2:30 ` Sean Anderson
2021-11-19 1:36 ` [PATCH v2 04/14] reset: mtmips: add reset controller support " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 05/14] pinctrl: mtmips: add " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 06/14] nand: raw: " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 07/14] usb: xhci-mtk: " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 08/14] phy: mtk-tphy: " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 09/14] spi: " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 10/14] gpio: " Weijie Gao
2021-11-19 1:36 ` [PATCH v2 11/14] watchdog: " Weijie Gao
2021-11-19 1:37 ` [PATCH v2 12/14] mmc: mediatek: " Weijie Gao
2021-11-22 23:41 ` Jaehoon Chung
2021-11-19 1:37 ` Weijie Gao [this message]
2021-11-21 19:14 ` [PATCH v2 13/14] net: " Ramon Fried
2021-11-22 8:09 ` Weijie Gao
2021-11-19 1:37 ` [PATCH v2 14/14] MAINTAINERS: update maintainer for MediaTek MIPS platform Weijie Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=880f4d18b3927801577d3c2e4eec128bf3830706.1637285375.git.weijie.gao@mediatek.com \
--to=weijie.gao@mediatek.com \
--cc=GSS_MTK_Uboot_upstream@mediatek.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).