Lines Matching refs:slave

196 #define for_active_slave(slave, priv) \  argument
197 slave = (priv)->slaves + ((priv)->data)->active_slave; if (slave)
198 #define for_each_slave(slave, priv) \ argument
199 for (slave = (priv)->slaves; slave != (priv)->slaves + \
200 ((priv)->data)->slaves; slave++)
455 static void cpsw_set_slave_mac(struct cpsw_slave *slave, in cpsw_set_slave_mac() argument
461 writel(mac_hi(pdata->enetaddr), &slave->regs->sa_hi); in cpsw_set_slave_mac()
462 writel(mac_lo(pdata->enetaddr), &slave->regs->sa_lo); in cpsw_set_slave_mac()
464 __raw_writel(mac_hi(priv->dev->enetaddr), &slave->regs->sa_hi); in cpsw_set_slave_mac()
465 __raw_writel(mac_lo(priv->dev->enetaddr), &slave->regs->sa_lo); in cpsw_set_slave_mac()
469 static int cpsw_slave_update_link(struct cpsw_slave *slave, in cpsw_slave_update_link() argument
499 if (mac_control == slave->mac_control) in cpsw_slave_update_link()
504 slave->slave_num, phy->speed, in cpsw_slave_update_link()
507 printf("link down on port %d\n", slave->slave_num); in cpsw_slave_update_link()
510 __raw_writel(mac_control, &slave->sliver->mac_control); in cpsw_slave_update_link()
511 slave->mac_control = mac_control; in cpsw_slave_update_link()
520 struct cpsw_slave *slave; in cpsw_update_link() local
522 for_active_slave(slave, priv) in cpsw_update_link()
523 ret = cpsw_slave_update_link(slave, priv, NULL); in cpsw_update_link()
536 static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv) in cpsw_slave_init() argument
540 setbit_and_wait_for_clear32(&slave->sliver->soft_reset); in cpsw_slave_init()
543 __raw_writel(0x76543210, &slave->sliver->rx_pri_map); in cpsw_slave_init()
544 __raw_writel(0x33221100, &slave->regs->tx_pri_map); in cpsw_slave_init()
547 __raw_writel(PKT_MAX, &slave->sliver->rx_maxlen); in cpsw_slave_init()
548 cpsw_set_slave_mac(slave, priv); in cpsw_slave_init()
550 slave->mac_control = 0; /* no link yet */ in cpsw_slave_init()
553 slave_port = cpsw_get_slave_port(priv, slave->slave_num); in cpsw_slave_init()
558 priv->phy_mask |= 1 << slave->data->phy_addr; in cpsw_slave_init()
658 struct cpsw_slave *slave; in _cpsw_init() local
685 for_active_slave(slave, priv) in _cpsw_init()
686 cpsw_slave_init(slave, priv); in _cpsw_init()
829 static void cpsw_slave_setup(struct cpsw_slave *slave, int slave_num, in cpsw_slave_setup() argument
834 slave->slave_num = slave_num; in cpsw_slave_setup()
835 slave->data = data; in cpsw_slave_setup()
836 slave->regs = regs + data->slave_reg_ofs; in cpsw_slave_setup()
837 slave->sliver = regs + data->sliver_reg_ofs; in cpsw_slave_setup()
840 static int cpsw_phy_init(struct cpsw_priv *priv, struct cpsw_slave *slave) in cpsw_phy_init() argument
847 slave->data->phy_addr, in cpsw_phy_init()
849 slave->data->phy_if); in cpsw_phy_init()
855 if (slave->data->max_speed) { in cpsw_phy_init()
856 ret = phy_set_supported(phydev, slave->data->max_speed); in cpsw_phy_init()
861 slave->slave_num + 1, slave->data->max_speed); in cpsw_phy_init()
864 priv->dev->name, slave->slave_num + 1, in cpsw_phy_init()
865 slave->data->max_speed); in cpsw_phy_init()
871 if (ofnode_valid(slave->data->phy_of_handle)) in cpsw_phy_init()
872 phydev->node = slave->data->phy_of_handle; in cpsw_phy_init()
902 struct cpsw_slave *slave; in _cpsw_register() local
920 for_each_slave(slave, priv) { in _cpsw_register()
921 cpsw_slave_setup(slave, idx, priv); in _cpsw_register()
931 for_active_slave(slave, priv) in _cpsw_register()
932 cpsw_phy_init(priv, slave); in _cpsw_register()
1067 int slave = priv->data->active_slave; in cpsw_gmii_sel_am3352() local
1092 mask = GMII_SEL_MODE_MASK << (slave * 2) | BIT(slave + 6); in cpsw_gmii_sel_am3352()
1093 mode <<= slave * 2; in cpsw_gmii_sel_am3352()
1096 if (slave == 0) in cpsw_gmii_sel_am3352()
1103 if (slave == 0) in cpsw_gmii_sel_am3352()
1121 int slave = priv->data->active_slave; in cpsw_gmii_sel_dra7xx() local
1143 switch (slave) { in cpsw_gmii_sel_dra7xx()
1367 int cpsw_get_slave_phy_addr(struct udevice *dev, int slave) in cpsw_get_slave_phy_addr() argument
1372 return data->slave_data[slave].phy_addr; in cpsw_get_slave_phy_addr()