powerpc/85xx: Rework MPC8536 SERDES is_serdes_configured support
PATCH 1/1 powerpc/85xx: Rework MPC8536 SERDES is_serdes_configured support
Move serdes init until after we are in ram so we can keep track of a global static protocal map for the particular serdes config we are in. This makes is_serdes_configured() much simplier and not constantly reading registers to determine if a given device is enabled based on the protocol.
--- arch/powerpc/cpu/mpc85xx/cpu_init.c | 12 ++--- arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c | 66 ++++++++++++++-------------- arch/powerpc/include/asm/fsl_serdes.h | 1 + include/configs/MPC8536DS.h | 1 + 4 files changed, 40 insertions(+), 40 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +5 -7
@@ -39,10 +39,6 @@DECLARE_GLOBAL_DATA_PTR ; -#ifdef CONFIG_MPC8536 -extern void fsl_serdes_init (void ); -#endif -#ifdef CONFIG_QE extern qe_iop_conf_t qe_iop_conf_tab[]; extern void qe_config_iopin(u8 port, u8 pin, int dir,
@@ -185,9 +181,6 @@ void cpu_init_f (void)/* Config QE ioports */ config_qe_ioports ();#endif -#if defined(CONFIG_MPC8536 ) -fsl_serdes_init (); -#endif #if defined(CONFIG_FSL_DMA )dma_init ();#endif
@@ -332,6 +325,11 @@ int cpu_init_r(void)qe_reset ();#endif +#if defined(CONFIG_SYS_HAS_SERDES ) +/* needs to be in ram since code uses global static vars */ +fsl_serdes_init (); +#endif +#if defined(CONFIG_MP )setup_mp ();#endif
arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c +33 -33
99 lines not on this page · raw message
arch/powerpc/include/asm/fsl_serdes.h +1 -0
@@ -44,5 +44,6 @@ enum srds_prtcl { };int is_serdes_configured (enum srds_prtcl device); +void fsl_serdes_init (void );#endif /* __FSL_SERDES_H */
include/configs/MPC8536DS.h +1 -0
@@ -65,6 +65,7 @@#define CONFIG_FSL_PCI_INIT 1/* Use common FSL init code */ #define CONFIG_FSL_PCIE_RESET 1/* need PCIe reset errata */ #define CONFIG_SYS_PCI_64BIT 1/* enable 64-bit PCI resources */ +#define CONFIG_SYS_HAS_SERDES /* has SERDES */ #define CONFIG_FSL_LAW 1/* Use common FSL init code */ #define CONFIG_E1000 1/* Defind e1000 pci Ethernet card*/
Signature · 1 line
1.6.0.6
PATCH 1/1 powerpc/85xx: Rework P1022 SERDES is_serdes_configured support
Move serdes init until after we are in ram so we can keep track of a global static protocal map for the particular serdes config we are in. This makes is_serdes_configured() much simplier and not constantly reading registers to determine if a given device is enabled based on the protocol.
--- arch/powerpc/cpu/mpc85xx/p1022_serdes.c | 38 ++++++++++++++++++++++--------- include/configs/P1022DS.h | 1 + 2 files changed, 28 insertions(+), 11 deletions(-)
arch/powerpc/cpu/mpc85xx/p1022_serdes.c +27 -11
@@ -17,6 +17,8 @@#define SRDS1_MAX_LANES 4#define SRDS2_MAX_LANES 2 +static u32 serdes1_prtcl_map, serdes2_prtcl_map; +static const u8 serdes1_cfg_tbl[][SRDS1_MAX_LANES ] = { [0x00 ] = {NONE ,NONE ,NONE ,NONE }, [0x01 ] = {NONE ,NONE ,NONE ,NONE },
@@ -73,26 +75,40 @@ static const u8 serdes2_cfg_tbl[][SRDS2_MAX_LANES] = {int is_serdes_configured (enum srds_prtcl device) { +int ret = (1 << device) & serdes1_prtcl_map; + +if (ret) +return ret; + +return (1 << device) & serdes2_prtcl_map; +} + +void fsl_serdes_init (void ) +{ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;u32 pordevsr =in_be32 (&gur->pordevsr);u32 srds_cfg = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> MPC85xx_PORDEVSR_IO_SEL_SHIFT; -unsigned int i; +int lane; -debug ("%s: dev = %d\n" , __FUNCTION__, device); -debug ("PORDEVSR[IO_SEL] = 0x%x\n" , srds_cfg); +debug ("PORDEVSR[IO_SEL_SRDS] = %x\n" , srds_cfg);if (srds_cfg >ARRAY_SIZE (serdes1_cfg_tbl)) { -printf ("Invalid PORDEVSR[IO_SEL] = %d\n" , srds_cfg); -return 0 ; +printf ("Invalid PORDEVSR[IO_SEL_SRDS] = %d\n" , srds_cfg); +return ; + } +for (lane =0 ; lane <SRDS1_MAX_LANES ; lane++) { +enum srds_prtcl lane_prtcl = serdes1_cfg_tbl[srds_cfg][lane]; + serdes1_prtcl_map |= (1 << lane_prtcl); } -for (i =0 ; i <SRDS1_MAX_LANES ; i++) { -if (serdes1_cfg_tbl[srds_cfg][i] == device) -return 1 ; -if (serdes2_cfg_tbl[srds_cfg][i] == device) -return 1 ; +if (srds_cfg >ARRAY_SIZE (serdes2_cfg_tbl)) { +printf ("Invalid PORDEVSR[IO_SEL_SRDS] = %d\n" , srds_cfg); +return ; } -return 0 ; +for (lane =0 ; lane <SRDS2_MAX_LANES ; lane++) { +enum srds_prtcl lane_prtcl = serdes2_cfg_tbl[srds_cfg][lane]; + serdes2_prtcl_map |= (1 << lane_prtcl); + } }
include/configs/P1022DS.h +1 -0
@@ -30,6 +30,7 @@#define CONFIG_FSL_PCI_INIT /* Use common FSL init code */ #define CONFIG_FSL_PCIE_RESET /* need PCIe reset errata */ #define CONFIG_SYS_PCI_64BIT /* enable 64-bit PCI resources */ +#define CONFIG_SYS_HAS_SERDES /* has SERDES */ #define CONFIG_PHYS_64BIT #define CONFIG_ENABLE_36BIT_PHYS
Signature · 1 line
1.6.0.6
Kumar Gala
AppliedPATCH 1/1 powerpc/85xx: Rework P1022 SERDES is_serdes_configured support
Quoted 11 lines · Kumar Gala
Move serdes init until after we are in ram so we can keep track of a global static protocal map for the particular serdes config we are in. This makes
is_serdes_configured()much simplier and not constantly reading registers to determine if a given device is enabled based on the protocol.Signed-off-by Kumar Gala <[email protected]>---
arch/powerpc/cpu/mpc85xx/p1022_serdes.c| 38 ++++++++++++++++++++++---------include/configs/P1022DS.h| 1 +2 files changed, 28 insertions(+), 11 deletions(-)
applied to 85xx
- k
Kumar Gala
AppliedPATCH 1/1 powerpc/85xx: Rework MPC8536 SERDES is_serdes_configured support
In reply to Kumar GalaQuoted 6 lines · Kumar Gala
Move serdes init until after we are in ram so we can keep track of a global static protocal map for the particular serdes config we are in. This makes
is_serdes_configured()much simplier and not constantly reading registers to determine if a given device is enabled based on the protocol.
Quoted 7 lines
Signed-off-by Kumar Gala <[email protected]>---
arch/powerpc/cpu/mpc85xx/cpu_init.c | 12 ++--- arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c | 66 ++++++++++++++-------------- arch/powerpc/include/asm/fsl_serdes.h | 1 + include/configs/MPC8536DS.h | 1 + 4 files changed, 40 insertions(+), 40 deletions(-)
applied to 85xx
- k