1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-01 07:09:22 +02:00

[power] + [s] : enable serial console and bootdelay 5 secs

This commit is contained in:
Xiangfu Liu 2009-12-18 12:21:50 +08:00
parent b33c92aaf5
commit 5623065e48

View File

@ -1,5 +1,5 @@
diff --git a/board/qi_lb60/qi_lb60.c b/board/qi_lb60/qi_lb60.c
index d13f2ab..d20d853 100644
index d13f2ab..93c2571 100644
--- a/board/qi_lb60/qi_lb60.c
+++ b/board/qi_lb60/qi_lb60.c
@@ -12,6 +12,8 @@
@ -23,7 +23,7 @@ index d13f2ab..d20d853 100644
* Initialize LCD pins
*/
__gpio_as_lcd_18bit();
@@ -43,17 +40,30 @@ static void gpio_init(void)
@@ -43,17 +40,31 @@ static void gpio_init(void)
* Initialize Other pins
*/
unsigned int i;
@ -49,6 +49,7 @@ index d13f2ab..d20d853 100644
+ if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){
+ /* if pressed [S] */
+ printf("[S] pressed, enable UART0\n");
+ gd->boot_option = 5;
+ __gpio_as_uart0();
+ } else {
+ printf("[S] not pressed, disable UART0\n");
@ -60,19 +61,19 @@ index d13f2ab..d20d853 100644
__gpio_as_output(GPIO_AUDIO_POP);
__gpio_set_pin(GPIO_AUDIO_POP);
@@ -73,6 +83,11 @@ static void gpio_init(void)
@@ -73,6 +84,11 @@ static void gpio_init(void)
__gpio_as_input(GPIO_USB_DETECT);
__gpio_enable_pull(GPIO_USB_DETECT);
+
+ if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) {
+ printf("[M] pressed, boot from sd card\n");
+ gd->boot_from_sd = 1;
+ gd->boot_option = 1;
+ }
}
static void cpm_init(void)
@@ -96,7 +111,6 @@ void board_early_init(void)
@@ -96,7 +112,6 @@ void board_early_init(void)
int checkboard (void)
{
@ -93,15 +94,31 @@ index be64d13..54bf0ea 100644
#endif
"\0"
};
diff --git a/common/main.c b/common/main.c
index 026edd1..1703d4f 100644
--- a/common/main.c
+++ b/common/main.c
@@ -372,7 +372,9 @@ void main_loop (void)
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
s = getenv ("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
-
+ DECLARE_GLOBAL_DATA_PTR;
+ if (gd->boot_option == 5)
+ bootdelay = gd->boot_option;
debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
# ifdef CONFIG_BOOT_RETRY_TIME
diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h
index db88704..9b4dd77 100644
index db88704..23f597e 100644
--- a/include/asm-mips/global_data.h
+++ b/include/asm-mips/global_data.h
@@ -47,6 +47,7 @@ typedef struct global_data {
@@ -47,6 +47,8 @@ typedef struct global_data {
unsigned long mem_clk; /* Memory bus clock */
unsigned long dev_clk; /* Device clock */
unsigned long fb_base; /* base address of framebuffer */
+ unsigned long boot_from_sd;
+ unsigned long boot_option; /* 1: boot from sd
+ * 5: boot delay for 5 secs*/
#endif
unsigned long baudrate;
unsigned long have_console; /* serial_init() was called */
@ -119,7 +136,7 @@ index 02af607..c3bf9c7 100644
/*
diff --git a/lib_mips/bootm.c b/lib_mips/bootm.c
index 54af24c..01cfd37 100644
index 54af24c..34150e9 100644
--- a/lib_mips/bootm.c
+++ b/lib_mips/bootm.c
@@ -46,7 +46,9 @@ static void linux_env_set (char * env_name, char * env_val);
@ -127,7 +144,7 @@ index 54af24c..01cfd37 100644
{
void (*theKernel) (int, char **, char **, int *);
- char *commandline = getenv ("bootargs");
+ char *commandline = gd->boot_from_sd == 1 ?
+ char *commandline = gd->boot_option == 1 ?
+ getenv ("bootargsfromsd") :
+ getenv ("bootargs");
char env_buf[12];