[U-Boot] [PATCH] rockchip: pinctrl: use fdtdec_get_int_array() to get interrupt

Dr. Philipp Tomsich philipp.tomsich at theobroma-systems.com
Wed Sep 6 08:42:02 UTC 2017


> On 6 Sep 2017, at 10:36, Kever Yang <kever.yang at rock-chips.com> wrote:
> 
> Not all the udevice have a available DT node, eg. rksdmmc at ff500000.blk
> which add by mmc_bind(), if we use dev_read_u32_array(), the interface
> will use the ofnode directly and end with:
> 	assert(ofnode_valid(node));
> 
> Use fdtdec_get_int_array() instead.

Changing this will affect livetree (at least it broke livetree support for me in my testing).
Looks like we will need to address the underlying issue of dynamically added nodes with the dev_* functions.

> 
> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
> ---
> 
> drivers/pinctrl/rockchip/pinctrl_rk3036.c | 3 ++-
> drivers/pinctrl/rockchip/pinctrl_rk3188.c | 3 ++-
> drivers/pinctrl/rockchip/pinctrl_rk3288.c | 3 ++-
> drivers/pinctrl/rockchip/pinctrl_rk3328.c | 3 ++-
> drivers/pinctrl/rockchip/pinctrl_rk3399.c | 3 ++-
> drivers/pinctrl/rockchip/pinctrl_rv1108.c | 3 ++-
> 6 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3036.c b/drivers/pinctrl/rockchip/pinctrl_rk3036.c
> index 94f6d7a..9215d6c 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rk3036.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rk3036.c
> @@ -193,7 +193,8 @@ static int rk3036_pinctrl_get_periph_id(struct udevice *dev,
> 	u32 cell[3];
> 	int ret;
> 
> -	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
> +	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
> +				   "interrupts", cell, ARRAY_SIZE(cell));
> 	if (ret < 0)
> 		return -EINVAL;
> 
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3188.c b/drivers/pinctrl/rockchip/pinctrl_rk3188.c
> index 692d8e2..65c1f66 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rk3188.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rk3188.c
> @@ -370,7 +370,8 @@ static int rk3188_pinctrl_get_periph_id(struct udevice *dev,
> 	u32 cell[3];
> 	int ret;
> 
> -	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
> +	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
> +				   "interrupts", cell, ARRAY_SIZE(cell));
> 	if (ret < 0)
> 		return -EINVAL;
> 
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3288.c b/drivers/pinctrl/rockchip/pinctrl_rk3288.c
> index 3c9ae97..ab64056 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rk3288.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rk3288.c
> @@ -595,7 +595,8 @@ static int rk3288_pinctrl_get_periph_id(struct udevice *dev,
> 	u32 cell[3];
> 	int ret;
> 
> -	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
> +	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
> +				   "interrupts", cell, ARRAY_SIZE(cell));
> 	if (ret < 0)
> 		return -EINVAL;
> 
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3328.c b/drivers/pinctrl/rockchip/pinctrl_rk3328.c
> index c74163e..f3e7eec 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rk3328.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rk3328.c
> @@ -249,7 +249,8 @@ static int rk3328_pinctrl_get_periph_id(struct udevice *dev,
> 	u32 cell[3];
> 	int ret;
> 
> -	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
> +	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
> +				   "interrupts", cell, ARRAY_SIZE(cell));
> 	if (ret < 0)
> 		return -EINVAL;
> 
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3399.c b/drivers/pinctrl/rockchip/pinctrl_rk3399.c
> index cab268c..d93b903 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rk3399.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rk3399.c
> @@ -350,7 +350,8 @@ static int rk3399_pinctrl_get_periph_id(struct udevice *dev,
> 	u32 cell[3];
> 	int ret;
> 
> -	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
> +	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
> +				   "interrupts", cell, ARRAY_SIZE(cell));
> 	if (ret < 0)
> 		return -EINVAL;
> 
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> index cda94f4..bdf3910 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> @@ -108,7 +108,8 @@ static int rv1108_pinctrl_get_periph_id(struct udevice *dev,
> 	u32 cell[3];
> 	int ret;
> 
> -	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
> +	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
> +				   "interrupts", cell, ARRAY_SIZE(cell));
> 	if (ret < 0)
> 		return -EINVAL;
> 
> -- 
> 1.9.1
> 



More information about the U-Boot mailing list