Lines Matching full:pcs
3 * Lynx PCS MDIO helpers
8 #include <linux/pcs-lynx.h>
11 #define SGMII_CLOCK_PERIOD_NS 8 /* PCS is clocked at 125 MHz */
24 struct phylink_pcs pcs; member
35 #define phylink_pcs_to_lynx(pl_pcs) container_of((pl_pcs), struct lynx_pcs, pcs)
36 #define lynx_to_phylink_pcs(lynx) (&(lynx)->pcs)
38 static unsigned int lynx_pcs_inband_caps(struct phylink_pcs *pcs, in lynx_pcs_inband_caps() argument
59 static void lynx_pcs_get_state_usxgmii(struct mdio_device *pcs, in lynx_pcs_get_state_usxgmii() argument
62 struct mii_bus *bus = pcs->bus; in lynx_pcs_get_state_usxgmii()
63 int addr = pcs->addr; in lynx_pcs_get_state_usxgmii()
82 static void lynx_pcs_get_state_2500basex(struct mdio_device *pcs, in lynx_pcs_get_state_2500basex() argument
87 bmsr = mdiodev_read(pcs, MII_BMSR); in lynx_pcs_get_state_2500basex()
103 static void lynx_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode, in lynx_pcs_get_state() argument
106 struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); in lynx_pcs_get_state()
135 static int lynx_pcs_config_giga(struct mdio_device *pcs, in lynx_pcs_config_giga() argument
149 mdiodev_write(pcs, LINK_TIMER_LO, link_timer & 0xffff); in lynx_pcs_config_giga()
150 mdiodev_write(pcs, LINK_TIMER_HI, link_timer >> 16); in lynx_pcs_config_giga()
162 err = mdiodev_modify(pcs, IF_MODE, in lynx_pcs_config_giga()
168 return phylink_mii_c22_pcs_config(pcs, interface, advertising, in lynx_pcs_config_giga()
172 static int lynx_pcs_config_usxgmii(struct mdio_device *pcs, in lynx_pcs_config_usxgmii() argument
176 struct mii_bus *bus = pcs->bus; in lynx_pcs_config_usxgmii()
177 int addr = pcs->addr; in lynx_pcs_config_usxgmii()
180 dev_err(&pcs->dev, "USXGMII only supports in-band AN for now\n"); in lynx_pcs_config_usxgmii()
191 static int lynx_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, in lynx_pcs_config() argument
195 struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); in lynx_pcs_config()
223 static void lynx_pcs_an_restart(struct phylink_pcs *pcs) in lynx_pcs_an_restart() argument
225 struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); in lynx_pcs_an_restart()
230 static void lynx_pcs_link_up_sgmii(struct mdio_device *pcs, in lynx_pcs_link_up_sgmii() argument
236 /* The PCS needs to be configured manually only in lynx_pcs_link_up_sgmii()
259 dev_err(&pcs->dev, "Invalid PCS speed %d\n", speed); in lynx_pcs_link_up_sgmii()
264 mdiodev_modify(pcs, IF_MODE, in lynx_pcs_link_up_sgmii()
285 static void lynx_pcs_link_up_2500basex(struct mdio_device *pcs, in lynx_pcs_link_up_2500basex() argument
292 dev_err(&pcs->dev, "AN not supported for 2500BaseX\n"); in lynx_pcs_link_up_2500basex()
300 mdiodev_modify(pcs, IF_MODE, in lynx_pcs_link_up_2500basex()
305 static void lynx_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, in lynx_pcs_link_up() argument
309 struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); in lynx_pcs_link_up()
357 lynx->pcs.ops = &lynx_pcs_phylink_ops; in lynx_pcs_create()
358 lynx->pcs.neg_mode = true; in lynx_pcs_create()
359 lynx->pcs.poll = true; in lynx_pcs_create()
362 __set_bit(lynx_interfaces[i], lynx->pcs.supported_interfaces); in lynx_pcs_create()
370 struct phylink_pcs *pcs; in lynx_pcs_create_mdiodev() local
376 pcs = lynx_pcs_create(mdio); in lynx_pcs_create_mdiodev()
386 return pcs; in lynx_pcs_create_mdiodev()
391 * lynx_pcs_create_fwnode() creates a lynx PCS instance from the fwnode
403 struct phylink_pcs *pcs; in lynx_pcs_create_fwnode() local
412 pcs = lynx_pcs_create(mdio); in lynx_pcs_create_fwnode()
422 return pcs; in lynx_pcs_create_fwnode()
426 void lynx_pcs_destroy(struct phylink_pcs *pcs) in lynx_pcs_destroy() argument
428 struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs); in lynx_pcs_destroy()
435 MODULE_DESCRIPTION("NXP Lynx PCS phylink library");