Devicetree
 help / color / mirror / Atom feed
From: Vladislav Leonov <vlad@zlab.su>
To: linux-rockchip@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org,
	Simon Glass <sjg@chromium.org>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Vladislav Leonov <vlad@zlab.su>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Jakub Kicinski <kuba@kernel.org>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org
Subject: [PATCH 05/25] net: ethernet: stmicro: stmmac: dwmac-rk: Add RV1106 support
Date: Mon, 10 Aug 2026 15:10:56 +0300	[thread overview]
Message-ID: <20260810121121.210040-6-vlad@zlab.su> (raw)
In-Reply-To: <20260810121121.210040-1-vlad@zlab.su>

Rockchip RV1106 GMAC 10/100 ethernet controller.

Signed-off-by: Vladislav Leonov <vlad@zlab.su>
---

 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 8d7042e68926..a1bf545467cc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1034,6 +1034,60 @@ static const struct rk_gmac_ops rk3588_ops = {
 	},
 };
 
+#define RV1106_VOGRF_GMAC_CLK_CON		0X60004
+
+#define RV1106_VOGRF_MACPHY_RMII_MODE		GRF_BIT(0)
+#define RV1106_VOGRF_GMAC_CLK_RMII_DIV2		GRF_BIT(2)
+#define RV1106_VOGRF_GMAC_CLK_RMII_DIV20	GRF_CLR_BIT(2)
+
+#define RV1106_VOGRF_MACPHY_CON0		0X60028
+
+static void rv1106_set_to_rmii(struct rk_priv_data *bsp_priv)
+{
+	regmap_write(bsp_priv->grf, RV1106_VOGRF_GMAC_CLK_CON,
+		     RV1106_VOGRF_MACPHY_RMII_MODE |
+		     RV1106_VOGRF_GMAC_CLK_RMII_DIV2);
+}
+
+static int rv1106_set_speed(struct rk_priv_data *bsp_priv,
+			    phy_interface_t interface, int speed)
+{
+	unsigned int val;
+
+	if (interface != PHY_INTERFACE_MODE_RMII)
+		return 0;
+
+	if (speed == SPEED_10)
+		val = RV1106_VOGRF_GMAC_CLK_RMII_DIV20;
+	else if (speed == SPEED_100)
+		val = RV1106_VOGRF_GMAC_CLK_RMII_DIV2;
+	else
+		return -EINVAL;
+
+	regmap_write(bsp_priv->grf, RV1106_VOGRF_GMAC_CLK_CON, val);
+
+	return 0;
+}
+
+static void rv1106_integrated_phy_powerup(struct rk_priv_data *bsp_priv)
+{
+	rk_gmac_integrated_fephy_powerup(bsp_priv, RV1106_VOGRF_MACPHY_CON0);
+}
+
+static void rv1106_integrated_phy_powerdown(struct rk_priv_data *bsp_priv)
+{
+	rk_gmac_integrated_fephy_powerdown(bsp_priv, RV1106_VOGRF_MACPHY_CON0);
+}
+
+static const struct rk_gmac_ops rv1106_ops = {
+	.set_to_rmii = rv1106_set_to_rmii,
+	.set_speed = rv1106_set_speed,
+	.integrated_phy_powerup = rv1106_integrated_phy_powerup,
+	.integrated_phy_powerdown = rv1106_integrated_phy_powerdown,
+
+	.supports_rmii = true,
+};
+
 #define RV1108_GRF_GMAC_CON0		0X0900
 
 /* RV1108_GRF_GMAC_CON0 */
