Lines Matching +full:exynos4210 +full:- +full:ehci

1 // SPDX-License-Identifier: GPL-2.0+
3 * Samsung Exynos USB HOST EHCI Controller
11 #include <linux/dma-mapping.h>
22 #include "ehci.h"
24 #define DRIVER_DESC "EHCI Exynos driver"
46 #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv)
57 num_phys = of_count_phandle_with_args(dev->of_node, "phys", in exynos_ehci_get_phy()
58 "#phy-cells"); in exynos_ehci_get_phy()
60 phy = devm_of_phy_get_by_index(dev, dev->of_node, phy_number); in exynos_ehci_get_phy()
63 exynos_ehci->phy[phy_number] = phy; in exynos_ehci_get_phy()
69 for_each_available_child_of_node(dev->of_node, child) { in exynos_ehci_get_phy()
80 return -EINVAL; in exynos_ehci_get_phy()
84 exynos_ehci->phy[phy_number] = phy; in exynos_ehci_get_phy()
91 exynos_ehci->legacy_phy = true; in exynos_ehci_get_phy()
103 ret = phy_power_on(exynos_ehci->phy[i]); in exynos_ehci_phy_enable()
105 for (i--; i >= 0; i--) in exynos_ehci_phy_enable()
106 phy_power_off(exynos_ehci->phy[i]); in exynos_ehci_phy_enable()
118 phy_power_off(exynos_ehci->phy[i]); in exynos_ehci_phy_disable()
129 dev_err(dev, "can't request ehci vbus gpio: %d\n", err); in exynos_setup_vbus_gpio()
136 struct ehci_hcd *ehci; in exynos_ehci_probe() local
142 * Right now device-tree probed devices don't get dma_mask set. in exynos_ehci_probe()
146 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in exynos_ehci_probe()
150 exynos_setup_vbus_gpio(&pdev->dev); in exynos_ehci_probe()
153 &pdev->dev, dev_name(&pdev->dev)); in exynos_ehci_probe()
155 dev_err(&pdev->dev, "Unable to create HCD\n"); in exynos_ehci_probe()
156 return -ENOMEM; in exynos_ehci_probe()
160 err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); in exynos_ehci_probe()
164 exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); in exynos_ehci_probe()
166 if (IS_ERR(exynos_ehci->clk)) { in exynos_ehci_probe()
167 dev_err(&pdev->dev, "Failed to get usbhost clock\n"); in exynos_ehci_probe()
168 err = PTR_ERR(exynos_ehci->clk); in exynos_ehci_probe()
172 err = clk_prepare_enable(exynos_ehci->clk); in exynos_ehci_probe()
176 hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in exynos_ehci_probe()
177 if (IS_ERR(hcd->regs)) { in exynos_ehci_probe()
178 err = PTR_ERR(hcd->regs); in exynos_ehci_probe()
182 hcd->rsrc_start = res->start; in exynos_ehci_probe()
183 hcd->rsrc_len = resource_size(res); in exynos_ehci_probe()
191 err = exynos_ehci_phy_enable(&pdev->dev); in exynos_ehci_probe()
193 dev_err(&pdev->dev, "Failed to enable USB phy\n"); in exynos_ehci_probe()
197 ehci = hcd_to_ehci(hcd); in exynos_ehci_probe()
198 ehci->caps = hcd->regs; in exynos_ehci_probe()
202 * Exynos EHCI port subnodes and generic USB device bindings in exynos_ehci_probe()
204 exynos_ehci->of_node = pdev->dev.of_node; in exynos_ehci_probe()
205 if (exynos_ehci->legacy_phy) in exynos_ehci_probe()
206 pdev->dev.of_node = NULL; in exynos_ehci_probe()
209 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); in exynos_ehci_probe()
213 dev_err(&pdev->dev, "Failed to add USB HCD\n"); in exynos_ehci_probe()
216 device_wakeup_enable(hcd->self.controller); in exynos_ehci_probe()
223 exynos_ehci_phy_disable(&pdev->dev); in exynos_ehci_probe()
224 pdev->dev.of_node = exynos_ehci->of_node; in exynos_ehci_probe()
226 clk_disable_unprepare(exynos_ehci->clk); in exynos_ehci_probe()
237 pdev->dev.of_node = exynos_ehci->of_node; in exynos_ehci_remove()
241 exynos_ehci_phy_disable(&pdev->dev); in exynos_ehci_remove()
243 clk_disable_unprepare(exynos_ehci->clk); in exynos_ehci_remove()
263 clk_disable_unprepare(exynos_ehci->clk); in exynos_ehci_suspend()
274 ret = clk_prepare_enable(exynos_ehci->clk); in exynos_ehci_resume()
281 clk_disable_unprepare(exynos_ehci->clk); in exynos_ehci_resume()
286 writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs)); in exynos_ehci_resume()
303 { .compatible = "samsung,exynos4210-ehci" },
314 .name = "exynos-ehci",
326 return -ENODEV; in ehci_exynos_init()
340 MODULE_ALIAS("platform:exynos-ehci");