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 21:18:07 +0200	[thread overview]
Message-ID: <3c3a7e31-e9b5-0cc9-518f-b3e2c3a11fa3@gmail.com> (raw)
In-Reply-To: <TYBPR01MB5309F3DE4629C953C54FF9C7863C0@TYBPR01MB5309.jpnprd01.prod.outlook.com>

On 9/19/20 8:35 PM, Biju Das wrote:

Hi,

[...]

>>>>> +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 ?
>>>
>>> No.  I have seen some other SoC's uses similar logic [1]& [2] .
>>
>> I mean, this looks like Linux's soc_device_match() , so such a function is likely
>> generic code, there is nothing platform specific to it, is there ?
> 
> I agree, we need to have a new generic api for such purpose. The Linux/U-boot soc_device_match  is for adding quirks with in different ES version of same SoC.
> 
> What we here need is similar to of_match_compatible for  array of different SoC's.
> Can you please confirm  [1] drivers/soc/soc-uclass.c is the right place for such generic api?

Can you use of_machine_is_compatible() ?

[...]

>>>  So can you please check whether there might
>>>> be some way to tell the two SoCs apart ?
>>>
>>> At present there is no way other than matching the SoC compatible string.
>>
>> Thinking about it a bit more, if you were to use the compatible string psssed
>> from TFA in the / node, you could iterate over soc_ids[] array and return
>> RMOBILE_CPU_TYPE_x , which could be stored there as .data .
>> Then you won't even need the SOC_RZG2 and it would all be faster, as all you
>> would need is a single pass over a smaller array.
> 
> Good point. Ok will get rid of SOC_RZG2,  will use smaller array forRZG2.
> 
> Are you suggesting to modify "arch_misc_init" directly set "platform" environment variable using match logic, which use a smaller array
> Compared to rmobile_cpuinfo.
> 
> Basically we match the compatible string from TFA, .data from " RMOBILE_CPU_TYPE_x" matched against PRR values and set the platform type .

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 ?

  reply	other threads:[~2020-09-19 19:18 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 [this message]
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=3c3a7e31-e9b5-0cc9-518f-b3e2c3a11fa3@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