[U-Boot] [PATCH v2] armv8:fsl-layerscape: Avoid RCWSR28 register hard-coding

york sun york.sun at nxp.com
Sat Mar 25 15:48:50 UTC 2017


On 02/15/2017 07:04 AM, Ashish Kumar wrote:
> From: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>
>
> SerDes information is not necessary to be present in RCWSR29 register.
> It may vary from SoC to SoC.
>
> So Avoid RCWSR28 register hard-coding.
>
> Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>
> Signed-off-by: Ashish Kumar <Ashish.Kumar at nxp.com>
> ---
> v2:
> Incorporate York's Review comments
>
>  .../cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c    | 28 ++++++++++++----------
>  .../include/asm/arch-fsl-layerscape/immap_lsch3.h  |  9 +++++++
>  2 files changed, 25 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
> index c2fc646..955e0b7 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
> @@ -51,20 +51,22 @@ int is_serdes_configured(enum srds_prtcl device)
>  int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
>  {
>  	struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
> -	u32 cfg = gur_in32(&gur->rcwsr[28]);
> +	u32 cfg = 0;
>  	int i;
>
>  	switch (sd) {
>  #ifdef CONFIG_SYS_FSL_SRDS_1
>  	case FSL_SRDS_1:
> -		cfg &= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK;
> -		cfg >>= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT;
> +		cfg = gur_in32(&gur->rcwsr[FSL_CHASSIS3_SRDS1_REGSR - 1]);
> +		cfg &= FSL_CHASSIS3_SRDS1_PRTCL_MASK;
> +		cfg >>= FSL_CHASSIS3_SRDS1_PRTCL_SHIFT;
>  		break;
>  #endif
>  #ifdef CONFIG_SYS_FSL_SRDS_2
>  	case FSL_SRDS_2:
> -		cfg &= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK;
> -		cfg >>= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
> +		cfg = gur_in32(&gur->rcwsr[FSL_CHASSIS3_SRDS2_REGSR - 1]);
> +		cfg &= FSL_CHASSIS3_SRDS2_PRTCL_MASK;
> +		cfg >>= FSL_CHASSIS3_SRDS2_PRTCL_SHIFT;
>  		break;
>  #endif
>  	default:
> @@ -83,8 +85,8 @@ int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
>  	return -ENODEV;
>  }
>
> -void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
> -		u8 serdes_prtcl_map[SERDES_PRCTL_COUNT])
> +void serdes_init(u32 sd, u32 sd_addr, u32 rcwsr, u32 sd_prctl_mask,

I am OK with this patch. Looks like this function serdes_init() is only 
used locally. Can you make another patch to change all serves_init() to 
static (ls1021a, lsch2, mpc85xx)?

York


More information about the U-Boot mailing list