New file |
| | |
| | | diff -Nuar u-boot-at91/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c u-boot-at91-loragw/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |
| | | --- u-boot-at91/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -164,6 +164,7 @@ |
| | | #if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI) |
| | | void at91_uhp_hw_init(void) |
| | | { |
| | | +#if 0 /* comment by guowenxue 2020.12.4, PD18 conflict with Relay control board on LoRaGW V2 */ |
| | | /* Enable VBus on UHP ports */ |
| | | at91_set_pio_output(AT91_PIO_PORTD, 18, 0); /* port A */ |
| | | at91_set_pio_output(AT91_PIO_PORTD, 19, 0); /* port B */ |
| | | @@ -171,6 +172,7 @@ |
| | | /* port C is OHCI only */ |
| | | at91_set_pio_output(AT91_PIO_PORTD, 20, 0); /* port C */ |
| | | #endif |
| | | +#endif |
| | | } |
| | | #endif |
| | | |
| | | diff -Nuar u-boot-at91/board/atmel/at91sam9x5ek/at91sam9x5ek.c u-boot-at91-loragw/board/atmel/at91sam9x5ek/at91sam9x5ek.c |
| | | --- u-boot-at91/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -263,6 +263,9 @@ |
| | | /* adress of boot parameters */ |
| | | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; |
| | | |
| | | + /* PD18 is for relay and active on lowlevel, add by guowenxue 2020.12.4 */ |
| | | + at91_set_pio_output(AT91_PIO_PORTD, 18, 1); |
| | | + |
| | | #ifdef CONFIG_CMD_NAND |
| | | at91sam9x5ek_nand_hw_init(); |
| | | #endif |
| | | diff -Nuar u-boot-at91/common/autoboot.c u-boot-at91-loragw/common/autoboot.c |
| | | --- u-boot-at91/common/autoboot.c 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/common/autoboot.c 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -161,9 +161,11 @@ |
| | | */ |
| | | if (bootdelay >= 0) { |
| | | if (tstc()) { /* we got a key press */ |
| | | - (void) getc(); /* consume input */ |
| | | - puts("\b\b\b 0"); |
| | | - abort = 1; /* don't auto boot */ |
| | | + if(27==getc()) /* Only get ECS key will skip autoboot, add by guowenxue 2019.12.10 */ |
| | | + { |
| | | + puts("\b\b\b 0"); |
| | | + abort = 1; /* don't auto boot */ |
| | | + } |
| | | } |
| | | } |
| | | #endif |
| | | @@ -174,14 +176,12 @@ |
| | | ts = get_timer(0); |
| | | do { |
| | | if (tstc()) { /* we got a key press */ |
| | | - abort = 1; /* don't auto boot */ |
| | | - bootdelay = 0; /* no more delay */ |
| | | -# ifdef CONFIG_MENUKEY |
| | | - menukey = getc(); |
| | | -# else |
| | | - (void) getc(); /* consume input */ |
| | | -# endif |
| | | - break; |
| | | + if(27==getc()) /* Only get ECS key will skip autoboot, add by guowenxue 2019.12.10 */ |
| | | + { |
| | | + abort = 1; /* don't auto boot */ |
| | | + bootdelay = 0; /* no more delay */ |
| | | + break; |
| | | + } |
| | | } |
| | | udelay(10000); |
| | | } while (!abort && get_timer(ts) < 1000); |
| | | diff -Nuar u-boot-at91/common/board_r.c u-boot-at91-loragw/common/board_r.c |
| | | --- u-boot-at91/common/board_r.c 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/common/board_r.c 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -427,6 +427,17 @@ |
| | | else |
| | | set_default_env(NULL); |
| | | |
| | | + /* add by guowenxue, 2019.12.10. For auto detect rootfs type for 4K/2K nandflash */ |
| | | + if( !getenv("nand_pagesize") ) |
| | | + { |
| | | + char buf[64]={'\0'}; |
| | | + extern int g_nand_erasesize; /* defined in drivers/mtd/nand/atmel_nand.c */ |
| | | + |
| | | + snprintf(buf, sizeof(buf), "p%dk", g_nand_erasesize); |
| | | + setenv("nand_pagesize", buf); |
| | | + saveenv(); |
| | | + } |
| | | + |
| | | /* Initialize from environment */ |
| | | load_addr = getenv_ulong("loadaddr", 16, load_addr); |
| | | #if defined(CONFIG_SYS_EXTBDINFO) |
| | | diff -Nuar u-boot-at91/drivers/mtd/nand/atmel_nand.c u-boot-at91-loragw/drivers/mtd/nand/atmel_nand.c |
| | | --- u-boot-at91/drivers/mtd/nand/atmel_nand.c 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/drivers/mtd/nand/atmel_nand.c 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -20,6 +20,8 @@ |
| | | #include <watchdog.h> |
| | | #include <linux/mtd/nand_ecc.h> |
| | | |
| | | +int g_nand_erasesize; /* add by guowenxue, 2019.12.10 */ |
| | | + |
| | | #ifdef CONFIG_ATMEL_NAND_HWECC |
| | | |
| | | /* Register access macros */ |
| | | @@ -1519,6 +1521,7 @@ |
| | | if (!ret) |
| | | nand_register(devnum); |
| | | |
| | | + g_nand_erasesize = mtd->writesize/1024; /* add by guowenxue, 2019.12.10 */ |
| | | return ret; |
| | | } |
| | | |
| | | diff -Nuar u-boot-at91/include/configs/at91sam9x5ek.h u-boot-at91-loragw/include/configs/at91sam9x5ek.h |
| | | --- u-boot-at91/include/configs/at91sam9x5ek.h 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/include/configs/at91sam9x5ek.h 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -52,7 +52,7 @@ |
| | | #define CONFIG_ATMEL_LCD_RGB565 |
| | | #define CONFIG_SYS_CONSOLE_IS_IN_ENV |
| | | |
| | | -#define CONFIG_BOOTDELAY 3 |
| | | +#define CONFIG_BOOTDELAY 1 |
| | | |
| | | /* |
| | | * BOOTP options |
| | | @@ -98,7 +98,7 @@ |
| | | #ifdef CONFIG_CMD_SF |
| | | #define CONFIG_ATMEL_SPI |
| | | #define CONFIG_SPI_FLASH |
| | | -#define CONFIG_SPI_FLASH_ATMEL |
| | | +#define CONFIG_SPI_FLASH_WINBOND /* modify by guowenxue, 2019.12.09 */ |
| | | #define CONFIG_SF_DEFAULT_SPEED 30000000 |
| | | #endif |
| | | |
| | | @@ -182,15 +182,13 @@ |
| | | "0x22000000 0x200000 0x300000; " \ |
| | | "bootm 0x22000000" |
| | | #elif defined(CONFIG_SYS_USE_SPIFLASH) |
| | | -/* bootstrap + u-boot + env + linux in spi flash */ |
| | | -#define CONFIG_ENV_IS_IN_SPI_FLASH |
| | | -#define CONFIG_ENV_OFFSET 0x5000 |
| | | -#define CONFIG_ENV_SIZE 0x3000 |
| | | -#define CONFIG_ENV_SECT_SIZE 0x1000 |
| | | -#define CONFIG_ENV_SPI_MAX_HZ 30000000 |
| | | -#define CONFIG_BOOTCOMMAND "sf probe 0; " \ |
| | | - "sf read 0x22000000 0x100000 0x300000; " \ |
| | | - "bootm 0x22000000" |
| | | + |
| | | +/* bootstrap + u-boot in SPI flash and env + linux in nandflash, modify by guowenxue */ |
| | | +#define CONFIG_ENV_IS_IN_NAND |
| | | +#define CONFIG_ENV_OFFSET 0xC0000 |
| | | +#define CONFIG_ENV_SIZE 0x20000 |
| | | +#define CONFIG_BOOTCOMMAND "nand read 0x22000000 0x100000 0x700000; bootm 0x22000000" |
| | | + |
| | | #elif defined(CONFIG_SYS_USE_DATAFLASH) |
| | | /* bootstrap + u-boot + env + linux in data flash */ |
| | | #define CONFIG_ENV_IS_IN_SPI_FLASH |
| | | @@ -220,12 +218,35 @@ |
| | | #else |
| | | #define CONFIG_BOOTARGS \ |
| | | "console=ttyS0,115200 earlyprintk " \ |
| | | - "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ |
| | | - "256k(env),256k(env_redundant),256k(spare)," \ |
| | | - "512k(dtb),6M(kernel)ro,-(rootfs) " \ |
| | | - "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw" |
| | | + "rootfstype=ubifs ubi.mtd=2 root=ubi0:rootfs rw" |
| | | #endif |
| | | |
| | | +/* Add by guowenxue, 2019.12.9 */ |
| | | +#define CONFIG_FIT 1 |
| | | +#define CONFIG_ENV_OVERWRITE 1 |
| | | +#define CONFIG_ETHADDR 42:96:ab:be:a7:5d |
| | | +#define CONFIG_IPADDR 192.168.2.196 |
| | | +#define CONFIG_SERVERIP 192.168.2.2 |
| | | + |
| | | +#define CONFIG_BOARDNAME "LoRaGW" |
| | | +#define CONFIG_TFTPBOOT "tftp 0x22000000 linuxrom-${boardname}.itb && bootm 0x22000000" |
| | | + |
| | | +#define CONFIG_BBL "sf probe && tftp 0x22000000 bootstrap-${boardname}.bin && " \ |
| | | + "tftp 0x23000000 u-boot-${boardname}.bin && " \ |
| | | + "sf erase 0 A0000 && sf write 0x22000000 0 3000 && sf write 0x23000000 8000 80000" |
| | | + |
| | | +#define CONFIG_BKR "tftp 0x22000000 linuxrom-${boardname}.itb && nand erase 0x100000 0x700000; " \ |
| | | + "nand write 0x22000000 0x100000 ${filesize}" |
| | | + |
| | | +#define CONFIG_BFS "tftp 0x21000000 rootfs-${boardname}.ubi-${nand_pagesize} && nand erase 800000 6400000; " \ |
| | | + "nand write 0x21000000 800000 ${filesize}" |
| | | + |
| | | +#define CONFIG_BSYS "run bkr; run bfs" |
| | | +#define CONFIG_CLRAPPS "nand erase d000000 13000000" |
| | | +#define CONFIG_CLRENV "nand erase 0 100000" |
| | | +#define CONFIG_DBGRUN "run bfs; run tb" |
| | | +/* add end */ |
| | | + |
| | | #define CONFIG_BAUDRATE 115200 |
| | | |
| | | #define CONFIG_SYS_PROMPT "U-Boot> " |
| | | diff -Nuar u-boot-at91/include/env_default.h u-boot-at91-loragw/include/env_default.h |
| | | --- u-boot-at91/include/env_default.h 2019-12-09 22:12:00.000000000 +0800 |
| | | +++ u-boot-at91-loragw/include/env_default.h 2024-05-22 11:40:07.019509486 +0800 |
| | | @@ -76,6 +76,35 @@ |
| | | #ifdef CONFIG_SERVERIP |
| | | "serverip=" __stringify(CONFIG_SERVERIP) "\0" |
| | | #endif |
| | | +/* add by guowenxue, 2019.08.22 */ |
| | | +#ifdef CONFIG_BOARDNAME |
| | | + "boardname=" CONFIG_BOARDNAME "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_TFTPBOOT |
| | | + "tb=" CONFIG_TFTPBOOT "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_BBL |
| | | + "bbl=" CONFIG_BBL "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_BKR |
| | | + "bkr=" CONFIG_BKR "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_BFS |
| | | + "bfs=" CONFIG_BFS "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_BSYS |
| | | + "bsys=" CONFIG_BSYS "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_CLRAPPS |
| | | + "clrapps=" CONFIG_CLRAPPS "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_CLRENV |
| | | + "clrenv=" CONFIG_CLRENV "\0" |
| | | +#endif |
| | | +#ifdef CONFIG_DBGRUN |
| | | + "dbg=" CONFIG_DBGRUN "\0" |
| | | +#endif |
| | | +/* add end */ |
| | | #ifdef CONFIG_SYS_AUTOLOAD |
| | | "autoload=" CONFIG_SYS_AUTOLOAD "\0" |
| | | #endif |