Skip to content

Commit 0235521

Browse files
cdleonardchanwoochoi
authored andcommitted
PM / devfreq: imx: Register interconnect device
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 <[email protected]> Tested-by: Martin Kepplinger <[email protected]> Acked-by: Chanwoo Choi <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent 5173a97 commit 0235521

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

drivers/devfreq/imx-bus.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct imx_bus {
1616
struct devfreq_dev_profile profile;
1717
struct devfreq *devfreq;
1818
struct clk *clk;
19+
struct platform_device *icc_pdev;
1920
};
2021

2122
static int imx_bus_target(struct device *dev,
@@ -58,7 +59,40 @@ static int imx_bus_get_dev_status(struct device *dev,
5859

5960
static void imx_bus_exit(struct device *dev)
6061
{
62+
struct imx_bus *priv = dev_get_drvdata(dev);
63+
6164
dev_pm_opp_of_remove_table(dev);
65+
platform_device_unregister(priv->icc_pdev);
66+
}
67+
68+
/* imx_bus_init_icc() - register matching icc provider if required */
69+
static int imx_bus_init_icc(struct device *dev)
70+
{
71+
struct imx_bus *priv = dev_get_drvdata(dev);
72+
const char *icc_driver_name;
73+
74+
if (!of_get_property(dev->of_node, "#interconnect-cells", 0))
75+
return 0;
76+
if (!IS_ENABLED(CONFIG_INTERCONNECT_IMX)) {
77+
dev_warn(dev, "imx interconnect drivers disabled\n");
78+
return 0;
79+
}
80+
81+
icc_driver_name = of_device_get_match_data(dev);
82+
if (!icc_driver_name) {
83+
dev_err(dev, "unknown interconnect driver\n");
84+
return 0;
85+
}
86+
87+
priv->icc_pdev = platform_device_register_data(
88+
dev, icc_driver_name, -1, NULL, 0);
89+
if (IS_ERR(priv->icc_pdev)) {
90+
dev_err(dev, "failed to register icc provider %s: %ld\n",
91+
icc_driver_name, PTR_ERR(priv->devfreq));
92+
return PTR_ERR(priv->devfreq);
93+
}
94+
95+
return 0;
6296
}
6397

6498
static int imx_bus_probe(struct platform_device *pdev)
@@ -110,6 +144,10 @@ static int imx_bus_probe(struct platform_device *pdev)
110144
goto err;
111145
}
112146

147+
ret = imx_bus_init_icc(dev);
148+
if (ret)
149+
goto err;
150+
113151
return 0;
114152

115153
err:
@@ -118,6 +156,9 @@ static int imx_bus_probe(struct platform_device *pdev)
118156
}
119157

120158
static const struct of_device_id imx_bus_of_match[] = {
159+
{ .compatible = "fsl,imx8mq-noc", .data = "imx8mq-interconnect", },
160+
{ .compatible = "fsl,imx8mm-noc", .data = "imx8mm-interconnect", },
161+
{ .compatible = "fsl,imx8mn-noc", .data = "imx8mn-interconnect", },
121162
{ .compatible = "fsl,imx8m-noc", },
122163
{ .compatible = "fsl,imx8m-nic", },
123164
{ /* sentinel */ },

0 commit comments

Comments
 (0)