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: Sat, 19 Sep 2020 04:47:47 +0200	[thread overview]
Message-ID: <c20eed11-742f-7375-2bfb-ed2d38d460a0@gmail.com> (raw)
In-Reply-To: <20200918160307.14323-1-biju.das.jz@bp.renesas.com>

On 9/18/20 6:03 PM, Biju Das wrote:
> Add CPU and PRR IDs for R8A774A1(a.k.a RZ/G2M) SoC.

[...]

> +static const struct udevice_id *of_soc_match_compatible(void)
> +{
> +	const struct udevice_id *of_match = soc_ids;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(soc_ids); i++) {
> +		if (!fdt_node_check_compatible(gd->fdt_blob, 0,
> +					       of_match->compatible))
> +			return of_match;
> +		of_match++;
> +	}
> +
> +	return NULL;
> +}

This should rather be a generic function, I think this is something that
already exists in Linux common code too, right ?

>  static int rmobile_cpuinfo_idx(void)
>  {
>  	int i = 0;
>  	u32 cpu_type = rmobile_get_cpu_type();
> +	const struct udevice_id *match = of_soc_match_compatible();
>  
> +	/*
> +	 * This loop identifies CPU based on PRR register, it differentiates
> +	 * RZ/G SoC's from R-Car SoC's by matching RZ/G SoC compatible string
> +	 * from DT against the family_type.
> +	 */
>  	for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++)
> -		if (rmobile_cpuinfo[i].cpu_type == cpu_type)
> -			break;
> +		if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
> +			if (match &&
> +			    rmobile_cpuinfo[i].family_type == match->data)
> +				break;
> +			else if (!match &&
> +				 rmobile_cpuinfo[i].family_type != SOC_RZG2)
> +				break;
> +		}

I still don't understand this, so if cpu_type ==
RMOBILE_CPU_TYPE_R8A7796 , then it can be either RZG2 or R8A7796, right?
And there is no PRR bit or any other bit to tell those two chips apart ?

I would like to avoid using the OF match here, because that fails if you
use MULTI_DTB_FIT , does it not ? So can you please check whether there
might be some way to tell the two SoCs apart ?

  parent reply	other threads:[~2020-09-19  2:47 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 ` Marek Vasut [this message]
2020-09-19 11:37   ` [PATCH 1/2] arm: rmobile: Add RZ/G2M SoC 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
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=c20eed11-742f-7375-2bfb-ed2d38d460a0@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