Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp434362pxh; Wed, 10 Nov 2021 04:12:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJ8UhS52peKp+XILcR5v9h0HWr/GE3eEZkWtoW5erLrT+fpIlPmmHoUtZFNz3mppNxOVvP X-Received: by 2002:a17:907:86a1:: with SMTP id qa33mr20367409ejc.142.1636546350269; Wed, 10 Nov 2021 04:12:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636546350; cv=none; d=google.com; s=arc-20160816; b=yAfPSP80KrAlqdYxIHDNJ8GxJ52Relx+wKmQCJhlTHs12UHhRQeZEJ/q0lLicaZZkr Pg/qrqaotBhWVb2z/K9hW35kcv0C+6qUoH3PzgnqA8poki0IQ1d8OtGsNqPgATzhb4Pm a6Zsatqnw8AGArbDh2bleMRUSZ9YVSsNXJ2syofUPWYw75dkZeiyH3UJFWeSehHb3Zl6 zww+kuoF2eoJVbYvsxrqSv0HrYym3anpGQR7Xqm624pRUSlWj++ZLx+2jcpJp4EBjufc j/W7H6kWP+Phe8zUH+cDmfrcEQ8b19bzTwnLRq2eIkAPwBwS613UaIWG3VHNN+2fEfBw JfzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=VyhuPuo3Dr6FLX90Yql2n8R2Vy9SBLHywkAT4A3YPD8=; b=OATSxLVqu+OvxWlCYOBRCcAjkGpY00HiEYeugqKdlvRd7C8YNQmYzVdKDz8U4nWqXt 5+AhNobggElgbU2ggXNEWc+ivHX0HXjcWOzxf1jqQxek04CGOcC/5HgQGaH6VbOGtvVz wkbN3Z4axvHFaZB2IKdQmKNoSDXxe1Hp7hMqvDUqoD3gXl/ZCZOS/T73E7qZfy0rKF81 pB9WsyshOHWNburCpAmWIshCSv8Th1CBQhAvvVdwL7hdsMX/aWhGedjuPCCXA8kpNM9+ K2xTKD6vUUwsRf58+3YltznIvuajNID2RFel2DaPTJSlHudvBT5L7cTetZHth0RPJh0u EgZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eIW85C9C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qa42si36724337ejc.545.2021.11.10.04.12.05; Wed, 10 Nov 2021 04:12:30 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=eIW85C9C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231706AbhKJMKl (ORCPT + 99 others); Wed, 10 Nov 2021 07:10:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231709AbhKJMKg (ORCPT ); Wed, 10 Nov 2021 07:10:36 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1389EC061766 for ; Wed, 10 Nov 2021 04:07:49 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id b4so2061933pgh.10 for ; Wed, 10 Nov 2021 04:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VyhuPuo3Dr6FLX90Yql2n8R2Vy9SBLHywkAT4A3YPD8=; b=eIW85C9CExtGE8flCJQCSN+XChabht7eH0U/OVjuA7BCE91EkfJ/CNS4qiPD+AfL2g ri18zagn1FlARjWtl8GyWJXyJmVs4gYrpfHTS2VkiHKNvrZJ0DHmLN+3WiBf2xt/xCIx Sa+JSTYVw1AsCyhrg/wuSWCIKNJjDJcuKyV1jZaC/qQg9R3Lrn3kNngVHQXWf3d6Eg56 NNrEEC9XkgSzHjuJOT6F8917/4hYEX9tEm8xJ2TWD+8ksPvfih+b9QkxfWQvF75EaIC8 mPbI0jaYop4g4pOPqm1Zq5/DYeLGmWqtC33EoDJiRbr3g6H7a27n9aWvsWdti3zi9aom Aq3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VyhuPuo3Dr6FLX90Yql2n8R2Vy9SBLHywkAT4A3YPD8=; b=7K54MzucrqywRodG+xoHJm56LDN31YkhKWrMcSx60ggATui8KzAWvnJhLtDgpp75fN XLNhaJJ6LogDDgy4j1E3TBRN7EXsUgpI4SWM7PtQzoz8SfdfKXv/wW9Fy3PmbmLQdskQ 8Dy5HQ9nYq0X3wAtli6/cmoQxoe1p9KYt/UrKWvDtpyt9gXWnDj/iIezQN1DTXXo0cBK p/mU0UayJdBGjRbTckOj4GbFKEeDZKiNZOb6E6f4kA/eewCC5vsKFLUr3RPdjm9oRfoE HHF1cwilwRJuI1+E2XknpaQ3l2hQE6oDcMguMqbSlmS3Z4cUXkX7CO4Usxn8CJTBQwBs JbpA== X-Gm-Message-State: AOAM533mbcahU/9nN1MI6WR+i9k4ZACJ6uPha0GW5SUMAeA+t4QmrRkU xCAIeb5DjoEWhg/AzPwOTTTFJA== X-Received: by 2002:a63:e755:: with SMTP id j21mr11565738pgk.235.1636546068584; Wed, 10 Nov 2021 04:07:48 -0800 (PST) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id g9sm8377914pfc.182.2021.11.10.04.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 04:07:47 -0800 (PST) From: Shawn Guo To: Georgi Djakov Cc: Bjorn Andersson , Rob Herring , Loic Poulain , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo Subject: [PATCH 3/6] interconnect: icc-rpm: Add QNOC type QoS support Date: Wed, 10 Nov 2021 20:07:13 +0800 Message-Id: <20211110120716.6401-4-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110120716.6401-1-shawn.guo@linaro.org> References: <20211110120716.6401-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It adds QoS support for QNOC type device which can be found on QCM2290 platform. The downstream driver[1] includes support for priority, limiter, regulator and forwarding setup. As QCM2290 support only requires priority and forwarding configuration, limiter and regulator support are omitted for this initial submission. [1] https://source.codeaurora.org/quic/la/kernel/msm-4.19/tree/drivers/soc/qcom/msm_bus/msm_bus_qnoc_adhoc.c?h=kernel.lnx.4.19.r22-rel Signed-off-by: Shawn Guo --- drivers/interconnect/qcom/icc-rpm.c | 38 ++++++++++++++++++++++++++--- drivers/interconnect/qcom/icc-rpm.h | 3 +++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 264a9399fb28..22a98c0b29af 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -17,6 +17,13 @@ #include "smd-rpm.h" #include "icc-rpm.h" +/* QNOC QoS */ +#define QNOC_QOS_MCTL_LOWn_ADDR(n) (0x8 + (n * 0x1000)) +#define QNOC_QOS_MCTL_DFLT_PRIO_MASK 0x70 +#define QNOC_QOS_MCTL_DFLT_PRIO_SHIFT 4 +#define QNOC_QOS_MCTL_URGFWD_EN_MASK 0x8 +#define QNOC_QOS_MCTL_URGFWD_EN_SHIFT 3 + /* BIMC QoS */ #define M_BKE_REG_BASE(n) (0x300 + (0x4000 * n)) #define M_BKE_EN_ADDR(n) (M_BKE_REG_BASE(n)) @@ -39,6 +46,27 @@ #define NOC_QOS_MODEn_ADDR(n) (0xc + (n * 0x1000)) #define NOC_QOS_MODEn_MASK 0x3 +static int qcom_icc_set_qnoc_qos(struct icc_node *src, u64 max_bw) +{ + struct icc_provider *provider = src->provider; + struct qcom_icc_provider *qp = to_qcom_provider(provider); + struct qcom_icc_node *qn = src->data; + struct qcom_icc_qos *qos = &qn->qos; + int rc; + + rc = regmap_update_bits(qp->regmap, + qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port), + QNOC_QOS_MCTL_DFLT_PRIO_MASK, + qos->areq_prio << QNOC_QOS_MCTL_DFLT_PRIO_SHIFT); + if (rc) + return rc; + + return regmap_update_bits(qp->regmap, + qp->qos_offset + QNOC_QOS_MCTL_LOWn_ADDR(qos->qos_port), + QNOC_QOS_MCTL_URGFWD_EN_MASK, + !!qos->urg_fwd_en << QNOC_QOS_MCTL_URGFWD_EN_SHIFT); +} + static int qcom_icc_bimc_set_qos_health(struct qcom_icc_provider *qp, struct qcom_icc_qos *qos, int regnum) @@ -163,10 +191,14 @@ static int qcom_icc_qos_set(struct icc_node *node, u64 sum_bw) dev_dbg(node->provider->dev, "Setting QoS for %s\n", qn->name); - if (qp->type == QCOM_ICC_BIMC) + switch (qp->type) { + case QCOM_ICC_BIMC: return qcom_icc_set_bimc_qos(node, sum_bw); - - return qcom_icc_set_noc_qos(node, sum_bw); + case QCOM_ICC_QNOC: + return qcom_icc_set_qnoc_qos(node, sum_bw); + default: + return qcom_icc_set_noc_qos(node, sum_bw); + } } static int qcom_icc_rpm_set(int mas_rpm_id, int slv_rpm_id, u64 sum_bw) diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index d8e77ce7fe06..66ce908a6e65 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -15,6 +15,7 @@ enum qcom_icc_type { QCOM_ICC_NOC, QCOM_ICC_BIMC, + QCOM_ICC_QNOC, }; /** @@ -43,6 +44,7 @@ struct qcom_icc_provider { * @ap_owned: indicates if the node is owned by the AP or by the RPM * @qos_mode: default qos mode for this node * @qos_port: qos port number for finding qos registers of this node + * @urg_fwd_en: enable urgent forwarding */ struct qcom_icc_qos { u32 areq_prio; @@ -51,6 +53,7 @@ struct qcom_icc_qos { bool ap_owned; int qos_mode; int qos_port; + bool urg_fwd_en; }; /** -- 2.17.1