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>
18 #include <linux/usb.h>
19 #include <linux/usb/hcd.h>
21 #include <linux/dma-mapping.h>
25 #define rdl(off) readl_relaxed(hcd->regs + (off))
26 #define wrl(off, val) writel_relaxed((val), hcd->regs + (off))
61 #define hcd_to_orion_priv(h) ((struct orion_ehci_hcd *)hcd_to_ehci(h)->priv)
65 struct phy *phy; member
71 * Implement Orion USB controller specification guidelines
83 * Reset controller in orion_usb_phy_v1_setup()
89 * GL# USB-10: Set IPG for non start of frame packets in orion_usb_phy_v1_setup()
95 * GL# USB-9: USB 2.0 Power Control in orion_usb_phy_v1_setup()
101 * GL# USB-1: USB PHY Tx Control - force calibration to '8' in orion_usb_phy_v1_setup()
107 * GL# USB-3 GL# USB-9: USB PHY Rx Control in orion_usb_phy_v1_setup()
114 * GL# USB-3 GL# USB-9: USB PHY IVREF Control in orion_usb_phy_v1_setup()
120 * GL# USB-3 GL# USB-9: USB PHY Test Group Control in orion_usb_phy_v1_setup()
126 * Stop and reset controller in orion_usb_phy_v1_setup()
133 * GL# USB-5 Streaming disable REG_USB_MODE[4]=1 in orion_usb_phy_v1_setup()
135 * GL# USB-4 Setup USB Host mode in orion_usb_phy_v1_setup()
151 for (i = 0; i < dram->num_cs; i++) { in ehci_orion_conf_mbus_windows()
152 const struct mbus_dram_window *cs = dram->cs + i; in ehci_orion_conf_mbus_windows()
154 wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) | in ehci_orion_conf_mbus_windows()
155 (cs->mbus_attr << 8) | in ehci_orion_conf_mbus_windows()
156 (dram->mbus_dram_target_id << 4) | 1); in ehci_orion_conf_mbus_windows()
157 wrl(USB_WINDOW_BASE(i), cs->base); in ehci_orion_conf_mbus_windows()
163 struct device *dev = hcd->self.controller; in ehci_orion_drv_reset()
174 * sbuscfg reg has to be set after usb controller reset, otherwise in ehci_orion_drv_reset()
177 if (of_device_is_compatible(dev->of_node, "marvell,armada-3700-ehci")) in ehci_orion_drv_reset()
207 struct orion_ehci_data *pd = dev_get_platdata(&pdev->dev); in ehci_orion_drv_probe()
218 return -ENODEV; in ehci_orion_drv_probe()
220 pr_debug("Initializing Orion-SoC USB Host Controller\n"); in ehci_orion_drv_probe()
224 err = -ENODEV; in ehci_orion_drv_probe()
229 * Right now device-tree probed devices don't get dma_mask in ehci_orion_drv_probe()
230 * set. Since shared usb code relies on it, set it here for in ehci_orion_drv_probe()
233 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in ehci_orion_drv_probe()
238 regs = devm_ioremap_resource(&pdev->dev, res); in ehci_orion_drv_probe()
245 &pdev->dev, dev_name(&pdev->dev)); in ehci_orion_drv_probe()
247 err = -ENOMEM; in ehci_orion_drv_probe()
251 hcd->rsrc_start = res->start; in ehci_orion_drv_probe()
252 hcd->rsrc_len = resource_size(res); in ehci_orion_drv_probe()
253 hcd->regs = regs; in ehci_orion_drv_probe()
256 ehci->caps = hcd->regs + 0x100; in ehci_orion_drv_probe()
257 hcd->has_tt = 1; in ehci_orion_drv_probe()
264 priv->clk = devm_clk_get(&pdev->dev, NULL); in ehci_orion_drv_probe()
265 if (!IS_ERR(priv->clk)) { in ehci_orion_drv_probe()
266 err = clk_prepare_enable(priv->clk); in ehci_orion_drv_probe()
271 priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); in ehci_orion_drv_probe()
272 if (IS_ERR(priv->phy)) { in ehci_orion_drv_probe()
273 err = PTR_ERR(priv->phy); in ehci_orion_drv_probe()
274 if (err != -ENOSYS) in ehci_orion_drv_probe()
279 * (Re-)program MBUS remapping windows if we are asked to. in ehci_orion_drv_probe()
286 * setup Orion USB controller. in ehci_orion_drv_probe()
288 if (pdev->dev.of_node) in ehci_orion_drv_probe()
291 phy_version = pd->phy_version; in ehci_orion_drv_probe()
294 case EHCI_PHY_NA: /* dont change USB phy settings */ in ehci_orion_drv_probe()
302 dev_warn(&pdev->dev, "USB phy version isn't supported.\n"); in ehci_orion_drv_probe()
309 device_wakeup_enable(hcd->self.controller); in ehci_orion_drv_probe()
313 if (!IS_ERR(priv->clk)) in ehci_orion_drv_probe()
314 clk_disable_unprepare(priv->clk); in ehci_orion_drv_probe()
318 dev_err(&pdev->dev, "init %s fail, %d\n", in ehci_orion_drv_probe()
319 dev_name(&pdev->dev), err); in ehci_orion_drv_probe()
331 if (!IS_ERR(priv->clk)) in ehci_orion_drv_remove()
332 clk_disable_unprepare(priv->clk); in ehci_orion_drv_remove()
340 { .compatible = "marvell,orion-ehci", },
341 { .compatible = "marvell,armada-3700-ehci", },
351 .name = "orion-ehci",
360 return -ENODEV; in ehci_orion_init()
374 MODULE_ALIAS("platform:orion-ehci");