| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xhci.c,v 1.142 2021/05/27 11:09:15 skrll Exp $ */ | | 1 | /* $NetBSD: xhci.c,v 1.143 2021/05/29 16:49:30 riastradh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2013 Jonathan A. Kollasch | | 4 | * Copyright (c) 2013 Jonathan A. Kollasch |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * USB rev 2.0 and rev 3.1 specification | | 30 | * USB rev 2.0 and rev 3.1 specification |
31 | * http://www.usb.org/developers/docs/ | | 31 | * http://www.usb.org/developers/docs/ |
32 | * xHCI rev 1.1 specification | | 32 | * xHCI rev 1.1 specification |
33 | * http://www.intel.com/technology/usb/spec.htm | | 33 | * http://www.intel.com/technology/usb/spec.htm |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.142 2021/05/27 11:09:15 skrll Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.143 2021/05/29 16:49:30 riastradh Exp $"); |
38 | | | 38 | |
39 | #ifdef _KERNEL_OPT | | 39 | #ifdef _KERNEL_OPT |
40 | #include "opt_usb.h" | | 40 | #include "opt_usb.h" |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/kmem.h> | | 46 | #include <sys/kmem.h> |
47 | #include <sys/device.h> | | 47 | #include <sys/device.h> |
48 | #include <sys/select.h> | | 48 | #include <sys/select.h> |
49 | #include <sys/proc.h> | | 49 | #include <sys/proc.h> |
50 | #include <sys/queue.h> | | 50 | #include <sys/queue.h> |
| @@ -1017,27 +1017,27 @@ xhci_resume(device_t self, const pmf_qua | | | @@ -1017,27 +1017,27 @@ xhci_resume(device_t self, const pmf_qua |
1017 | * xHC shall transmit the resume signaling | | 1017 | * xHC shall transmit the resume signaling |
1018 | * within 1ms (T_URSM). Software shall ensure | | 1018 | * within 1ms (T_URSM). Software shall ensure |
1019 | * that resume is signaled for at least 20ms | | 1019 | * that resume is signaled for at least 20ms |
1020 | * (T_DRSMDN). Software shall start timing | | 1020 | * (T_DRSMDN). Software shall start timing |
1021 | * T_DRSMDN from the write of ``15'' (Resume) | | 1021 | * T_DRSMDN from the write of ``15'' (Resume) |
1022 | * to PLS.' | | 1022 | * to PLS.' |
1023 | */ | | 1023 | */ |
1024 | if (bn == 1) { | | 1024 | if (bn == 1) { |
1025 | KASSERT(sc->sc_bus2.ub_revision == USBREV_2_0); | | 1025 | KASSERT(sc->sc_bus2.ub_revision == USBREV_2_0); |
1026 | v &= ~(XHCI_PS_PLS_MASK | XHCI_PS_CLEAR); | | 1026 | v &= ~(XHCI_PS_PLS_MASK | XHCI_PS_CLEAR); |
1027 | v |= XHCI_PS_LWS; | | 1027 | v |= XHCI_PS_LWS; |
1028 | v |= XHCI_PS_PLS_SET(XHCI_PS_PLS_SETRESUME); | | 1028 | v |= XHCI_PS_PLS_SET(XHCI_PS_PLS_SETRESUME); |
1029 | xhci_op_write_4(sc, port, v); | | 1029 | xhci_op_write_4(sc, port, v); |
1030 | usb_delay_ms(&sc->sc_bus, 20); | | 1030 | usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT); |
1031 | } else { | | 1031 | } else { |
1032 | KASSERT(sc->sc_bus.ub_revision > USBREV_2_0); | | 1032 | KASSERT(sc->sc_bus.ub_revision > USBREV_2_0); |
1033 | } | | 1033 | } |
1034 | | | 1034 | |
1035 | /* | | 1035 | /* |
1036 | * `For a USB3 protocol port [and a USB2 | | 1036 | * `For a USB3 protocol port [and a USB2 |
1037 | * protocol port after transitioning to | | 1037 | * protocol port after transitioning to |
1038 | * Resume], software shall write a ``0'' (U0) | | 1038 | * Resume], software shall write a ``0'' (U0) |
1039 | * to the PLS field...' | | 1039 | * to the PLS field...' |
1040 | */ | | 1040 | */ |
1041 | v = xhci_op_read_4(sc, port); | | 1041 | v = xhci_op_read_4(sc, port); |
1042 | v &= ~(XHCI_PS_PLS_MASK | XHCI_PS_CLEAR); | | 1042 | v &= ~(XHCI_PS_PLS_MASK | XHCI_PS_CLEAR); |
1043 | v |= XHCI_PS_LWS | XHCI_PS_PLS_SET(XHCI_PS_PLS_SETU0); | | 1043 | v |= XHCI_PS_LWS | XHCI_PS_PLS_SET(XHCI_PS_PLS_SETU0); |