diff mbox

ARM: dts: add pinctrl nodes for Exynos5250 SoC

Message ID CAJuYYwTwbYhRO7z8J79g-GM-44Y6A6trkF_z72Kqp+MoBF==+w@mail.gmail.com
State New
Headers show

Commit Message

thomas.abraham@linaro.org April 25, 2013, 7:38 a.m. UTC
On 25 April 2013 05:03, Olof Johansson <olof@lixom.net> wrote:
> On Thu, Dec 13, 2012 at 06:36:18PM +0530, Thomas Abraham wrote:
>> Add pinctrl device nodes for Exynos5250 SoC.
>>
>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>
> Replying to an old email of a patch that has been merged because it seems
> horribly broken.
>
>
>> diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
>> index 581e57a..eb8d610 100644
>> --- a/arch/arm/boot/dts/exynos5250.dtsi
>> +++ b/arch/arm/boot/dts/exynos5250.dtsi
>> @@ -18,6 +18,7 @@
>>  */
>>
>>  /include/ "skeleton.dtsi"
>> +/include/ "exynos5250-pinctrl.dtsi"
>>
>>  / {
>>       compatible = "samsung,exynos5250";
>> @@ -48,6 +49,8 @@
>>               mshc1 = &dwmmc_1;
>>               mshc2 = &dwmmc_2;
>>               mshc3 = &dwmmc_3;
>> +             pinctrl0 = &pinctrl_0;
>> +             pinctrl3 = &pinctrl_3;
>>       };
>>
>>       gic:interrupt-controller@10481000 {
>> @@ -79,6 +82,24 @@
>>               interrupts = <0 42 0>;
>>       };
>>
>> +     pinctrl_0: pinctrl@11400000 {
>> +             compatible = "samsung,pinctrl-exynos5250";
>> +             reg = <0x11400000 0x1000>;
>> +             interrupts = <0 46 0>;
>> +
>> +             wakup_eint: wakeup-interrupt-controller {
>> +                     compatible = "samsung,exynos4210-wakeup-eint";
>> +                     interrupt-parent = <&gic>;
>> +                     interrupts = <0 32 0>;
>> +             };
>
> Typo, should be "wakeup_eint". And what happened to #interrupt-cells? And the
> interrupt map?

Hi Olof,

With the pinctrl driver, there is change in the way the wakeup
interrupts are handled. Each of the four wakeup banks (GPX0 to GPX3)
are now individual interrupt controllers (introduced by Tomasz Figa).
The wakeup interrupts generated by GPX2 and GPX3 are muxed into the <0
32 0> interrupt of GIC.

So the interrupts-cells and interrupt map are not required in the
above node. The label "wakup_eint" can actually to dropped and
probably the node name "wakeup-interrupt-controller" should be renamed
to avoid interpreting it as a interrupt controller node.

>
> Do you have an example of a tested user or a testcase for this? I'm
> trying to get interrupts going on these pins, and it's not looking like
> it's even close to working.

The following is a rudimentary patch with which I have tested wakeup
interrupts GPX0[0] and GPX3[7] on smdk5250 board. The gpio number in
the dts file can be changed to test wakeup interrupt on pins other
than EINT31 (GPX3[7]).

Thanks,
Thomas.

simple patch to test wakeup interrupts on smdk5250 board.
Note: some of the smdk5250 boards may have a faulty SW8 button
(for EINT31) and so EINT31 might not work on those smdk5250
boards.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 arch/arm/boot/dts/exynos5250-smdk5250.dts |    5 ++
 arch/arm/mach-exynos/Makefile             |    2 +-
 arch/arm/mach-exynos/button-smdk5250.c    |   72 +++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-exynos/button-smdk5250.c


>
>
> -Olof

Comments

Olof Johansson April 26, 2013, 6:15 p.m. UTC | #1
Hi,

On Thu, Apr 25, 2013 at 12:38 AM, Thomas Abraham
<thomas.abraham@linaro.org> wrote:
> On 25 April 2013 05:03, Olof Johansson <olof@lixom.net> wrote:
>> On Thu, Dec 13, 2012 at 06:36:18PM +0530, Thomas Abraham wrote:
>>> Add pinctrl device nodes for Exynos5250 SoC.
>>>
>>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>>
>> Replying to an old email of a patch that has been merged because it seems
>> horribly broken.
>>
>>
>>> diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
>>> index 581e57a..eb8d610 100644
>>> --- a/arch/arm/boot/dts/exynos5250.dtsi
>>> +++ b/arch/arm/boot/dts/exynos5250.dtsi
>>> @@ -18,6 +18,7 @@
>>>  */
>>>
>>>  /include/ "skeleton.dtsi"
>>> +/include/ "exynos5250-pinctrl.dtsi"
>>>
>>>  / {
>>>       compatible = "samsung,exynos5250";
>>> @@ -48,6 +49,8 @@
>>>               mshc1 = &dwmmc_1;
>>>               mshc2 = &dwmmc_2;
>>>               mshc3 = &dwmmc_3;
>>> +             pinctrl0 = &pinctrl_0;
>>> +             pinctrl3 = &pinctrl_3;
>>>       };
>>>
>>>       gic:interrupt-controller@10481000 {
>>> @@ -79,6 +82,24 @@
>>>               interrupts = <0 42 0>;
>>>       };
>>>
>>> +     pinctrl_0: pinctrl@11400000 {
>>> +             compatible = "samsung,pinctrl-exynos5250";
>>> +             reg = <0x11400000 0x1000>;
>>> +             interrupts = <0 46 0>;
>>> +
>>> +             wakup_eint: wakeup-interrupt-controller {
>>> +                     compatible = "samsung,exynos4210-wakeup-eint";
>>> +                     interrupt-parent = <&gic>;
>>> +                     interrupts = <0 32 0>;
>>> +             };
>>
>> Typo, should be "wakeup_eint". And what happened to #interrupt-cells? And the
>> interrupt map?
>
> Hi Olof,
>
> With the pinctrl driver, there is change in the way the wakeup
> interrupts are handled. Each of the four wakeup banks (GPX0 to GPX3)
> are now individual interrupt controllers (introduced by Tomasz Figa).
> The wakeup interrupts generated by GPX2 and GPX3 are muxed into the <0
> 32 0> interrupt of GIC.
>
> So the interrupts-cells and interrupt map are not required in the
> above node. The label "wakup_eint" can actually to dropped and
> probably the node name "wakeup-interrupt-controller" should be renamed
> to avoid interpreting it as a interrupt controller node.

Yep, I was completely misled by the remaining existence of the
wakup_eint [sic] label. I'll submit a patch to remove those.

Seems that things are working as appropriate with the gpio/pinctrl
binding. It's a little trickier to find out which interrupt specifier
to use since it requires one more lookup in the user manual, but
that's alright.


>> Do you have an example of a tested user or a testcase for this? I'm
>> trying to get interrupts going on these pins, and it's not looking like
>> it's even close to working.
>
> The following is a rudimentary patch with which I have tested wakeup
> interrupts GPX0[0] and GPX3[7] on smdk5250 board. The gpio number in
> the dts file can be changed to test wakeup interrupt on pins other
> than EINT31 (GPX3[7]).

Thanks!

-Olof
diff mbox

Patch

diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 26d856b..eedec6a 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -248,4 +248,9 @@ 
                        clock-frequency = <24000000>;
                };
        };
