Received: by 10.223.164.221 with SMTP id h29csp2316828wrb; Thu, 2 Nov 2017 09:03:16 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SBi/CcDkiavb4dZ2806Zo8mSHUbG6+Jt8pxqgECQgyd1bllsrF/zdhCuCeyH1RR+ESg+dk X-Received: by 10.101.99.199 with SMTP id n7mr4114740pgv.247.1509638596432; Thu, 02 Nov 2017 09:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509638596; cv=none; d=google.com; s=arc-20160816; b=dY/aQ0qtp60yRPLyl6WaW1FieFQKPRqJy4Xr+kIQ3ENNa3eRoXrZxLadj6XHLhfK82 nZYXeW3xr2QHcHxMrGx3xV5bCbQnEKUP+g/KcI90IoQeIC9eWf74DTc5hRut4vD61fMN 4IrCTqrRkSFRNgZIYNt6SF2+KrHqe4YtO04yj7LeCJH6YSJwJ60IBc56yriedCnlS8/b 55yRpnghxnoXXRlu4Drquf8seK2w2hLP6KQR951KwrS8Q5IAAisj2BbUcvbXpc1vwq4z n7HRjLuY/Qs7bgSZcpUi2CGd44tPx4rHORSLNJlpQuxmY6u8GLXHIsA01KJ+QPi4eqw3 nMaw== 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:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=eJeZ2DFOD1wHLF9eC8lqdSbkFw+M76XmLsV/T33ty48=; b=U1UW82IZ2wIN1h1HciDH8n9ZnR6q5K08ZftsziWnyuzhWY1Gp7fsajrCblDIvQ2SgS htjMZDwI0IND1KA6ciBaZ1+F7fBRLO0p0eHNnEhcgymYAtw9WQ8nsqHdNw2WB2bMqDu/ QjzjnIH08XI1SiQ4HnnzUAiLOgEG2RM0UjpmmxFX4BuHEcOU1gnqepg0YgwZKJfKbZk+ CwNiy1zZ9fBmUt2SuI0YeGWJLZWbzr2mWA6mMrKfPuwSfWc5guGQDsLj/tEi+0MNwOpr R3ru7WixbfhxZ+sopAtMZ05xk6SxFdnV/WLHthIZwttQLtVP7jA3lr/e2ut8OBNrWw+d Xy6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kNmJAoRl; 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 i76si3855991pgc.36.2017.11.02.09.03.02; Thu, 02 Nov 2017 09:03:16 -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=kNmJAoRl; 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 S934037AbdKBQBF (ORCPT + 97 others); Thu, 2 Nov 2017 12:01:05 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:50305 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934009AbdKBQBD (ORCPT ); Thu, 2 Nov 2017 12:01:03 -0400 Received: by mail-lf0-f66.google.com with SMTP id a132so10186lfa.7 for ; Thu, 02 Nov 2017 09:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eJeZ2DFOD1wHLF9eC8lqdSbkFw+M76XmLsV/T33ty48=; b=kNmJAoRlNxCAAm/x6AE8FNmZGby/+uHuoy8v9X4bz/vyJHM0rfI0/JWvH2cTWhGoaR b5ArLDtpGiYUdQntIt71SHRLGAZEugLVi/5HlwA1RtcxWG9Q3lStbUoFvi44KPgMUee5 HmXuQDcIGN+1wif/kUs0F5vFV8mqufr9e3Odg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eJeZ2DFOD1wHLF9eC8lqdSbkFw+M76XmLsV/T33ty48=; b=XExNmDyOkrwb1unlEnbTAyk3D0tL8+IjayooQSpvdNLSslis8rDvhXP7eqH2M7ZwaO A/g6dDoQ2LEd8Q+eXIvSA7fTGzfdtLvURpa6xW/pNyyoXLwDvLj+LQtvn3r4Hk++buN7 pI5XzLvrJfk+9NpYd/X647uXPWj8G8kkkPsBxcPp3LhudWj+ItVY6VEIfmH5Bug8I6CW 1LqNM2lj+aNm0YakoRKyLgYN1vcIYgou+MXCByuViQ1K4A8ckqjQ95yoM6cWmVQN2x9h UQKyd+k1A8jpCqE7bdPGQ4PK6NsMwk42sIJUx5ZhuhLDmeM1UgNr3x7rx93bm/cq7QQD 646Q== X-Gm-Message-State: AMCzsaW3HRCNmIpf3vn1gDmWZskKKAsFB34ZL51o4L4GNmz5elomlkHh wHnCunnzvAH1zmtnjuL5vduxHA== X-Received: by 10.46.56.14 with SMTP id f14mr1886550lja.46.1509638461332; Thu, 02 Nov 2017 09:01:01 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id g12sm601467lfd.61.2017.11.02.09.00.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 09:01:00 -0700 (PDT) Subject: Re: [PATCH v3 3/3] interconnect: Add Qualcomm msm8916 interconnect provider driver To: Amit Kucheria Cc: Linux PM list , gregkh@linuxfoundation.org, "Rafael J. Wysocki" , robh+dt@kernel.org, khilman@baylibre.com, Michael Turquette , Vincent Guittot , Saravana Kannan , Stephen Boyd , Andy Gross , seansw@qti.qualcomm.com, davidai@quicinc.com, LKML , lakml , linux-arm-msm@vger.kernel.org, mark.rutland@arm.com, Lorenzo Pieralisi References: <20170908171830.13813-1-georgi.djakov@linaro.org> <20170908171830.13813-4-georgi.djakov@linaro.org> From: Georgi Djakov Message-ID: Date: Thu, 2 Nov 2017 18:00:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 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 Amit, On 11/02/2017 09:28 AM, Amit Kucheria wrote: > On Fri, Sep 8, 2017 at 10:48 PM, Georgi Djakov wrote: >> Add driver for the Qualcomm interconnect buses found in msm8916 based >> platforms. This patch contains only a partial topology to make reviewing >> easier. >> >> Signed-off-by: Georgi Djakov >> --- >> drivers/interconnect/Kconfig | 5 + >> drivers/interconnect/Makefile | 1 + >> drivers/interconnect/qcom/Kconfig | 11 + >> drivers/interconnect/qcom/Makefile | 1 + >> drivers/interconnect/qcom/interconnect_msm8916.c | 375 +++++++++++++++++++++++ >> include/linux/interconnect/qcom-msm8916.h | 92 ++++++ >> 6 files changed, 485 insertions(+) >> create mode 100644 drivers/interconnect/qcom/Kconfig >> create mode 100644 drivers/interconnect/qcom/Makefile >> create mode 100644 drivers/interconnect/qcom/interconnect_msm8916.c >> create mode 100644 include/linux/interconnect/qcom-msm8916.h >> >> diff --git a/drivers/interconnect/Kconfig b/drivers/interconnect/Kconfig >> index 1e50e951cdc1..b123a76e2f9d 100644 >> --- a/drivers/interconnect/Kconfig >> +++ b/drivers/interconnect/Kconfig >> @@ -8,3 +8,8 @@ menuconfig INTERCONNECT >> >> If unsure, say no. >> >> +if INTERCONNECT >> + >> +source "drivers/interconnect/qcom/Kconfig" >> + >> +endif >> diff --git a/drivers/interconnect/Makefile b/drivers/interconnect/Makefile >> index d9da6a6c3560..62a01de24aeb 100644 >> --- a/drivers/interconnect/Makefile >> +++ b/drivers/interconnect/Makefile >> @@ -1 +1,2 @@ >> obj-$(CONFIG_INTERCONNECT) += interconnect.o >> +obj-$(CONFIG_INTERCONNECT_QCOM) += qcom/ >> diff --git a/drivers/interconnect/qcom/Kconfig b/drivers/interconnect/qcom/Kconfig >> new file mode 100644 >> index 000000000000..86465dc37bd4 >> --- /dev/null >> +++ b/drivers/interconnect/qcom/Kconfig >> @@ -0,0 +1,11 @@ >> +config INTERCONNECT_QCOM >> + bool "Qualcomm Network-on-Chip interconnect drivers" >> + depends on INTERCONNECT >> + depends on ARCH_QCOM || COMPILE_TEST >> + default y >> + >> +config INTERCONNECT_QCOM_MSM8916 >> + tristate "Qualcomm MSM8916 interconnect driver" >> + depends on INTERCONNECT_QCOM >> + help >> + This is a driver for the Qualcomm Network-on-Chip on msm8916-based platforms. >> diff --git a/drivers/interconnect/qcom/Makefile b/drivers/interconnect/qcom/Makefile >> new file mode 100644 >> index 000000000000..0831080e1100 >> --- /dev/null >> +++ b/drivers/interconnect/qcom/Makefile >> @@ -0,0 +1 @@ >> +obj-$(CONFIG_INTERCONNECT_QCOM_MSM8916) += interconnect_msm8916.o >> diff --git a/drivers/interconnect/qcom/interconnect_msm8916.c b/drivers/interconnect/qcom/interconnect_msm8916.c >> new file mode 100644 >> index 000000000000..9b001e100974 >> --- /dev/null >> +++ b/drivers/interconnect/qcom/interconnect_msm8916.c >> @@ -0,0 +1,375 @@ >> +/* >> + * Copyright (C) 2017 Linaro Ltd >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 and >> + * only version 2 as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define to_qcom_icp(_icp) \ >> + container_of(_icp, struct qcom_interconnect_provider, icp) >> +#define to_qcom_node(_node) \ >> + container_of(_node, struct qcom_interconnect_node, node) >> + >> +enum qcom_bus_type { >> + QCOM_BUS_TYPE_NOC = 0, >> + QCOM_BUS_TYPE_MEM, >> +}; >> + >> +struct qcom_interconnect_provider { >> + struct icp icp; >> + void __iomem *base; >> + struct clk *bus_clk; >> + struct clk *bus_a_clk; >> + u32 base_offset; >> + u32 qos_offset; >> + enum qcom_bus_type type; >> +}; >> + >> +struct qcom_interconnect_node { >> + struct interconnect_node node; >> + unsigned char *name; >> + struct interconnect_node *links[8]; > > Magic number 8. Replace with 8916_MAX_LINKS or something. > Ok, sure! >> + u16 id; >> + u16 num_links; >> + u16 port; >> + u16 buswidth; > > Comment on what a buswidth is just to be clear > Ok! >> + u64 rate; > > Comment on units Ok! > >> +}; >> + >> +static struct qcom_interconnect_node snoc_int_0; >> +static struct qcom_interconnect_node snoc_int_1; >> +static struct qcom_interconnect_node snoc_int_bimc; >> +static struct qcom_interconnect_node snoc_bimc_0_mas; >> +static struct qcom_interconnect_node pnoc_snoc_slv; >> + >> +static struct qcom_interconnect_node snoc_bimc_0_slv; > > IMO, saving an 'a' and 'e' is not worth it for the sake of > readability. Just use 'slave' and 'master' in the names. > Currently i prefer to keep it this way. Maybe i can put a comment somewhere. >> +static struct qcom_interconnect_node slv_ebi_ch0; >> + >> +static struct qcom_interconnect_node pnoc_int_1; >> +static struct qcom_interconnect_node mas_pnoc_sdcc_1; >> +static struct qcom_interconnect_node mas_pnoc_sdcc_2; >> +static struct qcom_interconnect_node pnoc_snoc_mas; >> + >> +struct qcom_interconnect_desc { >> + struct qcom_interconnect_node **nodes; >> + size_t num_nodes; >> +}; >> + >> +static struct qcom_interconnect_node snoc_int_0 = { >> + .id = 10004, >> + .name = "snoc-int-0", >> +#if 0 > > Please get rid if these. > I have included only a small part of the topology for this SoC for simplicity. Will remove them. >> + .links = { &snoc_pnoc_mas.node }, >> + .num_links = 1, >> +#endif >> + .buswidth = 8, >> +}; >> + >> +static struct qcom_interconnect_node snoc_int_1 = { >> + .id = 10005, >> + .name = "snoc-int-1", >> +#if 0 >> + .links = { &slv_apss.node, &slv_cats_0.node, &slv_cats_1.node }, >> + .num_links = 3, >> +#endif >> + .buswidth = 8, >> +}; >> + >> +static struct qcom_interconnect_node snoc_int_bimc = { >> + .id = 10006, >> + .name = "snoc-bimc", >> + .links = { &snoc_bimc_0_mas.node }, >> + .num_links = 1, >> + .buswidth = 8, >> +}; >> + >> +static struct qcom_interconnect_node snoc_bimc_0_mas = { >> + .id = 10007, >> + .name = "snoc-bimc-0-mas", >> + .links = { &snoc_bimc_0_slv.node }, >> + .num_links = 1, >> + .buswidth = 8, >> +}; >> + >> +static struct qcom_interconnect_node pnoc_snoc_slv = { >> + .id = 10011, >> + .name = "snoc-pnoc", >> + .links = { &snoc_int_0.node, &snoc_int_bimc.node, &snoc_int_1.node }, >> + .num_links = 3, >> + .buswidth = 8, >> +}; > > > Suggest replacing this list of definitions with a macro such as: > > #define DEFINE_XCON_NODE(_name, _id, numlinks, buswidth, ...) \ > static struct qcom_interconnect_node _name; \ > static struct qcom_interconnect_node _name = { \ > .id = _id, > \ > .name = _name, > \ > .buswidth = buswidth, > \ > .num_links = numlinks, > \ > .links = { __VA_ARGS__ }, > \ > }; > > > This will reduce these definitions to a series of definitions as > follows that improves readability. > > DEFINE_XCON_NODE(snoc_int_0, 10004, 1, 8, &snoc_pnoc_mas.node) > DEFINE_XCON_NODE(snoc_int_1, 10005, 3, 8, &snoc_apss.node, > &slv_cats_0.node, &slv_cats_1.node) > DEFINE_XCON_NODE(snoc_int_bimc, 10006, 1, 8, &snoc_bimc_0_mas.node) > > If fact you could take it one step further and move the definitions > under the provider definition below directly. > Will do it. Thanks! [..] >> +static struct qcom_interconnect_node *msm8916_pnoc_nodes[] = { >> + [PNOC_INT_1] = &pnoc_int_1, >> + [MAS_PNOC_SDCC_1] = &mas_pnoc_sdcc_1, >> + [MAS_PNOC_SDCC_2] = &mas_pnoc_sdcc_2, >> + [PNOC_SNOC_MAS] = &pnoc_snoc_mas, >> +}; > > There are big holes in this node array definition because the index > values are not contiguous. Are you planning fill these in later for > each of the providers? > Yes, exactly. I trying to keep this patch as small as possible to be more review friendly. At some time will add the full topology. Thanks for the comments! BR, Georgi From 1582938521353955761@xxx Thu Nov 02 07:30:12 +0000 2017 X-GM-THRID: 1577992818368267790 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread