03013a01974d647fae25adcf205e64c6e3bed882
[openwrt/staging/zorun.git] /
1 From: Florian Fainelli <f.fainelli@gmail.com>
2 Date: Tue, 22 Nov 2016 11:40:54 -0800
3 Subject: [PATCH] net: phy: broadcom: Move bcm54xx_auxctl_{read, write} to
4 common library
5
6 We are going to need these functions to implement support for Broadcom
7 Wirespeed, aka downshift.
8
9 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
10 Signed-off-by: David S. Miller <davem@davemloft.net>
11 ---
12
13 --- a/drivers/net/phy/bcm-phy-lib.c
14 +++ b/drivers/net/phy/bcm-phy-lib.c
15 @@ -50,6 +50,23 @@ int bcm_phy_read_exp(struct phy_device *
16 }
17 EXPORT_SYMBOL_GPL(bcm_phy_read_exp);
18
19 +int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
20 +{
21 + /* The register must be written to both the Shadow Register Select and
22 + * the Shadow Read Register Selector
23 + */
24 + phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
25 + regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
26 + return phy_read(phydev, MII_BCM54XX_AUX_CTL);
27 +}
28 +EXPORT_SYMBOL_GPL(bcm54xx_auxctl_read);
29 +
30 +int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
31 +{
32 + return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
33 +}
34 +EXPORT_SYMBOL(bcm54xx_auxctl_write);
35 +
36 int bcm_phy_write_misc(struct phy_device *phydev,
37 u16 reg, u16 chl, u16 val)
38 {
39 --- a/drivers/net/phy/bcm-phy-lib.h
40 +++ b/drivers/net/phy/bcm-phy-lib.h
41 @@ -19,6 +19,9 @@
42 int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val);
43 int bcm_phy_read_exp(struct phy_device *phydev, u16 reg);
44
45 +int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val);
46 +int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum);
47 +
48 int bcm_phy_write_misc(struct phy_device *phydev,
49 u16 reg, u16 chl, u16 value);
50 int bcm_phy_read_misc(struct phy_device *phydev,
51 --- a/drivers/net/phy/broadcom.c
52 +++ b/drivers/net/phy/broadcom.c
53 @@ -30,21 +30,6 @@ MODULE_DESCRIPTION("Broadcom PHY driver"
54 MODULE_AUTHOR("Maciej W. Rozycki");
55 MODULE_LICENSE("GPL");
56
57 -static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
58 -{
59 - /* The register must be written to both the Shadow Register Select and
60 - * the Shadow Read Register Selector
61 - */
62 - phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
63 - regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
64 - return phy_read(phydev, MII_BCM54XX_AUX_CTL);
65 -}
66 -
67 -static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
68 -{
69 - return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
70 -}
71 -
72 static int bcm54810_config(struct phy_device *phydev)
73 {
74 int rc, val;