From patchwork Thu Aug 13 03:25:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 1343982 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mediatek.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256 header.s=dk header.b=JQCz3X1A; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BRsSY5tkvz9sTM for ; Thu, 13 Aug 2020 13:27:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4B85E821B7; Thu, 13 Aug 2020 05:26:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=mediatek.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=mediatek.com header.i=@mediatek.com header.b="JQCz3X1A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 423FF821D0; Thu, 13 Aug 2020 05:26:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MIME_BASE64_TEXT,RDNS_NONE,SPF_HELO_NONE, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by phobos.denx.de (Postfix) with ESMTP id 51CEB81E6F for ; Thu, 13 Aug 2020 05:26:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=mediatek.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=chunfeng.yun@mediatek.com X-UUID: 44149c43585947ecb527e7f25282e076-20200813 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=OF42AjF8AtSi7JqQ+6UbnLj5IOovjZu8PqeAG9J4Ghw=; b=JQCz3X1A3Rza0j/Pe2ITPLjkWCud9C5agSI3uzoBtzvVEC1zfRgklAIddN6nSXZYDEev2S5y/6S1cChe4hcT0NhP1Olar0CrXQSs23Eb25HpaqetW+ehEhNjB16xWE5t15yrqRu+7Suy/qXYRA73HCnpPn9cyOuLz7ZRv/eYEPQ=; X-UUID: 44149c43585947ecb527e7f25282e076-20200813 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1839906745; Thu, 13 Aug 2020 11:26:27 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 13 Aug 2020 11:26:25 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 13 Aug 2020 11:26:25 +0800 From: Chunfeng Yun To: Marek Vasut , Bin Meng , Frank Wunderlich CC: Ryder Lee , Weijie Gao , GSS_MTK_Uboot_upstream , , Chunfeng Yun Subject: [PATCH 07/11] usb: xhci: convert to TRB_LEN() Date: Thu, 13 Aug 2020 11:25:04 +0800 Message-ID: <1597289108-22936-7-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597289108-22936-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597289108-22936-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: FCB3F228DDC99184718DC9149118134065F527C4BCDA6FDDC36DF0650B7095FD2000:8 X-MTK: N X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Use TRB_LEN(x) instead of ((x) & TRB_LEN_MASK) Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-ring.c | 8 ++++---- include/usb/xhci.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 16d2e02..99c84f9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -688,7 +688,7 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe, length, maxpacketsize, more_trbs_coming); - length_field = ((trb_buff_len & TRB_LEN_MASK) | + length_field = (TRB_LEN(trb_buff_len) | TRB_TD_SIZE(remainder) | TRB_INTR_TARGET(0)); @@ -848,7 +848,7 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe, trb_fields[1] = le16_to_cpu(req->index) | le16_to_cpu(req->length) << 16; /* TRB_LEN | (TRB_INTR_TARGET) */ - trb_fields[2] = (8 | TRB_INTR_TARGET(0)); + trb_fields[2] = (TRB_LEN(8) | TRB_INTR_TARGET(0)); /* Immediate data in pointer */ trb_fields[3] = field; queue_trb(ctrl, ep_ring, true, trb_fields); @@ -864,11 +864,11 @@ int xhci_ctrl_tx(struct usb_device *udev, unsigned long pipe, remainder = xhci_td_remainder(ctrl, 0, length, length, usb_maxpacket(udev, pipe), 1); - length_field = (length & TRB_LEN_MASK) | TRB_TD_SIZE(remainder) | + length_field = TRB_LEN(length) | TRB_TD_SIZE(remainder) | TRB_INTR_TARGET(0); debug("length_field = %d, length = %d," "xhci_td_remainder(length) = %d , TRB_INTR_TARGET(0) = %d\n", - length_field, (length & TRB_LEN_MASK), + length_field, TRB_LEN(length), TRB_TD_SIZE(remainder), 0); if (length > 0) { diff --git a/include/usb/xhci.h b/include/usb/xhci.h index ca3d99b..35c6604 100644 --- a/include/usb/xhci.h +++ b/include/usb/xhci.h @@ -847,7 +847,6 @@ struct xhci_event_cmd { /* Normal TRB fields */ /* transfer_len bitmasks - bits 0:16 */ #define TRB_LEN(p) ((p) & 0x1ffff) -#define TRB_LEN_MASK (0x1ffff) /* TD Size, packets remaining in this TD, bits 21:17 (5 bits, so max 31) */ #define TRB_TD_SIZE(p) (min((p), (u32)31) << 17) /* Interrupter Target - which MSI-X vector to target the completion event at */