aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-xburst/patches/0004-add-more-boot-options-F1-F2-F3-F4-M-S.patch
blob: 73e03243c37a3b5077ce716a63be616dd2226362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
From c52b6168979d03fc31205444c3278c537787472a Mon Sep 17 00:00:00 2001
From: Xiangfu <xiangfu@openmobilefree.net>
Date: Wed, 10 Oct 2012 18:39:55 +0800
Subject: [PATCH 4/6] add more boot options(F1/F2/F3/F4/M/S)

---
 arch/mips/include/asm/global_data.h |    3 +++
 arch/mips/lib/bootm.c               |   17 ++++++++++++++++-
 board/qi/qi_lb60/qi_lb60.c          |   26 +++++++++++++++++++++++---
 common/main.c                       |   21 +++++++++++++++++++--
 include/configs/qi_lb60.h           |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 93 insertions(+), 6 deletions(-)

diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h
index 6e2cdc7..cd03d7e 100644
--- a/arch/mips/include/asm/global_data.h
+++ b/arch/mips/include/asm/global_data.h
@@ -59,6 +59,9 @@ typedef	struct	global_data {
 	unsigned long	env_valid;	/* Checksum of Environment valid? */
 	void		**jt;		/* jump table */
 	char		env_buf[32];	/* buffer for getenv() before reloc. */
+#if defined(CONFIG_NANONOTE)
+        unsigned long   boot_option;
+#endif
 } gd_t;
 
 #include <asm-generic/global_data_flags.h>
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 608c1a7..e00416b 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -47,10 +47,25 @@ int do_bootm_linux(int flag, int argc, char * const argv[],
 			bootm_headers_t *images)
 {
 	void (*theKernel) (int, char **, char **, int *);
-	char *commandline = getenv("bootargs");
+	char *commandline;
 	char env_buf[12];
 	char *cp;
 
+#if defined(CONFIG_NANONOTE)
+        if (gd->boot_option & BOOT_FROM_MEMCARD)
+                commandline = getenv ("bootargsfromsd");
+        else if (gd->boot_option & BOOT_WITH_F1)
+                commandline = getenv ("bootargsf1");
+        else if (gd->boot_option & BOOT_WITH_F2)
+                commandline = getenv ("bootargsf2");
+        else if (gd->boot_option & BOOT_WITH_F3)
+                commandline = getenv ("bootargsf3");
+        else if (gd->boot_option & BOOT_WITH_F4)
+                commandline = getenv ("bootargsf4");
+        else
+#endif
+                commandline = getenv ("bootargs");
+
 	if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
 		return 1;
 
diff --git a/board/qi/qi_lb60/qi_lb60.c b/board/qi/qi_lb60/qi_lb60.c
index a2ba648..d622219 100644
--- a/board/qi/qi_lb60/qi_lb60.c
+++ b/board/qi/qi_lb60/qi_lb60.c
@@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static void gpio_init(void)
 {
-	unsigned int i;
+	unsigned int i, j;
 
 	/* Initialize NAND Flash Pins */
 	__gpio_as_nand();
@@ -42,14 +42,34 @@ static void gpio_init(void)
 
 	if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){
 		printf("[S] pressed, enable UART0\n");
+		gd->boot_option |= BOOT_WITH_ENABLE_UART;
 		__gpio_as_uart0();
 	} else {
 		__gpio_as_input(GPIO_KEYIN_8);
 		__gpio_enable_pull(GPIO_KEYIN_8);
 	}
 
-	/* enable the TP4, TP5 as UART0 */
-	__gpio_jtag_to_uart0();
+	if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) {
+		printf("[M] pressed, boot from memory card\n");
+		gd->boot_option |= BOOT_FROM_MEMCARD;
+		__gpio_jtag_to_uart0();
+	}
+
+	for (j = 0; j < 4; j++) {
+		for (i = 0; i < 4; i++)
+			__gpio_set_pin(GPIO_KEYOUT_BASE + i);
+
+		__gpio_clear_pin(GPIO_KEYOUT_BASE + j);
+
+		if (__gpio_get_pin(GPIO_KEYIN_BASE) == 0) {
+			printf("[F%d] pressed", (j + 1));
+			gd->boot_option |= (1 << (j + 2));
+			/* BOOT_WITH_F1	(1 << 2) */
+			/* BOOT_WITH_F2	(1 << 3) */
+			/* BOOT_WITH_F3	(1 << 4) */
+			/* BOOT_WITH_F4	(1 << 5) */
+		}
+	}
 
 	__gpio_as_output(GPIO_AUDIO_POP);
 	__gpio_set_pin(GPIO_AUDIO_POP);
