Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp936415imm; Wed, 6 Jun 2018 08:04:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIuKJnMnMIF9Ku2xpLpXKxfaKoVdnqZVmRZKOCKH+L9c/OFgydIBIOUp6VfHlrcCY/0bA5c X-Received: by 2002:a65:5143:: with SMTP id g3-v6mr2853257pgq.190.1528297495088; Wed, 06 Jun 2018 08:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528297495; cv=none; d=google.com; s=arc-20160816; b=Ce4ONhw/EEy+2JABfBZl/FlytpYzDrIUj0AoFXs9/R253m5Wirg458RiPDUFUxA6P4 fJKiWvzBlbEtSIROFpbVsH6I6O/Sl1AxsQ1+DUwaXb/s83wDxU9j4PWky4XRV9XILDy8 6HmnkeL918LEexdMx0fBgUd9ZNqxJK/sm28swxfuac9v5mMq+PtV4v2HQA3sOyn3zTJe p1AJVxHqfdeu7by/qa5VNBM+DujsedJqiyJbESzJvsk3kJ4iWV8XTAXb7q55EVA6qVJl zM/qk6AlZKMjoMP9u0H30SFbEFfncg+dkJZ+iUygQXZJfdBuQ8W5zd3DHc54LCN9eNKJ Xftw== 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 :content-language:in-reply-to:mime-version:date:message-id:autocrypt :openpgp:references:cc:to:subject:from:dkim-signature :arc-authentication-results; bh=syVhND38kKHNb/CTD4aACEhRBiLxFAiXyxOKv+DjNK8=; b=GA0ZCF5ax4jYk04+aFLpViGNaHkbO9GhfqbmSkidKFcJ0XnENLUVt9A0t/o2Lf2ZE8 efdg4/8ukixVNl6xyVThMrlyuGKHbVHa/xKBXl6oVSxCBALCqTJhdioLcgDqedNSc9G+ ++wesEQ2QfUDJO0aNOdhTbUOX1i65TCo4qJoMuGdE11DpPFYjAw47BEwBipYSIe90/YR O7PM81ncE+sT5uQFu6jcs+s2Nt2KAsy0YT32NxibxRmsXzeFXwisYv2F/718IAkNABuW VnflrMvfwcZWj17sWMSrvAXbLn46MCbiP+kLhfTmO8IdK5ROVBZ7BGFIdEjZo4pv8n/Y +udw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CGJjvqFN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m13-v6si28056299pls.70.2018.06.06.08.04.39; Wed, 06 Jun 2018 08:04:55 -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=@linaro.org header.s=google header.b=CGJjvqFN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752461AbeFFPDf (ORCPT + 99 others); Wed, 6 Jun 2018 11:03:35 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40870 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbeFFPDY (ORCPT ); Wed, 6 Jun 2018 11:03:24 -0400 Received: by mail-wm0-f66.google.com with SMTP id n5-v6so12623909wmc.5 for ; Wed, 06 Jun 2018 08:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:subject:to:cc:references:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=syVhND38kKHNb/CTD4aACEhRBiLxFAiXyxOKv+DjNK8=; b=CGJjvqFNsp70epgr2U4DIWGJbJe44da/PQTSmqGU9ZKBvezVqNqqaYyaHawka/7Zm1 hMaGiG/A8Xzh5CwuWZJ49cpc7XnrfWt7ZZvlkx9uree2+dfvL1O72ysjekLY3Ktovxi3 O9KA+/MIX/arHSoBKpLlB2hSuEzkKJn63rwCc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=syVhND38kKHNb/CTD4aACEhRBiLxFAiXyxOKv+DjNK8=; b=byrAQwkOQufRchWGFIwwo3bUQE+DoDvlTqc1YbawhsA2p2625BUVMG91rgrdmJnRpb 3z6pVpdTWYk+10WEEwrH9ndNrFb9E8Hjjb2DnY6lCz+xIU2fRML2mbDCSt8RxQMSLCpX TGVnH3ukY8FGxMRSrZYjTXyj/5xUefJ+XixKvxmn90SM71waszsODf2IFjszFl0X1wH/ 9kVZWfxoZpQaJdcIZ+DvdKX70C+uQERXIAvsi7ncOf6f8VIszVeUDQPNv2QQFxqgRz1T i7ut0J8TwjRZcfjsfoss52G3qf7E7HuuYyghf1Zq1k+yjzWv3DW4bjXje5UzIUkU6BTp 4SmQ== X-Gm-Message-State: APt69E1KJ3vtuhmU3DbfcGkzZyGgs1cxLYYb9YjkFGH7TfAH64htgYBl b4OYbKBAcvvFrELZQiOxl1HTPw== X-Received: by 2002:a1c:e48a:: with SMTP id b132-v6mr2023800wmh.129.1528297402981; Wed, 06 Jun 2018 08:03:22 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id c10-v6sm12486721wrs.6.2018.06.06.08.03.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 08:03:22 -0700 (PDT) From: Georgi Djakov Subject: Re: [PATCH v4 5/7] interconnect: qcom: Add msm8916 interconnect provider driver To: Evan Green Cc: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net, robh+dt@kernel.org, Michael Turquette , khilman@baylibre.com, vincent.guittot@linaro.org, skannan@codeaurora.org, Bjorn Andersson , amit.kucheria@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20180309210958.16672-1-georgi.djakov@linaro.org> <20180309210958.16672-6-georgi.djakov@linaro.org> Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= xsFNBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyycE12zMkk+Sc ASMfXhfywB0tXRNmzsywdxQFcJ6jblPNxscnGMh2VlY2rezmqJdcK4G4Lprkc0jOHotV/6oJ mj9h95Ouvbq5TDHx+ERn8uyt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7ayYJIXFqjl/X0KBcCbiAl4vbdBw1bqFnO4zd1lMXKVoa29UHqby4MPbQhjWNVv9kqp8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: <21c5adcc-dc18-73a1-e07a-d84f2e6ae534@linaro.org> Date: Wed, 6 Jun 2018 18:03:21 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Evan, On 12.05.18 г. 0:29, Evan Green wrote: > Hi Georgi, > > On Fri, Mar 9, 2018 at 1:11 PM Georgi Djakov > wrote: > >> Add driver for the Qualcomm interconnect buses found in msm8916 based >> platforms. > >> Signed-off-by: Georgi Djakov >> --- >> drivers/interconnect/Kconfig | 5 + >> drivers/interconnect/Makefile | 1 + >> drivers/interconnect/qcom/Kconfig | 11 + >> drivers/interconnect/qcom/Makefile | 2 + >> drivers/interconnect/qcom/msm8916.c | 482 > ++++++++++++++++++++++++++++++++++++ >> include/linux/interconnect/qcom.h | 350 ++++++++++++++++++++++++++ >> 6 files changed, 851 insertions(+) >> create mode 100644 drivers/interconnect/qcom/Kconfig >> create mode 100644 drivers/interconnect/qcom/msm8916.c >> create mode 100644 include/linux/interconnect/qcom.h > ... >> diff --git a/drivers/interconnect/qcom/msm8916.c > b/drivers/interconnect/qcom/msm8916.c >> new file mode 100644 >> index 000000000000..d5b54f8261c8 >> --- /dev/null >> +++ b/drivers/interconnect/qcom/msm8916.c > ... >> +static int qnoc_probe(struct platform_device *pdev) >> +{ >> + const struct qcom_icc_desc *desc; >> + struct qcom_icc_node **qnodes; >> + struct qcom_icc_provider *qp; >> + struct resource *res; >> + struct icc_provider *provider; >> + size_t num_nodes, i; >> + int ret; >> + >> + /* wait for RPM */ >> + if (!qcom_icc_rpm_smd_available()) >> + return -EPROBE_DEFER; >> + >> + desc = of_device_get_match_data(&pdev->dev); >> + if (!desc) >> + return -EINVAL; >> + >> + qnodes = desc->nodes; >> + num_nodes = desc->num_nodes; >> + >> + qp = devm_kzalloc(&pdev->dev, sizeof(*qp), GFP_KERNEL); >> + if (!qp) >> + return -ENOMEM; >> + >> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> + qp->base = devm_ioremap_resource(&pdev->dev, res); >> + if (IS_ERR(qp->base)) >> + return PTR_ERR(qp->base); >> + >> + qp->bus_clk = devm_clk_get(&pdev->dev, "bus_clk"); >> + if (IS_ERR(qp->bus_clk)) >> + return PTR_ERR(qp->bus_clk); >> + >> + qp->bus_a_clk = devm_clk_get(&pdev->dev, "bus_a_clk"); >> + if (IS_ERR(qp->bus_a_clk)) >> + return PTR_ERR(qp->bus_a_clk); >> + >> + provider = &qp->provider; >> + provider->dev = &pdev->dev; >> + provider->set = &qcom_icc_set; >> + INIT_LIST_HEAD(&provider->nodes); >> + provider->data = qp; >> + >> + ret = icc_add_provider(provider); >> + if (ret) { >> + dev_err(&pdev->dev, "error adding interconnect > provider\n"); >> + return ret; >> + } >> + >> + for (i = 0; i < num_nodes; i++) { >> + struct icc_node *node; >> + int ret; >> + size_t j; >> + >> + node = icc_node_create(qnodes[i]->id); >> + if (IS_ERR(node)) { >> + ret = PTR_ERR(node); >> + goto err; >> + } >> + >> + node->name = qnodes[i]->name; >> + node->data = qnodes[i]; >> + icc_node_add(node, provider); >> + >> + dev_dbg(&pdev->dev, "registered node %p %s %d\n", node, >> + qnodes[i]->name, node->id); >> + >> + /* populate links */ >> + for (j = 0; j < qnodes[i]->num_links; j++) >> + if (qnodes[i]->links[j]) >> + icc_link_create(node, > qnodes[i]->links[j]); >> + >> + ret = qcom_icc_init(node); >> + if (ret) >> + dev_err(&pdev->dev, "%s init error (%d)\n", > node->name, >> + ret); > > Don't you want to call qcom_icc_init before icc_link_create? As soon as > icc_link_create is called, the node is connected to the graph, and > qcom_icc_set can be called. > I agree. >> + } >> + >> + platform_set_drvdata(pdev, provider); >> + >> + return ret; >> +err: >> + icc_del_provider(provider); >> + return ret; >> +} >> + >> +static int qnoc_remove(struct platform_device *pdev) >> +{ >> + struct icc_provider *provider = platform_get_drvdata(pdev); >> + >> + icc_del_provider(provider); > > Presumably in the framework nodes and links ought to get cleaned up > somewhere too, right? As it is now, the devm code frees provider when this > device is removed, even though provider is still very connected in the > graph via the nodes and links. Sorry, this part is incomplete. Will implement the rest of the cleanup code. >> + >> + return 0; >> +} >> + >> +static const struct of_device_id qnoc_of_match[] = { >> + { .compatible = "qcom,msm8916-pnoc", .data = &msm8916_pnoc }, >> + { .compatible = "qcom,msm8916-snoc", .data = &msm8916_snoc }, >> + { .compatible = "qcom,msm8916-bimc", .data = &msm8916_bimc }, >> + { }, >> +}; >> +MODULE_DEVICE_TABLE(of, qnoc_of_match); >> + >> +static struct platform_driver qnoc_driver = { >> + .probe = qnoc_probe, >> + .remove = qnoc_remove, >> + .driver = { >> + .name = "qnoc-msm8916", >> + .of_match_table = qnoc_of_match, >> + }, >> +}; >> +module_platform_driver(qnoc_driver); >> +MODULE_AUTHOR("Georgi Djakov "); >> +MODULE_DESCRIPTION("Qualcomm msm8916 NoC driver"); >> +MODULE_LICENSE("GPL v2"); >> diff --git a/include/linux/interconnect/qcom.h > b/include/linux/interconnect/qcom.h >> new file mode 100644 >> index 000000000000..2cd378d2f575 >> --- /dev/null >> +++ b/include/linux/interconnect/qcom.h >> @@ -0,0 +1,350 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +/* >> + * Qualcomm interconnect IDs >> + * >> + * Copyright (c) 2018, Linaro Ltd. >> + * Author: Georgi Djakov >> + */ >> + >> +#ifndef __QCOM_INTERCONNECT_IDS_H >> +#define __QCOM_INTERCONNECT_IDS_H >> + >> +#define FAB_BIMC 0 >> +#define FAB_SYS_NOC 1024 >> +#define FAB_MMSS_NOC 2048 >> +#define FAB_OCMEM_NOC 3072 >> +#define FAB_PERIPH_NOC 4096 >> +#define FAB_CONFIG_NOC 5120 >> +#define FAB_OCMEM_VNOC 6144 > > Looks like you're still following that downstream convention of NoCs being > divisible by 1024, masters in 1-512, and slaves in 512-1023, then I don't > know about the 10000s. This was documented somewhere downstream, can you > add that documentation somewhere in here? Yes, i am currently following the existing IDs. The 10000s are the nodes used for the interconnects between the NoCs. I don't think it's worth documenting this, as the plan is to switch to arbitrary numbers. Thanks, Georgi