Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp779513ybz; Wed, 15 Apr 2020 18:53:11 -0700 (PDT) X-Google-Smtp-Source: APiQypKqB+97TfEuCrMt5oziub5j1zpbna8zQbAEqhNspsFYYhU2J/5dhNtPzFya3J1WqODsfVmu X-Received: by 2002:a17:906:4356:: with SMTP id z22mr4563424ejm.334.1587001991345; Wed, 15 Apr 2020 18:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587001991; cv=none; d=google.com; s=arc-20160816; b=a2isaCNlNLTo44d+gOwme63ZG3Ml3OxUTsrVWf9clxc/7XYkeBq9emzJCj+a/E30Xo SdGZWknqWuoRKJQyOvm9TV+upNYytai59DskWfcJIY1uXXB0SJ8EW266yNs1vsm3DK5c uRpk99LUZXUEYsRZGlr7/+nxAPSJFEh1R9HZhS/6RHIoUi+egIzjW+VzQJ2Tgpoi7nc2 /Ti8ikukHKgRZwwlqif9f/2jUbTTNujPOAF/dam+otjE5SeqGx1n8xNvcuwp+7eLewSh SzoSlExMJNdOw7aqTYlYp5b+oCxEYzRYnReXB6pbXPUYMpsbSzkkFHa6QzMF8T1KP+S4 6EoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wjox1MgPvdJXUGATfEXxAcxxbZg3uJFLLwCAqSjIesE=; b=oY/YJEumr5P6X26F0FxtRmVn28G4B/zRSBwl+ImrcV+fl1E+VTfEKsZcHr5ubZxT3l gXvigZDe5wTr4hg2QUj6NEEH+irAgekS8sZnxqwVVuMqxB5iRzwm7DJQ/TS7wifQtVme PfBwA2gB/l9bH+Md7wqAK+Hu3C78MxHdsCRw4lw0uWYOyEcU1XXebSHNOIHiU736zArv kyTWu5eNSoT1RmbrzyHzfl+pwoeZ55AaPM3bVXUB9bb30oIKz+myhfNUeaGlY1UYyyO7 28Ok3TWLvNKPyyaFjoV9r+pxslBzF1mMStj+ZZsZscw663YDHzpKSPgdwFBPzf2pHzXN g3lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cQu4bNLs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si11379629edp.173.2020.04.15.18.52.48; Wed, 15 Apr 2020 18:53:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cQu4bNLs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410597AbgDORA5 (ORCPT + 99 others); Wed, 15 Apr 2020 13:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410586AbgDORAx (ORCPT ); Wed, 15 Apr 2020 13:00:53 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57364C061A10 for ; Wed, 15 Apr 2020 10:00:53 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id nu11so106622pjb.1 for ; Wed, 15 Apr 2020 10:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wjox1MgPvdJXUGATfEXxAcxxbZg3uJFLLwCAqSjIesE=; b=cQu4bNLsv8clRV7vbm6yX8Vcr0WT6P2ddMJwlbMXwObS0A0xmm0ittvqdSO5Yf1bOr sFasgytkTHpQGqOStpC1iFZ4uUdX+5l5cXqSrhw5KghlbYt4eKDVLyAWc/PmCwYfaDlN td4R3YoyzOKkRacu2dOnBGm5KU+bqlK4dPVDM= 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=Wjox1MgPvdJXUGATfEXxAcxxbZg3uJFLLwCAqSjIesE=; b=YI2bHjAbVbwodjv5hoBfHyrL9xXuihk2M+SrBeWlkcU8bV+pXxNfBWXnDOfkLJmih7 /j6VG9EQKBPaUGLLhjjDl85S8u/gT7jxqG9HtKSeJXZYjbs538eWE+CjonITyyaOb9rm pYpEzddYLSwfo8QtGuTDO6tdqtSfNISYjOr5FM7NLIAgNIeSw7RgOFvxNpRMEdV9UbpI Qm8pKR14sQQiPrBFv0gvEUlZSBfBX7MiLGl/d30eP8Lv8SUk9Qm0xGLGhpUerYRuqyON 0FTLVYqSWRupcbYMCvC7B3d8kfPY40u/nm9AABbP9CtmIochjwGiAw2m3EhAnr5R6zUs S0LQ== X-Gm-Message-State: AGi0PubQioPwSMM9XwLRKcxVfb+ykGp+S7hf2di/kshrz5e9I79KxZtG ANLOB4YK+D7hm0UzoIYi6SML10Q0uYXUtg== X-Received: by 2002:a17:902:6945:: with SMTP id k5mr5717586plt.8.1586970051536; Wed, 15 Apr 2020 10:00:51 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id i187sm14203509pfg.33.2020.04.15.10.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 10:00:51 -0700 (PDT) From: Douglas Anderson To: Andy Gross , Bjorn Andersson Cc: mkshah@codeaurora.org, mka@chromium.org, joe@perches.com, swboyd@chromium.org, evgreen@chromium.org, Douglas Anderson , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] soc: qcom: rpmh-rsc: Timeout after 1 second in write_tcs_reg_sync() Date: Wed, 15 Apr 2020 10:00:28 -0700 Message-Id: <20200415095953.v3.2.I8550512081c89ec7a545018a7d2d9418a27c1a7a@changeid> X-Mailer: git-send-email 2.26.0.110.g2183baf09c-goog In-Reply-To: <20200415095953.v3.1.Ic70288f256ff0be65cac6a600367212dfe39f6c9@changeid> References: <20200415095953.v3.1.Ic70288f256ff0be65cac6a600367212dfe39f6c9@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If our data still isn't there after 1 second, shout and give up. Reported-by: Joe Perches Signed-off-by: Douglas Anderson Reviewed-by: Stephen Boyd --- Changes in v3: - The register should be hex. Changes in v2: - Patch ("Timeout after 1 second") new for v2. drivers/soc/qcom/rpmh-rsc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index ce39d8399312..e09d1ada0cd2 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -175,12 +176,13 @@ static void write_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id, static void write_tcs_reg_sync(const struct rsc_drv *drv, int reg, int tcs_id, u32 data) { + u32 new_data; + writel(data, tcs_reg_addr(drv, reg, tcs_id)); - for (;;) { - if (data == readl(tcs_reg_addr(drv, reg, tcs_id))) - break; - udelay(1); - } + if (readl_poll_timeout_atomic(tcs_reg_addr(drv, reg, tcs_id), new_data, + new_data == data, 1, USEC_PER_SEC)) + pr_err("%s: error writing %#x to %d:%#x\n", drv->name, + data, tcs_id, reg); } /** -- 2.26.0.110.g2183baf09c-goog