Lines Matching +full:usb +full:- +full:phy +full:- +full:controller

1 // SPDX-License-Identifier: GPL-2.0
3 * drivers/usb/host/ehci-orion.c
13 #include <linux/platform_data/usb-ehci-orion.h>
15 #include <linux/phy/phy.h>
16 #include <linux/usb.h>
17 #include <linux/usb/hcd.h>
19 #include <linux/dma-mapping.h>
23 #define rdl(off) readl_relaxed(hcd->regs + (off))
24 #define wrl(off, val) writel_relaxed((val), hcd->regs + (off))
59 #define hcd_to_orion_priv(h) ((struct orion_ehci_hcd *)hcd_to_ehci(h)->priv)
63 struct phy *phy; member
71 * a larger (34-bit) DMA mask, in order for DMA allocations
78 * Implement Orion USB controller specification guidelines
90 * Reset controller in orion_usb_phy_v1_setup()
96 * GL# USB-10: Set IPG for non start of frame packets in orion_usb_phy_v1_setup()
102 * GL# USB-9: USB 2.0 Power Control in orion_usb_phy_v1_setup()
108 * GL# USB-1: USB PHY Tx Control - force calibration to '8' in orion_usb_phy_v1_setup()
114 * GL# USB-3 GL# USB-9: USB PHY Rx Control in orion_usb_phy_v1_setup()
121 * GL# USB-3 GL# USB-9: USB PHY IVREF Control in orion_usb_phy_v1_setup()
127 * GL# USB-3 GL# USB-9: USB PHY Test Group Control in orion_usb_phy_v1_setup()
133 * Stop and reset controller in orion_usb_phy_v1_setup()
140 * GL# USB-5 Streaming disable REG_USB_MODE[4]=1 in orion_usb_phy_v1_setup()
142 * GL# USB-4 Setup USB Host mode in orion_usb_phy_v1_setup()
158 for (i = 0; i < dram->num_cs; i++) { in ehci_orion_conf_mbus_windows()
159 const struct mbus_dram_window *cs = dram->cs + i; in ehci_orion_conf_mbus_windows()
161 wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) | in ehci_orion_conf_mbus_windows()
162 (cs->mbus_attr << 8) | in ehci_orion_conf_mbus_windows()
163 (dram->mbus_dram_target_id << 4) | 1); in ehci_orion_conf_mbus_windows()
164 wrl(USB_WINDOW_BASE(i), cs->base); in ehci_orion_conf_mbus_windows()
170 struct device *dev = hcd->self.controller; in ehci_orion_drv_reset()
181 * sbuscfg reg has to be set after usb controller reset, otherwise in ehci_orion_drv_reset()
184 if (of_device_is_compatible(dev->of_node, "marvell,armada-3700-ehci")) in ehci_orion_drv_reset()
214 struct orion_ehci_data *pd = dev_get_platdata(&pdev->dev); in ehci_orion_drv_probe()
226 return -ENODEV; in ehci_orion_drv_probe()
228 pr_debug("Initializing Orion-SoC USB Host Controller\n"); in ehci_orion_drv_probe()
237 * Right now device-tree probed devices don't get dma_mask in ehci_orion_drv_probe()
238 * set. Since shared usb code relies on it, set it here for in ehci_orion_drv_probe()
241 dma_mask_ptr = (u64 *)of_device_get_match_data(&pdev->dev); in ehci_orion_drv_probe()
242 err = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr); in ehci_orion_drv_probe()
253 &pdev->dev, dev_name(&pdev->dev)); in ehci_orion_drv_probe()
255 err = -ENOMEM; in ehci_orion_drv_probe()
259 hcd->rsrc_start = res->start; in ehci_orion_drv_probe()
260 hcd->rsrc_len = resource_size(res); in ehci_orion_drv_probe()
261 hcd->regs = regs; in ehci_orion_drv_probe()
264 ehci->caps = hcd->regs + 0x100; in ehci_orion_drv_probe()
265 hcd->has_tt = 1; in ehci_orion_drv_probe()
272 priv->clk = devm_clk_get(&pdev->dev, NULL); in ehci_orion_drv_probe()
273 if (!IS_ERR(priv->clk)) { in ehci_orion_drv_probe()
274 err = clk_prepare_enable(priv->clk); in ehci_orion_drv_probe()
279 priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); in ehci_orion_drv_probe()
280 if (IS_ERR(priv->phy)) { in ehci_orion_drv_probe()
281 err = PTR_ERR(priv->phy); in ehci_orion_drv_probe()
282 if (err != -ENOSYS) in ehci_orion_drv_probe()
287 * (Re-)program MBUS remapping windows if we are asked to. in ehci_orion_drv_probe()
294 * setup Orion USB controller. in ehci_orion_drv_probe()
296 if (pdev->dev.of_node) in ehci_orion_drv_probe()
299 phy_version = pd->phy_version; in ehci_orion_drv_probe()
302 case EHCI_PHY_NA: /* dont change USB phy settings */ in ehci_orion_drv_probe()
310 dev_warn(&pdev->dev, "USB phy version isn't supported.\n"); in ehci_orion_drv_probe()
317 device_wakeup_enable(hcd->self.controller); in ehci_orion_drv_probe()
321 if (!IS_ERR(priv->clk)) in ehci_orion_drv_probe()
322 clk_disable_unprepare(priv->clk); in ehci_orion_drv_probe()
326 dev_err(&pdev->dev, "init %s fail, %d\n", in ehci_orion_drv_probe()
327 dev_name(&pdev->dev), err); in ehci_orion_drv_probe()
339 if (!IS_ERR(priv->clk)) in ehci_orion_drv_remove()
340 clk_disable_unprepare(priv->clk); in ehci_orion_drv_remove()
346 { .compatible = "marvell,orion-ehci", .data = &dma_mask_orion},
347 { .compatible = "marvell,armada-3700-ehci", .data = &dma_mask_orion},
348 { .compatible = "marvell,ac5-ehci", .data = &dma_mask_ac5},
358 .name = "orion-ehci",
367 return -ENODEV; in ehci_orion_init()
381 MODULE_ALIAS("platform:orion-ehci");