mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] at91: bootstrap: add menu support
@ 2013-01-24 11:30 Jean-Christophe PLAGNIOL-VILLARD
  2013-01-24 11:33 ` [PATCH 1/2] menu: the dependancy on process escape is wrong drop it Jean-Christophe PLAGNIOL-VILLARD
  2013-01-31 13:21 ` [PATCH 0/2] " Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-24 11:30 UTC (permalink / raw)
  To: barebox

HI,

	if you enable the menu support and press m you will be able to display
	a menu and then choose from where you want to boot

	use full as on at91 we can not choose an alternative boot from a pin

The following changes since commit 6d588b9bfd85247f9007c002cec98a7535764ae4:

  Merge branch 'for-next/misc' into next (2013-01-23 20:46:17 +0100)

are available in the git repository at:


  git://git.jcrosoft.org/barebox.git delivery/at91bootstrap_menu

for you to fetch changes up to 01086f0c0f72e95a0eda5479f7d323ddc02641dd:

  at91: bootstrap: add menu support (2013-01-20 14:09:06 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
      menu: the dependancy on process escape is wrong drop it
      at91: bootstrap: add menu support

 arch/arm/mach-at91/bootstrap.c |  215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 common/Kconfig                 |    1 -
 2 files changed, 190 insertions(+), 26 deletions(-)

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] menu: the dependancy on process escape is wrong drop it
  2013-01-24 11:30 [PATCH 0/2] at91: bootstrap: add menu support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-24 11:33 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-24 11:33   ` [PATCH 2/2] at91: bootstrap: add menu support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-31 13:21 ` [PATCH 0/2] " Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-24 11:33 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Kconfig |    1 -
 1 file changed, 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index eccae4c..0066ec4 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -403,7 +403,6 @@ config AUTO_COMPLETE
 config MENU
 	bool
 	prompt "Menu Framework"
