[U-Boot] [PATCH 1/2] dm: core: Add functions to read 64-bit dt properties
Bin Meng
bmeng.cn at gmail.com
Fri Aug 23 05:00:17 UTC 2019
On Fri, Aug 23, 2019 at 11:58 AM T Karthik Reddy <tkarthik at xilinx.com> wrote:
>
> Hi Bin Meng,
>
> > -----Original Message-----
> > From: Bin Meng <bmeng.cn at gmail.com>
> > Sent: Friday, August 23, 2019 8:58 AM
> > To: Michal Simek <michals at xilinx.com>
> > Cc: U-Boot Mailing List <u-boot at lists.denx.de>; T Karthik Reddy
> > <tkarthik at xilinx.com>; git <git at xilinx.com>
> > Subject: Re: [U-Boot] [PATCH 1/2] dm: core: Add functions to read 64-bit dt
> > properties
> >
> > Hi Michal,
> >
> > On Thu, Aug 22, 2019 at 7:18 PM Michal Simek <michal.simek at xilinx.com>
> > wrote:
> > >
> > > From: T Karthik Reddy <t.karthik.reddy at xilinx.com>
> > >
> > > This patch adds functions dev_read_u64_default & dev_read_u64 to read
> > > unsigned 64-bit values from devicetree.
> > >
> > > Signed-off-by: T Karthik Reddy <t.karthik.reddy at xilinx.com>
> > > Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> > > ---
> > >
> > > drivers/core/ofnode.c | 2 +-
> > > drivers/core/read.c | 10 ++++++++++
> > > include/dm/ofnode.h | 2 +-
> > > include/dm/read.h | 32 ++++++++++++++++++++++++++++++++
> > > 4 files changed, 44 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index
> > > e74a662d1d30..7eca00cd6613 100644
> > > --- a/drivers/core/ofnode.c
> > > +++ b/drivers/core/ofnode.c
> > > @@ -79,7 +79,7 @@ int ofnode_read_u64(ofnode node, const char
> > *propname, u64 *outp)
> > > return 0;
> > > }
> > >
> > > -int ofnode_read_u64_default(ofnode node, const char *propname, u64
> > > def)
> > > +u64 ofnode_read_u64_default(ofnode node, const char *propname, u64
> > > +def)
> >
> > Why changing the return value type here?
>
> Because "ofnode_read_u64_default" will get a 64-bit integer value from DT & that 64-bit value should return instead of 32-bit value.
Somehow I misread the changes was to another API ofnode_read_u64. Yes,
that makes sense!
>
> >
> > > {
> > > assert(ofnode_valid(node));
> > > ofnode_read_u64(node, propname, &def); diff --git
> > > a/drivers/core/read.c b/drivers/core/read.c index
> > > 8b5502de1159..5dd2ddca70e8 100644
> > > --- a/drivers/core/read.c
> > > +++ b/drivers/core/read.c
> > > @@ -11,6 +11,16 @@
> > > #include <mapmem.h>
> > > #include <dm/of_access.h>
> > >
> > > +int dev_read_u64(struct udevice *dev, const char *propname, u64
> > > +*outp) {
> > > + return ofnode_read_u64(dev_ofnode(dev), propname, outp); }
> > > +
> > > +u64 dev_read_u64_default(struct udevice *dev, const char *propname,
> > > +u64 def) {
> > > + return ofnode_read_u64_default(dev_ofnode(dev), propname,
> > > +def); }
> > > +
> >
> > I would put the dev_read_u64_* routines after the u32 version below.
>
> It will be modified in V2.
>
Regards,
Bin
More information about the U-Boot
mailing list