Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp949493imm; Wed, 6 Jun 2018 08:15:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIx0j4RJyT0h8u5NsmD4YSmAEteyvwSyVEb/B7dCK7Sq2NR64e33vG0dYBIjwcmSE0nfgqN X-Received: by 2002:a65:5d09:: with SMTP id e9-v6mr2931310pgr.150.1528298111368; Wed, 06 Jun 2018 08:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528298111; cv=none; d=google.com; s=arc-20160816; b=UnPl/AOq3mNoI0ulUZWidnWfOu/wDIIH6gnQLtDfWeCHgThEpEuRXIspXUUgIF+uar PzZWZuUZIQPtHhbe00MsvAI1lgkOGCzHuu/sFoSHuHbhEoledHk5CZ1pqV/Z8JWrd7pQ mFgABne2C9Fxym02HQxQ5HhQWBiyu6iSp1z8ZasGQIreB1S7y3MYMoM9rnVpPpQq9NQL PlJQv5NwxwQYWtfZJ7Gb2SK3G5WysGppEXwZc4N564dpCfdyLJ7wUzncc5OqmWo7nV7V j/AYRhg/wm6s9+l9YHyudzcGMeFPf7r3W+DQDRMx64T5py3s7RqohIE16c3KvLUbTGDP UAJQ== 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=7m/+XXPeyD0JHZ19DTBtvHR8GGASK7uJK7k1E5fedJM=; b=N6n9QVsSM6dbVBtPs5ToL4Ky8OExo3k+OJHjIGBIfbGkdZHs9EHMzhgZgdFIje8X0G zxrWjZcMLs5FYxzaaN+RUCggp69z6vPPy8pa5GDIa+03zYiVOVBWrmdURsZ2/RqxFr1r TvKsFgtMSppXhHK2ix3S01a+Rk3aPLqemOXpYJgjhBzWtyRLusjqfgmkyMZoR7/H0yuU pB0d5iT/EALFHy/kI5i7VOPTVBMDBz3M/j45AoB9VaHNSKm9TzAQPQxS1sDMKZbt320G IOfZXSxgqkFpg7T2ryDLFG/RGt7GbG4z5FpWTcwaRPuDN45UsPYpr6ZtTAZdGafhkFob gx+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LJHta7bd; 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 w22-v6si50561747plq.196.2018.06.06.08.14.55; Wed, 06 Jun 2018 08:15:11 -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=LJHta7bd; 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 S1752277AbeFFPOd (ORCPT + 99 others); Wed, 6 Jun 2018 11:14:33 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46406 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbeFFPOb (ORCPT ); Wed, 6 Jun 2018 11:14:31 -0400 Received: by mail-wr0-f195.google.com with SMTP id v13-v6so6702892wrp.13 for ; Wed, 06 Jun 2018 08:14:30 -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=7m/+XXPeyD0JHZ19DTBtvHR8GGASK7uJK7k1E5fedJM=; b=LJHta7bdS8aMNgT7P7W2YUWLt23k/RZaaqXL40AicJGXKdqgeEf5f1suLSOkZRJZ9J vZqYMuoqiXUJ1Zn/IqmaaB6oqyv5R9+nxncl8GqTUxOl23oWyAbFWSrjIZIJ1CI1B+ss lVdRG0WvKGnGYP2DallY/bgg7Av+ZxWsO5afo= 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=7m/+XXPeyD0JHZ19DTBtvHR8GGASK7uJK7k1E5fedJM=; b=LU33cNw21hoHiYq066d7K1W0tolX9e0NLnZswNqa08lxgq0YEszfs/oLDUKyXQC4IM /uEDR7kZMZ3SGqDnG9xQQrUFMJ6eUYlic7aXKMvofesaiMRChAqpmBIkn9LGbw2AhZFd zohQA92qxxUwarLm4C6Tp9RhVCZqk/Jd586K/f7psa8fFFf0gAQxwqMokT2JLgKJrFwJ TzaSaZ6QbsFrSd1r5yaXRaJNpIFyq7/azw05IfHn1t1XtCVrVZRNzytXcCnuOU8p/oYt ST17ORRz1Y7NXLfqgnkZvT+jlIQ88PNmsnIkjCm5hLO0zFJnbrvJOjrMNTrrnTtMOPFo aR6Q== X-Gm-Message-State: APt69E3RxhIlXppfoTJ/rshbo2HrUgNb/4Xyf1mvhJZcu1I+tz1WMb8w dojjKjTtXKVxUdISl+ctwwWSvw== X-Received: by 2002:adf:c4d0:: with SMTP id o16-v6mr2714223wrf.173.1528298069770; Wed, 06 Jun 2018 08:14:29 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id v68-v6sm7187752wmd.12.2018.06.06.08.14.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 08:14:29 -0700 (PDT) From: Georgi Djakov Subject: Re: [PATCH v4 5/7] interconnect: qcom: Add msm8916 interconnect provider driver To: Amit Kucheria Cc: Linux PM list , gregkh@linuxfoundation.org, "Rafael J. Wysocki" , Rob Herring , Michael Turquette , khilman@baylibre.com, Vincent Guittot , Saravana Kannan , Bjorn Andersson , seansw@qti.qualcomm.com, davidai@quicinc.com, Mark Rutland , Lorenzo Pieralisi , LKML , lakml , 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+ERn8uytPygDBR67kNHs18LkvrEex/Z1cQARAQABzShHZW9yZ2kgRGph a292IDxnZW9yZ2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hjWNVv9kqp8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: <0f03e7b9-aed6-b012-08da-5921061e3db2@linaro.org> Date: Wed, 6 Jun 2018 18:14:28 +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 Amit, On 25.05.18 г. 11:27, Amit Kucheria wrote: > On Fri, Mar 9, 2018 at 11:09 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 [..] >> +#define DEFINE_QNODE(_name, _id, _port, _buswidth, _ap_owned, \ >> + _mas_rpm_id, _slv_rpm_id, _qos_mode, \ >> + _numlinks, ...) \ >> + static struct qcom_icc_node _name = { \ >> + .id = _id, \ >> + .name = #_name, \ >> + .port = _port, \ >> + .buswidth = _buswidth, \ >> + .qos_mode = _qos_mode, \ >> + .ap_owned = _ap_owned, \ >> + .mas_rpm_id = _mas_rpm_id, \ >> + .slv_rpm_id = _slv_rpm_id, \ >> + .num_links = _numlinks, \ >> + .links = { __VA_ARGS__ }, \ >> + } > > Move this macro definition just above its use below. > Ok. >> +enum qcom_qos_mode { >> + QCOM_QOS_MODE_BYPASS = 0, >> + QCOM_QOS_MODE_FIXED, >> + QCOM_QOS_MODE_MAX, >> +}; >> + >> +struct qcom_icc_provider { >> + struct icc_provider provider; >> + void __iomem *base; >> + struct clk *bus_clk; >> + struct clk *bus_a_clk; >> +}; >> + >> +#define MSM8916_MAX_LINKS 8 >> + >> +/** >> + * struct qcom_icc_node - Qualcomm specific interconnect nodes >> + * @name: the node name used in debugfs >> + * @links: an array of nodes where we can go next while traversing >> + * @id: a unique node identifier >> + * @num_links: the total number of @links >> + * @port: the offset index into the masters QoS register space >> + * @buswidth: width of the interconnect between a node and the bus > > units? Will add. [..] >> +static int qcom_icc_init(struct icc_node *node) >> +{ >> + struct qcom_icc_provider *qp = to_qcom_provider(node->provider); >> + /* TODO: init qos and priority */ >> + > > No need to set_rate here before enabling the clock? Yes, i am planing to initially set the bus clocks at max rate. The rate would be adjusted as soon as the consumers start placing requests. > >> + clk_prepare_enable(qp->bus_clk); >> + clk_prepare_enable(qp->bus_a_clk); >> + >> + return 0; >> +} >> + >> +static int qcom_icc_set(struct icc_node *src, struct icc_node *dst, >> + u32 avg, u32 peak) >> +{ >> + struct qcom_icc_provider *qp; >> + struct qcom_icc_node *qn; >> + struct icc_node *node; >> + struct icc_provider *provider; >> + u64 avg_bw; >> + u64 peak_bw; >> + u64 rate = 0; >> + int ret = 0; >> + >> + if (!src) >> + node = dst; >> + else >> + node = src; >> + >> + qn = node->data; >> + provider = node->provider; >> + qp = to_qcom_provider(node->provider); >> + >> + /* convert from kbps to bps */ >> + avg_bw = avg * 1000ULL; >> + peak_bw = peak * 1000ULL; >> + > > Since the core uses kbps and various SoC HW might use bps (or other > units), perhaps consider providing a macro in the core header such as: > > #define icc_units_to_bps(bw) (bw * 1000ULL) > > and then move this conversion to the top of the function where you > define the variable > > u64 avg_bw = icc_units_to_bps(avg); > u64 peak_bw = icc_units_to_bps(peak); > > Since other drivers will end up copying this driver, it might help > prevent silly errors in the drivers and has a side-effect of allowing > the core to change internal units w/o any driver changes down the > line, if needed. Ok, i am fine with this. Thanks, Georgi