-	depends on PROCESS_ESCAPE_SEQUENCE
 	help
 	  a menu framework that allow us to create list menu to simplify
 	  barebox and make it more user-frendly
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] at91: bootstrap: add menu support
  2013-01-24 11:33 ` [PATCH 1/2] menu: the dependancy on process escape is wrong drop it Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-24 11:33   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-01-27 11:32     ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-24 11:33 UTC (permalink / raw)
  To: barebox

This will allow to change the boot mode

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/bootstrap.c |  215 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 190 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
index 5ee43ad..4149304 100644
--- a/arch/arm/mach-at91/bootstrap.c
+++ b/arch/arm/mach-at91/bootstrap.c
@@ -10,6 +10,7 @@
 #include <sizes.h>
 #include <malloc.h>
 #include <init.h>
+#include <menu.h>
 
 #if defined(CONFIG_MCI_ATMEL)
 #define is_mmc() 1
@@ -35,46 +36,210 @@
 #define is_dataflash() 0
 #endif
 
-static void boot_seq(bool is_barebox)
+#if defined(CONFIG_MENU) && !defined(CONFIG_NONE)
+#define is_menu() 1
+#else
+#define is_menu() 0
+#endif
+
+static char* is_barebox_to_str(bool is_barebox)
+{
+	return is_barebox ? "barebox" : "unknown";
+}
+
+static void at91bootstrap_boot_m25p80(bool is_barebox)
+{
+	char *name = is_barebox_to_str(is_barebox);
+	int (*func)(void) = NULL;
+
+	func = bootstrap_board_read_m25p80();
+	printf("Boot %s from m25p80\n", name);
+	bootstrap_boot(func, is_barebox);
+	bootstrap_err("... failed\n");
+	free(func);
+}
+
+static void at91bootstrap_boot_dataflash(bool is_barebox)
+{
+	char *name = is_barebox_to_str(is_barebox);
+	int (*func)(void) = NULL;
+
+	printf("Boot %s from dataflash\n", name);
+	func = bootstrap_board_read_dataflash();
+	bootstrap_boot(func, is_barebox);
+	bootstrap_err("... failed\n");
+	free(func);
+}
+
+static void at91bootstrap_boot_nand(bool is_barebox)
+{
+	char *name = is_barebox_to_str(is_barebox);
+	int (*func)(void) = NULL;
+
+	printf("Boot %s from nand\n", name);
+	func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
+	bootstrap_boot(func, is_barebox);
+	bootstrap_err("... failed\n");
+	free(func);
+}
+
+static void at91bootstrap_boot_mmc(void)
 {
-	char *name = is_barebox ? "barebox" : "unknown";
 	int (*func)(void) = NULL;
 
+	printf("Boot from mmc\n");
+	func = bootstrap_read_disk("disk0.0", NULL);
+	bootstrap_boot(func, false);
+	bootstrap_err("... failed\n");
+	free(func);
+}
+
+static void boot_nand_barebox_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_nand(true);
+
+	getc();
+}
+
+static void boot_nand_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_nand(false);
+
+	getc();
+}
+
+static void boot_m25p80_barebox_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_nand(true);
+
+	getc();
+}
+
+static void boot_m25p80_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_nand(false);
+
+	getc();
+}
+
+static void boot_dataflash_barebox_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_dataflash(true);
+
+	getc();
+}
+
+static void boot_dataflash_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_dataflash(false);
+
+	getc();
+}
+
+static void boot_mmc_disk_action(struct menu *m, struct menu_entry *me)
+{
+	at91bootstrap_boot_mmc();
+
+	getc();
+}
+
+static void boot_reset_action(struct menu *m, struct menu_entry *me)
+{
+	reset_cpu(0);
+}
+
+void at91_bootstrap_menu(void)
+{
+	struct menu *m;
+	struct menu_entry *me;
+
+	m = menu_alloc();
+	m->display = m->name = "boot";
+
+	menu_add(m);
+
+	if (is_mmc()) {
+		me = menu_entry_alloc();
+		me->action = boot_mmc_disk_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "mmc";
+		menu_add_entry(m, me);
+	}
+
 	if (is_m25p80()) {
-		func = bootstrap_board_read_m25p80();
-		printf("Boot %s from m25p80\n", name);
-		bootstrap_boot(func, is_barebox);
-		bootstrap_err("... failed\n");
-		free(func);
+		me = menu_entry_alloc();
+		me->action = boot_m25p80_barebox_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "m25p80 (barebox)";
+		menu_add_entry(m, me);
+
+		me = menu_entry_alloc();
+		me->action = boot_m25p80_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "m25p80";
+		menu_add_entry(m, me);
 	}
+
 	if (is_dataflash()) {
-		printf("Boot %s from dataflash\n", name);
-		func = bootstrap_board_read_dataflash();
-		bootstrap_boot(func, is_barebox);
-		bootstrap_err("... failed\n");
-		free(func);
+		me = menu_entry_alloc();
+		me->action = boot_dataflash_barebox_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "dataflash (barebox)";
+		menu_add_entry(m, me);
+
+		me = menu_entry_alloc();
+		me->action = boot_dataflash_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "dataflash";
+		menu_add_entry(m, me);
 	}
+
 	if (is_nand()) {
-		printf("Boot %s from nand\n", name);
-		func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
-		bootstrap_boot(func, is_barebox);
-		bootstrap_err("... failed\n");
-		free(func);
+		me = menu_entry_alloc();
+		me->action = boot_nand_barebox_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "nand (barebox)";
+		menu_add_entry(m, me);
+
+		me = menu_entry_alloc();
+		me->action = boot_nand_action;
+		me->type = MENU_ENTRY_NORMAL;
+		me->display = "nand";
+		menu_add_entry(m, me);
 	}
+
+	me = menu_entry_alloc();
+	me->action = boot_reset_action;
+	me->type = MENU_ENTRY_NORMAL;
+	me->display = "reset";
+	menu_add_entry(m, me);
+
+	menu_show(m);
 }
 
-static int at91_bootstrap(void)
+static void boot_seq(bool is_barebox)
 {
-	int (*func)(void) = NULL;
+	if (is_m25p80())
+		at91bootstrap_boot_m25p80(is_barebox);
 
-	if (is_mmc()) {
-		printf("Boot from mmc\n");
-		func = bootstrap_read_disk("disk0.0", NULL);
-		bootstrap_boot(func, false);
-		bootstrap_err("... failed\n");
-		free(func);
+	if (is_dataflash())
+		at91bootstrap_boot_dataflash(is_barebox);
+
+	if (is_nand())
+		at91bootstrap_boot_nand(is_barebox);
+}
+
+static int at91_bootstrap(void)
+{
+	if (is_menu()) {
+		printf("press 'm' to start the menu\n");
+		if (tstc() && getc() == 'm')
+			at91_bootstrap_menu();
 	}
 
+	if (is_mmc())
+		at91bootstrap_boot_mmc();
+
 	/* First only bootstrap_boot a barebox */
 	boot_seq(true);
 	/* Second bootstrap_boot any */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] at91: bootstrap: add menu support
  2013-01-24 11:33   ` [PATCH 2/2] at91: bootstrap: add menu support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-27 11:32     ` Sascha Hauer
  2013-01-27 11:38       ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2013-01-27 11:32 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, Jan 24, 2013 at 12:33:16PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> This will allow to change the boot mode
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

I applied 1/2. Can you please ping me about this one after the next
release?

Thanks
 Sascha

> ---
>  arch/arm/mach-at91/bootstrap.c |  215 +++++++++++++++++++++++++++++++++++-----
>  1 file changed, 190 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
> index 5ee43ad..4149304 100644
> --- a/arch/arm/mach-at91/bootstrap.c
> +++ b/arch/arm/mach-at91/bootstrap.c
> @@ -10,6 +10,7 @@
>  #include <sizes.h>
>  #include <malloc.h>
>  #include <init.h>
> +#include <menu.h>
>  
>  #if defined(CONFIG_MCI_ATMEL)
>  #define is_mmc() 1
> @@ -35,46 +36,210 @@
>  #define is_dataflash() 0
>  #endif
>  
> -static void boot_seq(bool is_barebox)
> +#if defined(CONFIG_MENU) && !defined(CONFIG_NONE)
> +#define is_menu() 1
> +#else
> +#define is_menu() 0
> +#endif
> +
> +static char* is_barebox_to_str(bool is_barebox)
> +{
> +	return is_barebox ? "barebox" : "unknown";
> +}
> +
> +static void at91bootstrap_boot_m25p80(bool is_barebox)
> +{
> +	char *name = is_barebox_to_str(is_barebox);
> +	int (*func)(void) = NULL;
> +
> +	func = bootstrap_board_read_m25p80();
> +	printf("Boot %s from m25p80\n", name);
> +	bootstrap_boot(func, is_barebox);
> +	bootstrap_err("... failed\n");
> +	free(func);
> +}
> +
> +static void at91bootstrap_boot_dataflash(bool is_barebox)
> +{
> +	char *name = is_barebox_to_str(is_barebox);
> +	int (*func)(void) = NULL;
> +
> +	printf("Boot %s from dataflash\n", name);
> +	func = bootstrap_board_read_dataflash();
> +	bootstrap_boot(func, is_barebox);
> +	bootstrap_err("... failed\n");
> +	free(func);
> +}
> +
> +static void at91bootstrap_boot_nand(bool is_barebox)
> +{
> +	char *name = is_barebox_to_str(is_barebox);
> +	int (*func)(void) = NULL;
> +
> +	printf("Boot %s from nand\n", name);
> +	func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> +	bootstrap_boot(func, is_barebox);
> +	bootstrap_err("... failed\n");
> +	free(func);
> +}
> +
> +static void at91bootstrap_boot_mmc(void)
>  {
> -	char *name = is_barebox ? "barebox" : "unknown";
>  	int (*func)(void) = NULL;
>  
> +	printf("Boot from mmc\n");
> +	func = bootstrap_read_disk("disk0.0", NULL);
> +	bootstrap_boot(func, false);
> +	bootstrap_err("... failed\n");
> +	free(func);
> +}
> +
> +static void boot_nand_barebox_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_nand(true);
> +
> +	getc();
> +}
> +
> +static void boot_nand_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_nand(false);
> +
> +	getc();
> +}
> +
> +static void boot_m25p80_barebox_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_nand(true);
> +
> +	getc();
> +}
> +
> +static void boot_m25p80_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_nand(false);
> +
> +	getc();
> +}
> +
> +static void boot_dataflash_barebox_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_dataflash(true);
> +
> +	getc();
> +}
> +
> +static void boot_dataflash_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_dataflash(false);
> +
> +	getc();
> +}
> +
> +static void boot_mmc_disk_action(struct menu *m, struct menu_entry *me)
> +{
> +	at91bootstrap_boot_mmc();
> +
> +	getc();
> +}
> +
> +static void boot_reset_action(struct menu *m, struct menu_entry *me)
> +{
> +	reset_cpu(0);
> +}
> +
> +void at91_bootstrap_menu(void)
> +{
> +	struct menu *m;
> +	struct menu_entry *me;
> +
> +	m = menu_alloc();
> +	m->display = m->name = "boot";
> +
> +	menu_add(m);
> +
> +	if (is_mmc()) {
> +		me = menu_entry_alloc();
> +		me->action = boot_mmc_disk_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "mmc";
> +		menu_add_entry(m, me);
> +	}
> +
>  	if (is_m25p80()) {
> -		func = bootstrap_board_read_m25p80();
> -		printf("Boot %s from m25p80\n", name);
> -		bootstrap_boot(func, is_barebox);
> -		bootstrap_err("... failed\n");
> -		free(func);
> +		me = menu_entry_alloc();
> +		me->action = boot_m25p80_barebox_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "m25p80 (barebox)";
> +		menu_add_entry(m, me);
> +
> +		me = menu_entry_alloc();
> +		me->action = boot_m25p80_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "m25p80";
> +		menu_add_entry(m, me);
>  	}
> +
>  	if (is_dataflash()) {
> -		printf("Boot %s from dataflash\n", name);
> -		func = bootstrap_board_read_dataflash();
> -		bootstrap_boot(func, is_barebox);
> -		bootstrap_err("... failed\n");
> -		free(func);
> +		me = menu_entry_alloc();
> +		me->action = boot_dataflash_barebox_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "dataflash (barebox)";
> +		menu_add_entry(m, me);
> +
> +		me = menu_entry_alloc();
> +		me->action = boot_dataflash_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "dataflash";
> +		menu_add_entry(m, me);
>  	}
> +
>  	if (is_nand()) {
> -		printf("Boot %s from nand\n", name);
> -		func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> -		bootstrap_boot(func, is_barebox);
> -		bootstrap_err("... failed\n");
> -		free(func);
> +		me = menu_entry_alloc();
> +		me->action = boot_nand_barebox_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "nand (barebox)";
> +		menu_add_entry(m, me);
> +
> +		me = menu_entry_alloc();
> +		me->action = boot_nand_action;
> +		me->type = MENU_ENTRY_NORMAL;
> +		me->display = "nand";
> +		menu_add_entry(m, me);
>  	}
> +
> +	me = menu_entry_alloc();
> +	me->action = boot_reset_action;
> +	me->type = MENU_ENTRY_NORMAL;
> +	me->display = "reset";
> +	menu_add_entry(m, me);
> +
> +	menu_show(m);
>  }
>  
> -static int at91_bootstrap(void)
> +static void boot_seq(bool is_barebox)
>  {
> -	int (*func)(void) = NULL;
> +	if (is_m25p80())
> +		at91bootstrap_boot_m25p80(is_barebox);
>  
> -	if (is_mmc()) {
> -		printf("Boot from mmc\n");
> -		func = bootstrap_read_disk("disk0.0", NULL);
> -		bootstrap_boot(func, false);
> -		bootstrap_err("... failed\n");
> -		free(func);
> +	if (is_dataflash())
> +		at91bootstrap_boot_dataflash(is_barebox);
> +
> +	if (is_nand())
> +		at91bootstrap_boot_nand(is_barebox);
> +}
> +
> +static int at91_bootstrap(void)
> +{
> +	if (is_menu()) {
> +		printf("press 'm' to start the menu\n");
> +		if (tstc() && getc() == 'm')
> +			at91_bootstrap_menu();
>  	}
>  
> +	if (is_mmc())
> +		at91bootstrap_boot_mmc();
> +
>  	/* First only bootstrap_boot a barebox */
>  	boot_seq(true);
>  	/* Second bootstrap_boot any */
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] at91: bootstrap: add menu support
  2013-01-27 11:32     ` Sascha Hauer
