All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC v2 2/2] arm64: zynqmp: spl: install a PMU firmware config object at runtime
Date: Thu, 4 Apr 2019 09:52:12 +0200	[thread overview]
Message-ID: <c2189563-a845-5a79-3b9c-f98da4bdd516@lucaceresoli.net> (raw)
In-Reply-To: <7fa2f917-7b8e-a6ee-3629-0405b9e0bef9@xilinx.com>

Hi Mike, Michal,

On 04/04/19 08:49, Michal Simek wrote:
[...]
>>>>>>> +#ifdef ZYNQMP_LOAD_PM_CFG_OBJ
>>>>>>> +#include CONFIG_ZYNQMP_LOAD_PM_CFG_OBJ_FILE
>>>>>>> +#endif
>>>>>>> +
>>>>>>>    int board_early_init_f(void)
>>>>>>>    {
>>>>>>>    	int ret = 0;
>>>>>>> @@ -332,6 +338,11 @@ int board_early_init_f(void)
>>>>>>>    
>>>>>>>    int board_init(void)
>>>>>>>    {
>>>>>>> +#if defined(CONFIG_SPL_BUILD) && defined(ZYNQMP_LOAD_PM_CFG_OBJ)
>>>>>>> +	zynqmp_pmufw_load_config_object(XPm_ConfigObject,
>>>>>>> +					sizeof(XPm_ConfigObject));
>>>>>>> +#endif
>>>>>>
>>>>>> As we discussed over IRC. I think that this should be simply bin
>>>>>> firmware file compare to C built by u-boot.
>>>>>
>>>>> Sure. I have a working prototype that uses a binary blob. It still needs
>>>>> a decent way to produce a blob and to be updated according to your review.
>>>>
>>>> It should be doable to write a Python script to parse the C file and create an
>>>> equivalent binary (using "struct" module) which is just an array of integers
>>>> in the end. That avoids the need for a microblaze C compiler...
>>>
>>> There's no need for a microblaze compiler. pm_cfg_obj.c is simply
>>> declaring a u32 array and some #defines, any C compiler is enough.
>>>
>>> That said, my current solution (a trivial main.c that compiles the u32
>>> array and outputs it to a binary file) is not nice at all, and it
>>> requires a pm_defs.h file.
>>>
>>> The python script you mention looks way better from a user perspective,
>>> although the parsing might be a bit fragile. I'll consider it, thanks
>>> for the suggestion.
>>>
>>> In the past I even prototyped a python script that parses the Vivado
>>> .xpr project file and produces a pm_cfg_obj.c. It avoided the need to
>>> run the Xilinx XSDK just to generate pm_cfg_obj.c. It might also be
>>> extended to produce a .bin directly, or a self-standing .c file that
>>> doesn't need pm_defs.h, thus removing any licensing issue. But it never
>>> grew complete to handle all cases. Obvious, since *I* don't even know
>>> all of the cases. :)
>>
>>
>> Another approach would be to simply create and include a "god mode" config 
>> object that just allows access to all periferals. As far as I can see, such a 
>> config object would just work on all boards. There's nothing really board 
>> specific in the config object, and it's rather lame anyway to have to go and 
>> compile a new bootloader just because you want to use a SPI controller...
>>
>> The config object I compile into the pmu firmware is of that type anyway.

Oh, that's interesting, but read below.

> Most of that stuff should be the same for all boards. But there are some
> stuff which can be just board specific.

Mike, I think Michal refers to boards like Ultra96 which need special
GPIO handling for their boot sequence, whose pm_cfg_obj.c have a final
section similar to this:

	/* GPO SECTION */
	PM_CONFIG_GPO_SECTION_ID,		/* GPO Section ID */
	PM_CONFIG_GPO1_BIT_2_MASK |
	PM_CONFIG_GPO1_MIO_PIN_34_MAP |
	0,					/* State of GPO pins */

I suspect a "god mode" config cannot handle such cases.

-- 
Luca

  reply	other threads:[~2019-04-04  7:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 15:48 [U-Boot] [RFC v2 0/2] arm64: zynqmp: pass a PMUFW config object Luca Ceresoli
2019-03-21 15:48 ` [U-Boot] [RFC v2 1/2] zynqmp: add minimal include files to build a pm_cfg_obj.c Luca Ceresoli
2019-03-27 15:10   ` Michal Simek
2019-03-29 12:23     ` Luca Ceresoli
2019-03-29 16:47       ` Michal Simek
2019-03-21 15:48 ` [U-Boot] [RFC v2 2/2] arm64: zynqmp: spl: install a PMU firmware config object at runtime Luca Ceresoli
2019-03-27 15:03   ` Michal Simek
2019-03-29 12:22     ` Luca Ceresoli
2019-03-29 16:45       ` Michal Simek
2019-04-03 11:24       ` Mike Looijmans
2019-04-03 11:28         ` Michal Simek
2019-04-03 21:18         ` Luca Ceresoli
2019-04-04  5:38           ` Mike Looijmans
2019-04-04  6:49             ` Michal Simek
2019-04-04  7:52               ` Luca Ceresoli [this message]
2019-04-04  7:56                 ` Michal Simek
2019-04-04 10:05                   ` Mike Looijmans

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=c2189563-a845-5a79-3b9c-f98da4bdd516@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --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 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.