diff mbox

[2/4] gpio: samsung: Skip registration if pinctrl driver is present on Exynos4x12

Message ID 1351089457-8205-3-git-send-email-t.figa@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomasz Figa Oct. 24, 2012, 2:37 p.m. UTC
This patch modifies the Samsung GPIO driver to check for pinctrl driver
presence earlier and use generic matching instead of a single compatible
value.

This allows us to fix warning about unrecognized SoC in case of
Exynos4x12, which is not supported by this driver.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpio/gpio-samsung.c | 43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

Comments

Linus Walleij Oct. 28, 2012, 7:11 p.m. UTC | #1
On Wed, Oct 24, 2012 at 4:37 PM, Tomasz Figa <t.figa@samsung.com> wrote:

> This patch modifies the Samsung GPIO driver to check for pinctrl driver
> presence earlier and use generic matching instead of a single compatible
> value.
>
> This allows us to fix warning about unrecognized SoC in case of
> Exynos4x12, which is not supported by this driver.
>
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Tell me if there is something you want merged through
the GPIO or pinctrl tree. I have this Samsung branch on the
pinctrl tree...

Yours,
Linus Walleij
Kim Kukjin Nov. 7, 2012, 4:41 a.m. UTC | #2
Linus Walleij wrote:
> 
> On Wed, Oct 24, 2012 at 4:37 PM, Tomasz Figa <t.figa@samsung.com> wrote:
> 
> > This patch modifies the Samsung GPIO driver to check for pinctrl driver
> > presence earlier and use generic matching instead of a single compatible
> > value.
> >
> > This allows us to fix warning about unrecognized SoC in case of
> > Exynos4x12, which is not supported by this driver.
> >
> > Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Tell me if there is something you want merged through
> the GPIO or pinctrl tree. I have this Samsung branch on the
> pinctrl tree...
> 
Hi Linus, 

