ipq806x: ArcherC2600: devictree cleanup
[oweals/openwrt.git] / target / linux / apm821xx / patches-4.4 / 701-powerpc_ibm_apm82181_phyclk_fix.patch
1 --- a/drivers/net/ethernet/ibm/emac/core.c
2 +++ b/drivers/net/ethernet/ibm/emac/core.c
3 @@ -129,6 +129,7 @@ static inline void emac_report_timeout_e
4  {
5         if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX |
6                                   EMAC_FTR_460EX_PHY_CLK_FIX |
7 +                                 EMAC_FTR_APM821XX_PHY_CLK_FIX |
8                                   EMAC_FTR_440EP_PHY_CLK_FIX))
9                 DBG(dev, "%s" NL, error);
10         else if (net_ratelimit())
11 @@ -146,6 +147,10 @@ static inline void emac_rx_clk_tx(struct
12         if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
13                 dcri_clrset(SDR0, SDR0_MFR,
14                             0, SDR0_MFR_ECS >> dev->cell_index);
15 +
16 +       if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX))
17 +                dcri_clrset(SDR0, SDR0_ETH_CFG,
18 +                        0, 0x00000100 >> dev->cell_index);
19  #endif
20  }
21  
22 @@ -155,6 +160,10 @@ static inline void emac_rx_clk_default(s
23         if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
24                 dcri_clrset(SDR0, SDR0_MFR,
25                             SDR0_MFR_ECS >> dev->cell_index, 0);
26 +
27 +       if (emac_has_feature(dev, EMAC_FTR_APM821XX_PHY_CLK_FIX))
28 +               dcri_clrset(SDR0, SDR0_ETH_CFG,
29 +                           0x00000100 >> dev->cell_index, 0);
30  #endif
31  }
32  
33 @@ -2587,7 +2596,7 @@ static int emac_init_config(struct emac_
34                 if (of_device_is_compatible(np, "ibm,emac-apm821xx")) {
35                         dev->features |= (EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE |
36                                           EMAC_FTR_APM821XX_NO_HALF_DUPLEX |
37 -                                         EMAC_FTR_460EX_PHY_CLK_FIX);
38 +                                         EMAC_FTR_APM821XX_PHY_CLK_FIX);
39                 }
40         } else if (of_device_is_compatible(np, "ibm,emac4")) {
41                 dev->features |= EMAC_FTR_EMAC4;
42 --- a/drivers/net/ethernet/ibm/emac/core.h
43 +++ b/drivers/net/ethernet/ibm/emac/core.h
44 @@ -333,6 +333,8 @@ struct emac_instance {
45   */
46  #define EMAC_FTR_APM821XX_NO_HALF_DUPLEX       0x00001000
47  
48 +#define EMAC_FTR_APM821XX_PHY_CLK_FIX  0x000002000
49 +
50  /* Right now, we don't quite handle the always/possible masks on the
51   * most optimal way as we don't have a way to say something like
52   * always EMAC4. Patches welcome.