[U-Boot] [PATCH 1/7] spi: altera: Use struct-based register access

Marek Vasut marex at denx.de
Wed Oct 22 00:15:21 CEST 2014


On Monday, October 20, 2014 at 07:19:33 PM, Jagan Teki wrote:
> On 20 October 2014 20:40, Marek Vasut <marex at denx.de> wrote:
> > On Monday, October 20, 2014 at 04:53:15 PM, Jagan Teki wrote:
> > 
> > [...]
> > 
> >> > -#define ALTERA_SPI_RXDATA      0
> >> > -#define ALTERA_SPI_TXDATA      4
> >> > -#define ALTERA_SPI_STATUS      8
> >> > -#define ALTERA_SPI_CONTROL     12
> >> > -#define ALTERA_SPI_SLAVE_SEL   20
> >> > +struct altera_spi_regs {
> >> > +       u32     rxdata;
> >> > +       u32     txdata;
> >> > +       u32     status;
> >> > +       u32     control;
> >> > +       u32     _reserved;
> >> > +       u32     slave_sel;
> >> > +};
> >> 
> >> Can you place this structure definition below of all macro defines, i
> >> don't think the
> >> next level patches does that, does they?
> > 
> > Does it make sense to you, to first define the bits in registers and then
> > the register layout ? It does not make sense to me, so I would prefer to
> > keep it like it is.
> 
> You're correct the way you replaced, usually the driver code will go like
> this
> 
> -- >includes
> 
> --> macros definitions
> 
> --> global or structure definitions
> 
> --> driver function calls.
> 
> We follow this [1] to make the driver more readable.
> 
> [1] http://patchwork.ozlabs.org/patch/265683/

I'm not sure what I am supposed to follow in the link above. Is it fine to 
assume that this patch does not need any change then ?

Best regards,
Marek Vasut


More information about the U-Boot mailing list