public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] arm: rmobile: Add RZ/G2M SoC
Date: Mon, 21 Sep 2020 18:23:44 +0200	[thread overview]
Message-ID: <583b789e-3c39-f354-a33d-d6ca54ec81ce@gmail.com> (raw)
In-Reply-To: <TYBPR01MB5309557157A3C16C4C84F4F5863A0@TYBPR01MB5309.jpnprd01.prod.outlook.com>

On 9/21/20 12:30 PM, Biju Das wrote:

[...]

>> I don't think you need to modify anything then, the DT passed from TFA
>> would contain the correct compatible string in / node, and that gets merged
>> into the U-Boot control DT early on in fdtdec_board_setup() in:
>> board/renesas/rcar-common/common.c
>> so all you would have to do is use
>> of_machine_is_compatible("renesas,r8a7-something-");
>>
>> Would that work ?
> 
> 
> Yes, I have added the below function to get cpu name from small array tfa_cpu_table. Will send V3 with this changes.
> 
> +static const u8* get_cpu_name(void)
> +{
> +u32 cpu_type = rmobile_get_cpu_type();
> +
> +return is_tfa_soc_match(cpu_type) ?
> +tfa_cpuinfo[tfa_cpuinfo_idx(cpu_type)].cpu_name :
> +rmobile_cpuinfo[rmobile_cpuinfo_idx(cpu_type)].cpu_name;
> +}
> 
> +static int tfa_cpuinfo_idx(u32 cpu_type)
> +{
> +int i = 0;
> +
> +for (; i < ARRAY_SIZE(tfa_cpuinfo); i++)
> +if (tfa_cpuinfo[i].cpu_type == cpu_type)
> +break;
> +
> +return i;
> +}
> +
> +static bool is_tfa_soc_match(u32 cpu_type)
> +{
> +int idx = tfa_cpuinfo_idx(cpu_type);
> +
> +if (idx != ARRAY_SIZE(tfa_cpuinfo) &&
> +    of_machine_is_compatible(tfa_cpuinfo[idx].compatible))
> +return true;
> +
> +return false;
> +}

There might be even better way. Look at rmobile_get_cpu_type() , that is
a weak function. So if you can implement one for RZG2 , then that
function can return CPU_TYPE_RZG2_something ; and rmobile_get_cpu_type()
for RZG2 can be implemented using the match on /compatible string .

Take a look at how arch/arm/mach-rmobile/cpu_info-rcar.c implements it
using PRR, you might need cpu_info-rzg.c I think.

Also, I hope there should already be some function to which you provide
a compatible string and a table of supported compatible strings (of
match table), from which it will return the .data field of the matching
entry in that table. And that .data field can already be the
CPU_TYPE_RZG_something , so you don't have to implement the table look
up again.

What do you think ?

  reply	other threads:[~2020-09-21 16:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 16:03 [PATCH 1/2] arm: rmobile: Add RZ/G2M SoC Biju Das
2020-09-18 16:03 ` [PATCH 2/2] arm: rmobile: Add HopeRun HiHope RZ/G2M board support Biju Das
2020-09-19  2:48   ` Marek Vasut
2020-09-19 12:18     ` Biju Das
2020-09-19 13:04       ` Marek Vasut
2020-09-19 18:38         ` Biju Das
2020-09-19 19:18           ` Marek Vasut
2020-09-19  2:47 ` [PATCH 1/2] arm: rmobile: Add RZ/G2M SoC Marek Vasut
2020-09-19 11:37   ` Biju Das
2020-09-19 13:00     ` Marek Vasut
2020-09-19 18:35       ` Biju Das
2020-09-19 19:18         ` Marek Vasut
2020-09-21 10:30           ` Biju Das
2020-09-21 16:23             ` Marek Vasut [this message]
2020-09-21 17:29               ` Biju Das
2020-09-22  6:08                 ` Biju Das
2020-09-22 11:11                   ` Biju Das
2020-09-22 13:11                 ` Marek Vasut

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=583b789e-3c39-f354-a33d-d6ca54ec81ce@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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