public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2
@ 2025-04-23  5:11 Sumit Garg
  2025-05-05  5:23 ` Sumit Garg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sumit Garg @ 2025-04-23  5:11 UTC (permalink / raw)
  To: u-boot-qcom, u-boot
  Cc: trini, casey.connolly, neil.armstrong, loic.minier, Sumit Garg

From: Sumit Garg <sumit.garg@oss.qualcomm.com>

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.

Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
---
 arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
index deae4d32378..dc8220e89b4 100644
--- a/arch/arm/mach-snapdragon/board.c
+++ b/arch/arm/mach-snapdragon/board.c
@@ -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, ",")) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2
  2025-04-23  5:11 [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2 Sumit Garg
@ 2025-05-05  5:23 ` Sumit Garg
  2025-05-05  7:23 ` neil.armstrong
       [not found] ` <183C90A92BBF63A5.32718@groups.io>
  2 siblings, 0 replies; 5+ messages in thread
From: Sumit Garg @ 2025-05-05  5:23 UTC (permalink / raw)
  To: casey.connolly, neil.armstrong
  Cc: u-boot-qcom, u-boot, trini, loic.minier, Sumit Garg

On Wed, Apr 23, 2025 at 10:41:32AM +0530, Sumit Garg wrote:
> From: Sumit Garg <sumit.garg@oss.qualcomm.com>
> 
> 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.
> 
> Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
> ---
>  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

> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index deae4d32378..dc8220e89b4 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -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, ",")) {
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2
  2025-04-23  5:11 [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2 Sumit Garg
  2025-05-05  5:23 ` Sumit Garg
@ 2025-05-05  7:23 ` neil.armstrong
       [not found] ` <183C90A92BBF63A5.32718@groups.io>
  2 siblings, 0 replies; 5+ messages in thread
From: neil.armstrong @ 2025-05-05  7:23 UTC (permalink / raw)
  To: Sumit Garg, u-boot-qcom, u-boot
  Cc: trini, casey.connolly, loic.minier, Sumit Garg

Hi,

On 23/04/2025 07:11, Sumit Garg wrote:
> From: Sumit Garg <sumit.garg@oss.qualcomm.com>
> 
> 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

> 
> Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
> ---
>   arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> index deae4d32378..dc8220e89b4 100644
> --- a/arch/arm/mach-snapdragon/board.c
> +++ b/arch/arm/mach-snapdragon/board.c
> @@ -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, ",")) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2
       [not found] ` <183C90A92BBF63A5.32718@groups.io>
@ 2025-05-05  7:26   ` neil.armstrong
  2025-05-05  9:31     ` Sumit Garg
  0 siblings, 1 reply; 5+ messages in thread
From: neil.armstrong @ 2025-05-05  7:26 UTC (permalink / raw)
  To: u-boot-qcom, Sumit Garg, u-boot
  Cc: trini, casey.connolly, loic.minier, Sumit Garg

On 05/05/2025 09:23, Neil Armstrong via groups.io wrote:
> Hi,
> 
> On 23/04/2025 07:11, Sumit Garg wrote:
>> From: Sumit Garg <sumit.garg@oss.qualcomm.com>
>>
>> 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.

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

> 
> Neil
> 
>>
>> Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
>> ---
>>   arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
>> index deae4d32378..dc8220e89b4 100644
>> --- a/arch/arm/mach-snapdragon/board.c
>> +++ b/arch/arm/mach-snapdragon/board.c
>> @@ -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);

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

>>           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: u-boot-qcom+owner@groups.io
> Unsubscribe: https://groups.io/g/u-boot-qcom/leave/13197875/900740/1403832380/xyzzy [neil.armstrong@linaro.org]
> -=-=-=-=-=-=-=-=-=-=-=-
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2
  2025-05-05  7:26   ` neil.armstrong
@ 2025-05-05  9:31     ` Sumit Garg
  0 siblings, 0 replies; 5+ messages in thread
From: Sumit Garg @ 2025-05-05  9:31 UTC (permalink / raw)
  To: neil.armstrong
  Cc: u-boot-qcom, u-boot, trini, casey.connolly, loic.minier,
	Sumit Garg

On Mon, May 05, 2025 at 09:26:09AM +0200, neil.armstrong@linaro.org wrote:
> On 05/05/2025 09:23, Neil Armstrong via groups.io wrote:
> > Hi,
> > 
> > On 23/04/2025 07:11, Sumit Garg wrote:
> > > From: Sumit Garg <sumit.garg@oss.qualcomm.com>
> > > 
> > > 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.
> 
> Forget my comment, it affects the fdtfile construction....
> 
> > 
> > Neil
> > 
> > > 
> > > Signed-off-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
> > > ---
> > >   arch/arm/mach-snapdragon/board.c | 12 ++++++++++--
> > >   1 file changed, 10 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> > > index deae4d32378..dc8220e89b4 100644
> > > --- a/arch/arm/mach-snapdragon/board.c
> > > +++ b/arch/arm/mach-snapdragon/board.c
> > > @@ -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);
> 
> 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

> 
> > >           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: u-boot-qcom+owner@groups.io
> > Unsubscribe: https://groups.io/g/u-boot-qcom/leave/13197875/900740/1403832380/xyzzy [neil.armstrong@linaro.org]
> > -=-=-=-=-=-=-=-=-=-=-=-
> > 
> > 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-05  9:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23  5:11 [PATCH] mach-snapdragon: Update fdtfile logic to work for RB1 and RB2 Sumit Garg
2025-05-05  5:23 ` Sumit Garg
2025-05-05  7:23 ` neil.armstrong
     [not found] ` <183C90A92BBF63A5.32718@groups.io>
2025-05-05  7:26   ` neil.armstrong
2025-05-05  9:31     ` Sumit Garg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox