mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jamie Iles <jamie@jamieiles.com>
To: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Grant Likely <grant.likely@secretlab.ca>,
	Jamie Iles <jamie@jamieiles.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Russell King <linux@arm.linux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>, Nicolas Pitre <nico@fluxnic.net>
Subject: Re: [PATCH] gpio: support for Synopsys DesignWare APB GPIO
Date: Sun, 3 Apr 2011 15:07:50 +0100	[thread overview]
Message-ID: <20110403140750.GB5670@pulham.picochip.com> (raw)
In-Reply-To: <20110403120344.GA1540@oksana.dev.rtsoft.ru>

Hi Anton,

On Sun, Apr 03, 2011 at 04:03:44PM +0400, Anton Vorontsov wrote:
> > > I'm not
> > > hugely thrilled with the current method that the driver uses to define
> > > the register locations (using named resources).  My instinct would be
> > > to use a single register resource region with offsets for each
> > > register type defined from the base of it, but Anton can probably fill
> > > us in on the reason that approach was used.
> 
> Well, I did it that way because you don't have to pass the offsets via
> platform data (you don't need platform data most of the time, i.e. if
> you use dynamic bases).

Well I'm happy to give it a go for some more complex chips with multiple 
banks but I'm not sure how to accomplish this without platform data.  My 
first idea would be to have something like:

struct mmio_gpio_bank {
	unsigned int		ngpio;
	unsigned long		set_offs;
	unsigned long		clr_offs;
	unsigned long		dout_offs;
	unsigned long		din_offs;
	unsigned long		dir_offs;
};

struct mmio_gpio_pdata {
	size_t			bus_width_bits;
	int			gpio_base;
	unsigned int		nr_banks;
	struct mmio_gpio_bank	banks[];
};

and have one iomem resource for the whole controller.  This allows us to 
cope with the controllers where each bank has a different number of GPIO 
pins but I'm not sure how device tree friendly it is.  If there's a 
better way then please let me know and I'll give it a go, though
at first it does need to be able to work without device tree support.

Looking at some of the different IRQ demuxing schemes they seem to vary 
quite a bit so I'm not sure how to handle that in a relatively generic 
way but perhaps that can come later.

Jamie

  reply	other threads:[~2011-04-03 14:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01 13:47 Jamie Iles
2011-04-01 15:17 ` Randy Dunlap
2011-04-02 22:10 ` Thomas Gleixner
2011-04-03  2:59   ` Jamie Iles
2011-04-03  4:45     ` Grant Likely
2011-04-03  9:30       ` Thomas Gleixner
2011-04-03 12:03         ` Anton Vorontsov
2011-04-03 14:07           ` Jamie Iles [this message]
2011-04-03 14:47             ` Grant Likely
2011-04-03 15:22               ` Jamie Iles
2011-04-04 10:40                 ` Anton Vorontsov
2011-04-05  2:48                 ` Grant Likely
2011-04-05  8:18                   ` Jamie Iles
2011-04-05 11:47                     ` Anton Vorontsov

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=20110403140750.GB5670@pulham.picochip.com \
    --to=jamie@jamieiles.com \
    --cc=arnd@arndb.de \
    --cc=cbouatmailru@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nico@fluxnic.net \
    --cc=tglx@linutronix.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

all inboxes | Powered by JetHome®