2 * Copyright (C) 2015 Alexey Brodkin <abrodkin@synopsys.com>
4 * SPDX-License-Identifier: GPL-2.0+
13 * Even though here we don't explicitly use "struct ehci_ctrl"
14 * ehci_register() expects it to be the first thing that resides in
15 * device's private data.
18 struct ehci_ctrl ctrl;
21 static int ehci_usb_probe(struct udevice *dev)
23 struct ehci_hccr *hccr = (struct ehci_hccr *)dev_get_addr(dev);
24 struct ehci_hcor *hcor;
28 struct udevice *clk_dev;
31 clk_id = clk_get_by_index(dev, i, &clk_dev);
34 if (clk_enable(clk_dev, clk_id))
35 printf("failed to enable clock (dev=%s, id=%d)\n",
36 clk_dev->name, clk_id);
39 hcor = (struct ehci_hcor *)((uintptr_t)hccr +
40 HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
42 return ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST);
45 static int ehci_usb_remove(struct udevice *dev)
47 return ehci_deregister(dev);
50 static const struct udevice_id ehci_usb_ids[] = {
51 { .compatible = "generic-ehci" },
55 U_BOOT_DRIVER(ehci_generic) = {
56 .name = "ehci_generic",
58 .of_match = ehci_usb_ids,
59 .probe = ehci_usb_probe,
60 .remove = ehci_usb_remove,
62 .priv_auto_alloc_size = sizeof(struct generic_ehci),
63 .flags = DM_FLAG_ALLOC_PRIV_DMA,