Received: by 10.192.165.148 with SMTP id m20csp1021422imm; Wed, 2 May 2018 12:43:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZruvpQ3CAU0YvjY0i0ktupOUFKJ+sC2JHENTyTKdB2baJHk1U56VsrExAP0lc6HYOhQc1tY X-Received: by 2002:a63:9911:: with SMTP id d17-v6mr17397658pge.106.1525290185067; Wed, 02 May 2018 12:43:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525290185; cv=none; d=google.com; s=arc-20160816; b=KLmZguNAC+CMFbilWAyFLzZPFIagfMLBl6vUIz2UIG0SLEWS8UZ9z1IrhGf+GJDq/q IbHm6C1xVSWCBzHJySjfE5sqMUsMOltuEqBgXHP9RfedpFjDAxDxoyD3b3QroVXw7Plm g5Qeriy8PLIOdCijcZhD7JN6+D13wXf5zX6ko09O8IIc6+ZgXGS9fSPqX3SOIm58LUDR ddKKX4ttrTKuT63yLXT5X1co05UV1QC/B1Yel6pAMAV+sYWV6br+Buq3YFOfjlpKAqj4 bW5oOSTBvFzZBGeXBTl7sArpANEQ77wxmADdTy+ajqB2FdWogwPgjM5+xM5vQYAULrET a/4w== 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=GqyP58LgpHlStpgYsSMmiYLrQK/iZ3LgtoY1b0r0UXE=; b=u2Ur/XiyGVxS/Bynr751hOK9Frmp43ECLXHrMhPIsRVIGPBfbhkmw2rdfbYuhYbp2x EiDRI+TQAGRROA1tnDWP0cisoQtSvENcWU4VCeyKhOXDER8EYVECcFata8YOeRA3Mgaw ZadxMd1+s60ndEDXdnHh+Q/Xvpu3CUpBgcC2XXWohCt901HwPwlb/rIlN2wTIm35mIal IdbB/C87l3mXlqH1OQSTvFzR4wBG+B1scofEoOE7pCHUHlBeSTZbW7mUKkio3HeUEKQ1 Topg2u7thU1WzDaw3dhEXhxwmoN+wquz+MeEbWj+gkGrrpyQEOeN5tr4tcNv/zrtYFCW DFRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=kRbhlP7d; dkim=pass header.i=@codeaurora.org header.s=default header.b=kRbhlP7d; 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 v64-v6si10027579pgb.86.2018.05.02.12.42.50; Wed, 02 May 2018 12:43:05 -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=kRbhlP7d; dkim=pass header.i=@codeaurora.org header.s=default header.b=kRbhlP7d; 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 S1751698AbeEBTji (ORCPT + 99 others); Wed, 2 May 2018 15:39:38 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38612 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbeEBTiE (ORCPT ); Wed, 2 May 2018 15:38:04 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C0171607E1; Wed, 2 May 2018 19:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525289883; bh=UBLZ9pL95fft5riz4BhaHpRyWBrUaiz8XD+lPHCN0O8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRbhlP7d774ix+EXXovuqsb3j/9K3zmJawuX4VVQ3xwfwOp167KrSwaKM3xCixdPx gtXvWXhTIgM315rOY9VpR5EWLQoK0+/g/KbdSY4nNqr0vdNjvN06VS9orluUJTrNwT XueULqhwY7/OxoyH99PnUJfSiv8/X+iO8U26trSY= 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 2924960588; Wed, 2 May 2018 19:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525289883; bh=UBLZ9pL95fft5riz4BhaHpRyWBrUaiz8XD+lPHCN0O8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRbhlP7d774ix+EXXovuqsb3j/9K3zmJawuX4VVQ3xwfwOp167KrSwaKM3xCixdPx gtXvWXhTIgM315rOY9VpR5EWLQoK0+/g/KbdSY4nNqr0vdNjvN06VS9orluUJTrNwT XueULqhwY7/OxoyH99PnUJfSiv8/X+iO8U26trSY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2924960588 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 v7 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS Date: Wed, 2 May 2018 13:37:45 -0600 Message-Id: <20180502193749.31004-7-ilina@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180502193749.31004-1-ilina@codeaurora.org> References: <20180502193749.31004-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 v7: - Move bitmap_zero() outside the loop 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 4e2144a14c31..42aedf2d80fe 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -104,6 +104,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