Re: [PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2013-04-26 Thread Olof Johansson
Hi,

On Thu, Apr 25, 2013 at 12:38 AM, Thomas Abraham
 wrote:
> On 25 April 2013 05:03, Olof Johansson  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 
>>
>> 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@1140 {
>>> + compatible = "samsung,pinctrl-exynos5250";
>>> + reg = <0x1140 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
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2013-04-25 Thread Tomasz Figa
Oh screw that mobile GMail - seems like it now always sends plain + HTML...

Resending the post from a mail client working properly:

On Thursday 25 of April 2013 10:47:21 Tomasz Figa wrote:

Hi Olof,

W dniu czwartek, 25 kwietnia 2013 użytkownik Olof Johansson  
napisał:
> 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 
>
> Replying to an old email of a patch that has been merged because it seems
> horribly broken.
>

As far as I can see in Kgene's tree, newer version of this patch has been 
merged.

I managed to already found a typo in that new version, though. The pinctrl2 
block is located at 0x386 not 0x368, or at least this is what the 
manual says.

>
>> 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@1140 {
>> + compatible = "samsung,pinctrl-exynos5250";
>> + reg = <0x1140 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?
>
> 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.

I have extensively tested interrupt handling in pinctrl-driver when reworking 
it. Testing was done on Exynos4210 and Exynos4412, but Exynos5250 seems to 
follow exactly the same design of pinctrl block.

Could you specify a bit more precisely what is your use case (GPIO pin, 
driver, device tree node of interrupt user, etc.)?

Best regards,
-- 
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Kernel and System Framework

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2013-04-25 Thread Thomas Abraham
On 25 April 2013 05:03, Olof Johansson  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 
>
> 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@1140 {
>> + compatible = "samsung,pinctrl-exynos5250";
>> + reg = <0x1140 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 
---
 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

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 = <2400>;
};
};
+
+   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 000..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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+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 = {
+   .n

Re: [PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2013-04-24 Thread Olof Johansson
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 

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@1140 {
> + compatible = "samsung,pinctrl-exynos5250";
> + reg = <0x1140 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?

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.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2012-12-18 Thread Kukjin Kim

On 12/14/12 12:34, Linus Walleij wrote:

On Thu, Dec 13, 2012 at 2:06 PM, Thomas Abraham
  wrote:


Add pinctrl device nodes for Exynos5250 SoC.

Signed-off-by: Thomas Abraham


Acked-by: Linus Walleij


- The individual device nodes which are using the old style Samsung gpio
   bindings have not been converted over to pinctrl bindings yet. It might
   also be important to know if Linus's pinctrl grab in device core patch
   (http://comments.gmane.org/gmane.linux.kernel/1409263) gets accepted.


Greg seems happy with it and the plan is to have it merged for kernel
v3.9.

I intend to push Greg for an ACK and queue it for linux-next right after the
merge window.


Same here ;-)


- This patch should not be merged for now which otherwise would break existing
   platforms which are using the old samsung gpio driver bindings. This patch
   is intended to get started with the migration to pinctrl framework.
   It is probably better to first prepare all the migration patches and
   merge them as a bunch.


Sure. I guess it'll be taken through the Samsung tree anyway, right?


I'm OK on this, if Greg is OK, then let me pick this up in Samsung tree.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim , Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2012-12-14 Thread Linus Walleij
On Thu, Dec 13, 2012 at 2:06 PM, Thomas Abraham
 wrote:

> Add pinctrl device nodes for Exynos5250 SoC.
>
> Signed-off-by: Thomas Abraham 

Acked-by: Linus Walleij 

> - The individual device nodes which are using the old style Samsung gpio
>   bindings have not been converted over to pinctrl bindings yet. It might
>   also be important to know if Linus's pinctrl grab in device core patch
>   (http://comments.gmane.org/gmane.linux.kernel/1409263) gets accepted.

Greg seems happy with it and the plan is to have it merged for kernel
v3.9.

I intend to push Greg for an ACK and queue it for linux-next right after the
merge window.

> - This patch should not be merged for now which otherwise would break existing
>   platforms which are using the old samsung gpio driver bindings. This patch
>   is intended to get started with the migration to pinctrl framework.
>   It is probably better to first prepare all the migration patches and
>   merge them as a bunch.

Sure. I guess it'll be taken through the Samsung tree anyway, right?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: dts: add pinctrl nodes for Exynos5250 SoC

2012-12-13 Thread Thomas Abraham
Add pinctrl device nodes for Exynos5250 SoC.

Signed-off-by: Thomas Abraham 
---
Few notes on this patch:
- Only pinctrl-0 and pinctrl-3 nodes have been added. Since pinctrl-1 is
  mostly used for camera interface, and since I do not have good
  understanding of this interface, I assumed the person with better
  understanding of camera interface can add the pinctrl-1 node. And
  pinctrl-2 node is used for C2C controller which I do not understand.
- The individual device nodes which are using the old style Samsung gpio
  bindings have not been converted over to pinctrl bindings yet. It might
  also be important to know if Linus's pinctrl grab in device core patch
  (http://comments.gmane.org/gmane.linux.kernel/1409263) gets accepted.
- This patch should not be merged for now which otherwise would break existing
  platforms which are using the old samsung gpio driver bindings. This patch
  is intended to get started with the migration to pinctrl framework.
  It is probably better to first prepare all the migration patches and
  merge them as a bunch.

 arch/arm/boot/dts/exynos5250-pinctrl.dtsi |  575 +
 arch/arm/boot/dts/exynos5250.dtsi |  268 +-
 2 files changed, 596 insertions(+), 247 deletions(-)
 create mode 100644 arch/arm/boot/dts/exynos5250-pinctrl.dtsi

diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
new file mode 100644
index 000..24180fc
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -0,0 +1,575 @@
+/*
+ * Samsung's Exynos5250 SoC pin-mux and pin-config device tree source
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung's Exynos5250 SoC pin-mux and pin-config optiosn are listed as device
+ * tree nodes are listed in this file.
+ *
+ * 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.
+*/
+
+/ {
+   pinctrl@1140 {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa2: gpa2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb0: gpb0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb1: gpb1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb2: gpb2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb3: gpb3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc2: gpc2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc3: gpc3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd0: gpd0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller