Skip to contentSkip to conversation

gpio: Add GPIO driver framework for Marvell SoCs

PATCH Superseded Ajay Bhargav 4 participants 4 messages Aug 3, 2011 – Aug 4, 2011 1 message not in the archive

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

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

#1 lore raw

PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs

Quoted 9 lines · ----- "Simon Guinot

AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear for GPIO output/direction registers. Instead, a register must be read first to leave other bits unchanged (see __set_direction in kw_gpio.c).

Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada struct gpio_reg array) ?

Quoted 7 lines

If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybe armada_gpio is a better name...

Regards,

Simon

Hi Simon,

Yes its possible to implement code that way, Armada SoC does have GPIO registers for set/clear. what about register naming?? I think they are different for Kirkwood and Orion.

One more thing which can be done to make this code generic is to have some macros which can be defined by individual arch for specific registers which are going to be in use e.g.

#define GPIO_PIN_LEVEL_REG
#define GPIO_DIR_REG
#define GPIO_PIN_SET_REG
#define GPIO_PIN_CLR_REG

so anyone can have their own version of these registers in gpio.h of their arch. The only thing which can complicate this is banking of registers, no. of banks etc.

Please provide comments on this, so we can have a better code.

Thanks & Regards,
Ajay Bhargav

#2 lore raw

PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs

Hi Ajay,

Quoted 17 lines · Ajay Bhargav
Quoted 15 lines · ----- "Simon Guinot

AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear for GPIO output/direction registers. Instead, a register must be read first to leave other bits unchanged (see __set_direction in kw_gpio.c).

Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada struct gpio_reg array) ?

If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybe armada_gpio is a better name...

Regards,

Quoted 7 lines
Quoted 1 line

Simon

Hi Simon,

Yes its possible to implement code that way, Armada SoC does have GPIO registers for set/clear. what about register naming?? I think they are different for Kirkwood and Orion.

I think that the register names could be OK. But here is a most important problem: On Orion/Kirkwood SoCs, a single GPIO output register is available (no set/clear variants as for Armada). I missed that point at my first look. It is quite problematic because only two registers are shared between the different Marvell SoCs: level and direction. In fact, this registers are probably relevant on every machines providing GPIOs...

Maybe that having two common registers is not enough to add Orion/Kirkwood support to the mvgpio driver ?

Quoted 9 lines

One more thing which can be done to make this code generic is to have some macros which can be defined by individual arch for specific registers which are going to be in use e.g.

#define GPIO_PIN_LEVEL_REG
#define GPIO_DIR_REG
#define GPIO_PIN_SET_REG
#define GPIO_PIN_CLR_REG

Yes, but how to handle both a single GPI0 output register and some GPIO {set,clear} output registers (in a nice way) ?

Regards,

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110804/4672a522/attachment.pgp

#3 lore raw

PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs

Hi Simon,

Quoted 42 lines · Simon Guinot

Hi Ajay,

Quoted 17 lines · Ajay Bhargav
Quoted 15 lines · ----- "Simon Guinot

AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear for GPIO output/direction registers. Instead, a register must be read first to leave other bits unchanged (see __set_direction in kw_gpio.c).

Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada struct gpio_reg array) ?

If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybe armada_gpio is a better name...

Regards,

Quoted 7 lines
Quoted 1 line

Simon

Hi Simon,

Yes its possible to implement code that way, Armada SoC does have GPIO registers for set/clear. what about register naming?? I think they are different for Kirkwood and Orion.

I think that the register names could be OK. But here is a most important problem: On Orion/Kirkwood SoCs, a single GPIO output register is available (no set/clear variants as for Armada). I missed that point at my first look. It is quite problematic because only two registers are shared between the different Marvell SoCs: level and direction. In fact, this registers are probably relevant on every machines providing GPIOs...

Maybe that having two common registers is not enough to add Orion/Kirkwood support to the mvgpio driver ?

Quoted 4 lines

One more thing which can be done to make this code generic is to have some macros which can be defined by individual arch for specific registers which are going to be in use e.g.

Quoted 7 lines
Quoted 4 lines

#define GPIO_PIN_LEVEL_REG
#define GPIO_DIR_REG
#define GPIO_PIN_SET_REG
#define GPIO_PIN_CLR_REG

Yes, but how to handle both a single GPI0 output register and some GPIO {set,clear} output registers (in a nice way) ?

Two distinct gipo drivers for the two marvell variants?

Or a single driver with a single API but implemented differently according to the presence / absence of a variant flag, e.g. CONFIG_MVGIPO_HAS_SET_AND_CLR_REGS?

Quoted 3 lines

Regards,

Simon

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs

Quoted 50 lines · Albert ARIBAUD

Hi Simon,

Quoted 35 lines · Simon Guinot

Hi Ajay,

Quoted 17 lines · Ajay Bhargav
Quoted 15 lines · ----- "Simon Guinot"<[email protected]> ?wrote:

AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear for GPIO output/direction registers. Instead, a register must be read first to leave other bits unchanged (see __set_direction in kw_gpio.c).

Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada struct gpio_reg array) ?

If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybe armada_gpio is a better name...

Regards,

Quoted 7 lines
Quoted 1 line

Simon

Hi Simon,

Yes its possible to implement code that way, Armada SoC does have GPIO registers for set/clear. what about register naming?? I think they are different for Kirkwood and Orion.

I think that the register names could be OK. But here is a most important problem: On Orion/Kirkwood SoCs, a single GPIO output register is available (no set/clear variants as for Armada). I missed that point at my first look. It is quite problematic because only two registers are shared between the different Marvell SoCs: level and direction. In fact, this registers are probably relevant on every machines providing GPIOs...

Quoted 2 lines

Maybe that having two common registers is not enough to add Orion/Kirkwood support to the mvgpio driver ?

?>

Quoted 9 lines
Quoted 8 lines

One more thing which can be done to make this code generic is to have some macros which can be defined by individual arch for specific registers which are going to be in use e.g.

#define GPIO_PIN_LEVEL_REG
#define GPIO_DIR_REG
#define GPIO_PIN_SET_REG
#define GPIO_PIN_CLR_REG

Quoted 4 lines
Quoted 2 lines

Yes, but how to handle both a single GPI0 output register and some GPIO {set,clear} output registers (in a nice way) ?

Two distinct gipo drivers for the two marvell variants?

If let I choose, I'd prefer two, since the register set is different.

Best regards,
Lei