Lines Matching refs:comm
28 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_open() local
33 comm->enable |= mac->lan_port; in spl2sw_ethernet_open()
35 spl2sw_mac_hw_start(comm); in spl2sw_ethernet_open()
38 mask = readl(comm->l2sw_reg_base + L2SW_SW_INT_MASK_0); in spl2sw_ethernet_open()
40 writel(mask, comm->l2sw_reg_base + L2SW_SW_INT_MASK_0); in spl2sw_ethernet_open()
52 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_stop() local
56 comm->enable &= ~mac->lan_port; in spl2sw_ethernet_stop()
60 spl2sw_mac_hw_stop(comm); in spl2sw_ethernet_stop()
69 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_start_xmit() local
78 if (unlikely(comm->tx_desc_full == 1)) { in spl2sw_ethernet_start_xmit()
92 mapping = dma_map_single(&comm->pdev->dev, skb->data, in spl2sw_ethernet_start_xmit()
94 if (dma_mapping_error(&comm->pdev->dev, mapping)) { in spl2sw_ethernet_start_xmit()
100 spin_lock_irqsave(&comm->tx_lock, flags); in spl2sw_ethernet_start_xmit()
102 tx_pos = comm->tx_pos; in spl2sw_ethernet_start_xmit()
103 txdesc = &comm->tx_desc[tx_pos]; in spl2sw_ethernet_start_xmit()
104 skbinfo = &comm->tx_temp_skb_info[tx_pos]; in spl2sw_ethernet_start_xmit()
125 if (unlikely(tx_pos == comm->tx_done_pos)) { in spl2sw_ethernet_start_xmit()
127 comm->tx_desc_full = 1; in spl2sw_ethernet_start_xmit()
129 comm->tx_pos = tx_pos; in spl2sw_ethernet_start_xmit()
133 writel(MAC_TRIG_L_SOC0, comm->l2sw_reg_base + L2SW_CPU_TX_TRIG); in spl2sw_ethernet_start_xmit()
135 spin_unlock_irqrestore(&comm->tx_lock, flags); in spl2sw_ethernet_start_xmit()
171 struct spl2sw_common *comm = mac->comm; in spl2sw_ethernet_tx_timeout() local
178 spin_lock_irqsave(&comm->tx_lock, flags); in spl2sw_ethernet_tx_timeout()
181 if (comm->ndev[i]) in spl2sw_ethernet_tx_timeout()
182 netif_stop_queue(comm->ndev[i]); in spl2sw_ethernet_tx_timeout()
184 spl2sw_mac_soft_reset(comm); in spl2sw_ethernet_tx_timeout()
188 if (comm->ndev[i]) { in spl2sw_ethernet_tx_timeout()
189 netif_trans_update(comm->ndev[i]); in spl2sw_ethernet_tx_timeout()
190 netif_wake_queue(comm->ndev[i]); in spl2sw_ethernet_tx_timeout()
193 spin_unlock_irqrestore(&comm->tx_lock, flags); in spl2sw_ethernet_tx_timeout()
324 struct spl2sw_common *comm; in spl2sw_probe() local
336 comm = devm_kzalloc(&pdev->dev, sizeof(*comm), GFP_KERNEL); in spl2sw_probe()
337 if (!comm) in spl2sw_probe()
340 comm->pdev = pdev; in spl2sw_probe()
341 platform_set_drvdata(pdev, comm); in spl2sw_probe()
343 spin_lock_init(&comm->tx_lock); in spl2sw_probe()
344 spin_lock_init(&comm->mdio_lock); in spl2sw_probe()
345 spin_lock_init(&comm->int_mask_lock); in spl2sw_probe()
348 comm->l2sw_reg_base = devm_platform_ioremap_resource(pdev, 0); in spl2sw_probe()
349 if (IS_ERR(comm->l2sw_reg_base)) in spl2sw_probe()
350 return PTR_ERR(comm->l2sw_reg_base); in spl2sw_probe()
359 comm->clk = devm_clk_get(&pdev->dev, NULL); in spl2sw_probe()
360 if (IS_ERR(comm->clk)) { in spl2sw_probe()
361 dev_err_probe(&pdev->dev, PTR_ERR(comm->clk), in spl2sw_probe()
363 return PTR_ERR(comm->clk); in spl2sw_probe()
367 comm->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); in spl2sw_probe()
368 if (IS_ERR(comm->rstc)) { in spl2sw_probe()
369 dev_err_probe(&pdev->dev, PTR_ERR(comm->rstc), in spl2sw_probe()
371 return PTR_ERR(comm->rstc); in spl2sw_probe()
375 ret = clk_prepare_enable(comm->clk); in spl2sw_probe()
381 reset_control_assert(comm->rstc); in spl2sw_probe()
383 reset_control_deassert(comm->rstc); in spl2sw_probe()
388 dev_name(&pdev->dev), comm); in spl2sw_probe()
395 ret = spl2sw_descs_init(comm); in spl2sw_probe()
398 spl2sw_descs_free(comm); in spl2sw_probe()
403 spl2sw_mac_init(comm); in spl2sw_probe()
406 ret = spl2sw_mdio_init(comm); in spl2sw_probe()
456 comm->ndev[i] = ndev; in spl2sw_probe()
460 mac->comm = comm; in spl2sw_probe()
476 if (comm->ndev[i]) in spl2sw_probe()
486 ndev = comm->ndev[i]; in spl2sw_probe()
488 ret = spl2sw_phy_connect(comm); in spl2sw_probe()
495 netif_napi_add(ndev, &comm->rx_napi, spl2sw_rx_poll); in spl2sw_probe()
496 napi_enable(&comm->rx_napi); in spl2sw_probe()
497 netif_napi_add_tx(ndev, &comm->tx_napi, spl2sw_tx_poll); in spl2sw_probe()
498 napi_enable(&comm->tx_napi); in spl2sw_probe()
503 if (comm->ndev[i]) in spl2sw_probe()
504 unregister_netdev(comm->ndev[i]); in spl2sw_probe()
507 spl2sw_mdio_remove(comm); in spl2sw_probe()
510 clk_disable_unprepare(comm->clk); in spl2sw_probe()
516 struct spl2sw_common *comm; in spl2sw_remove() local
519 comm = platform_get_drvdata(pdev); in spl2sw_remove()
521 spl2sw_phy_remove(comm); in spl2sw_remove()
525 if (comm->ndev[i]) in spl2sw_remove()
526 unregister_netdev(comm->ndev[i]); in spl2sw_remove()
528 comm->enable = 0; in spl2sw_remove()
529 spl2sw_mac_hw_stop(comm); in spl2sw_remove()
530 spl2sw_descs_free(comm); in spl2sw_remove()
533 napi_disable(&comm->rx_napi); in spl2sw_remove()
534 netif_napi_del(&comm->rx_napi); in spl2sw_remove()
535 napi_disable(&comm->tx_napi); in spl2sw_remove()
536 netif_napi_del(&comm->tx_napi); in spl2sw_remove()
538 spl2sw_mdio_remove(comm); in spl2sw_remove()
540 clk_disable_unprepare(comm->clk); in spl2sw_remove()