Message ID | 20191108230630.30025-1-heiko.stuebner@theobroma-systems.com |
---|---|
State | Accepted |
Delegated to: | Kever Yang |
Headers | show |
Series | [U-Boot,v2,1/2] rockchip: clk: rv1108: remove duplicate reset init | expand |
On 2019/11/9 上午7:06, Heiko Stuebner wrote: > rockchip_reset_bind() already does the needed init for the reset > registers, only referenced the wrong cru structure. > > So we can get rid of the open-coded reset init and just fix > the correct cru reference. > > Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Thanks, - Kever > --- > changes in v2: > - drop the now unused old softreset_reg struct > softresets are only used inside the softreset driver and > have their own separate struct > > arch/arm/include/asm/arch-rockchip/clock.h | 6 ------ > drivers/clk/rockchip/clk_rv1108.c | 14 +------------- > 2 files changed, 1 insertion(+), 19 deletions(-) > > diff --git a/arch/arm/include/asm/arch-rockchip/clock.h b/arch/arm/include/asm/arch-rockchip/clock.h > index 0eb19ca86f..1d5b3a07d0 100644 > --- a/arch/arm/include/asm/arch-rockchip/clock.h > +++ b/arch/arm/include/asm/arch-rockchip/clock.h > @@ -43,12 +43,6 @@ struct sysreset_reg { > unsigned int glb_srst_snd_value; > }; > > -struct softreset_reg { > - void __iomem *base; > - unsigned int sf_reset_offset; > - unsigned int sf_reset_num; > -}; > - > /** > * clk_get_divisor() - Calculate the required clock divisior > * > diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c > index 3ebb007fab..b1e8208d54 100644 > --- a/drivers/clk/rockchip/clk_rv1108.c > +++ b/drivers/clk/rockchip/clk_rv1108.c > @@ -681,7 +681,6 @@ static int rv1108_clk_bind(struct udevice *dev) > int ret; > struct udevice *sys_child, *sf_child; > struct sysreset_reg *priv; > - struct softreset_reg *sf_priv; > > /* The reset driver does not have a device node, so bind it here */ > ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", > @@ -698,22 +697,11 @@ static int rv1108_clk_bind(struct udevice *dev) > } > > #if CONFIG_IS_ENABLED(CONFIG_RESET_ROCKCHIP) > - ret = offsetof(struct rk3368_cru, softrst_con[0]); > + ret = offsetof(struct rv1108_cru, softrst_con[0]); > ret = rockchip_reset_bind(dev, ret, 13); > if (ret) > debug("Warning: software reset driver bind faile\n"); > #endif > - ret = device_bind_driver_to_node(dev, "rockchip_reset", "reset", > - dev_ofnode(dev), &sf_child); > - if (ret) { > - debug("Warning: No rockchip reset driver: ret=%d\n", ret); > - } else { > - sf_priv = malloc(sizeof(struct softreset_reg)); > - sf_priv->sf_reset_offset = offsetof(struct rv1108_cru, > - softrst_con[0]); > - sf_priv->sf_reset_num = 13; > - sf_child->priv = sf_priv; > - } > > return 0; > }
On 2019/11/13 下午5:08, Kever Yang wrote: > > On 2019/11/9 上午7:06, Heiko Stuebner wrote: >> rockchip_reset_bind() already does the needed init for the reset >> registers, only referenced the wrong cru structure. >> >> So we can get rid of the open-coded reset init and just fix >> the correct cru reference. >> >> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> > > Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Applied to u-boot-rockchip master. Thanks, - Kever > > Thanks, > - Kever >> --- >> changes in v2: >> - drop the now unused old softreset_reg struct >> softresets are only used inside the softreset driver and >> have their own separate struct >> >> arch/arm/include/asm/arch-rockchip/clock.h | 6 ------ >> drivers/clk/rockchip/clk_rv1108.c | 14 +------------- >> 2 files changed, 1 insertion(+), 19 deletions(-) >> >> diff --git a/arch/arm/include/asm/arch-rockchip/clock.h >> b/arch/arm/include/asm/arch-rockchip/clock.h >> index 0eb19ca86f..1d5b3a07d0 100644 >> --- a/arch/arm/include/asm/arch-rockchip/clock.h >> +++ b/arch/arm/include/asm/arch-rockchip/clock.h >> @@ -43,12 +43,6 @@ struct sysreset_reg { >> unsigned int glb_srst_snd_value; >> }; >> -struct softreset_reg { >> - void __iomem *base; >> - unsigned int sf_reset_offset; >> - unsigned int sf_reset_num; >> -}; >> - >> /** >> * clk_get_divisor() - Calculate the required clock divisior >> * >> diff --git a/drivers/clk/rockchip/clk_rv1108.c >> b/drivers/clk/rockchip/clk_rv1108.c >> index 3ebb007fab..b1e8208d54 100644 >> --- a/drivers/clk/rockchip/clk_rv1108.c >> +++ b/drivers/clk/rockchip/clk_rv1108.c >> @@ -681,7 +681,6 @@ static int rv1108_clk_bind(struct udevice *dev) >> int ret; >> struct udevice *sys_child, *sf_child; >> struct sysreset_reg *priv; >> - struct softreset_reg *sf_priv; >> /* The reset driver does not have a device node, so bind it >> here */ >> ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", >> @@ -698,22 +697,11 @@ static int rv1108_clk_bind(struct udevice *dev) >> } >> #if CONFIG_IS_ENABLED(CONFIG_RESET_ROCKCHIP) >> - ret = offsetof(struct rk3368_cru, softrst_con[0]); >> + ret = offsetof(struct rv1108_cru, softrst_con[0]); >> ret = rockchip_reset_bind(dev, ret, 13); >> if (ret) >> debug("Warning: software reset driver bind faile\n"); >> #endif >> - ret = device_bind_driver_to_node(dev, "rockchip_reset", "reset", >> - dev_ofnode(dev), &sf_child); >> - if (ret) { >> - debug("Warning: No rockchip reset driver: ret=%d\n", ret); >> - } else { >> - sf_priv = malloc(sizeof(struct softreset_reg)); >> - sf_priv->sf_reset_offset = offsetof(struct rv1108_cru, >> - softrst_con[0]); >> - sf_priv->sf_reset_num = 13; >> - sf_child->priv = sf_priv; >> - } >> return 0; >> } > > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot
diff --git a/arch/arm/include/asm/arch-rockchip/clock.h b/arch/arm/include/asm/arch-rockchip/clock.h index 0eb19ca86f..1d5b3a07d0 100644 --- a/arch/arm/include/asm/arch-rockchip/clock.h +++ b/arch/arm/include/asm/arch-rockchip/clock.h @@ -43,12 +43,6 @@ struct sysreset_reg { unsigned int glb_srst_snd_value; }; -struct softreset_reg { - void __iomem *base; - unsigned int sf_reset_offset; - unsigned int sf_reset_num; -}; - /** * clk_get_divisor() - Calculate the required clock divisior * diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c index 3ebb007fab..b1e8208d54 100644 --- a/drivers/clk/rockchip/clk_rv1108.c +++ b/drivers/clk/rockchip/clk_rv1108.c @@ -681,7 +681,6 @@ static int rv1108_clk_bind(struct udevice *dev) int ret; struct udevice *sys_child, *sf_child; struct sysreset_reg *priv; - struct softreset_reg *sf_priv; /* The reset driver does not have a device node, so bind it here */ ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", @@ -698,22 +697,11 @@ static int rv1108_clk_bind(struct udevice *dev) } #if CONFIG_IS_ENABLED(CONFIG_RESET_ROCKCHIP) - ret = offsetof(struct rk3368_cru, softrst_con[0]); + ret = offsetof(struct rv1108_cru, softrst_con[0]); ret = rockchip_reset_bind(dev, ret, 13); if (ret) debug("Warning: software reset driver bind faile\n"); #endif - ret = device_bind_driver_to_node(dev, "rockchip_reset", "reset", - dev_ofnode(dev), &sf_child); - if (ret) { - debug("Warning: No rockchip reset driver: ret=%d\n", ret); - } else { - sf_priv = malloc(sizeof(struct softreset_reg)); - sf_priv->sf_reset_offset = offsetof(struct rv1108_cru, - softrst_con[0]); - sf_priv->sf_reset_num = 13; - sf_child->priv = sf_priv; - } return 0; }
rockchip_reset_bind() already does the needed init for the reset registers, only referenced the wrong cru structure. So we can get rid of the open-coded reset init and just fix the correct cru reference. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> --- changes in v2: - drop the now unused old softreset_reg struct softresets are only used inside the softreset driver and have their own separate struct arch/arm/include/asm/arch-rockchip/clock.h | 6 ------ drivers/clk/rockchip/clk_rv1108.c | 14 +------------- 2 files changed, 1 insertion(+), 19 deletions(-)