diff mbox

[4/6] pinctrl: sunxi: add clock support

Message ID 1363962042-29536-5-git-send-email-emilio@elopez.com.ar
State New
Headers show

Commit Message

Emilio López March 22, 2013, 2:20 p.m. UTC
For the port controller to work, we need to enable the apb0_pio gate.
This commit adds the ability to enable one clock specified on the device
tree to the pinctrl driver.

Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
 drivers/pinctrl/pinctrl-sunxi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Linus Walleij March 27, 2013, 1:14 p.m. UTC | #1
On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:

> For the port controller to work, we need to enable the apb0_pio gate.
> This commit adds the ability to enable one clock specified on the device
> tree to the pinctrl driver.
>
> Signed-off-by: Emilio López <emilio@elopez.com.ar>

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

I guess you'll want to merge these as one series to some platform-specific
tree, tell me if you want it merged in the pinctrl tree.

Yours,
Linus Walleij
Maxime Ripard March 27, 2013, 8:03 p.m. UTC | #2
Hi Linus,

Le 27/03/2013 14:14, Linus Walleij a écrit :
> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
> 
>> For the port controller to work, we need to enable the apb0_pio gate.
>> This commit adds the ability to enable one clock specified on the device
>> tree to the pinctrl driver.
>>
>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> I guess you'll want to merge these as one series to some platform-specific
> tree, tell me if you want it merged in the pinctrl tree.

The easiest would probably be to merge this patch through your patch,
with Mike taking the clock driver patches and me taking the dt ones,
once we agree on the other patches.

Maxime
Linus Walleij April 3, 2013, 11:59 a.m. UTC | #3
On Wed, Mar 27, 2013 at 9:03 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> Hi Linus,
> Le 27/03/2013 14:14, Linus Walleij a écrit :
>> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
>>
>>> For the port controller to work, we need to enable the apb0_pio gate.
>>> This commit adds the ability to enable one clock specified on the device
>>> tree to the pinctrl driver.
>>>
>>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
>>
>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> I guess you'll want to merge these as one series to some platform-specific
>> tree, tell me if you want it merged in the pinctrl tree.
>
> The easiest would probably be to merge this patch through your patch,
> with Mike taking the clock driver patches and me taking the dt ones,
> once we agree on the other patches.

OK then, patch applied to the pinctrl tree, thanks!

Yours,
Linus Walleij
Maxime Ripard April 3, 2013, 9:20 p.m. UTC | #4
Hi Linus,

Le 03/04/2013 13:59, Linus Walleij a écrit :
> On Wed, Mar 27, 2013 at 9:03 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> 
>> Hi Linus,
>> Le 27/03/2013 14:14, Linus Walleij a écrit :
>>> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
>>>
>>>> For the port controller to work, we need to enable the apb0_pio gate.
>>>> This commit adds the ability to enable one clock specified on the device
>>>> tree to the pinctrl driver.
>>>>
>>>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
>>>
>>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>>>
>>> I guess you'll want to merge these as one series to some platform-specific
>>> tree, tell me if you want it merged in the pinctrl tree.
>>
>> The easiest would probably be to merge this patch through your patch,
>> with Mike taking the clock driver patches and me taking the dt ones,
>> once we agree on the other patches.
> 
> OK then, patch applied to the pinctrl tree, thanks!

Ouch, the previous patches aren't applied yet by Mike, and we didn't
have some comments from him about these patches, so I can't really say
if the previous patches will get merge by 3.10 or not... So we will
maybe end up with a broken pinctrl stuff.

Mike, do you have some comments on Emilio's patches?

If you do, we can still fix things up later by applying a slightly
modified version of patches 5/6 with a clock that is already there, for
it to load properly.

