[U-Boot] [PATCH 2/6] mx6q: Add support for ECSPI through mxc_spi driver

Marek Vasut
2012-01-18T01:47:47Z

> On 01/17/2012 06:27 PM, Marek Vasut wrote:
> >> On 01/17/2012 04:19 PM, Marek Vasut wrote:
> >>>> Signed-off-by: Eric Nelson<eric.nelson@boundarydevices.com>
> >>>> +/* ECSPI registers */
> >>>> +struct cspi_regs {
> >>>> + u32 rxdata;
> >>>> + u32 txdata;
> >>>> + u32 ctrl;
> >>>> + u32 cfg;
> >>>> + u32 intr;
> >>>> + u32 dma;
> >>>> + u32 stat;
> >>>> + u32 period;
> >>>> +};
> >>>
> >>> Sigh ... it's no fun I can have only one remark :-)
> >>>
> >>> Is this part common for all imx-es ?
> >>
> >> All i.MX6's
> >>
> >> This is a cut& paste from MX51.
> >>
> >> I was tempted to introduce an 'mxc_ecspi.h' to merge the declaration
> >> for i.MX5x and i.MX6 which share the ECSPI peripheral and 'mxc_cspi.h'
> >> for i.MX31 and i.MX35 that share the CSPI peripheral.
> >
> > But you don't even need this outside of the spi driver so just put it
> > into the spi driver and be done with it. That'll solve your duplication
> > issue.
> >
> > M
>
> I'll defer to Stefano on this one, since I did this in response
>
> to his request:
> > Right - and we already discussed in the past how to avoid to put
> > specific SOC code inside the driver. In fact, the cspi_regs structure
> > was already moved into the specific SOC header (imx-regs.h) - but the
> > definitions of the single bits of the registers are still inside the
> > driver, as well as the base address of the (e)cspi controllers.
> >
> > They should also be moved - take into acoount by implementing your
> > changes for i.mx6
>
> The struct cspi_regs is already present in mx31, mx35, and mx51 headers,
> so I'm not breaking new ground here, only in the bitfield declarations.
>
> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/arch-
mx31/i
> mx-regs.h;h=6a517ddd931ca0d1e598bd7456c4c611741602eb;hb=HEAD#l60
> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/arch-mx35/i
> mx-regs.h;h=df74508a93ee87ae986f7c2f48f6c5fb36626070;hb=HEAD#l279
> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/arch-mx5/im
> x-regs.h;h=0ee88d25b7800ae9e6aed809d02dd19d9cac9c82;hb=HEAD#l423
>
> My interpretation of Stefano's intent is to clean up the driver at the
> expense of extra defines in the arch-specific headers.

But they're all the same, right? So we have now the same structure defined
thrice?

M
>
> Regards,
>
>
> Eric