From patchwork Wed Aug 19 12:40:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11724031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 005C3618 for ; Wed, 19 Aug 2020 12:55:08 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC2C82173E for ; Wed, 19 Aug 2020 12:55:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GzzFJKQ+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="KIsy7nfM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC2C82173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=7eEzjY50auMmHNGbIv2iX0gsGNtQmCJ0XweWvSKyKXU=; b=GzzFJKQ+cansVpg0cmEqcTTCWq agnp/SMEfakzEvvYRUNKCDm0K/mgOvg6IcdBj57vNDZe+wdiQMydiLEOn3Ig4T+3QAJar+E5oopK0 /siUd6BlsAra5FeL2MLU4R1lwHxMHj3pOybp5qIEePtewIqRMYBa9LlHbw1DomhQ7rwP7D+H64uG5 PDpnun/9TE6VMWAcUf/dhfEQMBxGK/6XUfJp6gmvMJo6NAM37rFL/wEg3gV2EgoPcrbIbqsolP8U8 qs4t1CEQEiKfaUUc9dTawM3ho57BtEfUxN3q3eJskKzCXq1I8h1SUvoIhMcp4JQewKGi4hXTGPfXC OwBbTUeg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8Naq-0006lG-8A; Wed, 19 Aug 2020 12:53:28 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NaI-0006Wk-7a; Wed, 19 Aug 2020 12:52:55 +0000 X-UUID: 2bc6541cdc734cb88c58fb1a11ab56df-20200819 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:Message-ID:Date:Subject:CC:To:From; bh=+3z+T7GeyoHeHwhU3UCJLeddq0B7PomhVS6LM+oEBwA=; b=KIsy7nfMKkpkQgA/qcgtoxI4fmbl1kJLdsqYq9+YInT6PLqSXvxmOSQNgjUOZj39vB94nLDK10G1l89srJH8f64XSki9VUxfbiV5QxrTmedLU+7uBPca/ujyQMOizIUWulXLlCe0IQilOmCLX/j/LSBtB1/BzjudJLRPtvvpQ4k=; X-UUID: 2bc6541cdc734cb88c58fb1a11ab56df-20200819 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1073075100; Wed, 19 Aug 2020 04:52:50 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:48 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:42 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:42 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 01/10] usb: early: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:40:56 +0800 Message-ID: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-TM-SNTS-SMTP: 11A0FBB927ECEBA7F7FD5B2A90D46DA3FD7D363E0C47726682BD5434B97E97B02000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_085254_550346_12A98033 X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org, Lu Baolu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Cc: Lu Baolu Cc: Mathias Nyman Signed-off-by: Chunfeng Yun --- drivers/usb/early/xhci-dbc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c index c050776..be4ecba 100644 --- a/drivers/usb/early/xhci-dbc.c +++ b/drivers/usb/early/xhci-dbc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -135,16 +136,9 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait, int delay) { u32 result; - do { - result = readl(ptr); - result &= mask; - if (result == done) - return 0; - udelay(delay); - wait -= delay; - } while (wait > 0); - - return -ETIMEDOUT; + return readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done), + delay, wait); } static void __init xdbc_bios_handoff(void) From patchwork Wed Aug 19 12:40:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC56413A4 for ; Wed, 19 Aug 2020 12:43:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1D88206B5 for ; Wed, 19 Aug 2020 12:43:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ws2CrRw8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="symRFg/p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1D88206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QPZHvhZOTATyrMyQcgpwdK+bkivzjPf3GiELYubfehU=; b=ws2CrRw8j4amJx8aNCPWWiW7X v3lufF8Oxl/et13Gr3jU/b39ofj3+AtUWF8kWYBk6IChseqaEdLc8eXcCNjaUB6EDn/WC4yJAa+6y FKuXJ9vwOFcjAlnR5KelU6+dDKIhpBNQLDrff/bL6SY83443cX5gZpteET0B22pEebSO58SwASbZj Y4Ijrh4e+JhC2M6xteDXpnx8ogcF3J/7VbLEQBxnX7RmfltWp5MkV2V2x5Cz1GkSm6pUoJEVpFLJH FatZLnN/2MDi7PWiSIdMP3YXH5DYf64ABKL48YifsYlRalcPh9a7ct1WZZvV/jMdaTa8s6r4F5L+M bR+uNjeqA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQn-0001tc-UR; Wed, 19 Aug 2020 12:43:05 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQe-0001pA-AR; Wed, 19 Aug 2020 12:42:57 +0000 X-UUID: 8363af15f11b4356bd22353fcc97a2f5-20200819 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=gbEvkNvLGl7XkhJbIl8Am9oqDys+ugPHHJ4cNwALPbg=; b=symRFg/pIqoSot9Y2muUGLgHLRU5BFlxhtrrtLlDiRT0puX2QLaDnYPRIZ5IOedhljC+9Yavplcf/8fh6m3N/L+Wnmlm+GVDQ0R99JXCXtlZ8YN6vzQnjGyCsz/JOCPLRi9Fc1opUf1WVuUa2lWoVEKcUFYRWTIg3qLEoEFWJOM=; X-UUID: 8363af15f11b4356bd22353fcc97a2f5-20200819 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1978801214; Wed, 19 Aug 2020 04:42:51 -0800 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:48 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:44 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:43 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 02/10] usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:40:57 +0800 Message-ID: <1597840865-26631-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 65E32546313909D0757CC1C22E12E8B6E09145F4B7102037ADFB3A642D9C03412000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084256_558644_3AEABE5E X-CRM114-Status: GOOD ( 15.36 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Petr Mladek , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, "Eric W. Biederman" , Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Cc: "Eric W. Biederman" Cc: Petr Mladek Signed-off-by: Chunfeng Yun --- drivers/usb/early/ehci-dbgp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c index b075dbf..45b42d8 100644 --- a/drivers/usb/early/ehci-dbgp.c +++ b/drivers/usb/early/ehci-dbgp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -161,17 +162,11 @@ static inline u32 dbgp_pid_read_update(u32 x, u32 tok) static int dbgp_wait_until_complete(void) { u32 ctrl; - int loop = DBGP_TIMEOUT; - - do { - ctrl = readl(&ehci_debug->control); - /* Stop when the transaction is finished */ - if (ctrl & DBGP_DONE) - break; - udelay(1); - } while (--loop > 0); + int ret; - if (!loop) + ret = readl_poll_timeout_atomic(&ehci_debug->control, ctrl, + (ctrl & DBGP_DONE), 1, DBGP_TIMEOUT); + if (ret) return -DBGP_TIMEOUT; /* From patchwork Wed Aug 19 12:40:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 064CC138C for ; Wed, 19 Aug 2020 12:44:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1C42206B5 for ; Wed, 19 Aug 2020 12:44:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PHC5HnvM"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="D2VdRfCZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1C42206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=q3cmFcrhuUtqX2+1b2oPEyEXAFYejPLDit4ZDGAZuQ4=; b=PHC5HnvM2OEA+T859HK3f3E3X W+6TIU2y1DIa5S39xErpfNOtv9KVrqZa+RaQAK4p3D35v5w1PDa5wRBY8YnRMcLJf1izlQ9nLiM23 B5IWrU8pDnmbFkTj0jXWwicdIRY4vRwo+araBQEKsr2tzCFhFyt518fKuDLcDawdOs3hObdKE/+7a uZjS1mo5T7iC0+YISbBA0pRWNA7Y0wY61jH9sbFZV1KhtxqRCwRNv2Tjx5iplU4sDBlWpWfR15RF3 gOurPVwons8XzR7ECcPDofMDl9WjDT/yadlsWDocuqBAXhaF5pqdIiMxG7Fp0pZLSJFBXlfvrAqho cyW7Mkabg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQk-0001rv-Iv; Wed, 19 Aug 2020 12:43:02 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQe-0001or-AR; Wed, 19 Aug 2020 12:42:57 +0000 X-UUID: 36b77b703ef74bd491df73341d88b969-20200819 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=b6owPCjpasIYidgAsRKMlqeM1EqM75qi1guA0uBBWPk=; b=D2VdRfCZPov7x0Q60+MMI16NKwrzI8UNqhVXwxZ871VCbMCHcN46XKl1t4wqBIGwj66oseTIjXIEzb1lbENdf8WF9UHGIuVaqaL9fHqmcoMr5D6WwknValScNaO+VAhOAUmyk7peuW3QabOfYyJ9wmgXE02ynruNqsAinpA7ApA=; X-UUID: 36b77b703ef74bd491df73341d88b969-20200819 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 513644048; Wed, 19 Aug 2020 04:42:51 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:49 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:45 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:44 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 03/10] usb: pci-quirks: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:40:58 +0800 Message-ID: <1597840865-26631-3-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 06646778FB2686F5E984FAB9759175ECDE1BBAA36A064A42CB520E8BAA7E74D02000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084256_561111_9132B7C5 X-CRM114-Status: GOOD ( 14.13 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Cc: Mathias Nyman Signed-off-by: Chunfeng Yun --- drivers/usb/host/pci-quirks.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index b8961c0..8920566 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -1012,15 +1013,9 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, { u32 result; - do { - result = readl(ptr); - result &= mask; - if (result == done) - return 0; - udelay(delay_usec); - wait_usec -= delay_usec; - } while (wait_usec > 0); - return -ETIMEDOUT; + return readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done), + delay_usec, wait_usec); } /* From patchwork Wed Aug 19 12:40:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11724033 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF114618 for ; Wed, 19 Aug 2020 12:55:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87BE021744 for ; Wed, 19 Aug 2020 12:55:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ca0znSrc"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="anVGfFPS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87BE021744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NcB2cQvxjIFyFwEfkNOoOv/kj+7czKXnlkbcJDkyJnA=; b=Ca0znSrcDNn5wckNe6D3M/6rR TqpXoyxPUDpW+ygcDk1bbSKitB3J4VPjB9wOE++C2HrLKCjd57aatHATe88kGuiHI6Mt7MAxYKtcF nxBtiMzu7/l32sK8psXvL/OZWmwWMxUZHjucTuYD1OgJociE3/fdGnKxh9ZSrJkBmJGy68wPdeSyg /gYzeNiVaEf+6NMgj6NNyz/Vsiu4xfGFFawT6/OcNM6yF5Ne0lLV0Wh6czqxdtEFgvptW8Cg6a61g bvNZVbHhWvQkav1dHfjpG/JSHro/FLAc7PkXCzWx5BZF6leZUHwYfFrwMWTnqJT3fjF097bdPTP5W vB4dilSPw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8Nb1-0006t7-6b; Wed, 19 Aug 2020 12:53:39 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NaK-0006Wk-0e; Wed, 19 Aug 2020 12:52:57 +0000 X-UUID: 1cc1bb77f1114eb888a6f0946269295d-20200819 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=AQIMWJYfBrMtRgOV2GfpNte4cp/Qee5OO3k+Wl9/GA0=; b=anVGfFPSZJTh3Hjxn0ixqNUitHVdfhtXF5gVIt/YJJ9pvBQPlLxlb4N7eUThZKN+N8AUZZg9SEJh6Hc9qvhFEUZ3UQPKfAWV79mmeTz0ecMgdN/DRuedCaP1AVWtUE6jYUCAB9JYMBRMRvcxPgS7ZPfbe4AXt9h2BRtsYHnCWZw=; X-UUID: 1cc1bb77f1114eb888a6f0946269295d-20200819 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 592649390; Wed, 19 Aug 2020 04:52:50 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:49 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:46 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:45 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 04/10] usb: xhci-rcar: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:40:59 +0800 Message-ID: <1597840865-26631-4-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: BCE825A1C94D2720BFEDB625C7672783B5064235399A4E02EC7DCDEB11E3DB422000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_085256_303201_05E990A9 X-CRM114-Status: GOOD ( 16.29 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Mathias Nyman , Yoshihiro Shimoda , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Cc: Mathias Nyman Cc: Yoshihiro Shimoda Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-rcar.c | 43 ++++++++++++------------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index c1025d3..74f836f 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -127,8 +128,7 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd) void __iomem *regs = hcd->regs; struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); const struct firmware *fw; - int retval, index, j, time; - int timeout = 10000; + int retval, index, j; u32 data, val, temp; u32 quirks = 0; const struct soc_device_attribute *attr; @@ -166,32 +166,19 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd) temp |= RCAR_USB3_DL_CTRL_FW_SET_DATA0; writel(temp, regs + RCAR_USB3_DL_CTRL); - for (time = 0; time < timeout; time++) { - val = readl(regs + RCAR_USB3_DL_CTRL); - if ((val & RCAR_USB3_DL_CTRL_FW_SET_DATA0) == 0) - break; - udelay(1); - } - if (time == timeout) { - retval = -ETIMEDOUT; + retval = readl_poll_timeout_atomic(regs + RCAR_USB3_DL_CTRL, + val, !(val & RCAR_USB3_DL_CTRL_FW_SET_DATA0), + 1, 10000); + if (retval < 0) break; - } } temp = readl(regs + RCAR_USB3_DL_CTRL); temp &= ~RCAR_USB3_DL_CTRL_ENABLE; writel(temp, regs + RCAR_USB3_DL_CTRL); - for (time = 0; time < timeout; time++) { - val = readl(regs + RCAR_USB3_DL_CTRL); - if (val & RCAR_USB3_DL_CTRL_FW_SUCCESS) { - retval = 0; - break; - } - udelay(1); - } - if (time == timeout) - retval = -ETIMEDOUT; + retval = readl_poll_timeout_atomic((regs + RCAR_USB3_DL_CTRL), + val, (val & RCAR_USB3_DL_CTRL_FW_SUCCESS), 1, 10000); release_firmware(fw); @@ -200,18 +187,12 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd) static bool xhci_rcar_wait_for_pll_active(struct usb_hcd *hcd) { - int timeout = 1000; + int retval; u32 val, mask = RCAR_USB3_AXH_STA_PLL_ACTIVE_MASK; - while (timeout > 0) { - val = readl(hcd->regs + RCAR_USB3_AXH_STA); - if ((val & mask) == mask) - return true; - udelay(1); - timeout--; - } - - return false; + retval = readl_poll_timeout_atomic(hcd->regs + RCAR_USB3_AXH_STA, + val, ((val & mask) == mask), 1, 1000); + return !!retval; } /* This function needs to initialize a "phy" of usb before */ From patchwork Wed Aug 19 12:41:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E698513A4 for ; Wed, 19 Aug 2020 12:43:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF04C206FA for ; Wed, 19 Aug 2020 12:43:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2V198VjO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="N2XXvi99" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF04C206FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Xe5VH7LdvFpiYTNBATR4Tl+PjISkWo1v6jLi48Sd/28=; b=2V198VjO1XOwmnf+lRAh7dGAW 2eX3dqe7uoOcuDDokQhbMLXNKYXh9aOTOxM5WCOdFs6Lc9+hRVEGzBaqf/2uJaqayHw0C3RWANvax z5GU8bjklVDiplOF+XogFVcJlDBdrOlMCBEE8m17LSWkMIa93ExtfH/rvG5nnWPgQbJfEq5sDOFMJ vcPP3jDmboAhArSQZqct0XqARLLTL3NSZISbgWz4cyb9QY6bHcGXCRWnCR7UAmeel18XTvrVj83Lb zWybX6lcc4DPIroMBZRx/jr0l4OiHPCb+nrfwFme+EXzJ/Rn35WX6WMSZxn4mGNas8ll/KOlyLqst SxhsKq6vw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NR5-0001yt-Ml; Wed, 19 Aug 2020 12:43:23 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQg-0001or-8Z; Wed, 19 Aug 2020 12:42:59 +0000 X-UUID: 540281c2f8ba49bfb2e3e7251234aaef-20200819 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=eKEone2/VvA8KcScfMxNPAUaYGhubW0D8Rj8rrilwBA=; b=N2XXvi99Hs5gbNj56kFZO8y/IBYFWD0IPEwVcllVkM1Qc6KYL4ozXEIEzek1C0tJVtRTgybEJiH3ZHUJxwJVmZ9cu2sFLgRJQQ4ia4Q0M52Ebat9EAonzAgIfeBomdAzM1CGhnaS3gKqL+Krz8tiZiVcYIfQXe8MEQv8Buvh6Jg=; X-UUID: 540281c2f8ba49bfb2e3e7251234aaef-20200819 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1024799371; Wed, 19 Aug 2020 04:42:54 -0800 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:55 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:47 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:46 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 05/10] usb: oxu210hp-hcd: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:41:00 +0800 Message-ID: <1597840865-26631-5-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 9693D66562738BA9832D0AB5A04BE9CC0503C283B8C76DF2B82558CAC208F5212000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084258_477617_BD37D3C6 X-CRM114-Status: GOOD ( 15.99 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun --- drivers/usb/host/oxu210hp-hcd.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index cfa7dd2..27dbbe1 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -748,18 +749,16 @@ static int handshake(struct oxu_hcd *oxu, void __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; + int ret; - do { - result = readl(ptr); - if (result == ~(u32)0) /* card removed */ - return -ENODEV; - result &= mask; - if (result == done) - return 0; - udelay(1); - usec--; - } while (usec > 0); - return -ETIMEDOUT; + ret = readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done || + result == U32_MAX), + 1, usec); + if (result == U32_MAX) /* card removed */ + return -ENODEV; + + return ret; } /* Force HC to halt state from unknown (EHCI spec section 2.3) */ From patchwork Wed Aug 19 12:41:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723963 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D75014E3 for ; Wed, 19 Aug 2020 12:43:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3337D206B5 for ; Wed, 19 Aug 2020 12:43:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="J7GfpJPC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Jt8hNIII" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3337D206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xaHr1zJDn5ShJZGFRGnzYdpBax6sv1tBv2EF3+NV2E4=; b=J7GfpJPCZH5wP42PvwV/qXaDQ i/CwPjYIyim2+6Vqz+9YQe9+cNGlkQQRFDvFxLalrPNA7BT7IHZHtVa47fdyspsqPoeGOIcgNqEz7 veM2pCqJM6uC8hN42mFyBPv5/yWgD0NA21wwHAhTjC7fG3IlswQLayI95IC1q0/2vQUyK9qDstFxi GPS/R7Fb3aTY5w+ytFcqy8q59E1XcgaBlqs6ZH4rKCtgzIjsbyqV69TD7vz+p9Rl+cSW/3yWgTMwY Nvrft5qyMhFXZuMwPvDQY02OOA+wmU1xuhe/mr2J1ohYJ8RcG9uu76gPFyxGY8v2akeAF+LsnjTGI w+QCS1Ksg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NRN-00028t-MZ; Wed, 19 Aug 2020 12:43:41 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQk-0001rT-9g; Wed, 19 Aug 2020 12:43:08 +0000 X-UUID: 2597fe916992419ba899126c2ea60ad1-20200819 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=D88GhKAQOoOoMdP2CcQ1z4Poelnhpyo0MHbY6pqZ5mg=; b=Jt8hNIIIVBtbRIrH3NKm2aNXR+j+a73q/G/WmAQxv3pVEfHGw+/LpaXruz9YeJy2x2dt0Ksh7t18yBWFn2gwuOD9oGuaigu5yKet5B64g+vflZOvVAONW5CTjNJFb7kIVcEXM+f6eX/YH6XU5lV/xDd+Fst8XtySVTp8U1v7WWI=; X-UUID: 2597fe916992419ba899126c2ea60ad1-20200819 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1108702254; Wed, 19 Aug 2020 04:42:55 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:53 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:48 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:47 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 06/10] usb: fotg210-hcd: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:41:01 +0800 Message-ID: <1597840865-26631-6-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: F4E93F279AA6B03AA944F8689A81AD9D167A411882F0CF6059AAE4936108172D2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084302_602527_D8A73806 X-CRM114-Status: GOOD ( 15.92 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun --- drivers/usb/host/fotg210-hcd.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index 194df82..1d94fcf 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -883,18 +884,15 @@ static int handshake(struct fotg210_hcd *fotg210, void __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; + int ret; - do { - result = fotg210_readl(fotg210, ptr); - if (result == ~(u32)0) /* card removed */ - return -ENODEV; - result &= mask; - if (result == done) - return 0; - udelay(1); - usec--; - } while (usec > 0); - return -ETIMEDOUT; + ret = readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done || + result == U32_MAX), 1, usec); + if (result == U32_MAX) /* card removed */ + return -ENODEV; + + return ret; } /* Force HC to halt state from unknown (EHCI spec section 2.3). From patchwork Wed Aug 19 12:41:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA9C6138C for ; Wed, 19 Aug 2020 12:44:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4278206B5 for ; Wed, 19 Aug 2020 12:44:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1il2CQ41"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="ICRwMgfr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4278206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wFk5316Qar4Z3ToYqVD30Zujkd7x19MFyvXwTqwLv1o=; b=1il2CQ41736tFMl2QNcS8xhjL fHDMhukHCaqeX54XQiInxT4+tr3BCKxgUJPmYc0BPTWrNr29ynOhxAWlBRedg6g5WdBjzjOYvc9rN aJ0yw+GFRkcGK54OIHf7nA639YVDTT4WN+vXZpIjjMFD3nOQDzpnZT3CpzqHFm7Kd6taGFpi2d13+ NNOQHKpHNqV3CW2kbvzj/63dkQPrd9Nf1Wb25WtY2OREMotwpqNhTiIQPTlhngmoWxAbsSWa152zB IcATKV3Po5kkfYVBAXIjItDQZUAtf8Z1O92KFx9fg0b306u2iXPdfi4G8j7KvKF01+BCRvES3GgVh UlbTacvSg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQx-0001wL-AH; Wed, 19 Aug 2020 12:43:15 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQg-0001pA-82; Wed, 19 Aug 2020 12:42:59 +0000 X-UUID: fd68c47988fa40ec82e2f5ee6cd3e49d-20200819 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=UosKRjGpZIhdI5RMhf5vCV5EcbtKc40dysbwHo6gzZY=; b=ICRwMgfrUYZEEjXEbR+6oV6/iugn2d0c4XQRiNj+dpS/OusKkF6pWR9Gk8YJQirmZCSq+cYMPQv3fbOVOk9+aqhEtEEy1+N5AEpSrwU6Mo9RZ5tHikhMjJvhaODSshS8l8YlkoYTeejcK12bLUiUl5x0gdZROr3rHIv+GhJHhAM=; X-UUID: fd68c47988fa40ec82e2f5ee6cd3e49d-20200819 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 2060230968; Wed, 19 Aug 2020 04:42:54 -0800 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:56 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:50 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:48 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 07/10] usb: isp1760-hcd: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:41:02 +0800 Message-ID: <1597840865-26631-7-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 17313833DAD51A68B7DE4830FA2EF9A95C5D248D526DC3860607DA067257611B2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084258_471762_60578035 X-CRM114-Status: GOOD ( 15.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun --- drivers/usb/isp1760/isp1760-hcd.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index dd74ab7a..33ae656 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -380,18 +381,15 @@ static int handshake(struct usb_hcd *hcd, u32 reg, u32 mask, u32 done, int usec) { u32 result; + int ret; + + ret = readl_poll_timeout_atomic(hcd->regs + reg, result, + ((result & mask) == done || + result == U32_MAX), 1, usec); + if (result == U32_MAX) + return -ENODEV; - do { - result = reg_read32(hcd->regs, reg); - if (result == ~0) - return -ENODEV; - result &= mask; - if (result == done) - return 0; - udelay(1); - usec--; - } while (usec > 0); - return -ETIMEDOUT; + return ret; } /* reset a non-running (STS_HALT == 1) controller */ From patchwork Wed Aug 19 12:41:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723983 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E38213A4 for ; Wed, 19 Aug 2020 12:44:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 472BF206B5 for ; Wed, 19 Aug 2020 12:44:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KCbg+nlm"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="NU/6cjoG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 472BF206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2WOBJ7fZN1zg6kxnekVLaOZVg8Zg1ofjwQZYr3EwLjw=; b=KCbg+nlmb6O3UhePRtxcCA3Yi Iw+jyyJuHRz8hzmWze+R0MEqVLuyaaYBoL7ushPcW0FAnGmbGzKKUnZwxzy2UfgBBhekljBEu7gDM HT7BJ7gm0W40mLVhRDml94KyfouHbiUVKWn0x5TzTMtt2kPWZv9+REKm7hbCRFA6qWCircPuFAUN8 KA2/S3aCq0L5bURcrT8ZdxfvG0WzBYUXvmyDRfpK8fvtpEw4rteX6ya4s2yfd3VjASg2W3NfAHVOC J8wegLu4vvDvIOsqOsn7O9iRgQbB9DFCnUktvwSQHt99h67q7Aux5AiESTmwQ6XDuJdvVzWFtMKjU PKueR6xag==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NRH-00024j-O4; Wed, 19 Aug 2020 12:43:35 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQk-0001rF-9g; Wed, 19 Aug 2020 12:43:08 +0000 X-UUID: a3b9075c10da46df90e10917d9d26a2f-20200819 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=BwV3u0UCzhuW0Euj9HoyhyyD5L8KPMx+OzfJoFQQAdE=; b=NU/6cjoGTlFPEHz8TeVyYJ1nQlhS+AqhE5Qt7/Rx1dvEQjmsJzmKoNqYQkuOBYGqPuuHKS5zQ6iANlUXnYa283NvZz/+VUuEahCJ2kp+kIN7sC49RMesc3aOJDRawUwbm5aZ3Zof/8HwxfNYhZRhzEHCGxU4hTUmZKfjZFcfgV4=; X-UUID: a3b9075c10da46df90e10917d9d26a2f-20200819 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 554475109; Wed, 19 Aug 2020 04:42:58 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:59 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:51 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:50 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 08/10] usb: phy-ulpi-viewport: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:41:03 +0800 Message-ID: <1597840865-26631-8-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 540DEF74C77FA8C5F52AD2B56CB2756BDC5DDF21B9D2E21F148585182723DFB92000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084302_613987_782430AE X-CRM114-Status: GOOD ( 13.62 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun --- drivers/usb/phy/phy-ulpi-viewport.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/phy/phy-ulpi-viewport.c b/drivers/usb/phy/phy-ulpi-viewport.c index 7a14e0e..0f61e32 100644 --- a/drivers/usb/phy/phy-ulpi-viewport.c +++ b/drivers/usb/phy/phy-ulpi-viewport.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -20,16 +21,9 @@ static int ulpi_viewport_wait(void __iomem *view, u32 mask) { - unsigned long usec = 2000; + u32 val; - while (usec--) { - if (!(readl(view) & mask)) - return 0; - - udelay(1); - } - - return -ETIMEDOUT; + return readl_poll_timeout_atomic(view, val, !(val & mask), 1, 2000); } static int ulpi_viewport_read(struct usb_phy *otg, u32 reg) From patchwork Wed Aug 19 12:41:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11723985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50A2B13A4 for ; Wed, 19 Aug 2020 12:45:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 256562078D for ; Wed, 19 Aug 2020 12:45:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KXw5eS6T"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="QazGoteN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 256562078D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LTEt+5XZhZSMbhSIltZm2ZEq1nkAtuSxaiYRJM16icU=; b=KXw5eS6Tix5ODHDMvLyuGzkuX S5mqWLtu09DNRRdhgxXGKo6wCkGxPyyalJwKXHwP1PBHOU5/AHZSCzZAxNjRhuQfqfynrfwRg1kSD B5pM+Hrn0ygr0DYFf9sk/mD1hsyk0fdFuXNZDQgLij2LIZLgX106JqN9xSQ3wTIN2j/x6ftK+kkv+ Tl7js1SKAkIuPOnYiNYWkz1Q+rRXS2VciR/MHVolD4Ervu7HAEkEvwBNRpUdczmoEd8kqlFxq3DF0 uknrcaSb6gU8XN+8RneFBMpLAcJ9I2vgZOJVhMVVNrnurvL4uo+ILHciHF0cswMgNIOtx0pdsadWd luSOGrdKg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NRV-0002Ei-0k; Wed, 19 Aug 2020 12:43:49 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NQk-0001sA-FD; Wed, 19 Aug 2020 12:43:09 +0000 X-UUID: 526043864f014d52b9795632dbc9fcb8-20200819 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=8uPUV+WuJUk2y2D4BlVGYPxJs4zQfi1SnztFfLAGohI=; b=QazGoteNiwD18kEomorQZ0EOcrtmDC/HfBdmV1SD7JbVHnTElOLkfCf5826y4qQxXBPbVKbumnV9mDnv3FU24mcEba0woY3ef5IIM0VjuamST7st+GsuzdqClU5c07Dc3EEYRQfLglN2JldmHngr93KQfgeGsAlJCXP8/S5nZOk=; X-UUID: 526043864f014d52b9795632dbc9fcb8-20200819 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 297135965; Wed, 19 Aug 2020 04:42:59 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:43:01 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:52 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:51 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 09/10] usb: phy: phy-mv-usb: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:41:04 +0800 Message-ID: <1597840865-26631-9-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 880C2D39F7C81EB325277EEE0174E037DFB900233850FB14E9242C8AAB137E272000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_084302_754240_7DAF94B9 X-CRM114-Status: GOOD ( 15.76 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun --- drivers/usb/phy/phy-mv-usb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c index ce767ec..008ed58 100644 --- a/drivers/usb/phy/phy-mv-usb.c +++ b/drivers/usb/phy/phy-mv-usb.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -135,8 +136,8 @@ static int mv_otg_set_timer(struct mv_otg *mvotg, unsigned int id, static int mv_otg_reset(struct mv_otg *mvotg) { - unsigned int loops; u32 tmp; + int ret; /* Stop the controller */ tmp = readl(&mvotg->op_regs->usbcmd); @@ -146,15 +147,12 @@ static int mv_otg_reset(struct mv_otg *mvotg) /* Reset the controller to get default values */ writel(USBCMD_CTRL_RESET, &mvotg->op_regs->usbcmd); - loops = 500; - while (readl(&mvotg->op_regs->usbcmd) & USBCMD_CTRL_RESET) { - if (loops == 0) { - dev_err(&mvotg->pdev->dev, + ret = readl_poll_timeout_atomic(&mvotg->op_regs->usbcmd, tmp, + (tmp & USBCMD_CTRL_RESET), 20, 10000); + if (ret < 0) { + dev_err(&mvotg->pdev->dev, "Wait for RESET completed TIMEOUT\n"); - return -ETIMEDOUT; - } - loops--; - udelay(20); + return ret; } writel(0x0, &mvotg->op_regs->usbintr); From patchwork Wed Aug 19 12:41:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11724029 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E11A913 for ; Wed, 19 Aug 2020 12:55:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 568712173E for ; Wed, 19 Aug 2020 12:55:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EBsVYivr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="BdbnORcN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 568712173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9T00E7kmKZshzl09pg97l2kaqfaqmbh7lZq0Cjn2eoo=; b=EBsVYivrVCVvFva/VF3G2ICLp PpRMTo3IRv+Q2KIT7S0JXtbxLiIgyna8OqxtDn+uda4Hwbq1QzVGH+iEB0m5WUgXabIM4bXNvyGUf riUelCz4k8ffh6d/Ydm3r6HfOyBM1XyBjBpgnfrmofK0MzJ0NxBgkKp/JRY5axNfEvP6UnQJGdZY5 08uQRdNMJdIQv5yrVF5mhExc+1dSKmyTSRmmi2VoAiiaazxFTMBxBnbwpJdfyuk+Qq/GW4ttyFNfi FroNxxWoFXArAcN1FxaPzC7yMG3qt8YSel64isM6VisGlmLeRuFK9E/Z/9dGryOq0+0k+9vQwZJxa YSGSKrDRQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8Nad-0006cx-2D; Wed, 19 Aug 2020 12:53:15 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8NaI-0006WL-7Z; Wed, 19 Aug 2020 12:52:56 +0000 X-UUID: 03eaf0a31e2b42bd93338a55ae38345c-20200819 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=Dpta4H1SRQk7Li++WBp2aI6qhPf7vOedFdtzx5lB+FM=; b=BdbnORcN+z0BJUp0H5lM60jMuurtL4cB15OO/QYJ12tJhKS9/6FznXN2GGk3eSF3XIDtkJj3kFFUXRHxKqu5i9N4ANiSlXvwgB5Q73pHMFPehfMyc+iWU8lXpYbNWjNrZ7NCSqEpMHrCbh4WoI6p+2fIsbij+Thh2RL9zM+zO+w=; X-UUID: 03eaf0a31e2b42bd93338a55ae38345c-20200819 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 2116185108; Wed, 19 Aug 2020 04:52:50 -0800 Received: from MTKMBS31N2.mediatek.inc (172.27.4.87) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 05:42:58 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Aug 2020 20:42:54 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Aug 2020 20:42:52 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman Subject: [PATCH 10/10] usb: udc: net2280: convert to readl_poll_timeout_atomic() Date: Wed, 19 Aug 2020 20:41:05 +0800 Message-ID: <1597840865-26631-10-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> References: <1597840865-26631-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: E0EC442A6D048C3678D031DC199AB4D56B601BF5917F13DC48DE34E7762CD3F22000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200819_085254_560910_60083071 X-CRM114-Status: GOOD ( 15.80 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , Alan Stern , Lee Jones , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Cc: Alan Stern Cc: Felipe Balbi Signed-off-by: Chunfeng Yun Acked-by: Alan Stern --- drivers/usb/gadget/udc/net2280.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 7530bd9..f1a21f4 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -360,18 +361,16 @@ static inline void enable_pciirqenb(struct net2280_ep *ep) static int handshake(u32 __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; + int ret; - do { - result = readl(ptr); - if (result == ~(u32)0) /* "device unplugged" */ - return -ENODEV; - result &= mask; - if (result == done) - return 0; - udelay(1); - usec--; - } while (usec > 0); - return -ETIMEDOUT; + ret = readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done || + result == U32_MAX), + 1, usec); + if (result == U32_MAX) /* device unplugged */ + return -ENODEV; + + return ret; } static const struct usb_ep_ops net2280_ep_ops;