Lines Matching full:plat

129  * @plat: enet data
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()
279 plat->tx_queues_cfg[queue].coe_unsupported = in stmmac_mtl_setup()
284 if (queue != plat->tx_queues_to_use) { in stmmac_mtl_setup()
336 * @plat: driver data platform structure
341 * If an MDIO node is found, it's assigned to plat->mdio_node and
342 * plat->mdio_bus_data is allocated.
343 * If no connection can be determined, just plat->mdio_bus_data is allocated
347 * This expects that plat->phy_node has already been searched for.
351 static int stmmac_mdio_setup(struct plat_stmmacenet_data *plat, in stmmac_mdio_setup() argument
356 plat->mdio_node = stmmac_of_get_mdio(np); in stmmac_mdio_setup()
357 if (plat->mdio_node) in stmmac_mdio_setup()
365 legacy_mdio = !of_phy_is_fixed_link(np) && !plat->phy_node; in stmmac_mdio_setup()
369 if (plat->mdio_node || legacy_mdio) { in stmmac_mdio_setup()
370 plat->mdio_bus_data = devm_kzalloc(dev, in stmmac_mdio_setup()
371 sizeof(*plat->mdio_bus_data), in stmmac_mdio_setup()
373 if (!plat->mdio_bus_data) in stmmac_mdio_setup()
376 plat->mdio_bus_data->needs_reset = true; in stmmac_mdio_setup()
420 struct plat_stmmacenet_data *plat; in stmmac_probe_config_dt() local
426 plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); in stmmac_probe_config_dt()
427 if (!plat) in stmmac_probe_config_dt()
442 plat->phy_interface = phy_mode; in stmmac_probe_config_dt()
444 plat->mac_interface = rc < 0 ? plat->phy_interface : rc; in stmmac_probe_config_dt()
448 plat->phy_node = of_parse_phandle(np, "phy-handle", 0); in stmmac_probe_config_dt()
451 plat->port_node = of_fwnode_handle(np); in stmmac_probe_config_dt()
454 of_property_read_u32(np, "max-speed", &plat->max_speed); in stmmac_probe_config_dt()
456 plat->bus_id = of_alias_get_id(np, "ethernet"); in stmmac_probe_config_dt()
457 if (plat->bus_id < 0) in stmmac_probe_config_dt()
458 plat->bus_id = 0; in stmmac_probe_config_dt()
461 plat->phy_addr = -1; in stmmac_probe_config_dt()
466 plat->clk_csr = -1; in stmmac_probe_config_dt()
467 if (of_property_read_u32(np, "snps,clk-csr", &plat->clk_csr)) in stmmac_probe_config_dt()
468 of_property_read_u32(np, "clk_csr", &plat->clk_csr); in stmmac_probe_config_dt()
473 if (of_property_read_u32(np, "snps,phy-addr", &plat->phy_addr) == 0) in stmmac_probe_config_dt()
476 rc = stmmac_mdio_setup(plat, np, &pdev->dev); in stmmac_probe_config_dt()
482 of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size); in stmmac_probe_config_dt()
484 of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size); in stmmac_probe_config_dt()
486 plat->force_sf_dma_mode = in stmmac_probe_config_dt()
490 plat->flags |= STMMAC_FLAG_EN_TX_LPI_CLOCKGATING; in stmmac_probe_config_dt()
495 plat->maxmtu = JUMBO_LEN; in stmmac_probe_config_dt()
498 plat->multicast_filter_bins = HASH_TABLE_SIZE; in stmmac_probe_config_dt()
501 plat->unicast_filter_entries = 1; in stmmac_probe_config_dt()
520 of_property_read_u32(np, "max-frame-size", &plat->maxmtu); in stmmac_probe_config_dt()
522 &plat->multicast_filter_bins); in stmmac_probe_config_dt()
524 &plat->unicast_filter_entries); in stmmac_probe_config_dt()
525 plat->unicast_filter_entries = dwmac1000_validate_ucast_entries( in stmmac_probe_config_dt()
526 &pdev->dev, plat->unicast_filter_entries); in stmmac_probe_config_dt()
527 plat->multicast_filter_bins = dwmac1000_validate_mcast_bins( in stmmac_probe_config_dt()
528 &pdev->dev, plat->multicast_filter_bins); in stmmac_probe_config_dt()
529 plat->has_gmac = 1; in stmmac_probe_config_dt()
530 plat->pmt = 1; in stmmac_probe_config_dt()
534 plat->has_gmac = 1; in stmmac_probe_config_dt()
535 plat->enh_desc = 1; in stmmac_probe_config_dt()
536 plat->tx_coe = 1; in stmmac_probe_config_dt()
537 plat->bugged_jumbo = 1; in stmmac_probe_config_dt()
538 plat->pmt = 1; in stmmac_probe_config_dt()
546 plat->has_gmac4 = 1; in stmmac_probe_config_dt()
547 plat->has_gmac = 0; in stmmac_probe_config_dt()
548 plat->pmt = 1; in stmmac_probe_config_dt()
550 plat->flags |= STMMAC_FLAG_TSO_EN; in stmmac_probe_config_dt()
555 plat->enh_desc = 1; in stmmac_probe_config_dt()
556 plat->bugged_jumbo = 1; in stmmac_probe_config_dt()
557 plat->force_sf_dma_mode = 1; in stmmac_probe_config_dt()
561 plat->has_xgmac = 1; in stmmac_probe_config_dt()
562 plat->pmt = 1; in stmmac_probe_config_dt()
564 plat->flags |= STMMAC_FLAG_TSO_EN; in stmmac_probe_config_dt()
573 plat->dma_cfg = dma_cfg; in stmmac_probe_config_dt()
586 plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode"); in stmmac_probe_config_dt()
587 if (plat->force_thresh_dma_mode && plat->force_sf_dma_mode) { in stmmac_probe_config_dt()
588 plat->force_sf_dma_mode = 0; in stmmac_probe_config_dt()
593 of_property_read_u32(np, "snps,ps-speed", &plat->mac_port_sel_speed); in stmmac_probe_config_dt()
595 plat->axi = stmmac_axi_setup(pdev); in stmmac_probe_config_dt()
597 rc = stmmac_mtl_setup(pdev, plat); in stmmac_probe_config_dt()
605 plat->stmmac_clk = devm_clk_get(&pdev->dev, in stmmac_probe_config_dt()
607 if (IS_ERR(plat->stmmac_clk)) { in stmmac_probe_config_dt()
609 plat->stmmac_clk = NULL; in stmmac_probe_config_dt()
611 clk_prepare_enable(plat->stmmac_clk); in stmmac_probe_config_dt()
614 plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); in stmmac_probe_config_dt()
615 if (IS_ERR(plat->pclk)) { in stmmac_probe_config_dt()
616 ret = plat->pclk; in stmmac_probe_config_dt()
619 clk_prepare_enable(plat->pclk); in stmmac_probe_config_dt()
622 plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "ptp_ref"); in stmmac_probe_config_dt()
623 if (IS_ERR(plat->clk_ptp_ref)) { in stmmac_probe_config_dt()
624 plat->clk_ptp_rate = clk_get_rate(plat->stmmac_clk); in stmmac_probe_config_dt()
625 plat->clk_ptp_ref = NULL; in stmmac_probe_config_dt()
628 plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); in stmmac_probe_config_dt()
629 dev_dbg(&pdev->dev, "PTP rate %lu\n", plat->clk_ptp_rate); in stmmac_probe_config_dt()
632 plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev, in stmmac_probe_config_dt()
634 if (IS_ERR(plat->stmmac_rst)) { in stmmac_probe_config_dt()
635 ret = plat->stmmac_rst; in stmmac_probe_config_dt()
639 plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared( in stmmac_probe_config_dt()
641 if (IS_ERR(plat->stmmac_ahb_rst)) { in stmmac_probe_config_dt()
642 ret = plat->stmmac_ahb_rst; in stmmac_probe_config_dt()
646 return plat; in stmmac_probe_config_dt()
649 clk_disable_unprepare(plat->pclk); in stmmac_probe_config_dt()
651 clk_disable_unprepare(plat->stmmac_clk); in stmmac_probe_config_dt()
653 of_node_put(plat->mdio_node); in stmmac_probe_config_dt()
655 of_node_put(plat->phy_node); in stmmac_probe_config_dt()
662 struct plat_stmmacenet_data *plat = data; in devm_stmmac_remove_config_dt() local
664 clk_disable_unprepare(plat->stmmac_clk); in devm_stmmac_remove_config_dt()
665 clk_disable_unprepare(plat->pclk); in devm_stmmac_remove_config_dt()
666 of_node_put(plat->mdio_node); in devm_stmmac_remove_config_dt()
667 of_node_put(plat->phy_node); in devm_stmmac_remove_config_dt()
679 struct plat_stmmacenet_data *plat; in devm_stmmac_probe_config_dt() local
682 plat = stmmac_probe_config_dt(pdev, mac); in devm_stmmac_probe_config_dt()
683 if (IS_ERR(plat)) in devm_stmmac_probe_config_dt()
684 return plat; in devm_stmmac_probe_config_dt()
687 devm_stmmac_remove_config_dt, plat); in devm_stmmac_probe_config_dt()
691 return plat; in devm_stmmac_probe_config_dt()
755 * @plat: driver data platform structure
760 struct plat_stmmacenet_data *plat) in stmmac_pltfr_init() argument
764 if (plat->init) in stmmac_pltfr_init()
765 ret = plat->init(pdev, plat->bsp_priv); in stmmac_pltfr_init()
773 * @plat: driver data platform structure
777 struct plat_stmmacenet_data *plat) in stmmac_pltfr_exit() argument
779 if (plat->exit) in stmmac_pltfr_exit()
780 plat->exit(pdev, plat->bsp_priv); in stmmac_pltfr_exit()
786 * @plat: driver data platform structure
792 struct plat_stmmacenet_data *plat, in stmmac_pltfr_probe() argument
797 ret = stmmac_pltfr_init(pdev, plat); in stmmac_pltfr_probe()
801 ret = stmmac_dvr_probe(&pdev->dev, plat, res); in stmmac_pltfr_probe()
803 stmmac_pltfr_exit(pdev, plat); in stmmac_pltfr_probe()
821 * @plat: driver data platform structure
827 struct plat_stmmacenet_data *plat, in devm_stmmac_pltfr_probe() argument
832 ret = stmmac_pltfr_probe(pdev, plat, res); in devm_stmmac_pltfr_probe()
851 struct plat_stmmacenet_data *plat = priv->plat; in stmmac_pltfr_remove() local
854 stmmac_pltfr_exit(pdev, plat); in stmmac_pltfr_remove()
873 stmmac_pltfr_exit(pdev, priv->plat); in stmmac_pltfr_suspend()
892 ret = stmmac_pltfr_init(pdev, priv->plat); in stmmac_pltfr_resume()
926 if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { in stmmac_pltfr_noirq_suspend()
928 clk_disable_unprepare(priv->plat->clk_ptp_ref); in stmmac_pltfr_noirq_suspend()
947 if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { in stmmac_pltfr_noirq_resume()
953 ret = clk_prepare_enable(priv->plat->clk_ptp_ref); in stmmac_pltfr_noirq_resume()