diff options
Diffstat (limited to 'target/linux/at91/patches-5.15/115-net-macb-add-userio-bits-as-platform-configuration.patch')
-rw-r--r-- | target/linux/at91/patches-5.15/115-net-macb-add-userio-bits-as-platform-configuration.patch | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/target/linux/at91/patches-5.15/115-net-macb-add-userio-bits-as-platform-configuration.patch b/target/linux/at91/patches-5.15/115-net-macb-add-userio-bits-as-platform-configuration.patch new file mode 100644 index 0000000000..79e7e62440 --- /dev/null +++ b/target/linux/at91/patches-5.15/115-net-macb-add-userio-bits-as-platform-configuration.patch @@ -0,0 +1,179 @@ +From 89f37ac2780d113d3c17d329726c0e92a1400744 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea <claudiu.beznea@microchip.com> +Date: Wed, 9 Dec 2020 15:03:32 +0200 +Subject: [PATCH 115/247] net: macb: add userio bits as platform configuration + +This is necessary for SAMA7G5 as it uses different values for +PHY interface and also introduces hdfctlen bit. + +Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> +Reviewed-by: Andrew Lunn <andrew@lunn.ch> +Signed-off-by: David S. Miller <davem@davemloft.net> +--- + drivers/net/ethernet/cadence/macb.h | 10 +++++++++ + drivers/net/ethernet/cadence/macb_main.c | 28 ++++++++++++++++++++---- + 2 files changed, 34 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/cadence/macb.h ++++ b/drivers/net/ethernet/cadence/macb.h +@@ -1104,6 +1104,14 @@ struct macb_pm_data { + u32 usrio; + }; + ++struct macb_usrio_config { ++ u32 mii; ++ u32 rmii; ++ u32 rgmii; ++ u32 refclk; ++ u32 hdfctlen; ++}; ++ + struct macb_config { + u32 caps; + unsigned int dma_burst_length; +@@ -1112,6 +1120,7 @@ struct macb_config { + struct clk **rx_clk, struct clk **tsu_clk); + int (*init)(struct platform_device *pdev); + int jumbo_max_len; ++ const struct macb_usrio_config *usrio; + }; + + struct tsu_incr { +@@ -1244,6 +1253,7 @@ struct macb { + u32 rx_intr_mask; + + struct macb_pm_data pm_data; ++ const struct macb_usrio_config *usrio; + }; + + #ifdef CONFIG_MACB_USE_HWSTAMP +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -3831,15 +3831,15 @@ static int macb_init(struct platform_dev + if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) { + val = 0; + if (phy_interface_mode_is_rgmii(bp->phy_interface)) +- val = GEM_BIT(RGMII); ++ val = bp->usrio->rgmii; + else if (bp->phy_interface == PHY_INTERFACE_MODE_RMII && + (bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) +- val = MACB_BIT(RMII); ++ val = bp->usrio->rmii; + else if (!(bp->caps & MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII)) +- val = MACB_BIT(MII); ++ val = bp->usrio->mii; + + if (bp->caps & MACB_CAPS_USRIO_HAS_CLKEN) +- val |= MACB_BIT(CLKEN); ++ val |= bp->usrio->refclk; + + macb_or_gem_writel(bp, USRIO, val); + } +@@ -4357,6 +4357,13 @@ static int fu540_c000_init(struct platfo + return macb_init(pdev); + } + ++static const struct macb_usrio_config macb_default_usrio = { ++ .mii = MACB_BIT(MII), ++ .rmii = MACB_BIT(RMII), ++ .rgmii = GEM_BIT(RGMII), ++ .refclk = MACB_BIT(CLKEN), ++}; ++ + static const struct macb_config fu540_c000_config = { + .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO | + MACB_CAPS_GEM_HAS_PTP, +@@ -4364,12 +4371,14 @@ static const struct macb_config fu540_c0 + .clk_init = fu540_c000_clk_init, + .init = fu540_c000_init, + .jumbo_max_len = 10240, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config at91sam9260_config = { + .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d3macb_config = { +@@ -4377,6 +4386,7 @@ static const struct macb_config sama5d3m + | MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config pc302gem_config = { +@@ -4384,6 +4394,7 @@ static const struct macb_config pc302gem + .dma_burst_length = 16, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d2_config = { +@@ -4391,6 +4402,7 @@ static const struct macb_config sama5d2_ + .dma_burst_length = 16, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d3_config = { +@@ -4400,6 +4412,7 @@ static const struct macb_config sama5d3_ + .clk_init = macb_clk_init, + .init = macb_init, + .jumbo_max_len = 10240, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d4_config = { +@@ -4407,18 +4420,21 @@ static const struct macb_config sama5d4_ + .dma_burst_length = 4, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config emac_config = { + .caps = MACB_CAPS_NEEDS_RSTONUBR | MACB_CAPS_MACB_IS_EMAC, + .clk_init = at91ether_clk_init, + .init = at91ether_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config np4_config = { + .caps = MACB_CAPS_USRIO_DISABLED, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config zynqmp_config = { +@@ -4429,6 +4445,7 @@ static const struct macb_config zynqmp_c + .clk_init = macb_clk_init, + .init = macb_init, + .jumbo_max_len = 10240, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config zynq_config = { +@@ -4437,6 +4454,7 @@ static const struct macb_config zynq_con + .dma_burst_length = 16, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct of_device_id macb_dt_ids[] = { +@@ -4557,6 +4575,8 @@ static int macb_probe(struct platform_de + bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; + device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); + ++ bp->usrio = macb_config->usrio; ++ + spin_lock_init(&bp->lock); + + /* setup capabilities */ |