Skip to contentSkip to conversation

powerpc: Implement GPIO LIB API on CPM2 Freescale SoC.

PATCH Superseded Laurent Pinchart 2 participants 7 messages Apr 17, 2008 PowerPC

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Implement GPIO LIB API on CPM2 Freescale SoC.

This patch implement GPIO LIB support for the CPM2 GPIOs.

The code is based on Jochen Friedrich's patch for the CPM1.

---
 arch/powerpc/platforms/Kconfig |    2 +
 arch/powerpc/sysdev/cpm2.c     |  123 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 0 deletions(-)
arch/powerpc/platforms/Kconfig +2 -0
index b0aa0dc..93ec36e 100644
@@ -283,6 +283,8 @@ config CPM2
 	depends on MPC85xx || 8260
 	select CPM
 	select PPC_LIB_RHEAP
+	select GENERIC_GPIO
+	select HAVE_GPIO_LIB
 	help
 	  The CPM2 (Communications Processor Module) is a coprocessor on
 	  embedded CPUs made by Freescale.  Selecting this option means that
arch/powerpc/sysdev/cpm2.c +123 -0

139 lines not on this page · raw message

Signature · 13 lines
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#1 lore raw

Hi Laurent,

Quoted 3 lines

This patch implement GPIO LIB support for the CPM2 GPIOs.

The code is based on Jochen Friedrich's patch for the CPM1.

I guess most of this should go to cpm_common.c and should be used for Port E on CPM1, as well. This port uses the same layout as CPM2 while Port B uses a different layout. See the discussion in
http://patchwork.ozlabs.org/linuxppc/patch?id=16282

Thanks,
Jochen

#2 lore raw
Quoted 10 lines · Jochen Friedrich

Hi Laurent,

Quoted 3 lines

This patch implement GPIO LIB support for the CPM2 GPIOs.

The code is based on Jochen Friedrich's patch for the CPM1.

I guess most of this should go to cpm_common.c and should be used for Port E on CPM1, as well. This port uses the same layout as CPM2 while Port B uses a different layout. See the discussion in
http://patchwork.ozlabs.org/linuxppc/patch?id=16282

The link doesn't seem to be related.

I'll rework the patch to move CPM2 GPIO support to cpm_common.c. Have you thought about a proper name for the compatible property ?

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#3 lore raw

Hi Laurent,

Quoted 3 lines
Quoted 1 line

http://patchwork.ozlabs.org/linuxppc/patch?id=16282

The link doesn't seem to be related.

http://patchwork.ozlabs.org/linuxppc/patch?id=17490 is the correct one.

Quoted 2 lines

I'll rework the patch to move CPM2 GPIO support to cpm_common.c. Have you thought about a proper name for the compatible property ?

I would leave cpm_init_par_io() in cpm2.c and just move the other parts.
- for cpm2, the property fsl,cpm2-pario-bank is correct.
- for cpm1, i'm thinking of something like fsl,cpm1-pario-bank32b and fsl,cpm1-pario-bank32e.

I'll update the CPM1 parts on top of your patch...

Thanks,
Jochen

#4 lore raw
Quoted 7 lines · Jochen Friedrich

Hi Laurent,

Quoted 3 lines
Quoted 1 line

http://patchwork.ozlabs.org/linuxppc/patch?id=16282

The link doesn't seem to be related.

http://patchwork.ozlabs.org/linuxppc/patch?id=17490 is the correct one.

Thanks.

Quoted 6 lines
Quoted 2 lines

I'll rework the patch to move CPM2 GPIO support to cpm_common.c. Have you thought about a proper name for the compatible property ?

I would leave cpm_init_par_io() in cpm2.c and just move the other parts.
- for cpm2, the property fsl,cpm2-pario-bank is correct.
- for cpm1, i'm thinking of something like fsl,cpm1-pario-bank32b and

fsl,cpm1-pario-bank32e.

Any preference for common function names ? cpm2_gpio32* might be too CPM2-specific for cpm_common.c. cpm_gpio32* is a bit too generic as it doesn't support port E on the CPM1.

BTW, what's the purpose of the shadow data register in the CPM GPIO chip structure ? As the set operation is protected by a spinlock, the only use I can think of is to prevent changing bits in the PDAT register for pins configured as inputs. Is that correct ? If so this should be clearly documented in the code.

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#5 lore raw

Hi Laurent,

Quoted 5 lines

BTW, what's the purpose of the shadow data register in the CPM GPIO chip structure ? As the set operation is protected by a spinlock, the only use I can think of is to prevent changing bits in the PDAT register for pins configured as inputs. Is that correct ? If so this should be clearly documented in the code.

It's for pins configured as open drain. See the discussion in:

http://ozlabs.org/pipermail/linuxppc-dev/2008-January/050826.html

Thanks,
Jochen

#6 lore raw
In reply to Laurent Pinchart

Hi Laurent,

Quoted 3 lines

Any preference for common function names ? cpm2_gpio32* might be too CPM2-specific for cpm_common.c. cpm_gpio32* is a bit too generic as it doesn't support port E on the CPM1.

I would keep the cpm2 name. I'll just add a comment to cpm1.c that fsl,cpm1-pario-bank32e uses cpm2 layout.

Thanks,
Jochen