DWMAC support for Rockchip RK3506
Subsystems (6)
Heiko Stuebner
maintainerv2 cover DWMAC support for Rockchip RK3506
Some cleanups to the DT binding for Rockchip variants of the dwmac and adding the RK3506 support on top.
As well as the driver-glue needed for setting up the correct RMII speed seitings.
changes in v2:
- add Conor's Acks to dt-bindings
- add Andrew's Reviews to first 3 patches
I didn't add the driver Review, as I did address Jonas' comments
- adapt to Jonas' comments in the driver
- add a patch for a MAINTAINERS entry (Jakub)
David Wu (1):
ethernet: stmmac: dwmac-rk: Add RK3506 GMAC support
Heiko Stuebner (4):
dt-bindings: net: snps,dwmac: move rk3399 line to its correct position
dt-bindings: net: snps,dwmac: Sync list of Rockchip compatibles
dt-bindings: net: rockchip-dwmac: Add compatible string for RK3506
MAINTAINERS: add dwmac-rk glue driver to the main Rockchip entry
.../bindings/net/rockchip-dwmac.yaml | 3 + .../devicetree/bindings/net/snps,dwmac.yaml | 6 +- MAINTAINERS | 1 + .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 64 +++++++++++++++++++ 4 files changed, 73 insertions(+), 1 deletion(-)
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH v2 1/5 dt-bindings: net: snps,dwmac: move rk3399 line to its correct position
Move the rk3399 compatible to its alphabetically correct position.
--- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -1
@@ -86,9 +86,9 @@ properties: - rockchip,rk3328-gmac - rockchip,rk3366-gmac - rockchip,rk3368-gmac + - rockchip,rk3399-gmac - rockchip,rk3576-gmac - rockchip,rk3588-gmac - - rockchip,rk3399-gmac - rockchip,rv1108-gmac - snps,dwmac - snps,dwmac-3.40a
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH v2 2/5 dt-bindings: net: snps,dwmac: Sync list of Rockchip compatibles
In reply to Heiko StuebnerA number of dwmac variants from Rockchip SoCs have turned up in the Rockchip-specific binding, but not in the main list in snps,dwmac.yaml which as the comment indicates is needed for accurate matching.
So add the missing rk3528, rk3568 and rv1126 to the main list.
--- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +3 -0
@@ -87,9 +87,12 @@ properties: - rockchip,rk3366-gmac - rockchip,rk3368-gmac - rockchip,rk3399-gmac + - rockchip,rk3528-gmac + - rockchip,rk3568-gmac - rockchip,rk3576-gmac - rockchip,rk3588-gmac - rockchip,rv1108-gmac + - rockchip,rv1126-gmac - snps,dwmac - snps,dwmac-3.40a - snps,dwmac-3.50a
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH v2 3/5 dt-bindings: net: rockchip-dwmac: Add compatible string for RK3506
In reply to Heiko StuebnerRockchip RK3506 has two Ethernet controllers based on Synopsys DWC Ethernet QoS IP.
Add compatible string for the RK3506 variant.
--- Documentation/devicetree/bindings/net/rockchip-dwmac.yaml | 3 +++ Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 + 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/net/rockchip-dwmac.yaml +3 -0
@@ -24,6 +24,7 @@ select: - rockchip,rk3366-gmac - rockchip,rk3368-gmac - rockchip,rk3399-gmac + - rockchip,rk3506-gmac - rockchip,rk3528-gmac - rockchip,rk3568-gmac - rockchip,rk3576-gmac
@@ -50,6 +51,7 @@ properties: - rockchip,rv1108-gmac - items: - enum: + - rockchip,rk3506-gmac - rockchip,rk3528-gmac - rockchip,rk3568-gmac - rockchip,rk3576-gmac
@@ -148,6 +150,7 @@ allOf: compatible: contains: enum: + - rockchip,rk3506-gmac - rockchip,rk3528-gmac then: properties:
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
@@ -87,6 +87,7 @@ properties: - rockchip,rk3366-gmac - rockchip,rk3368-gmac - rockchip,rk3399-gmac + - rockchip,rk3506-gmac - rockchip,rk3528-gmac - rockchip,rk3568-gmac - rockchip,rk3576-gmac
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH v2 4/5 ethernet: stmmac: dwmac-rk: Add RK3506 GMAC support
In reply to Heiko StuebnerFrom: David Wu <[email protected]>
Add the needed glue blocks for the RK3506-specific setup.
The RK3506 dwmac only supports up to 100MBit with a RMII PHY, but no RGMII.
--- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +64 -0
@@ -827,6 +827,69 @@ static const struct rk_gmac_ops rk3399_ops = { .set_speed = rk3399_set_speed, }; +#define RK3506_GRF_SOC_CON8 0x0020 +#define RK3506_GRF_SOC_CON11 0x002c + +#define RK3506_GMAC_RMII_MODE GRF_BIT(1) + +#define RK3506_GMAC_CLK_RMII_DIV2 GRF_BIT(3) +#define RK3506_GMAC_CLK_RMII_DIV20 GRF_CLR_BIT(3) + +#define RK3506_GMAC_CLK_SELECT_CRU GRF_CLR_BIT(5) +#define RK3506_GMAC_CLK_SELECT_IO GRF_BIT(5) + +#define RK3506_GMAC_CLK_RMII_GATE GRF_BIT(2) +#define RK3506_GMAC_CLK_RMII_NOGATE GRF_CLR_BIT(2) + +static void rk3506_set_to_rmii (struct rk_priv_data *bsp_priv) +{ +unsigned int id = bsp_priv->id, offset; + + offset = (id ==1 ) ?RK3506_GRF_SOC_CON11 :RK3506_GRF_SOC_CON8 ; +regmap_write (bsp_priv->grf, offset,RK3506_GMAC_RMII_MODE ); +} + +static const struct rk_reg_speed_data rk3506_reg_speed_data = { + .rmii_10 =RK3506_GMAC_CLK_RMII_DIV20 , + .rmii_100 =RK3506_GMAC_CLK_RMII_DIV2 , +}; + +static int rk3506_set_speed (struct rk_priv_data *bsp_priv, +phy_interface_t interface,int speed) +{ +unsigned int id = bsp_priv->id, offset; + + offset = (id ==1 ) ?RK3506_GRF_SOC_CON11 :RK3506_GRF_SOC_CON8 ; +return rk_set_reg_speed (bsp_priv, &rk3506_reg_speed_data, + offset, interface, speed); +} + +static void rk3506_set_clock_selection (struct rk_priv_data *bsp_priv, +bool input,bool enable) +{ +unsigned int value, offset, id = bsp_priv->id; + + offset = (id ==1 ) ?RK3506_GRF_SOC_CON11 :RK3506_GRF_SOC_CON8 ; + + value = input ?RK3506_GMAC_CLK_SELECT_IO : +RK3506_GMAC_CLK_SELECT_CRU ; + value |= enable ?RK3506_GMAC_CLK_RMII_NOGATE : +RK3506_GMAC_CLK_RMII_GATE ; +regmap_write (bsp_priv->grf, offset, value); +} + +static const struct rk_gmac_ops rk3506_ops = { + .set_to_rmii = rk3506_set_to_rmii, + .set_speed = rk3506_set_speed, + .set_clock_selection = rk3506_set_clock_selection, + .regs_valid = true, + .regs = { +0xff4c8000 ,/* gmac0 */ +0xff4d0000 ,/* gmac1 */ +0x0 ,/* sentinel */ + }, +}; +#define RK3528_VO_GRF_GMAC_CON 0x0018#define RK3528_VO_GRF_MACPHY_CON0 0x001c#define RK3528_VO_GRF_MACPHY_CON1 0x0020
@@ -1808,6 +1871,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = { { .compatible = "rockchip,rk3366-gmac", .data = &rk3366_ops }, { .compatible = "rockchip,rk3368-gmac", .data = &rk3368_ops }, { .compatible = "rockchip,rk3399-gmac", .data = &rk3399_ops }, + { .compatible = "rockchip,rk3506-gmac", .data = &rk3506_ops }, { .compatible = "rockchip,rk3528-gmac", .data = &rk3528_ops }, { .compatible = "rockchip,rk3568-gmac", .data = &rk3568_ops }, { .compatible = "rockchip,rk3576-gmac", .data = &rk3576_ops },
Signature · 1 line
2.47.2
Heiko Stuebner
maintainerPATCH v2 5/5 MAINTAINERS: add dwmac-rk glue driver to the main Rockchip entry
In reply to Heiko StuebnerThe dwmac-rk glue driver is currently not caught by the general maintainer entry for Rockchip SoCs, so add it explicitly, similar to the i2c driver.
The binding document in net/rockchip-dwmac.yaml already gets caught by the wildcard match.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -3296,6 +3296,7 @@ F: drivers/*/*/*rockchip* F: drivers/*/*rockchip* F: drivers/clk/rockchip/ F: drivers/i2c/busses/i2c-rk3x.c +F: drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c F: sound/soc/rockchip/ N: rockchip
Signature · 1 line
2.47.2
Re: [PATCH v2 5/5] MAINTAINERS: add dwmac-rk glue driver to the main Rockchip entry
Quoted 7 lines · Heiko Stuebner
The dwmac-rk glue driver is currently not caught by the general maintainer entry for Rockchip SoCs, so add it explicitly, similar to the i2c driver.
The binding document in
net/rockchip-dwmac.yamlalready gets caught by the wildcard match.Signed-off-by Heiko Stuebner <[email protected]>
Andrew
Heiko Stuebner
maintainerRe: [PATCH v2 5/5] MAINTAINERS: add dwmac-rk glue driver to the main Rockchip entry
Hi Andrew,
Am Donnerstag, 23. Oktober 2025, 20:57:50 Mitteleuropäische Sommerzeit schrieb Andrew Lunn:
Quoted 10 lines · Heiko Stuebner
Quoted 7 lines
The dwmac-rk glue driver is currently not caught by the general maintainer entry for Rockchip SoCs, so add it explicitly, similar to the i2c driver.
The binding document in
net/rockchip-dwmac.yamlalready gets caught by the wildcard match.Signed-off-by Heiko Stuebner <[email protected]>Reviewed-by Andrew Lunn <[email protected]>
just mentioning, I wasn't sure if your review for patch4 was still valid after I adapted the change to Jonas' suggestions, so only added the R-b's from v1 to patches 1-3 .
Heiko
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Thu, 23 Oct 2025 13:12:07 +0200 you wrote:
Some cleanups to the DT binding for Rockchip variants of the dwmac and adding the RK3506 support on top.
As well as the driver-glue needed for setting up the correct RMII speed seitings.
Quoted 8 lines
changes in v2:
- add Conor's Acks to dt-bindings
- add Andrew's Reviews to first 3 patches
I didn't add the driver Review, as I did address Jonas' comments
- adapt to Jonas' comments in the driver
- add a patch for aMAINTAINERSentry (Jakub)[...]
Here is the summary with links:
- [v2,1/5] dt-bindings: net: snps,dwmac: move rk3399 line to its correct position
https://git.kernel.org/netdev/net-next/c/32dd679b88d5 - [v2,2/5] dt-bindings: net: snps,dwmac: Sync list of Rockchip compatibles https://git.kernel.org/netdev/net-next/c/e774c91dca45 - [v2,3/5] dt-bindings: net: rockchip-dwmac: Add compatible string for RK3506 https://git.kernel.org/netdev/net-next/c/4a667bec74b3 - [v2,4/5] ethernet: stmmac: dwmac-rk: Add RK3506 GMAC support https://git.kernel.org/netdev/net-next/c/2010163a8ea4 - [v2,5/5] MAINTAINERS: add dwmac-rk glue driver to the main Rockchip entry https://git.kernel.org/netdev/net-next/c/384d84263295
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html