From: Andreas Larsson <andreas@gaisler.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>,
Rob Herring <rob.herring@calxeda.com>,
linux-kernel@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, software@gaisler.com
Subject: Re: [PATCH] gpio: Add device driver for GRGPIO cores
Date: Mon, 04 Feb 2013 09:10:32 +0100 [thread overview]
Message-ID: <510F6CF8.3000700@gaisler.com> (raw)
In-Reply-To: <CACRpkdbAS05dVOrE2E5Uu6qfzfgcoz_KqQmqZxz5Pne9BbCt-g@mail.gmail.com>
On 2013-02-02 16:16, Linus Walleij wrote:
>> +#if defined(__BIG_ENDIAN)
>> +static inline u32 grgpio_read_reg(u32 __iomem *reg)
>> +{
>> + return ioread32be(reg);
>> +}
>> +
>> +static inline void grgpio_write_reg(u32 __iomem *reg, u32 val)
>> +{
>> + iowrite32be(val, reg);
>> +}
>> +#else
>> [...]
>
> Where is this __BIG_ENDIAN flag coming from?
>
> And do you really have and test this regularly on both LE and BE hardware?
> I am worrying a bit about maintenance...
I am more than happy to drop that. I will most probably never test this
on LE hardware.
>> +static void grgpio_set_sbit(struct grgpio_priv *priv, u32 __iomem *reg,
>> + unsigned offset, int val, u32 *shadow)
>> +{
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&priv->lock, flags);
>> +
>> + if (val)
>> + *shadow |= (1 << offset);
>> + else
>> + *shadow &= ~(1 << offset);
>> + grgpio_write_reg(reg, *shadow);
>> +
>> + spin_unlock_irqrestore(&priv->lock, flags);
>> +}
>
> This is all very basic stuff. Please make a best effort to reuse or
> augment and reuse this:
> drivers/gpio/gpio-generic.c
>
> IIRC this one also handles endianness issues, but I could be wrong.
Sure, many of the initial functions do small basic tasks and resembles
functions in gpio-generic. But that does not make the hardware itself a
good candidate to use gpio-generic IMHO:
1) This core is generally running on SPARC, that is BE, but even on
SPARC, readl and writel (that would be used in gprio-generic) deals with
LE accesses and my registers are BE.
2) The grgpio_to_irq function is very hardware specific, and there is of
course no gpio_to_irq support in gpio-generic.
3) Running on SPARC, I get Open Firmware information from prom, so there
is no platform data to access in the probe function. Of course general
Open Firmware support could be added to gpio-generic, but in addition my
probe needs to set up very hardware specific things for gpio_to_irq.
Thank you for the feedback!
Cheers,
Andreas Larsson
next prev parent reply other threads:[~2013-02-04 8:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 12:28 [PATCH] gpio: Add device driver for GRGPIO cores Andreas Larsson
[not found] ` <1359548921-14925-1-git-send-email-andreas-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
2013-02-02 15:16 ` Linus Walleij
2013-02-02 15:16 ` Linus Walleij
2013-02-04 8:10 ` Andreas Larsson [this message]
[not found] ` <510F6CF8.3000700-FkzTOoA/JUlBDgjK7y7TUQ@public.gmane.org>
2013-02-04 9:24 ` Linus Walleij
2013-02-04 9:24 ` Linus Walleij
2013-02-04 10:27 ` Andreas Larsson
2013-02-09 22:36 ` Anton Vorontsov
2013-02-09 14:52 ` Grant Likely
2013-02-09 14:52 ` Grant Likely
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=510F6CF8.3000700@gaisler.com \
--to=andreas@gaisler.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=software@gaisler.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.