Skip to contentSkip to conversation

at91: fix at91rm9200 soc subtype handling

PATCH New Veli-Pekka Peltola 3 participants 7 messages Dec 28, 2011 – Jan 7, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91: fix at91rm9200 soc subtype handling

BGA should be the default SoC subtype but it is set to unknown if not explicitly set to PQFP. Currently setting it to PQFP sets subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

After this fix BGA subtype is set as default. On boot BGA is printed always but it is set to PQFP if requested before setting amount of GPIO banks.

---
 arch/arm/mach-at91/setup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-at91/setup.c +3 -2
index aa64294..e6b07ad 100644
@@ -27,9 +27,9 @@ EXPORT_SYMBOL(at91_soc_initdata);
 void __init at91rm9200_set_type(int type)
 {
 	if (type == ARCH_REVISON_9200_PQFP)
-		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
-	else
 		at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
+	else
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 }
 
 void __init at91_init_irq_default(void)
@@ -118,6 +118,7 @@ static void __init soc_detect(u32 dbgu_base)
 
 	case ARCH_ID_AT91RM9200:
 		at91_soc_initdata.type = AT91_SOC_RM9200;
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 		at91_boot_soc = at91rm9200_soc;
 		break;
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 at91: fix at91rm9200 soc subtype handling

On 12/28/2011 12:10 PM, Veli-Pekka Peltola :

Quoted 11 lines

BGA should be the default SoC subtype but it is set to unknown if not explicitly set to PQFP. Currently setting it to PQFP sets subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

After this fix BGA subtype is set as default. On boot BGA is printed always but it is set to PQFP if requested before setting amount of GPIO banks.

I will queue it in a "fixes" branch (hopefully for 3.3).

thanks a lot. Best regards,

Quoted 28 lines
---
 arch/arm/mach-at91/setup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-at91/setup.c +3 -2
index aa64294..e6b07ad 100644
@@ -27,9 +27,9 @@ EXPORT_SYMBOL(at91_soc_initdata);
 void __init at91rm9200_set_type(int type)
 {
 	if (type == ARCH_REVISON_9200_PQFP)
-		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
-	else
 		at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
+	else
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 }
 
 void __init at91_init_irq_default(void)
@@ -118,6 +118,7 @@ static void __init soc_detect(u32 dbgu_base)
 
 	case ARCH_ID_AT91RM9200:
 		at91_soc_initdata.type = AT91_SOC_RM9200;
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 		at91_boot_soc = at91rm9200_soc;
 		break;
 
Signature · 1 line
Nicolas Ferre
#2 lore raw

PATCH 1/1 at91: fix at91rm9200 soc subtype handling

On 01/02/2012 03:21 PM, Nicolas Ferre :

Quoted 11 lines

On 12/28/2011 12:10 PM, Veli-Pekka Peltola :

Quoted 10 lines

BGA should be the default SoC subtype but it is set to unknown if not explicitly set to PQFP. Currently setting it to PQFP sets subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

After this fix BGA subtype is set as default. On boot BGA is printed always but it is set to PQFP if requested before setting amount of GPIO banks.

Quoted 5 lines
Quoted 1 line

I will queue it in a "fixes" branch (hopefully for 3.3).

I come back to this:
1/ There is definitively a bug in at91rm9200_set_type()
2/ I do not know if it is a good idea to set BGA subtype by default. I would simply keep the "unknown" subtype printed out until the real subtype is set by the "*_init_early()" of the board code.

So, I may modify your original patch and submit it for discussion... Jean-Christophe, I would like to have your opinion on this.

Best regards,

Quoted 34 lines

thanks a lot. Best regards,

Quoted 28 lines
---
 arch/arm/mach-at91/setup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-at91/setup.c +3 -2
index aa64294..e6b07ad 100644
@@ -27,9 +27,9 @@ EXPORT_SYMBOL(at91_soc_initdata);
 void __init at91rm9200_set_type(int type)
 {
 	if (type == ARCH_REVISON_9200_PQFP)
-		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
-	else
 		at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
+	else
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 }
 
 void __init at91_init_irq_default(void)
