Lines Matching refs:fm_eth
36 static void dtsec_configure_serdes(struct fm_eth *priv) in dtsec_configure_serdes()
104 struct fm_eth *fm_eth = dev->priv; in dtsec_init_phy() local
112 if (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII || in dtsec_init_phy()
113 fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII || in dtsec_init_phy()
114 fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500) in dtsec_init_phy()
115 dtsec_configure_serdes(fm_eth); in dtsec_init_phy()
121 struct fm_eth *fm = dev->priv; in tgec_is_fibre()
218 static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth) in fm_eth_rx_port_parameter_init() argument
228 struct fm_bmi_rx_port *bmi_rx_port = fm_eth->rx_port; in fm_eth_rx_port_parameter_init()
232 pram = (struct fm_port_global_pram *)fm_muram_alloc(fm_eth->fm_index, in fm_eth_rx_port_parameter_init()
239 fm_eth->rx_pram = pram; in fm_eth_rx_port_parameter_init()
242 pram_page_offset = (void *)pram - fm_muram_base(fm_eth->fm_index); in fm_eth_rx_port_parameter_init()
271 fm_eth->rx_bd_ring = rx_bd_ring_base; in fm_eth_rx_port_parameter_init()
272 fm_eth->cur_rxbd = rx_bd_ring_base; in fm_eth_rx_port_parameter_init()
273 fm_eth->rx_buf = rx_buf_pool; in fm_eth_rx_port_parameter_init()
307 static int fm_eth_tx_port_parameter_init(struct fm_eth *fm_eth) in fm_eth_tx_port_parameter_init() argument
315 struct fm_bmi_tx_port *bmi_tx_port = fm_eth->tx_port; in fm_eth_tx_port_parameter_init()
319 pram = (struct fm_port_global_pram *)fm_muram_alloc(fm_eth->fm_index, in fm_eth_tx_port_parameter_init()
325 fm_eth->tx_pram = pram; in fm_eth_tx_port_parameter_init()
328 pram_page_offset = (void *)pram - fm_muram_base(fm_eth->fm_index); in fm_eth_tx_port_parameter_init()
345 fm_eth->tx_bd_ring = tx_bd_ring_base; in fm_eth_tx_port_parameter_init()
346 fm_eth->cur_txbd = tx_bd_ring_base; in fm_eth_tx_port_parameter_init()
375 static int fm_eth_init(struct fm_eth *fm_eth) in fm_eth_init() argument
379 ret = fm_eth_rx_port_parameter_init(fm_eth); in fm_eth_init()
383 ret = fm_eth_tx_port_parameter_init(fm_eth); in fm_eth_init()
390 static int fm_eth_startup(struct fm_eth *fm_eth) in fm_eth_startup() argument
395 mac = fm_eth->mac; in fm_eth_startup()
398 ret = fm_eth_init(fm_eth); in fm_eth_startup()
405 if (((fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII) || in fm_eth_startup()
406 (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII_2500) || in fm_eth_startup()
407 (fm_eth->enet_if == PHY_INTERFACE_MODE_QSGMII)) && in fm_eth_startup()
409 mac->set_if_mode(mac, fm_eth->enet_if, SPEED_100); in fm_eth_startup()
412 bmi_rx_port_init(fm_eth->rx_port); in fm_eth_startup()
414 bmi_tx_port_init(fm_eth->tx_port); in fm_eth_startup()
419 static void fmc_tx_port_graceful_stop_enable(struct fm_eth *fm_eth) in fmc_tx_port_graceful_stop_enable() argument
423 pram = fm_eth->tx_pram; in fmc_tx_port_graceful_stop_enable()
429 static void fmc_tx_port_graceful_stop_disable(struct fm_eth *fm_eth) in fmc_tx_port_graceful_stop_disable() argument
433 pram = fm_eth->tx_pram; in fmc_tx_port_graceful_stop_disable()
441 struct fm_eth *fm_eth; in fm_eth_open() local
447 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_open()
448 mac = fm_eth->mac; in fm_eth_open()
458 setbits_be32(&fm_eth->rx_port->fmbm_rcfg, FMBM_RCFG_EN); in fm_eth_open()
462 setbits_be32(&fm_eth->tx_port->fmbm_tcfg, FMBM_TCFG_EN); in fm_eth_open()
464 fmc_tx_port_graceful_stop_disable(fm_eth); in fm_eth_open()
467 if (fm_eth->phydev) { in fm_eth_open()
468 ret = phy_startup(fm_eth->phydev); in fm_eth_open()
471 fm_eth->phydev->dev->name); in fm_eth_open()
478 fm_eth->phydev->speed = SPEED_1000; in fm_eth_open()
479 fm_eth->phydev->link = 1; in fm_eth_open()
480 fm_eth->phydev->duplex = DUPLEX_FULL; in fm_eth_open()
484 mac->set_if_mode(mac, fm_eth->enet_if, fm_eth->phydev->speed); in fm_eth_open()
486 if (!fm_eth->phydev->link) in fm_eth_open()
487 printf("%s: No link.\n", fm_eth->phydev->dev->name); in fm_eth_open()
489 return fm_eth->phydev->link ? 0 : -1; in fm_eth_open()
494 struct fm_eth *fm_eth; in fm_eth_halt() local
497 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_halt()
498 mac = fm_eth->mac; in fm_eth_halt()
501 fmc_tx_port_graceful_stop_enable(fm_eth); in fm_eth_halt()
503 bmi_tx_port_disable(fm_eth->tx_port); in fm_eth_halt()
507 bmi_rx_port_disable(fm_eth->rx_port); in fm_eth_halt()
510 if (fm_eth->phydev) in fm_eth_halt()
511 phy_shutdown(fm_eth->phydev); in fm_eth_halt()
517 struct fm_eth *fm_eth; in fm_eth_send() local
523 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_send()
524 pram = fm_eth->tx_pram; in fm_eth_send()
525 txbd = fm_eth->cur_txbd; in fm_eth_send()
564 txbd_base = (struct fm_port_bd *)fm_eth->tx_bd_ring; in fm_eth_send()
568 fm_eth->cur_txbd = (void *)txbd; in fm_eth_send()
575 struct fm_eth *fm_eth; in fm_eth_recv() local
584 fm_eth = (struct fm_eth *)dev->priv; in fm_eth_recv()
585 pram = fm_eth->rx_pram; in fm_eth_recv()
586 rxbd = fm_eth->cur_rxbd; in fm_eth_recv()
608 rxbd_base = (struct fm_port_bd *)fm_eth->rx_bd_ring; in fm_eth_recv()
622 fm_eth->cur_rxbd = (void *)rxbd; in fm_eth_recv()
627 static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg) in fm_eth_init_mac() argument
633 num = fm_eth->num; in fm_eth_init_mac()
637 if (fm_eth->type == FM_ETH_10G_E) { in fm_eth_init_mac()
643 if (fm_eth->num >= 2) in fm_eth_init_mac()
653 if (fm_eth->type == FM_ETH_1G_E) { in fm_eth_init_mac()
669 fm_eth->mac = mac; in fm_eth_init_mac()
674 if (fm_eth->type == FM_ETH_1G_E) in fm_eth_init_mac()
685 struct fm_eth *fm_eth = dev->priv; in init_phy() local
691 if (fm_eth->type == FM_ETH_1G_E) in init_phy()
695 if (fm_eth->bus) { in init_phy()
696 phydev = phy_connect(fm_eth->bus, fm_eth->phyaddr, dev, in init_phy()
697 fm_eth->enet_if); in init_phy()
706 if (fm_eth->type == FM_ETH_1G_E) { in init_phy()
722 fm_eth->phydev = phydev; in init_phy()
733 struct fm_eth *fm_eth; in fm_eth_initialize() local
744 fm_eth = (struct fm_eth *)malloc(sizeof(struct fm_eth)); in fm_eth_initialize()
745 if (!fm_eth) in fm_eth_initialize()
747 memset(fm_eth, 0, sizeof(struct fm_eth)); in fm_eth_initialize()
750 fm_eth->fm_index = info->index - 1; /* keep as 0 based for muram */ in fm_eth_initialize()
751 fm_eth->num = num; in fm_eth_initialize()
752 fm_eth->type = info->type; in fm_eth_initialize()
754 fm_eth->rx_port = (void *)®->port[info->rx_port_id - 1].fm_bmi; in fm_eth_initialize()
755 fm_eth->tx_port = (void *)®->port[info->tx_port_id - 1].fm_bmi; in fm_eth_initialize()
758 fm_eth->max_rx_len = MAX_RXBUF_LEN; in fm_eth_initialize()
761 ret = fm_eth_init_mac(fm_eth, reg); in fm_eth_initialize()
766 if (fm_eth->type == FM_ETH_1G_E) in fm_eth_initialize()
773 dev->priv = (void *)fm_eth; in fm_eth_initialize()
778 fm_eth->dev = dev; in fm_eth_initialize()
779 fm_eth->bus = info->bus; in fm_eth_initialize()
780 fm_eth->phyaddr = info->phy_addr; in fm_eth_initialize()
781 fm_eth->enet_if = info->enet_if; in fm_eth_initialize()
784 ret = fm_eth_startup(fm_eth); in fm_eth_initialize()