From: sassmann@kpanic.de (Stefan Assmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] clk: initial clock driver for TWL6030
Date: Thu, 31 Jul 2014 13:58:11 +0200 [thread overview]
Message-ID: <53DA2F53.8010405@kpanic.de> (raw)
In-Reply-To: <53DA284D.6030404@ti.com>
On 31.07.2014 13:28, Tero Kristo wrote:
[...]
>> diff --git a/drivers/clk/ti/clk-6030.c b/drivers/clk/ti/clk-6030.c
>> new file mode 100644
>> index 0000000..61d1834
>> --- /dev/null
>> +++ b/drivers/clk/ti/clk-6030.c
>
> Please change the filename to something like clk-twl6030.c. clk-\d+
> filenames basically denote a SoC under TI clock driver structure.
Ok.
>
>> @@ -0,0 +1,133 @@
>> +/*
>> + * drivers/clk/ti/clk-6030.c
>
> Replace this with some sort of short description instead, see other
> files under drivers/clk/ti. Having an absolute filename here doesn't
> really provide anything.
Ok.
>
>> + *
>> + * Copyright (C) 2014 Stefan Assmann <sassmann@kpanic.de>
>> + *
>> + * 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.
>> + *
>> + * Clock driver for TI twl6030.
>> + */
>
> A basic comment about this driver, how about trying to make it more
> generic, as in making it an i2c-clock driver? I guess there are other
> external chips/boards outside twl6030 family that would be interested in
> using it.
I'll look into that.
[...]
>> +static int of_twl6030_clk32kg_probe(struct platform_device *pdev)
>> +{
>> + struct device_node *node = pdev->dev.of_node;
>> + struct clk *clk;
>> +
>> + if (!node)
>> + return -ENODEV;
>> +
>> + clk = devm_clk_get(&pdev->dev, "clk32kg");
>> + if (IS_ERR(clk))
>> + return PTR_ERR(clk);
>> +
>> + return clk_prepare(clk);
>
> This is plain wrong as pointed out earlier. The driver that uses the
> clock must enable it.
Understood. I'll change it to clk_prepare_enable().
[...]
>> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
>> index db11b4f..440fe4e 100644
>> --- a/drivers/mfd/twl-core.c
>> +++ b/drivers/mfd/twl-core.c
>> @@ -34,6 +34,7 @@
>> #include <linux/platform_device.h>
>> #include <linux/regmap.h>
>> #include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>> #include <linux/err.h>
>> #include <linux/device.h>
>> #include <linux/of.h>
>> @@ -1012,6 +1013,8 @@ static void clocks_init(struct device *dev,
>> u32 rate;
>> u8 ctrl = HFCLK_FREQ_26_MHZ;
>>
>> + of_clk_init(NULL);
>> +
>
> Don't do this please, this is horrible. of_clk_init or alternatives
> should be called from board/SoC specific context, otherwise you end up
> calling the init functions multiple times. If you are facing an issue
> that TI boards do not initialize external clocks properly currently,
> this is because TI clock driver does its init hierarchically and does
> not parse the whole DT for clock nodes. I have an experimental patch
> available I can post for you to try out which provides external clock
> support on TI boards if you like.
If you could provide that patch that'll be great.
Thanks for the comments Tero.
Stefan
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Assmann <sassmann-llIHtaV5axyzQB+pC5nmwQ@public.gmane.org>
To: Tero Kristo <t-kristo-l0cyMroinI0@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
pawel.moll-5wv7dgnIgG8@public.gmane.org,
peter.ujfalusi-l0cyMroinI0@public.gmane.org,
"Andreas Färber" <afaerber-l3A5Bk7waGM@public.gmane.org>
Subject: Re: [PATCH 2/2] clk: initial clock driver for TWL6030
Date: Thu, 31 Jul 2014 13:58:11 +0200 [thread overview]
Message-ID: <53DA2F53.8010405@kpanic.de> (raw)
In-Reply-To: <53DA284D.6030404-l0cyMroinI0@public.gmane.org>
On 31.07.2014 13:28, Tero Kristo wrote:
[...]
>> diff --git a/drivers/clk/ti/clk-6030.c b/drivers/clk/ti/clk-6030.c
>> new file mode 100644
>> index 0000000..61d1834
>> --- /dev/null
>> +++ b/drivers/clk/ti/clk-6030.c
>
> Please change the filename to something like clk-twl6030.c. clk-\d+
> filenames basically denote a SoC under TI clock driver structure.
Ok.
>
>> @@ -0,0 +1,133 @@
>> +/*
>> + * drivers/clk/ti/clk-6030.c
>
> Replace this with some sort of short description instead, see other
> files under drivers/clk/ti. Having an absolute filename here doesn't
> really provide anything.
Ok.
>
>> + *
>> + * Copyright (C) 2014 Stefan Assmann <sassmann-llIHtaV5axyzQB+pC5nmwQ@public.gmane.org>
>> + *
>> + * 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.
>> + *
>> + * Clock driver for TI twl6030.
>> + */
>
> A basic comment about this driver, how about trying to make it more
> generic, as in making it an i2c-clock driver? I guess there are other
> external chips/boards outside twl6030 family that would be interested in
> using it.
I'll look into that.
[...]
>> +static int of_twl6030_clk32kg_probe(struct platform_device *pdev)
>> +{
>> + struct device_node *node = pdev->dev.of_node;
>> + struct clk *clk;
>> +
>> + if (!node)
>> + return -ENODEV;
>> +
>> + clk = devm_clk_get(&pdev->dev, "clk32kg");
>> + if (IS_ERR(clk))
>> + return PTR_ERR(clk);
>> +
>> + return clk_prepare(clk);
>
> This is plain wrong as pointed out earlier. The driver that uses the
> clock must enable it.
Understood. I'll change it to clk_prepare_enable().
[...]
>> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
>> index db11b4f..440fe4e 100644
>> --- a/drivers/mfd/twl-core.c
>> +++ b/drivers/mfd/twl-core.c
>> @@ -34,6 +34,7 @@
>> #include <linux/platform_device.h>
>> #include <linux/regmap.h>
>> #include <linux/clk.h>
>> +#include <linux/clk-provider.h>
>> #include <linux/err.h>
>> #include <linux/device.h>
>> #include <linux/of.h>
>> @@ -1012,6 +1013,8 @@ static void clocks_init(struct device *dev,
>> u32 rate;
>> u8 ctrl = HFCLK_FREQ_26_MHZ;
>>
>> + of_clk_init(NULL);
>> +
>
> Don't do this please, this is horrible. of_clk_init or alternatives
> should be called from board/SoC specific context, otherwise you end up
> calling the init functions multiple times. If you are facing an issue
> that TI boards do not initialize external clocks properly currently,
> this is because TI clock driver does its init hierarchically and does
> not parse the whole DT for clock nodes. I have an experimental patch
> available I can post for you to try out which provides external clock
> support on TI boards if you like.
If you could provide that patch that'll be great.
Thanks for the comments Tero.
Stefan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-07-31 11:58 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-30 14:02 [PATCH 0/2] Enable wifi on pandaboard Stefan Assmann
2014-07-30 14:02 ` Stefan Assmann
2014-07-30 14:02 ` [PATCH 1/2] mfd: twl-core: move TWL6030 defines to twl.h Stefan Assmann
2014-07-30 14:02 ` Stefan Assmann
2014-07-31 8:36 ` Lee Jones
2014-07-31 8:36 ` Lee Jones
2014-07-31 8:46 ` Stefan Assmann
2014-07-31 8:46 ` Stefan Assmann
2014-07-30 14:02 ` [PATCH 2/2] clk: initial clock driver for TWL6030 Stefan Assmann
2014-07-30 14:02 ` Stefan Assmann
2014-07-30 14:29 ` Andreas Färber
2014-07-30 14:29 ` Andreas Färber
2014-07-30 14:36 ` Stefan Assmann
2014-07-30 14:36 ` Stefan Assmann
2014-07-30 17:50 ` Mark Brown
2014-07-30 17:50 ` Mark Brown
2014-07-31 9:56 ` Stefan Assmann
2014-07-31 9:56 ` Stefan Assmann
2014-07-31 11:05 ` Mark Brown
2014-07-31 11:05 ` Mark Brown
2014-07-31 12:04 ` Stefan Assmann
2014-07-31 12:04 ` Stefan Assmann
2014-07-31 19:14 ` Mike Turquette
2014-07-31 19:14 ` Mike Turquette
2014-07-31 11:28 ` Tero Kristo
2014-07-31 11:28 ` Tero Kristo
2014-07-31 11:58 ` Stefan Assmann [this message]
2014-07-31 11:58 ` Stefan Assmann
2014-07-31 13:16 ` Tero Kristo
2014-07-31 13:16 ` Tero Kristo
2014-07-31 12:26 ` Peter Ujfalusi
2014-07-31 12:26 ` Peter Ujfalusi
2014-07-31 12:54 ` Stefan Assmann
2014-07-31 12:54 ` Stefan Assmann
2014-07-31 12:58 ` Peter Ujfalusi
2014-07-31 12:58 ` Peter Ujfalusi
2014-07-31 14:05 ` Stefan Assmann
2014-07-31 14:05 ` Stefan Assmann
2014-07-31 19:20 ` Mike Turquette
2014-07-31 19:20 ` Mike Turquette
2014-08-01 10:04 ` Stefan Assmann
2014-08-01 10:04 ` Stefan Assmann
2014-08-01 10:38 ` Mark Brown
2014-08-01 10:38 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53DA2F53.8010405@kpanic.de \
--to=sassmann@kpanic.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.