]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: xhci: convert to HCS_MAX_PORTS()
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Tue, 8 Sep 2020 16:59:58 +0000 (18:59 +0200)
committerMarek Vasut <marex@denx.de>
Thu, 1 Oct 2020 17:43:05 +0000 (19:43 +0200)
Use HCS_MAX_PORTS(p) instead of
((p & HCS_MAX_PORTS_MASK) >> HCS_MAX_PORTS_SHIFT)

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/usb/host/xhci.c
include/usb/xhci.h

index 51edeb22c1429b6c6eec4eca5d028dd3555266ac..5f3a0fba4b56092f0e9f4eb569751fb316f73718 100644 (file)
@@ -1257,8 +1257,7 @@ static int xhci_lowlevel_init(struct xhci_ctrl *ctrl)
                return -ENOMEM;
 
        reg = xhci_readl(&hccr->cr_hcsparams1);
-       descriptor.hub.bNbrPorts = ((reg & HCS_MAX_PORTS_MASK) >>
-                                               HCS_MAX_PORTS_SHIFT);
+       descriptor.hub.bNbrPorts = HCS_MAX_PORTS(reg);
        printf("Register %x NbrPorts %d\n", reg, descriptor.hub.bNbrPorts);
 
        /* Port Indicators */
index 3de46cd95e7810a117645798f03b5d3134d299b6..cf4c0208b2d6db5c660975a05699b6f32025cd17 100644 (file)
@@ -101,8 +101,6 @@ struct xhci_hccr {
 /* bits 8:18, Max Interrupters */
 #define HCS_MAX_INTRS(p)       (((p) >> 8) & 0x7ff)
 /* bits 24:31, Max Ports - max value is 0x7F = 127 ports */
-#define HCS_MAX_PORTS_SHIFT    24
-#define HCS_MAX_PORTS_MASK     (0xff << HCS_MAX_PORTS_SHIFT)
 #define HCS_MAX_PORTS(p)       (((p) >> 24) & 0xff)
 
 /* HCSPARAMS2 - hcs_params2 - bitmasks */