From: Leonard Crestez <leonard.crestez@nxp.com> To: Georgi Djakov <georgi.djakov@linaro.org>, Rob Herring <robh+dt@kernel.org>, Chanwoo Choi <cw00.choi@samsung.com> Cc: "Alexandre Bailon" <abailon@baylibre.com>, "Rafael J. Wysocki" <rafael@kernel.org>, "Jacky Bai" <ping.bai@nxp.com>, "Anson Huang" <Anson.Huang@nxp.com>, "Artur Świgoń" <a.swigon@samsung.com>, "Abel Vesa" <abel.vesa@nxp.com>, "Krzysztof Kozlowski" <krzk@kernel.org>, "MyungJoo Ham" <myungjoo.ham@samsung.com>, "Kyungmin Park" <kyungmin.park@samsung.com>, "Saravana Kannan" <saravanak@google.com>, "Mark Rutland" <mark.rutland@arm.com>, "Viresh Kumar" <viresh.kumar@linaro.org>, "Shawn Guo" <shawnguo@kernel.org>, "Dong Aisheng" <aisheng.dong@nxp.com>, "Fabio Estevam" <fabio.estevam@nxp.com>, "Stephen Boyd" <sboyd@kernel.org>, "Michael Turquette" <mturquette@baylibre.com>, "Matthias Kaehlcke" <mka@chromium.org>, "Angus Ainslie" <angus@akkea.ca>, "Martin Kepplinger" <martink@posteo.de>, "Silvano di Ninno" <silvano.dininno@nxp.com>, linux-pm@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/8] PM / devfreq: imx: Register interconnect device Date: Wed, 1 Apr 2020 17:33:02 +0300 [thread overview] Message-ID: <a6f9657a66e510bf5507daea140465c40c117e3d.1585751281.git.leonard.crestez@nxp.com> (raw) In-Reply-To: <cover.1585751281.git.leonard.crestez@nxp.com> In-Reply-To: <cover.1585751281.git.leonard.crestez@nxp.com> There is no single device which can represent the imx interconnect. Instead of adding a virtual one just make the main &noc act as the global interconnect provider. The imx interconnect provider driver will scale the NOC and DDRC based on bandwidth request. More scalable nodes can be added in the future, for example for audio/display/vpu/gpu NICs. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm> --- drivers/devfreq/imx-bus.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c index 7915d7277349..240eeea66f13 100644 --- a/drivers/devfreq/imx-bus.c +++ b/drivers/devfreq/imx-bus.c @@ -14,10 +14,11 @@ struct imx_bus { struct devfreq_dev_profile profile; struct devfreq *devfreq; struct clk *clk; + struct platform_device *icc_pdev; }; static int imx_bus_target(struct device *dev, unsigned long *freq, u32 flags) { @@ -57,11 +58,44 @@ static int imx_bus_get_dev_status(struct device *dev, return 0; } static void imx_bus_exit(struct device *dev) { + struct imx_bus *priv = dev_get_drvdata(dev); + dev_pm_opp_of_remove_table(dev); + platform_device_unregister(priv->icc_pdev); +} + +/* imx_bus_init_icc() - register matching icc provider if required */ +static int imx_bus_init_icc(struct device *dev) +{ + struct imx_bus *priv = dev_get_drvdata(dev); + const char *icc_driver_name; + + if (!of_get_property(dev->of_node, "#interconnect-cells", 0)) + return 0; + if (!IS_ENABLED(CONFIG_INTERCONNECT_IMX)) { + dev_warn(dev, "imx interconnect drivers disabled\n"); + return 0; + } + + icc_driver_name = of_device_get_match_data(dev); + if (!icc_driver_name) { + dev_err(dev, "unknown interconnect driver\n"); + return 0; + } + + priv->icc_pdev = platform_device_register_data( + dev, icc_driver_name, -1, NULL, 0); + if (IS_ERR(priv->icc_pdev)) { + dev_err(dev, "failed to register icc provider %s: %ld\n", + icc_driver_name, PTR_ERR(priv->devfreq)); + return PTR_ERR(priv->devfreq); + } + + return 0; } static int imx_bus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -109,18 +143,25 @@ static int imx_bus_probe(struct platform_device *pdev) ret = PTR_ERR(priv->devfreq); dev_err(dev, "failed to add devfreq device: %d\n", ret); goto err; } + ret = imx_bus_init_icc(dev); + if (ret) + goto err; + return 0; err: dev_pm_opp_of_remove_table(dev); return ret; } static const struct of_device_id imx_bus_of_match[] = { + { .compatible = "fsl,imx8mq-noc", .data = "imx8mq-interconnect", }, + { .compatible = "fsl,imx8mm-noc", .data = "imx8mm-interconnect", }, + { .compatible = "fsl,imx8mn-noc", .data = "imx8mn-interconnect", }, { .compatible = "fsl,imx8m-noc", }, { .compatible = "fsl,imx8m-nic", }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, imx_bus_of_match); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Leonard Crestez <leonard.crestez@nxp.com> To: Georgi Djakov <georgi.djakov@linaro.org>, Rob Herring <robh+dt@kernel.org>, Chanwoo Choi <cw00.choi@samsung.com> Cc: "Mark Rutland" <mark.rutland@arm.com>, "Jacky Bai" <ping.bai@nxp.com>, "Rafael J. Wysocki" <rafael@kernel.org>, "Viresh Kumar" <viresh.kumar@linaro.org>, "Michael Turquette" <mturquette@baylibre.com>, "Angus Ainslie" <angus@akkea.ca>, "Artur Świgoń" <a.swigon@samsung.com>, "Alexandre Bailon" <abailon@baylibre.com>, "Matthias Kaehlcke" <mka@chromium.org>, "Abel Vesa" <abel.vesa@nxp.com>, "Anson Huang" <Anson.Huang@nxp.com>, "Krzysztof Kozlowski" <krzk@kernel.org>, "MyungJoo Ham" <myungjoo.ham@samsung.com>, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, "Martin Kepplinger" <martink@posteo.de>, "Silvano di Ninno" <silvano.dininno@nxp.com>, linux-arm-kernel@lists.infradead.org, "Dong Aisheng" <aisheng.dong@nxp.com>, "Saravana Kannan" <saravanak@google.com>, "Stephen Boyd" <sboyd@kernel.org>, "Kyungmin Park" <kyungmin.park@samsung.com>, kernel@pengutronix.de, "Fabio Estevam" <fabio.estevam@nxp.com>, "Shawn Guo" <shawnguo@kernel.org> Subject: [PATCH v2 3/8] PM / devfreq: imx: Register interconnect device Date: Wed, 1 Apr 2020 17:33:02 +0300 [thread overview] Message-ID: <a6f9657a66e510bf5507daea140465c40c117e3d.1585751281.git.leonard.crestez@nxp.com> (raw) In-Reply-To: <cover.1585751281.git.leonard.crestez@nxp.com> In-Reply-To: <cover.1585751281.git.leonard.crestez@nxp.com> There is no single device which can represent the imx interconnect. Instead of adding a virtual one just make the main &noc act as the global interconnect provider. The imx interconnect provider driver will scale the NOC and DDRC based on bandwidth request. More scalable nodes can be added in the future, for example for audio/display/vpu/gpu NICs. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm> --- drivers/devfreq/imx-bus.c | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c index 7915d7277349..240eeea66f13 100644 --- a/drivers/devfreq/imx-bus.c +++ b/drivers/devfreq/imx-bus.c @@ -14,10 +14,11 @@ struct imx_bus { struct devfreq_dev_profile profile; struct devfreq *devfreq; struct clk *clk; + struct platform_device *icc_pdev; }; static int imx_bus_target(struct device *dev, unsigned long *freq, u32 flags) { @@ -57,11 +58,44 @@ static int imx_bus_get_dev_status(struct device *dev, return 0; } static void imx_bus_exit(struct device *dev) { + struct imx_bus *priv = dev_get_drvdata(dev); + dev_pm_opp_of_remove_table(dev); + platform_device_unregister(priv->icc_pdev); +} + +/* imx_bus_init_icc() - register matching icc provider if required */ +static int imx_bus_init_icc(struct device *dev) +{ + struct imx_bus *priv = dev_get_drvdata(dev); + const char *icc_driver_name; + + if (!of_get_property(dev->of_node, "#interconnect-cells", 0)) + return 0; + if (!IS_ENABLED(CONFIG_INTERCONNECT_IMX)) { + dev_warn(dev, "imx interconnect drivers disabled\n"); + return 0; + } + + icc_driver_name = of_device_get_match_data(dev); + if (!icc_driver_name) { + dev_err(dev, "unknown interconnect driver\n"); + return 0; + } + + priv->icc_pdev = platform_device_register_data( + dev, icc_driver_name, -1, NULL, 0); + if (IS_ERR(priv->icc_pdev)) { + dev_err(dev, "failed to register icc provider %s: %ld\n", + icc_driver_name, PTR_ERR(priv->devfreq)); + return PTR_ERR(priv->devfreq); + } + + return 0; } static int imx_bus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -109,18 +143,25 @@ static int imx_bus_probe(struct platform_device *pdev) ret = PTR_ERR(priv->devfreq); dev_err(dev, "failed to add devfreq device: %d\n", ret); goto err; } + ret = imx_bus_init_icc(dev); + if (ret) + goto err; + return 0; err: dev_pm_opp_of_remove_table(dev); return ret; } static const struct of_device_id imx_bus_of_match[] = { + { .compatible = "fsl,imx8mq-noc", .data = "imx8mq-interconnect", }, + { .compatible = "fsl,imx8mm-noc", .data = "imx8mm-interconnect", }, + { .compatible = "fsl,imx8mn-noc", .data = "imx8mn-interconnect", }, { .compatible = "fsl,imx8m-noc", }, { .compatible = "fsl,imx8m-nic", }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, imx_bus_of_match); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-04-01 14:33 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-01 14:32 [PATCH v2 0/8] interconnect: Add imx support via devfreq Leonard Crestez 2020-04-01 14:32 ` Leonard Crestez 2020-04-01 14:33 ` [PATCH v2 1/8] dt-bindings: interconnect: Add bindings for imx8m noc Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-01 14:33 ` [PATCH v2 2/8] PM / devfreq: Add generic imx bus scaling driver Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-02 0:21 ` Chanwoo Choi 2020-04-02 0:21 ` Chanwoo Choi 2020-04-01 14:33 ` Leonard Crestez [this message] 2020-04-01 14:33 ` [PATCH v2 3/8] PM / devfreq: imx: Register interconnect device Leonard Crestez 2020-04-02 0:23 ` Chanwoo Choi 2020-04-02 0:23 ` Chanwoo Choi 2020-04-01 14:33 ` [PATCH v2 4/8] interconnect: Add imx core driver Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-02 11:05 ` Georgi Djakov 2020-04-02 11:05 ` Georgi Djakov 2020-04-02 22:00 ` Leonard Crestez 2020-04-02 22:00 ` Leonard Crestez 2020-04-01 14:33 ` [PATCH v2 5/8] interconnect: imx: Add platform driver for imx8mm Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-02 11:14 ` Georgi Djakov 2020-04-02 11:14 ` Georgi Djakov 2020-04-02 22:24 ` Leonard Crestez 2020-04-02 22:24 ` Leonard Crestez 2020-04-01 14:33 ` [PATCH v2 6/8] interconnect: imx: Add platform driver for imx8mq Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-01 14:33 ` [PATCH v2 7/8] interconnect: imx: Add platform driver for imx8mn Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-01 14:33 ` [PATCH v2 8/8] arm64: dts: imx8m: Add NOC nodes Leonard Crestez 2020-04-01 14:33 ` Leonard Crestez 2020-04-04 13:25 ` Adam Ford 2020-04-04 13:25 ` Adam Ford 2020-04-07 9:10 ` Leonard Crestez 2020-04-07 9:10 ` Leonard Crestez 2020-04-07 18:39 ` Adam Ford 2020-04-07 18:39 ` Adam Ford
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=a6f9657a66e510bf5507daea140465c40c117e3d.1585751281.git.leonard.crestez@nxp.com \ --to=leonard.crestez@nxp.com \ --cc=Anson.Huang@nxp.com \ --cc=a.swigon@samsung.com \ --cc=abailon@baylibre.com \ --cc=abel.vesa@nxp.com \ --cc=aisheng.dong@nxp.com \ --cc=angus@akkea.ca \ --cc=cw00.choi@samsung.com \ --cc=devicetree@vger.kernel.org \ --cc=fabio.estevam@nxp.com \ --cc=georgi.djakov@linaro.org \ --cc=kernel@pengutronix.de \ --cc=krzk@kernel.org \ --cc=kyungmin.park@samsung.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-imx@nxp.com \ --cc=linux-pm@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=martink@posteo.de \ --cc=mka@chromium.org \ --cc=mturquette@baylibre.com \ --cc=myungjoo.ham@samsung.com \ --cc=ping.bai@nxp.com \ --cc=rafael@kernel.org \ --cc=robh+dt@kernel.org \ --cc=saravanak@google.com \ --cc=sboyd@kernel.org \ --cc=shawnguo@kernel.org \ --cc=silvano.dininno@nxp.com \ --cc=viresh.kumar@linaro.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: linkBe 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.