| 1 | From 5201aff546faacdf539c03190f1b8ff0de9b2ef8 Mon Sep 17 00:00:00 2001 |
| 2 | From: Xiangfu Liu <xiangfu@sharism.cc> |
| 3 | Date: Mon, 7 Feb 2011 14:41:56 +0800 |
| 4 | Subject: [PATCH] add-more-boot-option.patch |
| 5 | |
| 6 | --- |
| 7 | arch/mips/lib/bootm.c | 8 ++++ |
| 8 | board/xburst/nanonote/nanonote.c | 81 +++++++++++++++++++++++-------------- |
| 9 | common/env_common.c | 6 --- |
| 10 | common/main.c | 8 ++++ |
| 11 | include/configs/nanonote.h | 4 ++ |
| 12 | include/configs/qi_lb60.h | 15 ++++++- |
| 13 | 6 files changed, 82 insertions(+), 40 deletions(-) |
| 14 | |
| 15 | diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c |
| 16 | index 24a40cc..280e396 100644 |
| 17 | --- a/arch/mips/lib/bootm.c |
| 18 | +++ b/arch/mips/lib/bootm.c |
| 19 | @@ -53,6 +53,14 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) |
| 20 | #if defined(CONFIG_NANONOTE) |
| 21 | if (gd->boot_option & BOOT_FROM_SDCARD) |
| 22 | commandline = getenv ("bootargsfromsd"); |
| 23 | + else if (gd->boot_option & BOOT_WITH_F1) |
| 24 | + commandline = getenv ("bootargsf1"); |
| 25 | + else if (gd->boot_option & BOOT_WITH_F2) |
| 26 | + commandline = getenv ("bootargsf2"); |
| 27 | + else if (gd->boot_option & BOOT_WITH_F3) |
| 28 | + commandline = getenv ("bootargsf3"); |
| 29 | + else if (gd->boot_option & BOOT_WITH_F4) |
| 30 | + commandline = getenv ("bootargsf4"); |
| 31 | else |
| 32 | #endif |
| 33 | commandline = getenv ("bootargs"); |
| 34 | diff --git a/board/xburst/nanonote/nanonote.c b/board/xburst/nanonote/nanonote.c |
| 35 | index ef9552a..0fc8925 100644 |
| 36 | --- a/board/xburst/nanonote/nanonote.c |
| 37 | +++ b/board/xburst/nanonote/nanonote.c |
| 38 | @@ -14,32 +14,12 @@ |
| 39 | |
| 40 | DECLARE_GLOBAL_DATA_PTR; |
| 41 | |
| 42 | -static void gpio_init(void) |
| 43 | +static void boot_option(void) |
| 44 | { |
| 45 | /* |
| 46 | - * Initialize NAND Flash Pins |
| 47 | - */ |
| 48 | - __gpio_as_nand(); |
| 49 | - |
| 50 | - /* |
| 51 | - * Initialize SDRAM pins |
| 52 | - */ |
| 53 | - __gpio_as_sdram_16bit_4720(); |
| 54 | - |
| 55 | - /* |
| 56 | - * Initialize LCD pins |
| 57 | - */ |
| 58 | - __gpio_as_lcd_18bit(); |
| 59 | - |
| 60 | - /* |
| 61 | - * Initialize MSC pins |
| 62 | - */ |
| 63 | - __gpio_as_msc(); |
| 64 | - |
| 65 | - /* |
| 66 | * Initialize Other pins |
| 67 | */ |
| 68 | - unsigned int i; |
| 69 | + unsigned int i, j; |
| 70 | for (i = 0; i < 7; i++){ |
| 71 | __gpio_as_input(GPIO_KEYIN_BASE + i); |
| 72 | __gpio_enable_pull(GPIO_KEYIN_BASE + i); |
| 73 | @@ -50,16 +30,12 @@ static void gpio_init(void) |
| 74 | __gpio_clear_pin(GPIO_KEYOUT_BASE + i); |
| 75 | } |
| 76 | |
| 77 | - /* enable the TP4, TP5 as UART0 */ |
| 78 | - __gpio_jtag_to_uart0(); |
| 79 | - |
| 80 | /* |
| 81 | * Initialize UART0 pins, in Ben NanoNote uart0 and keyin8 use the |
| 82 | * same gpio, init the gpio as uart0 cause a keyboard bug. so for |
| 83 | * end user we disable the uart0 |
| 84 | */ |
| 85 | if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ |
| 86 | - /* if pressed [S] */ |
| 87 | printf("[S] pressed, enable UART0\n"); |
| 88 | gd->boot_option |= BOOT_WITH_ENABLE_UART; |
| 89 | __gpio_as_uart0(); |
| 90 | @@ -68,6 +44,53 @@ static void gpio_init(void) |
| 91 | __gpio_enable_pull(GPIO_KEYIN_8); |
| 92 | } |
| 93 | |
| 94 | + if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) { |
| 95 | + printf("[M] pressed, boot from sd card\n"); |
| 96 | + gd->boot_option |= BOOT_FROM_SDCARD; |
| 97 | + } |
| 98 | + |
| 99 | + for (j = 0; j < 4; j++) { |
| 100 | + for (i = 0; i < 4; i++) |
| 101 | + __gpio_set_pin(GPIO_KEYOUT_BASE + i); |
| 102 | + |
| 103 | + __gpio_clear_pin(GPIO_KEYOUT_BASE + j); |
| 104 | + |
| 105 | + if (__gpio_get_pin(GPIO_KEYIN_BASE) == 0) { |
| 106 | + printf("[F%d] pressed", (j + 1)); |
| 107 | + gd->boot_option |= (1 << (j + 2)); |
| 108 | + /* BOOT_WITH_F1 (1 << 2) */ |
| 109 | + /* BOOT_WITH_F2 (1 << 3) */ |
| 110 | + /* BOOT_WITH_F3 (1 << 4) */ |
| 111 | + /* BOOT_WITH_F4 (1 << 5) */ |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +static void gpio_init(void) |
| 117 | +{ |
| 118 | + /* |
| 119 | + * Initialize NAND Flash Pins |
| 120 | + */ |
| 121 | + __gpio_as_nand(); |
| 122 | + |
| 123 | + /* |
| 124 | + * Initialize SDRAM pins |
| 125 | + */ |
| 126 | + __gpio_as_sdram_16bit_4720(); |
| 127 | + |
| 128 | + /* |
| 129 | + * Initialize LCD pins |
| 130 | + */ |
| 131 | + __gpio_as_lcd_18bit(); |
| 132 | + |
| 133 | + /* |
| 134 | + * Initialize MSC pins |
| 135 | + */ |
| 136 | + __gpio_as_msc(); |
| 137 | + |
| 138 | + /* enable the TP4, TP5 as UART0 */ |
| 139 | + __gpio_jtag_to_uart0(); |
| 140 | + |
| 141 | __gpio_as_output(GPIO_AUDIO_POP); |
| 142 | __gpio_set_pin(GPIO_AUDIO_POP); |
| 143 | |
| 144 | @@ -86,11 +109,6 @@ static void gpio_init(void) |
| 145 | |
| 146 | __gpio_as_input(GPIO_USB_DETECT); |
| 147 | __gpio_enable_pull(GPIO_USB_DETECT); |
| 148 | - |
| 149 | - if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) { |
| 150 | - printf("[M] pressed, boot from sd card\n"); |
| 151 | - gd->boot_option |= BOOT_FROM_SDCARD; |
| 152 | - } |
| 153 | } |
| 154 | |
| 155 | static void cpm_init(void) |
| 156 | @@ -111,6 +129,7 @@ void board_early_init(void) |
| 157 | { |
| 158 | gpio_init(); |
| 159 | cpm_init(); |
| 160 | + boot_option(); |
| 161 | } |
| 162 | |
| 163 | /* U-Boot common routines */ |
| 164 | diff --git a/common/env_common.c b/common/env_common.c |
| 165 | index 7ac2b6b..439a4a9 100644 |
| 166 | --- a/common/env_common.c |
| 167 | +++ b/common/env_common.c |
| 168 | @@ -133,12 +133,6 @@ uchar default_environment[] = { |
| 169 | #if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) |
| 170 | "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0" |
| 171 | #endif |
| 172 | -#ifdef CONFIG_BOOTARGSFROMSD |
| 173 | - "bootargsfromsd=" CONFIG_BOOTARGSFROMSD "\0" |
| 174 | -#endif |
| 175 | -#ifdef CONFIG_BOOTCOMMANDFROMSD |
| 176 | - "bootcmdfromsd=" CONFIG_BOOTCOMMANDFROMSD "\0" |
| 177 | -#endif |
| 178 | #ifdef CONFIG_EXTRA_ENV_SETTINGS |
| 179 | CONFIG_EXTRA_ENV_SETTINGS |
| 180 | #endif |
| 181 | diff --git a/common/main.c b/common/main.c |
| 182 | index c64979f..d4f729e 100644 |
| 183 | --- a/common/main.c |
| 184 | +++ b/common/main.c |
| 185 | @@ -400,6 +400,14 @@ void main_loop (void) |
| 186 | #if defined(CONFIG_NANONOTE) |
| 187 | if (gd->boot_option & BOOT_FROM_SDCARD) |
| 188 | s = getenv ("bootcmdfromsd"); |
| 189 | + else if (gd->boot_option & BOOT_WITH_F1) |
| 190 | + s = getenv ("bootcmdf1"); |
| 191 | + else if (gd->boot_option & BOOT_WITH_F2) |
| 192 | + s = getenv ("bootcmdf2"); |
| 193 | + else if (gd->boot_option & BOOT_WITH_F3) |
| 194 | + s = getenv ("bootcmdf3"); |
| 195 | + else if (gd->boot_option & BOOT_WITH_F4) |
| 196 | + s = getenv ("bootcmdf4"); |
| 197 | else |
| 198 | #endif |
| 199 | s = getenv ("bootcmd"); |
| 200 | diff --git a/include/configs/nanonote.h b/include/configs/nanonote.h |
| 201 | index 6b7d635..dde5cb4 100644 |
| 202 | --- a/include/configs/nanonote.h |
| 203 | +++ b/include/configs/nanonote.h |
| 204 | @@ -23,6 +23,10 @@ |
| 205 | |
| 206 | #define BOOT_FROM_SDCARD 1 |
| 207 | #define BOOT_WITH_ENABLE_UART (1 << 1) /* Vaule for global_data.h gd->boot_option */ |
| 208 | +#define BOOT_WITH_F1 (1 << 2) |
| 209 | +#define BOOT_WITH_F2 (1 << 3) |
| 210 | +#define BOOT_WITH_F3 (1 << 4) |
| 211 | +#define BOOT_WITH_F4 (1 << 5) |
| 212 | |
| 213 | #define CONFIG_LCD 1 /* LCD support */ |
| 214 | #define LCD_BPP LCD_COLOR32 /*5:18,24,32 bits per pixel */ |
| 215 | diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h |
| 216 | index 29ec805..9f08c74 100644 |
| 217 | --- a/include/configs/qi_lb60.h |
| 218 | +++ b/include/configs/qi_lb60.h |
| 219 | @@ -6,10 +6,19 @@ |
| 220 | #define CONFIG_QI_LB60 1 |
| 221 | |
| 222 | //#define DEBUG |
| 223 | -#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" |
| 224 | -#define CONFIG_BOOTARGSFROMSD "mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait" |
| 225 | #define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x200000;bootm" |
| 226 | -#define CONFIG_BOOTCOMMANDFROMSD "mmc init; ext2load mmc 0 0x80600000 /boot/uImage; bootm" |
| 227 | +#define CONFIG_BOOTARGS "mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" |
| 228 | +#define CONFIG_EXTRA_ENV_SETTINGS \ |
| 229 | + "bootcmdfromsd=mmc init; ext2load mmc 0 0x80600000 /boot/uImage; bootm;\0" \ |
| 230 | + "bootargsfromsd=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \ |
| 231 | + "bootcmdf1=mmc init; ext2load mmc 0:1 0x80600000 /boot/uImage; bootm;\0" \ |
| 232 | + "bootargsf1=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait\0" \ |
| 233 | + "bootcmdf2=mmc init; ext2load mmc 0:2 0x80600000 /boot/uImage; bootm;\0" \ |
| 234 | + "bootargsf2=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p2 rw rootwait\0" \ |
| 235 | + "bootcmdf3=mmc init; ext2load mmc 0:3 0x80600000 /boot/uImage; bootm;\0" \ |
| 236 | + "bootargsf3=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p3 rw rootwait\0" \ |
| 237 | + "bootcmdf4=mmc init; ext2load mmc 0:4 0x80600000 /boot/uImage; bootm;\0" \ |
| 238 | + "bootargsf4=mem=32M console=tty0 console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p4 rw rootwait\0" |
| 239 | |
| 240 | /* SDRAM paramters */ |
| 241 | #define SDRAM_BW16 1 /* Data bus width: 0-32bit, 1-16bit */ |
| 242 | -- |
| 243 | 1.7.0.4 |
| 244 | |
| 245 | |