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

Scott Wood scottwood at freescale.com
Tue Oct 7 18:32:59 CEST 2008


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?

>  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.

-Scott


More information about the U-Boot mailing list