@@ -118,6 +118,7 @@ static void __init soc_detect(u32 dbgu_base)
 
 	case ARCH_ID_AT91RM9200:
 		at91_soc_initdata.type = AT91_SOC_RM9200;
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 		at91_boot_soc = at91rm9200_soc;
 		break;
 
Signature · 1 line
Nicolas Ferre
#3 lore raw

PATCH v2 1/1 ARM: at91: fix at91rm9200 soc subtype handling

Currently setting it to PQFP changes subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

After this fix, subtype is still set as unknown. But board code should fill it in with proper value. Another information is thus printed.

Bug discovery and first implementation made by Veli-Pekka Peltola.

---
 arch/arm/mach-at91/setup.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-at91/setup.c +5 -2
index aa64294..f5bbe0ef 100644
@@ -27,9 +27,12 @@ EXPORT_SYMBOL(at91_soc_initdata);
 void __init at91rm9200_set_type(int type)
 {
 	if (type == ARCH_REVISON_9200_PQFP)
-		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
-	else
 		at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
+	else
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
+
+	pr_info("AT91: filled in soc subtype: %s\n",
+		at91_get_soc_subtype(&at91_soc_initdata));
 }
 
 void __init at91_init_irq_default(void)
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v2 1/1 ARM: at91: fix at91rm9200 soc subtype handling

Quoted 5 lines · Nicolas Ferre

Currently setting it to PQFP changes subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

Quoted 7 lines

After this fix, subtype is still set as unknown. But board code should fill it in with proper value. Another information is thus printed.

Bug discovery and first implementation made by Veli-Pekka Peltola.

Best Regards,
J.

Quoted 1 line

---

#5 lore raw

PATCH 1/1 at91: fix at91rm9200 soc subtype handling

In reply to Nicolas Ferre
Quoted 18 lines · Nicolas Ferre

On 01/02/2012 03:21 PM, Nicolas Ferre :

Quoted 11 lines

On 12/28/2011 12:10 PM, Veli-Pekka Peltola :

Quoted 10 lines

BGA should be the default SoC subtype but it is set to unknown if not explicitly set to PQFP. Currently setting it to PQFP sets subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

After this fix BGA subtype is set as default. On boot BGA is printed always but it is set to PQFP if requested before setting amount of GPIO banks.

Quoted 5 lines
Quoted 1 line

I will queue it in a "fixes" branch (hopefully for 3.3).

Quoted 8 lines

I come back to this:
1/ There is definitively a bug in at91rm9200_set_type()
2/ I do not know if it is a good idea to set BGA subtype by default. I would simply keep the "unknown" subtype printed out until the real subtype is set by the "*_init_early()" of the board code.

So, I may modify your original patch and submit it for discussion... Jean-Christophe, I would like to have your opinion on this.

agreed

Best Regards,
J.

#6 lore raw

PATCH 1/1 at91: fix at91rm9200 soc subtype handling

In reply to Veli-Pekka Peltola
Quoted 32 lines · Veli-Pekka Peltola

BGA should be the default SoC subtype but it is set to unknown if not explicitly set to PQFP. Currently setting it to PQFP sets subtype to BGA as subtypes are swapped in at91rm9200_set_type().

Wrong subtype causes GPIO bank D not to work at all.

After this fix BGA subtype is set as default. On boot BGA is printed always but it is set to PQFP if requested before setting amount of GPIO banks.

---
 arch/arm/mach-at91/setup.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-at91/setup.c +2 -2
index aa64294..e6b07ad 100644
@@ -27,9 +27,9 @@ EXPORT_SYMBOL(at91_soc_initdata);
 void __init at91rm9200_set_type(int type)
 {
 	if (type == ARCH_REVISON_9200_PQFP)
-		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
-	else
 		at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
+	else
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 }
 
 void __init at91_init_irq_default(void)

arch/arm/mach-at91/setup.c static void __init soc_detect(u32 dbgu_base) · line 122

Quoted 5 lines
arch/arm/mach-at91/setup.c +1 -0
@@ -118,6 +118,7 @@ static void __init soc_detect(u32 dbgu_base)
 
 	case ARCH_ID_AT91RM9200:
 		at91_soc_initdata.type = AT91_SOC_RM9200;
+		at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
 		at91_boot_soc = at91rm9200_soc;

disagree here
as we can not detect it the board MUST set it

Best Regards,
J.