2 * Copyright (c) 2015, Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
6 * SPDX-License-Identifier: GPL-2.0
17 * Create the appropriate control structures to manage a new XHCI host
20 int xhci_hcd_init(int index, struct xhci_hccr **ret_hccr,
21 struct xhci_hcor **ret_hcor)
23 struct xhci_hccr *hccr;
24 struct xhci_hcor *hcor;
29 pdev = pci_find_class(PCI_CLASS_SERIAL_USB_XHCI, index);
31 printf("XHCI host controller not found\n");
35 hccr = (struct xhci_hccr *)pci_map_bar(pdev,
36 PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
37 len = HC_LENGTH(xhci_readl(&hccr->cr_capbase));
38 hcor = (struct xhci_hcor *)((uint32_t)hccr + len);
40 debug("XHCI-PCI init hccr 0x%x and hcor 0x%x hc_length %d\n",
41 (uint32_t)hccr, (uint32_t)hcor, len);
46 /* enable busmaster */
47 pci_read_config_dword(pdev, PCI_COMMAND, &cmd);
48 cmd |= PCI_COMMAND_MASTER;
49 pci_write_config_dword(pdev, PCI_COMMAND, cmd);
55 * Destroy the appropriate control structures corresponding * to the XHCI host
58 void xhci_hcd_stop(int index)