Hi Wenyou, On 7 June 2016 at 01:11, Wenyou Yang <wenyou.y...@atmel.com> wrote: > Add post binding support for CLK uclass to recursively bind > its children as clk devices. > > Signed-off-by: Wenyou Yang <wenyou.y...@atmel.com> > --- > > Changes in v2: None > > drivers/clk/clk-uclass.c | 51 > ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+)
Can you please explain what this is for? We would normally call dm_scan_fdt_node() for this, but it seems that you are specifically to create drivers for things with no compatible strings. > > diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c > index b483c1e..ee568e4 100644 > --- a/drivers/clk/clk-uclass.c > +++ b/drivers/clk/clk-uclass.c > @@ -106,7 +106,58 @@ int clk_get_by_index(struct udevice *dev, int index, > struct udevice **clk_devp) > } > #endif > > +/** > + * clk_post-bind() - post binding for CLK uclass > + * Recursively bind its children as clk devices. > + * > + * @dev: clk device > + * @return: 0 on success, or negative error code on failure > + */ > +static int clk_post_bind(struct udevice *dev) > +{ > + const void *fdt = gd->fdt_blob; > + int offset = dev->of_offset; > + bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC); > + const char *name; > + int ret; > + > + for (offset = fdt_first_subnode(fdt, offset); > + offset > 0; > + offset = fdt_next_subnode(fdt, offset)) { > + if (pre_reloc_only && > + !fdt_getprop(fdt, offset, "u-boot,dm-pre-reloc", NULL)) > + continue; > + /* > + * If this node has "compatible" property, this is not a clk > + * node, but a normal device. skip. > + */ > + fdt_get_property(fdt, offset, "compatible", &ret); > + if (ret >= 0) > + continue; > + > + if (ret != -FDT_ERR_NOTFOUND) > + return ret; > + > + name = fdt_get_name(fdt, offset, NULL); > + if (!name) > + return -EINVAL; > + > + ret = device_bind_driver_to_node(dev, "clk", name, > + offset, NULL); > + if (ret) > + return ret; > + } > + > + return 0; > +} > + > UCLASS_DRIVER(clk) = { > .id = UCLASS_CLK, > + .post_bind = clk_post_bind, > .name = "clk", > }; > + > +U_BOOT_DRIVER(clk_generic) = { > + .id = UCLASS_CLK, > + .name = "clk", > +}; > -- > 2.7.4 > Regards, Simon _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot