From: Daniel Golle <daniel@makrotopia.org>
To: Weijie Gao <weijie.gao@mediatek.com>
Cc: u-boot@lists.denx.de,
GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>
Subject: Re: [PATCH v2 09/32] net: mediatek: add support for MediaTek MT7981/MT7986
Date: Thu, 1 Sep 2022 01:22:25 +0100 [thread overview]
Message-ID: <Yw/7QZBsdDeSpJd7@makrotopia.org> (raw)
In-Reply-To: <206238f54e48bca475934c2cf81f741dd08c67b0.1661941661.git.weijie.gao@mediatek.com>
On Wed, Aug 31, 2022 at 07:04:29PM +0800, Weijie Gao wrote:
> This patch adds support for MediaTek MT7981 and MT7986. Both chips uses
> PDMA v2.
>
Tested on Bananapi BPi-R2 (MT7623), Bananapi BPi-R64 (MT7623) and
Bananapi BPi-R3 (MT7986A).
Tested-by: Daniel Golle <daniel@makrotopia.org>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
> ---
> v2 changes: none
> ---
> drivers/net/mtk_eth.c | 27 +++++++++++++++++++++++++++
> drivers/net/mtk_eth.h | 5 +++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
> index fb72baae68..4c9fb266c7 100644
> --- a/drivers/net/mtk_eth.c
> +++ b/drivers/net/mtk_eth.c
> @@ -115,6 +115,7 @@ struct mtk_eth_priv {
> int force_mode;
> int speed;
> int duplex;
> + bool pn_swap;
>
> struct phy_device *phydev;
> int phy_interface;
> @@ -1057,6 +1058,12 @@ static void mtk_sgmii_init(struct mtk_eth_priv *priv)
> /* SGMII force mode setting */
> writel(SGMII_FORCE_MODE, priv->sgmii_base + SGMSYS_SGMII_MODE);
>
> + /* SGMII PN SWAP setting */
> + if (priv->pn_swap) {
> + setbits_le32(priv->sgmii_base + SGMSYS_QPHY_WRAP_CTRL,
> + SGMII_PN_SWAP_TX_RX);
> + }
> +
> /* Release PHYA power down state */
> clrsetbits_le32(priv->sgmii_base + SGMSYS_QPHY_PWR_STATE_CTRL,
> SGMII_PHYA_PWD, 0);
> @@ -1470,6 +1477,8 @@ static int mtk_eth_of_to_plat(struct udevice *dev)
> dev_err(dev, "Unable to find sgmii\n");
> return -ENODEV;
> }
> +
> + priv->pn_swap = ofnode_read_bool(args.node, "pn_swap");
> }
>
> /* check for switch first, otherwise phy will be used */
> @@ -1520,6 +1529,22 @@ static int mtk_eth_of_to_plat(struct udevice *dev)
> return 0;
> }
>
> +static const struct mtk_soc_data mt7986_data = {
> + .caps = MT7986_CAPS,
> + .ana_rgc3 = 0x128,
> + .pdma_base = PDMA_V2_BASE,
> + .txd_size = sizeof(struct mtk_tx_dma_v2),
> + .rxd_size = sizeof(struct mtk_rx_dma_v2),
> +};
> +
> +static const struct mtk_soc_data mt7981_data = {
> + .caps = MT7986_CAPS,
> + .ana_rgc3 = 0x128,
> + .pdma_base = PDMA_V2_BASE,
> + .txd_size = sizeof(struct mtk_tx_dma_v2),
> + .rxd_size = sizeof(struct mtk_rx_dma_v2),
> +};
> +
> static const struct mtk_soc_data mt7629_data = {
> .ana_rgc3 = 0x128,
> .pdma_base = PDMA_V1_BASE,
> @@ -1549,6 +1574,8 @@ static const struct mtk_soc_data mt7621_data = {
> };
>
> static const struct udevice_id mtk_eth_ids[] = {
> + { .compatible = "mediatek,mt7986-eth", .data = (ulong)&mt7986_data },
> + { .compatible = "mediatek,mt7981-eth", .data = (ulong)&mt7981_data },
> { .compatible = "mediatek,mt7629-eth", .data = (ulong)&mt7629_data },
> { .compatible = "mediatek,mt7623-eth", .data = (ulong)&mt7623_data },
> { .compatible = "mediatek,mt7622-eth", .data = (ulong)&mt7622_data },
> diff --git a/drivers/net/mtk_eth.h b/drivers/net/mtk_eth.h
> index 236c498a1b..1382ccbeb2 100644
> --- a/drivers/net/mtk_eth.h
> +++ b/drivers/net/mtk_eth.h
> @@ -36,6 +36,8 @@ enum mkt_eth_capabilities {
>
> #define MT7623_CAPS (MTK_GMAC1_TRGMII)
>
> +#define MT7986_CAPS (MTK_NETSYS_V2)
> +
> /* Frame Engine Register Bases */
> #define PDMA_V1_BASE 0x0800
> #define PDMA_V2_BASE 0x6000
> @@ -72,6 +74,9 @@ enum mkt_eth_capabilities {
> #define SGMSYS_QPHY_PWR_STATE_CTRL 0xe8
> #define SGMII_PHYA_PWD BIT(4)
>
> +#define SGMSYS_QPHY_WRAP_CTRL 0xec
> +#define SGMII_PN_SWAP_TX_RX 0x03
> +
> #define SGMSYS_GEN2_SPEED 0x2028
> #define SGMSYS_GEN2_SPEED_V2 0x128
> #define SGMSYS_SPEED_2500 BIT(2)
> --
> 2.17.1
>
next prev parent reply other threads:[~2022-09-01 0:22 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 11:00 [PATCH v2 00/32] Add support for MediaTek MT7981/MT7986 SoCs - v2 Weijie Gao
2022-08-31 11:00 ` [PATCH v2 01/32] arm: mediatek: add support for MediaTek MT7986 SoC Weijie Gao
2022-08-31 13:46 ` Simon Glass
2022-09-01 0:09 ` Daniel Golle
2022-08-31 11:00 ` [PATCH v2 02/32] arm: mediatek: add support for MediaTek MT7981 SoC Weijie Gao
2022-08-31 13:46 ` Simon Glass
2022-08-31 11:00 ` [PATCH v2 03/32] board: mediatek: add MT7986 reference boards Weijie Gao
2022-08-31 11:00 ` [PATCH v2 04/32] board: mediatek: add MT7981 " Weijie Gao
2022-08-31 13:46 ` Simon Glass
2022-08-31 11:04 ` [PATCH v2 05/32] mmc: mediatek: add support for MediaTek MT7891/MT7986 SoCs Weijie Gao
2022-09-01 0:10 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 06/32] net: mediatek: use a struct to cover variations of all SoCs Weijie Gao
2022-09-01 0:20 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 07/32] net: mediatek: stop using bitfileds for DMA descriptors Weijie Gao
2022-09-01 0:20 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 08/32] net: mediatek: add support for PDMA v2 Weijie Gao
2022-09-01 0:22 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 09/32] net: mediatek: add support for MediaTek MT7981/MT7986 Weijie Gao
2022-09-01 0:22 ` Daniel Golle [this message]
2022-08-31 11:04 ` [PATCH v2 10/32] serial: mtk: add support for using dynamic baud clock souce Weijie Gao
2022-09-01 0:22 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 11/32] arm: dts: mt7622: force high-speed mode for uart Weijie Gao
2022-09-01 0:23 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 12/32] pwm: mtk: add support for MediaTek MT7986 SoC Weijie Gao
2022-08-31 11:04 ` [PATCH v2 13/32] pwm: mtk: add support for MediaTek MT7981 SoC Weijie Gao
2022-08-31 11:04 ` [PATCH v2 14/32] timer: mtk: add support for MediaTek MT7981/MT7986 SoCs Weijie Gao
2022-09-01 0:24 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 15/32] watchdog: mediatek: add support for MediaTek MT7986 SoC Weijie Gao
2022-09-01 0:25 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 16/32] spi: add support for MediaTek spi-mem controller Weijie Gao
2022-09-01 0:25 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 17/32] i2c: add support for MediaTek I2C interface Weijie Gao
2022-08-31 11:04 ` [PATCH v2 18/32] arm: dts: mt7622: add i2c support Weijie Gao
2022-08-31 11:04 ` [PATCH v2 19/32] dt-bindings: pinctrl: mediatek: add a header for common pinconf parameters Weijie Gao
2022-08-31 11:04 ` [PATCH v2 20/32] pinctrl: mediatek: add pinctrl driver for MT7981 SoC Weijie Gao
2022-08-31 11:04 ` [PATCH v2 21/32] pinctrl: mediatek: add pinctrl driver for MT7986 SoC Weijie Gao
2022-09-01 0:26 ` Daniel Golle
2022-08-31 11:04 ` [PATCH v2 22/32] clk: mediatek: add CLK_BYPASS_XTAL flag to allow bypassing searching clock parent of xtal clock Weijie Gao
2022-09-01 0:26 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 23/32] clk: mediatek: add support to configure clock driver parent Weijie Gao
2022-09-01 0:27 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 24/32] clk: mediatek: add infrasys clock mux support Weijie Gao
2022-09-01 0:27 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 25/32] clk: mediatek: add CLK_XTAL support for clock driver Weijie Gao
2022-08-31 13:46 ` Simon Glass
2022-09-01 0:27 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 26/32] clk: mediatek: add clock driver support for MediaTek MT7986 SoC Weijie Gao
2022-09-01 0:28 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 27/32] clk: mediatek: add clock driver support for MediaTek MT7981 SoC Weijie Gao
2022-08-31 11:05 ` [PATCH v2 28/32] cpu: add basic cpu driver for MediaTek ARM chips Weijie Gao
2022-08-31 13:46 ` Simon Glass
2022-09-01 3:00 ` Weijie Gao
2022-09-01 0:28 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 29/32] tools: mtk_image: split gfh header verification into a new function Weijie Gao
2022-09-01 0:31 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 30/32] tools: mtk_image: split the code of generating NAND header into a new file Weijie Gao
2022-09-01 0:32 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 31/32] tools: mtk_image: add support for nand headers used by newer chips Weijie Gao
2022-09-01 0:32 ` Daniel Golle
2022-08-31 11:05 ` [PATCH v2 32/32] MAINTAINERS: update maintainer for MediaTek ARM 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=Yw/7QZBsdDeSpJd7@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=GSS_MTK_Uboot_upstream@mediatek.com \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
--cc=weijie.gao@mediatek.com \
/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