Received: by 10.192.165.148 with SMTP id m20csp26197imm; Thu, 19 Apr 2018 15:19:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ZADWXv8oE0s4yQdwcngxaavOy8N9uNVBDCvu4oozkPA9U4wrD1m+h71bG/W0V6cW9WnjX X-Received: by 10.98.109.66 with SMTP id i63mr7299250pfc.233.1524176377895; Thu, 19 Apr 2018 15:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524176377; cv=none; d=google.com; s=arc-20160816; b=uzx0kNp6c4n9aqUBh8+9CTuP4kHrASDTmz1rPfXcZsAolq2EwQ/5GweY50ifYTNwEq FsI4Upl7cRTfCX0Mv3QlKzBCotdxG5uG5j4DjJz+AupRLOkLwBw3VG2KkVEXFz9cy56Q E0MJUPbBKzig8LIKW1lUACTCqGddtsUNt2W5fDrVu/fzw1yzsS/AfuPCSNr9gyeDTzRp /85s5Nqw4FjmyNV3xycG1J1bBxuFcUWbmxEo9sfNT2nhaWXVNYkW7RBoNCu3ZwE5YnKp 0B9e01/rIpr3oSTUbYsD8qKmwXuulZqDhGBy5uX6DRXQ6WEykInn/NDPqYI9/AYAwFJX EQYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=b5BZ0eGo+qduWCLE42lbmG3UtRqcu+VAbrAScMbTbOc=; b=x4xws7R1s3ndo8kB12TlXeZupSDByZ54IPISkAT/Z+H8JcINUEpyQ9qRvWWlR/lzJV QV8K9wpW4Kd4NJAS7JsJ9oReP+bcrMZUYKHPB6iqG7O5XJJEcJlpS0/rOflOBEle2VOX PbXbs52oB5Gkw8bmVneBEE5Bzh3xfR7tNExyYD8BIMThxpJ40lHGnHPznOlCdNEZDeg9 kiWbdIk6nBZyoQ5BtfI0PqaZ9W7FpjNvpm8kZowvQ3sSiXqMy0bENSMQb6BIYwpY7Z/p zgvx+FJHzWPiTjsF6vqomFa/Vw3ExvjlQmOYhQ2Q+5qcpjWIZFIl37mkMqY7puPLfR4s vljQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TCiyiVIV; dkim=pass header.i=@codeaurora.org header.s=default header.b=miK0zo0U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si3839552pgc.224.2018.04.19.15.19.23; Thu, 19 Apr 2018 15:19:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=TCiyiVIV; dkim=pass header.i=@codeaurora.org header.s=default header.b=miK0zo0U; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753947AbeDSWRE (ORCPT + 99 others); Thu, 19 Apr 2018 18:17:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57630 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753593AbeDSWQ5 (ORCPT ); Thu, 19 Apr 2018 18:16:57 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D127F60AE0; Thu, 19 Apr 2018 22:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524176217; bh=6ysAZ+oOIZy2lmayLhdHbvJhATFixOekpI+zXUIyQw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TCiyiVIVyg0MFxKDuDqD1Ok5wX6AYRxa6JbX2IXRJapEvPuz8m4UJNtC6l7Th9Y6Y Z/PDOluu2OXz8otv2GvbSbPnqJx+lgFgfURXxo6je+391wNpEgrL4aZf9DMa8lHpKL iEZv7gW8+uFJyYqi0F8GuOgpB4cYCKucC7bRBW8w= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7317F60FF2; Thu, 19 Apr 2018 22:16:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524176210; bh=6ysAZ+oOIZy2lmayLhdHbvJhATFixOekpI+zXUIyQw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=miK0zo0UWNZgJgqtFPv+8dIibvSx1IN+ij5V4s1pM4KORfQ84GAT3WozOIFFSWWrJ 5CdXAcYF0Uopoq8hRe8+dYOvSqdmPqXXjLZNPhi/5YnYqEnfmqioVJ4Y9+rzfJDr3/ XuIPSczOSgsmzc43bA+fiuBUtFyBeK4fAOh+joNU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7317F60FF2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org From: Lina Iyer To: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, Lina Iyer Subject: [PATCH v6 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS Date: Thu, 19 Apr 2018 16:16:31 -0600 Message-Id: <20180419221635.17849-7-ilina@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180419221635.17849-1-ilina@codeaurora.org> References: <20180419221635.17849-1-ilina@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow sleep and wake commands to be cleared from the respective TCSes, so that they can be re-populated. Signed-off-by: Lina Iyer --- Changes in v6: - remove unnecessary locks around __tcs_invalidate - rename function to tcs_invaldiate Changes in v4: - refactored the rphm_rsc_invalidate() --- drivers/soc/qcom/rpmh-rsc.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index d169f7da5422..170d4a10275d 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -101,6 +101,51 @@ static struct tcs_group *get_tcs_of_type(struct rsc_drv *drv, int type) return &drv->tcs[type]; } +static int tcs_invalidate(struct rsc_drv *drv, int type) +{ + int m; + struct tcs_group *tcs; + + tcs = get_tcs_of_type(drv, type); + if (IS_ERR(tcs)) + return PTR_ERR(tcs); + + spin_lock(&tcs->lock); + if (bitmap_empty(tcs->slots, MAX_TCS_SLOTS)) { + spin_unlock(&tcs->lock); + return 0; + } + + for (m = tcs->offset; m < tcs->offset + tcs->num_tcs; m++) { + if (!tcs_is_free(drv, m)) { + spin_unlock(&tcs->lock); + return -EAGAIN; + } + write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, m, 0); + bitmap_zero(tcs->slots, MAX_TCS_SLOTS); + } + spin_unlock(&tcs->lock); + + return 0; +} + +/** + * rpmh_rsc_invalidate - Invalidate sleep and wake TCSes + * + * @drv: the RSC controller + */ +int rpmh_rsc_invalidate(struct rsc_drv *drv) +{ + int ret; + + ret = tcs_invalidate(drv, SLEEP_TCS); + if (!ret) + ret = tcs_invalidate(drv, WAKE_TCS); + + return ret; +} +EXPORT_SYMBOL(rpmh_rsc_invalidate); + static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, const struct tcs_request *msg) { -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project