From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 2/2] ARM: shmobile: Add support SOC_BUS to R-Car Gen2
Date: Thu, 12 Feb 2015 07:36:08 +0000 [thread overview]
Message-ID: <54DC57E8.4040507@renesas.com> (raw)
In-Reply-To: <1423186389-12861-2-git-send-email-nobuhiro.iwamatsu.yj@renesas.com>
Hi,
Thanks for your review.
(2015/02/10 17:53), Geert Uytterhoeven wrote:
> Hi Iwamatsu-san,
>
> On Fri, Feb 6, 2015 at 2:33 AM, Nobuhiro Iwamatsu
> <nobuhiro.iwamatsu.yj@renesas.com> wrote:
>> This provides information through SOC_BUS to sysfs.
>
> Thanks for your patch!
>
>> diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> index 2230948..0fa3ef8 100644
>> --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
>> +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
>
>> @@ -204,19 +206,53 @@ void __init rcar_gen2_reserve(void)
>> }
>>
>> #define PRR 0xFF000044
>> -static unsigned int __init rcar_gen2_get_revision(void)
>> +static unsigned int __init rcar_gen2_get_prr(void)
>> {
>> void __iomem *addr = ioremap_nocache(PRR, 4);
>> u32 data = ioread32(addr);
>>
>> iounmap(addr);
>>
>> - return ((data& 0xF0)>> 4) + 1;
>> + return data;
>> +}
>> +
>> +static unsigned int __init rcar_gen2_get_revision(void)
>> +{
>> + return ((rcar_gen2_get_prr()& 0xF0)>> 4) + 1;
>
> As the PRR register value doesn't change, and it's only 32-bit, I would
> read it once and store it for later use, to avoid the overhead of repeated
> ioremap() calls.
>
>> +}
>> +
>> +static u32 __init rcar_gen2_get_cpuid(void)
>> +{
>> + return (rcar_gen2_get_prr()& 0x7F00)>> 8;
>
> Likewise.
>
I see. I will fix.
>> }
>>
>> void __init rcar_gen2_init_machine(void)
>> {
>> + struct soc_device_attribute *soc_dev_attr;
>> + struct soc_device *soc_dev;
>> + struct device *parent = NULL;
>> +
>> + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
>> + if (!soc_dev_attr)
>> + goto out;
>> +
>> system_rev = rcar_gen2_get_revision();
>
> The above shows up (in hex) in /proc/cpuinfo as (for ES1.0)
>
> Revision: 0001
>
> As per the comment on your previous patch, I think it would be better to
> have "0010" for ES1.0.
>
>> - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
>> + soc_dev_attr->family = kasprintf(GFP_KERNEL, "Renesas R-Car Gen2");
>> + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", system_rev);
>
> Likewise:
>
> soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%u.%u",
> system_rev>> 4, system_rev& 0xf);
>
>> + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%04x",
>> + rcar_gen2_get_cpuid());
>
Ok, I will fix.
> On my Koelsch with R-Car M2-W ES1.0, this gives:
> /sys/devices/soc0/family : Renesas R-Car Gen2
> /sys/devices/soc0/revision : 1
> /sys/devices/soc0/soc_id : 0047
>
> Should we fill in the soc_device_attribute.machine field, too?
>
I see. I will add machine field.
>> +
>> + soc_dev = soc_device_register(soc_dev_attr);
>> + if (IS_ERR(soc_dev)) {
>> + kfree(soc_dev_attr->family);
>> + kfree(soc_dev_attr->revision);
>> + kfree(soc_dev_attr->soc_id);
>> + kfree(soc_dev_attr);
>> + goto out;
>> + }
>> +
>> + parent = soc_device_to_device(soc_dev);
>> +out:
>> + of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
>
> The above change moves all on-SoC devices from /sys/devices/platform/
> to /sys/devices/soc0/. I think it's worth adding that to the patch description.
I see. I will add more descriptin.
>
> Gr{oetje,eeting}s,
>
> Geert
Best regards,
Nobuhiro
prev parent reply other threads:[~2015-02-12 7:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 1:33 [PATCH 2/2] ARM: shmobile: Add support SOC_BUS to R-Car Gen2 Nobuhiro Iwamatsu
2015-02-10 8:53 ` Geert Uytterhoeven
2015-02-12 7:36 ` Nobuhiro Iwamatsu [this message]
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=54DC57E8.4040507@renesas.com \
--to=nobuhiro.iwamatsu.yj@renesas.com \
--cc=linux-sh@vger.kernel.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.