mbox series

[0/2] iommu/rockchip: fix clock handling to not break old dts

Message ID 20180410092612.2653-1-heiko@sntech.de
Headers show
Series iommu/rockchip: fix clock handling to not break old dts | expand

Message

Heiko Stuebner April 10, 2018, 9:26 a.m. UTC
The newly added clock handling makes iommu clocks required, thus breaking
devicetrees from the last 4 years.

This series fixes the binding and driver to work without clocks being
present, like it did before and should therefore probably go in as fix
on top of the clock-handling patch.


Heiko Stuebner (2):
  dt-bindings: iommu/rockchip: Make clock properties optional
  iommu/rockchip: make clock handling optional

 Documentation/devicetree/bindings/iommu/rockchip,iommu.txt | 4 ++--
 drivers/iommu/rockchip-iommu.c                             | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Robin Murphy April 10, 2018, 11:24 a.m. UTC | #1
On 10/04/18 10:26, Heiko Stuebner wrote:
> 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@sntech.de>
> ---
>   drivers/iommu/rockchip-iommu.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 5fc8656c60f9..7215c683cb8f 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -1176,8 +1176,12 @@ static int rk_iommu_probe(struct platform_device *pdev)
>   		iommu->clocks[i].id = rk_iommu_clocks[i];
>   
>   	err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks);
> -	if (err)
> -		return err;
> +	if (err) {
> +		if (err == -ENOENT)
> +			iommu->num_clocks = 0;
> +		else
> +			return err;
> +	}

Nit: this might be a bit nicer as:

	if (err == -ENOENT)
		iommu->num_clocks = 0;
	else if (err)
		return err;

Either way,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

Thanks,
Robin.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html