diff mbox series

[v2,5/5] wandboard: Print the board version in board_late_init()

Message ID 20200417122713.30574-5-festevam@gmail.com
State Accepted
Commit fe2f432c1c81763e13a5b5f2f9e61c8fd49555d9
Delegated to: Stefano Babic
Headers show
Series [v2,1/5] wandboard: Fix version detection for mx6q/mx6dl revD1 | expand

Commit Message

Fabio Estevam April 17, 2020, 12:27 p.m. UTC
Since CONFIG_DISPLAY_BOARDINFO_LATE is no longer used,  the checkboard()
function is no longer called.

As it is useful to print the board revision, print it inside
board_late_init() instead.

Also, to avoid GPIO errors related to using a GPIO without requesting it,
move the gpio_request(REV_DETECTION, "REV_DETECT") call prior to its
usage. 

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Still print the board revision, but on a different location now.

 board/wandboard/wandboard.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

Comments

Heiko Schocher April 17, 2020, 2:52 p.m. UTC | #1
Hello Fabio,

Am 17.04.2020 um 14:27 schrieb Fabio Estevam:
> Since CONFIG_DISPLAY_BOARDINFO_LATE is no longer used,  the checkboard()
> function is no longer called.
> 
> As it is useful to print the board revision, print it inside
> board_late_init() instead.
> 
> Also, to avoid GPIO errors related to using a GPIO without requesting it,
> move the gpio_request(REV_DETECTION, "REV_DETECT") call prior to its
> usage.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> Changes since v1:
> - Still print the board revision, but on a different location now.
> 
>   board/wandboard/wandboard.c | 23 +++++++++--------------
>   1 file changed, 9 insertions(+), 14 deletions(-)

Tested-by: Heiko Schocher <hs@denx.de>

Thanks!

bye,
Heiko
> 
> diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
> index 7fd60682a5..fb2f3c1fd2 100644
> --- a/board/wandboard/wandboard.c
> +++ b/board/wandboard/wandboard.c
> @@ -404,6 +404,7 @@ static const struct boot_mode board_boot_modes[] = {
>   static bool is_revc1(void)
>   {
>   	SETUP_IOMUX_PADS(rev_detection_pad);
> +	gpio_request(REV_DETECTION, "REV_DETECT");
>   	gpio_direction_input(REV_DETECTION);
>   
>   	if (gpio_get_value(REV_DETECTION))
> @@ -442,6 +443,14 @@ int board_late_init(void)
>   		env_set("board_name", "B1");
>   #endif
>   	setup_iomux_enet();
> +
> +	if (is_revd1())
> +		puts("Board: Wandboard rev D1\n");
> +	else if (is_revc1())
> +		puts("Board: Wandboard rev C1\n");
> +	else
> +		puts("Board: Wandboard rev B1\n");
> +
>   	return 0;
>   }
>   
> @@ -466,20 +475,6 @@ int board_init(void)
>   	return 0;
>   }
>   
> -int checkboard(void)
> -{
> -	gpio_request(REV_DETECTION, "REV_DETECT");
> -
> -	if (is_revd1())
> -		puts("Board: Wandboard rev D1\n");
> -	else if (is_revc1())
> -		puts("Board: Wandboard rev C1\n");
> -	else
> -		puts("Board: Wandboard rev B1\n");
> -
> -	return 0;
> -}
> -
>   #ifdef CONFIG_SPL_LOAD_FIT
>   int board_fit_config_name_match(const char *name)
>   {
>
Stefano Babic April 19, 2020, 9:09 a.m. UTC | #2
> Since CONFIG_DISPLAY_BOARDINFO_LATE is no longer used,  the checkboard()
> function is no longer called.
> As it is useful to print the board revision, print it inside
> board_late_init() instead.
> Also, to avoid GPIO errors related to using a GPIO without requesting it,
> move the gpio_request(REV_DETECTION, "REV_DETECT") call prior to its
> usage. 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Tested-by: Heiko Schocher <hs@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 7fd60682a5..fb2f3c1fd2 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -404,6 +404,7 @@  static const struct boot_mode board_boot_modes[] = {
 static bool is_revc1(void)
 {
 	SETUP_IOMUX_PADS(rev_detection_pad);
+	gpio_request(REV_DETECTION, "REV_DETECT");
 	gpio_direction_input(REV_DETECTION);
 
 	if (gpio_get_value(REV_DETECTION))
@@ -442,6 +443,14 @@  int board_late_init(void)
 		env_set("board_name", "B1");
 #endif
 	setup_iomux_enet();
+
+	if (is_revd1())
+		puts("Board: Wandboard rev D1\n");
+	else if (is_revc1())
+		puts("Board: Wandboard rev C1\n");
+	else
+		puts("Board: Wandboard rev B1\n");
+
 	return 0;
 }
 
@@ -466,20 +475,6 @@  int board_init(void)
 	return 0;
 }
 
-int checkboard(void)
-{
-	gpio_request(REV_DETECTION, "REV_DETECT");
-
-	if (is_revd1())
-		puts("Board: Wandboard rev D1\n");
-	else if (is_revc1())
-		puts("Board: Wandboard rev C1\n");
-	else
-		puts("Board: Wandboard rev B1\n");
-
-	return 0;
-}
-
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {