Lines Matching +full:bus +full:- +full:addr

1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
8 #include <linux/pcs-lynx.h>
36 struct mii_bus *bus = pcs->bus; in lynx_pcs_get_state_usxgmii() local
37 int addr = pcs->addr; in lynx_pcs_get_state_usxgmii() local
40 status = mdiobus_c45_read(bus, addr, MDIO_MMD_VEND2, MII_BMSR); in lynx_pcs_get_state_usxgmii()
44 state->link = !!(status & MDIO_STAT1_LSTATUS); in lynx_pcs_get_state_usxgmii()
45 state->an_complete = !!(status & MDIO_AN_STAT1_COMPLETE); in lynx_pcs_get_state_usxgmii()
46 if (!state->link || !state->an_complete) in lynx_pcs_get_state_usxgmii()
49 lpa = mdiobus_c45_read(bus, addr, MDIO_MMD_VEND2, MII_LPA); in lynx_pcs_get_state_usxgmii()
59 struct mii_bus *bus = pcs->bus; in lynx_pcs_get_state_2500basex() local
60 int addr = pcs->addr; in lynx_pcs_get_state_2500basex() local
63 bmsr = mdiobus_read(bus, addr, MII_BMSR); in lynx_pcs_get_state_2500basex()
64 lpa = mdiobus_read(bus, addr, MII_LPA); in lynx_pcs_get_state_2500basex()
66 state->link = false; in lynx_pcs_get_state_2500basex()
70 state->link = !!(bmsr & BMSR_LSTATUS); in lynx_pcs_get_state_2500basex()
71 state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE); in lynx_pcs_get_state_2500basex()
72 if (!state->link) in lynx_pcs_get_state_2500basex()
75 state->speed = SPEED_2500; in lynx_pcs_get_state_2500basex()
76 state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX; in lynx_pcs_get_state_2500basex()
77 state->duplex = DUPLEX_FULL; in lynx_pcs_get_state_2500basex()
85 switch (state->interface) { in lynx_pcs_get_state()
88 phylink_mii_c22_pcs_get_state(lynx->mdio, state); in lynx_pcs_get_state()
91 lynx_pcs_get_state_2500basex(lynx->mdio, state); in lynx_pcs_get_state()
94 lynx_pcs_get_state_usxgmii(lynx->mdio, state); in lynx_pcs_get_state()
97 phylink_mii_c45_pcs_get_state(lynx->mdio, state); in lynx_pcs_get_state()
103 dev_dbg(&lynx->mdio->dev, in lynx_pcs_get_state()
105 phy_modes(state->interface), in lynx_pcs_get_state()
106 phy_speed_to_str(state->speed), in lynx_pcs_get_state()
107 phy_duplex_to_str(state->duplex), in lynx_pcs_get_state()
108 state->link, state->an_enabled, state->an_complete); in lynx_pcs_get_state()
114 struct mii_bus *bus = pcs->bus; in lynx_pcs_config_sgmii() local
115 int addr = pcs->addr; in lynx_pcs_config_sgmii() local
127 mdiobus_write(bus, addr, LINK_TIMER_LO, link_timer & 0xffff); in lynx_pcs_config_sgmii()
128 mdiobus_write(bus, addr, LINK_TIMER_HI, link_timer >> 16); in lynx_pcs_config_sgmii()
130 err = mdiobus_modify(bus, addr, IF_MODE, in lynx_pcs_config_sgmii()
143 struct mii_bus *bus = pcs->bus; in lynx_pcs_config_usxgmii() local
144 int addr = pcs->addr; in lynx_pcs_config_usxgmii() local
147 dev_err(&pcs->dev, "USXGMII only supports in-band AN for now\n"); in lynx_pcs_config_usxgmii()
148 return -EOPNOTSUPP; in lynx_pcs_config_usxgmii()
152 return mdiobus_c45_write(bus, addr, MDIO_MMD_VEND2, MII_ADVERTISE, in lynx_pcs_config_usxgmii()
168 return lynx_pcs_config_sgmii(lynx->mdio, mode, advertising); in lynx_pcs_config()
171 dev_err(&lynx->mdio->dev, in lynx_pcs_config()
173 return -EOPNOTSUPP; in lynx_pcs_config()
177 return lynx_pcs_config_usxgmii(lynx->mdio, mode, advertising); in lynx_pcs_config()
182 return -EOPNOTSUPP; in lynx_pcs_config()
191 struct mii_bus *bus = pcs->bus; in lynx_pcs_link_up_sgmii() local
193 int addr = pcs->addr; in lynx_pcs_link_up_sgmii() local
196 * when not operating on in-band mode in lynx_pcs_link_up_sgmii()
218 dev_err(&pcs->dev, "Invalid PCS speed %d\n", speed); in lynx_pcs_link_up_sgmii()
223 mdiobus_modify(bus, addr, IF_MODE, in lynx_pcs_link_up_sgmii()
228 /* 2500Base-X is SerDes protocol 7 on Felix and 6 on ENETC. It is a SerDes lane
230 * auto-negotiation of any link parameters. Electrically it is compatible with
234 * - Downgrading the link speed by duplicating symbols
235 * - Auto-negotiation
240 * AN, we call this PHY interface type 2500Base-X. In case a PHY negotiates a
241 * lower link speed on line side, the system-side interface remains fixed at
248 struct mii_bus *bus = pcs->bus; in lynx_pcs_link_up_2500basex() local
249 int addr = pcs->addr; in lynx_pcs_link_up_2500basex() local
253 dev_err(&pcs->dev, "AN not supported for 2500BaseX\n"); in lynx_pcs_link_up_2500basex()
261 mdiobus_modify(bus, addr, IF_MODE, in lynx_pcs_link_up_2500basex()
275 lynx_pcs_link_up_sgmii(lynx->mdio, mode, speed, duplex); in lynx_pcs_link_up()
278 lynx_pcs_link_up_2500basex(lynx->mdio, mode, speed, duplex); in lynx_pcs_link_up()
281 /* At the moment, only in-band AN is supported for USXGMII in lynx_pcs_link_up()
304 lynx_pcs->mdio = mdio; in lynx_pcs_create()
305 lynx_pcs->pcs.ops = &lynx_pcs_phylink_ops; in lynx_pcs_create()
306 lynx_pcs->pcs.poll = true; in lynx_pcs_create()