[U-Boot] [RFC][PATCH] NAND boot: MPC8536DS support

Kumar Gala galak at kernel.crashing.org
Fri Sep 11 21:21:51 CEST 2009


On Sep 11, 2009, at 2:17 PM, Kumar Gala
>
> Makefile                                       |    1 +
> board/freescale/mpc8536ds/config.mk            |    7 ++
> board/freescale/mpc8536ds/tlb.c                |   11 ++
> cpu/mpc85xx/nand_init.c                        |   73 ++++++++++++++

how about renaming nand_init.c to cpu_init_nand.c

[snip]

> diff --git a/cpu/mpc85xx/nand_init.c b/cpu/mpc85xx/nand_init.c
> new file mode 100644
> index 0000000..dcbbc8d
> --- /dev/null
> +++ b/cpu/mpc85xx/nand_init.c
> @@ -0,0 +1,73 @@
> +/*
> + * Copyright (C) 2009 Freescale Semiconductor, Inc.

the '(C)' isnt needed.

> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <common.h>
> +#include <asm/io.h>
> +#include <asm/mmu.h>
> +#include <asm/fsl_law.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +void cpu_init_f(void)
> +{
> +	ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
> +
> +	/*
> +	 * LCRR - Clock Ratio Register - set up local bus timing
> +	 * when needed
> +	 */
> +	out_be32(&lbc->lcrr, LCRR_DBYP | LCRR_CLKDIV_8);
> +
> +#if defined(CONFIG_NAND_BR_PRELIM)  \
> +	&& defined(CONFIG_NAND_OR_PRELIM)
> +	out_be32(&lbc->br0, CONFIG_NAND_BR_PRELIM);
> +	out_be32(&lbc->or0, CONFIG_NAND_OR_PRELIM);
> +	/* for FPGA */
> +	out_be32(&lbc->br3, CONFIG_SYS_BR3_PRELIM);
> +	out_be32(&lbc->or3, CONFIG_SYS_OR3_PRELIM);
> +#else
> +#error  CONFIG_NAND_BR_PRELIM, CONFIG_NAND_OR_PRELIM must be defined
> +#endif
> +
> +#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR)
> +	ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
> +	uint l2srbar;
> +	int i;
> +
> +	l2srbar = CONFIG_SYS_INIT_L2_ADDR;
> +	out_be32(&l2cache->l2srbar0, l2srbar);
> +
> +	/* set MBECCDIS=1, SBECCDIS=1 */
> +	out_be32(&l2cache->l2errdis,
> +			(MPC85xx_L2ERRDIS_MBECC |
> +			 MPC85xx_L2ERRDIS_SBECC));
> +
> +	/* set L2E=1 & L2SRAM=001 */
> +	out_be32(&l2cache->l2ctl,
> +			(MPC85xx_L2CTL_L2E |
> +			 MPC85xx_L2CTL_L2SRAM_ENTIRE));
> +
> +	/* Initialize L2 SRAM to zero */
> +	for (i = 0; i < CONFIG_SYS_L2_SIZE; i++)
> +		((char *)l2srbar)[i] = 0;
> +#endif
> +}


> diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
> index 4746e2e..6fab240 100644
> --- a/include/configs/MPC8536DS.h
> +++ b/include/configs/MPC8536DS.h
> @@ -31,6 +31,12 @@
> #define CONFIG_PHYS_64BIT	1
> #endif
>
> +#ifdef CONFIG_MPC8536DS_NAND

I think I changed this to make it build.  Once we resolve how we are  
tweaking mkconfig we can figure this out.

> +#define CONFIG_NAND_U_BOOT		1
> +#define CONFIG_RAMBOOT_NAND		1
> +#define CONFIG_RAMBOOT_TEXT_BASE	0xf8f82000
> +#endif
> +

[snip]

> diff --git a/nand_spl/board/freescale/mpc8536ds/nand_boot.c b/ 
> nand_spl/board/freescale/mpc8536ds/nand_boot.c
> new file mode 100644
> index 0000000..77973d1
> --- /dev/null
> +++ b/nand_spl/board/freescale/mpc8536ds/nand_boot.c
> @@ -0,0 +1,99 @@
> +/*
> + * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights  
> reserved.

'All rights reserved' isn't acceptable (remove it).  Also get rid of  
'(C)'

> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + *
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + *
> + */
[snip]


Also, we need to add MPC8536DS_NAND to MAKEALL

- k


More information about the U-Boot mailing list