Skip to contentSkip to conversation

mach-snapdragon: Update fdtfile logic to work for RB1 and RB2

PATCH Superseded Sumit Garg 2 participants 5 messages Apr 23, 2025 – May 5, 2025 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sumit Garg

author
#0 lore raw

PATCH 1/1 mach-snapdragon: Update fdtfile logic to work for RB1 and RB2

From: Sumit Garg <[email protected]>

RB1 and RB2 have three root compatibles where the last one can't be used to decode fdtfile name (qcm* vs qrb*). So rather just rely on the first compatible to retrieve the SoC name.

---
 arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm/mach-snapdragon/board.c +10 -2
index deae4d32378..dc8220e89b4 100644
@@ -437,16 +437,24 @@ static void configure_env(void)
 
 	/* The Qualcomm reference boards (RBx, HDK, etc)  */
 	if (!strncmp("qcom", buf, strlen("qcom"))) {
+		char *soc;
+
 		/*
 		 * They all have the first compatible as "qcom,<soc>-<board>"
 		 * (e.g. "qcom,qrb5165-rb5"). We extract just the part after
 		 * the dash.
 		 */
-		if (!strsep(&tmp, "-")) {
+		if (!strsep(&tmp, ",")) {
+			log_warning("compatible '%s' has no ','\n", buf);
+			return;
+		}
+		soc = strsep(&tmp, "-");
+		if (!soc) {
 			log_warning("compatible '%s' has no '-'\n", buf);
 			return;
 		}
-		/* tmp is now "rb5" */
+
+		env_set("soc", soc);
 		env_set("board", tmp);
 	} else {
 		if (!strsep(&tmp, ",")) {
Signature · 1 line
2.43.0
author
#1 lore raw
Quoted 11 lines · Sumit Garg

From: Sumit Garg <[email protected]>

RB1 and RB2 have three root compatibles where the last one can't be used to decode fdtfile name (qcm* vs qrb*). So rather just rely on the first compatible to retrieve the SoC name.

---
 arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Gentle ping for this fix review, I will like to see this landed in 2025.07.

-Sumit

Quoted 34 lines
arch/arm/mach-snapdragon/board.c +10 -2
index deae4d32378..dc8220e89b4 100644
@@ -437,16 +437,24 @@ static void configure_env(void)
 
 	/* The Qualcomm reference boards (RBx, HDK, etc)  */
 	if (!strncmp("qcom", buf, strlen("qcom"))) {
+		char *soc;
+
 		/*
 		 * They all have the first compatible as "qcom,<soc>-<board>"
 		 * (e.g. "qcom,qrb5165-rb5"). We extract just the part after
 		 * the dash.
 		 */
-		if (!strsep(&tmp, "-")) {
+		if (!strsep(&tmp, ",")) {
+			log_warning("compatible '%s' has no ','\n", buf);
+			return;
+		}
+		soc = strsep(&tmp, "-");
+		if (!soc) {
 			log_warning("compatible '%s' has no '-'\n", buf);
 			return;
 		}
-		/* tmp is now "rb5" */
+
+		env_set("soc", soc);
 		env_set("board", tmp);
 	} else {
 		if (!strsep(&tmp, ",")) {
Signature · 1 line
2.43.0
#2 lore raw
In reply to Sumit Garg

Hi,

Quoted 5 lines · Sumit Garg

From: Sumit Garg <[email protected]>

RB1 and RB2 have three root compatibles where the last one can't be used to decode fdtfile name (qcm* vs qrb*). So rather just rely on the first compatible to retrieve the SoC name.

OK, so "soc" would be qcm2290 instead of qrb2210, what's the problem since you have "board" with "qrb2210-rb1" ?

What is the difference between qcm2290 & qrb2210 that affects U-boot ?

Same for qrb4210 vs sm4250.

If you have a custom board code, you can still match on the root compatible.

Neil

Quoted 37 lines
---
  arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm/mach-snapdragon/board.c +10 -2
index deae4d32378..dc8220e89b4 100644
@@ -437,16 +437,24 @@ static void configure_env(void)
 
  	/* The Qualcomm reference boards (RBx, HDK, etc)  */
  	if (!strncmp("qcom", buf, strlen("qcom"))) {
+		char *soc;
+
  		/*
  		 * They all have the first compatible as "qcom,<soc>-<board>"
  		 * (e.g. "qcom,qrb5165-rb5"). We extract just the part after
  		 * the dash.
  		 */
-		if (!strsep(&tmp, "-")) {
+		if (!strsep(&tmp, ",")) {
+			log_warning("compatible '%s' has no ','\n", buf);
+			return;
+		}
+		soc = strsep(&tmp, "-");
+		if (!soc) {
  			log_warning("compatible '%s' has no '-'\n", buf);
  			return;
  		}
-		/* tmp is now "rb5" */
+
+		env_set("soc", soc);
  		env_set("board", tmp);
  	} else {
  		if (!strsep(&tmp, ",")) {

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 9 lines · Neil Armstrong via groups.io

Hi,

Quoted 5 lines · Sumit Garg

From: Sumit Garg <[email protected]>

RB1 and RB2 have three root compatibles where the last one can't be used to decode fdtfile name (qcm* vs qrb*). So rather just rely on the first compatible to retrieve the SoC name.

Quoted 8 lines

OK, so "soc" would be qcm2290 instead of qrb2210, what's the problem since you have "board" with "qrb2210-rb1" ?

What is the difference between qcm2290 & qrb2210 that affects U-boot ?

Same for qrb4210 vs sm4250.

If you have a custom board code, you can still match on the root compatible.

Forget my comment, it affects the fdtfile construction....

Quoted 28 lines

Neil

Quoted 25 lines

---
  arch/arm/mach-snapdragon/board.c | 12 ++++++++++--

  1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm/mach-snapdragon/board.c +6 -1
index deae4d32378..dc8220e89b4 100644
@@ -437,16 +437,24 @@ static void configure_env(void)
       /* The Qualcomm reference boards (RBx, HDK, etc)  */
       if (!strncmp("qcom", buf, strlen("qcom"))) {
+        char *soc;
+
           /*
            * They all have the first compatible as "qcom,<soc>-<board>"
            * (e.g. "qcom,qrb5165-rb5"). We extract just the part after
            * the dash.
            */
-        if (!strsep(&tmp, "-")) {
+        if (!strsep(&tmp, ",")) {
+            log_warning("compatible '%s' has no ','\n", buf);
+            return;
+        }
Quoted 8 lines

arch/arm/mach-snapdragon/board.c static void configure_env(void) · line 457

Quoted 8 lines
arch/arm/mach-snapdragon/board.c +4 -1
+        soc = strsep(&tmp, "-");
+        if (!soc) {
               log_warning("compatible '%s' has no '-'\n", buf);
               return;
           }
-        /* tmp is now "rb5" */
+
+        env_set("soc", soc);

OK, so you should move the other env_set("soc", ...) code in the other else branch to avoid having a double env_set("soc", ...)

Quoted 15 lines

arch/arm/mach-snapdragon/board.c static void configure_env(void) · line 460

Quoted 3 lines
arch/arm/mach-snapdragon/board.c +0 -0
           env_set("board", tmp);
       } else {
           if (!strsep(&tmp, ",")) {

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#1677): https://groups.io/g/u-boot-qcom/message/1677
Mute This Topic: https://groups.io/mt/112410772/900740
Group Owner: [email protected]
Unsubscribe: https://groups.io/g/u-boot-qcom/leave/13197875/900740/1403832380/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#5 lore raw
Quoted 52 lines · On Mon, May 05, 2025 at 09:26:09AM +0200, [email protected] wrote:
Quoted 9 lines · Neil Armstrong via groups.io

Hi,

Quoted 5 lines · Sumit Garg

From: Sumit Garg <[email protected]>

RB1 and RB2 have three root compatibles where the last one can't be used to decode fdtfile name (qcm* vs qrb*). So rather just rely on the first compatible to retrieve the SoC name.

Quoted 8 lines

OK, so "soc" would be qcm2290 instead of qrb2210, what's the problem since you have "board" with "qrb2210-rb1" ?

What is the difference between qcm2290 & qrb2210 that affects U-boot ?

Same for qrb4210 vs sm4250.

If you have a custom board code, you can still match on the root compatible.

Forget my comment, it affects the fdtfile construction....

Quoted 31 lines

Neil

Quoted 28 lines

---
  arch/arm/mach-snapdragon/board.c | 12 ++++++++++--

  1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm/mach-snapdragon/board.c +8 -1
index deae4d32378..dc8220e89b4 100644
@@ -437,16 +437,24 @@ static void configure_env(void)
       /* The Qualcomm reference boards (RBx, HDK, etc)  */
       if (!strncmp("qcom", buf, strlen("qcom"))) {
+        char *soc;
+
           /*
            * They all have the first compatible as "qcom,<soc>-<board>"
            * (e.g. "qcom,qrb5165-rb5"). We extract just the part after
            * the dash.
            */
-        if (!strsep(&tmp, "-")) {
+        if (!strsep(&tmp, ",")) {
+            log_warning("compatible '%s' has no ','\n", buf);
+            return;
+        }
+        soc = strsep(&tmp, "-");
+        if (!soc) {
               log_warning("compatible '%s' has no '-'\n", buf);
Quoted 8 lines
Quoted 5 lines

arch/arm/mach-snapdragon/board.c static void configure_env(void) · line 457

Quoted 5 lines
arch/arm/mach-snapdragon/board.c +2 -1
               return;
           }
-        /* tmp is now "rb5" */
+
+        env_set("soc", soc);

OK, so you should move the other env_set("soc", ...) code in the other else branch to avoid having a double env_set("soc", ...)

Sure, I can do that in v2.

-Sumit

Quoted 17 lines
Quoted 16 lines

arch/arm/mach-snapdragon/board.c static void configure_env(void) · line 460

Quoted 4 lines
arch/arm/mach-snapdragon/board.c +0 -0
           env_set("board", tmp);
       } else {
           if (!strsep(&tmp, ",")) {

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#1677): https://groups.io/g/u-boot-qcom/message/1677
Mute This Topic: https://groups.io/mt/112410772/900740
Group Owner: [email protected]
Unsubscribe: https://groups.io/g/u-boot-qcom/leave/13197875/900740/1403832380/xyzzy [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-