From patchwork Fri Nov 1 12:41:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 11223017 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 D6A1A1390 for ; Fri, 1 Nov 2019 12:43:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A238D2067D for ; Fri, 1 Nov 2019 12:43:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uPaezK9l"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="MXonAe17" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A238D2067D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk 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=bombadil.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=4EakvTh+Bg9OYkpzw0hQTLrpqpY+oyc+6A5cCcR5d5M=; b=uPaezK9lwr8sIN 9lOKkPIzTH3BH0glQU3bM7BhPSkSBV3NnAcZ19m3utbtjw4J9zCIDNx6Ch+sSyR3pfGE2tERF5eoS X1Co2GMXJMjZwieHM97plFJiyVu/vP+cnlWg8r+6tX6ucEfGoamtvyGUFx3BXVD6DycPOo3wF1Ksn gVE5o0QZwo+oC4kNYzEFdrKPnEd2GV9OxnMX7ke4S5W8g7oDtcGVNjn7eLekJ2WaO3cUsCowtb5hG EEMCiUnmXv83nl6f5h6VjKFppZtf4dDPxnUOBst/6KxYooT3Bd9LM/xwCuX6+l6/cby0ba1dyO2EC arLwmdwGwgM8+u012wIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQWHP-0000ru-Iq; Fri, 01 Nov 2019 12:43:51 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQWG0-0007pU-2y for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 12:42:25 +0000 Received: by mail-lj1-x243.google.com with SMTP id s4so10089984ljj.10 for ; Fri, 01 Nov 2019 05:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KLof2Ot2O0jJsk//b5zfFITAj/UOtVeGro1UsWAolSk=; b=MXonAe17Nh/IHNlZn3/K4qN3Y33a5LRMb5n2AtdUT/tH1JEvQoroLGWco046i+FBys rV7YUUeM0D4I7ffZNLM/C0+JvV0RvuKcW4jDPcNWKBvwAfQGLsTSkAULwYJ9kcw7ecXP bzHca1F4QUF747YROIIEsYDGwAzgoGaP6KwQU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KLof2Ot2O0jJsk//b5zfFITAj/UOtVeGro1UsWAolSk=; b=O8lHO6h9hzwSbqz3u8MQ36C8exOoTqdccVCU8ZgA0rnAY07Dt1tlQJMyrGNSV/4391 lyNztHWipFMiBFc7/pYP6iIXPWKI0x/hn/SwH9HHTVcNy+GR5m3Dco6uCkEl7ZG/+fQN 9+BjoIm/nLVNuxhP8TDWE5MeXEFC0UdwA6vv9wdbXK+7mLoeJYX0GoaTlrKVwzlcOjM6 RHKqq/0HC6Oz3h9uy+LYAn+DRGRyqkrH9C7RJenHaXmMnw5DeqxXYvDAjZXqLjldNeSL AN+2qYv8pTabgyTBoscyVJlf78CcUH5LP8c2cJs3tcZxJh6NHT5WxOAq4+h2m8ynRV04 MqSQ== X-Gm-Message-State: APjAAAUEy/SFYHvCr4uLE4drGHNqPwo8N3+b2jFE+fPWb3IPtteUsMgI JVrSJ++NpmlriiIBhud3ZsOT6A== X-Google-Smtp-Source: APXvYqwyK33D39pNacH1MF4DGYS1r2n9xjHgSCwKh88O8OkGqcihnBmZbB2nG4AKKkDKOoFCeW51vQ== X-Received: by 2002:a2e:a0c9:: with SMTP id f9mr8263640ljm.77.1572612142749; Fri, 01 Nov 2019 05:42:22 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id o26sm2458540lfi.57.2019.11.01.05.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 05:42:21 -0700 (PDT) From: Rasmus Villemoes To: Qiang Zhao , Li Yang , Christophe Leroy Subject: [PATCH v3 06/36] soc: fsl: qe: replace spin_event_timeout by readx_poll_timeout_atomic Date: Fri, 1 Nov 2019 13:41:40 +0100 Message-Id: <20191101124210.14510-7-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191101124210.14510-1-linux@rasmusvillemoes.dk> References: <20191018125234.21825-1-linux@rasmusvillemoes.dk> <20191101124210.14510-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_054224_138613_7736C812 X-CRM114-Status: GOOD ( 11.31 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:243 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: Scott Wood , Rasmus Villemoes , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, 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 In preparation for allowing QE to be built for architectures other than ppc, use the generic readx_poll_timeout_atomic() helper from iopoll.h rather than the ppc-only spin_event_timeout(). Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index 456bd7416876..85737e6f5b62 100644 --- a/drivers/soc/fsl/qe/qe.c +++ b/drivers/soc/fsl/qe/qe.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -108,7 +109,8 @@ int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input) { unsigned long flags; u8 mcn_shift = 0, dev_shift = 0; - u32 ret; + u32 val; + int ret; spin_lock_irqsave(&qe_lock, flags); if (cmd == QE_RESET) { @@ -135,13 +137,12 @@ int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input) } /* wait for the QE_CR_FLG to clear */ - ret = spin_event_timeout((qe_ioread32be(&qe_immr->cp.cecr) & QE_CR_FLG) == 0, - 100, 0); - /* On timeout (e.g. failure), the expression will be false (ret == 0), - otherwise it will be true (ret == 1). */ + ret = readx_poll_timeout_atomic(qe_ioread32be, &qe_immr->cp.cecr, val, + (val & QE_CR_FLG) == 0, 0, 100); + /* On timeout, ret is -ETIMEDOUT, otherwise it will be 0. */ spin_unlock_irqrestore(&qe_lock, flags); - return ret == 1; + return ret == 0; } EXPORT_SYMBOL(qe_issue_cmd);