+
+       test-wkup {
+               compatible = "test_wkup";
+               gpios = <&gpx3 7 0>;
+       };
 };
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index ef6860b..d7640e3 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -44,7 +44,7 @@  obj-$(CONFIG_MACH_SMDK4212)           += mach-smdk4x12.o
 obj-$(CONFIG_MACH_SMDK4412)            += mach-smdk4x12.o

 obj-$(CONFIG_MACH_EXYNOS4_DT)          += mach-exynos4-dt.o
-obj-$(CONFIG_MACH_EXYNOS5_DT)          += mach-exynos5-dt.o
+obj-$(CONFIG_MACH_EXYNOS5_DT)          += mach-exynos5-dt.o button-smdk5250.o

 # device support

diff --git a/arch/arm/mach-exynos/button-smdk5250.c
b/arch/arm/mach-exynos/button-smdk5250.c
new file mode 100644
index 0000000..2dbb5b4
--- /dev/null
+++ b/arch/arm/mach-exynos/button-smdk5250.c
@@ -0,0 +1,72 @@ 
+/* linux/arch/arm/mach-s5pv310/button-smdkv310.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *             http://www.samsung.com/
+ *
+ * Button Driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/ioport.h>
+#include <linux/delay.h>
+#include <linux/serial_core.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+
+#include <plat/map-base.h>
+#include <plat/gpio-cfg.h>
+
+#include <mach/regs-gpio.h>
+#include <mach/regs-irq.h>
+
+static irqreturn_t
+s3c_button_interrupt(int irq, void *dev_id)
+{
+       printk("\n %d irq occured \n", irq);
+       return IRQ_HANDLED;
+}
+
+static struct irqaction s3c_button_irq = {
+       .name           = "s3c button Tick",
+       .flags          = IRQF_SHARED ,
+       .handler        = s3c_button_interrupt,
+};
+
+static int __init smdk5250_button_test(void)
+{
+       struct device_node *np;
+       unsigned long gpio;
+       int gpio_irq;
+
+       printk(KERN_INFO "\n\n SMDKV5250 Button init function\n");
+
+       np = of_find_compatible_node(NULL, NULL, "test_wkup");
+       if (!np) {
+               printk("could not find test node.. stopping.\n");
+               return -EINVAL;
+       }
+
+       gpio = of_get_gpio(np, 0);
+       if (!gpio_is_valid(gpio)) {
+               printk("\n gpio_weint_mux gpio is invalid\n");
+               return -EINVAL;
+       }
+
+       gpio_irq = gpio_to_irq(gpio);
+
+       irq_set_irq_type(gpio_irq, IRQ_TYPE_EDGE_BOTH);
+       setup_irq(gpio_irq, &s3c_button_irq);
+
+       return 0;
+}
+late_initcall(smdk5250_button_test);