Lines Matching +full:usb +full:- +full:ehci
1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for EHCI UHP on Atmel chips
8 * Based on various ehci-*.c drivers
12 #include <linux/dma-mapping.h>
19 #include <linux/usb.h>
20 #include <linux/usb/hcd.h>
21 #include <linux/usb/phy.h>
22 #include <linux/usb/of.h>
24 #include "ehci.h"
26 #define DRIVER_DESC "EHCI Atmel driver"
33 ((struct atmel_ehci_priv *)hcd_to_ehci(h)->priv)
47 /*-------------------------------------------------------------------------*/
51 if (atmel_ehci->clocked) in atmel_start_clock()
54 clk_prepare_enable(atmel_ehci->uclk); in atmel_start_clock()
55 clk_prepare_enable(atmel_ehci->iclk); in atmel_start_clock()
56 atmel_ehci->clocked = true; in atmel_start_clock()
61 if (!atmel_ehci->clocked) in atmel_stop_clock()
64 clk_disable_unprepare(atmel_ehci->iclk); in atmel_stop_clock()
65 clk_disable_unprepare(atmel_ehci->uclk); in atmel_stop_clock()
66 atmel_ehci->clocked = false; in atmel_stop_clock()
74 dev_dbg(&pdev->dev, "start\n"); in atmel_start_ehci()
83 dev_dbg(&pdev->dev, "stop\n"); in atmel_stop_ehci()
87 /*-------------------------------------------------------------------------*/
94 struct ehci_hcd *ehci; in ehci_atmel_drv_probe() local
100 return -ENODEV; in ehci_atmel_drv_probe()
102 pr_debug("Initializing Atmel-SoC USB Host Controller\n"); in ehci_atmel_drv_probe()
110 /* Right now device-tree probed devices don't get dma_mask set. in ehci_atmel_drv_probe()
111 * Since shared usb code relies on it, set it here for now. in ehci_atmel_drv_probe()
114 retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in ehci_atmel_drv_probe()
118 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); in ehci_atmel_drv_probe()
120 retval = -ENOMEM; in ehci_atmel_drv_probe()
125 hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in ehci_atmel_drv_probe()
126 if (IS_ERR(hcd->regs)) { in ehci_atmel_drv_probe()
127 retval = PTR_ERR(hcd->regs); in ehci_atmel_drv_probe()
131 hcd->rsrc_start = res->start; in ehci_atmel_drv_probe()
132 hcd->rsrc_len = resource_size(res); in ehci_atmel_drv_probe()
134 atmel_ehci->iclk = devm_clk_get(&pdev->dev, "ehci_clk"); in ehci_atmel_drv_probe()
135 if (IS_ERR(atmel_ehci->iclk)) { in ehci_atmel_drv_probe()
136 dev_err(&pdev->dev, "Error getting interface clock\n"); in ehci_atmel_drv_probe()
137 retval = -ENOENT; in ehci_atmel_drv_probe()
141 atmel_ehci->uclk = devm_clk_get(&pdev->dev, "usb_clk"); in ehci_atmel_drv_probe()
142 if (IS_ERR(atmel_ehci->uclk)) { in ehci_atmel_drv_probe()
143 dev_err(&pdev->dev, "failed to get uclk\n"); in ehci_atmel_drv_probe()
144 retval = PTR_ERR(atmel_ehci->uclk); in ehci_atmel_drv_probe()
148 ehci = hcd_to_ehci(hcd); in ehci_atmel_drv_probe()
150 ehci->caps = hcd->regs; in ehci_atmel_drv_probe()
157 device_wakeup_enable(hcd->self.controller); in ehci_atmel_drv_probe()
159 if (of_usb_get_phy_mode(pdev->dev.of_node) == USBPHY_INTERFACE_MODE_HSIC) in ehci_atmel_drv_probe()
160 writel(EHCI_INSNREG08_HSIC_EN, hcd->regs + EHCI_INSNREG(8)); in ehci_atmel_drv_probe()
169 dev_err(&pdev->dev, "init %s fail, %d\n", in ehci_atmel_drv_probe()
170 dev_name(&pdev->dev), retval); in ehci_atmel_drv_probe()
211 { .compatible = "atmel,at91sam9g45-ehci" },
226 .name = "atmel-ehci",
235 return -ENODEV; in ehci_atmel_init()
249 MODULE_ALIAS("platform:atmel-ehci");