ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0114-sdk_dpaa-SGMII-2500-needs-AN-disabled.patch
1 From e36f12a1d319b53d5f52b91671188a74e0a1fb41 Mon Sep 17 00:00:00 2001
2 From: Madalin Bucur <madalin.bucur@nxp.com>
3 Date: Tue, 23 Apr 2019 16:38:19 +0300
4 Subject: [PATCH] sdk_dpaa: SGMII 2500 needs AN disabled
5
6 Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
7 ---
8  .../ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c | 14 ++++++++++----
9  .../ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.h |  1 +
10  2 files changed, 11 insertions(+), 4 deletions(-)
11
12 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c
13 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.c
14 @@ -84,6 +84,7 @@ static void SetupSgmiiInternalPhy(t_Mema
15  {
16      uint16_t    tmpReg16;
17      e_EnetMode  enetMode;
18 +    bool autoneg_disabled = p_Memac->enetMode == e_ENET_MODE_SGMII_2500;
19  
20       /* In case the higher MACs are used (i.e. the MACs that should support 10G),
21          speed=10000 is provided for SGMII ports. Temporary modify enet mode
22 @@ -92,8 +93,9 @@ static void SetupSgmiiInternalPhy(t_Mema
23  
24      /* SGMII mode + AN enable */
25      tmpReg16 = PHY_SGMII_IF_MODE_AN | PHY_SGMII_IF_MODE_SGMII;
26 -    if ((p_Memac->enetMode) == e_ENET_MODE_SGMII_2500)
27 -        tmpReg16 = PHY_SGMII_CR_PHY_RESET | PHY_SGMII_IF_SPEED_GIGABIT | PHY_SGMII_IF_MODE_SGMII;
28 +    /* unless SGMII 2500 where AN needs to be disabled  */
29 +    if (autoneg_disabled)
30 +        tmpReg16 = PHY_SGMII_IF_SPEED_GIGABIT | PHY_SGMII_IF_MODE_SGMII;
31  
32      p_Memac->enetMode = MAKE_ENET_MODE(ENET_INTERFACE_FROM_MODE(p_Memac->enetMode), e_ENET_SPEED_1000);
33      MEMAC_MII_WritePhyReg(p_Memac, phyAddr, 0x14, tmpReg16);
34 @@ -116,8 +118,12 @@ static void SetupSgmiiInternalPhy(t_Mema
35      MEMAC_MII_WritePhyReg(p_Memac, phyAddr, 0x13, 0x0007);
36      MEMAC_MII_WritePhyReg(p_Memac, phyAddr, 0x12, 0xa120);
37  
38 -    /* Restart AN */
39 -    tmpReg16 = PHY_SGMII_CR_DEF_VAL | PHY_SGMII_CR_RESET_AN;
40 +    if (!autoneg_disabled)
41 +        /* Restart AN */
42 +        tmpReg16 = PHY_SGMII_CR_DEF_VAL | PHY_SGMII_CR_RESET_AN;
43 +    else
44 +        /* Disable AN */
45 +        tmpReg16 = PHY_SGMII_CR_DEF_VAL & ~PHY_SGMII_CR_AN_EN;
46      MEMAC_MII_WritePhyReg(p_Memac, phyAddr, 0x0, tmpReg16);
47  
48      /* Restore original enet mode */
49 --- a/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.h
50 +++ b/drivers/net/ethernet/freescale/sdk_fman/Peripherals/FM/MAC/memac.h
51 @@ -93,6 +93,7 @@ typedef struct
52  #define PHY_SGMII_CR_PHY_RESET          0x8000
53  #define PHY_SGMII_CR_RESET_AN           0x0200
54  #define PHY_SGMII_CR_DEF_VAL            0x1140
55 +#define PHY_SGMII_CR_AN_EN              0x1000
56  #define PHY_SGMII_DEV_ABILITY_SGMII     0x4001
57  #define PHY_SGMII_DEV_ABILITY_1000X     0x01A0
58  #define PHY_SGMII_IF_SPEED_GIGABIT     0x0008