From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Georgi Djakov <georgi.djakov@linaro.org>
Cc: robh+dt@kernel.org, agross@kernel.org, vkoul@kernel.org,
evgreen@chromium.org, daidavid1@codeaurora.org,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v3 4/5] interconnect: qcom: Add interconnect SMD over SMD driver
Date: Tue, 11 Jun 2019 16:31:43 -0700 [thread overview]
Message-ID: <20190611233143.GV4814@minitux> (raw)
In-Reply-To: <20190611164157.24656-5-georgi.djakov@linaro.org>
On Tue 11 Jun 09:41 PDT 2019, Georgi Djakov wrote:
> On some Qualcomm SoCs, there is a remote processor, which controls some of
> the Network-On-Chip interconnect resources. Other CPUs express their needs
> by communicating with this processor. Add a driver to handle communication
> with this remote processor.
>
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
> ---
>
> v3:
> - New patch.
>
> drivers/interconnect/qcom/Kconfig | 9 ++++
> drivers/interconnect/qcom/Makefile | 2 +
> drivers/interconnect/qcom/smd-rpm.c | 72 +++++++++++++++++++++++++++++
> drivers/interconnect/qcom/smd-rpm.h | 15 ++++++
> 4 files changed, 98 insertions(+)
> create mode 100644 drivers/interconnect/qcom/smd-rpm.c
> create mode 100644 drivers/interconnect/qcom/smd-rpm.h
>
> diff --git a/drivers/interconnect/qcom/Kconfig b/drivers/interconnect/qcom/Kconfig
> index e76e3e248c41..b0eade1da5d5 100644
> --- a/drivers/interconnect/qcom/Kconfig
> +++ b/drivers/interconnect/qcom/Kconfig
> @@ -9,6 +9,7 @@ config INTERCONNECT_QCOM_QCS404
> tristate "Qualcomm QCS404 interconnect driver"
> depends on INTERCONNECT_QCOM
> depends on QCOM_SMD_RPM || COMPILE_TEST
> + select INTERCONNECT_QCOM_SMD_RPM
> help
> This is a driver for the Qualcomm Network-on-Chip on qcs404-based
> platforms.
> @@ -20,3 +21,11 @@ config INTERCONNECT_QCOM_SDM845
> help
> This is a driver for the Qualcomm Network-on-Chip on sdm845-based
> platforms.
> +
> +config INTERCONNECT_QCOM_SMD_RPM
> + tristate "Qualcomm SMD RPM interconnect driver"
I think it's correct to have INTERCONNECT_QCOM_QCS404 select
INTERCONNECT_QCOM_SMD_RPM and then but INTERCONNECT_QCOM_SMD_RPM should
not be user selectable. So leave the tristate but drop the description
and the help text.
> + depends on INTERCONNECT_QCOM
> + depends on QCOM_SMD_RPM || COMPILE_TEST
> + help
> + This is a driver for communicating interconnect related configuration
> + details with a remote processor (RPM) on Qualcomm platforms.
> diff --git a/drivers/interconnect/qcom/Makefile b/drivers/interconnect/qcom/Makefile
> index 059ff325ee6c..67dafb783dec 100644
> --- a/drivers/interconnect/qcom/Makefile
> +++ b/drivers/interconnect/qcom/Makefile
> @@ -2,6 +2,8 @@
>
> qnoc-qcs404-objs := qcs404.o
> qnoc-sdm845-objs := sdm845.o
> +icc-smd-rpm-objs := smd-rpm.o
>
> obj-$(CONFIG_INTERCONNECT_QCOM_QCS404) += qnoc-qcs404.o
> obj-$(CONFIG_INTERCONNECT_QCOM_SDM845) += qnoc-sdm845.o
> +obj-$(CONFIG_INTERCONNECT_QCOM_SMD_RPM) += icc-smd-rpm.o
> diff --git a/drivers/interconnect/qcom/smd-rpm.c b/drivers/interconnect/qcom/smd-rpm.c
> new file mode 100644
> index 000000000000..af22c0a293e6
> --- /dev/null
> +++ b/drivers/interconnect/qcom/smd-rpm.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * RPM over SMD communication wrapper for interconnects
> + *
> + * Copyright (C) 2019 Linaro Ltd
> + * Author: Georgi Djakov <georgi.djakov@linaro.org>
> + */
> +
> +#include <linux/interconnect-provider.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/soc/qcom/smd-rpm.h>
> +
> +#include "smd-rpm.h"
> +
> +#define RPM_KEY_BW 0x00007762
> +
> +static struct qcom_smd_rpm *icc_smd_rpm;
> +
> +struct icc_rpm_smd_req {
> + __le32 key;
> + __le32 nbytes;
> + __le32 value;
> +};
> +
> +bool qcom_icc_rpm_smd_available(void)
> +{
> + if (!icc_smd_rpm)
> + return false;
> +
> + return true;
> +}
> +EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_available);
> +
> +int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val)
> +{
> + struct icc_rpm_smd_req req = {
> + .key = cpu_to_le32(RPM_KEY_BW),
> + .nbytes = cpu_to_le32(sizeof(u32)),
> + .value = cpu_to_le32(val),
> + };
> +
> + return qcom_rpm_smd_write(icc_smd_rpm, ctx, rsc_type, id, &req,
> + sizeof(req));
> +}
> +EXPORT_SYMBOL_GPL(qcom_icc_rpm_smd_send);
> +
> +static int qcom_icc_rpm_smd_probe(struct platform_device *pdev)
> +{
> + icc_smd_rpm = dev_get_drvdata(pdev->dev.parent);
> +
> + if (!icc_smd_rpm) {
> + dev_err(&pdev->dev, "unable to retrieve handle to RPM\n");
> + return -ENODEV;
> + }
> +
> + return 0;
> +}
It would probably be nice to have a remove function that zeros out
icc_smd_rpm as well.
Regards,
Bjorn
> +
> +static struct platform_driver qcom_interconnect_rpm_smd_driver = {
> + .driver = {
> + .name = "icc_smd_rpm",
> + },
> + .probe = qcom_icc_rpm_smd_probe,
> +};
> +module_platform_driver(qcom_interconnect_rpm_smd_driver);
> +MODULE_AUTHOR("Georgi Djakov <georgi.djakov@linaro.org>");
> +MODULE_DESCRIPTION("Qualcomm SMD RPM interconnect proxy driver");
> +MODULE_LICENSE("GPL v2");
> +MODULE_ALIAS("platform:icc_smd_rpm");
> diff --git a/drivers/interconnect/qcom/smd-rpm.h b/drivers/interconnect/qcom/smd-rpm.h
> new file mode 100644
> index 000000000000..ca9d0327b8ac
> --- /dev/null
> +++ b/drivers/interconnect/qcom/smd-rpm.h
> @@ -0,0 +1,15 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2019, Linaro Ltd.
> + * Author: Georgi Djakov <georgi.djakov@linaro.org>
> + */
> +
> +#ifndef __DRIVERS_INTERCONNECT_QCOM_SMD_RPM_H
> +#define __DRIVERS_INTERCONNECT_QCOM_SMD_RPM_H
> +
> +#include <linux/soc/qcom/smd-rpm.h>
> +
> +bool qcom_icc_rpm_smd_available(void);
> +int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val);
> +
> +#endif
next prev parent reply other threads:[~2019-06-11 23:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 16:41 [PATCH v3 0/5] Add QCS404 interconnect provider driver Georgi Djakov
2019-06-11 16:41 ` [PATCH v3 1/5] dt-bindings: interconnect: Add Qualcomm QCS404 DT bindings Georgi Djakov
2019-06-11 23:08 ` Bjorn Andersson
2019-06-11 16:41 ` [PATCH v3 2/5] interconnect: qcom: Add QCS404 interconnect provider driver Georgi Djakov
2019-06-11 23:34 ` Bjorn Andersson
2019-06-11 16:41 ` [PATCH v3 3/5] soc: qcom: smd-rpm: Create RPM interconnect proxy child device Georgi Djakov
2019-06-11 23:23 ` Bjorn Andersson
2019-06-11 16:41 ` [PATCH v3 4/5] interconnect: qcom: Add interconnect SMD over SMD driver Georgi Djakov
2019-06-11 23:31 ` Bjorn Andersson [this message]
2019-06-11 16:41 ` [PATCH v3 5/5] arm64: dts: qcs404: Add interconnect provider DT nodes Georgi Djakov
2019-06-11 23:40 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190611233143.GV4814@minitux \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=daidavid1@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=evgreen@chromium.org \
--cc=georgi.djakov@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.