Lines Matching refs:fm_eth

35 static void dtsec_configure_serdes(struct fm_eth *priv)  in dtsec_configure_serdes()
103 struct fm_eth *fm_eth = dev->priv; in dtsec_init_phy() local
111 if (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII || in dtsec_init_phy()
112 fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII || in dtsec_init_phy()
113 fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500) in dtsec_init_phy()
114 dtsec_configure_serdes(fm_eth); in dtsec_init_phy()
120 struct fm_eth *fm = dev->priv; in tgec_is_fibre()
217 static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth) in fm_eth_rx_port_parameter_init() argument
227 struct fm_bmi_rx_port *bmi_rx_port = fm_eth->rx_port; in fm_eth_rx_port_parameter_init()
231 pram = (struct fm_port_global_pram *)fm_muram_alloc(fm_eth->fm_index, in fm_eth_rx_port_parameter_init()
238 fm_eth->rx_pram = pram; in fm_eth_rx_port_parameter_init()
241 pram_page_offset = (void *)pram - fm_muram_base(fm_eth->fm_index); in fm_eth_rx_port_parameter_init()
270 fm_eth->rx_bd_ring = rx_bd_ring_base; in fm_eth_rx_port_parameter_init()
271 fm_eth->cur_rxbd = rx_bd_ring_base; in fm_eth_rx_port_parameter_init()
272 fm_eth->rx_buf = rx_buf_pool; in fm_eth_rx_port_parameter_init()
306 static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth) in fm_eth_tx_port_parameter_init() argument
314 struct fm_bmi_tx_port *bmi_tx_port = fm_eth->tx_port; in fm_eth_tx_port_parameter_init()
318 pram = (struct fm_port_global_pram *)fm_muram_alloc(fm_eth->fm_index, in fm_eth_tx_port_parameter_init()
324 fm_eth->tx_pram = pram; in fm_eth_tx_port_parameter_init()
327 pram_page_offset = (void *)pram - fm_muram_base(fm_eth->fm_index); in fm_eth_tx_port_parameter_init()
344 fm_eth->tx_bd_ring = tx_bd_ring_base; in fm_eth_tx_port_parameter_init()
345 fm_eth->cur_txbd = tx_bd_ring_base; in fm_eth_tx_port_parameter_init()
374 static int fm_eth_init(struct fm_eth *fm_eth) in fm_eth_init() argument
378 ret = fm_eth_rx_port_parameter_init(fm_eth); in fm_eth_init()
382 ret = fm_eth_tx_port_parameter_init(fm_eth); in fm_eth_init()
389 static int fm_eth_startup(struct fm_eth *fm_eth) in fm_eth_startup() argument
394 mac = fm_eth->mac; in fm_eth_startup()
397 ret = fm_eth_init(fm_eth); in fm_eth_startup()
404 if (((fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII) || in fm_eth_startup()
405 (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500) || in fm_eth_startup()
406 (fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII)) && in fm_eth_startup()
408 mac->set_if_mode(mac, fm_eth->enet_if, SPEED_100); in fm_eth_startup()
411 bmi_rx_port_init(fm_eth->rx_port); in fm_eth_startup()
413 bmi_tx_port_init(fm_eth->tx_port); in fm_eth_startup()
418 static void fmc_tx_port_graceful_stop_enable(struct fm_eth *fm_eth) in fmc_tx_port_graceful_stop_enable() argument
422 pram = fm_eth->tx_pram; in fmc_tx_port_graceful_stop_enable()
428 static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth) in fmc_tx_port_graceful_stop_disable() argument
432 pram = fm_eth->tx_pram; in fmc_tx_port_graceful_stop_disable()
440 struct fm_eth *fm_eth; in fm_eth_open() local
446 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_open()
447 mac = fm_eth->mac; in fm_eth_open()
457 setbits_be32(&fm_eth->rx_port->fmbm_rcfg, FMBM_RCFG_EN); in fm_eth_open()
461 setbits_be32(&fm_eth->tx_port->fmbm_tcfg, FMBM_TCFG_EN); in fm_eth_open()
463 fmc_tx_port_graceful_stop_disable(fm_eth); in fm_eth_open()
466 if (fm_eth->phydev) { in fm_eth_open()
467 ret = phy_startup(fm_eth->phydev); in fm_eth_open()
470 fm_eth->phydev->dev->name); in fm_eth_open()
477 fm_eth->phydev->speed = SPEED_1000; in fm_eth_open()
478 fm_eth->phydev->link = 1; in fm_eth_open()
479 fm_eth->phydev->duplex = DUPLEX_FULL; in fm_eth_open()
483 mac->set_if_mode(mac, fm_eth->enet_if, fm_eth->phydev->speed); in fm_eth_open()
485 if (!fm_eth->phydev->link) in fm_eth_open()
486 printf("%s: No link.\n", fm_eth->phydev->dev->name); in fm_eth_open()
488 return fm_eth->phydev->link ? 0 : -1; in fm_eth_open()
493 struct fm_eth *fm_eth; in fm_eth_halt() local
496 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_halt()
497 mac = fm_eth->mac; in fm_eth_halt()
500 fmc_tx_port_graceful_stop_enable(fm_eth); in fm_eth_halt()
502 bmi_tx_port_disable(fm_eth->tx_port); in fm_eth_halt()
506 bmi_rx_port_disable(fm_eth->rx_port); in fm_eth_halt()
509 if (fm_eth->phydev) in fm_eth_halt()
510 phy_shutdown(fm_eth->phydev); in fm_eth_halt()
516 struct fm_eth *fm_eth; in fm_eth_send() local
522 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_send()
523 pram = fm_eth->tx_pram; in fm_eth_send()
524 txbd = fm_eth->cur_txbd; in fm_eth_send()
563 txbd_base = (struct fm_port_bd *)fm_eth->tx_bd_ring; in fm_eth_send()
567 fm_eth->cur_txbd = (void *)txbd; in fm_eth_send()
574 struct fm_eth *fm_eth; in fm_eth_recv() local
583 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_recv()
584 pram = fm_eth->rx_pram; in fm_eth_recv()
585 rxbd = fm_eth->cur_rxbd; in fm_eth_recv()
607 rxbd_base = (struct fm_port_bd *)fm_eth->rx_bd_ring; in fm_eth_recv()
621 fm_eth->cur_rxbd = (void *)rxbd; in fm_eth_recv()
626 static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg) in fm_eth_init_mac() argument
632 num = fm_eth->num; in fm_eth_init_mac()
636 if (fm_eth->type == FM_ETH_10G_E) { in fm_eth_init_mac()
642 if (fm_eth->num >= 2) in fm_eth_init_mac()
652 if (fm_eth->type == FM_ETH_1G_E) { in fm_eth_init_mac()
668 fm_eth->mac = mac; in fm_eth_init_mac()
673 if (fm_eth->type == FM_ETH_1G_E) in fm_eth_init_mac()
684 struct fm_eth *fm_eth = dev->priv; in init_phy() local
690 if (fm_eth->type == FM_ETH_1G_E) in init_phy()
694 if (fm_eth->bus) { in init_phy()
695 phydev = phy_connect(fm_eth->bus, fm_eth->phyaddr, dev, in init_phy()
696 fm_eth->enet_if); in init_phy()
705 if (fm_eth->type == FM_ETH_1G_E) { in init_phy()
721 fm_eth->phydev = phydev; in init_phy()
732 struct fm_eth *fm_eth; in fm_eth_initialize() local
743 fm_eth = (struct fm_eth *)malloc(sizeof(struct fm_eth)); in fm_eth_initialize()
744 if (!fm_eth) in fm_eth_initialize()
746 memset(fm_eth, 0, sizeof(struct fm_eth)); in fm_eth_initialize()
749 fm_eth->fm_index = info->index - 1; /* keep as 0 based for muram */ in fm_eth_initialize()
750 fm_eth->num = num; in fm_eth_initialize()
751 fm_eth->type = info->type; in fm_eth_initialize()
753 fm_eth->rx_port = (void *)&reg->port[info->rx_port_id - 1].fm_bmi; in fm_eth_initialize()
754 fm_eth->tx_port = (void *)&reg->port[info->tx_port_id - 1].fm_bmi; in fm_eth_initialize()
757 fm_eth->max_rx_len = MAX_RXBUF_LEN; in fm_eth_initialize()
760 ret = fm_eth_init_mac(fm_eth, reg); in fm_eth_initialize()
765 if (fm_eth->type == FM_ETH_1G_E) in fm_eth_initialize()
772 dev->priv = (void *)fm_eth; in fm_eth_initialize()
777 fm_eth->dev = dev; in fm_eth_initialize()
778 fm_eth->bus = info->bus; in fm_eth_initialize()
779 fm_eth->phyaddr = info->phy_addr; in fm_eth_initialize()
780 fm_eth->enet_if = info->enet_if; in fm_eth_initialize()
783 ret = fm_eth_startup(fm_eth); in fm_eth_initialize()