samsung: misc: add new lcd menu options
cover samsung: misc: add new lcd menu options
Changes:
- small code refactor
- add menu option: gpt restore
- add menu option: env default
Inha Song (1):
samsung: misc: add env default option to lcd menu
Przemyslaw Marczak (2):
samsung: misc: check_keys(), key_pressed() - remove type static.
samsung: misc: add gpt restore option to lcd menu
board/samsung/common/misc.c | 60 +++++++++++++++++++++---------------------- include/samsung/misc.h | 6 +++++ 2 files changed, 36 insertions(+), 30 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 samsung: misc: check_keys(), key_pressed() - remove type static.
This patch removes type "static" from those functions declaration. Now it can be used outside.
--- board/samsung/common/misc.c | 5 ++--- include/samsung/misc.h | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-)
board/samsung/common/misc.c +2 -3
@@ -15,7 +15,6 @@#include <asm/arch/cpu.h> #include <asm/arch/gpio.h> #include <asm/gpio.h> -#include <linux/input.h> #include <power/pmic.h> #include <mmc.h>
@@ -72,7 +71,7 @@ static int power_key_pressed(u32 reg)return !!(status & mask); } -static int key_pressed (int key) +int key_pressed (int key) {int value;
@@ -94,7 +93,7 @@ static int key_pressed(int key)return value; } -static int check_keys (void ) +int check_keys (void ) {int keys =0 ;
include/samsung/misc.h +4 -0
@@ -1,6 +1,8 @@#ifndef __SAMSUNG_MISC_COMMON_H__#define __SAMSUNG_MISC_COMMON_H__ +#include <linux/input.h> +#ifdef CONFIG_REVISION_TAG u32 get_board_rev (void );#endif
@@ -19,6 +21,8 @@ enum { };void keys_init (void ); +int check_keys (void ); +int key_pressed (int key);void check_boot_mode (void );#endif /* CONFIG_LCD_MENU */
Signature · 1 line
1.7.9.5
PATCH 1/3 samsung: misc: check_keys(), key_pressed() - remove type static.
Quoted 2 lines · Przemyslaw Marczak
This patch removes type "static" from those functions declaration. Now it can be used outside.
outside where?
I think there's no reason to make them to non-static function. If you want to use it at outside then please send the patch together.
Quoted 54 lines
Change-Id I2244ca3568b73251401e5102f26cc113ea69c1a4Signed-off-by Przemyslaw Marczak <[email protected]>cc Minkyu Kang <[email protected]>--- board/samsung/common/misc.c | 5 ++--- include/samsung/misc.h | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-)board/samsung/common/misc.c +2
-3@@ -15,7 +15,6 @@#include <asm/arch/cpu.h> #include <asm/arch/gpio.h> #include <asm/gpio.h> -#include <linux/input.h> #include <power/pmic.h> #include <mmc.h> @@ -72,7 +71,7 @@ static int power_key_pressed(u32 reg)return !!(status & mask); } -static int key_pressed (int key) +int key_pressed (int key) {int value;@@ -94,7 +93,7 @@ static int key_pressed(int key)return value; } -static int check_keys (void ) +int check_keys (void ) {int keys =0 ;include/samsung/misc.h +2
-0@@ -1,6 +1,8 @@#ifndef __SAMSUNG_MISC_COMMON_H__#define __SAMSUNG_MISC_COMMON_H__ +#include <linux/input.h> +#ifdef CONFIG_REVISION_TAG u32 get_board_rev (void );#endif
include/samsung/misc.h enum { · line 28
Quoted 8 lines
include/samsung/misc.h +2
-0@@ -19,6 +21,8 @@ enum { };void keys_init (void ); +int check_keys (void ); +int key_pressed (int key);void check_boot_mode (void );#endif /* CONFIG_LCD_MENU */
Thanks,
Minkyu Kang.
PATCH 1/3 samsung: misc: check_keys(), key_pressed() - remove type static.
Hello Minkyu,
Quoted 12 lines · Minkyu Kang
Quoted 2 lines · Przemyslaw Marczak
This patch removes type "static" from those functions declaration. Now it can be used outside.
outside where?
I think there's no reason to make them to non-static function. If you want to use it at outside then please send the patch together.Quoted 4 lines
Change-Id I2244ca3568b73251401e5102f26cc113ea69c1a4Signed-off-by Przemyslaw Marczak <[email protected]>cc Minkyu Kang <[email protected]>
I will resend this patchset when some changes will be applied to GPT code. Thanks
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH 2/3 samsung: misc: add gpt restore option to lcd menu
In reply to Przemyslaw MarczakFunction cmd_process() runs commands with directly given list of arguments but it doesn't expand given macros. Command gpt expects expanded macro e.g. $partitions as an argument so it needs to be called with function run_command().
Changes:
- extend array mode_name by lower case commands names - used by find_cmd()
- put each command arguments into one string - used by run_command()
- use run_command() instead of cmd_process()
--- board/samsung/common/misc.c | 52 +++++++++++++++++++++---------------------- include/samsung/misc.h | 1 + 2 files changed, 26 insertions(+), 27 deletions(-)
board/samsung/common/misc.c +25 -27
@@ -115,12 +115,13 @@ int check_keys(void)* 4 BOOT_MODE_EXIT */ static char * -mode_name[BOOT_MODE_EXIT +1 ] = { -"DEVICE" , -"THOR" , -"UMS" , -"DFU" , -"EXIT" +mode_name[BOOT_MODE_EXIT +1 ][2 ] = { + {"DEVICE" ,"" }, + {"THOR" ,"thor" }, + {"UMS" ,"ums" }, + {"DFU" ,"dfu" }, + {"GPT" ,"gpt" }, + {"EXIT" ,"" }, }; static char *
@@ -129,18 +130,18 @@ mode_info[BOOT_MODE_EXIT + 1] = {"downloader" ,"mass storage" ,"firmware update" , +"restore" , "and run normal boot" }; -#define MODE_CMD_ARGC 4 -static char * -mode_cmd[BOOT_MODE_EXIT +1 ][MODE_CMD_ARGC ] = { - {"" ,"" ,"" ,"" }, - {"thor" ,"0" ,"mmc" ,"0" }, - {"ums" ,"0" ,"mmc" ,"0" }, - {"dfu" ,"0" ,"mmc" ,"0" }, - {"" ,"" ,"" ,"" }, +mode_cmd[BOOT_MODE_EXIT +1 ] = { +"" , +"thor 0 mmc 0" , +"ums 0 mmc 0" , +"dfu 0 mmc 0" , +"gpt write mmc 0 $partitions" , +"" , };static void display_board_info (void )
@@ -181,11 +182,10 @@ static void display_board_info(void)static int mode_leave_menu (int mode) {char *exit_option; -char *exit_boot ="boot" ; +char *exit_reset ="reset" ;char *exit_back ="back" ;cmd_tbl_t *cmd;int cmd_result; -int cmd_repeatable;int leave;lcd_clear ();
@@ -199,31 +199,29 @@ static int mode_leave_menu(int mode) leave =0 ;break ;default : - cmd =find_cmd (mode_cmd[mode][0 ]); + cmd =find_cmd (mode_name[mode][1 ]);if (cmd) { -printf ("Enter: %s %s\n" , mode_name[mode], +printf ("Enter: %s %s\n" , mode_name[mode][0 ], mode_info[mode]); -lcd_printf ("\n\n\t%s %s\n" , mode_name[mode], +lcd_printf ("\n\n\t%s %s\n" , mode_name[mode][0 ], mode_info[mode]);lcd_puts ("\n\tDo not turn off device before finish!\n" ); - cmd_result =cmd_process (0 ,MODE_CMD_ARGC , - *(mode_cmd + mode), - &cmd_repeatable,NULL ); + cmd_result =run_command (mode_cmd[mode],0 );if (cmd_result ==CMD_RET_SUCCESS ) {printf ("Command finished\n" );lcd_clear ();lcd_printf ("\n\n\t%s finished\n" , - mode_name[mode]); + mode_name[mode][0 ]); - exit_option = exit_boot; + exit_option = exit_reset; leave =1 ; }else {printf ("Command error\n" );lcd_clear ();lcd_printf ("\n\n\t%s command error\n" , - mode_name[mode]); + mode_name[mode][0 ]); exit_option = exit_back; leave =0 ;
@@ -263,7 +261,7 @@ static void display_download_menu(int mode)for (i =0 ; i <=BOOT_MODE_EXIT ; i++)lcd_printf ("\t%s %s - %s\n\n" , selection[i], - mode_name[i], + mode_name[i][0 ], mode_info[i]); }
@@ -304,7 +302,7 @@ static void download_menu(void)if (run) {if (mode_leave_menu (mode)) -break ; +run_command ("reset" ,0 );display_download_menu (mode); }
include/samsung/misc.h +1 -0
@@ -17,6 +17,7 @@ enum {BOOT_MODE_THOR ,BOOT_MODE_UMS ,BOOT_MODE_DFU , +BOOT_MODE_GPT , BOOT_MODE_EXIT, };
Signature · 1 line
1.7.9.5
PATCH 3/3 samsung: misc: add env default option to lcd menu
In reply to Przemyslaw MarczakFrom: Inha Song <[email protected]>
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -121,6 +121,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"UMS", "ums"}, {"DFU", "dfu"}, {"GPT", "gpt"}, + {"ENV", "env"}, {"EXIT", ""}, };
@@ -131,6 +132,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"mass storage" ,"firmware update" ,"restore" , +"default" , "and run normal boot" };
@@ -141,6 +143,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"ums 0 mmc 0" ,"dfu 0 mmc 0" ,"gpt write mmc 0 $partitions" , +"env default -a; saveenv" , "", };
include/samsung/misc.h +1 -0
@@ -18,6 +18,7 @@ enum {BOOT_MODE_UMS ,BOOT_MODE_DFU ,BOOT_MODE_GPT , +BOOT_MODE_ENV , BOOT_MODE_EXIT, };
Signature · 1 line
1.7.9.5
cover samsung: misc: add new lcd menu options
In reply to Przemyslaw MarczakHello,
Quoted 8 lines · Przemyslaw Marczak
Changes:
- small code refactor
- add menu option: gpt restore
- add menu option: env defaultInha Song (1):
samsung: misc: add env default option to lcd menu
Quoted 8 lines
Przemyslaw Marczak (2):
samsung: misc:check_keys(),key_pressed()- remove type static.
samsung: misc: add gpt restore option to lcd menuboard/samsung/common/misc.c | 60 +++++++++++++++++++++---------------------- include/samsung/misc.h | 6 +++++ 2 files changed, 36 insertions(+), 30 deletions(-)
Sorry for the Change-Id in the commits.
It's from gerrit - I forgot remove it.
Thank you
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH v2 1/4 samsung: misc: allows using environmental macros as args in menu commands
In reply to Przemyslaw MarczakFunction cmd_process() runs commands with directly given list of arguments but it doesn't expand given environmental variables names as macros. Command "gpt" as one of arguments expects expanded macro e.g. $partitions so it needs to be called by function run_command().
Changes:
- extend array mode_name by lower case commands names - used by find_cmd()
- put each command arguments into one string - used by run_command()
- use run_command() instead of cmd_process()
---
Changes v2:
- new commit after separate previous commit
--- board/samsung/common/misc.c | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-)
board/samsung/common/misc.c +22 -27
@@ -116,12 +116,12 @@ static int check_keys(void)* 4 BOOT_MODE_EXIT */ static char * -mode_name[BOOT_MODE_EXIT +1 ] = { -"DEVICE" , -"THOR" , -"UMS" , -"DFU" , -"EXIT" +mode_name[BOOT_MODE_EXIT +1 ][2 ] = { + {"DEVICE" ,"" }, + {"THOR" ,"thor" }, + {"UMS" ,"ums" }, + {"DFU" ,"dfu" }, + {"EXIT" ,"" }, }; static char *
@@ -133,15 +133,13 @@ mode_info[BOOT_MODE_EXIT + 1] = { "and run normal boot" }; -#define MODE_CMD_ARGC 4 -static char * -mode_cmd[BOOT_MODE_EXIT +1 ][MODE_CMD_ARGC ] = { - {"" ,"" ,"" ,"" }, - {"thor" ,"0" ,"mmc" ,"0" }, - {"ums" ,"0" ,"mmc" ,"0" }, - {"dfu" ,"0" ,"mmc" ,"0" }, - {"" ,"" ,"" ,"" }, +mode_cmd[BOOT_MODE_EXIT +1 ] = { +"" , +"thor 0 mmc 0" , +"ums 0 mmc 0" , +"dfu 0 mmc 0" , +"" , };static void display_board_info (void )
@@ -182,11 +180,10 @@ static void display_board_info(void)static int mode_leave_menu (int mode) {char *exit_option; -char *exit_boot ="boot" ; +char *exit_reset ="reset" ;char *exit_back ="back" ;cmd_tbl_t *cmd;int cmd_result; -int cmd_repeatable;int leave;lcd_clear ();
@@ -200,31 +197,29 @@ static int mode_leave_menu(int mode) leave =0 ;break ;default : - cmd =find_cmd (mode_cmd[mode][0 ]); + cmd =find_cmd (mode_name[mode][1 ]);if (cmd) { -printf ("Enter: %s %s\n" , mode_name[mode], +printf ("Enter: %s %s\n" , mode_name[mode][0 ], mode_info[mode]); -lcd_printf ("\n\n\t%s %s\n" , mode_name[mode], +lcd_printf ("\n\n\t%s %s\n" , mode_name[mode][0 ], mode_info[mode]);lcd_puts ("\n\tDo not turn off device before finish!\n" ); - cmd_result =cmd_process (0 ,MODE_CMD_ARGC , - *(mode_cmd + mode), - &cmd_repeatable,NULL ); + cmd_result =run_command (mode_cmd[mode],0 );if (cmd_result ==CMD_RET_SUCCESS ) {printf ("Command finished\n" );lcd_clear ();lcd_printf ("\n\n\t%s finished\n" , - mode_name[mode]); + mode_name[mode][0 ]); - exit_option = exit_boot; + exit_option = exit_reset; leave =1 ; }else {printf ("Command error\n" );lcd_clear ();lcd_printf ("\n\n\t%s command error\n" , - mode_name[mode]); + mode_name[mode][0 ]); exit_option = exit_back; leave =0 ;
@@ -264,7 +259,7 @@ static void display_download_menu(int mode)for (i =0 ; i <=BOOT_MODE_EXIT ; i++)lcd_printf ("\t%s %s - %s\n\n" , selection[i], - mode_name[i], + mode_name[i][0 ], mode_info[i]); }
@@ -305,7 +300,7 @@ static void download_menu(void)if (run) {if (mode_leave_menu (mode)) -break ; +run_command ("reset" ,0 );display_download_menu (mode); }
Signature · 1 line
1.9.0
PATCH v2 2/4 samsung: misc: add gpt restore option to lcd menu
This menu option allows restore gpt.
This is usefull and no needs access to the u-boot console. For proper operation:
- each partition uuid should be set in environment or
- CONFIG_RANDOM_UUID should be defined for automatically uuid setting
After operation success device is going to be reset.
---
Changes v2:
- commit separation
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -121,6 +121,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"THOR", "thor"}, {"UMS", "ums"}, {"DFU", "dfu"}, + {"GPT", "gpt"}, {"EXIT", ""}, };
@@ -130,6 +131,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"downloader" ,"mass storage" ,"firmware update" , +"restore" , "and run normal boot" };
@@ -139,6 +141,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"thor 0 mmc 0" ,"ums 0 mmc 0" ,"dfu 0 mmc 0" , +"gpt write mmc 0 $partitions" , "", };
include/samsung/misc.h +1 -0
@@ -15,6 +15,7 @@ enum {BOOT_MODE_THOR ,BOOT_MODE_UMS ,BOOT_MODE_DFU , +BOOT_MODE_GPT , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.0
PATCH v2 3/4 samsung: misc: add env default option to lcd menu
In reply to Przemyslaw MarczakFrom: Inha Song <[email protected]>
This change allows reset device environment to default without using u-boot console, which is useful for system developers.
---
Changes v2:
- extend commit message
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -122,6 +122,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"UMS", "ums"}, {"DFU", "dfu"}, {"GPT", "gpt"}, + {"ENV", "env"}, {"EXIT", ""}, };
@@ -132,6 +133,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"mass storage" ,"firmware update" ,"restore" , +"default" , "and run normal boot" };
@@ -142,6 +144,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"ums 0 mmc 0" ,"dfu 0 mmc 0" ,"gpt write mmc 0 $partitions" , +"env default -a; saveenv" , "", };
include/samsung/misc.h +1 -0
@@ -16,6 +16,7 @@ enum {BOOT_MODE_UMS ,BOOT_MODE_DFU ,BOOT_MODE_GPT , +BOOT_MODE_ENV , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.0
PATCH v2 4/4 samsung: misc: keys: fix gpio key debouncing by adding 50 ms delay
In reply to Przemyslaw MarczakThis change prevents gpio keys debouncing by adding 50 ms delay when key pressed condition met.
---
Changes v2:
- new commit
--- board/samsung/common/misc.c | 4 ++++ 1 file changed, 4 insertions(+)
board/samsung/common/misc.c +4 -0
@@ -105,6 +105,10 @@ static int check_keys(void)if (key_pressed (KEY_VOLUMEDOWN )) keys +=KEY_VOLUMEDOWN ; +/* Avoids gpio keys debouncing */ +if (keys) +mdelay (50 ); +return keys; }
Signature · 1 line
1.9.0
PATCH v2 4/4 samsung: misc: keys: fix gpio key debouncing by adding 50 ms delay
Quoted 3 lines · Przemyslaw Marczak
This change prevents gpio keys debouncing by adding 50 ms delay when key pressed condition met.
comment nit: keys are bouncing, de-bouncing is the counter measure, you don't want to avoid it :)
virtually yours
Gerhard Sittig
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
PATCH v2 4/4 samsung: misc: keys: fix gpio key debouncing by adding 50 ms delay
Hi,
Quoted 5 lines · Gerhard Sittig
Quoted 3 lines · Przemyslaw Marczak
This change prevents gpio keys debouncing by adding 50 ms delay when key pressed condition met.
Quoted 7 lines
comment nit: keys are bouncing, de-bouncing is the counter measure, you don't want to avoid it :)
virtually yours
Gerhard Sittig
Ok, I will correct this.
Thanks
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH v3 1/4 samsung: misc: allows using environmental macros as args in menu commands
In reply to Przemyslaw MarczakFunction cmd_process() runs commands with directly given list of arguments but it doesn't expand given environmental variables names as macros. Command "gpt" as one of arguments expects expanded macro e.g. $partitions so it needs to be called by function run_command().
Changes:
- extend array mode_name by lower case commands names - used by find_cmd()
- put each command arguments into one string - used by run_command()
- use run_command() instead of cmd_process()
---
Changes v2:
- new commit after separate previous commit
Changes v3:
- none
--- board/samsung/common/misc.c | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-)
board/samsung/common/misc.c +22 -27
@@ -116,12 +116,12 @@ static int check_keys(void)* 4 BOOT_MODE_EXIT */ static char * -mode_name[BOOT_MODE_EXIT +1 ] = { -"DEVICE" , -"THOR" , -"UMS" , -"DFU" , -"EXIT" +mode_name[BOOT_MODE_EXIT +1 ][2 ] = { + {"DEVICE" ,"" }, + {"THOR" ,"thor" }, + {"UMS" ,"ums" }, + {"DFU" ,"dfu" }, + {"EXIT" ,"" }, }; static char *
@@ -133,15 +133,13 @@ mode_info[BOOT_MODE_EXIT + 1] = { "and run normal boot" }; -#define MODE_CMD_ARGC 4 -static char * -mode_cmd[BOOT_MODE_EXIT +1 ][MODE_CMD_ARGC ] = { - {"" ,"" ,"" ,"" }, - {"thor" ,"0" ,"mmc" ,"0" }, - {"ums" ,"0" ,"mmc" ,"0" }, - {"dfu" ,"0" ,"mmc" ,"0" }, - {"" ,"" ,"" ,"" }, +mode_cmd[BOOT_MODE_EXIT +1 ] = { +"" , +"thor 0 mmc 0" , +"ums 0 mmc 0" , +"dfu 0 mmc 0" , +"" , };static void display_board_info (void )
@@ -182,11 +180,10 @@ static void display_board_info(void)static int mode_leave_menu (int mode) {char *exit_option; -char *exit_boot ="boot" ; +char *exit_reset ="reset" ;char *exit_back ="back" ;cmd_tbl_t *cmd;int cmd_result; -int cmd_repeatable;int leave;lcd_clear ();
@@ -200,31 +197,29 @@ static int mode_leave_menu(int mode) leave =0 ;break ;default : - cmd =find_cmd (mode_cmd[mode][0 ]); + cmd =find_cmd (mode_name[mode][1 ]);if (cmd) { -printf ("Enter: %s %s\n" , mode_name[mode], +printf ("Enter: %s %s\n" , mode_name[mode][0 ], mode_info[mode]); -lcd_printf ("\n\n\t%s %s\n" , mode_name[mode], +lcd_printf ("\n\n\t%s %s\n" , mode_name[mode][0 ], mode_info[mode]);lcd_puts ("\n\tDo not turn off device before finish!\n" ); - cmd_result =cmd_process (0 ,MODE_CMD_ARGC , - *(mode_cmd + mode), - &cmd_repeatable,NULL ); + cmd_result =run_command (mode_cmd[mode],0 );if (cmd_result ==CMD_RET_SUCCESS ) {printf ("Command finished\n" );lcd_clear ();lcd_printf ("\n\n\t%s finished\n" , - mode_name[mode]); + mode_name[mode][0 ]); - exit_option = exit_boot; + exit_option = exit_reset; leave =1 ; }else {printf ("Command error\n" );lcd_clear ();lcd_printf ("\n\n\t%s command error\n" , - mode_name[mode]); + mode_name[mode][0 ]); exit_option = exit_back; leave =0 ;
@@ -264,7 +259,7 @@ static void display_download_menu(int mode)for (i =0 ; i <=BOOT_MODE_EXIT ; i++)lcd_printf ("\t%s %s - %s\n\n" , selection[i], - mode_name[i], + mode_name[i][0 ], mode_info[i]); }
@@ -305,7 +300,7 @@ static void download_menu(void)if (run) {if (mode_leave_menu (mode)) -break ; +run_command ("reset" ,0 );display_download_menu (mode); }
Signature · 1 line
1.9.0
PATCH v3 2/4 samsung: misc: add gpt restore option to lcd menu
This menu option allows restore gpt.
This is usefull and no needs access to the u-boot console. For proper operation:
- each partition uuid should be set in environment or
- CONFIG_RANDOM_UUID should be defined for automatically uuid setting
After operation success device is going to be reset.
---
Changes v2:
- commit separation
Changes v3:
-none
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -121,6 +121,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"THOR", "thor"}, {"UMS", "ums"}, {"DFU", "dfu"}, + {"GPT", "gpt"}, {"EXIT", ""}, };
@@ -130,6 +131,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"downloader" ,"mass storage" ,"firmware update" , +"restore" , "and run normal boot" };
@@ -139,6 +141,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"thor 0 mmc 0" ,"ums 0 mmc 0" ,"dfu 0 mmc 0" , +"gpt write mmc 0 $partitions" , "", };
include/samsung/misc.h +1 -0
@@ -15,6 +15,7 @@ enum {BOOT_MODE_THOR ,BOOT_MODE_UMS ,BOOT_MODE_DFU , +BOOT_MODE_GPT , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.0
PATCH v3 3/4 samsung: misc: add env default option to lcd menu
In reply to Przemyslaw MarczakFrom: Inha Song <[email protected]>
This change allows reset device environment to default without using u-boot console, which is useful for system developers.
---
Changes v2:
- extend commit message
Changes v3:
- none
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -122,6 +122,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"UMS", "ums"}, {"DFU", "dfu"}, {"GPT", "gpt"}, + {"ENV", "env"}, {"EXIT", ""}, };
@@ -132,6 +133,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"mass storage" ,"firmware update" ,"restore" , +"default" , "and run normal boot" };
@@ -142,6 +144,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"ums 0 mmc 0" ,"dfu 0 mmc 0" ,"gpt write mmc 0 $partitions" , +"env default -a; saveenv" , "", };
include/samsung/misc.h +1 -0
@@ -16,6 +16,7 @@ enum {BOOT_MODE_UMS ,BOOT_MODE_DFU ,BOOT_MODE_GPT , +BOOT_MODE_ENV , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.0
PATCH v3 4/4 samsung: misc: keys: fix gpio key bouncing by adding 50 ms delay
In reply to Przemyslaw MarczakThis change prevents gpio keys bouncing by adding 50 ms delay when key pressed condition met.
---
Changes v2:
- new commit
Changes v3:
- correct commit message
--- board/samsung/common/misc.c | 4 ++++ 1 file changed, 4 insertions(+)
board/samsung/common/misc.c +4 -0
@@ -105,6 +105,10 @@ static int check_keys(void)if (key_pressed (KEY_VOLUMEDOWN )) keys +=KEY_VOLUMEDOWN ; +/* Avoids gpio keys debouncing */ +if (keys) +mdelay (50 ); +return keys; }
Signature · 1 line
1.9.0
PATCH v4 1/5 samsung: misc: allows using environmental macros as args in menu commands
In reply to Przemyslaw MarczakFunction cmd_process() runs commands with directly given list of arguments but it doesn't expand given environmental variables names as macros. Command "gpt" as one of arguments expects expanded macro e.g. $partitions so it needs to be called by function run_command().
Changes:
- extend array mode_name by lower case commands names - used by find_cmd()
- put each command arguments into one string - used by run_command()
- use run_command() instead of cmd_process()
---
Changes v2:
- new commit after separate previous commit
Changes v3:
- none
Changes v4:
- none
board/samsung/common/misc.c | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-)
board/samsung/common/misc.c +22 -27
@@ -116,12 +116,12 @@ static int check_keys(void)* 4 BOOT_MODE_EXIT */ static char * -mode_name[BOOT_MODE_EXIT +1 ] = { -"DEVICE" , -"THOR" , -"UMS" , -"DFU" , -"EXIT" +mode_name[BOOT_MODE_EXIT +1 ][2 ] = { + {"DEVICE" ,"" }, + {"THOR" ,"thor" }, + {"UMS" ,"ums" }, + {"DFU" ,"dfu" }, + {"EXIT" ,"" }, }; static char *
@@ -133,15 +133,13 @@ mode_info[BOOT_MODE_EXIT + 1] = { "and run normal boot" }; -#define MODE_CMD_ARGC 4 -static char * -mode_cmd[BOOT_MODE_EXIT +1 ][MODE_CMD_ARGC ] = { - {"" ,"" ,"" ,"" }, - {"thor" ,"0" ,"mmc" ,"0" }, - {"ums" ,"0" ,"mmc" ,"0" }, - {"dfu" ,"0" ,"mmc" ,"0" }, - {"" ,"" ,"" ,"" }, +mode_cmd[BOOT_MODE_EXIT +1 ] = { +"" , +"thor 0 mmc 0" , +"ums 0 mmc 0" , +"dfu 0 mmc 0" , +"" , };static void display_board_info (void )
@@ -182,11 +180,10 @@ static void display_board_info(void)static int mode_leave_menu (int mode) {char *exit_option; -char *exit_boot ="boot" ; +char *exit_reset ="reset" ;char *exit_back ="back" ;cmd_tbl_t *cmd;int cmd_result; -int cmd_repeatable;int leave;lcd_clear ();
@@ -200,31 +197,29 @@ static int mode_leave_menu(int mode) leave =0 ;break ;default : - cmd =find_cmd (mode_cmd[mode][0 ]); + cmd =find_cmd (mode_name[mode][1 ]);if (cmd) { -printf ("Enter: %s %s\n" , mode_name[mode], +printf ("Enter: %s %s\n" , mode_name[mode][0 ], mode_info[mode]); -lcd_printf ("\n\n\t%s %s\n" , mode_name[mode], +lcd_printf ("\n\n\t%s %s\n" , mode_name[mode][0 ], mode_info[mode]);lcd_puts ("\n\tDo not turn off device before finish!\n" ); - cmd_result =cmd_process (0 ,MODE_CMD_ARGC , - *(mode_cmd + mode), - &cmd_repeatable,NULL ); + cmd_result =run_command (mode_cmd[mode],0 );if (cmd_result ==CMD_RET_SUCCESS ) {printf ("Command finished\n" );lcd_clear ();lcd_printf ("\n\n\t%s finished\n" , - mode_name[mode]); + mode_name[mode][0 ]); - exit_option = exit_boot; + exit_option = exit_reset; leave =1 ; }else {printf ("Command error\n" );lcd_clear ();lcd_printf ("\n\n\t%s command error\n" , - mode_name[mode]); + mode_name[mode][0 ]); exit_option = exit_back; leave =0 ;
@@ -264,7 +259,7 @@ static void display_download_menu(int mode)for (i =0 ; i <=BOOT_MODE_EXIT ; i++)lcd_printf ("\t%s %s - %s\n\n" , selection[i], - mode_name[i], + mode_name[i][0 ], mode_info[i]); }
@@ -305,7 +300,7 @@ static void download_menu(void)if (run) {if (mode_leave_menu (mode)) -break ; +run_command ("reset" ,0 );display_download_menu (mode); }
Signature · 1 line
1.9.1
PATCH v4 2/5 samsung: misc: add gpt restore option to lcd menu
This menu option allows restore gpt.
This is usefull and no needs access to the u-boot console. For proper operation:
- each partition uuid should be set in environment or
- CONFIG_RANDOM_UUID should be defined for automatically uuid setting
After operation success device is going to be reset.
---
Changes v2:
- commit separation
Changes v3:
- none
Changes v4:
- none
board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -121,6 +121,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"THOR", "thor"}, {"UMS", "ums"}, {"DFU", "dfu"}, + {"GPT", "gpt"}, {"EXIT", ""}, };
@@ -130,6 +131,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"downloader" ,"mass storage" ,"firmware update" , +"restore" , "and run normal boot" };
@@ -139,6 +141,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"thor 0 mmc 0" ,"ums 0 mmc 0" ,"dfu 0 mmc 0" , +"gpt write mmc 0 $partitions" , "", };
include/samsung/misc.h +1 -0
@@ -15,6 +15,7 @@ enum {BOOT_MODE_THOR ,BOOT_MODE_UMS ,BOOT_MODE_DFU , +BOOT_MODE_GPT , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.1
PATCH v4 3/5 samsung: misc: add env default option to lcd menu
In reply to Przemyslaw MarczakFrom: Inha Song <[email protected]>
This change allows reset device environment to default without using u-boot console, which is useful for system developers.
---
Changes v2:
- extend commit message
Changes v3:
- none
Changes v4:
- none
board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -122,6 +122,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"UMS", "ums"}, {"DFU", "dfu"}, {"GPT", "gpt"}, + {"ENV", "env"}, {"EXIT", ""}, };
@@ -132,6 +133,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"mass storage" ,"firmware update" ,"restore" , +"default" , "and run normal boot" };
@@ -142,6 +144,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"ums 0 mmc 0" ,"dfu 0 mmc 0" ,"gpt write mmc 0 $partitions" , +"env default -a; saveenv" , "", };
include/samsung/misc.h +1 -0
@@ -16,6 +16,7 @@ enum {BOOT_MODE_UMS ,BOOT_MODE_DFU ,BOOT_MODE_GPT , +BOOT_MODE_ENV , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.1
PATCH v4 4/5 samsung: misc: keys: fix gpio key bouncing by adding 50 ms delay
In reply to Przemyslaw MarczakThis change prevents gpio keys bouncing by adding 50 ms delay when key pressed condition met.
---
Changes v2:
- new commit
Changes v3:
- correct commit message
Changes v4:
- none
board/samsung/common/misc.c | 4 ++++ 1 file changed, 4 insertions(+)
board/samsung/common/misc.c +4 -0
@@ -105,6 +105,10 @@ static int check_keys(void)if (key_pressed (KEY_VOLUMEDOWN )) keys +=KEY_VOLUMEDOWN ; +/* Avoids gpio keys debouncing */ +if (keys) +mdelay (50 ); +return keys; }
Signature · 1 line
1.9.1
PATCH v4 4/5 samsung: misc: keys: fix gpio key bouncing by adding 50 ms delay
Quoted 6 lines · Przemyslaw Marczak
This change prevents gpio keys bouncing by adding 50 ms delay when key pressed condition met.
[ ... ]
board/samsung/common/misc.c static int check_keys(void) · line 113
Quoted 9 lines
board/samsung/common/misc.c +4
-0@@ -105,6 +105,10 @@ static int check_keys(void)if (key_pressed (KEY_VOLUMEDOWN )) keys +=KEY_VOLUMEDOWN ; +/* Avoids gpio keys debouncing */ +if (keys) +mdelay (50 ); +return keys; }
The approach might have helped in your case, since you tested it and found it's good. I'm just wondering whether the code really does correct de-bouncing.
The delay does decrease the polling frequency (assuming that the routine is called in a loop). But you return data that was sampled before the delay. You don't re-fetch samples after the delay. And this would not necessarily help either, I'm afraid.
In case the GPIO (or the key_pressed() call) does debouncing, you wouldn't need it here. If the key_pressed() result still is bouncy, then the above logic would not debounce it. What you need is some kind of "trigger" where you notice that the line levels are changing, and a delayed fetch of the lines' values after they have settled. Without the first condition, you always have the risk of sampling arbitrary data that does not reflect the keys' status.
nit: The comment still appears to be misleading, you don't want to avoid debouncing. :)
virtually yours
Gerhard Sittig
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
PATCH v4 4/5 samsung: misc: keys: fix gpio key bouncing by adding 50 ms delay
Quoted 7 lines · Gerhard Sittig
[ ... ] What you
need is some kind of "trigger" where you notice that the line levels are changing, and a delayed fetch of the lines' values after they have settled. Without the first condition, you always have the risk of sampling arbitrary data that does not reflect the keys' status.
Let me mention another approach here for completeness.
You might want to fetch samples into some buffer (a "FIFO" of a certain depth), and only pass along "pressed" or "released" conditions when a certain number of successive samples have the same level and this level is different from what you have passed along previously. That is, you only report changes in the keys' condition after they have become stable.
This approach might be the least intrusive in the context of the routine that you modify in your patch. And it can be acceptably cheap both in terms of computation as well as in storage.
bool last_reported = 0;
int last_sampled = 0;
last_sampled <<= 1;
last_sampled &= 0xfff;
last_sampled |= (key_pressed() ? 1 : 0;
if (last_reported && last_sampled == 0) {
/* report the "released" edge */
last_reported = false;
}
if (!last_reported && last_sampled == 0xfff) {
/* report the "pressed" edge */
last_reported = true;
}
/* other cases either are no changes, or changes that
* have not yet become stable */Just pick a depth and sampling frequency that matches the characteristics of the mechanical bouncing of the switches. Several ten milliseconds is a good estimate (and most users won't notice the delay). This might be a useful helper for other boards to use, too.
virtually yours
Gerhard Sittig
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: [email protected]
PATCH v4 4/5 samsung: misc: keys: fix gpio key bouncing by adding 50 ms delay
In reply to Gerhard SittigHello Gerhard,
Quoted 35 lines · Gerhard Sittig
Quoted 6 lines · Przemyslaw Marczak
This change prevents gpio keys bouncing by adding 50 ms delay when key pressed condition met.
[ ... ]
board/samsung/common/misc.c static int check_keys(void) · line 113
Quoted 9 lines
board/samsung/common/misc.c +4
-0@@ -105,6 +105,10 @@ static int check_keys(void)if (key_pressed (KEY_VOLUMEDOWN )) keys +=KEY_VOLUMEDOWN ; +/* Avoids gpio keys debouncing */ +if (keys) +mdelay (50 ); +return keys; }The approach might have helped in your case, since you tested it and found it's good. I'm just wondering whether the code really does correct de-bouncing.
The delay does decrease the polling frequency (assuming that the routine is called in a loop). But you return data that was sampled before the delay. You don't re-fetch samples after the delay. And this would not necessarily help either, I'm afraid.
In case the GPIO (or the
key_pressed()call) does debouncing, you wouldn't need it here. If thekey_pressed()result still is bouncy, then the above logic would not debounce it. What you need is some kind of "trigger" where you notice that the line levels are changing, and a delayed fetch of the lines' values after they have settled. Without the first condition, you always have the risk of sampling arbitrary data that does not reflect the keys' status.
Quoted 7 lines
nit: The comment still appears to be misleading, you don't want to avoid debouncing. :)
virtually yours
Gerhard Sittig
This is right notice. Actually the problem was not a key bouncing. The right problem is about the menu loop where check_keys() is called too many times for a one second.
And changing menu position few times in a second is useless and hard to choose proper menu option.
Putting delay into check_keys() function was good enough to make this menu more useful but in fact this was not a solution for key bouncing.
Function check_keys() should be as fast as it could be.
So I think that I need only increase a delay in the menu loop which is now 100ms.
Increasing it to 200ms gives good results. It's a simple solution.
What do you think about this?
Thank you for comments.
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH v4 5/5 samsung: misc: remove download mode info screen
In reply to Przemyslaw MarczakThis change removes LCD menu download mode info screen. Now key press timeout is checked in function download_menu() and menu options are displayed directly after PWR + VOLUP keys.
---
Changes v4:
- new commit
board/samsung/common/misc.c | 73 +++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 42 deletions(-)
board/samsung/common/misc.c +31 -42
@@ -265,7 +265,7 @@ static void display_download_menu(int mode) selection[mode] ="[=>]" ;lcd_clear (); -lcd_printf ("\n\t\tDownload Mode Menu\n" ); +lcd_printf ("\n\n\t\tDownload Mode Menu\n\n" );for (i =0 ; i <=BOOT_MODE_EXIT ; i++) lcd_printf("\t%s %s - %s\n\n", selection[i],
@@ -278,10 +278,38 @@ static void download_menu(void)int mode =0 ;int last_mode =0 ;int run; -int key; +int key =0 ; +int timeout =15 ;/* sec */ +int i;display_download_menu (mode); +lcd_puts ("\n" ); + +/* Start count if no key is pressed */ +while (check_keys ()) +continue ; + +while (timeout--) { +lcd_printf ("\r\tNormal boot will start in: %2.d seconds." , + timeout); + +/* about 1000 ms in for loop */ +for (i =0 ; i <10 ; i++) { +mdelay (100 ); + key =check_keys (); +if (key) +break ; + } +if (key) +break ; + } + +if (!key) { +lcd_clear (); +return ; + } +while (1 ) { run =0 ;
@@ -319,45 +347,6 @@ static void download_menu(void)lcd_clear (); } -static void display_mode_info (void ) -{ -lcd_position_cursor (4 ,4 ); -lcd_printf ("%s\n" ,U_BOOT_VERSION ); -lcd_puts ("\nDownload Mode Menu\n" ); -#ifdef CONFIG_SYS_BOARD -lcd_printf ("Board name: %s\n" ,CONFIG_SYS_BOARD ); -#endif -lcd_printf ("Press POWER KEY to display MENU options." ); -} - -static int boot_menu (void ) -{ -int key =0 ; -int timeout =10 ; - -display_mode_info (); - -while (timeout--) { -lcd_printf ("\rNormal boot will start in: %d seconds." , timeout); -mdelay (1000 ); - - key =key_pressed (KEY_POWER ); -if (key) -break ; - } - -lcd_clear (); - -/* If PWR pressed - show download menu */ -if (key) { -printf ("Power pressed - go to download menu\n" ); -download_menu (); -printf ("Download mode exit.\n" ); - } - -return 0 ; -} -void check_boot_mode (void ) {int pwr_key;
@@ -370,7 +359,7 @@ void check_boot_mode(void)power_key_pressed (KEY_PWR_INTERRUPT_REG );if (key_pressed (KEY_VOLUMEUP )) -boot_menu (); +download_menu ();else if (key_pressed (KEY_VOLUMEDOWN ))mode_leave_menu (BOOT_MODE_THOR ); }
Signature · 1 line
1.9.1
PATCH v5 1/5 samsung: misc: allows using environmental macros as args in menu commands
In reply to Przemyslaw MarczakFunction cmd_process() runs commands with directly given list of arguments but it doesn't expand given environmental variables names as macros. Command "gpt" as one of arguments expects expanded macro e.g. $partitions so it needs to be called by function run_command().
Changes:
- extend array mode_name by lower case commands names - used by find_cmd()
- put each command arguments into one string - used by run_command()
- use run_command() instead of cmd_process()
---
Changes v2:
- new commit after separate previous commit
Changes v3:
- none
Changes v4:
- none
Changes v5:
- none
--- board/samsung/common/misc.c | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-)
board/samsung/common/misc.c +22 -27
@@ -116,12 +116,12 @@ static int check_keys(void)* 4 BOOT_MODE_EXIT */ static char * -mode_name[BOOT_MODE_EXIT +1 ] = { -"DEVICE" , -"THOR" , -"UMS" , -"DFU" , -"EXIT" +mode_name[BOOT_MODE_EXIT +1 ][2 ] = { + {"DEVICE" ,"" }, + {"THOR" ,"thor" }, + {"UMS" ,"ums" }, + {"DFU" ,"dfu" }, + {"EXIT" ,"" }, }; static char *
@@ -133,15 +133,13 @@ mode_info[BOOT_MODE_EXIT + 1] = { "and run normal boot" }; -#define MODE_CMD_ARGC 4 -static char * -mode_cmd[BOOT_MODE_EXIT +1 ][MODE_CMD_ARGC ] = { - {"" ,"" ,"" ,"" }, - {"thor" ,"0" ,"mmc" ,"0" }, - {"ums" ,"0" ,"mmc" ,"0" }, - {"dfu" ,"0" ,"mmc" ,"0" }, - {"" ,"" ,"" ,"" }, +mode_cmd[BOOT_MODE_EXIT +1 ] = { +"" , +"thor 0 mmc 0" , +"ums 0 mmc 0" , +"dfu 0 mmc 0" , +"" , };static void display_board_info (void )
@@ -182,11 +180,10 @@ static void display_board_info(void)static int mode_leave_menu (int mode) {char *exit_option; -char *exit_boot ="boot" ; +char *exit_reset ="reset" ;char *exit_back ="back" ;cmd_tbl_t *cmd;int cmd_result; -int cmd_repeatable;int leave;lcd_clear ();
@@ -200,31 +197,29 @@ static int mode_leave_menu(int mode) leave =0 ;break ;default : - cmd =find_cmd (mode_cmd[mode][0 ]); + cmd =find_cmd (mode_name[mode][1 ]);if (cmd) { -printf ("Enter: %s %s\n" , mode_name[mode], +printf ("Enter: %s %s\n" , mode_name[mode][0 ], mode_info[mode]); -lcd_printf ("\n\n\t%s %s\n" , mode_name[mode], +lcd_printf ("\n\n\t%s %s\n" , mode_name[mode][0 ], mode_info[mode]);lcd_puts ("\n\tDo not turn off device before finish!\n" ); - cmd_result =cmd_process (0 ,MODE_CMD_ARGC , - *(mode_cmd + mode), - &cmd_repeatable,NULL ); + cmd_result =run_command (mode_cmd[mode],0 );if (cmd_result ==CMD_RET_SUCCESS ) {printf ("Command finished\n" );lcd_clear ();lcd_printf ("\n\n\t%s finished\n" , - mode_name[mode]); + mode_name[mode][0 ]); - exit_option = exit_boot; + exit_option = exit_reset; leave =1 ; }else {printf ("Command error\n" );lcd_clear ();lcd_printf ("\n\n\t%s command error\n" , - mode_name[mode]); + mode_name[mode][0 ]); exit_option = exit_back; leave =0 ;
@@ -264,7 +259,7 @@ static void display_download_menu(int mode)for (i =0 ; i <=BOOT_MODE_EXIT ; i++)lcd_printf ("\t%s %s - %s\n\n" , selection[i], - mode_name[i], + mode_name[i][0 ], mode_info[i]); }
@@ -305,7 +300,7 @@ static void download_menu(void)if (run) {if (mode_leave_menu (mode)) -break ; +run_command ("reset" ,0 );display_download_menu (mode); }
Signature · 1 line
1.9.1
PATCH v5 2/5 samsung: misc: add gpt restore option to lcd menu
This menu option allows restore gpt.
This is usefull and no needs access to the u-boot console. For proper operation:
- each partition uuid should be set in environment or
- CONFIG_RANDOM_UUID should be defined for automatically uuid setting
After operation success device is going to be reset.
---
Changes v2:
- commit separation
Changes v3:
- none
Changes v4:
- none
Changes v5:
- none
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -121,6 +121,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"THOR", "thor"}, {"UMS", "ums"}, {"DFU", "dfu"}, + {"GPT", "gpt"}, {"EXIT", ""}, };
@@ -130,6 +131,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"downloader" ,"mass storage" ,"firmware update" , +"restore" , "and run normal boot" };
@@ -139,6 +141,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"thor 0 mmc 0" ,"ums 0 mmc 0" ,"dfu 0 mmc 0" , +"gpt write mmc 0 $partitions" , "", };
include/samsung/misc.h +1 -0
@@ -15,6 +15,7 @@ enum {BOOT_MODE_THOR ,BOOT_MODE_UMS ,BOOT_MODE_DFU , +BOOT_MODE_GPT , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.1
PATCH v5 2/5 samsung: misc: add gpt restore option to lcd menu
Quoted 21 lines · Przemyslaw Marczak
This menu option allows restore gpt.
This is usefull and no needs access to the u-boot console. For proper operation:
- each partition uuid should be set in environment or
-CONFIG_RANDOM_UUIDshould be defined for automatically uuid settingAfter operation success device is going to be reset.
Signed-off-by Przemyslaw Marczak <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes v2:
- commit separationChanges v3:
- noneChanges v4:
- none
Quoted 8 lines
Changes v5:
- none--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
PATCH v5 3/5 samsung: misc: add env default option to lcd menu
In reply to Przemyslaw MarczakFrom: Inha Song <[email protected]>
This change allows reset device environment to default without using u-boot console, which is useful for system developers.
---
Changes v2:
- extend commit message
Changes v3:
- none
Changes v4:
- none
Changes v5:
- none
--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
board/samsung/common/misc.c +3 -0
@@ -122,6 +122,7 @@ mode_name[BOOT_MODE_EXIT + 1][2] = { {"UMS", "ums"}, {"DFU", "dfu"}, {"GPT", "gpt"}, + {"ENV", "env"}, {"EXIT", ""}, };
@@ -132,6 +133,7 @@ mode_info[BOOT_MODE_EXIT + 1] = {"mass storage" ,"firmware update" ,"restore" , +"default" , "and run normal boot" };
@@ -142,6 +144,7 @@ mode_cmd[BOOT_MODE_EXIT + 1] = {"ums 0 mmc 0" ,"dfu 0 mmc 0" ,"gpt write mmc 0 $partitions" , +"env default -a; saveenv" , "", };
include/samsung/misc.h +1 -0
@@ -16,6 +16,7 @@ enum {BOOT_MODE_UMS ,BOOT_MODE_DFU ,BOOT_MODE_GPT , +BOOT_MODE_ENV , BOOT_MODE_EXIT, };
Signature · 1 line
1.9.1
PATCH v5 3/5 samsung: misc: add env default option to lcd menu
Quoted 19 lines · Przemyslaw Marczak
From: Inha Song <[email protected]>
This change allows reset device environment to default without using u-boot console, which is useful for system developers.
Signed-off-by Inha Song <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes v2:
- extend commit messageChanges v3:
- noneChanges v4:
- none
Quoted 7 lines
Changes v5:
- none--- board/samsung/common/misc.c | 3 +++ include/samsung/misc.h | 1 + 2 files changed, 4 insertions(+)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
PATCH v5 4/5 samsung: misc: menu: increase delay in menu main loop
In reply to Przemyslaw MarczakIncrease menu loop delay to 200 ms helps choose the right menu option by user. Before this, each time key was pressed the current menu option was changed few times.
Now it changes only once and also changes few times if key is pressed for a longer time.
---
Changes v2:
- new commit
Changes v3:
- correct commit message
Changes v4:
- none
Changes v5:
- move mdelay() from check_keys() to menu loop
- update commit msg
--- board/samsung/common/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/samsung/common/misc.c +1 -1
@@ -285,7 +285,7 @@ static void download_menu(void)display_download_menu (mode); last_mode = mode; -mdelay (100 ); +mdelay (200 ); key =check_keys ();switch (key) {
Signature · 1 line
1.9.1
PATCH v5 4/5 samsung: misc: menu: increase delay in menu main loop
Quoted 6 lines · Przemyslaw Marczak
Increase menu loop delay to 200 ms helps choose the right menu option by user. Before this, each time key was pressed the current menu option was changed few times.
Now it changes only once and also changes few times if key is pressed for a longer time.
Since this description better reflects the motivation of the change, and because there appears to be no need to actually de-bounce the keys, I think this patch is good.
virtually yours
Gerhard Sittig
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
PATCH v5 4/5 samsung: misc: menu: increase delay in menu main loop
Quoted 8 lines · Gerhard Sittig
Quoted 6 lines · Przemyslaw Marczak
Increase menu loop delay to 200 ms helps choose the right menu option by user. Before this, each time key was pressed the current menu option was changed few times.
Now it changes only once and also changes few times if key is pressed for a longer time.
Quoted 8 lines
Since this description better reflects the motivation of the change, and because there appears to be no need to actually de-bounce the keys, I think this patch is good.
virtually yours
Gerhard Sittig
Thanks:)
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH v5 4/5 samsung: misc: menu: increase delay in menu main loop
In reply to Przemyslaw MarczakQuoted 19 lines · Przemyslaw Marczak
Increase menu loop delay to 200 ms helps choose the right menu option by user. Before this, each time key was pressed the current menu option was changed few times.
Now it changes only once and also changes few times if key is pressed for a longer time.Signed-off-by Przemyslaw Marczak <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes v2:
- new commitChanges v3:
- correct commit messageChanges v4:
- none
Quoted 8 lines
Changes v5:
- movemdelay()fromcheck_keys()to menu loop
- update commit msg--- board/samsung/common/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
PATCH v5 5/5 samsung: misc: remove download mode info screen
In reply to Przemyslaw MarczakThis change removes LCD menu download mode info screen. Now key press timeout is checked in function download_menu() and menu options are displayed directly after PWR + VOLUP keys.
---
Changes v4:
- new commit
Changes v5:
- none
--- board/samsung/common/misc.c | 73 +++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 42 deletions(-)
board/samsung/common/misc.c +31 -42
@@ -261,7 +261,7 @@ static void display_download_menu(int mode) selection[mode] ="[=>]" ;lcd_clear (); -lcd_printf ("\n\t\tDownload Mode Menu\n" ); +lcd_printf ("\n\n\t\tDownload Mode Menu\n\n" );for (i =0 ; i <=BOOT_MODE_EXIT ; i++) lcd_printf("\t%s %s - %s\n\n", selection[i],
@@ -274,10 +274,38 @@ static void download_menu(void)int mode =0 ;int last_mode =0 ;int run; -int key; +int key =0 ; +int timeout =15 ;/* sec */ +int i;display_download_menu (mode); +lcd_puts ("\n" ); + +/* Start count if no key is pressed */ +while (check_keys ()) +continue ; + +while (timeout--) { +lcd_printf ("\r\tNormal boot will start in: %2.d seconds." , + timeout); + +/* about 1000 ms in for loop */ +for (i =0 ; i <10 ; i++) { +mdelay (100 ); + key =check_keys (); +if (key) +break ; + } +if (key) +break ; + } + +if (!key) { +lcd_clear (); +return ; + } +while (1 ) { run =0 ;
@@ -315,45 +343,6 @@ static void download_menu(void)lcd_clear (); } -static void display_mode_info (void ) -{ -lcd_position_cursor (4 ,4 ); -lcd_printf ("%s\n" ,U_BOOT_VERSION ); -lcd_puts ("\nDownload Mode Menu\n" ); -#ifdef CONFIG_SYS_BOARD -lcd_printf ("Board name: %s\n" ,CONFIG_SYS_BOARD ); -#endif -lcd_printf ("Press POWER KEY to display MENU options." ); -} - -static int boot_menu (void ) -{ -int key =0 ; -int timeout =10 ; - -display_mode_info (); - -while (timeout--) { -lcd_printf ("\rNormal boot will start in: %d seconds." , timeout); -mdelay (1000 ); - - key =key_pressed (KEY_POWER ); -if (key) -break ; - } - -lcd_clear (); - -/* If PWR pressed - show download menu */ -if (key) { -printf ("Power pressed - go to download menu\n" ); -download_menu (); -printf ("Download mode exit.\n" ); - } - -return 0 ; -} -void check_boot_mode (void ) {int pwr_key;
@@ -366,7 +355,7 @@ void check_boot_mode(void)power_key_pressed (KEY_PWR_INTERRUPT_REG );if (key_pressed (KEY_VOLUMEUP )) -boot_menu (); +download_menu ();else if (key_pressed (KEY_VOLUMEDOWN ))mode_leave_menu (BOOT_MODE_THOR ); }
Signature · 1 line
1.9.1
PATCH v5 5/5 samsung: misc: remove download mode info screen
Dear Przemyslaw Marczak,
Quoted 52 lines · Przemyslaw Marczak
This change removes LCD menu download mode info screen. Now key press timeout is checked in function
download_menu()and menu options are displayed directly after PWR + VOLUP keys.Signed-off-by Przemyslaw Marczak <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes v4:
- new commitChanges v5:
- none--- board/samsung/common/misc.c | 73 +++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 42 deletions(-)board/samsung/common/misc.c +13
-2@@ -261,7 +261,7 @@ static void display_download_menu(int mode) selection[mode] ="[=>]" ;lcd_clear (); -lcd_printf ("\n\t\tDownload Mode Menu\n" ); +lcd_printf ("\n\n\t\tDownload Mode Menu\n\n" );for (i =0 ; i <=BOOT_MODE_EXIT ; i++) lcd_printf("\t%s %s - %s\n\n", selection[i],@@ -274,10 +274,38 @@ static void download_menu(void)int mode =0 ;int last_mode =0 ;int run; -int key; +int key =0 ; +int timeout =15 ;/* sec */ +int i;display_download_menu (mode); +lcd_puts ("\n" ); + +/* Start count if no key is pressed */ +while (check_keys ()) +continue ; + +while (timeout--) { +lcd_printf ("\r\tNormal boot will start in: %2.d seconds." , + timeout);
board/samsung/common/misc.c static void download_menu(void) · line 301
Quoted 10 lines
board/samsung/common/misc.c +9
-0+ +/* about 1000 ms in for loop */ +for (i =0 ; i <10 ; i++) { +mdelay (100 ); + key =check_keys (); +if (key) +break ; + } +if (key)
maybe, unnecessary if statement.
Quoted 70 lines
board/samsung/common/misc.c +8
-39+break ; + } + +if (!key) { +lcd_clear (); +return ; + } +while (1 ) { run =0 ;@@ -315,45 +343,6 @@ static void download_menu(void)lcd_clear (); } -static void display_mode_info (void ) -{ -lcd_position_cursor (4 ,4 ); -lcd_printf ("%s\n" ,U_BOOT_VERSION ); -lcd_puts ("\nDownload Mode Menu\n" ); -#ifdef CONFIG_SYS_BOARD -lcd_printf ("Board name: %s\n" ,CONFIG_SYS_BOARD ); -#endif -lcd_printf ("Press POWER KEY to display MENU options." ); -} - -static int boot_menu (void ) -{ -int key =0 ; -int timeout =10 ; - -display_mode_info (); - -while (timeout--) { -lcd_printf ("\rNormal boot will start in: %d seconds." , timeout); -mdelay (1000 ); - - key =key_pressed (KEY_POWER ); -if (key) -break ; - } - -lcd_clear (); - -/* If PWR pressed - show download menu */ -if (key) { -printf ("Power pressed - go to download menu\n" ); -download_menu (); -printf ("Download mode exit.\n" ); - } - -return 0 ; -} -void check_boot_mode (void ) {int pwr_key;board/samsung/common/misc.c +1
-2@@ -366,7 +355,7 @@ void check_boot_mode(void)power_key_pressed (KEY_PWR_INTERRUPT_REG );if (key_pressed (KEY_VOLUMEUP )) -boot_menu (); +download_menu ();else if (key_pressed (KEY_VOLUMEDOWN ))mode_leave_menu (BOOT_MODE_THOR ); } --1.9.1
Quoted 5 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Thanks,
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net
PATCH v5 5/5 samsung: misc: remove download mode info screen
Hello Minkyu,
Quoted 71 lines · Minkyu Kang
Dear Przemyslaw Marczak,
On 30 April 2014 20:28, Przemyslaw Marczak <[email protected] <mailto:[email protected]>> wrote:
This change removes LCD menu download mode info screen. Now key press timeout is checked in function
download_menu()and menu options are displayed directly after PWR + VOLUP keys.Signed-off-by Przemyslaw Marczak <[email protected]<mailto:[email protected]>>
Cc: Minkyu Kang <mk7.kang at samsung.com <mailto:[email protected]>>---
Changes v4:
- new commitChanges v5:
- none---
board/samsung/common/misc.c| 73
+++++++++++++++++++--------------------------
1 file changed, 31 insertions(+), 42 deletions(-)diff --git
a/board/samsung/common/misc.cb/board/samsung/common/misc.cindex 2ea275e..03106fd 100644
---a/board/samsung/common/misc.c
+++b/board/samsung/common/misc.c
@@ -261,7 +261,7 @@ static voiddisplay_download_menu(int mode)
selection[mode] = "[=>]";
lcd_clear();
-lcd_printf("\n\t\tDownload Mode Menu\n");
+lcd_printf("\n\n\t\tDownload Mode Menu\n\n");for (i = 0; i <=
BOOT_MODE_EXIT; i++)
lcd_printf("\t%s %s - %s\n\n", selection[i],
@@ -274,10 +274,38 @@ static voiddownload_menu(void)
int mode = 0;
intlast_mode= 0;
int run;
- int key;
+ int key = 0;
+ int timeout = 15; /* sec */
+ int i;
display_download_menu(mode);+
lcd_puts("\n");
+
+ /* Start count if no key is pressed */
+ while (check_keys())
+ continue;
+
+ while (timeout--) {
+ lcd_printf("\r\tNormal boot will start in: %2.d
seconds.",
+ timeout);
+
+ /* about 1000 ms in for loop */
+ for (i = 0; i < 10; i++) {
+ mdelay(100);
+ key =check_keys();
+ if (key)
+ break;
+ }
+ if (key)
Quoted 2 lines
maybe, unnecessary if statement.
Please take a notice that there are two loops: "while" and "for", so the second "if (key)" is necessary for break a "while" loop on "user event".
Quoted 76 lines
+ break;
+ }
+
+ if (!key) {
+lcd_clear();
+ return;
+ }
+
while (1) {
run = 0;@@ -315,45 +343,6 @@ static void
download_menu(void)
lcd_clear();
}-static void
display_mode_info(void)
-{
-lcd_position_cursor(4, 4);
-lcd_printf("%s\n", U_BOOT_VERSION);
-lcd_puts("\nDownload Mode Menu\n");
-#ifdefCONFIG_SYS_BOARD
-lcd_printf("Board name: %s\n", CONFIG_SYS_BOARD);
-#endif
-lcd_printf("Press POWER KEY to display MENU options.");
-}
-
-static intboot_menu(void)
-{
- int key = 0;
- int timeout = 10;
-
-display_mode_info();
-
- while (timeout--) {
- lcd_printf("\rNormal boot will start in: %d
seconds.", timeout);
- mdelay(1000);
-
- key =key_pressed(KEY_POWER);
- if (key)
- break;
- }
-
-lcd_clear();
-
- /* If PWR pressed - show download menu */
- if (key) {
-printf("Power pressed - go to download menu\n");
-download_menu();
-printf("Download mode exit.\n");
- }
-
- return 0;
-}
-
voidcheck_boot_mode(void)
{
intpwr_key;
@@ -366,7 +355,7 @@ voidcheck_boot_mode(void)
power_key_pressed(KEY_PWR_INTERRUPT_REG);if (
key_pressed(KEY_VOLUMEUP))
-boot_menu();
+download_menu();
else if (key_pressed(KEY_VOLUMEDOWN))
mode_leave_menu(BOOT_MODE_THOR);
}
--
1.9.1_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de <mailto:[email protected]>
http://lists.denx.de/mailman/listinfo/u-boot
Quoted 5 lines
Thanks,
Minkyu Kang.
--
from. prom.
www.promsoft.net <http://www.promsoft.net>
Thank you
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH v5 5/5 samsung: misc: remove download mode info screen
Dear Przemyslaw Marczak,
Quoted 74 lines · Przemyslaw Marczak
Hello Minkyu,
Quoted 71 lines · Minkyu Kang
Dear Przemyslaw Marczak,
On 30 April 2014 20:28, Przemyslaw Marczak <[email protected] <mailto:[email protected]>> wrote:
This change removes LCD menu download mode info screen. Now key press timeout is checked in function
download_menu()and menu options are displayed directly after PWR + VOLUP keys.Signed-off-by Przemyslaw Marczak <[email protected]<mailto:[email protected]>>
Cc: Minkyu Kang <mk7.kang at samsung.com <mailto:[email protected]>>---
Changes v4:
- new commitChanges v5:
- none---
board/samsung/common/misc.c| 73
+++++++++++++++++++--------------------------
1 file changed, 31 insertions(+), 42 deletions(-)diff --git
a/board/samsung/common/misc.cb/board/samsung/common/misc.cindex 2ea275e..03106fd 100644
---a/board/samsung/common/misc.c
+++b/board/samsung/common/misc.c
@@ -261,7 +261,7 @@ static voiddisplay_download_menu(int mode)
selection[mode] = "[=>]";
lcd_clear();
-lcd_printf("\n\t\tDownload Mode Menu\n");
+lcd_printf("\n\n\t\tDownload Mode Menu\n\n");for (i = 0; i <=
BOOT_MODE_EXIT; i++)
lcd_printf("\t%s %s - %s\n\n", selection[i],
@@ -274,10 +274,38 @@ static voiddownload_menu(void)
int mode = 0;
intlast_mode= 0;
int run;
- int key;
+ int key = 0;
+ int timeout = 15; /* sec */
+ int i;
display_download_menu(mode);+
lcd_puts("\n");
+
+ /* Start count if no key is pressed */
+ while (check_keys())
+ continue;
+
+ while (timeout--) {
+ lcd_printf("\r\tNormal boot will start in: %2.d
seconds.",
+ timeout);
+
+ /* about 1000 ms in for loop */
+ for (i = 0; i < 10; i++) {
+ mdelay(100);
+ key =check_keys();
+ if (key)
+ break;
+ }
+ if (key)
Quoted 5 lines
Quoted 2 lines
maybe, unnecessary if statement.
Please take a notice that there are two loops: "while" and "for", so the second "if (key)" is necessary for break a "while" loop on "user event".
Ah, I see :)
actually, I doubt that need to two loops... anyway OK.
Thanks,
Minkyu Kang.
PATCH v5 5/5 samsung: misc: remove download mode info screen
In reply to Przemyslaw MarczakQuoted 11 lines · Przemyslaw Marczak
This change removes LCD menu download mode info screen. Now key press timeout is checked in function
download_menu()and menu options are displayed directly after PWR + VOLUP keys.Signed-off-by Przemyslaw Marczak <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes v4:
- new commit
Quoted 7 lines
Changes v5:
- none--- board/samsung/common/misc.c | 73 +++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 42 deletions(-)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
PATCH v5 1/5 samsung: misc: allows using environmental macros as args in menu commands
In reply to Przemyslaw MarczakQuoted 23 lines · Przemyslaw Marczak
Function
cmd_process()runs commands with directly given list of arguments but it doesn't expand given environmental variables names as macros. Command "gpt" as one of arguments expects expanded macro e.g. $partitions so it needs to be called by functionrun_command().Changes:
- extend arraymode_nameby lower case commands names - used byfind_cmd()
- put each command arguments into one string - used byrun_command()
- userun_command()instead ofcmd_process()Signed-off-by Przemyslaw Marczak <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes v2:
- new commit after separate previous commitChanges v3:
- noneChanges v4:
- none
Quoted 7 lines
Changes v5:
- none--- board/samsung/common/misc.c | 49 ++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 27 deletions(-)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.