CARRIER F in the RCW build stamp is the bring-up RCW: it powers every
serses PLL down and zeroes the 3 protocols's serdes.

Signed-off-by: Vincent Jardin <[email protected]>
---

(no changes since v1)

 board/nxp/lx2160a/nbxv3/carrier.c | 35 +++++++++++++++++++++++++++----
 board/nxp/lx2160a/nbxv3/carrier.h |  1 +
 doc/board/nxp/nbxv3.rst           |  8 ++++++-
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/board/nxp/lx2160a/nbxv3/carrier.c 
b/board/nxp/lx2160a/nbxv3/carrier.c
index 61bab54d5ef..06a54bed0eb 100644
--- a/board/nxp/lx2160a/nbxv3/carrier.c
+++ b/board/nxp/lx2160a/nbxv3/carrier.c
@@ -57,12 +57,14 @@
  *   1     NBV30 / NBV31
  *   2     NBV32
  *   3     NBV32 with SerDes 1 at protocol 20 (2x 40GE) in the RCW
- *   4..F  unassigned, treated like 0
+ *   4..E  unassigned, treated like 0
+ *   F     bring-up RCW: no SerDes IO, it names no carrier either
  */
 #define NBXV3_STAMP_SCRATCHRW          12      /* SCRATCHRW13 */
 #define NBXV3_STAMP_CARRIER            GENMASK(31, 28)
 #define NBXV3_STAMP_TAG                        GENMASK(27, 24)
 #define NBXV3_STAMP_TAG_NBXV3          0xb
+#define NBXV3_CARRIER_BRINGUP          0xf
 
 /* CARRIER digit of the RCW build stamp, -ENOENT without a stamp */
 static int nbxv3_stamp_carrier(void)
@@ -91,25 +93,50 @@ static const char *nbxv3_carrier_detect(int digit)
        }
 }
 
+/*
+ * The RCW of bringup powers down every SerDes PLL: there is no WRIOP for
+ * the MC to manage, so do not start the MC.
+ */
+static void nbxv3_carrier_disable_mc(void)
+{
+       if (!env_get("mcinitcmd"))
+               return;
+
+       if (env_set("mcinitcmd", NULL)) {
+               printf("Carrier:       WARNING: cannot clear ${mcinitcmd}, the 
MC start is expected to hang\n");
+               return;
+       }
+
+       printf("Carrier:       bring-up RCW (no SerDes IO), MC not started\n");
+}
+
 void nbxv3_carrier_env_init(void)
 {
        const char *carrier = env_get("carrier");
        const char *origin;
        int digit;
 
+       /* Whatever ${carrier} says, the SerDes have no IO */
+       digit = nbxv3_stamp_carrier();
+       if (digit == NBXV3_CARRIER_BRINGUP)
+               nbxv3_carrier_disable_mc();
+
        if (carrier && *carrier) {
                printf("Carrier:       %s (from env)\n", carrier);
                return;
        }
 
-       digit = nbxv3_stamp_carrier();
        carrier = nbxv3_carrier_detect(digit);
        if (carrier) {
                origin = "RCW build stamp";
        } else {
                carrier = NBXV3_CARRIER_DEFAULT;
-               origin = digit < 0 ? "default, no RCW build stamp" :
-                                    "default, the RCW names no carrier";
+               if (digit < 0)
+                       origin = "default, no RCW build stamp";
+               else if (digit == NBXV3_CARRIER_BRINGUP)
+                       origin = "default, the bring-up RCW names no carrier";
+               else
+                       origin = "default, the RCW names no carrier";
        }
 
        if (env_set("carrier", carrier)) {
diff --git a/board/nxp/lx2160a/nbxv3/carrier.h 
b/board/nxp/lx2160a/nbxv3/carrier.h
index e7eb42265e4..44b2ce1f047 100644
--- a/board/nxp/lx2160a/nbxv3/carrier.h
+++ b/board/nxp/lx2160a/nbxv3/carrier.h
@@ -11,6 +11,7 @@
  * It is idempotent, and it never overrides a value already present
  * in the uboot's environment.
  * It shall run after initr_env and before ${mcinitcmd} is evaluated.
+ * On the bring-up RCW it also clears ${mcinitcmd}, without saving it.
  */
 void nbxv3_carrier_env_init(void);
 
diff --git a/doc/board/nxp/nbxv3.rst b/doc/board/nxp/nbxv3.rst
index 3eb87104a52..8259ca85095 100644
--- a/doc/board/nxp/nbxv3.rst
+++ b/doc/board/nxp/nbxv3.rst
@@ -112,9 +112,15 @@ CARRIER ``${carrier}``
 1       ``nbv30`` (NBV30, NBV31)
 2       ``nbv32``
 3       ``nbv32-40g``: NBV32 with SerDes 1 protocol 20 (2x 40GE)
-4..F    unassigned, treated like 0
+4..E    unassigned, treated like 0
+F       none: bring-up RCW, see below
 ======= ==================================================
 
+The bring-up RCW (CARRIER F) leaves every SerDes without IO, so there is
+no data path for the MC to manage and starting it hangs the boot.
+U-Boot clears ``mcinitcmd`` for that boot, whatever ``${carrier}`` is,
+and does not save it.
+
 Boot flow
 ---------
 
-- 
2.43.0

Reply via email to