lkml.org 
[lkml]   [2018]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v8 05/10] dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg property
Hi Joe,

On Wed, Oct 3, 2018 at 8:37 PM Joe Perches <joe@perches.com> wrote:
> On Wed, 2018-10-03 at 15:22 +0200, Boris Brezillon wrote:
> > The reg property of devices connected to an I3C bus have 3 cells, and
> > filling them manually is not trivial. Provides macros to help doing
> > that.
>
> This patch logic seems excessively fragile.

> > --- /dev/null
> > +++ b/include/dt-bindings/i3c/i3c.h

> > +
> > +#define I3C_PID(manufid, partid, instid, extrainfo) \
> > + ((manufid) << 1) \
> > + (((partid) << 16) | ((instid) << 12) | (extrainfo))
>
> This macro doesn't make any sense. Missing a shift and an or?

No, it generates two of the three cells.

> > +
> > +#define I3C_DEV_WITH_STATIC_ADDR(addr, manufid, partid, \
> > + instid, extrainfo) \
> > + (addr) I3C_PID(manufid, partid, instid, extrainfo)
> > +
> > +#define I3C_DEV(manufid, partid, instid, extrainfo) \
> > + I3C_DEV_WITH_STATIC_ADDR(0x0, manufid, partid, \
> > + instid, extrainfo)

And the above two macros generate all three cells.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2018-10-03 20:46    [W:1.228 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site