1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Subject: [PATCH 2/2] net: phy: pick Broadcom drivers updates from net-next for
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
8 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
11 --- a/drivers/net/phy/bcm7xxx.c
12 +++ b/drivers/net/phy/bcm7xxx.c
13 @@ -163,12 +163,43 @@ static int bcm7xxx_28nm_e0_plus_afe_conf
17 +static int bcm7xxx_28nm_a0_patch_afe_config_init(struct phy_device *phydev)
19 + /* +1 RC_CAL codes for RL centering for both LT and HT conditions */
20 + bcm_phy_write_misc(phydev, AFE_RXCONFIG_2, 0xd003);
22 + /* Cut master bias current by 2% to compensate for RC_CAL offset */
23 + bcm_phy_write_misc(phydev, DSP_TAP10, 0x791b);
25 + /* Improve hybrid leakage */
26 + bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x10e3);
28 + /* Change rx_on_tune 8 to 0xf */
29 + bcm_phy_write_misc(phydev, 0x21, 0x2, 0x87f6);
31 + /* Change 100Tx EEE bandwidth */
32 + bcm_phy_write_misc(phydev, 0x22, 0x2, 0x017d);
34 + /* Enable ffe zero detection for Vitesse interoperability */
35 + bcm_phy_write_misc(phydev, 0x26, 0x2, 0x0015);
37 + r_rc_cal_reset(phydev);
42 static int bcm7xxx_28nm_config_init(struct phy_device *phydev)
44 u8 rev = PHY_BRCM_7XXX_REV(phydev->dev_flags);
45 u8 patch = PHY_BRCM_7XXX_PATCH(phydev->dev_flags);
48 + /* Newer devices have moved the revision information back into a
49 + * standard location in MII_PHYS_ID[23]
52 + rev = phydev->phy_id & ~phydev->drv->phy_id_mask;
54 pr_info_once("%s: %s PHY revision: 0x%02x, patch: %d\n",
55 dev_name(&phydev->dev), phydev->drv->name, rev, patch);
57 @@ -192,6 +223,9 @@ static int bcm7xxx_28nm_config_init(stru
59 ret = bcm7xxx_28nm_e0_plus_afe_config_init(phydev);
62 + ret = bcm7xxx_28nm_a0_patch_afe_config_init(phydev);
67 @@ -336,6 +370,7 @@ static int bcm7xxx_suspend(struct phy_de
69 static struct phy_driver bcm7xxx_driver[] = {
70 BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"),
71 + BCM7XXX_28NM_GPHY(PHY_ID_BCM7278, "Broadcom BCM7278"),
72 BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"),
73 BCM7XXX_28NM_GPHY(PHY_ID_BCM7366, "Broadcom BCM7366"),
74 BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"),
75 @@ -350,6 +385,7 @@ static struct phy_driver bcm7xxx_driver[
77 static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = {
78 { PHY_ID_BCM7250, 0xfffffff0, },
79 + { PHY_ID_BCM7278, 0xfffffff0, },
80 { PHY_ID_BCM7364, 0xfffffff0, },
81 { PHY_ID_BCM7366, 0xfffffff0, },
82 { PHY_ID_BCM7346, 0xfffffff0, },
83 --- a/drivers/net/phy/broadcom.c
84 +++ b/drivers/net/phy/broadcom.c
85 @@ -395,12 +395,10 @@ static int bcm54612e_config_aneg(struct
86 (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
89 - /* Errata: reads require filling in the write selector field */
90 - bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
91 - MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC);
92 - reg = phy_read(phydev, MII_BCM54XX_AUX_CTL);
93 + reg = bcm54xx_auxctl_read(phydev,
94 + MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
95 /* Disable RXD to RXC delay (default set) */
96 - reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW;
97 + reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
98 /* Clear shadow selector field */
99 reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
100 bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
101 --- a/include/linux/brcmphy.h
102 +++ b/include/linux/brcmphy.h
104 #define PHY_ID_BCM57780 0x03625d90
106 #define PHY_ID_BCM7250 0xae025280
107 +#define PHY_ID_BCM7278 0xae0251a0
108 #define PHY_ID_BCM7364 0xae025260
109 #define PHY_ID_BCM7366 0x600d8490
110 #define PHY_ID_BCM7346 0x600d8650
111 @@ -103,18 +104,17 @@
113 * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18)
115 -#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
116 +#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x00
117 #define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400
118 #define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800
120 -#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000
121 -#define MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW 0x0100
122 -#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
123 -#define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000
124 -#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007
125 -#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12
126 -#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN (1 << 8)
127 +#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x07
128 +#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN 0x0010
129 +#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN 0x0100
130 +#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
131 +#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000
133 +#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12
134 #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007