* [PATCH 0/3] Expose REFCLK for RMII and enable RMII
@ 2025-06-19 17:04 Ryan.Wanner
2025-06-19 17:04 ` [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property Ryan.Wanner
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Ryan.Wanner @ 2025-06-19 17:04 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea
Cc: netdev, devicetree, linux-kernel, Ryan Wanner
From: Ryan Wanner <Ryan.Wanner@microchip.com>
This set allows the REFCLK property to be exposed as a dt-property to
properly reflect the correct RMII layout. RMII can take an external or
internal provided REFCLK, since this is not SoC dependent but board
dependent this must be exposed as a DT property for the macb driver.
This set also enables RMII mode for the SAMA7 SoCs gigabit mac.
Ryan Wanner (3):
dt-bindings: net: cdns,macb: Add external REFCLK property
net: cadence: macb: Expose REFCLK as a device tree property
net: cadence: macb: Enable RMII for SAMA7 gem
Documentation/devicetree/bindings/net/cdns,macb.yaml | 7 +++++++
drivers/net/ethernet/cadence/macb_main.c | 6 ++++++
2 files changed, 13 insertions(+)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property
2025-06-19 17:04 [PATCH 0/3] Expose REFCLK for RMII and enable RMII Ryan.Wanner
@ 2025-06-19 17:04 ` Ryan.Wanner
2025-06-20 14:22 ` Conor Dooley
2025-06-19 17:04 ` [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property Ryan.Wanner
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Ryan.Wanner @ 2025-06-19 17:04 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea
Cc: netdev, devicetree, linux-kernel, Ryan Wanner
From: Ryan Wanner <Ryan.Wanner@microchip.com>
REFCLK can be provided by an external source so this should be exposed
by a DT property. The REFCLK is used for RMII and in some SoCs that use
this driver the RGMII 125MHz clk can also be provided by an external
source.
Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
---
Documentation/devicetree/bindings/net/cdns,macb.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documentation/devicetree/bindings/net/cdns,macb.yaml
index 8d69846b2e09..e69f60c37793 100644
--- a/Documentation/devicetree/bindings/net/cdns,macb.yaml
+++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml
@@ -114,6 +114,13 @@ properties:
power-domains:
maxItems: 1
+ cdns,refclk-ext:
+ type: boolean
+ description:
+ This selects if the REFCLK for RMII is provided by an external source.
+ For RGMII mode this selects if the 125MHz REF clock is provided by an external
+ source.
+
cdns,rx-watermark:
$ref: /schemas/types.yaml#/definitions/uint32
description:
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property
2025-06-19 17:04 [PATCH 0/3] Expose REFCLK for RMII and enable RMII Ryan.Wanner
2025-06-19 17:04 ` [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property Ryan.Wanner
@ 2025-06-19 17:04 ` Ryan.Wanner
2025-06-20 10:25 ` Simon Horman
2025-06-19 17:04 ` [PATCH 3/3] net: cadence: macb: Enable RMII for SAMA7 gem Ryan.Wanner
2025-06-21 7:24 ` [PATCH 0/3] Expose REFCLK for RMII and enable RMII Andrew Lunn
3 siblings, 1 reply; 9+ messages in thread
From: Ryan.Wanner @ 2025-06-19 17:04 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea
Cc: netdev, devicetree, linux-kernel, Ryan Wanner
From: Ryan Wanner <Ryan.Wanner@microchip.com>
The RMII and RGMII can both support internal or external provided
REFCLKs 50MHz and 125MHz respectively. Since this is dependent on
the board that the SoC is on this needs to be set via the device tree.
This property flag is checked in the MACB DT node so the REFCLK cap is
configured the correct way for the RMII or RGMII is configured on the
board.
Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
---
drivers/net/ethernet/cadence/macb_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index d1f1ae5ea161..146e532543a1 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4109,6 +4109,8 @@ static const struct net_device_ops macb_netdev_ops = {
static void macb_configure_caps(struct macb *bp,
const struct macb_config *dt_conf)
{
+ struct device_node *np = bp->pdev->dev.of_node;
+ bool refclk_ext = of_property_present(np, "cdns,refclk-ext");
u32 dcfg;
if (dt_conf)
@@ -4141,6 +4143,9 @@ static void macb_configure_caps(struct macb *bp,
}
}
+ if (refclk_ext)
+ bp->caps |= MACB_CAPS_USRIO_HAS_CLKEN;
+
dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] net: cadence: macb: Enable RMII for SAMA7 gem
2025-06-19 17:04 [PATCH 0/3] Expose REFCLK for RMII and enable RMII Ryan.Wanner
2025-06-19 17:04 ` [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property Ryan.Wanner
2025-06-19 17:04 ` [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property Ryan.Wanner
@ 2025-06-19 17:04 ` Ryan.Wanner
2025-06-21 7:24 ` [PATCH 0/3] Expose REFCLK for RMII and enable RMII Andrew Lunn
3 siblings, 0 replies; 9+ messages in thread
From: Ryan.Wanner @ 2025-06-19 17:04 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea
Cc: netdev, devicetree, linux-kernel, Ryan Wanner
From: Ryan Wanner <Ryan.Wanner@microchip.com>
This macro enables the RMII mode bit in the USRIO register when RMII
mode is requested.
Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
---
drivers/net/ethernet/cadence/macb_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 146e532543a1..f4f922915ade 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -5101,6 +5101,7 @@ static const struct macb_config mpfs_config = {
static const struct macb_config sama7g5_gem_config = {
.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_CLK_HW_CHG |
+ MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII |
MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP,
.dma_burst_length = 16,
.clk_init = macb_clk_init,
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property
2025-06-19 17:04 ` [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property Ryan.Wanner
@ 2025-06-20 10:25 ` Simon Horman
0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2025-06-20 10:25 UTC (permalink / raw)
To: Ryan.Wanner
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea, netdev, devicetree,
linux-kernel
On Thu, Jun 19, 2025 at 10:04:14AM -0700, Ryan.Wanner@microchip.com wrote:
> From: Ryan Wanner <Ryan.Wanner@microchip.com>
>
> The RMII and RGMII can both support internal or external provided
> REFCLKs 50MHz and 125MHz respectively. Since this is dependent on
> the board that the SoC is on this needs to be set via the device tree.
>
> This property flag is checked in the MACB DT node so the REFCLK cap is
> configured the correct way for the RMII or RGMII is configured on the
> board.
>
> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
> ---
> drivers/net/ethernet/cadence/macb_main.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index d1f1ae5ea161..146e532543a1 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4109,6 +4109,8 @@ static const struct net_device_ops macb_netdev_ops = {
> static void macb_configure_caps(struct macb *bp,
> const struct macb_config *dt_conf)
> {
> + struct device_node *np = bp->pdev->dev.of_node;
> + bool refclk_ext = of_property_present(np, "cdns,refclk-ext");
> u32 dcfg;
Hi Ryan,
Some minor feedback from my side.
1. of_property_read_bool() seems slightly more appropriate here
2. Please consider arranging local variables in Networking code
in reverse xmas tree order - longest line to shortest.
This tool can be helpful for this
https://github.com/ecree-solarflare/xmastree
struct device_node *np = bp->pdev->dev.of_node;
bool refclk_ext;
u32 dcfg;
refclk_ext = of_property_read_bool(np, "cdns,refclk-ext");
...
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property
2025-06-19 17:04 ` [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property Ryan.Wanner
@ 2025-06-20 14:22 ` Conor Dooley
0 siblings, 0 replies; 9+ messages in thread
From: Conor Dooley @ 2025-06-20 14:22 UTC (permalink / raw)
To: Ryan.Wanner
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea, netdev, devicetree,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]
On Thu, Jun 19, 2025 at 10:04:13AM -0700, Ryan.Wanner@microchip.com wrote:
> From: Ryan Wanner <Ryan.Wanner@microchip.com>
>
> REFCLK can be provided by an external source so this should be exposed
> by a DT property. The REFCLK is used for RMII and in some SoCs that use
> this driver the RGMII 125MHz clk can also be provided by an external
> source.
>
> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
> ---
> Documentation/devicetree/bindings/net/cdns,macb.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/cdns,macb.yaml b/Documentation/devicetree/bindings/net/cdns,macb.yaml
> index 8d69846b2e09..e69f60c37793 100644
> --- a/Documentation/devicetree/bindings/net/cdns,macb.yaml
> +++ b/Documentation/devicetree/bindings/net/cdns,macb.yaml
> @@ -114,6 +114,13 @@ properties:
> power-domains:
> maxItems: 1
>
> + cdns,refclk-ext:
> + type: boolean
> + description:
> + This selects if the REFCLK for RMII is provided by an external source.
> + For RGMII mode this selects if the 125MHz REF clock is provided by an external
> + source.
If this gets a v2, is the distinction between RMII and RGMII worth
mentioning? Or is that mentioned because the property has no effect for
!{RGMII,RMII} usecases?
I'm okay with the property existing, though so
Acked-by: Conor Dooley <conor.dooley@microchip.com>
if it's the latter or with an improved description for the former.
> +
> cdns,rx-watermark:
> $ref: /schemas/types.yaml#/definitions/uint32
> description:
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] Expose REFCLK for RMII and enable RMII
2025-06-19 17:04 [PATCH 0/3] Expose REFCLK for RMII and enable RMII Ryan.Wanner
` (2 preceding siblings ...)
2025-06-19 17:04 ` [PATCH 3/3] net: cadence: macb: Enable RMII for SAMA7 gem Ryan.Wanner
@ 2025-06-21 7:24 ` Andrew Lunn
2025-06-23 16:16 ` Ryan Wanner
3 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2025-06-21 7:24 UTC (permalink / raw)
To: Ryan.Wanner
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea, netdev, devicetree,
linux-kernel
On Thu, Jun 19, 2025 at 10:04:12AM -0700, Ryan.Wanner@microchip.com wrote:
> From: Ryan Wanner <Ryan.Wanner@microchip.com>
>
> This set allows the REFCLK property to be exposed as a dt-property to
> properly reflect the correct RMII layout. RMII can take an external or
> internal provided REFCLK, since this is not SoC dependent but board
> dependent this must be exposed as a DT property for the macb driver.
What board is going to use this? Do you have a patch for a .dts file?
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] Expose REFCLK for RMII and enable RMII
2025-06-21 7:24 ` [PATCH 0/3] Expose REFCLK for RMII and enable RMII Andrew Lunn
@ 2025-06-23 16:16 ` Ryan Wanner
2025-06-23 17:47 ` Andrew Lunn
0 siblings, 1 reply; 9+ messages in thread
From: Ryan Wanner @ 2025-06-23 16:16 UTC (permalink / raw)
To: Andrew Lunn
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea, netdev, devicetree,
linux-kernel
On 6/21/25 00:24, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Thu, Jun 19, 2025 at 10:04:12AM -0700, Ryan.Wanner@microchip.com wrote:
>> From: Ryan Wanner <Ryan.Wanner@microchip.com>
>>
>> This set allows the REFCLK property to be exposed as a dt-property to
>> properly reflect the correct RMII layout. RMII can take an external or
>> internal provided REFCLK, since this is not SoC dependent but board
>> dependent this must be exposed as a DT property for the macb driver.
>
> What board is going to use this? Do you have a patch for a .dts file?
Our SAMA7D65_curiosity board has a connector that allows us to change
ethernet phys. Since some of the phys we have provide their own REFCLK
while others do not, this property needs to be added so we are able to
use all of these.
I do not have an exact .dts patch for this since our default is MPU
provides the REFCLK, this property will be used with dt-overlays that
match each phy that is connected.
Ryan
>
> Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] Expose REFCLK for RMII and enable RMII
2025-06-23 16:16 ` Ryan Wanner
@ 2025-06-23 17:47 ` Andrew Lunn
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2025-06-23 17:47 UTC (permalink / raw)
To: Ryan Wanner
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, nicolas.ferre, claudiu.beznea, netdev, devicetree,
linux-kernel
> Our SAMA7D65_curiosity board has a connector that allows us to change
> ethernet phys. Since some of the phys we have provide their own REFCLK
> while others do not, this property needs to be added so we are able to
> use all of these.
>
> I do not have an exact .dts patch for this since our default is MPU
> provides the REFCLK, this property will be used with dt-overlays that
> match each phy that is connected.
We generally don't allow a feature without a user. So please re-submit
this when you submit a DT overlay which can actually use it.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-06-23 17:47 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 17:04 [PATCH 0/3] Expose REFCLK for RMII and enable RMII Ryan.Wanner
2025-06-19 17:04 ` [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property Ryan.Wanner
2025-06-20 14:22 ` Conor Dooley
2025-06-19 17:04 ` [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property Ryan.Wanner
2025-06-20 10:25 ` Simon Horman
2025-06-19 17:04 ` [PATCH 3/3] net: cadence: macb: Enable RMII for SAMA7 gem Ryan.Wanner
2025-06-21 7:24 ` [PATCH 0/3] Expose REFCLK for RMII and enable RMII Andrew Lunn
2025-06-23 16:16 ` Ryan Wanner
2025-06-23 17:47 ` Andrew Lunn
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).