[U-Boot] [PATCH 2/4] Make the fsl_elbc_nand driver work for both 83xxand 85xx

Jin Zhengxiong-R64188 Jason.Jin at freescale.com
Wed Oct 8 11:45:01 CEST 2008


> -----Original Message-----
> From: Wood Scott-B07421 
> Sent: Wednesday, October 08, 2008 12:33 AM
> To: Jin Zhengxiong-R64188
> Cc: u-boot at lists.denx.de
> Subject: Re: [PATCH 2/4] Make the fsl_elbc_nand driver work 
> for both 83xxand 85xx
> 
> On Fri, Sep 19, 2008 at 05:32:50PM +0800, Jason Jin wrote:
> > +/*
> > + * Local Bus Controller Registers.
> > + */
> > +typedef struct lbus_bank {
> > +	u32 br;			/* Base Register */
> > +	u32 or;			/* Option Register */
> > +} lbus_bank_t;
> > +
> > +typedef struct fsl_lbus {
> > +	lbus_bank_t bank[8];
> > +	u8 res0[0x28];
> > +	u32 mar;		/* UPM Address Register */
> > +	u8 res1[0x4];
> > +	u32 mamr;		/* UPMA Mode Register */
> > +	u32 mbmr;		/* UPMB Mode Register */
> > +	u32 mcmr;		/* UPMC Mode Register */
> > +	u8 res2[0x8];
> > +	u32 mrtpr;		/* Memory Refresh Timer 
> Prescaler Register */
> > +	u32 mdr;		/* UPM Data Register */
> > +	u8 res3[0x4];
> > +	u32 lsor;		/* Special Operation Initiation 
> Register */
> > +	u32 lsdmr;		/* SDRAM Mode Register */
> > +	u8 res4[0x8];
> > +	u32 lurt;		/* UPM Refresh Timer */
> > +	u32 lsrt;		/* SDRAM Refresh Timer */
> > +	u8 res5[0x8];
> > +	u32 ltesr;		/* Transfer Error Status Register */
> > +	u32 ltedr;		/* Transfer Error Disable Register */
> > +	u32 lteir;		/* Transfer Error Interrupt Register */
> > +	u32 lteatr;		/* Transfer Error Attributes Register */
> > +	u32 ltear;		/* Transfer Error Address Register */
> > +	u8 res6[0xC];
> > +	u32 lbcr;		/* Configuration Register */
> > +	u32 lcrr;		/* Clock Ratio Register */
> > +	u8 res7[0x8];
> > +	u32 fmr;		/* Flash Mode Register */
> > +	u32 fir;		/* Flash Instruction Register */
> > +	u32 fcr;		/* Flash Command Register */
> > +	u32 fbar;		/* Flash Block Addr Register */
> > +	u32 fpar;		/* Flash Page Addr Register */
> > +	u32 fbcr;		/* Flash Byte Count Register */
> > +	u8 res8[0xF08];
> > +}fsl_lbus_t;
> 
> Space after brace.
> 
> Can we put this in a header file that is shared by 
> immap_83xx.h, immap_85xx.h, etc., rather than duplicating it here?
> 
Thanks.
I was trying to avoid too much changes to the code, which maybe result
in other functions
can not work. Actually, As the different immap definition, to completly
avoid the duplicating, we need to merge the lbc immap for 85xx/83xx and
change the related code.

There is already a fsl_lbc.h file in include/asm but it is included by
some .S file and can not move the structure into it. How about define a
immap_fsl_lbc.h file for the structure? 

> >  static void fsl_elbc_ctrl_init(void)
> >  {
> > -	immap_t *im = (immap_t *)CFG_IMMR;
> > -
> >  	elbc_ctrl = kzalloc(sizeof(*elbc_ctrl), GFP_KERNEL);
> >  	if (!elbc_ctrl)
> >  		return;
> >  
> > +#ifdef CONFIG_MPC85xx
> > +	elbc_ctrl->regs = (void *)CFG_MPC85xx_LBC_ADDR; #else
> > +	immap_t *im = (immap_t *)CFG_IMMR;
> >  	elbc_ctrl->regs = &im->lbus;
> > +#endif
> 
> Did you try building this on 83xx?  You'll get a type 
> conflict warning because you duplicated the struct.

Thanks, If we still define the structure in the file, we need to change
the structure name.

Jason


More information about the U-Boot mailing list