gpio: Add GPIO driver framework for Marvell SoCs
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs
Quoted 65 lines · ----- "Lei Wen
Quoted 9 lines · Albert ARIBAUD
Hi Simon,
Quoted 6 lines · Simon Guinot
Hi Ajay,
Quoted 3 lines · Ajay Bhargav
Quoted 1 line · ----- "Simon Guinot"<[email protected]> ?wrote:
AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear
for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
GPIO output/direction registers. Instead, a register must be
read
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
first to leave other bits unchanged (see
__set_directioninkw_gpio.c).Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada structgpio_regarray) ?If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybearmada_gpiois a better name...Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Regards,
Simon
Hi Simon,
Yes its possible to implement code that way, Armada SoC does have
GPIO
Quoted 1 line
Quoted 1 line
Quoted 1 line
registers for set/clear. what about register naming?? I think they
are
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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
Quoted 1 line
Quoted 1 line
is available (no set/clear variants as for Armada). I missed that
point
Quoted 1 line
Quoted 1 line
at my first look. It is quite problematic because only two
registers are
Quoted 1 line
Quoted 1 line
shared between the different Marvell SoCs: level and direction. In
fact,
Quoted 1 line
Quoted 1 line
this registers are probably relevant on every machines providing
GPIOs...
Quoted 5 lines
Quoted 3 lines
Maybe that having two common registers is not enough to add Orion/Kirkwood support to the mvgpio driver ?
?>
Quoted 1 line
Quoted 1 line
One more thing which can be done to make this code generic is to
have
Quoted 1 line
Quoted 1 line
Quoted 1 line
some macros which can be defined by individual arch for specific
registers
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
which are going to be in use e.g.
#define
GPIO_PIN_LEVEL_REG
#defineGPIO_DIR_REG
#defineGPIO_PIN_SET_REG
#defineGPIO_PIN_CLR_REGYes, but how to handle both a single GPI0 output register and some
GPIO
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
{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
Hi Simon,
For Armada minimum 3 registers are required and available for armada
1. Direction (read/write)
2. Pin level set (write only)
3. Pin level clear (write only)
@lei
How bout if we check for architecture and use specific code or defines? i.e.
#ifdef CONFIG_KIRKWOOD
//KW code
#elif CONFIG_ARMADA100
//Armada code
#else
//orion or other?
#endif
Regards,
Ajay Bhargav
PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs
Quoted 95 lines
-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Ajay Bhargav
Sent: Thursday, August 04, 2011 4:21 PM
To: Lei Wen
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v2 1/2] gpio: Add GPIO driver framework for Marvell SoCsQuoted 65 lines · ----- "Lei Wen
Quoted 9 lines · Albert ARIBAUD
Hi Simon,
Quoted 6 lines · Simon Guinot
Hi Ajay,
Quoted 3 lines · Ajay Bhargav
Quoted 1 line · ----- "Simon Guinot"<[email protected]> ?wrote:
AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear
for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
GPIO output/direction registers. Instead, a register must be
read
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
first to leave other bits unchanged (see
__set_directioninkw_gpio.c).Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada structgpio_regarray) ?If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybearmada_gpiois a better name...Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Regards,
Simon
Hi Simon,
Yes its possible to implement code that way, Armada SoC does have
GPIO
Quoted 1 line
Quoted 1 line
Quoted 1 line
registers for set/clear. what about register naming?? I think they
are
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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
Quoted 1 line
Quoted 1 line
is available (no set/clear variants as for Armada). I missed that
point
Quoted 1 line
Quoted 1 line
at my first look. It is quite problematic because only two
registers are
Quoted 1 line
Quoted 1 line
shared between the different Marvell SoCs: level and direction. In
fact,
Quoted 1 line
Quoted 1 line
this registers are probably relevant on every machines providing
GPIOs...
Quoted 5 lines
Quoted 3 lines
Maybe that having two common registers is not enough to add Orion/Kirkwood support to the mvgpio driver ?
?>
Quoted 1 line
Quoted 1 line
One more thing which can be done to make this code generic is to
have
Quoted 1 line
Quoted 1 line
Quoted 1 line
some macros which can be defined by individual arch for specific
registers
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
which are going to be in use e.g.
#define
GPIO_PIN_LEVEL_REG
#defineGPIO_DIR_REG
#defineGPIO_PIN_SET_REG
#defineGPIO_PIN_CLR_REGYes, but how to handle both a single GPI0 output register and some
GPIO
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
{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,
LeiHi Simon,
For Armada minimum 3 registers are required and available for armada
1. Direction (read/write)
2. Pin level set (write only)
3. Pin level clear (write only)
Quoted 10 lines
@lei
How bout if we check for architecture and use specific code or defines? i.e.
#ifdefCONFIG_KIRKWOOD
//KW code
#elifCONFIG_ARMADA100
//Armada code
#else
//orion or other?
#endif
Let's avoid this, because there will be several SoC architectures that uses similar GPIO register definitions, like kirkwood/orion have similar definition and armada/mmp/pantheon/etc.. have different one.
So we will end up having several #ifdefs. Ideally #ifdefs are discouraged for better coding practices.
Instead,
I would suggest to use macros for this code segments or alternatively inlined functions and those should be defined in mvgpio.h, #ifdefed with CPU core subversion (i.e. CONFIG_FEROCEION, CONFIG_SHEEVA_88SV331xV5)
Regards..
Prafulla . .
PATCH v2 1/2 gpio: Add GPIO driver framework for Marvell SoCs
In reply to Ajay BhargavHi Ajay,
Quoted 84 lines · Ajay Bhargav
Quoted 65 lines · ----- "Lei Wen
Quoted 9 lines · Albert ARIBAUD
Hi Simon,
Quoted 6 lines · Simon Guinot
Hi Ajay,
Quoted 3 lines · Ajay Bhargav
Quoted 1 line · ----- "Simon Guinot"<[email protected]> ?wrote:
AFAIK, Orion and Kirkwood SoCs don't provide bitwise set/clear
for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
GPIO output/direction registers. Instead, a register must be
read
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
first to leave other bits unchanged (see
__set_directioninkw_gpio.c).Is it possible to handle Armada SoCs GPIOs in a same way ? maybe using
the pin registers (gpxx in the Armada structgpio_regarray) ?If not, this code is not Marvell generic but rather specific for Armada
SoCs and then maybearmada_gpiois a better name...Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Regards,
Simon
Hi Simon,
Yes its possible to implement code that way, Armada SoC does have
GPIO
Quoted 1 line
Quoted 1 line
Quoted 1 line
registers for set/clear. what about register naming?? I think they
are
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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
Quoted 1 line
Quoted 1 line
is available (no set/clear variants as for Armada). I missed that
point
Quoted 1 line
Quoted 1 line
at my first look. It is quite problematic because only two
registers are
Quoted 1 line
Quoted 1 line
shared between the different Marvell SoCs: level and direction. In
fact,
Quoted 1 line
Quoted 1 line
this registers are probably relevant on every machines providing
GPIOs...
Quoted 5 lines
Quoted 3 lines
Maybe that having two common registers is not enough to add Orion/Kirkwood support to the mvgpio driver ?
?>
Quoted 1 line
Quoted 1 line
One more thing which can be done to make this code generic is to
have
Quoted 1 line
Quoted 1 line
Quoted 1 line
some macros which can be defined by individual arch for specific
registers
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
which are going to be in use e.g.
#define
GPIO_PIN_LEVEL_REG
#defineGPIO_DIR_REG
#defineGPIO_PIN_SET_REG
#defineGPIO_PIN_CLR_REGYes, but how to handle both a single GPI0 output register and some
GPIO
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
{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,
LeiHi Simon,
For Armada minimum 3 registers are required and available for armada
1. Direction (read/write)
2. Pin level set (write only)
3. Pin level clear (write only)
Quoted 11 lines
@lei
How bout if we check for architecture and use specific code or defines? i.e.
#ifdefCONFIG_KIRKWOOD
//KW code
#elifCONFIG_ARMADA100
//Armada code
#else
//orion or other?
#endif
I agree with Prafulla, if this not unalignment could be fixed in the .h file which
is located in the arch directory, or ifdef there?, then I think I would totally fine with that. Or maybe
seperate with two c file is a better solution.
Best regards,
Lei