Lines Matching refs:val
17 int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val) in bcm_phy_write_exp() argument
25 return phy_write(phydev, MII_BCM54XX_EXP_DATA, val); in bcm_phy_write_exp()
31 int val; in bcm_phy_read_exp() local
33 val = phy_write(phydev, MII_BCM54XX_EXP_SEL, reg); in bcm_phy_read_exp()
34 if (val < 0) in bcm_phy_read_exp()
35 return val; in bcm_phy_read_exp()
37 val = phy_read(phydev, MII_BCM54XX_EXP_DATA); in bcm_phy_read_exp()
42 return val; in bcm_phy_read_exp()
57 int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) in bcm54xx_auxctl_write() argument
59 return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); in bcm54xx_auxctl_write()
64 u16 reg, u16 chl, u16 val) in bcm_phy_write_misc() argument
81 rc = bcm_phy_write_exp(phydev, tmp, val); in bcm_phy_write_misc()
149 u16 val) in bcm_phy_write_shadow() argument
154 MII_BCM54XX_SHD_DATA(val)); in bcm_phy_write_shadow()
160 int val; in bcm_phy_enable_apd() local
163 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3); in bcm_phy_enable_apd()
164 if (val < 0) in bcm_phy_enable_apd()
165 return val; in bcm_phy_enable_apd()
167 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS; in bcm_phy_enable_apd()
168 bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val); in bcm_phy_enable_apd()
171 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_APD); in bcm_phy_enable_apd()
172 if (val < 0) in bcm_phy_enable_apd()
173 return val; in bcm_phy_enable_apd()
176 val &= BCM_APD_CLR_MASK; in bcm_phy_enable_apd()
179 val |= BCM54XX_SHD_APD_EN; in bcm_phy_enable_apd()
181 val |= BCM_NO_ANEG_APD_EN; in bcm_phy_enable_apd()
184 val |= BCM_APD_SINGLELP_EN; in bcm_phy_enable_apd()
187 return bcm_phy_write_shadow(phydev, BCM54XX_SHD_APD, val); in bcm_phy_enable_apd()
193 int val; in bcm_phy_set_eee() local
196 val = phy_read_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL); in bcm_phy_set_eee()
197 if (val < 0) in bcm_phy_set_eee()
198 return val; in bcm_phy_set_eee()
201 val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X; in bcm_phy_set_eee()
203 val &= ~(LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X); in bcm_phy_set_eee()
205 phy_write_mmd(phydev, MDIO_MMD_AN, BRCM_CL45VEN_EEE_CONTROL, (u32)val); in bcm_phy_set_eee()
208 val = phy_read_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV); in bcm_phy_set_eee()
209 if (val < 0) in bcm_phy_set_eee()
210 return val; in bcm_phy_set_eee()
213 val |= (MDIO_EEE_100TX | MDIO_EEE_1000T); in bcm_phy_set_eee()
215 val &= ~(MDIO_EEE_100TX | MDIO_EEE_1000T); in bcm_phy_set_eee()
217 phy_write_mmd(phydev, MDIO_MMD_AN, BCM_CL45VEN_EEE_ADV, (u32)val); in bcm_phy_set_eee()
225 int val; in bcm_phy_downshift_get() local
227 val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); in bcm_phy_downshift_get()
228 if (val < 0) in bcm_phy_downshift_get()
229 return val; in bcm_phy_downshift_get()
232 if (!(val & MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN)) { in bcm_phy_downshift_get()
237 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR2); in bcm_phy_downshift_get()
238 if (val < 0) in bcm_phy_downshift_get()
239 return val; in bcm_phy_downshift_get()
242 if (val & BCM54XX_SHD_SCR2_WSPD_RTRY_DIS) { in bcm_phy_downshift_get()
246 val >>= BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_SHIFT; in bcm_phy_downshift_get()
247 val &= BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_MASK; in bcm_phy_downshift_get()
248 *count = val + BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_OFFSET; in bcm_phy_downshift_get()
257 int val = 0, ret = 0; in bcm_phy_downshift_set() local
266 val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); in bcm_phy_downshift_set()
267 if (val < 0) in bcm_phy_downshift_set()
268 return val; in bcm_phy_downshift_set()
271 val |= MII_BCM54XX_AUXCTL_MISC_WREN; in bcm_phy_downshift_set()
274 val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN; in bcm_phy_downshift_set()
277 val); in bcm_phy_downshift_set()
279 val |= MII_BCM54XX_AUXCTL_SHDWSEL_MISC_WIRESPEED_EN; in bcm_phy_downshift_set()
282 val); in bcm_phy_downshift_set()
287 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR2); in bcm_phy_downshift_set()
288 val &= ~(BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_MASK << in bcm_phy_downshift_set()
294 val |= BCM54XX_SHD_SCR2_WSPD_RTRY_DIS; in bcm_phy_downshift_set()
297 val |= 1 << BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_SHIFT; in bcm_phy_downshift_set()
300 val |= (count - BCM54XX_SHD_SCR2_WSPD_RTRY_LMT_OFFSET) << in bcm_phy_downshift_set()
305 return bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR2, val); in bcm_phy_downshift_set()
348 int val; in bcm_phy_get_stat() local
351 val = phy_read(phydev, stat.reg); in bcm_phy_get_stat()
352 if (val < 0) { in bcm_phy_get_stat()
355 val >>= stat.shift; in bcm_phy_get_stat()
356 val = val & ((1 << stat.bits) - 1); in bcm_phy_get_stat()
357 shadow[i] += val; in bcm_phy_get_stat()