Lines Matching +full:generic +full:- +full:ohci

1 // SPDX-License-Identifier: GPL-2.0+
3 * SAMSUNG EXYNOS USB HOST OHCI Controller
10 #include <linux/dma-mapping.h>
20 #include "ohci.h"
22 #define DRIVER_DESC "OHCI Exynos driver"
26 #define to_exynos_ohci(hcd) (struct exynos_ohci_hcd *)(hcd_to_ohci(hcd)->priv)
46 num_phys = of_count_phandle_with_args(dev->of_node, "phys", in exynos_ohci_get_phy()
47 "#phy-cells"); in exynos_ohci_get_phy()
49 phy = devm_of_phy_get_by_index(dev, dev->of_node, phy_number); in exynos_ohci_get_phy()
52 exynos_ohci->phy[phy_number] = phy; in exynos_ohci_get_phy()
58 for_each_available_child_of_node(dev->of_node, child) { in exynos_ohci_get_phy()
69 return -EINVAL; in exynos_ohci_get_phy()
73 exynos_ohci->phy[phy_number] = phy; in exynos_ohci_get_phy()
80 exynos_ohci->legacy_phy = true; in exynos_ohci_get_phy()
92 ret = phy_power_on(exynos_ohci->phy[i]); in exynos_ohci_phy_enable()
94 for (i--; i >= 0; i--) in exynos_ohci_phy_enable()
95 phy_power_off(exynos_ohci->phy[i]); in exynos_ohci_phy_enable()
107 phy_power_off(exynos_ohci->phy[i]); in exynos_ohci_phy_disable()
119 * Right now device-tree probed devices don't get dma_mask set. in exynos_ohci_probe()
123 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in exynos_ohci_probe()
128 &pdev->dev, dev_name(&pdev->dev)); in exynos_ohci_probe()
130 dev_err(&pdev->dev, "Unable to create HCD\n"); in exynos_ohci_probe()
131 return -ENOMEM; in exynos_ohci_probe()
136 err = exynos_ohci_get_phy(&pdev->dev, exynos_ohci); in exynos_ohci_probe()
140 exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); in exynos_ohci_probe()
142 if (IS_ERR(exynos_ohci->clk)) { in exynos_ohci_probe()
143 dev_err(&pdev->dev, "Failed to get usbhost clock\n"); in exynos_ohci_probe()
144 err = PTR_ERR(exynos_ohci->clk); in exynos_ohci_probe()
148 err = clk_prepare_enable(exynos_ohci->clk); in exynos_ohci_probe()
152 hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in exynos_ohci_probe()
153 if (IS_ERR(hcd->regs)) { in exynos_ohci_probe()
154 err = PTR_ERR(hcd->regs); in exynos_ohci_probe()
157 hcd->rsrc_start = res->start; in exynos_ohci_probe()
158 hcd->rsrc_len = resource_size(res); in exynos_ohci_probe()
168 err = exynos_ohci_phy_enable(&pdev->dev); in exynos_ohci_probe()
170 dev_err(&pdev->dev, "Failed to enable USB phy\n"); in exynos_ohci_probe()
176 * Exynos OHCI port subnodes and generic USB device bindings in exynos_ohci_probe()
178 exynos_ohci->of_node = pdev->dev.of_node; in exynos_ohci_probe()
179 if (exynos_ohci->legacy_phy) in exynos_ohci_probe()
180 pdev->dev.of_node = NULL; in exynos_ohci_probe()
184 dev_err(&pdev->dev, "Failed to add USB HCD\n"); in exynos_ohci_probe()
187 device_wakeup_enable(hcd->self.controller); in exynos_ohci_probe()
191 exynos_ohci_phy_disable(&pdev->dev); in exynos_ohci_probe()
192 pdev->dev.of_node = exynos_ohci->of_node; in exynos_ohci_probe()
194 clk_disable_unprepare(exynos_ohci->clk); in exynos_ohci_probe()
205 pdev->dev.of_node = exynos_ohci->of_node; in exynos_ohci_remove()
209 exynos_ohci_phy_disable(&pdev->dev); in exynos_ohci_remove()
211 clk_disable_unprepare(exynos_ohci->clk); in exynos_ohci_remove()
220 if (hcd->driver->shutdown) in exynos_ohci_shutdown()
221 hcd->driver->shutdown(hcd); in exynos_ohci_shutdown()
237 clk_disable_unprepare(exynos_ohci->clk); in exynos_ohci_suspend()
248 clk_prepare_enable(exynos_ohci->clk); in exynos_ohci_resume()
253 clk_disable_unprepare(exynos_ohci->clk); in exynos_ohci_resume()
277 { .compatible = "samsung,exynos4210-ohci" },
288 .name = "exynos-ohci",
296 return -ENODEV; in ohci_exynos_init()
309 MODULE_ALIAS("platform:exynos-ohci");