Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp767131pxa; Sat, 1 Aug 2020 05:35:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwu4TjZzdvPHstNsh99dkNg1+v6ZCdA1pIPfctj8Pwf3dW993n6C+0SVEQOyph3EHo80v5h X-Received: by 2002:aa7:d45a:: with SMTP id q26mr7888549edr.95.1596285307171; Sat, 01 Aug 2020 05:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596285307; cv=none; d=google.com; s=arc-20160816; b=pmBnsTzMFUu3SeVAUOH96I22g3BXSb0ItnQ2VlV1HzO/gmZe5iCqOesbkzmrukFXZj MzzLBh0uFhvAEW5BQC5gC/TxjdDrNFBjk5aViSRUhhlpm/cmrm7XaUazPmJgxesthLTB odgwqFQX41KQutcI208v/52j75J5WSqPYQ632GNzlB4pVAT80eQcVKcnGWY+TKT1ulsf lEk60pLGXCsvuXuL0zN/xaO0Sa3iguelxKpySI8P5mSgi1H7TCWw95NlcWhXXJzCuSC/ cm5yBYw9CFR5h3iYTI4p97M23D7p1ijCYEHE8UkG0+nA03tWpc/DTHMH/nU/cxpVhxLz f4Ig== 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 :dmarc-filter:dkim-signature; bh=vOImtBgeqdRnUROqMwdyXuAZ1BNGZF6kDhd29hTqD0E=; b=jpdymHRTNCvIi69Q8C/j7PKKqUGWovD2S2gUWC4Ma50v66O6+sP9HhOaxjukwSqbHh OaCA0o+KdL/yrxxTJiY9yuEba7BcHwPT7sh894N4ve0H+bqKhF9RfyrHCkgKrqmMqQTR lA/HZkHwxK4U98JR+IL9SpcSsY7se/sOB1ebL0G3V4Z/0JEL7l0oWKwTe5ZqnXslB2Kh AYNeUJhXWzkwRMsgf5m+UXSFrBgL12C7emTdMLlMu+5yhbCWDo4SnrVam4I/iEbpauYG SKd886I96cSrWEzP7SDohMUPgH6WU3JAuHgidoam9j/wpoYcZ/rvIb5/QW8ABQ9Gkm6x oJiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="bdwznQt/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz27si7216100ejc.415.2020.08.01.05.34.45; Sat, 01 Aug 2020 05:35:07 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b="bdwznQt/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729171AbgHAMcK (ORCPT + 99 others); Sat, 1 Aug 2020 08:32:10 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:14255 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729164AbgHAMcK (ORCPT ); Sat, 1 Aug 2020 08:32:10 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1596285129; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=vOImtBgeqdRnUROqMwdyXuAZ1BNGZF6kDhd29hTqD0E=; b=bdwznQt/T1eswkLYP2Yzn0naxOwTOzOoW6FwFHvG35lZK45p5CTQWgptdFWi0mbsmxgR2KjQ k2yxB0+yP/b8cgLx9apn4Zg0n3UpooeZ2VTnHOH6gpVzr8jF08uHNhpjKzIXklI5c03x9b0+ snJ7NyELrqiRnA/rJgCf+st+SyA= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5f25608f2c24b37bbe5ba023 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 01 Aug 2020 12:31:11 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3812CC433CB; Sat, 1 Aug 2020 12:31:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham autolearn_force=no version=3.4.0 Received: from blr-ubuntu-253.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sibis) by smtp.codeaurora.org (Postfix) with ESMTPSA id E7FF0C43391; Sat, 1 Aug 2020 12:31:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E7FF0C43391 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=sibis@codeaurora.org From: Sibi Sankar To: robh+dt@kernel.org, georgi.djakov@linaro.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, jonathan@marek.ca, linux-pm@vger.kernel.org, Sibi Sankar Subject: [PATCH 3/7] interconnect: qcom: Lay the groundwork for adding EPSS support Date: Sat, 1 Aug 2020 18:00:45 +0530 Message-Id: <20200801123049.32398-4-sibis@codeaurora.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200801123049.32398-1-sibis@codeaurora.org> References: <20200801123049.32398-1-sibis@codeaurora.org> 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 Lay the groundwork for adding Epoch Subsystem (EPSS) L3 support on SM8250. Signed-off-by: Sibi Sankar --- drivers/interconnect/qcom/osm-l3.c | 37 +++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/interconnect/qcom/osm-l3.c b/drivers/interconnect/qcom/osm-l3.c index 00831c33e0fe5..27c9ece52efda 100644 --- a/drivers/interconnect/qcom/osm-l3.c +++ b/drivers/interconnect/qcom/osm-l3.c @@ -21,13 +21,13 @@ #define LUT_MAX_ENTRIES 40U #define LUT_SRC GENMASK(31, 30) #define LUT_L_VAL GENMASK(7, 0) -#define LUT_ROW_SIZE 32 #define CLK_HW_DIV 2 -/* Register offsets */ +/* OSM Register offsets */ #define REG_ENABLE 0x0 -#define REG_FREQ_LUT 0x110 -#define REG_PERF_STATE 0x920 +#define OSM_LUT_ROW_SIZE 32 +#define OSM_REG_FREQ_LUT 0x110 +#define OSM_REG_PERF_STATE 0x920 #define OSM_L3_MAX_LINKS 1 @@ -37,6 +37,7 @@ struct qcom_osm_l3_icc_provider { void __iomem *base; unsigned int max_state; + unsigned int reg_perf_state; unsigned long lut_tables[LUT_MAX_ENTRIES]; struct icc_provider provider; }; @@ -60,6 +61,9 @@ struct qcom_icc_node { struct qcom_icc_desc { struct qcom_icc_node **nodes; size_t num_nodes; + unsigned int lut_row_size; + unsigned int reg_freq_lut; + unsigned int reg_perf_state; }; #define DEFINE_QNODE(_name, _id, _buswidth, ...) \ @@ -82,6 +86,9 @@ static struct qcom_icc_node *sdm845_osm_l3_nodes[] = { static const struct qcom_icc_desc sdm845_icc_osm_l3 = { .nodes = sdm845_osm_l3_nodes, .num_nodes = ARRAY_SIZE(sdm845_osm_l3_nodes), + .lut_row_size = OSM_LUT_ROW_SIZE, + .reg_freq_lut = OSM_REG_FREQ_LUT, + .reg_perf_state = OSM_REG_PERF_STATE, }; DEFINE_QNODE(sc7180_osm_apps_l3, SC7180_MASTER_OSM_L3_APPS, 16, SC7180_SLAVE_OSM_L3); @@ -95,6 +102,9 @@ static struct qcom_icc_node *sc7180_osm_l3_nodes[] = { static const struct qcom_icc_desc sc7180_icc_osm_l3 = { .nodes = sc7180_osm_l3_nodes, .num_nodes = ARRAY_SIZE(sc7180_osm_l3_nodes), + .lut_row_size = OSM_LUT_ROW_SIZE, + .reg_freq_lut = OSM_REG_FREQ_LUT, + .reg_perf_state = OSM_REG_PERF_STATE, }; DEFINE_QNODE(sm8150_osm_apps_l3, SM8150_MASTER_OSM_L3_APPS, 32, SM8150_SLAVE_OSM_L3); @@ -108,6 +118,9 @@ static struct qcom_icc_node *sm8150_osm_l3_nodes[] = { static const struct qcom_icc_desc sm8150_icc_osm_l3 = { .nodes = sm8150_osm_l3_nodes, .num_nodes = ARRAY_SIZE(sm8150_osm_l3_nodes), + .lut_row_size = OSM_LUT_ROW_SIZE, + .reg_freq_lut = OSM_REG_FREQ_LUT, + .reg_perf_state = OSM_REG_PERF_STATE, }; static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) @@ -138,7 +151,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) break; } - writel_relaxed(index, qp->base + REG_PERF_STATE); + writel_relaxed(index, qp->base + qp->reg_perf_state); return 0; } @@ -193,9 +206,15 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) return -ENODEV; } + desc = device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; + + qp->reg_perf_state = desc->reg_perf_state; + for (i = 0; i < LUT_MAX_ENTRIES; i++) { - info = readl_relaxed(qp->base + REG_FREQ_LUT + - i * LUT_ROW_SIZE); + info = readl_relaxed(qp->base + desc->reg_freq_lut + + i * desc->lut_row_size); src = FIELD_GET(LUT_SRC, info); lval = FIELD_GET(LUT_L_VAL, info); if (src) @@ -214,10 +233,6 @@ static int qcom_osm_l3_probe(struct platform_device *pdev) } qp->max_state = i; - desc = device_get_match_data(&pdev->dev); - if (!desc) - return -EINVAL; - qnodes = desc->nodes; num_nodes = desc->num_nodes; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project