All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iommu/rockchip: make clock handling optional
@ 2018-04-17 12:09 Heiko Stuebner
       [not found] ` <20180417120915.31535-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Stuebner @ 2018-04-17 12:09 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A
  Cc: Heiko Stuebner, jeffy.chen-TNX95d0MmH7DzftRWevZcw,
	vicencb-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ,
	tomeu-XCtybt49RKsYaV1qd6yewg

iommu clocks are optional, so the driver should not fail if they are not
present. Instead just set the number of clocks to 0, which the clk-blk APIs
can handle just fine.

Fixes: f2e3a5f557ad ("iommu/rockchip: Control clocks needed to access the IOMMU")
Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Reviewed-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
---
changes in v2:
- keep it required in the binding for future variants
  but optional in the code for backwards compatiblity
- follow Robin Murphy's beautification suggestion

As the original changes breaks a lot of display support in 4.17-rc1,
this should abviously go in as fix into 4.17.

 drivers/iommu/rockchip-iommu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 5fc8656c60f9..422d22990289 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1175,8 +1175,15 @@ static int rk_iommu_probe(struct platform_device *pdev)
 	for (i = 0; i < iommu->num_clocks; ++i)
 		iommu->clocks[i].id = rk_iommu_clocks[i];
 
+	/*
+	 * iommu clocks should be present for all new devices and devicetrees
+	 * but there are older devicetrees without clocks out in the wild.
+	 * So clocks as optional for the time being.
+	 */
 	err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks);
-	if (err)
+	if (err == -ENOENT)
+		iommu->num_clocks = 0;
+	else if (err)
 		return err;
 
 	err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iommu/rockchip: make clock handling optional
       [not found] ` <20180417120915.31535-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
@ 2018-04-17 14:27   ` Enric Balletbo Serra
  2018-05-01  9:57   ` Heiko Stuebner
  1 sibling, 0 replies; 4+ messages in thread
From: Enric Balletbo Serra @ 2018-04-17 14:27 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: joro-zLv9SwRftAIdnm+yROfE0A, JeffyChen,
	vicencb-Re5JQEeQqe8AvxtiuMwx3w, Tomasz Figa,
	open list:ARM/Rockchip SoC...,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Enric Balletbo i Serra, robin.murphy-5wv7dgnIgG8,
	tomeu-XCtybt49RKsYaV1qd6yewg

2018-04-17 14:09 GMT+02:00 Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>:
> iommu clocks are optional, so the driver should not fail if they are not
> present. Instead just set the number of clocks to 0, which the clk-blk APIs
> can handle just fine.
>
> Fixes: f2e3a5f557ad ("iommu/rockchip: Control clocks needed to access the IOMMU")
> Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> Reviewed-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> ---
> changes in v2:
> - keep it required in the binding for future variants
>   but optional in the code for backwards compatiblity
> - follow Robin Murphy's beautification suggestion
>
> As the original changes breaks a lot of display support in 4.17-rc1,
> this should abviously go in as fix into 4.17.
>
>  drivers/iommu/rockchip-iommu.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 5fc8656c60f9..422d22990289 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -1175,8 +1175,15 @@ static int rk_iommu_probe(struct platform_device *pdev)
>         for (i = 0; i < iommu->num_clocks; ++i)
>                 iommu->clocks[i].id = rk_iommu_clocks[i];
>
> +       /*
> +        * iommu clocks should be present for all new devices and devicetrees
> +        * but there are older devicetrees without clocks out in the wild.
> +        * So clocks as optional for the time being.
> +        */
>         err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks);
> -       if (err)
> +       if (err == -ENOENT)
> +               iommu->num_clocks = 0;
> +       else if (err)
>                 return err;
>
>         err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
> --
> 2.16.2
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

Thanks to this patch my display is back :)

Tested-by: Enric Balletbo i Serra <enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iommu/rockchip: make clock handling optional
       [not found] ` <20180417120915.31535-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
  2018-04-17 14:27   ` Enric Balletbo Serra
@ 2018-05-01  9:57   ` Heiko Stuebner
  2018-05-03 12:59     ` Joerg Roedel
  1 sibling, 1 reply; 4+ messages in thread
From: Heiko Stuebner @ 2018-05-01  9:57 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A
  Cc: jeffy.chen-TNX95d0MmH7DzftRWevZcw,
	vicencb-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ,
	tomeu-XCtybt49RKsYaV1qd6yewg

Ho Joerg,

Am Dienstag, 17. April 2018, 14:09:15 CEST schrieb Heiko Stuebner:
> iommu clocks are optional, so the driver should not fail if they are not
> present. Instead just set the number of clocks to 0, which the clk-blk APIs
> can handle just fine.
> 
> Fixes: f2e3a5f557ad ("iommu/rockchip: Control clocks needed to access the IOMMU")
> Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> Reviewed-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>

could you pick up this patch as fix for 4.17 please?
As without it, we loose display output with old devicetrees.


Thanks
Heiko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iommu/rockchip: make clock handling optional
  2018-05-01  9:57   ` Heiko Stuebner
@ 2018-05-03 12:59     ` Joerg Roedel
  0 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2018-05-03 12:59 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: jeffy.chen-TNX95d0MmH7DzftRWevZcw,
	vicencb-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	enric.balletbo-ZGY8ohtN/8qB+jHODAdFcQ,
	tomeu-XCtybt49RKsYaV1qd6yewg

On Tue, May 01, 2018 at 11:57:29AM +0200, Heiko Stuebner wrote:
> Ho Joerg,
> 
> Am Dienstag, 17. April 2018, 14:09:15 CEST schrieb Heiko Stuebner:
> > iommu clocks are optional, so the driver should not fail if they are not
> > present. Instead just set the number of clocks to 0, which the clk-blk APIs
> > can handle just fine.
> > 
> > Fixes: f2e3a5f557ad ("iommu/rockchip: Control clocks needed to access the IOMMU")
> > Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> > Reviewed-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> 
> could you pick up this patch as fix for 4.17 please?
> As without it, we loose display output with old devicetrees.

Applied to the iommu/fixes branch, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-03 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 12:09 [PATCH v2] iommu/rockchip: make clock handling optional Heiko Stuebner
     [not found] ` <20180417120915.31535-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2018-04-17 14:27   ` Enric Balletbo Serra
2018-05-01  9:57   ` Heiko Stuebner
2018-05-03 12:59     ` Joerg Roedel

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.