Lines Matching full:mac

11 #define HBG_MAC_GET_PRIV(mac) ((struct hbg_priv *)(mac)->mdio_bus->priv)  argument
12 #define HBG_MII_BUS_GET_MAC(bus) (&((struct hbg_priv *)(bus)->priv)->mac)
23 static void hbg_mdio_set_command(struct hbg_mac *mac, u32 cmd) in hbg_mdio_set_command() argument
25 hbg_reg_write(HBG_MAC_GET_PRIV(mac), HBG_REG_MDIO_COMMAND_ADDR, cmd); in hbg_mdio_set_command()
28 static void hbg_mdio_get_command(struct hbg_mac *mac, u32 *cmd) in hbg_mdio_get_command() argument
30 *cmd = hbg_reg_read(HBG_MAC_GET_PRIV(mac), HBG_REG_MDIO_COMMAND_ADDR); in hbg_mdio_get_command()
33 static void hbg_mdio_set_wdata_reg(struct hbg_mac *mac, u16 wdata_value) in hbg_mdio_set_wdata_reg() argument
35 hbg_reg_write_field(HBG_MAC_GET_PRIV(mac), HBG_REG_MDIO_WDATA_ADDR, in hbg_mdio_set_wdata_reg()
39 static u32 hbg_mdio_get_rdata_reg(struct hbg_mac *mac) in hbg_mdio_get_rdata_reg() argument
41 return hbg_reg_read_field(HBG_MAC_GET_PRIV(mac), in hbg_mdio_get_rdata_reg()
46 static int hbg_mdio_wait_ready(struct hbg_mac *mac) in hbg_mdio_wait_ready() argument
48 struct hbg_priv *priv = HBG_MAC_GET_PRIV(mac); in hbg_mdio_wait_ready()
60 static int hbg_mdio_cmd_send(struct hbg_mac *mac, u32 prt_addr, u32 dev_addr, in hbg_mdio_cmd_send() argument
65 hbg_mdio_get_command(mac, &cmd); in hbg_mdio_cmd_send()
74 hbg_mdio_set_command(mac, cmd); in hbg_mdio_cmd_send()
77 return hbg_mdio_wait_ready(mac); in hbg_mdio_cmd_send()
82 struct hbg_mac *mac = HBG_MII_BUS_GET_MAC(bus); in hbg_mdio_read22() local
85 ret = hbg_mdio_cmd_send(mac, phy_addr, regnum, HBG_MDIO_C22_MODE, in hbg_mdio_read22()
90 return hbg_mdio_get_rdata_reg(mac); in hbg_mdio_read22()
96 struct hbg_mac *mac = HBG_MII_BUS_GET_MAC(bus); in hbg_mdio_write22() local
98 hbg_mdio_set_wdata_reg(mac, val); in hbg_mdio_write22()
99 return hbg_mdio_cmd_send(mac, phy_addr, regnum, HBG_MDIO_C22_MODE, in hbg_mdio_write22()
106 struct hbg_mac *mac = &priv->mac; in hbg_mdio_init_hw() local
117 hbg_mdio_set_command(mac, cmd); in hbg_mdio_init_hw()
122 struct phy_device *phydev = priv->mac.phydev; in hbg_flowctrl_cfg()
126 if (!priv->mac.pause_autoneg) in hbg_flowctrl_cfg()
140 dev_err(dev, "failed to fix the MAC link status\n"); in hbg_fix_np_link_fail()
145 if (!priv->mac.phydev->link) in hbg_fix_np_link_fail()
149 dev_err(dev, "failed to link between MAC and PHY, try to fix...\n"); in hbg_fix_np_link_fail()
167 if (phydev->link != priv->mac.link_status) { in hbg_phy_adjust_link()
183 priv->mac.speed = speed; in hbg_phy_adjust_link()
184 priv->mac.duplex = phydev->duplex; in hbg_phy_adjust_link()
185 priv->mac.autoneg = phydev->autoneg; in hbg_phy_adjust_link()
190 priv->mac.link_status = phydev->link; in hbg_phy_adjust_link()
202 struct phy_device *phydev = priv->mac.phydev; in hbg_phy_connect()
224 phy_start(priv->mac.phydev); in hbg_phy_start()
229 phy_stop(priv->mac.phydev); in hbg_phy_stop()
235 struct hbg_mac *mac = &priv->mac; in hbg_mdio_init() local
240 mac->phy_addr = priv->dev_specs.phy_addr; in hbg_mdio_init()
248 mdio_bus->phy_mask = ~(1 << mac->phy_addr); in hbg_mdio_init()
250 mac->mdio_bus = mdio_bus; in hbg_mdio_init()
260 phydev = mdiobus_get_phy(mdio_bus, mac->phy_addr); in hbg_mdio_init()
265 mac->phydev = phydev; in hbg_mdio_init()