Lines Matching refs:emac

110 static void icssg_config_mii_init_fw_offload(struct prueth_emac *emac)  in icssg_config_mii_init_fw_offload()  argument
112 struct prueth *prueth = emac->prueth; in icssg_config_mii_init_fw_offload()
113 int mii = prueth_emac_slice(emac); in icssg_config_mii_init_fw_offload()
128 if (emac->phy_if == PHY_INTERFACE_MODE_MII && mii == ICSS_MII1) in icssg_config_mii_init_fw_offload()
130 else if (emac->phy_if != PHY_INTERFACE_MODE_MII && mii == ICSS_MII0) in icssg_config_mii_init_fw_offload()
137 static void icssg_config_mii_init(struct prueth_emac *emac) in icssg_config_mii_init() argument
139 struct prueth *prueth = emac->prueth; in icssg_config_mii_init()
140 int slice = prueth_emac_slice(emac); in icssg_config_mii_init()
156 if (emac->phy_if == PHY_INTERFACE_MODE_MII && slice == ICSS_MII0) in icssg_config_mii_init()
158 else if (emac->phy_if != PHY_INTERFACE_MODE_MII && slice == ICSS_MII1) in icssg_config_mii_init()
223 void icssg_config_ipg(struct prueth_emac *emac) in icssg_config_ipg() argument
225 struct prueth *prueth = emac->prueth; in icssg_config_ipg()
226 int slice = prueth_emac_slice(emac); in icssg_config_ipg()
229 switch (emac->speed) { in icssg_config_ipg()
231 ipg = emac->is_sr1 ? MII_RT_TX_IPG_1G_SR1 : MII_RT_TX_IPG_1G; in icssg_config_ipg()
234 ipg = emac->is_sr1 ? MII_RT_TX_IPG_100M_SR1 : MII_RT_TX_IPG_100M; in icssg_config_ipg()
238 if (emac->is_sr1) in icssg_config_ipg()
245 netdev_err(emac->ndev, "Unsupported link speed\n"); in icssg_config_ipg()
253 static void emac_r30_cmd_init(struct prueth_emac *emac) in emac_r30_cmd_init() argument
258 p = emac->dram.va + MGR_R30_CMD_OFFSET; in emac_r30_cmd_init()
264 static int emac_r30_is_done(struct prueth_emac *emac) in emac_r30_is_done() argument
270 p = emac->dram.va + MGR_R30_CMD_OFFSET; in emac_r30_is_done()
281 static int prueth_fw_offload_buffer_setup(struct prueth_emac *emac) in prueth_fw_offload_buffer_setup() argument
285 struct prueth *prueth = emac->prueth; in prueth_fw_offload_buffer_setup()
286 int slice = prueth_emac_slice(emac); in prueth_fw_offload_buffer_setup()
299 bpool_cfg = emac->dram.va + BUFFER_POOL_0_ADDR_OFFSET; in prueth_fw_offload_buffer_setup()
331 rxq_ctx = emac->dram.va + HOST_RX_Q_PRE_CONTEXT_OFFSET; in prueth_fw_offload_buffer_setup()
341 static int prueth_emac_buffer_setup(struct prueth_emac *emac) in prueth_emac_buffer_setup() argument
345 struct prueth *prueth = emac->prueth; in prueth_emac_buffer_setup()
346 int slice = prueth_emac_slice(emac); in prueth_emac_buffer_setup()
363 bpool_cfg = emac->dram.va + BUFFER_POOL_0_ADDR_OFFSET; in prueth_emac_buffer_setup()
382 rxq_ctx = emac->dram.va + HOST_RX_Q_PRE_CONTEXT_OFFSET; in prueth_emac_buffer_setup()
390 rxq_ctx = emac->dram.va + HOST_RX_Q_EXP_CONTEXT_OFFSET; in prueth_emac_buffer_setup()
452 int icssg_config(struct prueth *prueth, struct prueth_emac *emac, int slice) in icssg_config() argument
454 void __iomem *config = emac->dram.va + ICSSG_CONFIG_OFFSET; in icssg_config()
466 emac->speed = SPEED_1000; in icssg_config()
467 emac->duplex = DUPLEX_FULL; in icssg_config()
468 if (!phy_interface_mode_is_rgmii(emac->phy_if)) { in icssg_config()
469 emac->speed = SPEED_100; in icssg_config()
470 emac->duplex = DUPLEX_FULL; in icssg_config()
474 icssg_miig_set_interface_mode(prueth->miig_rt, slice, emac->phy_if); in icssg_config()
476 icssg_config_mii_init_fw_offload(emac); in icssg_config()
478 icssg_config_mii_init(emac); in icssg_config()
479 icssg_config_ipg(emac); in icssg_config()
480 icssg_update_rgmii_cfg(prueth->miig_rt, emac); in icssg_config()
496 writew(emac->rx_flow_id_base, &flow_cfg->rx_base_flow); in icssg_config()
502 ret = prueth_fw_offload_buffer_setup(emac); in icssg_config()
504 ret = prueth_emac_buffer_setup(emac); in icssg_config()
508 emac_r30_cmd_init(emac); in icssg_config()
539 int icssg_set_port_state(struct prueth_emac *emac, in icssg_set_port_state() argument
547 p = emac->dram.va + MGR_R30_CMD_OFFSET; in icssg_set_port_state()
550 netdev_err(emac->ndev, "invalid port command\n"); in icssg_set_port_state()
555 mutex_lock(&emac->cmd_lock); in icssg_set_port_state()
562 1000, 10000, false, emac); in icssg_set_port_state()
565 netdev_err(emac->ndev, "timeout waiting for command done\n"); in icssg_set_port_state()
567 mutex_unlock(&emac->cmd_lock); in icssg_set_port_state()
573 void icssg_config_half_duplex(struct prueth_emac *emac) in icssg_config_half_duplex() argument
577 if (!emac->half_duplex) in icssg_config_half_duplex()
581 writel(val, emac->dram.va + HD_RAND_SEED_OFFSET); in icssg_config_half_duplex()
585 void icssg_config_set_speed(struct prueth_emac *emac) in icssg_config_set_speed() argument
589 switch (emac->speed) { in icssg_config_set_speed()
601 netdev_err(emac->ndev, "Unsupported link speed\n"); in icssg_config_set_speed()
605 if (emac->duplex == DUPLEX_HALF) in icssg_config_set_speed()
608 writeb(fw_speed, emac->dram.va + PORT_LINK_SPEED_OFFSET); in icssg_config_set_speed()
612 int icssg_send_fdb_msg(struct prueth_emac *emac, struct mgmt_cmd *cmd, in icssg_send_fdb_msg() argument
615 struct prueth *prueth = emac->prueth; in icssg_send_fdb_msg()
616 int slice = prueth_emac_slice(emac); in icssg_send_fdb_msg()
634 netdev_err(emac->ndev, "Timedout sending HWQ message\n"); in icssg_send_fdb_msg()
647 static void icssg_fdb_setup(struct prueth_emac *emac, struct mgmt_cmd *fdb_cmd, in icssg_fdb_setup() argument
650 int slice = prueth_emac_slice(emac); in icssg_fdb_setup()
664 fdb_cmd->seqnum = ++(emac->prueth->icssg_hwcmdseq); in icssg_fdb_setup()
672 netdev_dbg(emac->ndev, "MAC %pM slot %X FID %X\n", addr, fdb_slot, fid); in icssg_fdb_setup()
675 int icssg_fdb_add_del(struct prueth_emac *emac, const unsigned char *addr, in icssg_fdb_add_del() argument
683 icssg_fdb_setup(emac, &fdb_cmd, addr, fid, add ? ICSS_CMD_ADD_FDB : ICSS_CMD_DEL_FDB); in icssg_fdb_add_del()
688 ret = icssg_send_fdb_msg(emac, &fdb_cmd, &fdb_cmd_rsp); in icssg_fdb_add_del()
700 int icssg_fdb_lookup(struct prueth_emac *emac, const unsigned char *addr, in icssg_fdb_lookup() argument
709 icssg_fdb_setup(emac, &fdb_cmd, addr, fid, ICSS_CMD_GET_FDB_SLOT); in icssg_fdb_lookup()
713 ret = icssg_send_fdb_msg(emac, &fdb_cmd, &fdb_cmd_rsp); in icssg_fdb_lookup()
719 slot = (struct prueth_fdb_slot __force *)(emac->dram.va + FDB_CMD_BUFFER); in icssg_fdb_lookup()
730 void icssg_vtbl_modify(struct prueth_emac *emac, u8 vid, u8 port_mask, in icssg_vtbl_modify() argument
733 struct prueth *prueth = emac->prueth; in icssg_vtbl_modify()
758 u16 icssg_get_pvid(struct prueth_emac *emac) in icssg_get_pvid() argument
760 struct prueth *prueth = emac->prueth; in icssg_get_pvid()
763 if (emac->port_id == PRUETH_PORT_MII0) in icssg_get_pvid()