[PATCH V7 12/15] board: siemens: iot2050: use the named gpio to control the user-button

Simon Glass sjg at chromium.org
Thu Mar 2 00:38:59 CET 2023


Hi Jan,

On Tue, 28 Feb 2023 at 11:21, Jan Kiszka <jan.kiszka at siemens.com> wrote:
>
> From: chao zeng <chao.zeng at siemens.com>
>
> User-button is controlled by the mcu domain gpio number 25.
> But main0 main1 mcu domain all have gpio number 25.
>
> To identify where the gpio is from, Using gpio controll base as the prefix
> to indicate the gpio resource.
>
> Signed-off-by: chao zeng <chao.zeng at siemens.com>
> ---
>  board/siemens/iot2050/board.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>


You might consider having a board note with this sort of information,
e.g. using sysinfo, as using a node name in the code is pretty ugly.

> diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c
> index 57d7009e8c7..2735ae3fb74 100644
> --- a/board/siemens/iot2050/board.c
> +++ b/board/siemens/iot2050/board.c
> @@ -183,7 +183,7 @@ static bool user_button_pressed(void)
>
>         memset(&gpio, 0, sizeof(gpio));
>
> -       if (dm_gpio_lookup_name("25", &gpio) < 0 ||
> +       if (dm_gpio_lookup_name("gpio at 42110000_25", &gpio) < 0 ||
>             dm_gpio_request(&gpio, "USER button") < 0 ||
>             dm_gpio_set_dir_flags(&gpio, GPIOD_IS_IN) < 0)
>                 return false;
> --
> 2.35.3
>

Regards,
Simon


More information about the U-Boot mailing list