From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
To: linux-sh@vger.kernel.org
Subject: Re: [RFC/PATCH] ARM: shmobile: Consolidate the pm code for R-Car Gen2
Date: Mon, 16 Mar 2015 04:30:43 +0000 [thread overview]
Message-ID: <55065C73.3040508@bp.renesas.com> (raw)
In-Reply-To: <5502A268.2030304@bp.renesas.com>
Hi Geert-san,
Thank you for your feedback.
On 2015/03/13 18:39, Geert Uytterhoeven wrote:
> Hi Inami-san,
>
> On Fri, Mar 13, 2015 at 9:40 AM, Gaku Inami
> <gaku.inami.xw@bp.renesas.com> wrote:
< snip >
>> --- /dev/null
>> +++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c
>> @@ -0,0 +1,114 @@
>> +/*
>> + * R-Car Generation 2 Power management support
>> + *
>> + * Copyright (C) 2015 Renesas Electronics Corporation
> Please retain the original copyrights from pm-r8a779[01].c here, too.
I will fix it with v2 patch.
>> +#if defined(CONFIG_SMP)
>> +
>> +static void __init rcar_gen2_sysc_init(void)
>> +{
>> + u32 val;
>> + void __iomem *base = rcar_sysc_init(0xe6180000);
>> +
>> + if (of_machine_is_compatible("renesas,r8a7790"))
>> + val = 0x013111ef;
>> + else if (of_machine_is_compatible("renesas,r8a7791"))
>> + val = 0x00111003;
> As you do SoC OF matching in rcar_gen2_pm_init() too, perhaps "val" should
> be passed from that function? That would save a few of_machine_is_compatible()
> lookups.
I will pass the value of SYSCIER from rcar_gen2_pm_init().
>
>> +
>> + /* enable all interrupt sources, but do not use interrupt handler */
>> + iowrite32(val, base + SYSCIER);
>> + iowrite32(0, base + SYSCIMR);
>> +}
>> +
>> +#else /* CONFIG_SMP */
>> +
>> +static inline void rcar_gen2_sysc_init(void) {}
>> +
>> +#endif /* CONFIG_SMP */
>> +
>> +void __init rcar_gen2_pm_init(void)
>> +{
>> + void __iomem *p;
>> + u32 bar;
>> + static int once;
>> + struct device_node *np, *cpus;
>> + bool is_a7 = false;
>> + bool is_a15 = false;
> I would name these "has_a7" and "has_a15", as both can be true.
I will fix it with v2 patch.
>> + phys_addr_t boot_vector_addr = 0;
>> +
>> + if (once++)
>> + return;
>> +
>> + cpus = of_find_node_by_path("/cpus");
>> + if (!cpus)
>> + return;
>> +
>> + for_each_child_of_node(cpus, np) {
>> + if (of_device_is_compatible(np, "arm,cortex-a15"))
>> + is_a15 = true;
>> + else if (of_device_is_compatible(np, "arm,cortex-a7"))
>> + is_a7 = true;
>> + }
>> +
>> + if (of_machine_is_compatible("renesas,r8a7790"))
>> + boot_vector_addr = MERAM;
>> + else
>> + boot_vector_addr = RAM;
> You could store the SYSCIER value in a variable here:
>
> if (of_machine_is_compatible("renesas,r8a7790")) {
> boot_vector_addr = MERAM;
> syscier = 0x013111ef;
> } else if (of_machine_is_compatible("renesas,r8a7791")) {
> boot_vector_addr = RAM;
> syscier = 0x00111003;
> }
>
> More SoC checks will be added in the future...
>
> If CONFIG_SMP is not set, the compiler will optimize out the assignments
> to syscier.
>
>> + rcar_gen2_sysc_init();
> You could pass syscier here.
It was redundant to call twice of_machine_is_compatible().
I will fix as you mentioned, and then I will post v2 patch.
Regards,
Inami
next prev parent reply other threads:[~2015-03-16 4:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 8:40 [RFC/PATCH] ARM: shmobile: Consolidate the pm code for R-Car Gen2 Gaku Inami
2015-03-13 9:39 ` Geert Uytterhoeven
2015-03-16 4:30 ` Gaku Inami [this message]
2015-03-25 5:45 ` [RFC/PATCH] ARM: shmobile: Consolidate the smp " Gaku Inami
2015-04-01 13:31 ` Geert Uytterhoeven
2015-04-02 8:18 ` Gaku Inami
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=55065C73.3040508@bp.renesas.com \
--to=gaku.inami.xw@bp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).