diff options
Diffstat (limited to 'target/linux/at91/patches-5.10/115-net-macb-add-userio-bits-as-platform-configuration.patch')
-rw-r--r-- | target/linux/at91/patches-5.10/115-net-macb-add-userio-bits-as-platform-configuration.patch | 186 |
1 files changed, 186 insertions, 0 deletions
diff --git a/target/linux/at91/patches-5.10/115-net-macb-add-userio-bits-as-platform-configuration.patch b/target/linux/at91/patches-5.10/115-net-macb-add-userio-bits-as-platform-configuration.patch new file mode 100644 index 0000000000..ce5a2ebc40 --- /dev/null +++ b/target/linux/at91/patches-5.10/115-net-macb-add-userio-bits-as-platform-configuration.patch @@ -0,0 +1,186 @@ +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(-) + +diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h +index 5de47f6fde5a..e9385a1390a9 100644 +--- 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 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c +index 1e8bf6b9834b..a8326b75eca8 100644 +--- a/drivers/net/ethernet/cadence/macb_main.c ++++ b/drivers/net/ethernet/cadence/macb_main.c +@@ -3800,15 +3800,15 @@ static int macb_init(struct platform_device *pdev) + 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); + } +@@ -4326,6 +4326,13 @@ static int fu540_c000_init(struct platform_device *pdev) + 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, +@@ -4333,12 +4340,14 @@ static const struct macb_config fu540_c000_config = { + .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 = { +@@ -4346,6 +4355,7 @@ static const struct macb_config sama5d3macb_config = { + | 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 = { +@@ -4353,6 +4363,7 @@ static const struct macb_config pc302gem_config = { + .dma_burst_length = 16, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d2_config = { +@@ -4360,6 +4371,7 @@ static const struct macb_config sama5d2_config = { + .dma_burst_length = 16, + .clk_init = macb_clk_init, + .init = macb_init, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d3_config = { +@@ -4369,6 +4381,7 @@ static const struct macb_config sama5d3_config = { + .clk_init = macb_clk_init, + .init = macb_init, + .jumbo_max_len = 10240, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config sama5d4_config = { +@@ -4376,18 +4389,21 @@ static const struct macb_config sama5d4_config = { + .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 = { +@@ -4398,6 +4414,7 @@ static const struct macb_config zynqmp_config = { + .clk_init = macb_clk_init, + .init = macb_init, + .jumbo_max_len = 10240, ++ .usrio = &macb_default_usrio, + }; + + static const struct macb_config zynq_config = { +@@ -4406,6 +4423,7 @@ static const struct macb_config zynq_config = { + .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[] = { +@@ -4527,6 +4545,8 @@ static int macb_probe(struct platform_device *pdev) + 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 */ +-- +2.32.0 + |