diff mbox series

[RFC,04/19] devfreq: imx-bus: Decouple imx-bus from icc made

Message ID 1613750416-11901-5-git-send-email-abel.vesa@nxp.com
State Superseded
Headers show
Series [RFC,01/19] clk: imx8mq: Replace critical with ignore_unused flag for dram_apb clock | expand

Commit Message

Abel Vesa Feb. 19, 2021, 4 p.m. UTC
The link between an imx-bus device and its icc id will be done
through the fsl,icc-id property in each dts node. The imx
interconnect driver will pick up all the dts nodes that have that
property defined and will link them to the rightfull icc id.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
---
 drivers/devfreq/imx-bus.c | 40 +++------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

Comments

Chanwoo Choi Feb. 26, 2021, 4:52 p.m. UTC | #1
On 21. 2. 20. 오전 1:00, Abel Vesa wrote:
> The link between an imx-bus device and its icc id will be done

> through the fsl,icc-id property in each dts node. The imx

> interconnect driver will pick up all the dts nodes that have that

> property defined and will link them to the rightfull icc id.

> 

> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>

> ---

>   drivers/devfreq/imx-bus.c | 40 +++------------------------------------

>   1 file changed, 3 insertions(+), 37 deletions(-)

> 

> diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c

> index 1c0c92d0eb08..9f0df88b29c1 100644

> --- a/drivers/devfreq/imx-bus.c

> +++ b/drivers/devfreq/imx-bus.c

> @@ -65,36 +65,6 @@ static void imx_bus_exit(struct device *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->icc_pdev));

> -		return PTR_ERR(priv->icc_pdev);

> -	}

> -

> -	return 0;

> -}

> -

>   static int imx_bus_probe(struct platform_device *pdev)

>   {

>   	struct device *dev = &pdev->dev;

> @@ -144,10 +114,6 @@ static int imx_bus_probe(struct platform_device *pdev)

>   		goto err;

>   	}

>   

> -	ret = imx_bus_init_icc(dev);

> -	if (ret)

> -		goto err;

> -

>   	return 0;

>   

>   err:

> @@ -156,9 +122,9 @@ static int imx_bus_probe(struct platform_device *pdev)

>   }

>   

>   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,imx8mq-noc",},

> +	{ .compatible = "fsl,imx8mm-noc",},

> +	{ .compatible = "fsl,imx8mn-noc",},

>   	{ .compatible = "fsl,imx8m-noc", },

>   	{ .compatible = "fsl,imx8m-nic", },

>   	{ /* sentinel */ },

> 


For this patch, you need to get the ack of use of new 'fsl,icc-id 
property'. IMO, looks good to me.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>



And you must update the DT binding document.
[1] Documentation/devicetree/bindings/interconnect/fsl,imx8m-noc.yaml

Thanks,
Chanwoo Choi
diff mbox series

Patch

diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c
index 1c0c92d0eb08..9f0df88b29c1 100644
--- a/drivers/devfreq/imx-bus.c
+++ b/drivers/devfreq/imx-bus.c
@@ -65,36 +65,6 @@  static void imx_bus_exit(struct device *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->icc_pdev));
-		return PTR_ERR(priv->icc_pdev);
-	}
-
-	return 0;
-}
-
 static int imx_bus_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -144,10 +114,6 @@  static int imx_bus_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	ret = imx_bus_init_icc(dev);
-	if (ret)
-		goto err;
-
 	return 0;
 
 err:
@@ -156,9 +122,9 @@  static int imx_bus_probe(struct platform_device *pdev)
 }
 
 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,imx8mq-noc",},
+	{ .compatible = "fsl,imx8mm-noc",},
+	{ .compatible = "fsl,imx8mn-noc",},
 	{ .compatible = "fsl,imx8m-noc", },
 	{ .compatible = "fsl,imx8m-nic", },
 	{ /* sentinel */ },