Lines Matching +full:burst +full:- +full:clk +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0+
10 #include <linux/clk.h>
11 #include <linux/dma-mapping.h>
40 struct clk *clk; member
46 #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv)
56 num_phys = of_count_phandle_with_args(dev->of_node, "phys", in exynos_ehci_get_phy()
57 "#phy-cells"); in exynos_ehci_get_phy()
59 phy = devm_of_phy_get_by_index(dev, dev->of_node, phy_number); in exynos_ehci_get_phy()
62 exynos_ehci->phy[phy_number] = phy; in exynos_ehci_get_phy()
68 for_each_available_child_of_node_scoped(dev->of_node, child) { in exynos_ehci_get_phy()
77 return -EINVAL; in exynos_ehci_get_phy()
81 exynos_ehci->phy[phy_number] = phy; in exynos_ehci_get_phy()
86 exynos_ehci->legacy_phy = true; in exynos_ehci_get_phy()
98 ret = phy_power_on(exynos_ehci->phy[i]); in exynos_ehci_phy_enable()
100 for (i--; i >= 0; i--) in exynos_ehci_phy_enable()
101 phy_power_off(exynos_ehci->phy[i]); in exynos_ehci_phy_enable()
113 phy_power_off(exynos_ehci->phy[i]); in exynos_ehci_phy_disable()
137 * Right now device-tree probed devices don't get dma_mask set. in exynos_ehci_probe()
141 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in exynos_ehci_probe()
145 exynos_setup_vbus_gpio(&pdev->dev); in exynos_ehci_probe()
148 &pdev->dev, dev_name(&pdev->dev)); in exynos_ehci_probe()
150 dev_err(&pdev->dev, "Unable to create HCD\n"); in exynos_ehci_probe()
151 return -ENOMEM; in exynos_ehci_probe()
155 err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); in exynos_ehci_probe()
159 exynos_ehci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); in exynos_ehci_probe()
161 if (IS_ERR(exynos_ehci->clk)) { in exynos_ehci_probe()
162 dev_err(&pdev->dev, "Failed to get usbhost clock\n"); in exynos_ehci_probe()
163 err = PTR_ERR(exynos_ehci->clk); in exynos_ehci_probe()
167 hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in exynos_ehci_probe()
168 if (IS_ERR(hcd->regs)) { in exynos_ehci_probe()
169 err = PTR_ERR(hcd->regs); in exynos_ehci_probe()
173 hcd->rsrc_start = res->start; in exynos_ehci_probe()
174 hcd->rsrc_len = resource_size(res); in exynos_ehci_probe()
182 err = exynos_ehci_phy_enable(&pdev->dev); in exynos_ehci_probe()
184 dev_err(&pdev->dev, "Failed to enable USB phy\n"); in exynos_ehci_probe()
189 ehci->caps = hcd->regs; in exynos_ehci_probe()
195 exynos_ehci->of_node = pdev->dev.of_node; in exynos_ehci_probe()
196 if (exynos_ehci->legacy_phy) in exynos_ehci_probe()
197 pdev->dev.of_node = NULL; in exynos_ehci_probe()
199 /* DMA burst Enable */ in exynos_ehci_probe()
200 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); in exynos_ehci_probe()
204 dev_err(&pdev->dev, "Failed to add USB HCD\n"); in exynos_ehci_probe()
207 device_wakeup_enable(hcd->self.controller); in exynos_ehci_probe()
214 exynos_ehci_phy_disable(&pdev->dev); in exynos_ehci_probe()
215 pdev->dev.of_node = exynos_ehci->of_node; in exynos_ehci_probe()
226 pdev->dev.of_node = exynos_ehci->of_node; in exynos_ehci_remove()
230 exynos_ehci_phy_disable(&pdev->dev); in exynos_ehci_remove()
249 clk_disable_unprepare(exynos_ehci->clk); in exynos_ehci_suspend()
260 ret = clk_prepare_enable(exynos_ehci->clk); in exynos_ehci_resume()
266 dev_err(dev, "Failed to enable USB phy\n"); in exynos_ehci_resume()
267 clk_disable_unprepare(exynos_ehci->clk); in exynos_ehci_resume()
271 /* DMA burst Enable */ in exynos_ehci_resume()
272 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); in exynos_ehci_resume()
283 { .compatible = "samsung,exynos4210-ehci" },
294 .name = "exynos-ehci",
306 return -ENODEV; in ehci_exynos_init()
320 MODULE_ALIAS("platform:exynos-ehci");