[OpenWrt-Devel] [PATCH] ralink: Add support for GPIO as interrupt-controller
Daniel Santos
daniel.santos at pobox.com
Mon Nov 5 17:06:15 EST 2018
On 11/05/2018 03:46 PM, Rosen Penev wrote:
> On Mon, Nov 5, 2018 at 1:38 PM Daniel Santos <daniel.santos at pobox.com> wrote:
>> Hello,
>>
>> First my apologies for not CCing you John, I'm not sure which address to
>> use as I got a bounce from the blogic at openwrt.org address before.
>>
>> Rosen,
>>
>> I'm not too familiar with the mt7621 yet, I'm using an mt7620. All I
>> know is that it has two cores and some crypto engine instead of wifi.
>> Being that this is the drivers/gpio/gpio-ralink.c (a nice bland name)
>> I'm going assume we're just talking about two different drivers. The
>> compatible string for this one is "ralink,rt2880-gpio".
> Ah I see. I think what threw me off was the patch name being 0029 as
> 0028 is the mt7621 patch.
Oh yeah! I should probably just rename 0028 to 0029
>> On 11/04/2018 10:27 PM, Rosen Penev wrote:
>>> On Sun, Nov 4, 2018 at 6:49 PM Daniel Santos <daniel.santos at pobox.com> wrote:
>>>> The gpio-ralink driver has everything it needs to be used as an
>>>> interrupt controller except for device tree support. This simple patch
>>>> adds that support by configuring the irq domain to use two cells and
>>>> adding the appropriate documentation to the devicetree bindings.
>>> Note that there is a mainline driver that does this already:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpio/gpio-mt7621.c?h=v4.19.1
>>>
>>> I've backported it in my tree as well:
>>> https://github.com/neheb/source/commit/aa3a57cdcf91a4483cfd511f8a34fb9a595f4af2
>>>
>>> I have not submitted as I don't have hardware to test that uses GPIO
>>> beyond a simple push button.
>>>
>>> I think ramips maintainer currently wants to wait until 4.19 to make
>>> such changes.
>> Are you referring to the rampis Linux maintainer or OpenWRT?
> ramips is an OpenWrt specific platform.
Not really. In fact, the goal should be getting most of these patches
accepted upstream:
/home/daniel/proj/kernel/next
(daniel at love)$ ll arch/mips/ralink/
total 120
-rw-r--r-- 1 daniel daniel 1069 Oct 28 11:49 bootrom.c
-rw-r--r-- 1 daniel daniel 3859 Oct 28 11:49 cevt-rt3352.c
-rw-r--r-- 1 daniel daniel 1656 Oct 28 11:49 clk.c
-rw-r--r-- 1 daniel daniel 914 Oct 28 11:49 common.h
-rw-r--r-- 1 daniel daniel 2030 Oct 28 11:49 early_printk.c
-rw-r--r-- 1 daniel daniel 2146 Oct 28 11:49 ill_acc.c
-rw-r--r-- 1 daniel daniel 4893 Oct 28 11:49 irq.c
-rw-r--r-- 1 daniel daniel 580 Oct 28 11:49 irq-gic.c
-rw-r--r-- 1 daniel daniel 1590 Oct 28 11:49 Kconfig
-rw-r--r-- 1 daniel daniel 861 Oct 28 11:49 Makefile
-rw-r--r-- 1 daniel daniel 20178 Oct 28 11:49 mt7620.c
-rw-r--r-- 1 daniel daniel 6864 Oct 28 11:49 mt7621.c
-rw-r--r-- 1 daniel daniel 2557 Oct 28 11:49 of.c
-rw-r--r-- 1 daniel daniel 917 Oct 28 11:49 Platform
-rw-r--r-- 1 daniel daniel 1630 Oct 28 11:49 prom.c
-rw-r--r-- 1 daniel daniel 2269 Oct 28 11:49 reset.c
-rw-r--r-- 1 daniel daniel 3543 Oct 28 11:49 rt288x.c
-rw-r--r-- 1 daniel daniel 8796 Oct 28 11:49 rt305x.c
-rw-r--r-- 1 daniel daniel 4978 Oct 28 11:49 rt3883.c
-rw-r--r-- 1 daniel daniel 3607 Oct 28 11:49 timer.c
-rw-r--r-- 1 daniel daniel 539 Oct 28 11:49 timer-gic.c
Thanks,
Daniel
>> Thanks,
>> Daniel
>>
>>>> Signed-off-by: Daniel Santos <daniel.santos at pobox.com>
>>>> ---
>>>> ...-Add-support-for-GPIO-as-interrupt-contro.patch | 51 ++++++++++++++++++++++
>>>> 1 file changed, 51 insertions(+)
>>>> create mode 100644 target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch
>>>>
>>>> diff --git a/target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch b/target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch
>>>> new file mode 100644
>>>> index 0000000000..d93f39c746
>>>> --- /dev/null
>>>> +++ b/target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch
>>>> @@ -0,0 +1,51 @@
>>>> +From 57fa7f2f4ef6f78ce1d30509c0d111aa3791b524 Mon Sep 17 00:00:00 2001
>>>> +From: Daniel Santos <daniel.santos at pobox.com>
>>>> +Date: Sun, 4 Nov 2018 20:24:32 -0600
>>>> +Subject: gpio-ralink: Add support for GPIO as interrupt-controller
>>>> +
>>>> +Signed-off-by: Daniel Santos <daniel.santos at pobox.com>
>>>> +---
>>>> + Documentation/devicetree/bindings/gpio/gpio-ralink.txt | 6 ++++++
>>>> + drivers/gpio/gpio-ralink.c | 2 +-
>>>> + 2 files changed, 7 insertions(+), 1 deletion(-)
>>>> +
>>>> +diff --git a/Documentation/devicetree/bindings/gpio/gpio-ralink.txt b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
>>>> +index 5cd17f225fe3..2775449614d4 100644
>>>> +--- a/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
>>>> ++++ b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
>>>> +@@ -17,6 +17,9 @@ Required properties:
>>>> +
>>>> + Optional properties:
>>>> + - ralink,gpio-base : Specify the GPIO chips base number
>>>> ++- interrupt-controller : marks this as an interrupt controller
>>>> ++- #interrupt-cells : a standard two-cell interrupt flag, see
>>>> ++ interrupt-controller/interrupts.txt
>>>> +
>>>> + Example:
>>>> +
>>>> +@@ -28,6 +31,9 @@ Example:
>>>> +
>>>> + reg = <0x600 0x34>;
>>>> +
>>>> ++ interrupt-controller;
>>>> ++ #interrupt-cells = <2>;
>>>> ++
>>>> + interrupt-parent = <&intc>;
>>>> + interrupts = <6>;
>>>> +
>>>> +diff --git a/drivers/gpio/gpio-ralink.c b/drivers/gpio/gpio-ralink.c
>>>> +index 27910e384013..b6e30083d012 100644
>>>> +--- a/drivers/gpio/gpio-ralink.c
>>>> ++++ b/drivers/gpio/gpio-ralink.c
>>>> +@@ -220,7 +220,7 @@ static int gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
>>>> + }
>>>> +
>>>> + static const struct irq_domain_ops irq_domain_ops = {
>>>> +- .xlate = irq_domain_xlate_onecell,
>>>> ++ .xlate = irq_domain_xlate_twocell,
>>>> + .map = gpio_map,
>>>> + };
>>>> +
>>>> +--
>>>> +2.16.4
>>>> +
>>>> --
>>>> 2.16.4
>>>>
>>>>
>>>> _______________________________________________
>>>> openwrt-devel mailing list
>>>> openwrt-devel at lists.openwrt.org
>>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list