diff --git a/common/main.c b/common/main.c
index 9507cec..dbfb7ca 100644
--- a/common/main.c
+++ b/common/main.c
@@ -355,7 +355,11 @@ void main_loop (void)
 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
 	s = getenv ("bootdelay");
 	bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
-
+#if defined(CONFIG_NANONOTE)
+	DECLARE_GLOBAL_DATA_PTR;
+	if (gd->boot_option & BOOT_WITH_ENABLE_UART)
+		bootdelay = 3;
+# endif
 	debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
 #if defined(CONFIG_MENU_SHOW)
@@ -379,7 +383,20 @@ void main_loop (void)
 	}
 	else
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
-		s = getenv ("bootcmd");
+#if defined(CONFIG_NANONOTE)
+		if (gd->boot_option & BOOT_FROM_MEMCARD)
+			s = getenv ("bootcmdfromsd");
+		else if (gd->boot_option & BOOT_WITH_F1)
+			s = getenv ("bootcmdf1");
+		else if (gd->boot_option & BOOT_WITH_F2)
+			s = getenv ("bootcmdf2");
+		else if (gd->boot_option & BOOT_WITH_F3)
+			s = getenv ("bootcmdf3");
+		else if (gd->boot_option & BOOT_WITH_F4)
+			s = getenv ("bootcmdf4");
+		else
+#endif
+			s = getenv ("bootcmd");
 
 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
 
diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h
index 7b33be0..52b370c 100644
--- a/include/configs/qi_lb60.h
+++ b/include/configs/qi_lb60.h
@@ -31,6 +31,7 @@
 /*
  * Miscellaneous configurable options
  */
+#define CONFIG_NANONOTE
 #define CONFIG_JZ4740_MMC
 #define CONFIG_MMC      	1
 #define CONFIG_FAT      	1
@@ -39,6 +40,37 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
 
+#define CONFIG_CMD_UBIFS
+#define CONFIG_CMD_UBI
+#define CONFIG_MTD_PARTITIONS
+#define CONFIG_MTD_DEVICE
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_UBI
+#define CONFIG_CMD_UBIFS
+#define CONFIG_LZO
+#define CONFIG_RBTREE
+
+#define MTDIDS_DEFAULT		"nand0=jz4740-nand"
+#define MTDPARTS_DEFAULT	"mtdparts=jz4740-nand:4M@0(uboot)ro,4M@4M(kernel)ro,512M@8M(rootfs)ro,-(data)ro"
+
+#define BOOT_FROM_MEMCARD	1
+#define BOOT_WITH_ENABLE_UART	(1 << 1)	/* Vaule for global_data.h gd->boot_option */
+#define BOOT_WITH_F1		(1 << 2)
+#define BOOT_WITH_F2		(1 << 3)
+#define BOOT_WITH_F3		(1 << 4)
+#define BOOT_WITH_F4		(1 << 5)
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"bootcmdfromsd=mmc init; ext2load mmc 0 0x80600000 /boot/uImage; bootm;\0" \
+	"bootargsfromsd=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \
+	"bootcmdf1=mmc init; ext2load mmc 0:1 0x80600000 /boot/uImage; bootm;\0" \
+	"bootargsf1=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \
+	"bootcmdf2=mmc init; ext2load mmc 0:2 0x80600000 /boot/uImage; bootm;\0" \
+	"bootargsf2=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p2 rw rootwait\0" \
+	"bootcmdf3=mmc init; ext2load mmc 0:3 0x80600000 /boot/uImage; bootm;\0" \
+	"bootargsf3=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait\0" \
+	"bootcmdf4=mtdparts default;ubi part rootfs;ubifsmount rootfs;ubifsload 0x80600000 /boot/uImage; bootm;\0" \
+	"bootargsf4=mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait"
 
 #define CONFIG_SYS_SDRAM_BASE		0x80000000	/* Cached addr */
 #define CONFIG_SYS_INIT_SP_OFFSET	0x400000
-- 
1.7.9.5