diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2014-07-12 15:53:45 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2014-07-12 15:53:45 +0000 |
commit | bda563aab0d13daedfc0a5f6add19e1d8e09281d (patch) | |
tree | ced539679302ae8d8310e9e9fee3d5f282166e08 /sys/arch | |
parent | 4935a917200b997c76b8ecbaf9fccd02ff2daea7 (diff) |
Add support for Get Port Status requests.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/octeon/dev/octhci.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/sys/arch/octeon/dev/octhci.c b/sys/arch/octeon/dev/octhci.c index a7a0679c188..7cdd7b03ace 100644 --- a/sys/arch/octeon/dev/octhci.c +++ b/sys/arch/octeon/dev/octhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: octhci.c,v 1.9 2014/07/12 15:30:43 pirofti Exp $ */ +/* $OpenBSD: octhci.c,v 1.10 2014/07/12 15:53:44 pirofti Exp $ */ /* * Copyright (c) 2014 Paul Irofti <pirofti@openbsd.org> @@ -652,7 +652,7 @@ octhci_root_ctrl_start(struct usbd_xfer *xfer) int l, totlen = 0; int i; /* int port; */ - /* uint32_t v; */ + uint32_t v; KASSERT(xfer->rqflags & URQ_REQUEST); @@ -874,41 +874,40 @@ octhci_root_ctrl_start(struct usbd_xfer *xfer) err = USBD_IOERROR; goto ret; } -#if 0 - v = XOREAD4(sc, XHCI_PORTSC(index)); - DPRINTFN(8,("xhci_root_ctrl_start: port status=0x%04x\n", v)); - switch (XHCI_PS_SPEED(v)) { - case XHCI_SPEED_FULL: + + v = octhci_regc_read(sc, USBC_HPRT_OFFSET); + DPRINTFN(8,("octhci_root_ctrl_start: port status=0x%04x\n", v)); + switch ((v & USBC_HPRT_PRTSPD) >> USBC_HPRT_PRTSPD_OFFSET) { + case USBC_HPRT_PRTSPD_FULL: i = UPS_FULL_SPEED; break; - case XHCI_SPEED_LOW: + case USBC_HPRT_PRTSPD_LOW: i = UPS_LOW_SPEED; break; - case XHCI_SPEED_HIGH: - i = UPS_HIGH_SPEED; - break; - case XHCI_SPEED_SUPER: + case USBC_HPRT_PRTSPD_HIGH: default: - i = UPS_SUPER_SPEED; + i = UPS_HIGH_SPEED; break; } - if (v & XHCI_PS_CCS) i |= UPS_CURRENT_CONNECT_STATUS; - if (v & XHCI_PS_PED) i |= UPS_PORT_ENABLED; - if (v & XHCI_PS_OCA) i |= UPS_OVERCURRENT_INDICATOR; - if (v & XHCI_PS_PR) i |= UPS_RESET; - if (v & XHCI_PS_PP) i |= UPS_PORT_POWER; - USETW(ps.wPortStatus, i); - i = 0; - if (v & XHCI_PS_CSC) i |= UPS_C_CONNECT_STATUS; - if (v & XHCI_PS_PEC) i |= UPS_C_PORT_ENABLED; - if (v & XHCI_PS_OCC) i |= UPS_C_OVERCURRENT_INDICATOR; - if (v & XHCI_PS_PRC) i |= UPS_C_PORT_RESET; -#endif - i = UPS_HIGH_SPEED; + if (v & USBC_HPRT_PRTCONNSTS) + i |= UPS_CURRENT_CONNECT_STATUS; + if (v & USBC_HPRT_PRTENA) + i |= UPS_PORT_ENABLED; + if (v & USBC_HPRT_PRTOVRCURRACT) + i |= UPS_OVERCURRENT_INDICATOR; + if (v & USBC_HPRT_PRTRST) + i |= UPS_RESET; + if (v & USBC_HPRT_PRTPWR) + i |= UPS_PORT_POWER; USETW(ps.wPortStatus, i); i = 0; - i |= UPS_C_PORT_ENABLED; + if (v & USBC_HPRT_PRTCONNDET) + i |= UPS_C_CONNECT_STATUS; + if (v & USBC_HPRT_PRTENCHNG) + i |= UPS_C_PORT_ENABLED; + if (v & USBC_HPRT_PRTOVRCURRCHNG) + i |= UPS_C_OVERCURRENT_INDICATOR; USETW(ps.wPortChange, i); l = min(len, sizeof ps); |