[U-Boot] [PATCH v4] powerpc/p1022ds: Add sdcard and spi boot support to P1022DS

Andy Fleming afleming at gmail.com
Tue Jul 10 23:19:03 CEST 2012


On Mon, May 7, 2012 at 8:41 AM, Dirk Eibach <eibach at gdsys.de> wrote:
> Signed-off-by: Dirk Eibach <eibach at gdsys.de>
> Cc: Timur Tabi <timur at freescale.com>
> ---
> Changes in v2:
> - add Cc
> - split up original patch series
> Changes in v3:
> - use clrsetbits() instead of clrbits()/setbits()
> - remove dead code
> - remove unnecessary #undef
> Changes in v4:
> - Add some documentation
> - set pmuxcr depending on bootmode
> - use 'ifdef' instead of 'if defined'
> - undo unrelated whitespace change
> - fix CONFIG_ENV_ADDR
>
>  board/freescale/p1022ds/p1022ds.c |    5 +++
>  board/freescale/p1022ds/tlb.c     |   10 +++++++
>  boards.cfg                        |    4 +++
>  doc/README.p1022ds                |   52 +++++++++++++++++++++++++++++++++++
>  include/configs/P1022DS.h         |   55 +++++++++++++++++++++++++++++++++---
>  5 files changed, 121 insertions(+), 5 deletions(-)
>
> diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c
> index 456d9b0..e1e074e 100644
> --- a/board/freescale/p1022ds/p1022ds.c
> +++ b/board/freescale/p1022ds/p1022ds.c
> @@ -37,6 +37,11 @@ int board_early_init_f(void)
>  {
>         ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
>
> +#if defined(CONFIG_RAMBOOT_SPIFLASH) || defined(CONFIG_RAMBOOT_SDCARD)
> +       /* Reset eLBC_DIU and SPI_eLBC in case we are booting from SD */
> +       clrsetbits_be32(&gur->pmuxcr, 0x00600000, 0x80000000);
> +#endif
> +

This is somewhat convoluted, and also uses magic numbers. Please use
named constants. Also, if we're going to change multiple bits in the
pmuxcr, we might as well craft variables with the correct mask and set
values, and set it once.
>         /* Set pmuxcr to allow both i2c1 and i2c2 */
>         setbits_be32(&gur->pmuxcr, 0x1000);

While you're at it, please change this to a named constant.

Thanks,
Andy


More information about the U-Boot mailing list