• Home
  • Raw
  • Download

Lines Matching refs:phydev

216 __weak int mv88e61xx_hw_reset(struct phy_device *phydev)  in mv88e61xx_hw_reset()  argument
255 static int mv88e61xx_reg_read(struct phy_device *phydev, int dev, int reg) in mv88e61xx_reg_read() argument
257 struct mv88e61xx_phy_priv *priv = phydev->priv; in mv88e61xx_reg_read()
291 static int mv88e61xx_reg_write(struct phy_device *phydev, int dev, int reg, in mv88e61xx_reg_write() argument
294 struct mv88e61xx_phy_priv *priv = phydev->priv; in mv88e61xx_reg_write()
330 static int mv88e61xx_phy_wait(struct phy_device *phydev) in mv88e61xx_phy_wait() argument
336 val = mv88e61xx_reg_read(phydev, DEVADDR_GLOBAL_2, in mv88e61xx_phy_wait()
350 struct phy_device *phydev; in mv88e61xx_phy_read_indirect() local
353 phydev = (struct phy_device *)smi_wrapper->priv; in mv88e61xx_phy_read_indirect()
356 res = mv88e61xx_reg_write(phydev, DEVADDR_GLOBAL_2, in mv88e61xx_phy_read_indirect()
361 res = mv88e61xx_phy_wait(phydev); in mv88e61xx_phy_read_indirect()
366 return mv88e61xx_reg_read(phydev, DEVADDR_GLOBAL_2, in mv88e61xx_phy_read_indirect()
373 struct phy_device *phydev; in mv88e61xx_phy_write_indirect() local
376 phydev = (struct phy_device *)smi_wrapper->priv; in mv88e61xx_phy_write_indirect()
379 res = mv88e61xx_reg_write(phydev, DEVADDR_GLOBAL_2, in mv88e61xx_phy_write_indirect()
384 res = mv88e61xx_reg_write(phydev, DEVADDR_GLOBAL_2, in mv88e61xx_phy_write_indirect()
391 return mv88e61xx_phy_wait(phydev); in mv88e61xx_phy_write_indirect()
395 static int mv88e61xx_phy_read(struct phy_device *phydev, int phy, int reg) in mv88e61xx_phy_read() argument
397 return mv88e61xx_phy_read_indirect(phydev->bus, DEVADDR_PHY(phy), in mv88e61xx_phy_read()
402 static int mv88e61xx_phy_write(struct phy_device *phydev, int phy, in mv88e61xx_phy_write() argument
405 return mv88e61xx_phy_write_indirect(phydev->bus, DEVADDR_PHY(phy), in mv88e61xx_phy_write()
409 static int mv88e61xx_port_read(struct phy_device *phydev, u8 port, u8 reg) in mv88e61xx_port_read() argument
411 return mv88e61xx_reg_read(phydev, DEVADDR_PORT(port), reg); in mv88e61xx_port_read()
414 static int mv88e61xx_port_write(struct phy_device *phydev, u8 port, u8 reg, in mv88e61xx_port_write() argument
417 return mv88e61xx_reg_write(phydev, DEVADDR_PORT(port), reg, val); in mv88e61xx_port_write()
420 static int mv88e61xx_set_page(struct phy_device *phydev, u8 phy, u8 page) in mv88e61xx_set_page() argument
422 return mv88e61xx_phy_write(phydev, phy, PHY_REG_PAGE, page); in mv88e61xx_set_page()
425 static int mv88e61xx_get_switch_id(struct phy_device *phydev) in mv88e61xx_get_switch_id() argument
429 res = mv88e61xx_port_read(phydev, 0, PORT_REG_SWITCH_ID); in mv88e61xx_get_switch_id()
435 static bool mv88e61xx_6352_family(struct phy_device *phydev) in mv88e61xx_6352_family() argument
437 struct mv88e61xx_phy_priv *priv = phydev->priv; in mv88e61xx_6352_family()
449 static int mv88e61xx_get_cmode(struct phy_device *phydev, u8 port) in mv88e61xx_get_cmode() argument
453 res = mv88e61xx_port_read(phydev, port, PORT_REG_STATUS); in mv88e61xx_get_cmode()
459 static int mv88e61xx_parse_status(struct phy_device *phydev) in mv88e61xx_parse_status() argument
464 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, PHY_REG_STATUS1); in mv88e61xx_parse_status()
475 phydev->link = 0; in mv88e61xx_parse_status()
482 mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, in mv88e61xx_parse_status()
489 phydev->link = 1; in mv88e61xx_parse_status()
491 phydev->link = 0; in mv88e61xx_parse_status()
495 phydev->duplex = DUPLEX_FULL; in mv88e61xx_parse_status()
497 phydev->duplex = DUPLEX_HALF; in mv88e61xx_parse_status()
503 phydev->speed = SPEED_1000; in mv88e61xx_parse_status()
506 phydev->speed = SPEED_100; in mv88e61xx_parse_status()
509 phydev->speed = SPEED_10; in mv88e61xx_parse_status()
516 static int mv88e61xx_switch_reset(struct phy_device *phydev) in mv88e61xx_switch_reset() argument
524 val = mv88e61xx_port_read(phydev, port, PORT_REG_CTRL); in mv88e61xx_switch_reset()
530 val = mv88e61xx_port_write(phydev, port, PORT_REG_CTRL, val); in mv88e61xx_switch_reset()
539 val = mv88e61xx_reg_read(phydev, DEVADDR_GLOBAL_1, GLOBAL1_CTRL); in mv88e61xx_switch_reset()
543 val = mv88e61xx_reg_write(phydev, DEVADDR_GLOBAL_1, in mv88e61xx_switch_reset()
550 val = mv88e61xx_reg_read(phydev, DEVADDR_GLOBAL_1, in mv88e61xx_switch_reset()
562 static int mv88e61xx_serdes_init(struct phy_device *phydev) in mv88e61xx_serdes_init() argument
566 val = mv88e61xx_set_page(phydev, DEVADDR_SERDES, PHY_PAGE_SERDES); in mv88e61xx_serdes_init()
571 val = mv88e61xx_phy_read(phydev, DEVADDR_SERDES, MII_BMCR); in mv88e61xx_serdes_init()
575 val = mv88e61xx_phy_write(phydev, DEVADDR_SERDES, MII_BMCR, val); in mv88e61xx_serdes_init()
582 static int mv88e61xx_port_enable(struct phy_device *phydev, u8 port) in mv88e61xx_port_enable() argument
586 val = mv88e61xx_port_read(phydev, port, PORT_REG_CTRL); in mv88e61xx_port_enable()
592 val = mv88e61xx_port_write(phydev, port, PORT_REG_CTRL, val); in mv88e61xx_port_enable()
599 static int mv88e61xx_port_set_vlan(struct phy_device *phydev, u8 port, in mv88e61xx_port_set_vlan() argument
605 val = mv88e61xx_port_read(phydev, port, PORT_REG_VLAN_ID); in mv88e61xx_port_set_vlan()
611 val = mv88e61xx_port_write(phydev, port, PORT_REG_VLAN_ID, val); in mv88e61xx_port_set_vlan()
616 val = mv88e61xx_port_read(phydev, port, PORT_REG_VLAN_MAP); in mv88e61xx_port_set_vlan()
622 val = mv88e61xx_port_write(phydev, port, PORT_REG_VLAN_MAP, val); in mv88e61xx_port_set_vlan()
629 static int mv88e61xx_read_port_config(struct phy_device *phydev, u8 port) in mv88e61xx_read_port_config() argument
635 val = mv88e61xx_port_read(phydev, port, PORT_REG_STATUS); in mv88e61xx_read_port_config()
643 val = mv88e61xx_port_read(phydev, port, PORT_REG_PHYS_CTRL); in mv88e61xx_read_port_config()
648 val = mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL, in mv88e61xx_read_port_config()
655 val = mv88e61xx_port_read(phydev, port, in mv88e61xx_read_port_config()
672 phydev->duplex = DUPLEX_FULL; in mv88e61xx_read_port_config()
674 phydev->duplex = DUPLEX_HALF; in mv88e61xx_read_port_config()
680 phydev->speed = SPEED_1000; in mv88e61xx_read_port_config()
683 phydev->speed = SPEED_100; in mv88e61xx_read_port_config()
686 phydev->speed = SPEED_10; in mv88e61xx_read_port_config()
694 val = mv88e61xx_port_read(phydev, port, PORT_REG_PHYS_CTRL); in mv88e61xx_read_port_config()
699 val = mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL, in mv88e61xx_read_port_config()
708 static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port) in mv88e61xx_fixed_port_setup() argument
712 val = mv88e61xx_port_read(phydev, port, PORT_REG_PHYS_CTRL); in mv88e61xx_fixed_port_setup()
729 return mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL, in mv88e61xx_fixed_port_setup()
733 static int mv88e61xx_set_cpu_port(struct phy_device *phydev) in mv88e61xx_set_cpu_port() argument
738 val = mv88e61xx_reg_read(phydev, DEVADDR_GLOBAL_1, GLOBAL1_MON_CTRL); in mv88e61xx_set_cpu_port()
744 val = mv88e61xx_reg_write(phydev, DEVADDR_GLOBAL_1, in mv88e61xx_set_cpu_port()
751 val = mv88e61xx_port_set_vlan(phydev, CONFIG_MV88E61XX_CPU_PORT, val); in mv88e61xx_set_cpu_port()
756 val = mv88e61xx_port_enable(phydev, CONFIG_MV88E61XX_CPU_PORT); in mv88e61xx_set_cpu_port()
760 val = mv88e61xx_read_port_config(phydev, CONFIG_MV88E61XX_CPU_PORT); in mv88e61xx_set_cpu_port()
765 if (mv88e61xx_6352_family(phydev)) { in mv88e61xx_set_cpu_port()
766 val = mv88e61xx_get_cmode(phydev, CONFIG_MV88E61XX_CPU_PORT); in mv88e61xx_set_cpu_port()
772 val = mv88e61xx_serdes_init(phydev); in mv88e61xx_set_cpu_port()
777 val = mv88e61xx_fixed_port_setup(phydev, in mv88e61xx_set_cpu_port()
786 static int mv88e61xx_switch_init(struct phy_device *phydev) in mv88e61xx_switch_init() argument
794 res = mv88e61xx_switch_reset(phydev); in mv88e61xx_switch_init()
798 res = mv88e61xx_set_cpu_port(phydev); in mv88e61xx_switch_init()
807 static int mv88e61xx_phy_enable(struct phy_device *phydev, u8 phy) in mv88e61xx_phy_enable() argument
811 val = mv88e61xx_phy_read(phydev, phy, MII_BMCR); in mv88e61xx_phy_enable()
815 val = mv88e61xx_phy_write(phydev, phy, MII_BMCR, val); in mv88e61xx_phy_enable()
822 static int mv88e61xx_phy_setup(struct phy_device *phydev, u8 phy) in mv88e61xx_phy_setup() argument
830 val = mv88e61xx_phy_read(phydev, phy, PHY_REG_CTRL1); in mv88e61xx_phy_setup()
836 val = mv88e61xx_phy_write(phydev, phy, PHY_REG_CTRL1, val); in mv88e61xx_phy_setup()
843 static int mv88e61xx_phy_config_port(struct phy_device *phydev, u8 phy) in mv88e61xx_phy_config_port() argument
847 val = mv88e61xx_port_enable(phydev, phy); in mv88e61xx_phy_config_port()
851 val = mv88e61xx_port_set_vlan(phydev, phy, in mv88e61xx_phy_config_port()
859 static int mv88e61xx_probe(struct phy_device *phydev) in mv88e61xx_probe() argument
865 res = mv88e61xx_hw_reset(phydev); in mv88e61xx_probe()
890 priv->mdio_bus = phydev->bus; in mv88e61xx_probe()
897 priv->smi_addr = phydev->addr; in mv88e61xx_probe()
903 smi_wrapper->priv = phydev; in mv88e61xx_probe()
909 phydev->bus = smi_wrapper; in mv88e61xx_probe()
911 phydev->priv = priv; in mv88e61xx_probe()
913 priv->id = mv88e61xx_get_switch_id(phydev); in mv88e61xx_probe()
918 static int mv88e61xx_phy_config(struct phy_device *phydev) in mv88e61xx_phy_config() argument
924 res = mv88e61xx_switch_init(phydev); in mv88e61xx_phy_config()
930 phydev->addr = i; in mv88e61xx_phy_config()
932 res = mv88e61xx_phy_enable(phydev, i); in mv88e61xx_phy_config()
937 res = mv88e61xx_phy_setup(phydev, i); in mv88e61xx_phy_config()
942 res = mv88e61xx_phy_config_port(phydev, i); in mv88e61xx_phy_config()
948 res = genphy_config_aneg(phydev); in mv88e61xx_phy_config()
953 res = phy_reset(phydev); in mv88e61xx_phy_config()
962 res = mv88e61xx_fixed_port_setup(phydev, i); in mv88e61xx_phy_config()
973 static int mv88e61xx_phy_is_connected(struct phy_device *phydev) in mv88e61xx_phy_is_connected() argument
977 val = mv88e61xx_phy_read(phydev, phydev->addr, PHY_REG_STATUS1); in mv88e61xx_phy_is_connected()
989 static int mv88e61xx_phy_startup(struct phy_device *phydev) in mv88e61xx_phy_startup() argument
994 int speed = phydev->speed; in mv88e61xx_phy_startup()
995 int duplex = phydev->duplex; in mv88e61xx_phy_startup()
999 phydev->addr = i; in mv88e61xx_phy_startup()
1000 if (!mv88e61xx_phy_is_connected(phydev)) in mv88e61xx_phy_startup()
1002 res = genphy_update_link(phydev); in mv88e61xx_phy_startup()
1005 res = mv88e61xx_parse_status(phydev); in mv88e61xx_phy_startup()
1008 link = (link || phydev->link); in mv88e61xx_phy_startup()
1011 phydev->link = link; in mv88e61xx_phy_startup()
1015 phydev->speed = speed; in mv88e61xx_phy_startup()
1016 phydev->duplex = duplex; in mv88e61xx_phy_startup()