From: Phil Sutter <n0-1@freewrt.org>
To: David Brownell <david-b@pacbell.net>
Cc: Ralf Baechle <ralf@linux-mips.org>,
linux-mips@linux-mips.org, linux-ide@vger.kernel.org,
Jeff Garzik <jeff@garzik.org>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: Re: MIPS: RB532: Provide functions for gpio configuration
Date: Fri, 28 Nov 2008 20:35:57 +0100 [thread overview]
Message-ID: <20081128193322.D103C386DBBE@mail.ifyouseekate.net> (raw)
In-Reply-To: <200811202002.16178.david-b@pacbell.net>
Hi!
I fullquote here because of the lists and people added to Cc.
On Thu, Nov 20, 2008 at 08:02:15PM -0800, David Brownell wrote:
> I just noticed:
>
> > commit 2e373952cc893207a8b47a5e68c2f5155f912449
> > Author: Phil Sutter <n0-1@freewrt.org>
> > Date: Sat Nov 1 15:13:21 2008 +0100
> >
> > MIPS: RB532: Provide functions for gpio configuration
> >
> > As gpiolib doesn't support pin multiplexing, it provides no way to
> > access the GPIOFUNC register. Also there is no support for setting
> > interrupt status and level. These functions provide access to them and
> > are needed by the CompactFlash driver.
> >
> > Signed-off-by: Phil Sutter <n0-1@freewrt.org>
> > Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>
> The conventional way to do most of that is through the irq_chip
> associated with that block of IRQ-capable GPIOs.
>
>
> So ...
>
> > - /* Set the interrupt status and level for the CF pin */
> > - rb532_gpio_set_int_level(&rb532_gpio_chip->chip, CF_GPIO_NUM, 1);
> > - rb532_gpio_set_int_status(&rb532_gpio_chip->chip, CF_GPIO_NUM, 0);
> > + /* configure CF_GPIO_NUM as CFRDY IRQ source */
> > + rb532_gpio_set_func(0, CF_GPIO_NUM);
>
> ... the pinmux would indeed be a SOC-specific mechanism, kicked in
> only for boards that use that GPIO in that way, but ...
>
>
> > + rb532_gpio_direction_input(&rb532_gpio_chip->chip, CF_GPIO_NUM);
>
> ... normal gpio_request() + gpio_direction_input() would set the pin up, and ...
>
>
> > + rb532_gpio_set_ilevel(1, CF_GPIO_NUM);
> > + rb532_gpio_set_istat(0, CF_GPIO_NUM);
>
> status = request_irq(gpio_to_irq(CF_GPIO_NUM), ... )
>
> with appropriate IRQF_TRIGGER_* flags should solve that problem.
> Or even just set_irq_type(). (At least for one of the two
> registers updated there ... I can't guess what "istat" would be.)
>
> Just FYI at this point. Maybe you have a reason not to fit into
> the genirq framework.
>
> - Dave
Thanks for your hints, Dave. I already had a patch flying around adding
a set_type() function to the irq_chip (merely a dummy to shut up
warnings in the boot log). After extending it to cover the needs of the
mapped GPIO pins and some other work, I could drop that CompactFlash
initialisation code in gpio.c completely.
As a side effect, many of my changes to pata-rb532-cf got unnecessary
which I consider a very good sign.
I'll reply to this mail with the relevant patches for each list and
maintainer.
Greetings, Phil
next parent reply other threads:[~2008-11-28 19:33 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200811202002.16178.david-b@pacbell.net>
2008-11-28 19:35 ` Phil Sutter [this message]
2008-11-28 19:45 ` [PATCH] MIPS: rb532: add set_type() function to IRQ struct Phil Sutter
2009-01-29 16:39 ` Ralf Baechle
2008-11-28 19:46 ` [PATCH] MIPS: rb532: auto disable GPIO alternate function Phil Sutter
2009-01-29 16:41 ` Ralf Baechle
2008-11-28 19:46 ` [PATCH] MIPS: rb532: remove useless CF GPIO initialisation Phil Sutter
2009-01-29 16:47 ` Ralf Baechle
2008-11-28 19:46 ` [PATCH] MIPS: rb532: remove unused rb532_gpio_set_func() Phil Sutter
2009-01-22 0:41 ` Phil Sutter
2008-11-28 19:48 ` [PATCH] pata-rb532-cf: fix and rename register definitions Phil Sutter
2008-12-01 19:24 ` Jeff Garzik
2008-11-28 19:48 ` [PATCH] pata-rb532-cf: fix signature of the xfer function Phil Sutter
2008-12-01 19:24 ` Jeff Garzik
2008-11-28 19:48 ` [PATCH] pata-rb532-cf: read/write data in 4-byte blocks Phil Sutter
2009-01-20 16:40 ` review of pata-rb532-cf Phil Sutter
2009-01-24 14:12 ` Bartlomiej Zolnierkiewicz
[not found] ` <1232469660-22335-1-git-send-email-n0-1@freewrt.org>
2009-01-20 16:40 ` [PATCH 1/5] pata-rb532-cf: remove set_irq_type from finish_io Phil Sutter
2009-01-27 7:13 ` Jeff Garzik
[not found] ` <1232469660-22335-2-git-send-email-n0-1@freewrt.org>
2009-01-20 16:40 ` [PATCH 2/5] pata-rb532-cf: replace rb532_pata_finish_io() Phil Sutter
2009-01-27 7:14 ` Jeff Garzik
2009-01-27 13:36 ` Phil Sutter
2009-01-27 13:35 ` Phil Sutter
2009-02-03 4:19 ` Jeff Garzik
[not found] ` <1233063353-12770-1-git-send-email-n0-1@freewrt.org>
2009-01-27 13:35 ` [PATCH 3/5] pata-rb532-cf: use ata_sff_exec_command() Phil Sutter
[not found] ` <1233063353-12770-2-git-send-email-n0-1@freewrt.org>
2009-01-27 13:35 ` [PATCH 4/5] pata-rb532-cf: use ata_sff_data_xfer32() Phil Sutter
[not found] ` <1233063353-12770-3-git-send-email-n0-1@freewrt.org>
2009-01-27 13:35 ` [PATCH 5/5] pata-rb532-cf: drop custom freeze and thaw Phil Sutter
[not found] ` <1232469660-22335-3-git-send-email-n0-1@freewrt.org>
2009-01-20 16:40 ` [PATCH 3/5] pata-rb532-cf: use ata_sff_exec_command() Phil Sutter
[not found] ` <1232469660-22335-4-git-send-email-n0-1@freewrt.org>
2009-01-20 16:40 ` [PATCH 4/5] pata-rb532-cf: use ata_sff_data_xfer32() Phil Sutter
[not found] ` <1232469660-22335-5-git-send-email-n0-1@freewrt.org>
2009-01-20 16:41 ` [PATCH 5/5] pata-rb532-cf: drop custom freeze and thaw Phil Sutter
2009-01-22 18:28 ` [PATCH] rb532: update headers Phil Sutter
2009-01-29 18:04 ` Ralf Baechle
2009-01-22 18:32 ` [PATCH] MIPS: rb532: export rb532_gpio_set_func() Phil Sutter
2009-01-29 18:05 ` Ralf Baechle
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=20081128193322.D103C386DBBE@mail.ifyouseekate.net \
--to=n0-1@freewrt.org \
--cc=bzolnier@gmail.com \
--cc=david-b@pacbell.net \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/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.