Thanks,
Maxime
Mike Turquette April 4, 2013, 12:49 a.m. UTC | #5
Quoting Maxime Ripard (2013-04-03 14:20:37)
> Hi Linus,
> 
> Le 03/04/2013 13:59, Linus Walleij a écrit :
> > On Wed, Mar 27, 2013 at 9:03 PM, Maxime Ripard
> > <maxime.ripard@free-electrons.com> wrote:
> > 
> >> Hi Linus,
> >> Le 27/03/2013 14:14, Linus Walleij a écrit :
> >>> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
> >>>
> >>>> For the port controller to work, we need to enable the apb0_pio gate.
> >>>> This commit adds the ability to enable one clock specified on the device
> >>>> tree to the pinctrl driver.
> >>>>
> >>>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
> >>>
> >>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> >>>
> >>> I guess you'll want to merge these as one series to some platform-specific
> >>> tree, tell me if you want it merged in the pinctrl tree.
> >>
> >> The easiest would probably be to merge this patch through your patch,
> >> with Mike taking the clock driver patches and me taking the dt ones,
> >> once we agree on the other patches.
> > 
> > OK then, patch applied to the pinctrl tree, thanks!
> 
> Ouch, the previous patches aren't applied yet by Mike, and we didn't
> have some comments from him about these patches, so I can't really say
> if the previous patches will get merge by 3.10 or not... So we will
> maybe end up with a broken pinctrl stuff.
> 
> Mike, do you have some comments on Emilio's patches?
> 
> If you do, we can still fix things up later by applying a slightly
> modified version of patches 5/6 with a clock that is already there, for
> it to load properly.
> 

Hi Maxime,

I did leave some comments a few hours ago.  It would be better if the
fixes could be rolled in now, but if that is somehow impossible then I
don't mind taking them as-is with fixes at a later date.  Just let me
know.

Regards,
Mike

> Thanks,
> Maxime
> 
> -- 
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
Linus Walleij April 4, 2013, 11:37 a.m. UTC | #6
On Wed, Apr 3, 2013 at 11:20 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Le 03/04/2013 13:59, Linus Walleij a écrit :
>> On Wed, Mar 27, 2013 at 9:03 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>>
>>> Hi Linus,
>>> Le 27/03/2013 14:14, Linus Walleij a écrit :
>>>> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
>>>>
>>>>> For the port controller to work, we need to enable the apb0_pio gate.
>>>>> This commit adds the ability to enable one clock specified on the device
>>>>> tree to the pinctrl driver.
>>>>>
>>>>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
>>>>
>>>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>>>>
>>>> I guess you'll want to merge these as one series to some platform-specific
>>>> tree, tell me if you want it merged in the pinctrl tree.
>>>
>>> The easiest would probably be to merge this patch through your patch,
>>> with Mike taking the clock driver patches and me taking the dt ones,
>>> once we agree on the other patches.
>>
>> OK then, patch applied to the pinctrl tree, thanks!
>
> Ouch, the previous patches aren't applied yet by Mike, and we didn't
> have some comments from him about these patches, so I can't really say
> if the previous patches will get merge by 3.10 or not... So we will
> maybe end up with a broken pinctrl stuff.

This is usually why we keep patches together and merge whole series
into one tree, such as ARM SoC.

Well, maybe I'll drop it then ...

Yours,
Linus Walleij
Mike Turquette April 4, 2013, 5:01 p.m. UTC | #7
Quoting Linus Walleij (2013-04-04 04:37:23)
> On Wed, Apr 3, 2013 at 11:20 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Le 03/04/2013 13:59, Linus Walleij a écrit :
> >> On Wed, Mar 27, 2013 at 9:03 PM, Maxime Ripard
> >> <maxime.ripard@free-electrons.com> wrote:
> >>
> >>> Hi Linus,
> >>> Le 27/03/2013 14:14, Linus Walleij a écrit :
> >>>> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
> >>>>
> >>>>> For the port controller to work, we need to enable the apb0_pio gate.
> >>>>> This commit adds the ability to enable one clock specified on the device
> >>>>> tree to the pinctrl driver.
> >>>>>
> >>>>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
> >>>>
> >>>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> >>>>
> >>>> I guess you'll want to merge these as one series to some platform-specific
> >>>> tree, tell me if you want it merged in the pinctrl tree.
> >>>
> >>> The easiest would probably be to merge this patch through your patch,
> >>> with Mike taking the clock driver patches and me taking the dt ones,
> >>> once we agree on the other patches.
> >>
> >> OK then, patch applied to the pinctrl tree, thanks!
> >
> > Ouch, the previous patches aren't applied yet by Mike, and we didn't
> > have some comments from him about these patches, so I can't really say
> > if the previous patches will get merge by 3.10 or not... So we will
> > maybe end up with a broken pinctrl stuff.
> 
> This is usually why we keep patches together and merge whole series
> into one tree, such as ARM SoC.
> 
> Well, maybe I'll drop it then ...
> 

