RE: [PATCH v4 2/7] thunderbolt: Updating the register definitions

From: Levy, Amir (Jer)
Date: Tue Jul 26 2016 - 05:08:42 EST


On Tue, Jul 26 2016, 10:39 AM, Andreas Noever wrote:
> On Mon, Jul 18, 2016 at 12:00 PM, Amir Levy <amir.jer.levy@xxxxxxxxx>
> wrote:
> > Adding more Thunderbolt(TM) register definitions and some helper
> > macros.
> >
> > Signed-off-by: Amir Levy <amir.jer.levy@xxxxxxxxx>
> > ---
> > drivers/thunderbolt/nhi_regs.h | 109
> > +++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 109 insertions(+)
> >
> > diff --git a/drivers/thunderbolt/nhi_regs.h
> > b/drivers/thunderbolt/nhi_regs.h index 75cf069..b8e961f 100644
> > --- a/drivers/thunderbolt/nhi_regs.h
> > +++ b/drivers/thunderbolt/nhi_regs.h
> > @@ -9,6 +9,11 @@
> >
> > #include <linux/types.h>
> >
> > +#define NHI_MMIO_BAR 0
> > +
> > +#define TBT_RING_MIN_NUM_BUFFERS 2
> > +#define TBT_RING_MAX_FRAME_SIZE (4 * 1024)
> > +
> > enum ring_flags {
> > RING_FLAG_ISOCH_ENABLE = 1 << 27, /* TX only? */
> > RING_FLAG_E2E_FLOW_CONTROL = 1 << 28, @@ -39,6 +44,33 @@
> > struct ring_desc {
> > u32 time; /* write zero */
> > } __packed;
> >
> > +/**
> > + * struct tbt_buf_desc - TX/RX ring buffer descriptor.
> > + * This is same as struct ring_desc, but without the use of bitfields
> > +and
> > + * with explicit endianity.
> > + */
> > +struct tbt_buf_desc {
> > + __le64 phys;
> > + __le32 attributes;
> > + __le32 time;
> > +};
> Does sharing this file make sense? The style seems to be quite different
> (structs with bitfields vs explicit bit-access). I think I would prefer separate
> register definitions, unless you are reusing a substantial amount (I have not
> checked).
>

I'm using all the macros from the original file, except the struct with the bitfields.

Amir