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

Stefan Roese sr at denx.de
Wed Mar 1 10:36:55 UTC 2017


Hi Simon,

On 01.03.2017 06:52, Stefan Roese wrote:
> 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
>
> - Since all devices are removed, serial (and other) output
>   is not available (for debug purposes) any more
>
> 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.

I've just sent a small RFC patch series enabling this pre-OS
remove support via DM. It would be great, if you could review
this series and perhaps even ack it, if you are okay with it.

Thanks,
Stefan


More information about the U-Boot mailing list