@@ -1628,6 +1682,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = {
 	{ .compatible = "rockchip,rk3568-gmac", .data = &rk3568_ops },
 	{ .compatible = "rockchip,rk3576-gmac", .data = &rk3576_ops },
 	{ .compatible = "rockchip,rk3588-gmac", .data = &rk3588_ops },
+	{ .compatible = "rockchip,rv1106-gmac", .data = &rv1106_ops },
 	{ .compatible = "rockchip,rv1108-gmac", .data = &rv1108_ops },
 	{ .compatible = "rockchip,rv1126-gmac", .data = &rv1126_ops },
 	{ }
-- 
2.47.3


  parent reply	other threads:[~2026-08-10 12:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 12:10 [PATCH 00/25] ARM: rockchip: Add peripheral support for RV1106 Vladislav Leonov
2026-08-10 12:10 ` [PATCH 01/25] dt-bindings: reset: Add RV1106 CRU reset definitions Vladislav Leonov
2026-08-10 12:10 ` [PATCH 02/25] clk: rockchip: Add reset controller support for RV1106 Vladislav Leonov
2026-08-10 12:10 ` [PATCH 03/25] ARM: dts: rockchip: Add reset bindings to RV1106 Vladislav Leonov
2026-08-10 12:10 ` [PATCH 04/25] dt-bindings: net: rockchip-dwmac: add RV1106 compatible Vladislav Leonov
2026-08-10 12:10 ` Vladislav Leonov [this message]
2026-08-10 12:10 ` [PATCH 06/25] ARM: dts: rockchip: Add Ethernet GMAC node for RV1106 Vladislav Leonov
2026-08-10 12:10 ` [PATCH 07/25] dt-bindings: phy: rockchip,inno-usb2phy: Add RV1106 compatible Vladislav Leonov
2026-08-10 12:10 ` [PATCH 08/25] phy: rockchip: inno-usb2: Add support for RV1106 Vladislav Leonov
2026-08-10 12:11 ` [PATCH 09/25] dt-bindings: usb: rockchip,dwc3: add RV1106 SoC support Vladislav Leonov
2026-08-10 12:11 ` [PATCH 10/25] ARM: dts: rockchip: Add USB2 PHY and USB3-OTG (DWC3) nodes for RV1106 Vladislav Leonov
2026-08-10 12:11 ` [PATCH 11/25] dt-bindings: i2c: rk3x: Add RV1106 compatible Vladislav Leonov
2026-08-10 12:11 ` [PATCH 12/25] ARM: dts: rockchip: Add I2C nodes for RV1106 Vladislav Leonov
2026-08-10 12:11 ` [PATCH 13/25] ARM: dts: rockchip: Add DMAC node " Vladislav Leonov
2026-08-10 12:11 ` [PATCH 14/25] ARM: dts: rockchip: Add DMA support to UART nodes Vladislav Leonov
2026-08-10 12:11 ` [PATCH 15/25] dt-bindings: clock: rockchip: Add SCLK_IN_SPI1 for RV1106 Vladislav Leonov
2026-08-10 12:11 ` [PATCH 16/25] clk: rockchip: Add SCLK_IN_SPI1 gate " Vladislav Leonov
2026-08-10 12:11 ` [PATCH 17/25] dt-bindings: spi: rockchip: Add RV1106 compatible Vladislav Leonov
2026-08-10 12:25   ` Mark Brown
2026-08-10 12:11 ` [PATCH 18/25] spi: rockchip: Add support for RV1106 Vladislav Leonov
2026-08-10 12:11 ` [PATCH 19/25] ARM: dts: rockchip: Add SPI nodes " Vladislav Leonov
2026-08-10 12:11 ` [PATCH 20/25] dt-bindings: rng: rockchip: Add RV1106 compatible Vladislav Leonov
2026-08-10 12:11 ` [PATCH 21/25] ARM: dts: rockchip: Add RNG node for RV1106 Vladislav Leonov
2026-08-10 12:11 ` [PATCH 22/25] ARM: dts: rockchip: Add SDMMC1 " Vladislav Leonov
2026-08-10 12:11 ` [PATCH 23/25] ARM: dts: rockchip: add arm,cpu-registers-not-fw-configured to RV1106 timer node Vladislav Leonov
2026-08-10 12:11 ` [PATCH 24/25] dt-bindings: pwm: rockchip: Add RV1106 compatible Vladislav Leonov
2026-08-10 12:11 ` [PATCH 25/25] ARM: dts: rockchip: Add PWM nodes for RV1106 Vladislav Leonov
2026-08-10 18:35 ` [PATCH 00/25] ARM: rockchip: Add peripheral support " Jakub Kicinski

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=20260810121121.210040-6-vlad@zlab.su \
    --to=vlad@zlab.su \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=heiko@sntech.de \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sjg@chromium.org \
    /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