I plan on taking in the three clk patches after getting final comments
from Gregory.  So maybe you do not need to drop the pinctrl patches?

Regards,
Mike

> Yours,
> Linus Walleij
Linus Walleij April 5, 2013, 7:45 a.m. UTC | #8
On Thu, Apr 4, 2013 at 7:01 PM, Mike Turquette <mturquette@linaro.org> wrote:
> Quoting Linus Walleij (2013-04-04 04:37:23)
>> On Wed, Apr 3, 2013 at 11:20 PM, Maxime Ripard
>> <maxime.ripard@free-electrons.com> wrote:
>> > Le 03/04/2013 13:59, Linus Walleij a écrit :
>> >> On Wed, Mar 27, 2013 at 9:03 PM, Maxime Ripard
>> >> <maxime.ripard@free-electrons.com> wrote:
>> >>
>> >>> Hi Linus,
>> >>> Le 27/03/2013 14:14, Linus Walleij a écrit :
>> >>>> On Fri, Mar 22, 2013 at 3:20 PM, Emilio López <emilio@elopez.com.ar> wrote:
>> >>>>
>> >>>>> For the port controller to work, we need to enable the apb0_pio gate.
>> >>>>> This commit adds the ability to enable one clock specified on the device
>> >>>>> tree to the pinctrl driver.
>> >>>>>
>> >>>>> Signed-off-by: Emilio López <emilio@elopez.com.ar>
>> >>>>
>> >>>> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>> >>>>
>> >>>> I guess you'll want to merge these as one series to some platform-specific
>> >>>> tree, tell me if you want it merged in the pinctrl tree.
>> >>>
>> >>> The easiest would probably be to merge this patch through your patch,
>> >>> with Mike taking the clock driver patches and me taking the dt ones,
>> >>> once we agree on the other patches.
>> >>
>> >> OK then, patch applied to the pinctrl tree, thanks!
>> >
>> > Ouch, the previous patches aren't applied yet by Mike, and we didn't
>> > have some comments from him about these patches, so I can't really say
>> > if the previous patches will get merge by 3.10 or not... So we will
>> > maybe end up with a broken pinctrl stuff.
>>
>> This is usually why we keep patches together and merge whole series
>> into one tree, such as ARM SoC.
>>
>> Well, maybe I'll drop it then ...
>>
>
> I plan on taking in the three clk patches after getting final comments
> from Gregory.  So maybe you do not need to drop the pinctrl patches?

No, I'm keeping it around, no problem.

Thanks Mike,
Linus Walleij
diff mbox

Patch

diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index 3e41cd1..a1e2af7 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -11,6 +11,7 @@ 
  */
 
 #include <linux/io.h>
+#include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -1917,6 +1918,7 @@  static int sunxi_pinctrl_probe(struct platform_device *pdev)
 	struct pinctrl_pin_desc *pins;
 	struct sunxi_pinctrl *pctl;
 	int i, ret, last_pin;
+	struct clk *clk;
 
 	pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
 	if (!pctl)
@@ -1987,6 +1989,12 @@  static int sunxi_pinctrl_probe(struct platform_device *pdev)
 			goto gpiochip_error;
 	}
 
+	clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(clk))
+		goto gpiochip_error;
+
+	clk_prepare_enable(clk);
+
 	dev_info(&pdev->dev, "initialized sunXi PIO driver\n");
 
 	return 0;