Patchwork [U-Boot] SMDK5250: FDT: Retrieve board model via DT

login
register
mail settings
Submitter Rajeshwari Birje
Date Feb. 18, 2013, 12:51 p.m.
Message ID <1361191909-9565-1-git-send-email-rajeshwari.s@samsung.com>
Download mbox | patch
Permalink /patch/221283/
State Accepted
Delegated to: Minkyu Kang
Headers show

Comments

Rajeshwari Birje - Feb. 18, 2013, 12:51 p.m.
Print out the board model by parsing the device tree file.

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
 board/samsung/smdk5250/smdk5250.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
Simon Glass - Feb. 25, 2013, 4:39 a.m.
On Mon, Feb 18, 2013 at 4:51 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> Print out the board model by parsing the device tree file.
>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>

Acked-by: Simon Glass <sjg@chromium.org>

> ---
>  board/samsung/smdk5250/smdk5250.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
> index 6f6f2c2..0097b3f 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -336,8 +336,17 @@ int board_eth_init(bd_t *bis)
>  #ifdef CONFIG_DISPLAY_BOARDINFO
>  int checkboard(void)
>  {
> -       printf("\nBoard: SMDK5250\n");
> +#ifdef CONFIG_OF_CONTROL
> +       const char *board_name;
>
> +       board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
> +       if (board_name == NULL)
> +               printf("\nUnknown Board\n");
> +       else
> +               printf("\nBoard: %s\n", board_name);
> +#else
> +       printf("\nBoard: SMDK5250\n");
> +#endif
>         return 0;
>  }
>  #endif
> --
> 1.7.4.4
>
Minkyu Kang - March 12, 2013, 1:46 a.m.
On 18/02/13 21:51, Rajeshwari Shinde wrote:
> Print out the board model by parsing the device tree file.
> 
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
>  board/samsung/smdk5250/smdk5250.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
> index 6f6f2c2..0097b3f 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -336,8 +336,17 @@ int board_eth_init(bd_t *bis)
>  #ifdef CONFIG_DISPLAY_BOARDINFO
>  int checkboard(void)
>  {
> -	printf("\nBoard: SMDK5250\n");
> +#ifdef CONFIG_OF_CONTROL
> +	const char *board_name;
>  
> +	board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
> +	if (board_name == NULL)
> +		printf("\nUnknown Board\n");
> +	else
> +		printf("\nBoard: %s\n", board_name);
> +#else
> +	printf("\nBoard: SMDK5250\n");
> +#endif
>  	return 0;
>  }
>  #endif
> 


applied to u-boot-samsung.

Thanks,
Minkyu Kang.

Patch

diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index 6f6f2c2..0097b3f 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -336,8 +336,17 @@  int board_eth_init(bd_t *bis)
 #ifdef CONFIG_DISPLAY_BOARDINFO
 int checkboard(void)
 {
-	printf("\nBoard: SMDK5250\n");
+#ifdef CONFIG_OF_CONTROL
+	const char *board_name;
 
+	board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+	if (board_name == NULL)
+		printf("\nUnknown Board\n");
+	else
+		printf("\nBoard: %s\n", board_name);
+#else
+	printf("\nBoard: SMDK5250\n");
+#endif
 	return 0;
 }
 #endif