Patchwork [U-Boot,v3,07/11] samsung: board: enable support of multiple board types

login
register
mail settings
Submitter Przemyslaw Marczak
Date June 26, 2014, 2:15 p.m.
Message ID <1403792137-3113-8-git-send-email-p.marczak@samsung.com>
Download mbox | patch
Permalink /patch/364557/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Przemyslaw Marczak - June 26, 2014, 2:15 p.m.
This change adds declaration of functions:
- set_board_type() - called at checkboard()
- get_board_type() - called at checkboard()
- get_board_name()

For supporting multiple board types in a one config - it is welcome
to display the current board model. This is what get_board_type()
should return.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Piotr Wilczek <p.wilczek@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>

---
Changes v3:
- change the commit order
- include/samsung/misc.h: add new functions declaration
- update a commit message
---
 board/samsung/common/board.c | 7 +++++++
 include/samsung/misc.h       | 5 +++++
 2 files changed, 12 insertions(+)
Minkyu Kang - June 27, 2014, 9:40 a.m.
On 26/06/14 23:15, Przemyslaw Marczak wrote:
> This change adds declaration of functions:
> - set_board_type() - called at checkboard()
> - get_board_type() - called at checkboard()
> - get_board_name()
> 
> For supporting multiple board types in a one config - it is welcome
> to display the current board model. This is what get_board_type()
> should return.
> 
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Cc: Piotr Wilczek <p.wilczek@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> 
> ---
> Changes v3:
> - change the commit order
> - include/samsung/misc.h: add new functions declaration
> - update a commit message
> ---
>  board/samsung/common/board.c | 7 +++++++
>  include/samsung/misc.h       | 5 +++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> index fd5f21f..f2dbfa0 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -96,6 +96,7 @@ int board_init(void)
>  #ifdef CONFIG_EXYNOS_SPI
>  	spi_init();
>  #endif
> +
>  	return exynos_init();
>  }
>  
> @@ -285,7 +286,13 @@ int checkboard(void)
>  
>  	board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
>  	printf("Board: %s\n", board_name ? board_name : "unknown");
> +#ifdef CONFIG_BOARD_TYPES
> +	set_board_type();
> +
> +	const char *board_type = get_board_type();

please don't declare local variable at middle of function.

>  
> +	printf("Model: %s\n", board_type ? board_type : "unknown");
> +#endif
>  	return 0;
>  }
>  #endif
> diff --git a/include/samsung/misc.h b/include/samsung/misc.h
> index c3fcc29..fcec5ea 100644
> --- a/include/samsung/misc.h
> +++ b/include/samsung/misc.h
> @@ -40,5 +40,10 @@ char *get_dfu_alt_system(void);
>  char *get_dfu_alt_boot(void);
>  void set_dfu_alt_info(void);
>  #endif
> +#ifdef CONFIG_BOARD_TYPES
> +void set_board_type(void);
> +const char *get_board_type(void);
> +const char *get_board_name(void);
> +#endif
>  
>  #endif /* __SAMSUNG_MISC_COMMON_H__ */
>
Przemyslaw Marczak - June 27, 2014, 11:34 a.m.
On 06/27/2014 11:40 AM, Minkyu Kang wrote:
> On 26/06/14 23:15, Przemyslaw Marczak wrote:
>> This change adds declaration of functions:
>> - set_board_type() - called at checkboard()
>> - get_board_type() - called at checkboard()
>> - get_board_name()
>>
>> For supporting multiple board types in a one config - it is welcome
>> to display the current board model. This is what get_board_type()
>> should return.
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> Cc: Piotr Wilczek <p.wilczek@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>>
>> ---
>> Changes v3:
>> - change the commit order
>> - include/samsung/misc.h: add new functions declaration
>> - update a commit message
>> ---
>>   board/samsung/common/board.c | 7 +++++++
>>   include/samsung/misc.h       | 5 +++++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
>> index fd5f21f..f2dbfa0 100644
>> --- a/board/samsung/common/board.c
>> +++ b/board/samsung/common/board.c
>> @@ -96,6 +96,7 @@ int board_init(void)
>>   #ifdef CONFIG_EXYNOS_SPI
>>   	spi_init();
>>   #endif
>> +
>>   	return exynos_init();
>>   }
>>
>> @@ -285,7 +286,13 @@ int checkboard(void)
>>
>>   	board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
>>   	printf("Board: %s\n", board_name ? board_name : "unknown");
>> +#ifdef CONFIG_BOARD_TYPES
>> +	set_board_type();
>> +
>> +	const char *board_type = get_board_type();
>
> please don't declare local variable at middle of function.
>
ok, I will fix this.
>>
>> +	printf("Model: %s\n", board_type ? board_type : "unknown");
>> +#endif
>>   	return 0;
>>   }
>>   #endif
>> diff --git a/include/samsung/misc.h b/include/samsung/misc.h
>> index c3fcc29..fcec5ea 100644
>> --- a/include/samsung/misc.h
>> +++ b/include/samsung/misc.h
>> @@ -40,5 +40,10 @@ char *get_dfu_alt_system(void);
>>   char *get_dfu_alt_boot(void);
>>   void set_dfu_alt_info(void);
>>   #endif
>> +#ifdef CONFIG_BOARD_TYPES
>> +void set_board_type(void);
>> +const char *get_board_type(void);
>> +const char *get_board_name(void);
>> +#endif
>>
>>   #endif /* __SAMSUNG_MISC_COMMON_H__ */
>>
>
>

Thank you for review.

Regards,

Patch

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index fd5f21f..f2dbfa0 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -96,6 +96,7 @@  int board_init(void)
 #ifdef CONFIG_EXYNOS_SPI
 	spi_init();
 #endif
+
 	return exynos_init();
 }
 
@@ -285,7 +286,13 @@  int checkboard(void)
 
 	board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
 	printf("Board: %s\n", board_name ? board_name : "unknown");
+#ifdef CONFIG_BOARD_TYPES
+	set_board_type();
+
+	const char *board_type = get_board_type();
 
+	printf("Model: %s\n", board_type ? board_type : "unknown");
+#endif
 	return 0;
 }
 #endif
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index c3fcc29..fcec5ea 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -40,5 +40,10 @@  char *get_dfu_alt_system(void);
 char *get_dfu_alt_boot(void);
 void set_dfu_alt_info(void);
 #endif
+#ifdef CONFIG_BOARD_TYPES
+void set_board_type(void);
+const char *get_board_type(void);
+const char *get_board_name(void);
+#endif
 
 #endif /* __SAMSUNG_MISC_COMMON_H__ */