@ 2013-01-27 11:38       ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2013-01-27 11:38 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Jan 27, 2013 at 12:32:23PM +0100, Sascha Hauer wrote:
> On Thu, Jan 24, 2013 at 12:33:16PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > This will allow to change the boot mode
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> 
> I applied 1/2. Can you please ping me about this one after the next
> release?

Grmpf. I answered to the wrong mail. This was meant for the mci write
protect patches. I didn't have a look at the bootstrap menu patches yet.

Sascha

> 
> Thanks
>  Sascha
> 
> > ---
> >  arch/arm/mach-at91/bootstrap.c |  215 +++++++++++++++++++++++++++++++++++-----
> >  1 file changed, 190 insertions(+), 25 deletions(-)
> > 
> > diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c
> > index 5ee43ad..4149304 100644
> > --- a/arch/arm/mach-at91/bootstrap.c
> > +++ b/arch/arm/mach-at91/bootstrap.c
> > @@ -10,6 +10,7 @@
> >  #include <sizes.h>
> >  #include <malloc.h>
> >  #include <init.h>
> > +#include <menu.h>
> >  
> >  #if defined(CONFIG_MCI_ATMEL)
> >  #define is_mmc() 1
> > @@ -35,46 +36,210 @@
> >  #define is_dataflash() 0
> >  #endif
> >  
> > -static void boot_seq(bool is_barebox)
> > +#if defined(CONFIG_MENU) && !defined(CONFIG_NONE)
> > +#define is_menu() 1
> > +#else
> > +#define is_menu() 0
> > +#endif
> > +
> > +static char* is_barebox_to_str(bool is_barebox)
> > +{
> > +	return is_barebox ? "barebox" : "unknown";
> > +}
> > +
> > +static void at91bootstrap_boot_m25p80(bool is_barebox)
> > +{
> > +	char *name = is_barebox_to_str(is_barebox);
> > +	int (*func)(void) = NULL;
> > +
> > +	func = bootstrap_board_read_m25p80();
> > +	printf("Boot %s from m25p80\n", name);
> > +	bootstrap_boot(func, is_barebox);
> > +	bootstrap_err("... failed\n");
> > +	free(func);
> > +}
> > +
> > +static void at91bootstrap_boot_dataflash(bool is_barebox)
> > +{
> > +	char *name = is_barebox_to_str(is_barebox);
> > +	int (*func)(void) = NULL;
> > +
> > +	printf("Boot %s from dataflash\n", name);
> > +	func = bootstrap_board_read_dataflash();
> > +	bootstrap_boot(func, is_barebox);
> > +	bootstrap_err("... failed\n");
> > +	free(func);
> > +}
> > +
> > +static void at91bootstrap_boot_nand(bool is_barebox)
> > +{
> > +	char *name = is_barebox_to_str(is_barebox);
> > +	int (*func)(void) = NULL;
> > +
> > +	printf("Boot %s from nand\n", name);
> > +	func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> > +	bootstrap_boot(func, is_barebox);
> > +	bootstrap_err("... failed\n");
> > +	free(func);
> > +}
> > +
> > +static void at91bootstrap_boot_mmc(void)
> >  {
> > -	char *name = is_barebox ? "barebox" : "unknown";
> >  	int (*func)(void) = NULL;
> >  
> > +	printf("Boot from mmc\n");
> > +	func = bootstrap_read_disk("disk0.0", NULL);
> > +	bootstrap_boot(func, false);
> > +	bootstrap_err("... failed\n");
> > +	free(func);
> > +}
> > +
> > +static void boot_nand_barebox_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_nand(true);
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_nand_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_nand(false);
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_m25p80_barebox_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_nand(true);
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_m25p80_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_nand(false);
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_dataflash_barebox_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_dataflash(true);
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_dataflash_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_dataflash(false);
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_mmc_disk_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	at91bootstrap_boot_mmc();
> > +
> > +	getc();
> > +}
> > +
> > +static void boot_reset_action(struct menu *m, struct menu_entry *me)
> > +{
> > +	reset_cpu(0);
> > +}
> > +
> > +void at91_bootstrap_menu(void)
> > +{
> > +	struct menu *m;
> > +	struct menu_entry *me;
> > +
> > +	m = menu_alloc();
> > +	m->display = m->name = "boot";
> > +
> > +	menu_add(m);
> > +
> > +	if (is_mmc()) {
> > +		me = menu_entry_alloc();
> > +		me->action = boot_mmc_disk_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "mmc";
> > +		menu_add_entry(m, me);
> > +	}
> > +
> >  	if (is_m25p80()) {
> > -		func = bootstrap_board_read_m25p80();
> > -		printf("Boot %s from m25p80\n", name);
> > -		bootstrap_boot(func, is_barebox);
> > -		bootstrap_err("... failed\n");
> > -		free(func);
> > +		me = menu_entry_alloc();
> > +		me->action = boot_m25p80_barebox_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "m25p80 (barebox)";
> > +		menu_add_entry(m, me);
> > +
> > +		me = menu_entry_alloc();
> > +		me->action = boot_m25p80_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "m25p80";
> > +		menu_add_entry(m, me);
> >  	}
> > +
> >  	if (is_dataflash()) {
> > -		printf("Boot %s from dataflash\n", name);
> > -		func = bootstrap_board_read_dataflash();
> > -		bootstrap_boot(func, is_barebox);
> > -		bootstrap_err("... failed\n");
> > -		free(func);
> > +		me = menu_entry_alloc();
> > +		me->action = boot_dataflash_barebox_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "dataflash (barebox)";
> > +		menu_add_entry(m, me);
> > +
> > +		me = menu_entry_alloc();
> > +		me->action = boot_dataflash_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "dataflash";
> > +		menu_add_entry(m, me);
> >  	}
> > +
> >  	if (is_nand()) {
> > -		printf("Boot %s from nand\n", name);
> > -		func = bootstrap_read_devfs("nand0", true, SZ_128K, SZ_256K, SZ_1M);
> > -		bootstrap_boot(func, is_barebox);
> > -		bootstrap_err("... failed\n");
> > -		free(func);
> > +		me = menu_entry_alloc();
> > +		me->action = boot_nand_barebox_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "nand (barebox)";
> > +		menu_add_entry(m, me);
> > +
> > +		me = menu_entry_alloc();
> > +		me->action = boot_nand_action;
> > +		me->type = MENU_ENTRY_NORMAL;
> > +		me->display = "nand";
> > +		menu_add_entry(m, me);
> >  	}
> > +
> > +	me = menu_entry_alloc();
> > +	me->action = boot_reset_action;
> > +	me->type = MENU_ENTRY_NORMAL;
> > +	me->display = "reset";
> > +	menu_add_entry(m, me);
> > +
> > +	menu_show(m);
> >  }
> >  
> > -static int at91_bootstrap(void)
> > +static void boot_seq(bool is_barebox)
> >  {
> > -	int (*func)(void) = NULL;
> > +	if (is_m25p80())
> > +		at91bootstrap_boot_m25p80(is_barebox);
> >  
> > -	if (is_mmc()) {
> > -		printf("Boot from mmc\n");
> > -		func = bootstrap_read_disk("disk0.0", NULL);
> > -		bootstrap_boot(func, false);
> > -		bootstrap_err("... failed\n");
> > -		free(func);
> > +	if (is_dataflash())
> > +		at91bootstrap_boot_dataflash(is_barebox);
> > +
> > +	if (is_nand())
> > +		at91bootstrap_boot_nand(is_barebox);
> > +}
> > +
> > +static int at91_bootstrap(void)
> > +{
> > +	if (is_menu()) {
> > +		printf("press 'm' to start the menu\n");
> > +		if (tstc() && getc() == 'm')
> > +			at91_bootstrap_menu();
> >  	}
> >  
> > +	if (is_mmc())
> > +		at91bootstrap_boot_mmc();
> > +
> >  	/* First only bootstrap_boot a barebox */
> >  	boot_seq(true);
> >  	/* Second bootstrap_boot any */
> > -- 
> > 1.7.10.4
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] at91: bootstrap: add menu support
  2013-01-24 11:30 [PATCH 0/2] at91: bootstrap: add menu support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-24 11:33 ` [PATCH 1/2] menu: the dependancy on process escape is wrong drop it Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-31 13:21 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-01-31 13:21 UTC (permalink / raw)
  To: barebox

ping

On 12:30 Thu 24 Jan     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> HI,
> 
> 	if you enable the menu support and press m you will be able to display
> 	a menu and then choose from where you want to boot
> 
> 	use full as on at91 we can not choose an alternative boot from a pin
> 
> The following changes since commit 6d588b9bfd85247f9007c002cec98a7535764ae4:
> 
>   Merge branch 'for-next/misc' into next (2013-01-23 20:46:17 +0100)
> 
> are available in the git repository at:
> 
> 
>   git://git.jcrosoft.org/barebox.git delivery/at91bootstrap_menu
> 
> for you to fetch changes up to 01086f0c0f72e95a0eda5479f7d323ddc02641dd:
> 
>   at91: bootstrap: add menu support (2013-01-20 14:09:06 +0800)
> 
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (2):
>       menu: the dependancy on process escape is wrong drop it
>       at91: bootstrap: add menu support
> 
>  arch/arm/mach-at91/bootstrap.c |  215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
>  common/Kconfig                 |    1 -
>  2 files changed, 190 insertions(+), 26 deletions(-)
> 
> Best Regards,
> J.
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-31 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 11:30 [PATCH 0/2] at91: bootstrap: add menu support Jean-Christophe PLAGNIOL-VILLARD
2013-01-24 11:33 ` [PATCH 1/2] menu: the dependancy on process escape is wrong drop it Jean-Christophe PLAGNIOL-VILLARD
2013-01-24 11:33   ` [PATCH 2/2] at91: bootstrap: add menu support Jean-Christophe PLAGNIOL-VILLARD
2013-01-27 11:32     ` Sascha Hauer
2013-01-27 11:38       ` Sascha Hauer
2013-01-31 13:21 ` [PATCH 0/2] " Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox