Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3938678imm; Mon, 18 Jun 2018 06:40:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIuMEPyrGuJ5gKj0JYv/aCf0koHMZ/8j5XgrbUqBiQGSo6gIjPEy1+O0MHppVw7UgD4G9Ma X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr13954768plo.257.1529329236223; Mon, 18 Jun 2018 06:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529329236; cv=none; d=google.com; s=arc-20160816; b=teekhvfxilEIMEO9oSvdGNOxmqWomKqyRiXbKsz9YGUB03khDtAh3nNBvJsJEr7D4u /rFtQaiw4B0pcrA37abtIr6R8tSZ1yAQZqEU1xC3vvbaCyaUUrzW5zMin2N0DWVMoApL eMIBaLOpPU8/Tuw9cvacq508LOlmguy1DaT4KdDg8zvHInrYJra0wnQBDJVCnflgmnFe RiPGDHFWNERlnSbHDOBw4qExbc8Assu590/mgJgWHImoV+z3l7AcETFoQdAsvfM1mrVF Cp4Xe34xiiKJx16TLygncvhFyZkBjZGNQwEKXefWR5PAWo7Htb31fzjhj3ZbPwdDGZ2c yWZg== 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=/ij4r7f9/pIsxhNhVqcs2snqiy0zVUZvtwsaCAAkrhw=; b=qI1dhOAU9gq79Wh0TvZw6tZfy6J2ECewl0Ipe/QTXUElUZ/L1tnDvIOUF5sCYbIVdh 9Su9X9Pp9FO6VJNkmAv707+t7ex0aOzXHVTyC82YiQYGi4lFwQAnbYcllt+W7JKGAj5I 8UntnX5XiWqyoPYdsAF3GDNE5eGJcdBuhgbZrfxkmMnzcRhTnkyXFFzk7QfCfZZR1f/5 fL4cO2sxYFBd4DMjYefL/CEHDdFehjdYyrmwRlEEHMGCb0OMEVmXvz3fKmc+AGhSzXC9 MQRPVCY4YyNwZNb5d3dZ1z9VqT3PBYj935BHpNVs9jxA3SUJrYxjCF83wozi4I770Owu rXdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="WAJ//o8V"; dkim=pass header.i=@codeaurora.org header.s=default header.b=mr7BJeTu; 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 j8-v6si14342450plk.261.2018.06.18.06.40.21; Mon, 18 Jun 2018 06:40:36 -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="WAJ//o8V"; dkim=pass header.i=@codeaurora.org header.s=default header.b=mr7BJeTu; 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 S935032AbeFRNjN (ORCPT + 99 others); Mon, 18 Jun 2018 09:39:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42438 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934807AbeFRNhz (ORCPT ); Mon, 18 Jun 2018 09:37:55 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 45E2660B15; Mon, 18 Jun 2018 13:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529329075; bh=pLOwIBxDTltsSVQbBtdC0E8Hyq6eVarFPLCIbhHn1/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WAJ//o8VNVa5gX33ccn5ulb4RtBGI2gvP4O3j/T+PcrFI5n8NcuDm6j24ycPLf7Jz gqOB95ArW3k55QWkaXfay0TODi80TwXLnDTjjFmVENZ4AMcTMJ+BhyFHECCN4w9CxA ov/iht4qcOn98AA02Bxd393bzPLlN6IRCTDfgkL8= 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.3 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,FROM_LOCAL_NOVOWEL,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 43AD060B19; Mon, 18 Jun 2018 13:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1529329074; bh=pLOwIBxDTltsSVQbBtdC0E8Hyq6eVarFPLCIbhHn1/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mr7BJeTuEgij3tQ5L7z2a1QAyC+78vLZC0iSDxYNHxecYIoYhmKAD+TeIg1PDPzrI VqAz/Fkzz6w1m63ZcifMQS+T2YBEEFzZlPAHedRP3y3Dzyr0CIpm7Bp/GlaBfrFMXD 4KR2+BNW13ZpFLaSlYPNTFg4sRh15yAgEfxFkGu4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 43AD060B19 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=rplsssn@codeaurora.org From: Raju P L S S S N 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, mka@chromium.org, ilina@codeaurora.org, "Raju P.L.S.S.S.N" Subject: [PATCH v11 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS Date: Mon, 18 Jun 2018 19:07:16 +0530 Message-Id: <1529329040-2606-7-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1529329040-2606-1-git-send-email-rplsssn@codeaurora.org> References: <1529329040-2606-1-git-send-email-rplsssn@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lina Iyer Allow sleep and wake commands to be cleared from the respective TCSes, so that they can be re-populated. Signed-off-by: Lina Iyer Signed-off-by: Raju P.L.S.S.S.N --- Changes in v9: - Remove EXPORT_SYMBOL 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 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index b87f9b0..a68dcd1 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -101,6 +101,50 @@ 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; +} + 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,\na Linux Foundation Collaborative Project