linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Brandt <Chris.Brandt@renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>
Subject: RE: [PATCH 0/2] ARM: dts: rskrza1: Add I2C and remaining LEDs
Date: Thu, 21 Mar 2019 12:16:42 +0000	[thread overview]
Message-ID: <TY1PR01MB156269186D28360C36DAED0B8A420@TY1PR01MB1562.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAMuHMdXG2wD9sbZY-1LY3d+AVA3BBjpjsn3zd3dJEi2r2BVEfg@mail.gmail.com>

Hi Geert,

Look what fun you are having with an RZ/A1 board!
You might have even more fun with a RZ/A2 board ;)

> However, that also doesn't work, as the PL390 GIC supports rising edge
> and high-level interrupts only.  Falling edge and low-level interrupts
> on the IRQ pins seem to be an RZ/A1-specific GIC extension,

Yes. I get this question a couple times a year.

And no one wants rising or level high, so the GPIO interrupts would not 
work for them anyway.

So, as you found:

> I've just discovered commit 207c10b54ca81129 ("irq-gic: add support for
> pins IRQ0-IRQ7") in rza_linux-4.14, but when using that, the system
> locks up when pressing a switch :-(

It might be because the interrupt routine needs to go in and clear the 
interrupt by writing to the 'IRQ Interrupt Request Register' (IRQRR).
From the HW manual:

"IRQRR is a 16-bit register that indicates interrupt requests from 
external input pins IRQ7 to IRQ0. If edge detection is set for the IRQ7 to 
IRQ0 interrupts, writing 0 to the IRQ7F to IRQ0F bits after reading IRQ7F 
to IRQ0F = 1 cancels the retained interrupts."


The touchscreen driver for the LCD uses IRQ_TYPE_LEVEL_LOW. 
In the interrupt routine ft5x06_ts_isr, disable_irq_nosync(irq) is called immediately.
Then after the touch point is read out, enable_irq(ts->client->irq) is called in ft5x06_ts_poscheck.
https://github.com/renesas-rz/rza_linux-4.19/blob/master/drivers/input/touchscreen/ft5x06_ts.c#L232


> What am I doing wrong?
> Do you have a better solution?
> The IRQx support looks most promising, but needs some work (separate
> compatible value, small driver with a custom .irq_set_type, deferring
> the rest to the normal GIC driver).

I not sure about a 'better' solution...just the one I tell people 
(although I need to make some App Note someday).

Basically, I tell people they need to describe the IRQ in the Device 
Tree somewhere (so it can get allocated an interrupt ID).
Then, they can call request_irq() from inside a custom driver if they 
want to.
Or, they just make a very simple shim-driver in their board-xxx.c file 
that registers the interrupt and has a simple interrupt routine. Many 
times all people want to do is simply wire up an interrupt that the 
application can wait on. Or, use an IRQ pin to start an ADC conversion. Pretty 
simple stuff.

Of course they can also use a UIO driver to do these kinds of things as 
well.
As you know, the UIO subsystem will automatically turn of the interrupt 
each time, but users still need to write to the IRQRR register before 
turning the interrupt back on if using edge interrupts.

I always thought what I really need to do is instead just make a 
separate driver like you suggested above because technical, the "IRQ" block is 
not really part of the GIC, it is a separate block that feeds interrupts
into the GIC just like all the other peripherals, so it should be 
represented as a separate piece of hardware (ie, its own driver and 
capability string).


For what it's worth, the RZ/A2 has the exact same IRQs, so if I ever got
around for doing it for RZ/A1, it could also be used for RZ/A2.

Chris

  reply	other threads:[~2019-03-21 12:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 19:44 [PATCH 0/2] ARM: dts: rskrza1: Add I2C and remaining LEDs Geert Uytterhoeven
2019-03-20 19:44 ` [PATCH 1/2] ARM: dts: rskrza1: Add I2C support Geert Uytterhoeven
2019-03-22 10:23   ` Simon Horman
2019-03-25 10:55     ` Geert Uytterhoeven
2019-03-27 12:08       ` Simon Horman
2019-03-20 19:44 ` [PATCH 2/2] ARM: dts: rskrza1: Add remaining LEDs Geert Uytterhoeven
2019-03-27 12:09   ` Simon Horman
2019-03-20 20:41 ` [PATCH 0/2] ARM: dts: rskrza1: Add I2C and " Chris Brandt
2019-03-21 10:02   ` Geert Uytterhoeven
2019-03-21 12:16     ` Chris Brandt [this message]
2019-03-21 12:28       ` Geert Uytterhoeven
2019-03-22  8:23     ` Geert Uytterhoeven
2019-03-22 11:04       ` Chris Brandt

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=TY1PR01MB156269186D28360C36DAED0B8A420@TY1PR01MB1562.jpnprd01.prod.outlook.com \
    --to=chris.brandt@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=magnus.damm@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).