From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 1/1] lib: utils: identify supported GPIO reset methods
Date: Thu, 30 Sep 2021 12:29:20 +0200 [thread overview]
Message-ID: <90c95c0f-ece1-91e2-3202-abe01542b6ff@canonical.com> (raw)
In-Reply-To: <CAAhSdy0nhv5B4DUFEr+OB68z7w7ZmqYoQDoBJ6jz3MK2mxD+OQ@mail.gmail.com>
On 9/29/21 14:38, Anup Patel wrote:
> On Wed, Sep 29, 2021 at 12:31 PM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>>
>>
>> On 9/29/21 6:16 AM, Anup Patel wrote:
>>> +Nikita
>>>
>>> On Tue, Sep 28, 2021 at 5:13 PM Heinrich Schuchardt
>>> <heinrich.schuchardt@canonical.com> wrote:
>>>>
>>>> The GPIO reset driver supports reset and poweroff. But not all boards
>>>> support both. gpio_system_reset_check() must detect this situation.
>>>>
>>>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>>>
>>> Looks good to me.
>>>
>>> Reviewed-by: Anup Patel <anup.patel@wdc.com>
>>>
>>> I had mentioned on the PMIC reset series that we need to improve
>>> the sbi_system.h device registration such that reset drivers can
>>> register a reset device for a range of reset types. This will allow
>>> separate reset drivers (e.g. PMIC+GPIO) for SiFive Unmatched.
>>> Also, reset_check() callback will not be required anymore.
>>
>> Hello Anup,
>>
>> thanks for reviewing.
>>
>> Currently we keep a list of drivers in a static array. As we are
>> acquiring more and drivers I would like to move to linker generated
>> lists as Linux and U-Boot use the for enumerating drivers.
>>
>> So a driver could look like:
>>
>> int drv1_check(unsigned int type, unsigned int reason) {...}
>>
>> void drv1_reset(unsigned int type, unsigned int reason) {...}
>>
>> SRST_DRIVER(drv1) = {
>> .name = "driver_1",
>> .check = drv1_check,
>> .reset = drv1_reset,
>> };
>>
>> The linker will create a list of all SRST_DRIVER() instances over which
>> we can iterate in our code.
>>
>> Does this make sense to you?
>>
>> Example code is available in
>> https://github.com/xypron/linker_generated_lists
>
> I certainly like the Linker list approach. In fact, I have
> implemented something similar in-past for Xvisor built-in
> modules.
>
> We can go ahead with Linker list approach with
> following considerations:
> 1) The generic SBI library (i.e lib/sbi and include/sbi/
> directories) should not use linker list because we have
> couple of projects (e.g. Microchip HSS and EDK2)
> which directly link with the OpenSBI generic library
> instead of using OpenSBI firmwares.
The platform specification requires:
"the UEFI ResetSystem() service must be implemented via the SBI System
Reset Extension."
Is this compatible with linking part of SBI as a library but excluding
reset drivers?
> 2) This should only impact FDT based drivers in
> SBI utils (i.e. lib/utils and include/sbi_utils directories).
>
> Basically, all FDT based driver frameworks under
> lib/utils can happily move to the Linker list approach
> so that we don't have to maintain various xyz_drivers[]
> arrays across different FDT based driver frameworks.
>
> Agree ??
While trying to implement the linker list for OpenSBI I ran into some
problem with the linker:
https://sourceware.org/bugzilla/show_bug.cgi?id=28398
So I would suggest we start by converting the interface using an array.
Best regards
Heinrich
>
> Regards,
> Anup
>
next prev parent reply other threads:[~2021-09-30 10:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 11:42 [PATCH 1/1] lib: utils: identify supported GPIO reset methods Heinrich Schuchardt
2021-09-29 4:16 ` Anup Patel
2021-09-29 7:01 ` Heinrich Schuchardt
2021-09-29 12:38 ` Anup Patel
2021-09-30 10:29 ` Heinrich Schuchardt [this message]
2021-09-30 13:13 ` Anup Patel
2021-09-29 9:14 ` Nikita Shubin
2021-09-29 12:03 ` Heinrich Schuchardt
2021-10-01 4:58 ` Anup Patel
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=90c95c0f-ece1-91e2-3202-abe01542b6ff@canonical.com \
--to=heinrich.schuchardt@canonical.com \
--cc=opensbi@lists.infradead.org \
/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