All of lore.kernel.org
 help / color / mirror / Atom feed
From: padma venkat <padma.kvr@gmail.com>
To: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Padmavathi Venna <padma.v@samsung.com>,
	kgene.kim@samsung.com, linux@arm.linux.org.uk,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	grant.likely@secretlab.ca, jassi Brar <jassisinghbrar@gmail.com>
Subject: Re: [RFC][PATCH 1/2] S5PV210: SPI: Add clkdev support
Date: Wed, 10 Aug 2011 17:34:33 +0530	[thread overview]
Message-ID: <CAAgF-BftGYkZ6aaSZgxd8gk1Zy9-sJEroZcaijd6zN3Qr9MEhQ@mail.gmail.com> (raw)
In-Reply-To: <4E413941.10307@samsung.com>

Hi Sylwester,

On Tue, Aug 9, 2011 at 7:12 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> [corrected Jassi's email address]
>
> On 08/09/2011 03:57 PM, Padmavathi Venna wrote:
>> Create a clkdev alias for spi bus clock and modify the spi
>> driver to lookup the clock using the alias name instead of
>> passing clock name and clock number from SPI platform data.
>>
>> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
>> ---
>> This patch is tested for S5PV210 platform and similar
>> changes can be adopted for rest of the Samsung's s3c
>> and s5p platforms, if this approach is accepted.
>
> It is a bit surprising to me how you do intend to use the clock aliases.
> Are we seriously going to be creating clock con_id aliases for most
> of the available devices ? It doesn't sound sane to me..
We don't need to create the alias names for all the devices. But we need
to create only for those which need clock information from platform data.
As far as I know we need to create for spi,hsmmc,uart and iis.
>
> Wouldn't it be possible to avoid the aliases by correcting the clock
> registration process ?
Yes it is possible but we don't have the flexibility to create the alias names
only for the required clocks.
>
>>  arch/arm/mach-s5pv210/dev-spi.c                  |   31 ++++++++++++++++++---
>>  arch/arm/plat-samsung/include/plat/s3c64xx-spi.h |    7 +----
>>  2 files changed, 27 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm/mach-s5pv210/dev-spi.c b/arch/arm/mach-s5pv210/dev-spi.c
> ...
>> -void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>> +void __init s5pv210_spi_set_info(int cntrlr, int num_cs)
>>  {
>>       struct s3c64xx_spi_info *pd;
>> +     struct device *dev;
>> +     char devname[16], clk_alias_name[16];
>> +     int ret, i;
>>
>>       /* Reject invalid configuration */
>> -     if (!num_cs || src_clk_nr < 0
>> -                     || src_clk_nr > S5PV210_SPI_SRCCLK_SCLK) {
>> +     if (!num_cs) {
>>               printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
>>               return;
>>       }
>> @@ -159,9 +162,11 @@ void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>>       switch (cntrlr) {
>>       case 0:
>>               pd = &s5pv210_spi0_pdata;
>> +             dev = &s5pv210_device_spi0.dev;
>>               break;
>>       case 1:
>>               pd = &s5pv210_spi1_pdata;
>> +             dev = &s5pv210_device_spi1.dev;
>>               break;
>>       default:
>>               printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
>> @@ -169,7 +174,23 @@ void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>>               return;
>>       }
>>
>> +     sprintf(devname, "s3c64xx-spi.%d", cntrlr);
>> +
>> +     for (i = 0; i < ARRAY_SIZE(spi_src_clks); i++) {
>> +             sprintf(clk_alias_name, "clk_spi_bus%d", i);
>> +
>> +             if (!strcmp(spi_src_clks[i], "pclk"))
>> +                     ret = clk_add_alias(clk_alias_name, devname,
>> +                                             spi_src_clks[i], NULL);
>> +             else
>> +                     ret = clk_add_alias(clk_alias_name, devname,
>> +                                             spi_src_clks[i], dev);
>> +             if (ret) {
>> +                     printk(KERN_ERR "failed to create alias for"
>> +                             " SPI%d source clock%d\n", cntrlr, i);
>> +                     continue;
>> +             }
>> +     }
>> +
>>       pd->num_cs = num_cs;
>> -     pd->src_clk_nr = src_clk_nr;
>> -     pd->src_clk_name = spi_src_clks[src_clk_nr];
>>  }
> ...
>
> --
> Thanks,
> Sylwester
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

WARNING: multiple messages have this Message-ID (diff)
From: padma.kvr@gmail.com (padma venkat)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH 1/2] S5PV210: SPI: Add clkdev support
Date: Wed, 10 Aug 2011 17:34:33 +0530	[thread overview]
Message-ID: <CAAgF-BftGYkZ6aaSZgxd8gk1Zy9-sJEroZcaijd6zN3Qr9MEhQ@mail.gmail.com> (raw)
In-Reply-To: <4E413941.10307@samsung.com>

Hi Sylwester,

On Tue, Aug 9, 2011 at 7:12 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> [corrected Jassi's email address]
>
> On 08/09/2011 03:57 PM, Padmavathi Venna wrote:
>> Create a clkdev alias for spi bus clock and modify the spi
>> driver to lookup the clock using the alias name instead of
>> passing clock name and clock number from SPI platform data.
>>
>> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
>> ---
>> This patch is tested for S5PV210 platform and similar
>> changes can be adopted for rest of the Samsung's s3c
>> and s5p platforms, if this approach is accepted.
>
> It is a bit surprising to me how you do intend to use the clock aliases.
> Are we seriously going to be creating clock con_id aliases for most
> of the available devices ? It doesn't sound sane to me..
We don't need to create the alias names for all the devices. But we need
to create only for those which need clock information from platform data.
As far as I know we need to create for spi,hsmmc,uart and iis.
>
> Wouldn't it be possible to avoid the aliases by correcting the clock
> registration process ?
Yes it is possible but we don't have the flexibility to create the alias names
only for the required clocks.
>
>> ?arch/arm/mach-s5pv210/dev-spi.c ? ? ? ? ? ? ? ? ?| ? 31 ++++++++++++++++++---
>> ?arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | ? ?7 +----
>> ?2 files changed, 27 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm/mach-s5pv210/dev-spi.c b/arch/arm/mach-s5pv210/dev-spi.c
> ...
>> -void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>> +void __init s5pv210_spi_set_info(int cntrlr, int num_cs)
>> ?{
>> ? ? ? struct s3c64xx_spi_info *pd;
>> + ? ? struct device *dev;
>> + ? ? char devname[16], clk_alias_name[16];
>> + ? ? int ret, i;
>>
>> ? ? ? /* Reject invalid configuration */
>> - ? ? if (!num_cs || src_clk_nr < 0
>> - ? ? ? ? ? ? ? ? ? ? || src_clk_nr > S5PV210_SPI_SRCCLK_SCLK) {
>> + ? ? if (!num_cs) {
>> ? ? ? ? ? ? ? printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
>> ? ? ? ? ? ? ? return;
>> ? ? ? }
>> @@ -159,9 +162,11 @@ void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>> ? ? ? switch (cntrlr) {
>> ? ? ? case 0:
>> ? ? ? ? ? ? ? pd = &s5pv210_spi0_pdata;
>> + ? ? ? ? ? ? dev = &s5pv210_device_spi0.dev;
>> ? ? ? ? ? ? ? break;
>> ? ? ? case 1:
>> ? ? ? ? ? ? ? pd = &s5pv210_spi1_pdata;
>> + ? ? ? ? ? ? dev = &s5pv210_device_spi1.dev;
>> ? ? ? ? ? ? ? break;
>> ? ? ? default:
>> ? ? ? ? ? ? ? printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
>> @@ -169,7 +174,23 @@ void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
>> ? ? ? ? ? ? ? return;
>> ? ? ? }
>>
>> + ? ? sprintf(devname, "s3c64xx-spi.%d", cntrlr);
>> +
>> + ? ? for (i = 0; i < ARRAY_SIZE(spi_src_clks); i++) {
>> + ? ? ? ? ? ? sprintf(clk_alias_name, "clk_spi_bus%d", i);
>> +
>> + ? ? ? ? ? ? if (!strcmp(spi_src_clks[i], "pclk"))
>> + ? ? ? ? ? ? ? ? ? ? ret = clk_add_alias(clk_alias_name, devname,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? spi_src_clks[i], NULL);
>> + ? ? ? ? ? ? else
>> + ? ? ? ? ? ? ? ? ? ? ret = clk_add_alias(clk_alias_name, devname,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? spi_src_clks[i], dev);
>> + ? ? ? ? ? ? if (ret) {
>> + ? ? ? ? ? ? ? ? ? ? printk(KERN_ERR "failed to create alias for"
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? " SPI%d source clock%d\n", cntrlr, i);
>> + ? ? ? ? ? ? ? ? ? ? continue;
>> + ? ? ? ? ? ? }
>> + ? ? }
>> +
>> ? ? ? pd->num_cs = num_cs;
>> - ? ? pd->src_clk_nr = src_clk_nr;
>> - ? ? pd->src_clk_name = spi_src_clks[src_clk_nr];
>> ?}
> ...
>
> --
> Thanks,
> Sylwester
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2011-08-10 12:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 13:57 [RFC][PATCH 1/2] S5PV210: SPI: Add clkdev support Padmavathi Venna
2011-08-09 13:57 ` Padmavathi Venna
2011-08-09 13:57 ` Padmavathi Venna
2011-08-09 13:42 ` Sylwester Nawrocki
2011-08-09 13:42   ` Sylwester Nawrocki
2011-08-10 12:04   ` padma venkat [this message]
2011-08-10 12:04     ` padma venkat
2011-08-10 12:59     ` Sylwester Nawrocki
2011-08-10 12:59       ` Sylwester Nawrocki

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=CAAgF-BftGYkZ6aaSZgxd8gk1Zy9-sJEroZcaijd6zN3Qr9MEhQ@mail.gmail.com \
    --to=padma.kvr@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=jassisinghbrar@gmail.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=padma.v@samsung.com \
    --cc=s.nawrocki@samsung.com \
    /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.