Lines Matching refs:plat

132 			    struct plat_stmmacenet_data *plat)  in stmmac_mtl_setup()  argument
144 plat->rx_queues_to_use = 1; in stmmac_mtl_setup()
145 plat->tx_queues_to_use = 1; in stmmac_mtl_setup()
151 plat->rx_queues_cfg[0].mode_to_use = MTL_QUEUE_DCB; in stmmac_mtl_setup()
152 plat->tx_queues_cfg[0].mode_to_use = MTL_QUEUE_DCB; in stmmac_mtl_setup()
166 &plat->rx_queues_to_use)) in stmmac_mtl_setup()
167 plat->rx_queues_to_use = 1; in stmmac_mtl_setup()
170 plat->rx_sched_algorithm = MTL_RX_ALGORITHM_SP; in stmmac_mtl_setup()
172 plat->rx_sched_algorithm = MTL_RX_ALGORITHM_WSP; in stmmac_mtl_setup()
174 plat->rx_sched_algorithm = MTL_RX_ALGORITHM_SP; in stmmac_mtl_setup()
178 if (queue >= plat->rx_queues_to_use) in stmmac_mtl_setup()
182 plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; in stmmac_mtl_setup()
184 plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB; in stmmac_mtl_setup()
186 plat->rx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; in stmmac_mtl_setup()
189 &plat->rx_queues_cfg[queue].chan)) in stmmac_mtl_setup()
190 plat->rx_queues_cfg[queue].chan = queue; in stmmac_mtl_setup()
194 &plat->rx_queues_cfg[queue].prio)) { in stmmac_mtl_setup()
195 plat->rx_queues_cfg[queue].prio = 0; in stmmac_mtl_setup()
196 plat->rx_queues_cfg[queue].use_prio = false; in stmmac_mtl_setup()
198 plat->rx_queues_cfg[queue].use_prio = true; in stmmac_mtl_setup()
203 plat->rx_queues_cfg[queue].pkt_route = PACKET_AVCPQ; in stmmac_mtl_setup()
205 plat->rx_queues_cfg[queue].pkt_route = PACKET_PTPQ; in stmmac_mtl_setup()
207 plat->rx_queues_cfg[queue].pkt_route = PACKET_DCBCPQ; in stmmac_mtl_setup()
209 plat->rx_queues_cfg[queue].pkt_route = PACKET_UPQ; in stmmac_mtl_setup()
211 plat->rx_queues_cfg[queue].pkt_route = PACKET_MCBCQ; in stmmac_mtl_setup()
213 plat->rx_queues_cfg[queue].pkt_route = 0x0; in stmmac_mtl_setup()
217 if (queue != plat->rx_queues_to_use) { in stmmac_mtl_setup()
225 &plat->tx_queues_to_use)) in stmmac_mtl_setup()
226 plat->tx_queues_to_use = 1; in stmmac_mtl_setup()
229 plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WRR; in stmmac_mtl_setup()
231 plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WFQ; in stmmac_mtl_setup()
233 plat->tx_sched_algorithm = MTL_TX_ALGORITHM_DWRR; in stmmac_mtl_setup()
235 plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP; in stmmac_mtl_setup()
241 if (queue >= plat->tx_queues_to_use) in stmmac_mtl_setup()
245 &plat->tx_queues_cfg[queue].weight)) in stmmac_mtl_setup()
246 plat->tx_queues_cfg[queue].weight = 0x10 + queue; in stmmac_mtl_setup()
249 plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; in stmmac_mtl_setup()
252 plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB; in stmmac_mtl_setup()
256 &plat->tx_queues_cfg[queue].send_slope)) in stmmac_mtl_setup()
257 plat->tx_queues_cfg[queue].send_slope = 0x0; in stmmac_mtl_setup()
259 &plat->tx_queues_cfg[queue].idle_slope)) in stmmac_mtl_setup()
260 plat->tx_queues_cfg[queue].idle_slope = 0x0; in stmmac_mtl_setup()
262 &plat->tx_queues_cfg[queue].high_credit)) in stmmac_mtl_setup()
263 plat->tx_queues_cfg[queue].high_credit = 0x0; in stmmac_mtl_setup()
265 &plat->tx_queues_cfg[queue].low_credit)) in stmmac_mtl_setup()
266 plat->tx_queues_cfg[queue].low_credit = 0x0; in stmmac_mtl_setup()
268 plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB; in stmmac_mtl_setup()
272 &plat->tx_queues_cfg[queue].prio)) { in stmmac_mtl_setup()
273 plat->tx_queues_cfg[queue].prio = 0; in stmmac_mtl_setup()
274 plat->tx_queues_cfg[queue].use_prio = false; in stmmac_mtl_setup()
276 plat->tx_queues_cfg[queue].use_prio = true; in stmmac_mtl_setup()
281 if (queue != plat->tx_queues_to_use) { in stmmac_mtl_setup()
320 static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, in stmmac_dt_phy() argument
330 plat->mdio_node = of_get_child_by_name(np, "mdio"); in stmmac_dt_phy()
336 for_each_child_of_node(np, plat->mdio_node) { in stmmac_dt_phy()
337 if (of_device_is_compatible(plat->mdio_node, in stmmac_dt_phy()
343 if (plat->mdio_node) { in stmmac_dt_phy()
349 plat->mdio_bus_data = in stmmac_dt_phy()
352 if (!plat->mdio_bus_data) in stmmac_dt_phy()
355 plat->mdio_bus_data->needs_reset = true; in stmmac_dt_phy()
399 struct plat_stmmacenet_data *plat; in stmmac_probe_config_dt() local
405 plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); in stmmac_probe_config_dt()
406 if (!plat) in stmmac_probe_config_dt()
421 plat->phy_interface = phy_mode; in stmmac_probe_config_dt()
422 plat->interface = stmmac_of_get_mac_mode(np); in stmmac_probe_config_dt()
423 if (plat->interface < 0) in stmmac_probe_config_dt()
424 plat->interface = plat->phy_interface; in stmmac_probe_config_dt()
428 plat->phy_node = of_parse_phandle(np, "phy-handle", 0); in stmmac_probe_config_dt()
431 plat->phylink_node = np; in stmmac_probe_config_dt()
434 of_property_read_u32(np, "max-speed", &plat->max_speed); in stmmac_probe_config_dt()
436 plat->bus_id = of_alias_get_id(np, "ethernet"); in stmmac_probe_config_dt()
437 if (plat->bus_id < 0) in stmmac_probe_config_dt()
438 plat->bus_id = 0; in stmmac_probe_config_dt()
441 plat->phy_addr = -1; in stmmac_probe_config_dt()
446 plat->clk_csr = -1; in stmmac_probe_config_dt()
447 if (of_property_read_u32(np, "snps,clk-csr", &plat->clk_csr)) in stmmac_probe_config_dt()
448 of_property_read_u32(np, "clk_csr", &plat->clk_csr); in stmmac_probe_config_dt()
453 if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) in stmmac_probe_config_dt()
457 rc = stmmac_dt_phy(plat, np, &pdev->dev); in stmmac_probe_config_dt()
461 of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); in stmmac_probe_config_dt()
463 of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size); in stmmac_probe_config_dt()
465 plat->force_sf_dma_mode = in stmmac_probe_config_dt()
468 plat->en_tx_lpi_clockgating = in stmmac_probe_config_dt()
474 plat->maxmtu = JUMBO_LEN; in stmmac_probe_config_dt()
477 plat->multicast_filter_bins = HASH_TABLE_SIZE; in stmmac_probe_config_dt()
480 plat->unicast_filter_entries = 1; in stmmac_probe_config_dt()
498 of_property_read_u32(np, "max-frame-size", &plat->maxmtu); in stmmac_probe_config_dt()
500 &plat->multicast_filter_bins); in stmmac_probe_config_dt()
502 &plat->unicast_filter_entries); in stmmac_probe_config_dt()
503 plat->unicast_filter_entries = dwmac1000_validate_ucast_entries( in stmmac_probe_config_dt()
504 &pdev->dev, plat->unicast_filter_entries); in stmmac_probe_config_dt()
505 plat->multicast_filter_bins = dwmac1000_validate_mcast_bins( in stmmac_probe_config_dt()
506 &pdev->dev, plat->multicast_filter_bins); in stmmac_probe_config_dt()
507 plat->has_gmac = 1; in stmmac_probe_config_dt()
508 plat->pmt = 1; in stmmac_probe_config_dt()
512 plat->has_gmac = 1; in stmmac_probe_config_dt()
513 plat->enh_desc = 1; in stmmac_probe_config_dt()
514 plat->tx_coe = 1; in stmmac_probe_config_dt()
515 plat->bugged_jumbo = 1; in stmmac_probe_config_dt()
516 plat->pmt = 1; in stmmac_probe_config_dt()
523 plat->has_gmac4 = 1; in stmmac_probe_config_dt()
524 plat->has_gmac = 0; in stmmac_probe_config_dt()
525 plat->pmt = 1; in stmmac_probe_config_dt()
526 plat->tso_en = of_property_read_bool(np, "snps,tso"); in stmmac_probe_config_dt()
531 plat->enh_desc = 1; in stmmac_probe_config_dt()
532 plat->bugged_jumbo = 1; in stmmac_probe_config_dt()
533 plat->force_sf_dma_mode = 1; in stmmac_probe_config_dt()
537 plat->has_xgmac = 1; in stmmac_probe_config_dt()
538 plat->pmt = 1; in stmmac_probe_config_dt()
539 plat->tso_en = of_property_read_bool(np, "snps,tso"); in stmmac_probe_config_dt()
545 stmmac_remove_config_dt(pdev, plat); in stmmac_probe_config_dt()
548 plat->dma_cfg = dma_cfg; in stmmac_probe_config_dt()
561 plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode"); in stmmac_probe_config_dt()
562 if (plat->force_thresh_dma_mode && plat->force_sf_dma_mode) { in stmmac_probe_config_dt()
563 plat->force_sf_dma_mode = 0; in stmmac_probe_config_dt()
568 of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed); in stmmac_probe_config_dt()
570 plat->axi = stmmac_axi_setup(pdev); in stmmac_probe_config_dt()
572 rc = stmmac_mtl_setup(pdev, plat); in stmmac_probe_config_dt()
574 stmmac_remove_config_dt(pdev, plat); in stmmac_probe_config_dt()
580 plat->stmmac_clk = devm_clk_get(&pdev->dev, in stmmac_probe_config_dt()
582 if (IS_ERR(plat->stmmac_clk)) { in stmmac_probe_config_dt()
584 plat->stmmac_clk = NULL; in stmmac_probe_config_dt()
586 clk_prepare_enable(plat->stmmac_clk); in stmmac_probe_config_dt()
589 plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); in stmmac_probe_config_dt()
590 if (IS_ERR(plat->pclk)) { in stmmac_probe_config_dt()
591 ret = plat->pclk; in stmmac_probe_config_dt()
594 clk_prepare_enable(plat->pclk); in stmmac_probe_config_dt()
597 plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "ptp_ref"); in stmmac_probe_config_dt()
598 if (IS_ERR(plat->clk_ptp_ref)) { in stmmac_probe_config_dt()
599 plat->clk_ptp_rate = clk_get_rate(plat->stmmac_clk); in stmmac_probe_config_dt()
600 plat->clk_ptp_ref = NULL; in stmmac_probe_config_dt()
603 plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); in stmmac_probe_config_dt()
604 dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate); in stmmac_probe_config_dt()
607 plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev, in stmmac_probe_config_dt()
609 if (IS_ERR(plat->stmmac_rst)) { in stmmac_probe_config_dt()
610 ret = plat->stmmac_rst; in stmmac_probe_config_dt()
614 plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared( in stmmac_probe_config_dt()
616 if (IS_ERR(plat->stmmac_ahb_rst)) { in stmmac_probe_config_dt()
617 ret = plat->stmmac_ahb_rst; in stmmac_probe_config_dt()
621 return plat; in stmmac_probe_config_dt()
624 clk_disable_unprepare(plat->pclk); in stmmac_probe_config_dt()
626 clk_disable_unprepare(plat->stmmac_clk); in stmmac_probe_config_dt()
639 struct plat_stmmacenet_data *plat) in stmmac_remove_config_dt() argument
641 clk_disable_unprepare(plat->stmmac_clk); in stmmac_remove_config_dt()
642 clk_disable_unprepare(plat->pclk); in stmmac_remove_config_dt()
643 of_node_put(plat->phy_node); in stmmac_remove_config_dt()
644 of_node_put(plat->mdio_node); in stmmac_remove_config_dt()
654 struct plat_stmmacenet_data *plat) in stmmac_remove_config_dt() argument
713 struct plat_stmmacenet_data *plat = priv->plat; in stmmac_pltfr_remove() local
717 if (plat->exit) in stmmac_pltfr_remove()
718 plat->exit(pdev, plat->bsp_priv); in stmmac_pltfr_remove()
720 stmmac_remove_config_dt(pdev, plat); in stmmac_pltfr_remove()
741 if (priv->plat->exit) in stmmac_pltfr_suspend()
742 priv->plat->exit(pdev, priv->plat->bsp_priv); in stmmac_pltfr_suspend()
760 if (priv->plat->init) in stmmac_pltfr_resume()
761 priv->plat->init(pdev, priv->plat->bsp_priv); in stmmac_pltfr_resume()
793 if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { in stmmac_pltfr_noirq_suspend()
795 clk_disable_unprepare(priv->plat->clk_ptp_ref); in stmmac_pltfr_noirq_suspend()
814 if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { in stmmac_pltfr_noirq_resume()
820 ret = clk_prepare_enable(priv->plat->clk_ptp_ref); in stmmac_pltfr_noirq_resume()