A commit 1b6056d6 ("pinctrl: samsung: Include bank-specific eint offset in
bank struct") which is in your pinctrl tree (samsung branch) changed
macro(EXYNOS_PIN_BANK_EINTG) to add offset. Eventually, this series(due to
3rd patch, pinctrl: samsung: Add support for Exynos4x12) breaks compilation
without the commit. So if you don't have a plan to rebase samsung branch of
your pinctrl tree, I'd like to merge it in my tree. Is it ok to you?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
Linus Walleij Nov. 8, 2012, 9:12 p.m. UTC | #3
On Wed, Nov 7, 2012 at 5:41 AM, Kukjin Kim <kgene.kim@samsung.com> wrote:

> A commit 1b6056d6 ("pinctrl: samsung: Include bank-specific eint offset in
> bank struct") which is in your pinctrl tree (samsung branch) changed
> macro(EXYNOS_PIN_BANK_EINTG) to add offset. Eventually, this series(due to
> 3rd patch, pinctrl: samsung: Add support for Exynos4x12) breaks compilation
> without the commit. So if you don't have a plan to rebase samsung branch of
> your pinctrl tree, I'd like to merge it in my tree. Is it ok to you?

Sure tell me when you've merged it and I'll drop commit 1b6056d6
from my tree.

Yours,
Linus Walleij
Kim Kukjin Nov. 9, 2012, 10:09 a.m. UTC | #4
Linus Walleij wrote:
> 
> On Wed, Nov 7, 2012 at 5:41 AM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> 
> > A commit 1b6056d6 ("pinctrl: samsung: Include bank-specific eint offset
> in
> > bank struct") which is in your pinctrl tree (samsung branch) changed
> > macro(EXYNOS_PIN_BANK_EINTG) to add offset. Eventually, this series(due
> to
> > 3rd patch, pinctrl: samsung: Add support for Exynos4x12) breaks
> compilation
> > without the commit. So if you don't have a plan to rebase samsung branch
> of
> > your pinctrl tree, I'd like to merge it in my tree. Is it ok to you?
> 
> Sure tell me when you've merged it and I'll drop commit 1b6056d6
> from my tree.
> 

Thanks :-)

(- some guys in Cc...)

But having a problem, the 'it' means the commit 1b6056d6? If so, I couldn't
cherry-pick only that because of dependency with other commits 40ba622 and
3a232ba.

$ git cherry-pick -s 40ba622
[next/dt-exynos4x12 3b1977c] pinctrl: samsung: Assing pin numbers
dynamically
 Author: Tomasz Figa <t.figa@samsung.com>
 3 files changed, 62 insertions(+), 54 deletions(-)

$ git cherry-pick -s 3a232ba
[next/dt-exynos4x12 7fa08a4] pinctrl: samsung: Remove static pin
enumerations
 Author: Tomasz Figa <t.figa@samsung.com>
 1 files changed, 96 insertions(+), 215 deletions(-)
 rewrite drivers/pinctrl/pinctrl-exynos.h (66%)

$ git cherry-pick -s 1b6056d
[next/dt-exynos4x12 86010aa] pinctrl: samsung: Include bank-specific eint
offset in bank struct
 Author: Tomasz Figa <t.figa@samsung.com>
 3 files changed, 30 insertions(+), 29 deletions(-)

I could cherry-pick clearly with 2 more commits.

Can you drop above 3 commits in your tree? If many conflicts happens during
rebasing, how about that I merge your pinctrl/samsung branch into Samsung
tree?...

$ git log --oneline pinctrl/samsung v3.7-rc1..pinctrl/samsung
b33ef91 Documentation: Update samsung-pinctrl device tree bindings
documentation
a19fe2d pinctrl: samsung: Add GPIO to IRQ translation
22b9ba0 pinctrl: exynos: Set pin function to EINT in irq_set_type of wake-up
EINT
a04b07c pinctrl: samsung: Use per-bank IRQ domain for wake-up interrupts
d3a7b9e pinctrl: samsung: Use one GPIO chip per pin bank
595be72 pinctrl: exynos: Use one IRQ domain per pin bank
1b6056d pinctrl: samsung: Include bank-specific eint offset in bank struct
6defe9a pinctrl: samsung: Hold pointer to driver data in bank struct
ab66378 pinctrl: samsung: Match pin banks with their device nodes
a7a8241 ARM: dts: exynos4210-pinctrl: Add nodes for pin banks
724e56a pinctrl: samsung: Distinguish between pin group and bank nodes
3a232ba pinctrl: samsung: Remove static pin enumerations
40ba622 pinctrl: samsung: Assing pin numbers dynamically
62f14c0 pinctrl: samsung: Do not pass gpio_chip to pin_to_reg_bank
7c367d3 pinctrl: samsung: Detect and handle unsupported configuration types

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
Linus Walleij Nov. 11, 2012, 6:35 p.m. UTC | #5
On Fri, Nov 9, 2012 at 11:09 AM, Kukjin Kim <kgene.kim@samsung.com> wrote:
>> On Wed, Nov 7, 2012 at 5:41 AM, Kukjin Kim <kgene.kim@samsung.com> wrote:
>>
>> > A commit 1b6056d6 ("pinctrl: samsung: Include bank-specific eint offset
>> in
>> > bank struct") which is in your pinctrl tree (samsung branch) changed
>> > macro(EXYNOS_PIN_BANK_EINTG) to add offset. Eventually, this series(due
>> to
>> > 3rd patch, pinctrl: samsung: Add support for Exynos4x12) breaks
>> compilation
>> > without the commit. So if you don't have a plan to rebase samsung branch
>> of
>> > your pinctrl tree, I'd like to merge it in my tree. Is it ok to you?
>>
>> Sure tell me when you've merged it and I'll drop commit 1b6056d6
>> from my tree.
>>
>
> Thanks :-)
>
> (- some guys in Cc...)
>
> But having a problem, the 'it' means the commit 1b6056d6? If so, I couldn't
> cherry-pick only that because of dependency with other commits 40ba622 and
> 3a232ba.
>
> $ git cherry-pick -s 40ba622
> [next/dt-exynos4x12 3b1977c] pinctrl: samsung: Assing pin numbers
> dynamically
>  Author: Tomasz Figa <t.figa@samsung.com>
>  3 files changed, 62 insertions(+), 54 deletions(-)
>
> $ git cherry-pick -s 3a232ba
> [next/dt-exynos4x12 7fa08a4] pinctrl: samsung: Remove static pin
> enumerations
>  Author: Tomasz Figa <t.figa@samsung.com>
>  1 files changed, 96 insertions(+), 215 deletions(-)
>  rewrite drivers/pinctrl/pinctrl-exynos.h (66%)
>
> $ git cherry-pick -s 1b6056d
> [next/dt-exynos4x12 86010aa] pinctrl: samsung: Include bank-specific eint
> offset in bank struct
>  Author: Tomasz Figa <t.figa@samsung.com>
>  3 files changed, 30 insertions(+), 29 deletions(-)
>
> I could cherry-pick clearly with 2 more commits.
>
> Can you drop above 3 commits in your tree? If many conflicts happens during
> rebasing, how about that I merge your pinctrl/samsung branch into Samsung
> tree?...

Why not :-)

I have removed the samsung branch from my for-next to avoid
clashes.

So please bring the samsung branch into you tree and fix
everything up there.

Axel Lin has sent some tree-wide cleanups but let's hope they don't
hit samsung so much, or they will need to be postponed/dropped.

Yours,
Linus Walleij
Kim Kukjin Nov. 12, 2012, 5:03 a.m. UTC | #6
Linus Walleij wrote:
> 
> >
> > Can you drop above 3 commits in your tree? If many conflicts happens
> during
> > rebasing, how about that I merge your pinctrl/samsung branch into
> Samsung
> > tree?...
> 
> Why not :-)
> 
> I have removed the samsung branch from my for-next to avoid
> clashes.
> 
Thanks ;-)

