[U-Boot] [PATCH 2/7] ppc/p4080: Add support for CoreNet style platform LAWs

Wolfgang Denk wd at denx.de
Wed Sep 23 00:05:35 CEST 2009


Dear Kumar Gala,

In message <1253307595-28655-3-git-send-email-galak at kernel.crashing.org> you wrote:
> On CoreNet based platforms the LAW address is split between an high &
> low register and we no longer shift the address.  Also, the target IDs
> on CoreNet platforms have been completely re-assigned.
> 
> Additionally, added a new find_law() API to which LAW an address hits in.
> This is need for the CoreNet style boot release code since it will need
> to determine what the target ID should be set to for boot window
> translation.
> 
> Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
> ---
>  drivers/misc/fsl_law.c    |   99 ++++++++++++++++++++++++++++++++++++++++++++-
>  include/asm-ppc/fsl_law.h |   29 +++++++++++++
>  2 files changed, 127 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/misc/fsl_law.c b/drivers/misc/fsl_law.c
> index aa877c6..fba16ed 100644
> --- a/drivers/misc/fsl_law.c
> +++ b/drivers/misc/fsl_law.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright 2008 Freescale Semiconductor, Inc.
> + * Copyright 2008-2009 Freescale Semiconductor, Inc.
>   *
>   * (C) Copyright 2000
>   * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> @@ -48,6 +48,24 @@ DECLARE_GLOBAL_DATA_PTR;
>  
>  void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
>  {
> +#ifdef CONFIG_FSL_CORENET
> +	volatile ccsr_local_t *ccm;
> +	volatile u32 *base, *lawbarh, *lawbarl, *lawar;
> +
> +	ccm = (void *)(CONFIG_SYS_FSL_CORENET_CCM_ADDR);
> +
> +	base = &(ccm->lawbarh0);
> +	lawbarh = base + idx * 4;
> +	lawbarl = lawbarh + 1;
> +	lawar = lawbarl + 1;
> +
> +	gd->used_laws |= (1 << idx);
> +
> +	out_be32(lawar, 0);
> +	out_be32(lawbarh, ((u64)addr >> 32));
> +	out_be32(lawbarl, addr & 0xffffffff);
> +	out_be32(lawar, LAWAR_EN | ((u32)id << 20) | (u32)sz);
> +#else
>  	volatile u32 *base = (volatile u32 *)(CONFIG_SYS_IMMR + 0xc08);
>  	volatile u32 *lawbar = base + 8 * idx;
>  	volatile u32 *lawar = base + 8 * idx + 2;

This is ugly. Now we have code and variable declarations intermixed.
Please don't. Especially not when it's the same variables.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There comes to all races an ultimate crisis which  you  have  yet  to
face  ....  One  day  our  minds became so powerful we dared think of
ourselves as gods.
	-- Sargon, "Return to Tomorrow", stardate 4768.3


More information about the U-Boot mailing list