Re: help on udoo_neo power up on mainline uboot

Peter Robinson
2021-12-30T14:08:35Z

On Wed, Dec 29, 2021 at 11:07 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Peter and Tommaso,
>
> On Wed, Dec 29, 2021 at 7:38 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> > Yes, according to Peter, the failure comes only during the second call
> > to get_board_value()
>
> I managed to get my Udoo Neo board working again.
>
> With only the change below on top of Peter's series, I can get the
> board version to be printed correctly:
>
> --- a/board/udoo/neo/neo.c
> +++ b/board/udoo/neo/neo.c
> @@ -383,18 +383,13 @@ static char *board_string(void)
> return "UNDEFINED";
> }
>
> -int checkboard(void)
> -{
> - printf("Board: UDOO Neo %s\n", board_string());
> - return 0;
> -}
> -
> int board_late_init(void)
> {
> #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> env_set("board_name", board_string());
> #endif
>
> + printf("Board: UDOO Neo %s\n", board_string());
> return 0;
> }

That works for my Full board. Interestingly in my playing I had got to
similar and had wondered about whether the checkboard function was
needed.

One minor query on the above is it worth assigning the board_string
return to a local variable rather than called the function twice?
Either way feel free to add my RB/TB or let me know if you want me to
send a patch.
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index d374b86b5d..41790df1bf 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -204,6 +204,9 @@ static int get_board_value(void)
r184 = gpio_get_value(IMX_GPIO_NR(4, 13));
r185 = gpio_get_value(IMX_GPIO_NR(4, 0));

+ gpio_free(IMX_GPIO_NR(4, 13));
+ gpio_free(IMX_GPIO_NR(4, 0));
+
/*
* Machine selection -
* Machine r184, r185
@@ -260,8 +263,9 @@ static char *board_string(void)
return "FULL";
case UDOO_NEO_TYPE_EXTENDED:
return "EXTENDED";
+ default:
+ return "UNDEFINED";
}
- return "UNDEFINED";
}

int checkboard(void)
@@ -270,8 +274,15 @@ int checkboard(void)
return 0;
}

+int show_board_info(void)
+{
+ printf("BLAH Board: UDOO Neo %s\n", board_string());
+ return 0;
+}
+
int board_late_init(void)
{
+ printf("Board: UDOO Neo %s\n", board_string());
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
env_set("board_name", board_string());
#endif