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
69 * Implement Orion USB controller specification guidelines
81 * Reset controller in orion_usb_phy_v1_setup()
87 * GL# USB-10: Set IPG for non start of frame packets in orion_usb_phy_v1_setup()
93 * GL# USB-9: USB 2.0 Power Control in orion_usb_phy_v1_setup()
99 * GL# USB-1: USB PHY Tx Control - force calibration to '8' in orion_usb_phy_v1_setup()
105 * GL# USB-3 GL# USB-9: USB PHY Rx Control in orion_usb_phy_v1_setup()
112 * GL# USB-3 GL# USB-9: USB PHY IVREF Control in orion_usb_phy_v1_setup()
118 * GL# USB-3 GL# USB-9: USB PHY Test Group Control in orion_usb_phy_v1_setup()
124 * Stop and reset controller in orion_usb_phy_v1_setup()
131 * GL# USB-5 Streaming disable REG_USB_MODE[4]=1 in orion_usb_phy_v1_setup()
133 * GL# USB-4 Setup USB Host mode in orion_usb_phy_v1_setup()
149 for (i = 0; i < dram->num_cs; i++) { in ehci_orion_conf_mbus_windows()
150 const struct mbus_dram_window *cs = dram->cs + i; in ehci_orion_conf_mbus_windows()
152 wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) | in ehci_orion_conf_mbus_windows()
153 (cs->mbus_attr << 8) | in ehci_orion_conf_mbus_windows()
154 (dram->mbus_dram_target_id << 4) | 1); in ehci_orion_conf_mbus_windows()
155 wrl(USB_WINDOW_BASE(i), cs->base); in ehci_orion_conf_mbus_windows()
161 struct device *dev = hcd->self.controller; in ehci_orion_drv_reset()
172 * sbuscfg reg has to be set after usb controller reset, otherwise in ehci_orion_drv_reset()
175 if (of_device_is_compatible(dev->of_node, "marvell,armada-3700-ehci")) in ehci_orion_drv_reset()
205 struct orion_ehci_data *pd = dev_get_platdata(&pdev->dev); in ehci_orion_drv_probe()
216 return -ENODEV; in ehci_orion_drv_probe()
218 pr_debug("Initializing Orion-SoC USB Host Controller\n"); in ehci_orion_drv_probe()
227 * Right now device-tree probed devices don't get dma_mask in ehci_orion_drv_probe()
228 * set. Since shared usb code relies on it, set it here for in ehci_orion_drv_probe()
231 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in ehci_orion_drv_probe()
242 &pdev->dev, dev_name(&pdev->dev)); in ehci_orion_drv_probe()
244 err = -ENOMEM; in ehci_orion_drv_probe()
248 hcd->rsrc_start = res->start; in ehci_orion_drv_probe()
249 hcd->rsrc_len = resource_size(res); in ehci_orion_drv_probe()
250 hcd->regs = regs; in ehci_orion_drv_probe()
253 ehci->caps = hcd->regs + 0x100; in ehci_orion_drv_probe()
254 hcd->has_tt = 1; in ehci_orion_drv_probe()
261 priv->clk = devm_clk_get(&pdev->dev, NULL); in ehci_orion_drv_probe()
262 if (!IS_ERR(priv->clk)) { in ehci_orion_drv_probe()
263 err = clk_prepare_enable(priv->clk); in ehci_orion_drv_probe()
268 priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); in ehci_orion_drv_probe()
269 if (IS_ERR(priv->phy)) { in ehci_orion_drv_probe()
270 err = PTR_ERR(priv->phy); in ehci_orion_drv_probe()
271 if (err != -ENOSYS) in ehci_orion_drv_probe()
276 * (Re-)program MBUS remapping windows if we are asked to. in ehci_orion_drv_probe()
283 * setup Orion USB controller. in ehci_orion_drv_probe()
285 if (pdev->dev.of_node) in ehci_orion_drv_probe()
288 phy_version = pd->phy_version; in ehci_orion_drv_probe()
291 case EHCI_PHY_NA: /* dont change USB phy settings */ in ehci_orion_drv_probe()
299 dev_warn(&pdev->dev, "USB phy version isn't supported.\n"); in ehci_orion_drv_probe()
306 device_wakeup_enable(hcd->self.controller); in ehci_orion_drv_probe()
310 if (!IS_ERR(priv->clk)) in ehci_orion_drv_probe()
311 clk_disable_unprepare(priv->clk); in ehci_orion_drv_probe()
315 dev_err(&pdev->dev, "init %s fail, %d\n", in ehci_orion_drv_probe()
316 dev_name(&pdev->dev), err); in ehci_orion_drv_probe()
328 if (!IS_ERR(priv->clk)) in ehci_orion_drv_remove()
329 clk_disable_unprepare(priv->clk); in ehci_orion_drv_remove()
335 { .compatible = "marvell,orion-ehci", },
336 { .compatible = "marvell,armada-3700-ehci", },
346 .name = "orion-ehci",
355 return -ENODEV; in ehci_orion_init()
369 MODULE_ALIAS("platform:orion-ehci");