From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: "linus.walleij@linaro.org" <linus.walleij@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Vineet.Gupta1@synopsys.com" <Vineet.Gupta1@synopsys.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"gnurou@gmail.com" <gnurou@gmail.com>
Subject: Re: [PATCH] gpio-dwapb: reset mask register on probe
Date: Thu, 19 Mar 2015 08:44:01 +0000 [thread overview]
Message-ID: <1426754640.2742.19.camel@synopsys.com> (raw)
In-Reply-To: <CACRpkdYMtAzWyshP0_x-qucz2j=1JE_=DE3Y7TARWGxDQxnurA@mail.gmail.com>
Hi Linus,
On Tue, 2015-03-17 at 17:54 +0100, Linus Walleij wrote:
> >> + /* Mask out and disable all interrupts */
> >> + dwapb_write(gpio, GPIO_INTMASK, 0xffffffff);
> >> + dwapb_write(gpio, GPIO_INTEN, 0);
> >
> > This looks good to me - it's always a good idea to make sure defaults
> > are set as we expect.
>
> So should I cook a patch doing just these two lines?
>
> But the initial patch unmasking all IRQs then? Is that even needed?
Oops, my bad here :)
I intentionally wrote 0 to MASK register to return it to default state
(if pre-bootloader messes it). As I explained if we really mask all
interrupts (together with disabling them all via INTEN) then interrupts
will never happen.
If we look at DW APB GPIO databook it says:
--->8---
Whenever a 1 is written to a bit of this register [GPIO_INTEN], it
configures the corresponding bit on Port A to become an interrupt;
otherwise, Port A operates as a normal GPIO signal.
--->8---
While for GPIO_INTMASK it says:
--->8---
Controls whether an interrupt on Port A can create an interrupt for the
interrupt controller by not masking it. By default, all interrupts bits
are unmasked.
--->8---
So IMHO we need to update "gpio-dwapb" driver in the following manner:
[1] In dwapb_configure_irqs() in accordance to "snps,nr-gpios" in the
first bank set a value in GPIO_INTEN. This way we turn N pins in that
port/bank in "interrupt" mode from their default gpio mode.
[2] Don't expose dwapb_irq_enable()/dwapb_irq_disable() through
ct->chip.irq_enable/ct->chip.irq_disable. Because we don't want to
toggle modes of pins, right?
[3] Use ct->chip.irq_mask/ct->chip.irq_unmask for purpose of real
enabling/disabling interrupts.
If I'm not missing something that would be implementation that matches
real device specification.
If we do these changes then indeed we'll want to make sure GPIO_INTMASK
is initialized with all interrupts masked out:
--->8---
dwapb_write(gpio, GPIO_INTMASK, 0xffffffff);
--->8---
Let me know if my proposal makes sense and then I'll send patch that
implements it.
-Alexey
next prev parent reply other threads:[~2015-03-19 8:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 8:47 [PATCH] gpio-dwapb: reset mask register on probe Alexey Brodkin
2015-03-09 13:59 ` Linus Walleij
2015-03-09 20:56 ` Alexey Brodkin
2015-03-17 16:54 ` Linus Walleij
2015-03-19 8:44 ` Alexey Brodkin [this message]
2015-03-26 9:29 ` Linus Walleij
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=1426754640.2742.19.camel@synopsys.com \
--to=alexey.brodkin@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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.