> So please bring the samsung branch into you tree and fix
> everything up there.
> 
I did.

> Axel Lin has sent some tree-wide cleanups but let's hope they don't
> hit samsung so much, or they will need to be postponed/dropped.
> 
OK, I see.

Thanks again.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
diff mbox

Patch

diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 43c4595..01f7fe9 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -2796,27 +2796,6 @@  static __init void exynos4_gpiolib_init(void)
 	int group = 0;
 	void __iomem *gpx_base;
 
-#ifdef CONFIG_PINCTRL_SAMSUNG
-		/*
-		 * This gpio driver includes support for device tree support and
-		 * there are platforms using it. In order to maintain
-		 * compatibility with those platforms, and to allow non-dt
-		 * Exynos4210 platforms to use this gpiolib support, a check
-		 * is added to find out if there is a active pin-controller
-		 * driver support available. If it is available, this gpiolib
-		 * support is ignored and the gpiolib support available in
-		 * pin-controller driver is used. This is a temporary check and
-		 * will go away when all of the Exynos4210 platforms have
-		 * switched to using device tree and the pin-ctrl driver.
-		 */
-		struct device_node *pctrl_np;
-		const char *pctrl_compat = "samsung,pinctrl-exynos4210";
-		pctrl_np = of_find_compatible_node(NULL, NULL, pctrl_compat);
-		if (pctrl_np)
-			if (of_device_is_available(pctrl_np))
-				return;
-#endif
-
 	/* gpio part1 */
 	gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K);
 	if (gpio_base1 == NULL) {
@@ -3031,6 +3010,28 @@  static __init int samsung_gpiolib_init(void)
 	int i, nr_chips;
 	int group = 0;
 
+#ifdef CONFIG_PINCTRL_SAMSUNG
+	/*
+	* This gpio driver includes support for device tree support and there
+	* are platforms using it. In order to maintain compatibility with those
+	* platforms, and to allow non-dt Exynos4210 platforms to use this
+	* gpiolib support, a check is added to find out if there is a active
+	* pin-controller driver support available. If it is available, this
+	* gpiolib support is ignored and the gpiolib support available in
+	* pin-controller driver is used. This is a temporary check and will go
+	* away when all of the Exynos4210 platforms have switched to using
+	* device tree and the pin-ctrl driver.
+	*/
+	struct device_node *pctrl_np;
+	static const struct of_device_id exynos_pinctrl_ids[] = {
+		{ .compatible = "samsung,pinctrl-exynos4210", },
+		{ .compatible = "samsung,pinctrl-exynos4x12", },
+	};
+	for_each_matching_node(pctrl_np, exynos_pinctrl_ids)
+		if (pctrl_np && of_device_is_available(pctrl_np))
+			return -ENODEV;
+#endif
+
 	samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs));
 
 	if (soc_is_s3c24xx()) {