From patchwork Tue Oct 18 15:28:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 4221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2021574wrs; Tue, 18 Oct 2022 08:32:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4y/ACq3WyVKKfiGDbif/5t/8Qf0kEEbYbFR1L7/UKZEN4IErMzXfg/6TWxKzZE061Tcngq X-Received: by 2002:a05:6402:1941:b0:457:138:1e88 with SMTP id f1-20020a056402194100b0045701381e88mr3223796edz.394.1666107131781; Tue, 18 Oct 2022 08:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666107131; cv=none; d=google.com; s=arc-20160816; b=hxruOQp/pIyz/5mgeO9XujGNODVa0CZ35Vu3v8g6xn3BZYEN0F7iQnHsw8pQy+Qdkp sdxmp6S9tU7vYmsGf8vggApEFE0RatwwbJQ1PhhswhTD4bEGfCCvVPHuOQFqqqe8wi+h AyNyJ0hixXikbPXZWz4T6evy4w34oA27NbCVTjLPbrACb0gl05ZhwHufAvG6tuk7XKlX glZwxlupesn1R3t4D2/G2Um/1xP/HQ3+ULMYy9tEXjKQOH/MChcyozBC9rXSS5lXvxDd 89vhIqAce17r0WCa0Y75fNrWDBKHFh+Q9pBjyvf3XboodSaLTVm9px39SuRKeTBqsaME Zxww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UPjX8YygxtCcRrbYn3FxymvJ8EWixkz9W2za1oHEXVo=; b=eXz0lAl2XvPYEpqVuFZT6P1wZkVAmnvopJ+ErmsTgI7FCpAfrQU/VeOkkZGX6y9BRN YfplmeLhE0bZ+dLcQZyI2sTg66eCOY/tsuPBvT6t3n5Zb/WalsZTJYlW7RbTEx+x4Dfl WfF2V9AhCk3ZKbskt2RaTbhOCsTdlf7XbT9kcUzjypqvuWLFk6WkHu0zu+/COi37Fjbo 0ShxXlJjenWraswlKXxK7akvXcIcflqIxlBahpDX5YxaN2mIo9qeRmuN7qe+CQFW5PMK JrXnfytG/xGKn28xpwCkiWbs3JmVfwRd4k8nS0E5cfp+UuBzatSKEkHFL7qOC0/hTDpO ypgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wHWBloqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm1-20020a05640222c100b004589ea2d983si9992971edb.287.2022.10.18.08.31.46; Tue, 18 Oct 2022 08:32:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wHWBloqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbiJRP3a (ORCPT + 99 others); Tue, 18 Oct 2022 11:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbiJRP3G (ORCPT ); Tue, 18 Oct 2022 11:29:06 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC9E6BC62D for ; Tue, 18 Oct 2022 08:29:04 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id c22so17075808lja.6 for ; Tue, 18 Oct 2022 08:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UPjX8YygxtCcRrbYn3FxymvJ8EWixkz9W2za1oHEXVo=; b=wHWBloqiiwx1jqX9ysI/sEnSimM+LufKG+jyIximgCy4KFyv9/5FcYTEmQqzYo+BtF I7iAYnHfUOHyxFQJHD8JnD0vtZHDXCZuI7bMNPz9hzlE1zhXONBPzoZxS0SSW2h79IfV CG4uuKU90clSzh0UOUBaRoRQIkgovBbeqIc7ONuqcm8cfQLl1cOc4onShQdMWeLXvyK/ xr3mbBOVG1XS0UrP+vtSuy003lxBekgP8qUpJpmgG0SZ4d8+tStH0MqLqIRUhpc2JVlf +HyAs2qFzkyYoiatPzCjN5fGZisvRDzdpSo2WGqgp93USKxPoJuhcD8Abn3uVlJAVswo 9QKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UPjX8YygxtCcRrbYn3FxymvJ8EWixkz9W2za1oHEXVo=; b=DkCChkRwIReyQ5DVczKUC0n7ujJqlaqCr6UkBxwIpToHAZDuGOGslTV4qJsnsI0hfi VyvLlgCG9QqX8cXQ5lUWeV6FKC0xvX1bbIUjI9mytktH0RZvB1ad1o8Wc3HmxxiM6lOR j4VpuE8oo7GO2COu4l0udmOZyo4GuC4pa2K9V4CsSR4DG7DvLknZy5ZXi8KR/9oU5RoM HMp/k2hyRo+kGrpg+lobR4RS5CyoMqpliCVkOO4+T/0XD64yehaCTsnYGDHVQC/zLHBm GnloojUABfe2uxa1mFS8XjvidSEclMNtaLkCESeu3h/1f/U17QhZqAO+px22TbQ6c0QL psXA== X-Gm-Message-State: ACrzQf0mZpp5OooJvoYHSNs+csyXJ4vMSUMqqaCP66mkjzFVRE8i/ZN1 VUfZTg0oCTfKFH9Nz1K3/+5HEw== X-Received: by 2002:a05:651c:98a:b0:26d:fd1f:10 with SMTP id b10-20020a05651c098a00b0026dfd1f0010mr1287534ljq.323.1666106943060; Tue, 18 Oct 2022 08:29:03 -0700 (PDT) Received: from uffe-XPS13.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id a9-20020a05651c030900b0026ddd41aecasm1998617ljp.135.2022.10.18.08.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 08:29:02 -0700 (PDT) From: Ulf Hansson To: Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: Dmitry Baryshkov , Maulik Shah , Rajendra Nayak , Sudeep Holla , Amit Pundir , Ulf Hansson , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/6] soc: qcom: rpmh-rsc: Save base address of drv Date: Tue, 18 Oct 2022 17:28:36 +0200 Message-Id: <20221018152837.619426-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221018152837.619426-1-ulf.hansson@linaro.org> References: <20221018152837.619426-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747039951771349513?= X-GMAIL-MSGID: =?utf-8?q?1747039951771349513?= From: Maulik Shah Add changes to save drv's base address for rsc. This is used to read drv's configuration such as solver mode is supported or to write into CONTROL_TCS registers. Signed-off-by: Maulik Shah Reviewed-by: Ulf Hansson Tested-by: Dmitry Baryshkov # SM8450 --- drivers/soc/qcom/rpmh-internal.h | 2 ++ drivers/soc/qcom/rpmh-rsc.c | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/soc/qcom/rpmh-internal.h b/drivers/soc/qcom/rpmh-internal.h index cd3d6ce137e3..7866bb1e5361 100644 --- a/drivers/soc/qcom/rpmh-internal.h +++ b/drivers/soc/qcom/rpmh-internal.h @@ -91,6 +91,7 @@ struct rpmh_ctrlr { * Resource State Coordinator controller (RSC) * * @name: Controller identifier. + * @base: Start address of the DRV registers in this controller. * @tcs_base: Start address of the TCS registers in this controller. * @id: Instance id in the controller (Direct Resource Voter). * @num_tcs: Number of TCSes in this DRV. @@ -114,6 +115,7 @@ struct rpmh_ctrlr { */ struct rsc_drv { const char *name; + void __iomem *base; void __iomem *tcs_base; int id; int num_tcs; diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 050b5f5c9f62..8e01697f59af 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -881,8 +881,7 @@ static int rpmh_rsc_pd_attach(struct rsc_drv *drv, struct device *dev) return ret; } -static int rpmh_probe_tcs_config(struct platform_device *pdev, - struct rsc_drv *drv, void __iomem *base) +static int rpmh_probe_tcs_config(struct platform_device *pdev, struct rsc_drv *drv) { struct tcs_type_config { u32 type; @@ -896,9 +895,9 @@ static int rpmh_probe_tcs_config(struct platform_device *pdev, ret = of_property_read_u32(dn, "qcom,tcs-offset", &offset); if (ret) return ret; - drv->tcs_base = base + offset; + drv->tcs_base = drv->base + offset; - config = readl_relaxed(base + DRV_PRNT_CHLD_CONFIG); + config = readl_relaxed(drv->base + DRV_PRNT_CHLD_CONFIG); max_tcs = config; max_tcs &= DRV_NUM_TCS_MASK << (DRV_NUM_TCS_SHIFT * drv->id); @@ -960,7 +959,6 @@ static int rpmh_rsc_probe(struct platform_device *pdev) char drv_id[10] = {0}; int ret, irq; u32 solver_config; - void __iomem *base; /* * Even though RPMh doesn't directly use cmd-db, all of its children @@ -987,11 +985,11 @@ static int rpmh_rsc_probe(struct platform_device *pdev) drv->name = dev_name(&pdev->dev); snprintf(drv_id, ARRAY_SIZE(drv_id), "drv-%d", drv->id); - base = devm_platform_ioremap_resource_byname(pdev, drv_id); - if (IS_ERR(base)) - return PTR_ERR(base); + drv->base = devm_platform_ioremap_resource_byname(pdev, drv_id); + if (IS_ERR(drv->base)) + return PTR_ERR(drv->base); - ret = rpmh_probe_tcs_config(pdev, drv, base); + ret = rpmh_probe_tcs_config(pdev, drv); if (ret) return ret; @@ -1014,7 +1012,7 @@ static int rpmh_rsc_probe(struct platform_device *pdev) * 'HW solver' mode where they can be in autonomous mode executing low * power mode to power down. */ - solver_config = readl_relaxed(base + DRV_SOLVER_CONFIG); + solver_config = readl_relaxed(drv->base + DRV_SOLVER_CONFIG); solver_config &= DRV_HW_SOLVER_MASK << DRV_HW_SOLVER_SHIFT; solver_config = solver_config >> DRV_HW_SOLVER_SHIFT; if (!solver_config) {