Lines Matching +full:versal +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0
3 * dwc3-xilinx.c - Xilinx DWC3 controller specific glue driver
12 #include <linux/clk.h>
15 #include <linux/dma-mapping.h>
22 #include <linux/firmware/xlnx-zynqmp.h>
35 /* Versal USB Reset ID */
62 reg = readl(priv_data->regs + XLNX_USB_PHY_RST_EN); in dwc3_xlnx_mask_phy_rst()
69 writel(reg, priv_data->regs + XLNX_USB_PHY_RST_EN); in dwc3_xlnx_mask_phy_rst()
74 struct device *dev = priv_data->dev; in dwc3_xlnx_init_versal()
79 /* Assert and De-assert reset */ in dwc3_xlnx_init_versal()
90 dev_err_probe(dev, ret, "failed to De-assert Reset\n"); in dwc3_xlnx_init_versal()
101 struct device *dev = priv_data->dev; in dwc3_xlnx_init_zynqmp()
107 priv_data->usb3_phy = devm_phy_optional_get(dev, "usb3-phy"); in dwc3_xlnx_init_zynqmp()
108 if (IS_ERR(priv_data->usb3_phy)) { in dwc3_xlnx_init_zynqmp()
109 ret = PTR_ERR(priv_data->usb3_phy); in dwc3_xlnx_init_zynqmp()
119 * by the first-stage boot loader, but may be reverted by a core in dwc3_xlnx_init_zynqmp()
121 * in use but the usb3-phy entry is missing from the device tree. in dwc3_xlnx_init_zynqmp()
124 if (!priv_data->usb3_phy) { in dwc3_xlnx_init_zynqmp()
126 writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); in dwc3_xlnx_init_zynqmp()
172 ret = phy_init(priv_data->usb3_phy); in dwc3_xlnx_init_zynqmp()
174 phy_exit(priv_data->usb3_phy); in dwc3_xlnx_init_zynqmp()
185 writel(FPD_POWER_PRSNT_OPTION, priv_data->regs + XLNX_USB_FPD_POWER_PRSNT); in dwc3_xlnx_init_zynqmp()
188 writel(PIPE_CLK_SELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); in dwc3_xlnx_init_zynqmp()
202 ret = phy_power_on(priv_data->usb3_phy); in dwc3_xlnx_init_zynqmp()
204 phy_exit(priv_data->usb3_phy); in dwc3_xlnx_init_zynqmp()
209 /* ulpi reset via gpio-modepin or gpio-framework driver */ in dwc3_xlnx_init_zynqmp()
229 if (of_dma_is_coherent(dev->of_node) || device_iommu_mapped(dev)) { in dwc3_xlnx_init_zynqmp()
230 reg = readl(priv_data->regs + XLNX_USB_TRAFFIC_ROUTE_CONFIG); in dwc3_xlnx_init_zynqmp()
232 writel(reg, priv_data->regs + XLNX_USB_TRAFFIC_ROUTE_CONFIG); in dwc3_xlnx_init_zynqmp()
241 .compatible = "xlnx,zynqmp-dwc3",
245 .compatible = "xlnx,versal-dwc3",
255 struct device *dev = &pdev->dev; in dwc3_xlnx_probe()
256 struct device_node *np = dev->of_node; in dwc3_xlnx_probe()
263 return -ENOMEM; in dwc3_xlnx_probe()
272 match = of_match_node(dwc3_xlnx_of_match, pdev->dev.of_node); in dwc3_xlnx_probe()
274 priv_data->pltfm_init = match->data; in dwc3_xlnx_probe()
275 priv_data->regs = regs; in dwc3_xlnx_probe()
276 priv_data->dev = dev; in dwc3_xlnx_probe()
280 ret = devm_clk_bulk_get_all(priv_data->dev, &priv_data->clks); in dwc3_xlnx_probe()
284 priv_data->num_clocks = ret; in dwc3_xlnx_probe()
286 ret = clk_bulk_prepare_enable(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_probe()
290 ret = priv_data->pltfm_init(priv_data); in dwc3_xlnx_probe()
306 clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_probe()
314 struct device *dev = &pdev->dev; in dwc3_xlnx_remove()
318 clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_remove()
319 priv_data->num_clocks = 0; in dwc3_xlnx_remove()
330 clk_bulk_disable(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_runtime_suspend()
339 return clk_bulk_enable(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_runtime_resume()
354 phy_exit(priv_data->usb3_phy); in dwc3_xlnx_suspend()
357 clk_bulk_disable(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_suspend()
367 ret = clk_bulk_enable(priv_data->num_clocks, priv_data->clks); in dwc3_xlnx_resume()
371 ret = phy_init(priv_data->usb3_phy); in dwc3_xlnx_resume()
375 ret = phy_power_on(priv_data->usb3_phy); in dwc3_xlnx_resume()
377 phy_exit(priv_data->usb3_phy); in dwc3_xlnx_resume()
394 .name = "dwc3-xilinx",