summaryrefslogtreecommitdiff
path: root/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
diff options
context:
space:
mode:
authorHou Zhiqiang <Zhiqiang.Hou@nxp.com>2016-08-02 14:03:22 +0300
committerYork Sun <york.sun@nxp.com>2016-09-15 00:06:49 +0300
commit71fe22256cc9eb5decdd98842ec030ba921cd321 (patch)
tree8b1aa6d21838bf6391d1e7ef1e54a3822fc154ca /arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
parent07806e622963902efa57959a447c1dd6419e126b (diff)
downloadu-boot-71fe22256cc9eb5decdd98842ec030ba921cd321.tar.xz
fsl: serdes: ensure accessing the initialized maps of serdes protocol
Up to now, the function is_serdes_configed() doesn't check if the map of serdes protocol is initialized before accessing it. The function is_serdes_configed() will get wrong result when it was called before the serdes protocol maps initialized. As the first element of the map isn't used for any device, so use it as the flag to indicate if the map has been initialized. Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c')
-rw-r--r--arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index ba22f90a6f..85739e93a4 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
@@ -136,6 +136,9 @@ int is_serdes_configured(enum srds_prtcl device)
if (!(in_be32(&gur->rcwsr[5]) & FSL_CORENET_RCWSR5_SRDS_EN))
return 0;
+ if (!(serdes_prtcl_map & (1 << NONE)))
+ fsl_serdes_init();
+
return (1 << device) & serdes_prtcl_map;
}
@@ -514,6 +517,8 @@ void fsl_serdes_init(void)
if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
buf = buffer;
#endif
+ if (serdes_prtcl_map & (1 << NONE))
+ return;
/* Is serdes enabled at all? */
if (!(in_be32(&gur->rcwsr[5]) & FSL_CORENET_RCWSR5_SRDS_EN))
@@ -857,6 +862,9 @@ void fsl_serdes_init(void)
SRDS_RSTCTL_SDPD);
}
#endif
+
+ /* Set the first bit to indicate serdes has been initialized */
+ serdes_prtcl_map |= (1 << NONE);
}
const char *serdes_clock_to_string(u32 clock)