Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp432841pxh; Wed, 10 Nov 2021 04:11:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaArDxj7L0dS9Wlw138URgweYiIBbC8/cbIHJlHUhHfYUR1CWbhIKu+ENZPew677S+AmEk X-Received: by 2002:a17:906:9b96:: with SMTP id dd22mr15831514ejc.422.1636546262846; Wed, 10 Nov 2021 04:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636546262; cv=none; d=google.com; s=arc-20160816; b=nwv+2Fomzm+c3WBspgW5C0uk8Ldwq6ZeUFEMH0qkfKn42gf2UwliM2r0LzOI0YZofV eXeJX/qc+y9G0mXCRRZcZFuDHFKJQ0s6+BVOvt+pQ5HFwWCfq8QDDFT/1mZZ+BCbfnjK bcQbQcCLudqtshKa4eE99eRV0N04R72OXvPnZCfYdgX3xVtyn/NyNrvNg7ig0/M7uOG8 m4KVaPmV1OswYGAkysdomugdtXTJ/RojZ4zuSrsO1N1bOEQX/hf+AGeLkEU/gk1VdmUf HBRFahyKb3YwidjyqTsNiMKE/FuqWX0CLXhPu0tvDxuPfooNV8MqyOe0vx+dHPAvJxm5 YE6A== 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=id7DvGBlJbwLopapF2TpliiENdQPCEGHhQVDE16kcTQ=; b=CeTkhIbCr4KDMXUxRXOD/Hpm78XFzSDtDwTJzX73fD+h+p78EPLraEEO/TZ676wpGU 6NUkMDI+TmVarHLAWM/iBYv++z+2/Mw0aVbbUOANKeSQGgDHQKm4PjY+LHarlREFcSoS EF+IHw665iptd8UCvEwkvPm9xKmMWr4KXl47fY4CPAxCdtQz3sMM41aynIJx0tpwmxqs bXffiKl8o2OwZ3m+6dUi1OvFuwyKLiDJ7SN1S8QbK8azlFX+PgvcwhQaz7k9WqiEVQoj KTehllnzHA8ussPR82V5sRlrcFwWc0lX5W8fwPub9KCQh+cdW8a7/jOIwaimDxu3XSin 35VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s8IqHv7V; 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 ht12si29776507ejc.207.2021.11.10.04.10.37; Wed, 10 Nov 2021 04:11:02 -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=s8IqHv7V; 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 S231716AbhKJMKo (ORCPT + 99 others); Wed, 10 Nov 2021 07:10:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbhKJMKk (ORCPT ); Wed, 10 Nov 2021 07:10:40 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5389C06120B for ; Wed, 10 Nov 2021 04:07:51 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id 188so2071143pgb.7 for ; Wed, 10 Nov 2021 04:07:51 -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=id7DvGBlJbwLopapF2TpliiENdQPCEGHhQVDE16kcTQ=; b=s8IqHv7VqpDUAGMDN0wFjtkc3cV8oMNAb1/sE5N+igOB9reyOvmD8aHW8laRT/sdzk uYuxdtCSy3yvBcHZHKegOy8W0xZSJZy1OkruTKDuX+M2RbyDUtigzgR/pzTZxVBZPQEx xbOHeMmClALk3s9+R8z1Mtn5Hluj5vc/ovsfhaEbOv0PoiS5Qb3lVdrtGuZvngBTSNQB vcYFp3VWVPpAERM54S240r1iWGFtH+G71KitExOKQRNNQJC3rzpkBvce86fJyWp5ktO5 3ZSzCcIQXGvZX/hLN1rzv4lgfymQmWnfRZz9Dl2J62J+oqogFAYLaoa0Ot5BriLRyRtn Z1pA== 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=id7DvGBlJbwLopapF2TpliiENdQPCEGHhQVDE16kcTQ=; b=gHzeZRoWdFFX2IuYgWQlXygYgDkJn23X+BhQcQXbokRm88ZDD1TnLjbhW0oua3HJVQ uQOjU9jflZUwL39SP9Q88pOzOyA3xmJYYc+cI7bnd1HWHd3LQHcvT+4n8kDWJ8BtaBPm NIPaYMz2SdsC3lOvyzF+Qi/qcw8qVgfWALQQ0tnhVy9fdHNmew6X+x85F3ik6sKbl1ol HTXYonivOSnFXPAUhDQAY8zWKe9/97Ib/CzVagCYXnGLXXeowu0Psm2DzflKcx4RHnQO 7dczz2VeRpTOMKMXu3Um6PML60p48wLwojaxINni+ZSHtAfSgIkleGJgmf/XBLgAT7bs 9baQ== X-Gm-Message-State: AOAM531cakiUGULmRxANJL5X5DMC9pfTy2MzANCk0qMkx/izgrhQC7vH Y1hkb02NJyzVmWPdvY1WLvaNpNuaMQ7/dg== X-Received: by 2002:a63:1451:: with SMTP id 17mr11275138pgu.175.1636546071399; Wed, 10 Nov 2021 04:07:51 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Nov 2021 04:07:50 -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 4/6] interconnect: icc-rpm: Support child NoC device probe Date: Wed, 10 Nov 2021 20:07:14 +0800 Message-Id: <20211110120716.6401-5-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 As shown in downstream DT[1], the System NoC of QCM2290 is modelled using 4 fab/noc devices: sys_noc + qup_virt + mmnrt_virt + mmrt_virt. Among those 3 virtual devices, qup is owned by RPM and has no regmap resource, while mmnrt and mmrt are owned by AP and share the same regmap as sys_noc. So it's logical to represent these virtual devices as child nodes of sys_noc in DT, so that such configuration can be supported with a couple of changes on qnoc_probe(): - If there are child nodes, populate them. - If the device descriptor has .regmap_cfg but there is no IOMEM resource for the device, use parent's regmap. [1] https://android.googlesource.com/kernel/msm-extra/devicetree/+/refs/tags/android-11.0.0_r0.56/qcom/scuba-bus.dtsi Signed-off-by: Shawn Guo --- drivers/interconnect/qcom/icc-rpm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 22a98c0b29af..2dfa79ba27bd 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -347,8 +347,13 @@ int qnoc_probe(struct platform_device *pdev) void __iomem *mmio; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) + if (!res) { + /* Try parent's regmap */ + qp->regmap = dev_get_regmap(dev->parent, NULL); + if (qp->regmap) + goto regmap_done; return -ENODEV; + } mmio = devm_ioremap_resource(dev, res); @@ -364,6 +369,7 @@ int qnoc_probe(struct platform_device *pdev) } } +regmap_done: ret = devm_clk_bulk_get(dev, qp->num_clks, qp->bus_clks); if (ret) return ret; @@ -409,6 +415,10 @@ int qnoc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qp); + /* Populate child NoC devices if any */ + if (of_get_child_count(dev->of_node) > 0) + return of_platform_populate(dev->of_node, NULL, NULL, dev); + return 0; err: icc_nodes_remove(provider); -- 2.17.1