Skip to contentSkip to conversation

collie: don't read GPSR

PATCH New Dmitry Eremin-Solenikov 3 participants 4 messages Jun 17, 2011

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

PATCH 1/1 collie: don't read GPSR

On StrongARM GPSR is write-only according to docs, so don't read from it. Just set the required GPIO.

---
 arch/arm/mach-sa1100/collie.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-sa1100/collie.c +1 -1
index f28025e..3f32ba2 100644
@@ -339,7 +339,7 @@ static void __init collie_init(void)
 
 	PCFR = PCFR_OPDE;
 
-	GPSR |= _COLLIE_GPIO_UCB1x00_RESET;
+	GPSR = _COLLIE_GPIO_UCB1x00_RESET;
 
 
 	platform_scoop_config = &collie_pcmcia_config;
Signature · 1 line
1.7.5.3
#1 lore raw

PATCH 1/1 collie: don't read GPSR

Hi,

Quoted 3 lines · Dmitry Eremin-Solenikov

On StrongARM GPSR is write-only according to docs, so don't read from it. Just set the required GPIO.

Anyway GPSR (and GPCR) is a bit oriented register that allows asserting individual bits without the need for read-modify-write cycles, making the access inherently multithread safe. Using read-modify-write on this register is contrary to the HW design.

A quick grep of the kernel source shows another abuse like this in

drivers/video/sa1100fb.c:             GPSR |= SHANNON_GPIO_DISP_EN;
drivers/video/sa1100fb.c:             GPCR |= SHANNON_GPIO_DISP_EN;

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#2 lore raw

PATCH 1/1 collie: don't read GPSR

In reply to Dmitry Eremin-Solenikov

Would it be better to switch to use gpio_* API instead of manipulating GPxR directly?

Quoted 25 lines · Dmitry Eremin-Solenikov

On StrongARM GPSR is write-only according to docs, so don't read from it. Just set the required GPIO.

---
?arch/arm/mach-sa1100/collie.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)

arch/arm/mach-sa1100/collie.c +1 -2
index f28025e..3f32ba2 100644
@@ -339,7 +339,7 @@ static void __init collie_init(void)
 
 ? ? ? ?PCFR = PCFR_OPDE;
 
- ? ? ? GPSR |= _COLLIE_GPIO_UCB1x00_RESET;
+ ? ? ? GPSR = _COLLIE_GPIO_UCB1x00_RESET;
 
 
 ? ? ? ?platform_scoop_config = &collie_pcmcia_config;
--

1.7.5.3

#3 lore raw

PATCH 1/1 collie: don't read GPSR

Quoted 2 lines · Eric Miao

Would it be better to switch to use gpio_* API instead of manipulating GPxR directly?

Yes. Probably. But this would require a much bigger cleanup effort. Waiting for spare time for it.

Quoted 28 lines
Quoted 25 lines · Dmitry Eremin-Solenikov

On StrongARM GPSR is write-only according to docs, so don't read from it. Just set the required GPIO.

---
 arch/arm/mach-sa1100/collie.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-sa1100/collie.c +1 -2
index f28025e..3f32ba2 100644
@@ -339,7 +339,7 @@ static void __init collie_init(void)
 
       PCFR = PCFR_OPDE;
 
-       GPSR |= _COLLIE_GPIO_UCB1x00_RESET;
+       GPSR = _COLLIE_GPIO_UCB1x00_RESET;
 
 
       platform_scoop_config = &collie_pcmcia_config;
--

1.7.5.3

Signature · 2 lines
With best wishes
Dmitry