summaryrefslogtreecommitdiff
path: root/recipes-kernel/linux/linux-at91-5.4.81/linux-5.4-bring-back-PAE-bit-and-fix-NCFGR-values-applicable-f.patch
blob: 9412a69104bbf8434b79938d2691e1c35465d94c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From 0e6345082a283075a68d6a9e6fca917f48aaccc2 Mon Sep 17 00:00:00 2001
From: Mykyta Dorokhin <mykyta.dorokhin@globallogic.com>
Date: Thu, 4 Feb 2021 17:29:38 +0200
Subject: [PATCH] Bring back PAE bit and fix NCFGR values applicable for GEM only

---
 drivers/net/ethernet/cadence/macb_main.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index a5068d3..6bac7e1 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -572,12 +572,17 @@ static void macb_mac_config(struct phylink_config *config, unsigned int mode,
 	old_ctrl = ctrl = macb_or_gem_readl(bp, NCFGR);
 
 	/* Clear all the bits we might set later */
-	ctrl &= ~(GEM_BIT(GBE) | MACB_BIT(SPD) | MACB_BIT(FD) | MACB_BIT(PAE) |
-		  GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
+	ctrl &= ~(MACB_BIT(SPD) | MACB_BIT(FD) | MACB_BIT(PAE));
 
-	if (state->speed == SPEED_1000)
-		ctrl |= GEM_BIT(GBE);
-	else if (state->speed == SPEED_100)
+	if (macb_is_gem(bp)) {
+		ctrl &= ~(GEM_BIT(GBE) | GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
+	}
+
+	if (macb_is_gem(bp))
+		if (state->speed == SPEED_1000)
+			ctrl |= GEM_BIT(GBE);
+
+	if (state->speed == SPEED_100)
 		ctrl |= MACB_BIT(SPD);
 
 	if (state->duplex)
@@ -2362,6 +2367,9 @@ static void macb_init_hw(struct macb *bp)
 	config = macb_mdc_clk_div(bp);
 	config |= MACB_BF(RBOF, NET_IP_ALIGN);	/* Make eth data aligned */
 	config |= MACB_BIT(DRFCS);		/* Discard Rx FCS */
+	if (!macb_is_gem(bp)) {
+		config |= MACB_BIT(PAE);	/* PAuse Enable */
+	}
 	if (bp->caps & MACB_CAPS_JUMBO)
 		config |= MACB_BIT(JFRAME);	/* Enable jumbo frames */
 	else
-- 
1.9.1