Commit 071a2ef5 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'expose-refclk-for-rmii-and-enable-rmii'

Ryan Wanner says:

====================
Expose REFCLK for RMII and enable RMII

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.

v1: https://lore.kernel.org/cover.1750346271.git.Ryan.Wanner@microchip.com
====================

Link: https://patch.msgid.link/cover.1752510727.git.Ryan.Wanner@microchip.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 27b0286d db400061
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -115,6 +115,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:
+9 −2
Original line number Diff line number Diff line
@@ -4109,8 +4109,12 @@ 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;
	u32 dcfg;

	refclk_ext = of_property_read_bool(np, "cdns,refclk-ext");

	if (dt_conf)
		bp->caps = dt_conf->caps;

@@ -4141,6 +4145,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);
}

@@ -5096,6 +5103,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,
@@ -5105,8 +5113,7 @@ static const struct macb_config sama7g5_gem_config = {

static const struct macb_config sama7g5_emac_config = {
	.caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII |
		MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_MIIONRGMII |
		MACB_CAPS_GEM_HAS_PTP,
		MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP,
	.dma_burst_length = 16,
	.clk_init = macb_clk_init,
	.init = macb_init,