2 * Copyright (C) 2014 Roman Byshko
4 * Roman Byshko <rbyshko@gmail.com>
7 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
9 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/arch/usbc.h>
16 int ehci_hcd_init(int index, enum usb_init_type init, struct ehci_hccr **hccr,
17 struct ehci_hcor **hcor)
21 err = sunxi_usbc_request_resources(index + 1);
25 sunxi_usbc_enable(index + 1);
26 sunxi_usbc_vbus_enable(index + 1);
28 *hccr = sunxi_usbc_get_io_base(index + 1);
30 *hcor = (struct ehci_hcor *)((uint32_t) *hccr
31 + HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
33 debug("sunxi-ehci: init hccr %x and hcor %x hc_length %d\n",
34 (uint32_t)*hccr, (uint32_t)*hcor,
35 (uint32_t)HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
40 int ehci_hcd_stop(int index)
42 sunxi_usbc_vbus_disable(index + 1);
43 sunxi_usbc_disable(index + 1);
45 return sunxi_usbc_free_resources(index + 1);