[U-Boot] Device cleanup before starting OS (Linux)

Simon Glass sjg at chromium.org
Fri Mar 3 04:53:03 UTC 2017


Hi Stefan,

On 28 February 2017 at 22:52, Stefan Roese <sr at denx.de> wrote:
> Hi Simon,
>
> On 01.03.2017 06:40, Simon Glass wrote:
>> On 28 February 2017 at 09:32, Stefan Roese <sr at denx.de> wrote:
>>>
>>> Hi!
>>>
>>> I'm currently trying to add some code to stop (DMA) buffer usage
>>> in the Marvell mvpp2 ethernet driver, that should only be
>>> executed once, before the OS is started - stop() does not work
>>> easily for me here. I've found the weak function
>>> "board_quiesce_devices()", which is already used for
>>> such cases. But since you are not fond of weak functions
>>> (I totally agree here, this is far from perfect) and already
>>> suggested some kind of "finalize" DM API call, I'm wondering
>>> if I should introduce this new API call for such cases and use
>>> it in the ethernet driver.
>>>
>>> So what is your opinion about this? Should I add such a
>>> finalize DM function and call it from the arch/.../bootm
>>> code? Or do you have other suggestions on how to handle
>>> such driver specific last-stage (pre OS) calls?
>>
>> Is it possible to use the device's remove() method?
>
> I also thought about this of course. Using remove has the
> following disadvantages, that I currently can think of:
>
> - The remove functions of all devices are called, adding
>   to the bootup time

This seems fairly convincing to me, although I'd be interested to see
if the actual impact is noticeable (e.g. >1ms).

>
> - Since all devices are removed, serial (and other) output
>   is not available (for debug purposes) any more

This seems a lot more convincing.

>
> It should be possible to add a DM flag to enable this pre-OS
> device remove, which could be enabled on a per-device basis.
> This way we don't need another API function. But still I
> need to hook this pre-OS "remove" into arch/.../bootm.
>
> What do you think?

I'll reply on the patches.

>
> Thanks,
> Stefan

Regards,
Simon


More information about the U-Boot mailing list