| target/linux/xburst/image/u-boot/patches/0002-add-xburst-support.patch |
| 1 | | From 7f32a7a2ec1cf7472684869a5cec40013134c92b Mon Sep 17 00:00:00 2001 |
| 2 | | From: Xiangfu Liu <xiangfu@qi-hardware.com> |
| 3 | | Date: Wed, 18 Nov 2009 23:24:14 +0800 |
| 4 | | Subject: [PATCH 2/2] add-xburst-support |
| 1 | From 64c6e9b3ad9241d88411867cc4d5478bb6c6f3dd Mon Sep 17 00:00:00 2001 |
| 2 | From: Xiangfu Liu <xiangfu@sharism.cc> |
| 3 | Date: Mon, 18 Jan 2010 15:52:15 +0800 |
| 4 | Subject: [PATCH 2/2] change file |
| 5 | 5 | |
| 6 | 6 | --- |
| 7 | 7 | Makefile | 10 + |
| 8 | board/qi_lb60/qi_lb60.c | 39 +++- |
| 9 | common/env_common.c | 2 +- |
| 8 | 10 | common/lcd.c | 45 ++++- |
| 11 | common/main.c | 4 +- |
| 9 | 12 | cpu/mips/Makefile | 4 + |
| 10 | 13 | cpu/mips/cache.S | 280 ++++++++++---------------- |
| 11 | 14 | cpu/mips/config.mk | 6 +- |
| 12 | 15 | cpu/mips/cpu.c | 75 +++++++ |
| 13 | 16 | cpu/mips/start.S | 432 +++++++++++++++++++++++++++++++-------- |
| 14 | | drivers/mtd/nand/nand_base.c | 87 ++++++++- |
| 17 | drivers/mtd/nand/nand_base.c | 88 ++++++++- |
| 15 | 18 | examples/standalone/mips.lds | 2 +- |
| 16 | 19 | include/asm-mips/addrspace.h | 2 +- |
| 17 | | include/asm-mips/global_data.h | 9 + |
| 20 | include/asm-mips/global_data.h | 11 + |
| 21 | include/configs/qi_lb60.h | 2 + |
| 18 | 22 | include/lcd.h | 56 +++++- |
| 19 | 23 | lib_mips/board.c | 18 ++- |
| 24 | lib_mips/bootm.c | 4 +- |
| 20 | 25 | lib_mips/time.c | 4 + |
| 21 | | 14 files changed, 744 insertions(+), 286 deletions(-) |
| 26 | nand_spl/nand_boot_jz4740.c | 46 ++--- |
| 27 | 20 files changed, 797 insertions(+), 333 deletions(-) |
| 22 | 28 | |
| 23 | 29 | diff --git a/Makefile b/Makefile |
| 24 | | index e4499d7..e492d6a 100644 |
| 30 | index f06a97c..a318eb4 100644 |
| 25 | 31 | --- a/Makefile |
| 26 | 32 | +++ b/Makefile |
| 27 | | @@ -3381,6 +3381,16 @@ qemu_mips_config : unconfig |
| 33 | @@ -3439,6 +3439,16 @@ qemu_mips_config : unconfig |
| 28 | 34 | @$(MKCONFIG) -a qemu-mips mips mips qemu-mips |
| 29 | 35 | |
| 30 | 36 | ######################################################################### |
| ... | ... | |
| 41 | 47 | ## MIPS64 5Kc |
| 42 | 48 | ######################################################################### |
| 43 | 49 | |
| 50 | diff --git a/board/qi_lb60/qi_lb60.c b/board/qi_lb60/qi_lb60.c |
| 51 | index 54625c3..aa7b85b 100644 |
| 52 | --- a/board/qi_lb60/qi_lb60.c |
| 53 | @@ -12,6 +12,8 @@ |
| 54 | #include <asm/mipsregs.h> |
| 55 | #include <asm/jz4740.h> |
| 56 | |
| 57 | +DECLARE_GLOBAL_DATA_PTR; |
| 58 | + |
| 59 | static void gpio_init(void) |
| 60 | { |
| 61 | /* |
| 62 | @@ -25,11 +27,6 @@ static void gpio_init(void) |
| 63 | __gpio_as_sdram_32bit(); |
| 64 | |
| 65 | /* |
| 66 | - * Initialize UART0 pins |
| 67 | - */ |
| 68 | - __gpio_as_uart0(); |
| 69 | - |
| 70 | - /* |
| 71 | * Initialize LCD pins |
| 72 | */ |
| 73 | __gpio_as_lcd_18bit(); |
| 74 | @@ -43,17 +40,31 @@ static void gpio_init(void) |
| 75 | * Initialize Other pins |
| 76 | */ |
| 77 | unsigned int i; |
| 78 | + for (i = 0; i < 7; i++){ |
| 79 | + __gpio_as_input(GPIO_KEYIN_BASE + i); |
| 80 | + __gpio_enable_pull(GPIO_KEYIN_BASE + i); |
| 81 | + } |
| 82 | + |
| 83 | for (i = 0; i < 8; i++) { |
| 84 | __gpio_as_output(GPIO_KEYOUT_BASE + i); |
| 85 | - __gpio_set_pin(GPIO_KEYOUT_BASE + i); |
| 86 | + __gpio_clear_pin(GPIO_KEYOUT_BASE + i); |
| 87 | } |
| 88 | |
| 89 | - for (i = 0; i < 7; i++){ |
| 90 | - __gpio_as_input(GPIO_KEYIN_BASE + i); |
| 91 | - __gpio_enable_pull(GPIO_KEYIN_BASE + i); |
| 92 | + /* |
| 93 | + * Initialize UART0 pins, in Ben NanoNote uart0 and keyin8 use the |
| 94 | + * same gpio, init the gpio as uart0 cause a keyboard bug. so for |
| 95 | + * end user we disable the uart0 |
| 96 | + */ |
| 97 | + if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ |
| 98 | + /* if pressed [S] */ |
| 99 | + printf("[S] pressed, enable UART0\n"); |
| 100 | + gd->boot_option = 5; |
| 101 | + __gpio_as_uart0(); |
| 102 | + } else { |
| 103 | + printf("[S] not pressed, disable UART0\n"); |
| 104 | + __gpio_as_input(GPIO_KEYIN_8); |
| 105 | + __gpio_enable_pull(GPIO_KEYIN_8); |
| 106 | } |
| 107 | - /* __gpio_as_input( GPIO_KEYIN_8 ); */ |
| 108 | - /* __gpio_enable_pull( GPIO_KEYIN_8 ); */ |
| 109 | |
| 110 | __gpio_as_output(GPIO_AUDIO_POP); |
| 111 | __gpio_set_pin(GPIO_AUDIO_POP); |
| 112 | @@ -73,6 +84,11 @@ static void gpio_init(void) |
| 113 | |
| 114 | __gpio_as_input(GPIO_USB_DETECT); |
| 115 | __gpio_enable_pull(GPIO_USB_DETECT); |
| 116 | + |
| 117 | + if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) { |
| 118 | + printf("[M] pressed, boot from sd card\n"); |
| 119 | + gd->boot_option = 1; |
| 120 | + } |
| 121 | } |
| 122 | |
| 123 | static void cpm_init(void) |
| 124 | @@ -98,7 +114,6 @@ void board_early_init(void) |
| 125 | |
| 126 | int checkboard (void) |
| 127 | { |
| 128 | - DECLARE_GLOBAL_DATA_PTR; |
| 129 | |
| 130 | printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %d MHz)\n", |
| 131 | gd->cpu_clk/1000000); |
| 132 | diff --git a/common/env_common.c b/common/env_common.c |
| 133 | index 439a4a9..6cfe30b 100644 |
| 134 | --- a/common/env_common.c |
| 135 | @@ -134,7 +134,7 @@ uchar default_environment[] = { |
| 136 | "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0" |
| 137 | #endif |
| 138 | #ifdef CONFIG_EXTRA_ENV_SETTINGS |
| 139 | - CONFIG_EXTRA_ENV_SETTINGS |
| 140 | + "bootargsfromsd=" CONFIG_BOOTARGSFROMSD "\0" |
| 141 | #endif |
| 142 | "\0" |
| 143 | }; |
| 44 | 144 | diff --git a/common/lcd.c b/common/lcd.c |
| 45 | | index dc8fea6..b68b1ca 100644 |
| 145 | index 4e31618..ddd5aa8 100644 |
| 46 | 146 | --- a/common/lcd.c |
| 47 | 147 | +++ b/common/lcd.c |
| 48 | 148 | @@ -64,7 +64,9 @@ |
| ... | ... | |
| 56 | 158 | # endif |
| 57 | 159 | #endif |
| 58 | 160 | |
| 59 | | @@ -270,6 +272,14 @@ static void lcd_drawchars (ushort x, ushort y, uchar *str, int count) |
| 161 | @@ -249,6 +251,14 @@ static void lcd_drawchars (ushort x, ushort y, uchar *str, int count) |
| 60 | 162 | lcd_color_fg : lcd_color_bg; |
| 61 | 163 | bits <<= 1; |
| 62 | 164 | } |
| ... | ... | |
| 71 | 173 | #endif |
| 72 | 174 | } |
| 73 | 175 | #if LCD_BPP == LCD_MONOCHROME |
| 74 | | @@ -336,6 +346,9 @@ static void test_pattern (void) |
| 176 | @@ -315,6 +325,9 @@ static void test_pattern (void) |
| 75 | 177 | } |
| 76 | 178 | #endif /* LCD_TEST_PATTERN */ |
| 77 | 179 | |
| ... | ... | |
| 81 | 183 | |
| 82 | 184 | /************************************************************************/ |
| 83 | 185 | /* ** GENERIC Initialization Routines */ |
| 84 | | @@ -402,6 +415,7 @@ static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) |
| 186 | @@ -381,6 +394,7 @@ static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) |
| 85 | 187 | COLOR_MASK(lcd_getbgcolor()), |
| 86 | 188 | lcd_line_length*panel_info.vl_row); |
| 87 | 189 | #endif |
| ... | ... | |
| 89 | 191 | /* Paint the logo and retrieve LCD base address */ |
| 90 | 192 | debug ("[LCD] Drawing the logo...\n"); |
| 91 | 193 | lcd_console_address = lcd_logo (); |
| 92 | | @@ -479,6 +493,8 @@ static void lcd_setfgcolor (int color) |
| 194 | @@ -458,6 +472,8 @@ static void lcd_setfgcolor (int color) |
| 93 | 195 | { |
| 94 | 196 | #ifdef CONFIG_ATMEL_LCD |
| 95 | 197 | lcd_color_fg = color; |
| ... | ... | |
| 98 | 200 | #else |
| 99 | 201 | lcd_color_fg = color & 0x0F; |
| 100 | 202 | #endif |
| 101 | | @@ -490,6 +506,8 @@ static void lcd_setbgcolor (int color) |
| 203 | @@ -469,6 +485,8 @@ static void lcd_setbgcolor (int color) |
| 102 | 204 | { |
| 103 | 205 | #ifdef CONFIG_ATMEL_LCD |
| 104 | 206 | lcd_color_bg = color; |
| ... | ... | |
| 107 | 209 | #else |
| 108 | 210 | lcd_color_bg = color & 0x0F; |
| 109 | 211 | #endif |
| 110 | | @@ -528,6 +546,7 @@ void bitmap_plot (int x, int y) |
| 212 | @@ -507,6 +525,7 @@ void bitmap_plot (int x, int y) |
| 111 | 213 | uchar *bmap; |
| 112 | 214 | uchar *fb; |
| 113 | 215 | ushort *fb16; |
| ... | ... | |
| 115 | 217 | #if defined(CONFIG_PXA250) |
| 116 | 218 | struct pxafb_info *fbi = &panel_info.pxa; |
| 117 | 219 | #elif defined(CONFIG_MPC823) |
| 118 | | @@ -588,13 +607,25 @@ void bitmap_plot (int x, int y) |
| 220 | @@ -567,13 +586,25 @@ void bitmap_plot (int x, int y) |
| 119 | 221 | } |
| 120 | 222 | } |
| 121 | 223 | else { /* true color mode */ |
| ... | ... | |
| 147 | 249 | } |
| 148 | 250 | } |
| 149 | 251 | |
| 252 | diff --git a/common/main.c b/common/main.c |
| 253 | index 10d8904..ff11ad7 100644 |
| 254 | --- a/common/main.c |
| 255 | @@ -372,7 +372,9 @@ void main_loop (void) |
| 256 | #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) |
| 257 | s = getenv ("bootdelay"); |
| 258 | bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; |
| 259 | - |
| 260 | + DECLARE_GLOBAL_DATA_PTR; |
| 261 | + if (gd->boot_option == 5) |
| 262 | + bootdelay = gd->boot_option; |
| 263 | debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); |
| 264 | |
| 265 | # ifdef CONFIG_BOOT_RETRY_TIME |
| 150 | 266 | diff --git a/cpu/mips/Makefile b/cpu/mips/Makefile |
| 151 | 267 | index 28a1cbb..5207bc5 100644 |
| 152 | 268 | --- a/cpu/mips/Makefile |
| ... | ... | |
| 1217 | 1334 | + |
| 1218 | 1335 | +#endif /* CONFIG_JZ4730 */ |
| 1219 | 1336 | diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c |
| 1220 | | index 360b070..88717e9 100644 |
| 1337 | index 426bb95..6e5fbd3 100644 |
| 1221 | 1338 | --- a/drivers/mtd/nand/nand_base.c |
| 1222 | 1339 | +++ b/drivers/mtd/nand/nand_base.c |
| 1223 | 1340 | @@ -109,6 +109,22 @@ static struct nand_ecclayout nand_oob_16 = { |
| ... | ... | |
| 1251 | 1368 | |
| 1252 | 1369 | static struct nand_ecclayout nand_oob_128 = { |
| 1253 | 1370 | .eccbytes = 48, |
| 1254 | | @@ -1068,6 +1085,60 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, |
| 1371 | @@ -1116,6 +1133,60 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd, |
| 1255 | 1372 | } |
| 1256 | 1373 | |
| 1257 | 1374 | /** |
| ... | ... | |
| 1312 | 1429 | * nand_read_page_syndrome - [REPLACABLE] hardware ecc syndrom based page read |
| 1313 | 1430 | * @mtd: mtd info structure |
| 1314 | 1431 | * @chip: nand chip info structure |
| 1315 | | @@ -1222,8 +1293,15 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, |
| 1316 | | ret = chip->ecc.read_page_raw(mtd, chip, bufpoi); |
| 1432 | @@ -1271,9 +1342,17 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, |
| 1433 | bufpoi, page); |
| 1317 | 1434 | else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob) |
| 1318 | 1435 | ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi); |
| 1319 | 1436 | - else |
| 1320 | | + else { |
| 1437 | + else { |
| 1321 | 1438 | +#if defined(CONFIG_JZ4740) |
| 1322 | 1439 | + bufpoi[0] = (uint8_t)page; |
| 1323 | 1440 | + bufpoi[1] = (uint8_t)(page >> 8); |
| 1324 | 1441 | + bufpoi[2] = (uint8_t)(page >> 16); |
| 1325 | 1442 | + bufpoi[3] = (uint8_t)(page >> 24); |
| 1326 | 1443 | +#endif |
| 1327 | | ret = chip->ecc.read_page(mtd, chip, bufpoi); |
| 1444 | + |
| 1445 | ret = chip->ecc.read_page(mtd, chip, bufpoi, |
| 1446 | page); |
| 1328 | 1447 | + } |
| 1329 | 1448 | if (ret < 0) |
| 1330 | 1449 | break; |
| 1331 | 1450 | |
| 1332 | | @@ -2730,8 +2808,13 @@ int nand_scan_tail(struct mtd_info *mtd) |
| 1333 | | switch (chip->ecc.mode) { |
| 1451 | @@ -2791,8 +2870,13 @@ int nand_scan_tail(struct mtd_info *mtd) |
| 1452 | |
| 1334 | 1453 | case NAND_ECC_HW: |
| 1335 | 1454 | /* Use standard hwecc read page function ? */ |
| 1336 | 1455 | - if (!chip->ecc.read_page) |
| ... | ... | |
| 1372 | 1491 | cannot access physical memory directly from core */ |
| 1373 | 1492 | #define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x20000000) |
| 1374 | 1493 | diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h |
| 1375 | | index b2c4891..db88704 100644 |
| 1494 | index b2c4891..23f597e 100644 |
| 1376 | 1495 | --- a/include/asm-mips/global_data.h |
| 1377 | 1496 | +++ b/include/asm-mips/global_data.h |
| 1378 | | @@ -39,6 +39,15 @@ |
| 1497 | @@ -39,6 +39,17 @@ |
| 1379 | 1498 | typedef struct global_data { |
| 1380 | 1499 | bd_t *bd; |
| 1381 | 1500 | unsigned long flags; |
| ... | ... | |
| 1387 | 1506 | + unsigned long mem_clk; /* Memory bus clock */ |
| 1388 | 1507 | + unsigned long dev_clk; /* Device clock */ |
| 1389 | 1508 | + unsigned long fb_base; /* base address of framebuffer */ |
| 1509 | + unsigned long boot_option; /* 1: boot from sd |
| 1510 | + * 5: boot delay for 5 secs*/ |
| 1390 | 1511 | +#endif |
| 1391 | 1512 | unsigned long baudrate; |
| 1392 | 1513 | unsigned long have_console; /* serial_init() was called */ |
| 1393 | 1514 | phys_size_t ram_size; /* RAM size */ |
| 1515 | diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h |
| 1516 | index 02af607..c3bf9c7 100644 |
| 1517 | --- a/include/configs/qi_lb60.h |
| 1518 | @@ -45,6 +45,8 @@ |
| 1519 | #define CONFIG_BOOTDELAY 0 |
| 1520 | #define CONFIG_BOOTFILE "uImage" /* file to load */ |
| 1521 | #define CONFIG_BOOTARGS "mem=32M console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" |
| 1522 | +#define CONFIG_EXTRA_ENV_SETTINGS 1 |
| 1523 | +#define CONFIG_BOOTARGSFROMSD "mem=32M console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait" |
| 1524 | #define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x200000;bootm" |
| 1525 | |
| 1526 | /* |
| 1394 | 1527 | diff --git a/include/lcd.h b/include/lcd.h |
| 1395 | 1528 | index 1f85daa..997e246 100644 |
| 1396 | 1529 | --- a/include/lcd.h |
| ... | ... | |
| 1493 | 1627 | #else |
| 1494 | 1628 | # error Unsupported LCD BPP. |
| 1495 | 1629 | diff --git a/lib_mips/board.c b/lib_mips/board.c |
| 1496 | | index aa5b129..ea5166c 100644 |
| 1630 | index b2d113e..87cb12d 100644 |
| 1497 | 1631 | --- a/lib_mips/board.c |
| 1498 | 1632 | +++ b/lib_mips/board.c |
| 1499 | | @@ -45,6 +45,10 @@ DECLARE_GLOBAL_DATA_PTR; |
| 1633 | @@ -49,6 +49,10 @@ DECLARE_GLOBAL_DATA_PTR; |
| 1500 | 1634 | |
| 1501 | 1635 | #undef DEBUG |
| 1502 | 1636 | |
| ... | ... | |
| 1507 | 1641 | extern int timer_init(void); |
| 1508 | 1642 | |
| 1509 | 1643 | extern int incaip_set_cpuclk(void); |
| 1510 | | @@ -109,7 +113,6 @@ void *sbrk (ptrdiff_t increment) |
| 1511 | | return ((void *) old); |
| 1644 | @@ -78,7 +82,6 @@ int __board_early_init_f(void) |
| 1512 | 1645 | } |
| 1646 | int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f"))); |
| 1513 | 1647 | |
| 1514 | 1648 | - |
| 1515 | 1649 | static int init_func_ram (void) |
| 1516 | 1650 | { |
| 1517 | 1651 | #ifdef CONFIG_BOARD_TYPES |
| 1518 | | @@ -129,7 +132,6 @@ static int init_func_ram (void) |
| 1652 | @@ -98,7 +101,6 @@ static int init_func_ram (void) |
| 1519 | 1653 | |
| 1520 | 1654 | static int display_banner(void) |
| 1521 | 1655 | { |
| ... | ... | |
| 1523 | 1657 | printf ("\n\n%s\n\n", version_string); |
| 1524 | 1658 | return (0); |
| 1525 | 1659 | } |
| 1526 | | @@ -178,6 +180,9 @@ static int init_baudrate (void) |
| 1660 | @@ -147,6 +149,9 @@ static int init_baudrate (void) |
| 1527 | 1661 | typedef int (init_fnc_t) (void); |
| 1528 | 1662 | |
| 1529 | 1663 | init_fnc_t *init_sequence[] = { |
| ... | ... | |
| 1533 | 1667 | board_early_init_f, |
| 1534 | 1668 | timer_init, |
| 1535 | 1669 | env_init, /* initialize environment */ |
| 1536 | | @@ -193,7 +198,6 @@ init_fnc_t *init_sequence[] = { |
| 1670 | @@ -162,7 +167,6 @@ init_fnc_t *init_sequence[] = { |
| 1537 | 1671 | NULL, |
| 1538 | 1672 | }; |
| 1539 | 1673 | |
| ... | ... | |
| 1541 | 1675 | void board_init_f(ulong bootflag) |
| 1542 | 1676 | { |
| 1543 | 1677 | gd_t gd_data, *id; |
| 1544 | | @@ -233,6 +237,12 @@ void board_init_f(ulong bootflag) |
| 1678 | @@ -202,6 +206,12 @@ void board_init_f(ulong bootflag) |
| 1545 | 1679 | addr &= ~(4096 - 1); |
| 1546 | 1680 | debug ("Top of RAM usable for U-Boot at: %08lx\n", addr); |
| 1547 | 1681 | |
| ... | ... | |
| 1554 | 1688 | /* Reserve memory for U-Boot code, data & bss |
| 1555 | 1689 | * round down to next 16 kB limit |
| 1556 | 1690 | */ |
| 1557 | | @@ -379,9 +389,9 @@ void board_init_r (gd_t *id, ulong dest_addr) |
| 1691 | @@ -349,9 +359,9 @@ void board_init_r (gd_t *id, ulong dest_addr) |
| 1558 | 1692 | size = flash_init(); |
| 1559 | 1693 | display_flash_config (size); |
| 1560 | 1694 | bd->bi_flashsize = size; |
| ... | ... | |
| 1565 | 1699 | #if CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE |
| 1566 | 1700 | bd->bi_flashoffset = monitor_flash_len; /* reserved area for U-Boot */ |
| 1567 | 1701 | #else |
| 1702 | diff --git a/lib_mips/bootm.c b/lib_mips/bootm.c |
| 1703 | index 54af24c..34150e9 100644 |
| 1704 | --- a/lib_mips/bootm.c |
| 1705 | @@ -46,7 +46,9 @@ static void linux_env_set (char * env_name, char * env_val); |
| 1706 | int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) |
| 1707 | { |
| 1708 | void (*theKernel) (int, char **, char **, int *); |
| 1709 | - char *commandline = getenv ("bootargs"); |
| 1710 | + char *commandline = gd->boot_option == 1 ? |
| 1711 | + getenv ("bootargsfromsd") : |
| 1712 | + getenv ("bootargs"); |
| 1713 | char env_buf[12]; |
| 1714 | char *cp; |
| 1715 | |
| 1568 | 1716 | diff --git a/lib_mips/time.c b/lib_mips/time.c |
| 1569 | 1717 | index 07e356d..4654bf4 100644 |
| 1570 | 1718 | --- a/lib_mips/time.c |
| ... | ... | |
| 1584 | 1733 | } |
| 1585 | 1734 | + |
| 1586 | 1735 | +#endif /* !CONFIG_JzRISC */ |
| 1736 | diff --git a/nand_spl/nand_boot_jz4740.c b/nand_spl/nand_boot_jz4740.c |
| 1737 | index 924a47a..146de19 100644 |
| 1738 | --- a/nand_spl/nand_boot_jz4740.c |
| 1739 | @@ -24,10 +24,8 @@ |
| 1740 | #include <asm/io.h> |
| 1741 | #include <asm/jz4740.h> |
| 1742 | |
| 1743 | -#define KEY_1_OUT (32 * 3 + 21) |
| 1744 | -#define KEY_1_IN (32 * 3 + 19) |
| 1745 | -#define KEY_2_OUT (32 * 3 + 25) |
| 1746 | -#define KEY_2_IN (32 * 3 + 26) |
| 1747 | +#define KEY_U_OUT (32 * 2 + 16) |
| 1748 | +#define KEY_U_IN (32 * 3 + 19) |
| 1749 | |
| 1750 | /* |
| 1751 | * NAND flash definitions |
| 1752 | @@ -350,40 +348,25 @@ static void gpio_init(void) |
| 1753 | |
| 1754 | static int is_usb_boot() |
| 1755 | { |
| 1756 | - int key2,keyh; |
| 1757 | - |
| 1758 | - key2 = 0; |
| 1759 | - keyh = 0; |
| 1760 | + int keyU = 0; |
| 1761 | |
| 1762 | - __gpio_as_output(KEY_1_OUT); |
| 1763 | - __gpio_as_output(KEY_2_OUT); |
| 1764 | - __gpio_as_input(KEY_1_IN); |
| 1765 | - __gpio_as_input(KEY_2_IN); |
| 1766 | - __gpio_disable_pull(KEY_1_IN); |
| 1767 | - __gpio_disable_pull(KEY_2_IN); |
| 1768 | + __gpio_as_input(KEY_U_IN); |
| 1769 | + __gpio_enable_pull(KEY_U_IN); |
| 1770 | |
| 1771 | - __gpio_clear_pin(KEY_1_OUT); |
| 1772 | - __gpio_clear_pin(KEY_2_OUT); |
| 1773 | - |
| 1774 | - key2 = __gpio_get_pin(KEY_2_IN); |
| 1775 | - keyh = __gpio_get_pin(KEY_1_IN); |
| 1776 | + __gpio_as_output(KEY_U_OUT); |
| 1777 | + __gpio_clear_pin(KEY_U_OUT); |
| 1778 | |
| 1779 | - if(key2) |
| 1780 | - serial_puts("key2"); |
| 1781 | - else |
| 1782 | - serial_puts("key2--"); |
| 1783 | + keyU = __gpio_get_pin(KEY_U_IN); |
| 1784 | |
| 1785 | - if(keyh) |
| 1786 | - serial_puts("keyh"); |
| 1787 | + if (keyU) |
| 1788 | + serial_puts("[U] not pressed\n"); |
| 1789 | else |
| 1790 | - serial_puts("keyh--"); |
| 1791 | + serial_puts("[U] pressed\n"); |
| 1792 | |
| 1793 | - |
| 1794 | - if( ( key2 == 0 ) && ( keyh == 0 ) ) |
| 1795 | + if (keyU == 0) |
| 1796 | return 1; |
| 1797 | else |
| 1798 | return 0; |
| 1799 | - |
| 1800 | } |
| 1801 | |
| 1802 | void nand_boot(void) |
| 1803 | @@ -402,9 +385,8 @@ void nand_boot(void) |
| 1804 | pll_init(); |
| 1805 | sdram_init(); |
| 1806 | |
| 1807 | - int ret = 0; |
| 1808 | - ret = is_usb_boot(); |
| 1809 | - if(ret) { |
| 1810 | + if(is_usb_boot()) { |
| 1811 | + serial_puts("enter USB BOOT mode\n"); |
| 1812 | usb_boot(); |
| 1813 | } |
| 1814 | |
| 1587 | 1815 | -- |
| 1588 | 1816 | 1.6.3.3 |
| 1589 | 1817 | |
| target/linux/xburst/image/u-boot/patches/0003-other-function-for-ben.patch |
| 1 | | diff --git a/board/qi_lb60/qi_lb60.c b/board/qi_lb60/qi_lb60.c |
| 2 | | index d13f2ab..93c2571 100644 |
| 3 | | +++ b/board/qi_lb60/qi_lb60.c |
| 4 | | @@ -12,6 +12,8 @@ |
| 5 | | #include <asm/mipsregs.h> |
| 6 | | #include <asm/jz4740.h> |
| 7 | | |
| 8 | | +DECLARE_GLOBAL_DATA_PTR; |
| 9 | | + |
| 10 | | static void gpio_init(void) |
| 11 | | { |
| 12 | | /* |
| 13 | | @@ -25,11 +27,6 @@ static void gpio_init(void) |
| 14 | | __gpio_as_sdram_32bit(); |
| 15 | | |
| 16 | | /* |
| 17 | | - * Initialize UART0 pins |
| 18 | | - */ |
| 19 | | - __gpio_as_uart0(); |
| 20 | | - |
| 21 | | - /* |
| 22 | | * Initialize LCD pins |
| 23 | | */ |
| 24 | | __gpio_as_lcd_18bit(); |
| 25 | | @@ -43,17 +40,31 @@ static void gpio_init(void) |
| 26 | | * Initialize Other pins |
| 27 | | */ |
| 28 | | unsigned int i; |
| 29 | | + for (i = 0; i < 7; i++){ |
| 30 | | + __gpio_as_input(GPIO_KEYIN_BASE + i); |
| 31 | | + __gpio_enable_pull(GPIO_KEYIN_BASE + i); |
| 32 | | + } |
| 33 | | + |
| 34 | | for (i = 0; i < 8; i++) { |
| 35 | | __gpio_as_output(GPIO_KEYOUT_BASE + i); |
| 36 | | - __gpio_set_pin(GPIO_KEYOUT_BASE + i); |
| 37 | | + __gpio_clear_pin(GPIO_KEYOUT_BASE + i); |
| 38 | | } |
| 39 | | |
| 40 | | - for (i = 0; i < 7; i++){ |
| 41 | | - __gpio_as_input(GPIO_KEYIN_BASE + i); |
| 42 | | - __gpio_enable_pull(GPIO_KEYIN_BASE + i); |
| 43 | | + /* |
| 44 | | + * Initialize UART0 pins, in Ben NanoNote uart0 and keyin8 use the |
| 45 | | + * same gpio, init the gpio as uart0 cause a keyboard bug. so for |
| 46 | | + * end user we disable the uart0 |
| 47 | | + */ |
| 48 | | + if (__gpio_get_pin(GPIO_KEYIN_BASE + 2) == 0){ |
| 49 | | + /* if pressed [S] */ |
| 50 | | + printf("[S] pressed, enable UART0\n"); |
| 51 | | + gd->boot_option = 5; |
| 52 | | + __gpio_as_uart0(); |
| 53 | | + } else { |
| 54 | | + printf("[S] not pressed, disable UART0\n"); |
| 55 | | + __gpio_as_input(GPIO_KEYIN_8); |
| 56 | | + __gpio_enable_pull(GPIO_KEYIN_8); |
| 57 | | } |
| 58 | | - /* __gpio_as_input( GPIO_KEYIN_8 ); */ |
| 59 | | - /* __gpio_enable_pull( GPIO_KEYIN_8 ); */ |
| 60 | | |
| 61 | | __gpio_as_output(GPIO_AUDIO_POP); |
| 62 | | __gpio_set_pin(GPIO_AUDIO_POP); |
| 63 | | @@ -73,6 +84,11 @@ static void gpio_init(void) |
| 64 | | |
| 65 | | __gpio_as_input(GPIO_USB_DETECT); |
| 66 | | __gpio_enable_pull(GPIO_USB_DETECT); |
| 67 | | + |
| 68 | | + if (__gpio_get_pin(GPIO_KEYIN_BASE + 3) == 0) { |
| 69 | | + printf("[M] pressed, boot from sd card\n"); |
| 70 | | + gd->boot_option = 1; |
| 71 | | + } |
| 72 | | } |
| 73 | | |
| 74 | | static void cpm_init(void) |
| 75 | | @@ -96,7 +112,6 @@ void board_early_init(void) |
| 76 | | |
| 77 | | int checkboard (void) |
| 78 | | { |
| 79 | | - DECLARE_GLOBAL_DATA_PTR; |
| 80 | | |
| 81 | | printf("Board: Qi LB60 (Ingenic XBurst Jz4740 SoC, Speed %d MHz)\n", |
| 82 | | gd->cpu_clk/1000000); |
| 83 | | diff --git a/common/env_common.c b/common/env_common.c |
| 84 | | index be64d13..54bf0ea 100644 |
| 85 | | +++ b/common/env_common.c |
| 86 | | @@ -134,7 +134,7 @@ uchar default_environment[] = { |
| 87 | | "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0" |
| 88 | | #endif |
| 89 | | #ifdef CONFIG_EXTRA_ENV_SETTINGS |
| 90 | | - CONFIG_EXTRA_ENV_SETTINGS |
| 91 | | + "bootargsfromsd=" CONFIG_BOOTARGSFROMSD "\0" |
| 92 | | #endif |
| 93 | | "\0" |
| 94 | | }; |
| 95 | | diff --git a/common/main.c b/common/main.c |
| 96 | | index 026edd1..1703d4f 100644 |
| 97 | | +++ b/common/main.c |
| 98 | | @@ -372,7 +372,9 @@ void main_loop (void) |
| 99 | | #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) |
| 100 | | s = getenv ("bootdelay"); |
| 101 | | bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY; |
| 102 | | - |
| 103 | | + DECLARE_GLOBAL_DATA_PTR; |
| 104 | | + if (gd->boot_option == 5) |
| 105 | | + bootdelay = gd->boot_option; |
| 106 | | debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay); |
| 107 | | |
| 108 | | # ifdef CONFIG_BOOT_RETRY_TIME |
| 109 | | diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h |
| 110 | | index db88704..23f597e 100644 |
| 111 | | +++ b/include/asm-mips/global_data.h |
| 112 | | @@ -47,6 +47,8 @@ typedef struct global_data { |
| 113 | | unsigned long mem_clk; /* Memory bus clock */ |
| 114 | | unsigned long dev_clk; /* Device clock */ |
| 115 | | unsigned long fb_base; /* base address of framebuffer */ |
| 116 | | + unsigned long boot_option; /* 1: boot from sd |
| 117 | | + * 5: boot delay for 5 secs*/ |
| 118 | | #endif |
| 119 | | unsigned long baudrate; |
| 120 | | unsigned long have_console; /* serial_init() was called */ |
| 121 | | diff --git a/include/configs/qi_lb60.h b/include/configs/qi_lb60.h |
| 122 | | index 02af607..c3bf9c7 100644 |
| 123 | | +++ b/include/configs/qi_lb60.h |
| 124 | | @@ -45,6 +45,8 @@ |
| 125 | | #define CONFIG_BOOTDELAY 0 |
| 126 | | #define CONFIG_BOOTFILE "uImage" /* file to load */ |
| 127 | | #define CONFIG_BOOTARGS "mem=32M console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait" |
| 128 | | +#define CONFIG_EXTRA_ENV_SETTINGS 1 |
| 129 | | +#define CONFIG_BOOTARGSFROMSD "mem=32M console=ttyS0,57600n8 rootfstype=ext2 root=/dev/mmcblk0p1 rw rootwait" |
| 130 | | #define CONFIG_BOOTCOMMAND "nand read 0x80600000 0x400000 0x200000;bootm" |
| 131 | | |
| 132 | | /* |
| 133 | | diff --git a/lib_mips/bootm.c b/lib_mips/bootm.c |
| 134 | | index 54af24c..34150e9 100644 |
| 135 | | +++ b/lib_mips/bootm.c |
| 136 | | @@ -46,7 +46,9 @@ static void linux_env_set (char * env_name, char * env_val); |
| 137 | | int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) |
| 138 | | { |
| 139 | | void (*theKernel) (int, char **, char **, int *); |
| 140 | | - char *commandline = getenv ("bootargs"); |
| 141 | | + char *commandline = gd->boot_option == 1 ? |
| 142 | | + getenv ("bootargsfromsd") : |
| 143 | | + getenv ("bootargs"); |
| 144 | | char env_buf[12]; |
| 145 | | char *cp; |
| 146 | | |
| 147 | | diff --git a/nand_spl/nand_boot_jz4740.c b/nand_spl/nand_boot_jz4740.c |
| 148 | | index 924a47a..146de19 100644 |
| 149 | | +++ b/nand_spl/nand_boot_jz4740.c |
| 150 | | @@ -24,10 +24,8 @@ |
| 151 | | #include <asm/io.h> |
| 152 | | #include <asm/jz4740.h> |
| 153 | | |
| 154 | | -#define KEY_1_OUT (32 * 3 + 21) |
| 155 | | -#define KEY_1_IN (32 * 3 + 19) |
| 156 | | -#define KEY_2_OUT (32 * 3 + 25) |
| 157 | | -#define KEY_2_IN (32 * 3 + 26) |
| 158 | | +#define KEY_U_OUT (32 * 2 + 16) |
| 159 | | +#define KEY_U_IN (32 * 3 + 19) |
| 160 | | |
| 161 | | /* |
| 162 | | * NAND flash definitions |
| 163 | | @@ -350,40 +348,25 @@ static void gpio_init(void) |
| 164 | | |
| 165 | | static int is_usb_boot() |
| 166 | | { |
| 167 | | - int key2,keyh; |
| 168 | | - |
| 169 | | - key2 = 0; |
| 170 | | - keyh = 0; |
| 171 | | + int keyU = 0; |
| 172 | | |
| 173 | | - __gpio_as_output(KEY_1_OUT); |
| 174 | | - __gpio_as_output(KEY_2_OUT); |
| 175 | | - __gpio_as_input(KEY_1_IN); |
| 176 | | - __gpio_as_input(KEY_2_IN); |
| 177 | | - __gpio_disable_pull(KEY_1_IN); |
| 178 | | - __gpio_disable_pull(KEY_2_IN); |
| 179 | | + __gpio_as_input(KEY_U_IN); |
| 180 | | + __gpio_enable_pull(KEY_U_IN); |
| 181 | | |
| 182 | | - __gpio_clear_pin(KEY_1_OUT); |
| 183 | | - __gpio_clear_pin(KEY_2_OUT); |
| 184 | | - |
| 185 | | - key2 = __gpio_get_pin(KEY_2_IN); |
| 186 | | - keyh = __gpio_get_pin(KEY_1_IN); |
| 187 | | + __gpio_as_output(KEY_U_OUT); |
| 188 | | + __gpio_clear_pin(KEY_U_OUT); |
| 189 | | |
| 190 | | - if(key2) |
| 191 | | - serial_puts("key2"); |
| 192 | | - else |
| 193 | | - serial_puts("key2--"); |
| 194 | | + keyU = __gpio_get_pin(KEY_U_IN); |
| 195 | | |
| 196 | | - if(keyh) |
| 197 | | - serial_puts("keyh"); |
| 198 | | + if (keyU) |
| 199 | | + serial_puts("[U] not pressed\n"); |
| 200 | | else |
| 201 | | - serial_puts("keyh--"); |
| 202 | | + serial_puts("[U] pressed\n"); |
| 203 | | |
| 204 | | - |
| 205 | | - if( ( key2 == 0 ) && ( keyh == 0 ) ) |
| 206 | | + if (keyU == 0) |
| 207 | | return 1; |
| 208 | | else |
| 209 | | return 0; |
| 210 | | - |
| 211 | | } |
| 212 | | |
| 213 | | void nand_boot(void) |
| 214 | | @@ -402,9 +385,8 @@ void nand_boot(void) |
| 215 | | pll_init(); |
| 216 | | sdram_init(); |
| 217 | | |
| 218 | | - int ret = 0; |
| 219 | | - ret = is_usb_boot(); |
| 220 | | - if(ret) { |
| 221 | | + if(is_usb_boot()) { |
| 222 | | + serial_puts("enter USB BOOT mode\n"); |
| 223 | | usb_boot(); |
| 224 | | } |
| 225 | | |