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