From: Ajay Bhargav <ajay.bhargav@einfochips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] gpio: Add GPIO driver framework for Marvell SoCs
Date: Sat, 6 Aug 2011 10:40:05 +0530 (IST) [thread overview]
Message-ID: <891393239.55349.1312607405883.JavaMail.root@ahm.einfochips.com> (raw)
In-Reply-To: <2088605993.55298.1312607122087.JavaMail.root@ahm.einfochips.com>
----- "Prafulla Wadaskar" <prafulla@marvell.com> wrote:
> > -----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 SoCs
> >
> > ----- "Lei Wen" <adrian.wenl@gmail.com> wrote:
> >
> > > On Thu, Aug 4, 2011 at 4:51 PM, Albert ARIBAUD
> > > <albert.u.boot@aribaud.net> wrote:
> > > > Hi Simon,
> > > >
> > > > On 04/08/2011 02:04, Simon Guinot wrote:
> > > >> Hi Ajay,
> > > >>
> > > >> On Wed, Aug 03, 2011 at 10:10:00AM +0530, Ajay Bhargav wrote:
> > > >>> ----- "Simon Guinot"<simon@sequanux.org> ?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,
> > > >>>>
> > > >>>> 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 ?
> > > > ?>
> > > >>> 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) ?
> > > >
> > > > 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
>
> 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 . .
Hi Prafulla,
I think it will be better to keep two driver files. Let this patch be for
Armada/mmp/pantheon and other compatible SoCs. Should the common GPIO
struct for armada/mmp etc.. be moved out of GPIO.h to mvgpio.h?
Regards,
Ajay Bhargav
next parent reply other threads:[~2011-08-06 5:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2088605993.55298.1312607122087.JavaMail.root@ahm.einfochips.com>
2011-08-06 5:10 ` Ajay Bhargav [this message]
2011-08-07 2:16 ` [U-Boot] [PATCH v2 1/2] gpio: Add GPIO driver framework for Marvell SoCs Prafulla Wadaskar
[not found] <1874826476.47235.1312454749903.JavaMail.root@ahm.einfochips.com>
2011-08-04 10:51 ` Ajay Bhargav
2011-08-04 11:25 ` Prafulla Wadaskar
2011-08-04 12:51 ` Lei Wen
[not found] <1990439524.39318.1312346163802.JavaMail.root@ahm.einfochips.com>
2011-08-03 4:40 ` Ajay Bhargav
2011-08-04 0:04 ` Simon Guinot
2011-08-04 8:51 ` Albert ARIBAUD
2011-08-04 9:18 ` Lei Wen
2011-07-22 7:16 Ajay Bhargav
2011-08-02 14:10 ` Simon Guinot
2011-08-03 10:18 ` Prafulla Wadaskar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=891393239.55349.1312607405883.JavaMail.root@ahm.einfochips.com \
--to=ajay.bhargav@einfochips.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox