v1.5 branch refresh based upon upstream master @ c8677ca89e53e3be7988d54280fce166cc894a7e
[librecmc/librecmc.git] / target / linux / generic / pending-4.4 / 078-0002-net-phy-update-Broadcom-drivers-to-v4.6.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Subject: [PATCH 2/4] net: phy: update Broadcom drivers to v4.6
3 MIME-Version: 1.0
4 Content-Type: text/plain; charset=UTF-8
5 Content-Transfer-Encoding: 8bit
6
7 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
8 ---
9
10 --- a/drivers/net/phy/bcm7xxx.c
11 +++ b/drivers/net/phy/bcm7xxx.c
12 @@ -24,7 +24,7 @@
13  #define MII_BCM7XXX_100TX_FALSE_CAR    0x13
14  #define MII_BCM7XXX_100TX_DISC         0x14
15  #define MII_BCM7XXX_AUX_MODE           0x1d
16 -#define  MII_BCM7XX_64CLK_MDIO         BIT(12)
17 +#define  MII_BCM7XXX_64CLK_MDIO                BIT(12)
18  #define MII_BCM7XXX_TEST               0x1f
19  #define  MII_BCM7XXX_SHD_MODE_2                BIT(2)
20  
21 @@ -247,7 +247,7 @@ static int bcm7xxx_config_init(struct ph
22         int ret;
23  
24         /* Enable 64 clock MDIO */
25 -       phy_write(phydev, MII_BCM7XXX_AUX_MODE, MII_BCM7XX_64CLK_MDIO);
26 +       phy_write(phydev, MII_BCM7XXX_AUX_MODE, MII_BCM7XXX_64CLK_MDIO);
27         phy_read(phydev, MII_BCM7XXX_AUX_MODE);
28  
29         /* set shadow mode 2 */
30 @@ -318,6 +318,22 @@ static int bcm7xxx_suspend(struct phy_de
31         .driver         = { .owner = THIS_MODULE },                     \
32  }
33  
34 +#define BCM7XXX_40NM_EPHY(_oui, _name)                                 \
35 +{                                                                      \
36 +       .phy_id         = (_oui),                                       \
37 +       .phy_id_mask    = 0xfffffff0,                                   \
38 +       .name           = _name,                                        \
39 +       .features       = PHY_BASIC_FEATURES |                          \
40 +                         SUPPORTED_Pause | SUPPORTED_Asym_Pause,       \
41 +       .flags          = PHY_IS_INTERNAL,                              \
42 +       .config_init    = bcm7xxx_config_init,                          \
43 +       .config_aneg    = genphy_config_aneg,                           \
44 +       .read_status    = genphy_read_status,                           \
45 +       .suspend        = bcm7xxx_suspend,                              \
46 +       .resume         = bcm7xxx_config_init,                          \
47 +       .driver         = { .owner = THIS_MODULE },                     \
48 +}
49 +
50  static struct phy_driver bcm7xxx_driver[] = {
51         BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"),
52         BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"),
53 @@ -325,51 +341,19 @@ static struct phy_driver bcm7xxx_driver[
54         BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"),
55         BCM7XXX_28NM_GPHY(PHY_ID_BCM7439_2, "Broadcom BCM7439 (2)"),
56         BCM7XXX_28NM_GPHY(PHY_ID_BCM7445, "Broadcom BCM7445"),
57 -{
58 -       .phy_id         = PHY_ID_BCM7425,
59 -       .phy_id_mask    = 0xfffffff0,
60 -       .name           = "Broadcom BCM7425",
61 -       .features       = PHY_BASIC_FEATURES |
62 -                         SUPPORTED_Pause | SUPPORTED_Asym_Pause,
63 -       .flags          = PHY_IS_INTERNAL,
64 -       .config_init    = bcm7xxx_config_init,
65 -       .config_aneg    = genphy_config_aneg,
66 -       .read_status    = genphy_read_status,
67 -       .suspend        = bcm7xxx_suspend,
68 -       .resume         = bcm7xxx_config_init,
69 -       .driver         = { .owner = THIS_MODULE },
70 -}, {
71 -       .phy_id         = PHY_ID_BCM7429,
72 -       .phy_id_mask    = 0xfffffff0,
73 -       .name           = "Broadcom BCM7429",
74 -       .features       = PHY_BASIC_FEATURES |
75 -                         SUPPORTED_Pause | SUPPORTED_Asym_Pause,
76 -       .flags          = PHY_IS_INTERNAL,
77 -       .config_init    = bcm7xxx_config_init,
78 -       .config_aneg    = genphy_config_aneg,
79 -       .read_status    = genphy_read_status,
80 -       .suspend        = bcm7xxx_suspend,
81 -       .resume         = bcm7xxx_config_init,
82 -       .driver         = { .owner = THIS_MODULE },
83 -}, {
84 -       .phy_id         = PHY_ID_BCM7435,
85 -       .phy_id_mask    = 0xfffffff0,
86 -       .name           = "Broadcom BCM7435",
87 -       .features       = PHY_BASIC_FEATURES |
88 -                         SUPPORTED_Pause | SUPPORTED_Asym_Pause,
89 -       .flags          = PHY_IS_INTERNAL,
90 -       .config_init    = bcm7xxx_config_init,
91 -       .config_aneg    = genphy_config_aneg,
92 -       .read_status    = genphy_read_status,
93 -       .suspend        = bcm7xxx_suspend,
94 -       .resume         = bcm7xxx_config_init,
95 -       .driver         = { .owner = THIS_MODULE },
96 -} };
97 +       BCM7XXX_40NM_EPHY(PHY_ID_BCM7346, "Broadcom BCM7346"),
98 +       BCM7XXX_40NM_EPHY(PHY_ID_BCM7362, "Broadcom BCM7362"),
99 +       BCM7XXX_40NM_EPHY(PHY_ID_BCM7425, "Broadcom BCM7425"),
100 +       BCM7XXX_40NM_EPHY(PHY_ID_BCM7429, "Broadcom BCM7429"),
101 +       BCM7XXX_40NM_EPHY(PHY_ID_BCM7435, "Broadcom BCM7435"),
102 +};
103  
104  static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = {
105         { PHY_ID_BCM7250, 0xfffffff0, },
106         { PHY_ID_BCM7364, 0xfffffff0, },
107         { PHY_ID_BCM7366, 0xfffffff0, },
108 +       { PHY_ID_BCM7346, 0xfffffff0, },
109 +       { PHY_ID_BCM7362, 0xfffffff0, },
110         { PHY_ID_BCM7425, 0xfffffff0, },
111         { PHY_ID_BCM7429, 0xfffffff0, },
112         { PHY_ID_BCM7439, 0xfffffff0, },
113 --- a/include/linux/brcmphy.h
114 +++ b/include/linux/brcmphy.h
115 @@ -24,6 +24,8 @@
116  #define PHY_ID_BCM7250                 0xae025280
117  #define PHY_ID_BCM7364                 0xae025260
118  #define PHY_ID_BCM7366                 0x600d8490
119 +#define PHY_ID_BCM7346                 0x600d8650
120 +#define PHY_ID_BCM7362                 0x600d84b0
121  #define PHY_ID_BCM7425                 0x600d86b0
122  #define PHY_ID_BCM7429                 0x600d8730
123  #define PHY_ID_BCM7435                 0x600d8750