summaryrefslogtreecommitdiff
path: root/target/linux/apm821xx/patches-4.4/701-powerpc_ibm_apm82181_phyclk_fix.patch
blob: 011e785e9916bdc6bb906bac69ae6a9eb3e4f39c (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
50
51
52
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -129,6 +129,7 @@ static inline void emac_report_timeout_e
 {
 	if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX |
 				  EMAC_FTR_460EX_PHY_CLK_FIX |
+				  EMAC_FTR_APM821XX_PHY_CLK_FIX |
 				  EMAC_FTR_440EP_PHY_CLK_FIX))
 		DBG(dev, "%s" NL, error);
 	else if (net_ratelimit())
@@ -146,6 +147,10 @@ static inline void emac_rx_clk_tx(struct
 	if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
 		dcri_clrset(SDR0, SDR0_MFR,
 			    0, SDR0_MFR_ECS >> dev->cell_index);
+
+	if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX))
+                dcri_clrset(SDR0, SDR0_ETH_CFG,
+                        0, 0x00000100 >> dev->cell_index);
 #endif
 }
 
@@ -155,6 +160,10 @@ static inline void emac_rx_clk_default(s
 	if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
 		dcri_clrset(SDR0, SDR0_MFR,
 			    SDR0_MFR_ECS >> dev->cell_index, 0);
+
+	if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX))
+		dcri_clrset(SDR0, SDR0_ETH_CFG,
+			    0x00000100 >> dev->cell_index, 0);
 #endif
 }
 
@@ -2587,7 +2596,7 @@ static int emac_init_config(struct emac_
 		if (of_device_is_compatible(np, "ibm,emac-apm821xx")) {
 			dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
 					  EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
-					  EMAC_FTR_460EX_PHY_CLK_FIX);
+					  EMAC_FTR_APM821XX_PHY_CLK_FIX);
 		}
 	} else if (of_device_is_compatible(np, "ibm,emac4")) {
 		dev->features |= EMAC_FTR_EMAC4;
--- a/drivers/net/ethernet/ibm/emac/core.h
+++ b/drivers/net/ethernet/ibm/emac/core.h
@@ -333,6 +333,8 @@ struct emac_instance {
  */
 #define EMAC_FTR_APM821XX_NO_HALF_DUPLEX	0x00001000
 
+#define EMAC_FTR_APM821XX_PHY_CLK_FIX	0x000002000
+
 /* Right now, we don't quite handle the always/possible masks on the
  * most optimal way as we don't have a way to say something like
  * always EMAC4. Patches welcome.