210d1bd2de7b1b7b5505def83b9777b374459bb1
[openwrt/openwrt.git] / target / linux / at91 / patches-5.10 / 135-net-macb-Correct-usage-of-MACB_CAPS_CLK_HW_CHG-flag.patch
1 From 982347f757b85ef526afaf243867ddd515475e1b Mon Sep 17 00:00:00 2001
2 From: Charles Keepax <ckeepax@opensource.cirrus.com>
3 Date: Mon, 4 Jan 2021 10:38:02 +0000
4 Subject: [PATCH 135/247] net: macb: Correct usage of MACB_CAPS_CLK_HW_CHG flag
5
6 A new flag MACB_CAPS_CLK_HW_CHG was added and all callers of
7 macb_set_tx_clk were gated on the presence of this flag.
8
9 - if (!clk)
10 + if (!bp->tx_clk || !(bp->caps & MACB_CAPS_CLK_HW_CHG))
11
12 However the flag was not added to anything other than the new
13 sama7g5_gem, turning that function call into a no op for all other
14 systems. This breaks the networking on Zynq.
15
16 The commit message adding this states: a new capability so that
17 macb_set_tx_clock() to not be called for IPs having this
18 capability
19
20 This strongly implies that present of the flag was intended to skip
21 the function not absence of the flag. Update the if statement to
22 this effect, which repairs the existing users.
23
24 Fixes: daafa1d33cc9 ("net: macb: add capability to not set the clock rate")
25 Suggested-by: Andrew Lunn <andrew@lunn.ch>
26 Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
27 Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
28 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
29 Link: https://lore.kernel.org/r/20210104103802.13091-1-ckeepax@opensource.cirrus.com
30 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
31 ---
32 drivers/net/ethernet/cadence/macb_main.c | 2 +-
33 1 file changed, 1 insertion(+), 1 deletion(-)
34
35 --- a/drivers/net/ethernet/cadence/macb_main.c
36 +++ b/drivers/net/ethernet/cadence/macb_main.c
37 @@ -464,7 +464,7 @@ static void macb_set_tx_clk(struct macb
38 {
39 long ferr, rate, rate_rounded;
40
41 - if (!bp->tx_clk || !(bp->caps & MACB_CAPS_CLK_HW_CHG))
42 + if (!bp->tx_clk || (bp->caps & MACB_CAPS_CLK_HW_CHG))
43 return;
44
45 switch (speed) {