Adding more USB hardware information for RK3568

This commit is contained in:
xj 2024-06-28 04:32:00 -07:00
parent 41a4e81d7d
commit 9ce7259447
1 changed files with 15 additions and 4 deletions

View File

@ -196,15 +196,26 @@ static void xhci_init ( struct xhci_host *xhci, void *regs ) {
cap_vir_addr = usb_hc_get_register_vir_base(id);
if(!mmap(cap_vir_addr, regs, USB3_ADDR_OFFSET_UPPER_BOUND, true)){
return;
}
caplength = readb ( xhci->cap + XHCI_CAP_CAPLENGTH );
rtsoff = readl ( xhci->cap + XHCI_CAP_RTSOFF );
dboff = readl ( xhci->cap + XHCI_CAP_DBOFF );
xhci->cap_addr = xhci->base_addr = cap_vir_addr;
// caplength = readb ( xhci->cap + XHCI_CAP_CAPLENGTH );
caplength = readb ( xhci->cap_addr + XHCI_CAP_CAPLENGTH );
// rtsoff = readl ( xhci->cap + XHCI_CAP_RTSOFF );
rtsoff = readl ( xhci->cap_addr + XHCI_CAP_RTSOFF );
// dboff = readl ( xhci->cap + XHCI_CAP_DBOFF );
dboff = readl ( xhci->cap_addr + XHCI_CAP_DBOFF );
xhci->op = ( xhci->cap + caplength );
xhci->op_addr = ( xhci->cap_addr + caplength );
xhci->run = ( xhci->cap + rtsoff );
xhci->run_addr = ( xhci->cap_addr + rtsoff );
xhci->db = ( xhci->cap + dboff );
xhci->db_addr = ( xhci->cap_addr + dboff );
/* avoid access XHCI_REG_CAP_HCIVERSION = 0x2, unaligned memory */
xhci->version = ((readl ( xhci->cap + XHCI_CAP_CAPLENGTH ) >> 16) & 0xffff);