[U-Boot] [RFC Patch 2/5] driver: ddr: fsl_mmdc: Pass board parameters through data structure

Tom Rini trini at konsulko.com
Thu Sep 22 13:19:12 CEST 2016


On Thu, Sep 22, 2016 at 03:04:31AM +0000, Prabhakar Kushwaha wrote:
> 
> > -----Original Message-----
> > From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of York Sun
> > Sent: Thursday, September 22, 2016 4:21 AM
> > To: trini at konsulko.com
> > Cc: u-boot at lists.denx.de
> > Subject: [U-Boot] [RFC Patch 2/5] driver: ddr: fsl_mmdc: Pass board parameters
> > through data structure
> > 
> > Instead of using multiple macros, a data structure is used to pass
> > board-specific parameters to MMDC DDR driver.
> > 
> > Signed-off-by: York Sun <york.sun at nxp.com>
> > CC: Shengzhou Liu <Shengzhou.Liu at nxp.com>
> 
> 
> I doubt if it is one of the reason for root-cause.
> May not be part of this patch set
> 
> 
> > ---
> >  board/freescale/ls1012afrdm/ls1012afrdm.c | 18 ++++++++++++++-
> >  board/freescale/ls1012aqds/ls1012aqds.c   | 18 ++++++++++++++-
> >  board/freescale/ls1012ardb/ls1012ardb.c   | 18 ++++++++++++++-
> >  drivers/ddr/fsl/fsl_mmdc.c                | 38 +++++++++++++++----------------
> >  include/configs/ls1012afrdm.h             | 16 -------------
> >  include/configs/ls1012aqds.h              | 16 -------------
> >  include/configs/ls1012ardb.h              | 15 ------------
> >  include/fsl_mmdc.h                        | 21 +++++++++++++----
> >  8 files changed, 87 insertions(+), 73 deletions(-)
> > 
> > diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c
> > b/board/freescale/ls1012afrdm/ls1012afrdm.c
> > index d644e94..b03bdb8 100644
> > --- a/board/freescale/ls1012afrdm/ls1012afrdm.c
> > +++ b/board/freescale/ls1012afrdm/ls1012afrdm.c
> > @@ -26,7 +26,23 @@ int checkboard(void)
> > 
> >  int dram_init(void)
> >  {
> > -	mmdc_init();
> > +	static const struct fsl_mmdc_info mparam = {
> > +		0x04180000,	/* mdctl */
> > +		0x00030035,	/* mdpdc */
> > +		0x12554000,	/* mdotc */
> > +		0xbabf7954,	/* mdcfg0 */
> > +		0xdb328f64,	/* mdcfg1 */
> > +		0x01ff00db,	/* mdcfg2 */
> > +		0x00001680,	/* mdmisc */
> > +		0x0f3c8000,	/* mdref */
> > +		0x00002000,	/* mdrwd */
> > +		0x00bf1023,	/* mdor */
> > +		0x0000003f,	/* mdasp */
> > +		0x0000022a,	/* mpodtctrl */
> > +		0xa1390003,	/* mpzqhwctrl */
> > +	};
> > +
> > +	mmdc_init(&mparam);
> > 
> 
> Why cannot #define directly be used in fsl_mmdc.c.
> 
> If objective is to remove #define from board file, they even be required to avoid magic numbers. 

Please see the previous thread about this between York and I.  The end
goal is not to have no magic numbers, the end goal is to make it clear
what the magic numbers are doing.  I still wish there was also a link to
a tech note / manual / whatever to decode each of these values and a
comment about what DDR part is being used on the board, but this is a
step in the right direction.

And as a side bonus, this moves things one step closer to being able to
have more than one board supported by a given binary.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160922/818ed640/attachment.sig>


More information about the U-Boot mailing list