>-----Original Message-----
>From: Pramod Kumar
>Sent: Wednesday, September 18, 2019 4:52 PM
>To: u-boot@lists.denx.de
>Cc: York Sun <york....@nxp.com>; Jagdish Gediya
><jagdish.ged...@nxp.com>; Priyanka Jain <priyanka.j...@nxp.com>; Pramod
>Kumar <pramod.kuma...@nxp.com>
>Subject: [PATCH v1] armv8: fsl-layerscape: LS1044A/1048A: enable Only 1x
>10GE port
>
>LS1044A/1048A is LS1088 personality which support only one 1x 10GE port.
Please correct grammar. LS1044A, LS1048A are LS1088A personalities
>MAC1 and MAC2 are associated with 1G SGMII, 2.5G SGMII, and XFI.
>Disable MAC1 to have only one 1x 10GE port
>
>Signed-off-by: Pramod Kumar <pramod.kuma...@nxp.com>
>---
> arch/arm/cpu/armv8/fsl-layerscape/ls1088a_serdes.c | 33
>+++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1088a_serdes.c
>b/arch/arm/cpu/armv8/fsl-layerscape/ls1088a_serdes.c
>index 8e8b45a..11090e8 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/ls1088a_serdes.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1088a_serdes.c
>@@ -5,6 +5,11 @@
>
> #include <common.h>
> #include <asm/arch/fsl_serdes.h>
>+#include <asm/arch/soc.h>
>+#include <asm/io.h>
>+#define PERSONALITY_LS1088A_TYPE              0
>+#define PERSONALITY_LS1044A_LS1048A_TYPE      1
>+#define PERSONALITY_INVALID_TYPE              -1
>
> struct serdes_config {
>       u8 ip_protocol;
>@@ -32,6 +37,7 @@ static struct serdes_config serdes1_cfg_tbl[] = {
>       {0x3A, {SGMII3, PCIE1, SGMII1, SGMII2 }, {3, 5, 3, 3 } },
>               {}
> };
>+
> static struct serdes_config serdes2_cfg_tbl[] = {
>       /* SerDes 2 */
>       {0x0C, {PCIE1, PCIE1, PCIE1, PCIE1 }, {8, 8, 8, 8 } }, @@ -48,6 +54,22 
> @@
>static struct serdes_config *serdes_cfg_tbl[] = {
>       serdes2_cfg_tbl,
> };
>
>+int check_personality_type(void)
>+{
>+      struct ccsr_gur __iomem *gur = (void
>*)(CONFIG_SYS_FSL_GUTS_ADDR);
>+      unsigned int  svr, ver;
>+      int personality;
>+
>+      svr = gur_in32(&gur->svr);
>+      ver = SVR_SOC_VER(svr);
>+      if (ver == SVR_LS1088A)
>+              personality =  PERSONALITY_LS1088A_TYPE;
>+      else
>+              personality = PERSONALITY_LS1044A_LS1048A_TYPE;
>+
>+      return personality;
>+}
>+
SVR_SOC_VER macro is to return personality type.
No need to add another function check_personality_type()
If you intend to check presence of MAC1, you might rename it to
something like soc_has_mac1 and return true/false accordingly.

--priyankajain
> int serdes_get_number(int serdes, int cfg)  {
>       struct serdes_config *ptr;
>@@ -84,10 +106,19 @@ int serdes_get_number(int serdes, int cfg)  enum
>srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane)  {
>       struct serdes_config *ptr;
>+      int personality_type;
>
>       if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
>               return 0;
>-
>+      /*
>+       * LS1044A/1048A  support only one XFI port
>+       * Disable MAC1 for LS1044A/1048A
>+       */
>+      if (!serdes && lane == 2) {
>+              personality_type = check_personality_type();
>+              if (personality_type == PERSONALITY_LS1044A_LS1048A_TYPE)
>+                      return 0;
>+      }
>       ptr = serdes_cfg_tbl[serdes];
>       while (ptr->ip_protocol) {
>               if (ptr->ip_protocol == cfg)
>--
>2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to