R: R: [uClinux-dev] NAND on m5329evb

Greg Ungerer gerg at snapgear.com
Fri Jun 8 03:17:57 EDT 2007


Hi Andrea,

Tarani, Andrea wrote:
> This is the patch in plain text format (the previous are extracted from clearcase)

Still no good. If you look at the source the "=" are mangled
to "=3D" for example.

Regards
Greg



> This patch solve two problems:
> 1) a romfs corruption during kernel startup (the compiler place sys_clk_khz and sys_clk_mhz in bss segment but when used the bss overlap the romfs area)
> 2) the nand flash interface use a latch placed at addr 0x10080000 to manage the CE signal, not A18!!
> 
> diff U3b old/linux-2.6.x/arch/m68knommu/platform/532x/config.c new/linux-2.6.x/arch/m68knommu/platform/532x/config.c
> --- old/linux-2.6.x/arch/m68knommu/platform/532x/config.c	Fri Sep 15 16:59:33 2006
> +++ /new/linux-2.6.x/arch/m68knommu/platform/532x/config.c	Mon Oct 02 14:41:44 2006
> @@ -47,6 +47,21 @@
>  
>  /***************************************************************************/
>  
> +int sys_clk_khz = 0;
> +int sys_clk_mhz = 0;
> +
> +void wtm_init(void);
> +void scm_init(void);
> +void gpio_init(void);
> +void fbcs_init(void);
> +void sdramc_init(void);
> +int  clock_pll (int fsys, int flags);
> +int  clock_limp (int);
> +int  clock_exit_limp (void);
> +int  get_sys_clock (void);
> +
> +/***************************************************************************/
> +
>  /*
>   *	DMA channel base address table.
>   */
> @@ -91,6 +106,9 @@
>  
>  void config_BSP(char *commandp, int size)
>  {
> +	sys_clk_khz = get_sys_clock();
> +	sys_clk_mhz = sys_clk_khz/1000;
> +
>  	mcf_setimr(MCFSIM_IMR_MASKALL);
>  
>  #if defined(CONFIG_BOOTPARAM)
> @@ -168,24 +186,9 @@
>  
>  #define NAND_FLASH_ADDRESS	(0xD0000000)
>  
> -int sys_clk_khz = 0;
> -int sys_clk_mhz = 0;
> -
> -void wtm_init(void);
> -void scm_init(void);
> -void gpio_init(void);
> -void fbcs_init(void);
> -void sdramc_init(void);
> -int  clock_pll (int fsys, int flags);
> -int  clock_limp (int);
> -int  clock_exit_limp (void);
> -int  get_sys_clock (void);
>  
>  asmlinkage void __init sysinit(void)
>  {
> -	sys_clk_khz = clock_pll(0, 0);
> -	sys_clk_mhz = sys_clk_khz/1000;
> -	
>  	wtm_init();
>  	scm_init();
>  	gpio_init();
> @@ -234,14 +237,14 @@
>  	/* Initialize latch to drive signals to inactive states */
>  	*((u16 *)(0x10080000)) = 0xFFFF;
>  
> -	/* External SRAM */
> -	MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS;
> -	MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16
> -			| MCF_FBCS_CSCR_AA
> -			| MCF_FBCS_CSCR_SBM
> -			| MCF_FBCS_CSCR_WS(1));
> -	MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K
> -			| MCF_FBCS_CSMR_V);
> +//	/* External SRAM */
> +//	MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS;
> +//	MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16
> +//			| MCF_FBCS_CSCR_AA
> +//			| MCF_FBCS_CSCR_SBM
> +//			| MCF_FBCS_CSCR_WS(1));
> +//	MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K
> +//			| MCF_FBCS_CSMR_V);
>  
>  	/* Boot Flash connected to FBCS0 */
>  	MCF_FBCS0_CSAR = FLASH_ADDRESS;
> diff U3b old/linux-2.6.x/drivers/mtd/nand/m5329.c new/linux-2.6.x/drivers/mtd/nand/m5329.c
> --- old/linux-2.6.x/drivers/mtd/nand/m5329.c	Fri Sep 15 17:48:45 2006
> +++ new/linux-2.6.x/drivers/mtd/nand/m5329.c	Fri Sep 29 09:21:32 2006
> @@ -36,6 +36,9 @@
>  /*
>   * Values specific to the SPIA board (used with EP7212 processor)
>   */
> +#define NAND_FLASH_CE		((u16 *)(0x10080000))
> +#define NCE_LOW_VAL			0xfbfb
> +#define NCE_HIGH_VAL		0xffff
>  #define NAND_FLASH_ADDRESS	0xd0000000	/* Fash address mapping */
>  
>  #define CLE_ADDR_BIT		4
> @@ -90,10 +93,12 @@
>  		m5329_fio_base &= ~(1<<ALE_ADDR_BIT);
>  		break;
>  	case NAND_CTL_SETNCE: 
> -		m5329_fio_base &= ~(1<<NCE_ADDR_BIT);
> +		*NAND_FLASH_CE = NCE_LOW_VAL;
> +//		m5329_fio_base &= ~(1<<NCE_ADDR_BIT);
>  		break;
>  	case NAND_CTL_CLRNCE: 
> -		m5329_fio_base |= 1<NCE_ADDR_BIT;
> +		*NAND_FLASH_CE = NCE_HIGH_VAL;
> +//		m5329_fio_base |= 1<NCE_ADDR_BIT;
>  		break;
>  	}
>  	/* Set address of NAND IO lines */
> @@ -135,6 +140,8 @@
>  
>  	/* Link the private data with the MTD structure */
>  	m5329_mtd->priv = this;
> +
> +	*NAND_FLASH_CE = NCE_HIGH_VAL;
>  
>  	/* Set address of NAND IO lines */
>  	this->IO_ADDR_R = (void __iomem *) m5329_fio_base; 
> 
> -----Messaggio originale-----
> Da: uclinux-dev-bounces at uclinux.org [mailto:uclinux-dev-bounces at uclinux.org] Per conto di Greg Ungerer
> Inviato: venerdì 8 giugno 2007 7.49
> A: uClinux development list
> Oggetto: Re: R: [uClinux-dev] NAND on m5329evb
> 
> Hi Andrea,
> 
> Tarani, Andrea wrote:
>> try this patch (Greg can you ad this to distribution??)
> 
> This patch is mangled by mime for me.
> Can you resend in plain text?
> 
> Regards
> Greg
> 
> 
> 
> 
> This message (including any attachments) contains confidential 
> and/or proprietary information intended only for the addressee.  
> Any unauthorized disclosure, copying, distribution or reliance on 
> the contents of this information is strictly prohibited and may 
> constitute a violation of law.  If you are not the intended 
> recipient, please notify the sender immediately by responding to 
> this e-mail, and delete the message from your system.  If you 
> have any questions about this e-mail please notify the sender 
> immediately.
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
> 

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg at snapgear.com
Secure Computing Corporation                PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com


More information about the uClinux-dev mailing list