2 * Copyright (C) 2015 Marvell International Ltd.
4 * MVEBU USB HOST xHCI Controller
6 * SPDX-License-Identifier: GPL-2.0+
17 DECLARE_GLOBAL_DATA_PTR;
19 struct mvebu_xhci_platdata {
24 * Contains pointers to register base addresses
25 * for the usb controller.
28 struct xhci_ctrl ctrl; /* Needs to come first in this struct! */
29 struct usb_platdata usb_plat;
30 struct xhci_hccr *hcd;
34 * Dummy implementation that can be overwritten by a board
37 __weak int board_xhci_enable(void)
42 static int xhci_usb_probe(struct udevice *dev)
44 struct mvebu_xhci_platdata *plat = dev_get_platdata(dev);
45 struct mvebu_xhci *ctx = dev_get_priv(dev);
46 struct xhci_hcor *hcor;
49 ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
50 len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
51 hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
53 /* Enable USB xHCI (VBUS, reset etc) in board specific code */
56 return xhci_register(dev, ctx->hcd, hcor);
59 static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
61 struct mvebu_xhci_platdata *plat = dev_get_platdata(dev);
64 * Get the base address for XHCI controller from the device node
66 plat->hcd_base = dev_get_addr(dev);
67 if (plat->hcd_base == FDT_ADDR_T_NONE) {
68 debug("Can't get the XHCI register base address\n");
75 static const struct udevice_id xhci_usb_ids[] = {
76 { .compatible = "marvell,armada3700-xhci" },
77 { .compatible = "marvell,armada-8k-xhci" },
81 U_BOOT_DRIVER(usb_xhci) = {
84 .of_match = xhci_usb_ids,
85 .ofdata_to_platdata = xhci_usb_ofdata_to_platdata,
86 .probe = xhci_usb_probe,
87 .remove = xhci_deregister,
89 .platdata_auto_alloc_size = sizeof(struct mvebu_xhci_platdata),
90 .priv_auto_alloc_size = sizeof(struct mvebu_xhci),
91 .flags = DM_FLAG_ALLOC_PRIV_DMA,