From: Daniel Golle Date: Sat, 30 Jan 2021 13:58:16 +0000 (+0000) Subject: uboot-mediatek: add support for Linksys E8450 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ed5000431940c0c8ae2b5704faa0ceb68a299102;p=openwrt%2Fstaging%2Frobimarko.git uboot-mediatek: add support for Linksys E8450 Build U-Boot for the Linksys E8450 in order to have support for UBI. The loader has a default environment with scripts handling the reset button as well as fall-back to recovery firmware. If the loader comes up without a valid environment found in UBI, it will automatically make sure UBI is formatted and create a new environment and proceed to load recovery firmware (either from UBI or via TFTP if recovery is corrupted or unavailable). If the button is held down during power-on, the yellow status LED turns on and the bootloader environment is reset to factory defaults. If the button is released at this point, the recovery firmware (if existing) is loaded from UBI and booted. If the button is continously held down even beyond the point that the yellow LED turned on, the loader will try to load the recovery firmware via TFTP from server 192.168.1.254, write it to UBI and boot. Signed-off-by: Daniel Golle --- diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index c46b906cb5..b61f432644 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -3,6 +3,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_VERSION:=2020.10 PKG_HASH:=0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622 +PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -20,6 +21,16 @@ define U-Boot/mt7622 UBOOT_CONFIG:=mt7622_rfb endef +define U-Boot/mt7622_linksys_e8450 + NAME:=Linksys E8450 + BUILD_SUBTARGET:=mt7622 + UBOOT_CONFIG:=mt7622_linksys_e8450 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=snand + BL2_DDRBLOB:=1 + DEPENDS:=+trusted-firmware-a-mt7622-snand-1ddr +endef + define U-Boot/mt7623a_unielec_u7623 NAME:=UniElec U7623 (mt7623) BUILD_SUBTARGET:=mt7623 @@ -39,15 +50,33 @@ define U-Boot/mt7629 UBOOT_CONFIG:=mt7629_rfb endef -UBOOT_TARGETS := mt7629 mt7622 mt7623n_bpir2 mt7623a_unielec_u7623 +UBOOT_TARGETS := mt7629 mt7622 mt7622_linksys_e8450 mt7623n_bpir2 mt7623a_unielec_u7623 -UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE) +UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin) Build/Exports:=$(Host/Exports) +define Build/fip-image + $(STAGING_DIR_HOST)/bin/fiptool create \ + --soc-fw $(STAGING_DIR_IMAGE)/$(BUILD_SUBTARGET)-$(BL2_BOOTDEV)-$(BL2_DDRBLOB)ddr-bl31.bin \ + --nt-fw $(PKG_BUILD_DIR)/u-boot.bin \ + $(PKG_BUILD_DIR)/u-boot.fip +endef + +define Build/Compile + $(call Build/Compile/U-Boot) +ifeq ($(UBOOT_IMAGE),u-boot.fip)) + $(call Build/fip-image) +endif +endef + +# don't stage files to bindir, let target/linux/mediatek/image/*.mk do that +define Package/u-boot/install +endef + define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) endef $(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-mediatek/patches/002-nand-add-spi-nand-driver.patch b/package/boot/uboot-mediatek/patches/002-nand-add-spi-nand-driver.patch index dc3ebaf7af..5d3e94ac86 100644 --- a/package/boot/uboot-mediatek/patches/002-nand-add-spi-nand-driver.patch +++ b/package/boot/uboot-mediatek/patches/002-nand-add-spi-nand-driver.patch @@ -85,11 +85,9 @@ Signed-off-by: Xiangsheng Hou create mode 100644 drivers/mtd/nandx/include/internal/nandx_util.h create mode 100644 drivers/mtd/nandx/include/uboot/nandx_os.h -diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig -index 5e7571cf3d..34a59b44b9 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig -@@ -101,6 +101,13 @@ config HBMC_AM654 +@@ -108,6 +108,13 @@ config HBMC_AM654 This is the driver for HyperBus controller on TI's AM65x and other SoCs @@ -103,11 +101,9 @@ index 5e7571cf3d..34a59b44b9 100644 source "drivers/mtd/nand/Kconfig" source "drivers/mtd/spi/Kconfig" -diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile -index 318788c5e2..1df1031b23 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile -@@ -41,3 +41,7 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPORT) += spi/ +@@ -41,3 +41,7 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR obj-$(CONFIG_SPL_UBI) += ubispl/ endif @@ -115,8 +111,6 @@ index 318788c5e2..1df1031b23 100644 +ifeq ($(CONFIG_MTK_SPI_NAND), y) +include $(srctree)/drivers/mtd/nandx/Nandx.mk +endif -diff --git a/drivers/mtd/nand/raw/nand.c b/drivers/mtd/nand/raw/nand.c -index 026419e4e6..4be0c7d8f3 100644 --- a/drivers/mtd/nand/raw/nand.c +++ b/drivers/mtd/nand/raw/nand.c @@ -91,8 +91,10 @@ static void nand_init_chip(int i) @@ -130,9 +124,6 @@ index 026419e4e6..4be0c7d8f3 100644 nand_register(i, mtd); } -diff --git a/drivers/mtd/nandx/NOTICE b/drivers/mtd/nandx/NOTICE -new file mode 100644 -index 0000000000..1a06ca3867 --- /dev/null +++ b/drivers/mtd/nandx/NOTICE @@ -0,0 +1,52 @@ @@ -189,9 +180,6 @@ index 0000000000..1a06ca3867 + +#################################################################################################### \ No newline at end of file -diff --git a/drivers/mtd/nandx/Nandx.config b/drivers/mtd/nandx/Nandx.config -new file mode 100644 -index 0000000000..35705ee28d --- /dev/null +++ b/drivers/mtd/nandx/Nandx.config @@ -0,0 +1,17 @@ @@ -212,9 +200,6 @@ index 0000000000..35705ee28d +NANDX_NFI_BASE := y +NANDX_NFI_ECC := y +NANDX_NFI_SPI := y -diff --git a/drivers/mtd/nandx/Nandx.mk b/drivers/mtd/nandx/Nandx.mk -new file mode 100644 -index 0000000000..f5a6f2a628 --- /dev/null +++ b/drivers/mtd/nandx/Nandx.mk @@ -0,0 +1,91 @@ @@ -309,9 +294,6 @@ index 0000000000..f5a6f2a628 +clean: + rm -rf $(sim-obj) nandx +endif -diff --git a/drivers/mtd/nandx/README b/drivers/mtd/nandx/README -new file mode 100644 -index 0000000000..0feaeaeb88 --- /dev/null +++ b/drivers/mtd/nandx/README @@ -0,0 +1,31 @@ @@ -346,9 +328,6 @@ index 0000000000..0feaeaeb88 + Any block of above graph can be extended at your will, if you +want add new feature into this code, please make sure that your code +would follow the framework, and we will be appreciated about it. -diff --git a/drivers/mtd/nandx/core/Nandx.mk b/drivers/mtd/nandx/core/Nandx.mk -new file mode 100644 -index 0000000000..7a5661c044 --- /dev/null +++ b/drivers/mtd/nandx/core/Nandx.mk @@ -0,0 +1,38 @@ @@ -390,9 +369,6 @@ index 0000000000..7a5661c044 +nandx-header-$(NANDX_NFI_ECC) += nfi/nfiecc_regs.h +nandx-header-$(NANDX_NFI_SPI) += nfi/nfi_spi.h +nandx-header-$(NANDX_NFI_SPI) += nfi/nfi_spi_regs.h -diff --git a/drivers/mtd/nandx/core/core_io.c b/drivers/mtd/nandx/core/core_io.c -new file mode 100644 -index 0000000000..716eeed38d --- /dev/null +++ b/drivers/mtd/nandx/core/core_io.c @@ -0,0 +1,735 @@ @@ -1131,9 +1107,6 @@ index 0000000000..716eeed38d + return ret; +} +#endif -diff --git a/drivers/mtd/nandx/core/core_io.h b/drivers/mtd/nandx/core/core_io.h -new file mode 100644 -index 0000000000..edcb60908a --- /dev/null +++ b/drivers/mtd/nandx/core/core_io.h @@ -0,0 +1,39 @@ @@ -1176,9 +1149,6 @@ index 0000000000..edcb60908a +}; + +#endif /* __CORE_IO_H__ */ -diff --git a/drivers/mtd/nandx/core/nand/device_spi.c b/drivers/mtd/nandx/core/nand/device_spi.c -new file mode 100644 -index 0000000000..db338c28c2 --- /dev/null +++ b/drivers/mtd/nandx/core/nand/device_spi.c @@ -0,0 +1,200 @@ @@ -1382,9 +1352,6 @@ index 0000000000..db338c28c2 + return &spi_nand[index].dev; +} + -diff --git a/drivers/mtd/nandx/core/nand/device_spi.h b/drivers/mtd/nandx/core/nand/device_spi.h -new file mode 100644 -index 0000000000..1676b61fc8 --- /dev/null +++ b/drivers/mtd/nandx/core/nand/device_spi.h @@ -0,0 +1,132 @@ @@ -1520,9 +1487,6 @@ index 0000000000..1676b61fc8 +u8 spi_replace_tx_col_cycle(u8 mode); + +#endif /* __DEVICE_SPI_H__ */ -diff --git a/drivers/mtd/nandx/core/nand/nand_spi.c b/drivers/mtd/nandx/core/nand/nand_spi.c -new file mode 100644 -index 0000000000..2ae03e1cf4 --- /dev/null +++ b/drivers/mtd/nandx/core/nand/nand_spi.c @@ -0,0 +1,526 @@ @@ -2052,9 +2016,6 @@ index 0000000000..2ae03e1cf4 + nand_base_exit(spi->parent); + mem_free(spi); +} -diff --git a/drivers/mtd/nandx/core/nand/nand_spi.h b/drivers/mtd/nandx/core/nand/nand_spi.h -new file mode 100644 -index 0000000000..e55e4de6f7 --- /dev/null +++ b/drivers/mtd/nandx/core/nand/nand_spi.h @@ -0,0 +1,35 @@ @@ -2093,9 +2054,6 @@ index 0000000000..e55e4de6f7 +} + +#endif /* __NAND_SPI_H__ */ -diff --git a/drivers/mtd/nandx/core/nand_base.c b/drivers/mtd/nandx/core/nand_base.c -new file mode 100644 -index 0000000000..65998e5460 --- /dev/null +++ b/drivers/mtd/nandx/core/nand_base.c @@ -0,0 +1,304 @@ @@ -2403,9 +2361,6 @@ index 0000000000..65998e5460 + nfi_exit(base->nfi); + mem_free(base); +} -diff --git a/drivers/mtd/nandx/core/nand_base.h b/drivers/mtd/nandx/core/nand_base.h -new file mode 100644 -index 0000000000..13217978e5 --- /dev/null +++ b/drivers/mtd/nandx/core/nand_base.h @@ -0,0 +1,71 @@ @@ -2480,9 +2435,6 @@ index 0000000000..13217978e5 +int nand_detect_device(struct nand_base *nand); + +#endif /* __NAND_BASE_H__ */ -diff --git a/drivers/mtd/nandx/core/nand_chip.c b/drivers/mtd/nandx/core/nand_chip.c -new file mode 100644 -index 0000000000..02adc6f52e --- /dev/null +++ b/drivers/mtd/nandx/core/nand_chip.c @@ -0,0 +1,272 @@ @@ -2758,9 +2710,6 @@ index 0000000000..02adc6f52e + nand_exit(chip->nand); + mem_free(chip); +} -diff --git a/drivers/mtd/nandx/core/nand_chip.h b/drivers/mtd/nandx/core/nand_chip.h -new file mode 100644 -index 0000000000..3e9c8e6ca3 --- /dev/null +++ b/drivers/mtd/nandx/core/nand_chip.h @@ -0,0 +1,103 @@ @@ -2867,9 +2816,6 @@ index 0000000000..3e9c8e6ca3 +struct nand_chip *nand_chip_init(struct nfi_resource *res); +void nand_chip_exit(struct nand_chip *chip); +#endif /* __NAND_CHIP_H__ */ -diff --git a/drivers/mtd/nandx/core/nand_device.c b/drivers/mtd/nandx/core/nand_device.c -new file mode 100644 -index 0000000000..9f6764d1bc --- /dev/null +++ b/drivers/mtd/nandx/core/nand_device.c @@ -0,0 +1,285 @@ @@ -3158,9 +3104,6 @@ index 0000000000..9f6764d1bc + return 0; +} + -diff --git a/drivers/mtd/nandx/core/nand_device.h b/drivers/mtd/nandx/core/nand_device.h -new file mode 100644 -index 0000000000..e142cf529d --- /dev/null +++ b/drivers/mtd/nandx/core/nand_device.h @@ -0,0 +1,608 @@ @@ -3772,9 +3715,6 @@ index 0000000000..e142cf529d + +struct nand_device *nand_get_device(int index); +#endif /* __NAND_DEVICE_H__ */ -diff --git a/drivers/mtd/nandx/core/nfi.h b/drivers/mtd/nandx/core/nfi.h -new file mode 100644 -index 0000000000..ba84e73ccc --- /dev/null +++ b/drivers/mtd/nandx/core/nfi.h @@ -0,0 +1,51 @@ @@ -3829,9 +3769,6 @@ index 0000000000..ba84e73ccc +void nfi_exit(struct nfi *nfi); + +#endif /* __NFI_H__ */ -diff --git a/drivers/mtd/nandx/core/nfi/nfi_base.c b/drivers/mtd/nandx/core/nfi/nfi_base.c -new file mode 100644 -index 0000000000..d8679d7aa3 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfi_base.c @@ -0,0 +1,1357 @@ @@ -5192,9 +5129,6 @@ index 0000000000..d8679d7aa3 + nfi_extend_exit(nb); +} + -diff --git a/drivers/mtd/nandx/core/nfi/nfi_base.h b/drivers/mtd/nandx/core/nfi/nfi_base.h -new file mode 100644 -index 0000000000..ae894eaa31 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfi_base.h @@ -0,0 +1,95 @@ @@ -5293,9 +5227,6 @@ index 0000000000..ae894eaa31 +void nfi_extend_exit(struct nfi_base *nb); + +#endif /* __NFI_BASE_H__ */ -diff --git a/drivers/mtd/nandx/core/nfi/nfi_regs.h b/drivers/mtd/nandx/core/nfi/nfi_regs.h -new file mode 100644 -index 0000000000..ba4868acc8 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfi_regs.h @@ -0,0 +1,114 @@ @@ -5413,9 +5344,6 @@ index 0000000000..ba4868acc8 + +#endif /* __NFI_REGS_H__ */ + -diff --git a/drivers/mtd/nandx/core/nfi/nfi_spi.c b/drivers/mtd/nandx/core/nfi/nfi_spi.c -new file mode 100644 -index 0000000000..67cd0aaad9 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfi_spi.c @@ -0,0 +1,689 @@ @@ -6108,9 +6036,6 @@ index 0000000000..67cd0aaad9 + mem_free(nfi_spi); +} + -diff --git a/drivers/mtd/nandx/core/nfi/nfi_spi.h b/drivers/mtd/nandx/core/nfi/nfi_spi.h -new file mode 100644 -index 0000000000..a52255663a --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfi_spi.h @@ -0,0 +1,44 @@ @@ -6158,9 +6083,6 @@ index 0000000000..a52255663a +}; + +#endif /* __NFI_SPI_H__ */ -diff --git a/drivers/mtd/nandx/core/nfi/nfi_spi_regs.h b/drivers/mtd/nandx/core/nfi/nfi_spi_regs.h -new file mode 100644 -index 0000000000..77adf46782 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfi_spi_regs.h @@ -0,0 +1,64 @@ @@ -6228,9 +6150,6 @@ index 0000000000..77adf46782 +#define SPI_GPRAM_ADDR 0x800 + +#endif /* __NFI_SPI_REGS_H__ */ -diff --git a/drivers/mtd/nandx/core/nfi/nfiecc.c b/drivers/mtd/nandx/core/nfi/nfiecc.c -new file mode 100644 -index 0000000000..14246fbc3e --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfiecc.c @@ -0,0 +1,510 @@ @@ -6744,9 +6663,6 @@ index 0000000000..14246fbc3e + mem_free(ecc); +} + -diff --git a/drivers/mtd/nandx/core/nfi/nfiecc.h b/drivers/mtd/nandx/core/nfi/nfiecc.h -new file mode 100644 -index 0000000000..b02a5c3534 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfiecc.h @@ -0,0 +1,90 @@ @@ -6840,9 +6756,6 @@ index 0000000000..b02a5c3534 +void nfiecc_exit(struct nfiecc *ecc); + +#endif /* __NFIECC_H__ */ -diff --git a/drivers/mtd/nandx/core/nfi/nfiecc_regs.h b/drivers/mtd/nandx/core/nfi/nfiecc_regs.h -new file mode 100644 -index 0000000000..96564cf872 --- /dev/null +++ b/drivers/mtd/nandx/core/nfi/nfiecc_regs.h @@ -0,0 +1,51 @@ @@ -6897,9 +6810,6 @@ index 0000000000..96564cf872 +#define NFIECC_DECEL(x) (0x120 + (x) * 4) + +#endif /* __NFIECC_REGS_H__ */ -diff --git a/drivers/mtd/nandx/driver/Nandx.mk b/drivers/mtd/nandx/driver/Nandx.mk -new file mode 100644 -index 0000000000..3fb93d37c5 --- /dev/null +++ b/drivers/mtd/nandx/driver/Nandx.mk @@ -0,0 +1,18 @@ @@ -6921,9 +6831,6 @@ index 0000000000..3fb93d37c5 +nandx-$(NANDX_KERNEL_SUPPORT) += kernel/driver.c +nandx-$(NANDX_LK_SUPPORT) += lk/driver.c +nandx-$(NANDX_UBOOT_SUPPORT) += uboot/driver.c -diff --git a/drivers/mtd/nandx/driver/bbt/bbt.c b/drivers/mtd/nandx/driver/bbt/bbt.c -new file mode 100644 -index 0000000000..c9d4823e09 --- /dev/null +++ b/drivers/mtd/nandx/driver/bbt/bbt.c @@ -0,0 +1,408 @@ @@ -7335,9 +7242,6 @@ index 0000000000..c9d4823e09 + + return get_bbt_mark(g_bbt_manager.bbt, block) != BBT_BLOCK_GOOD; +} -diff --git a/drivers/mtd/nandx/driver/uboot/driver.c b/drivers/mtd/nandx/driver/uboot/driver.c -new file mode 100644 -index 0000000000..7bd3342452 --- /dev/null +++ b/drivers/mtd/nandx/driver/uboot/driver.c @@ -0,0 +1,574 @@ @@ -7915,9 +7819,6 @@ index 0000000000..7bd3342452 +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("MTK Nand Flash Controller Driver"); +MODULE_AUTHOR("MediaTek"); -diff --git a/drivers/mtd/nandx/include/Nandx.mk b/drivers/mtd/nandx/include/Nandx.mk -new file mode 100644 -index 0000000000..667402790e --- /dev/null +++ b/drivers/mtd/nandx/include/Nandx.mk @@ -0,0 +1,16 @@ @@ -7937,9 +7838,6 @@ index 0000000000..667402790e +nandx-header-$(NANDX_LK_SUPPORT) += lk/nandx_os.h +nandx-header-$(NANDX_KERNEL_SUPPORT) += kernel/nandx_os.h +nandx-header-$(NANDX_UBOOT_SUPPORT) += uboot/nandx_os.h -diff --git a/drivers/mtd/nandx/include/internal/bbt.h b/drivers/mtd/nandx/include/internal/bbt.h -new file mode 100644 -index 0000000000..4676def1f5 --- /dev/null +++ b/drivers/mtd/nandx/include/internal/bbt.h @@ -0,0 +1,62 @@ @@ -8005,9 +7903,6 @@ index 0000000000..4676def1f5 +int bbt_is_bad(struct nandx_info *nand, off_t offset); + +#endif /*__BBT_H__*/ -diff --git a/drivers/mtd/nandx/include/internal/nandx_core.h b/drivers/mtd/nandx/include/internal/nandx_core.h -new file mode 100644 -index 0000000000..09aff72224 --- /dev/null +++ b/drivers/mtd/nandx/include/internal/nandx_core.h @@ -0,0 +1,250 @@ @@ -8261,9 +8156,6 @@ index 0000000000..09aff72224 +#endif + +#endif /* __NANDX_CORE_H__ */ -diff --git a/drivers/mtd/nandx/include/internal/nandx_errno.h b/drivers/mtd/nandx/include/internal/nandx_errno.h -new file mode 100644 -index 0000000000..51fb299c03 --- /dev/null +++ b/drivers/mtd/nandx/include/internal/nandx_errno.h @@ -0,0 +1,40 @@ @@ -8307,9 +8199,6 @@ index 0000000000..51fb299c03 +#endif + +#endif /* __NANDX_ERRNO_H__ */ -diff --git a/drivers/mtd/nandx/include/internal/nandx_util.h b/drivers/mtd/nandx/include/internal/nandx_util.h -new file mode 100644 -index 0000000000..1990b000ee --- /dev/null +++ b/drivers/mtd/nandx/include/internal/nandx_util.h @@ -0,0 +1,221 @@ @@ -8534,9 +8423,6 @@ index 0000000000..1990b000ee +} + +#endif /* __NANDX_UTIL_H__ */ -diff --git a/drivers/mtd/nandx/include/uboot/nandx_os.h b/drivers/mtd/nandx/include/uboot/nandx_os.h -new file mode 100644 -index 0000000000..8ea53378bf --- /dev/null +++ b/drivers/mtd/nandx/include/uboot/nandx_os.h @@ -0,0 +1,78 @@ @@ -8618,8 +8504,6 @@ index 0000000000..8ea53378bf +} + +#endif /* __NANDX_OS_H__ */ -diff --git a/include/configs/mt7622.h b/include/configs/mt7622.h -index dfd506ed24..6d0c956484 100644 --- a/include/configs/mt7622.h +++ b/include/configs/mt7622.h @@ -11,6 +11,31 @@ @@ -8654,6 +8538,3 @@ index dfd506ed24..6d0c956484 100644 #define CONFIG_SYS_MAXARGS 8 #define CONFIG_SYS_BOOTM_LEN SZ_64M #define CONFIG_SYS_CBSIZE SZ_1K --- -2.17.1 - diff --git a/package/boot/uboot-mediatek/patches/003-mt7622-uboot-add-dts-and-config-for-spi-nand.patch b/package/boot/uboot-mediatek/patches/003-mt7622-uboot-add-dts-and-config-for-spi-nand.patch index 2c021e1c80..7167a498ad 100644 --- a/package/boot/uboot-mediatek/patches/003-mt7622-uboot-add-dts-and-config-for-spi-nand.patch +++ b/package/boot/uboot-mediatek/patches/003-mt7622-uboot-add-dts-and-config-for-spi-nand.patch @@ -11,11 +11,9 @@ Signed-off-by: Xiangsheng Hou arch/arm/dts/mt7622.dtsi | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) -diff --git a/arch/arm/dts/mt7622-rfb.dts b/arch/arm/dts/mt7622-rfb.dts -index f05c3fe14d..05502bddec 100644 --- a/arch/arm/dts/mt7622-rfb.dts +++ b/arch/arm/dts/mt7622-rfb.dts -@@ -143,6 +143,12 @@ +@@ -174,6 +174,12 @@ }; }; @@ -28,11 +26,9 @@ index f05c3fe14d..05502bddec 100644 &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins>; -diff --git a/arch/arm/dts/mt7622.dtsi b/arch/arm/dts/mt7622.dtsi -index 1e8ec9b48b..63fdb63d4a 100644 --- a/arch/arm/dts/mt7622.dtsi +++ b/arch/arm/dts/mt7622.dtsi -@@ -52,6 +52,26 @@ +@@ -53,6 +53,26 @@ #size-cells = <0>; }; @@ -59,6 +55,3 @@ index 1e8ec9b48b..63fdb63d4a 100644 timer { compatible = "arm,armv8-timer"; interrupt-parent = <&gic>; --- -2.17.1 - diff --git a/package/boot/uboot-mediatek/patches/004-configs-enable-mtd-and-mtk_spi_nand-in-defconfig.patch b/package/boot/uboot-mediatek/patches/004-configs-enable-mtd-and-mtk_spi_nand-in-defconfig.patch index cb564965c7..6999e5e235 100644 --- a/package/boot/uboot-mediatek/patches/004-configs-enable-mtd-and-mtk_spi_nand-in-defconfig.patch +++ b/package/boot/uboot-mediatek/patches/004-configs-enable-mtd-and-mtk_spi_nand-in-defconfig.patch @@ -10,8 +10,6 @@ Signed-off-by: Sam Shih configs/mt7622_rfb_defconfig | 5 +++++ 1 file changed, 5 insertions(+) -diff --git a/configs/mt7622_rfb_defconfig b/configs/mt7622_rfb_defconfig -index 1ce6ebdfeb..816126267b 100644 --- a/configs/mt7622_rfb_defconfig +++ b/configs/mt7622_rfb_defconfig @@ -13,6 +13,7 @@ CONFIG_DEFAULT_FDT_FILE="mt7622-rfb" @@ -22,18 +20,3 @@ index 1ce6ebdfeb..816126267b 100644 CONFIG_CMD_PCI=y CONFIG_CMD_SF_TEST=y CONFIG_CMD_PING=y - CONFIG_CMD_SMC=y -@@ -25,6 +26,10 @@ CONFIG_CLK=y - CONFIG_DM_MMC=y - CONFIG_MMC_HS200_SUPPORT=y - CONFIG_MMC_MTK=y -+CONFIG_MTD=y -+CONFIG_DM_MTD=y -+CONFIG_MTK_SPI_NAND=y -+CONFIG_MTD_RAW_NAND=y - CONFIG_DM_SPI_FLASH=y - CONFIG_SPI_FLASH_EON=y - CONFIG_SPI_FLASH_GIGADEVICE=y --- -2.17.1 - diff --git a/package/boot/uboot-mediatek/patches/005-update-bpir2-defconfig.patch b/package/boot/uboot-mediatek/patches/005-update-bpir2-defconfig.patch index cc7ed89280..b750dda6e8 100644 --- a/package/boot/uboot-mediatek/patches/005-update-bpir2-defconfig.patch +++ b/package/boot/uboot-mediatek/patches/005-update-bpir2-defconfig.patch @@ -1,10 +1,9 @@ -diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig -index 6b9fbd7e22..fb2a004803 100644 --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig -@@ -52,3 +52,13 @@ CONFIG_TIMER=y - CONFIG_WDT_MTK=y - CONFIG_LZMA=y +@@ -51,5 +51,15 @@ CONFIG_SYSRESET=y + CONFIG_SYSRESET_WATCHDOG=y + CONFIG_TIMER=y + CONFIG_MTK_TIMER=y +CONFIG_CMD_BOOTZ=y +CONFIG_OF_LIBFDT_OVERLAY=y +#enables savenenv-command @@ -15,3 +14,5 @@ index 6b9fbd7e22..fb2a004803 100644 +CONFIG_CMD_ASKENV=y +CONFIG_ENV_SIZE=0x2000 +CONFIG_CMD_SETEXPR=y + CONFIG_WDT_MTK=y + CONFIG_LZMA=y diff --git a/package/boot/uboot-mediatek/patches/006-cmd-button-return-button-status.patch b/package/boot/uboot-mediatek/patches/006-cmd-button-return-button-status.patch new file mode 100644 index 0000000000..a413688f1c --- /dev/null +++ b/package/boot/uboot-mediatek/patches/006-cmd-button-return-button-status.patch @@ -0,0 +1,38 @@ +From a6bfd71a96201127836d59736abcb54dc2d5e1a5 Mon Sep 17 00:00:00 2001 +From: Heinrich Schuchardt +Date: Mon, 14 Sep 2020 12:50:56 +0200 +Subject: [PATCH] cmd/button: return button status + +To make the button command useful in a shell script it should return the +status of the button: + +* 0 (true) - pressed, on +* 1 (false) - not pressed, off + +The button command takes only one argument. Correct maxargs. + +Adjust the Python unit test. + +Signed-off-by: Heinrich Schuchardt +Reviewed-by: Philippe Reynes +--- + cmd/button.c | 4 ++-- + test/py/tests/test_button.py | 34 ++++++++++++++++++++++++++-------- + 2 files changed, 28 insertions(+), 10 deletions(-) + +--- a/cmd/button.c ++++ b/cmd/button.c +@@ -75,11 +75,11 @@ int do_button(struct cmd_tbl *cmdtp, int + + ret = show_button_state(dev); + +- return 0; ++ return !ret; + } + + U_BOOT_CMD( +- button, 4, 1, do_button, ++ button, 2, 1, do_button, + "manage buttons", + " \tGet button state\n" + "button list\t\tShow a list of buttons" diff --git a/package/boot/uboot-mediatek/patches/007-env-readmem.patch b/package/boot/uboot-mediatek/patches/007-env-readmem.patch new file mode 100644 index 0000000000..a8c88a2757 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/007-env-readmem.patch @@ -0,0 +1,116 @@ +--- a/cmd/Kconfig ++++ b/cmd/Kconfig +@@ -571,6 +571,12 @@ config CMD_ENV_EXISTS + Check if a variable is defined in the environment for use in + shell scripting. + ++config CMD_ENV_READMEM ++ bool "env readmem" ++ default y ++ help ++ Store memory content into environment variable. ++ + config CMD_ENV_CALLBACK + bool "env callbacks - print callbacks and their associated variables" + help +--- a/cmd/nvedit.c ++++ b/cmd/nvedit.c +@@ -469,6 +469,60 @@ int do_env_ask(struct cmd_tbl *cmdtp, in + } + #endif + ++#if defined(CONFIG_CMD_ENV_READMEM) ++int do_env_readmem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ++{ ++ char varstr[CONFIG_SYS_CBSIZE]; ++ const void *buf; ++ char *local_args[4]; ++ ulong addr, bytes = 6; ++ int hexdump = 0; ++ ++ /* ++ * Check the syntax: ++ * ++ * readmem [-b] name address [size] ++ */ ++ if (argc < 3) ++ return CMD_RET_USAGE; ++ ++ local_args[0] = argv[0]; ++ ++ if (!strncmp(argv[1], "-b", 3)) ++ hexdump = 1; ++ ++ local_args[1] = argv[hexdump + 1]; ++ local_args[2] = varstr; ++ local_args[3] = NULL; ++ ++ addr = simple_strtoul(argv[hexdump + 2], NULL, 16); ++ ++ if (!hexdump) ++ bytes = simple_strtoul(argv[hexdump + 3], NULL, 16); ++ ++ if (bytes < 1) ++ return 1; ++ ++ if ((hexdump * 3) * bytes >= CONFIG_SYS_CBSIZE) ++ return 1; ++ ++ buf = map_sysmem(addr, bytes); ++ if (!buf) ++ return 1; ++ ++ if (hexdump) { ++ sprintf(varstr, "%pM", buf); ++ } else { ++ memcpy(varstr, buf, bytes); ++ varstr[bytes] = '\0'; ++ } ++ unmap_sysmem(buf); ++ ++ /* Continue calling setenv code */ ++ return _do_env_set(flag, 3, local_args, H_INTERACTIVE); ++} ++#endif ++ + #if defined(CONFIG_CMD_ENV_CALLBACK) + static int print_static_binding(const char *var_name, const char *callback_name, + void *priv) +@@ -1373,6 +1427,9 @@ static struct cmd_tbl cmd_env_sub[] = { + U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""), + #endif + U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""), ++#if defined(CONFIG_CMD_ENV_READMEM) ++ U_BOOT_CMD_MKENT(readmem, CONFIG_SYS_MAXARGS, 3, do_env_readmem, "", ""), ++#endif + #if defined(CONFIG_CMD_RUN) + U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""), + #endif +@@ -1461,6 +1518,9 @@ static char env_help_text[] = + #if defined(CONFIG_CMD_NVEDIT_EFI) + "env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n" + #endif ++#if defined(CONFIG_CMD_ENV_READMEM) ++ "env readmem [-b] name address size - read variable from memory\n" ++#endif + #if defined(CONFIG_CMD_RUN) + "env run var [...] - run commands in an environment variable\n" + #endif +@@ -1570,6 +1630,17 @@ U_BOOT_CMD( + ); + #endif + ++#if defined(CONFIG_CMD_ENV_READMEM) ++U_BOOT_CMD_COMPLETE( ++ readmem, CONFIG_SYS_MAXARGS, 3, do_env_readmem, ++ "get environment variable from memory address", ++ "name [-b] address size\n" ++ " - store memory address to env variable\n" ++ " \"-b\": read binary ethaddr", ++ var_complete ++); ++#endif ++ + #if defined(CONFIG_CMD_RUN) + U_BOOT_CMD_COMPLETE( + run, CONFIG_SYS_MAXARGS, 1, do_run, diff --git a/package/boot/uboot-mediatek/patches/008-bootmenu-custom-title.patch b/package/boot/uboot-mediatek/patches/008-bootmenu-custom-title.patch new file mode 100644 index 0000000000..32f26ece8e --- /dev/null +++ b/package/boot/uboot-mediatek/patches/008-bootmenu-custom-title.patch @@ -0,0 +1,32 @@ +--- a/cmd/bootmenu.c ++++ b/cmd/bootmenu.c +@@ -38,6 +38,7 @@ struct bootmenu_data { + int active; /* active menu entry */ + int count; /* total count of menu entries */ + struct bootmenu_entry *first; /* first menu entry */ ++ char *mtitle; /* custom menu title */ + }; + + enum bootmenu_key { +@@ -380,7 +381,12 @@ static void menu_display_statusline(stru + printf(ANSI_CURSOR_POSITION, 1, 1); + puts(ANSI_CLEAR_LINE); + printf(ANSI_CURSOR_POSITION, 2, 1); +- puts(" *** U-Boot Boot Menu ***"); ++ ++ if (menu->mtitle) ++ puts(menu->mtitle); ++ else ++ puts(" *** U-Boot Boot Menu ***"); ++ + puts(ANSI_CLEAR_LINE_TO_END); + printf(ANSI_CURSOR_POSITION, 3, 1); + puts(ANSI_CLEAR_LINE); +@@ -434,6 +440,7 @@ static void bootmenu_show(int delay) + return; + } + ++ bootmenu->mtitle = env_get("bootmenu_title"); + for (iter = bootmenu->first; iter; iter = iter->next) { + if (!menu_item_add(menu, iter->key, iter)) + goto cleanup; diff --git a/package/boot/uboot-mediatek/patches/009-mt7622-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/009-mt7622-generic-reset-button-ignore-env.patch new file mode 100644 index 0000000000..037bbb89ea --- /dev/null +++ b/package/boot/uboot-mediatek/patches/009-mt7622-generic-reset-button-ignore-env.patch @@ -0,0 +1,35 @@ +--- a/board/mediatek/mt7622/mt7622_rfb.c ++++ b/board/mediatek/mt7622/mt7622_rfb.c +@@ -6,9 +6,15 @@ + + #include + #include ++#include ++#include + #include + #include + ++#ifndef CONFIG_RESET_BUTTON_LABEL ++#define CONFIG_RESET_BUTTON_LABEL "reset" ++#endif ++ + DECLARE_GLOBAL_DATA_PTR; + + int board_init(void) +@@ -19,7 +25,15 @@ int board_init(void) + + int board_late_init(void) + { +- gd->env_valid = 1; //to load environment variable from persistent store ++ struct udevice *dev; ++ int ret; ++ ++ ret = !!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev); ++ ++ if (!ret) ++ ret = !button_get_state(dev); ++ ++ gd->env_valid = ret; //to load environment variable from persistent store + env_relocate(); + return 0; + } diff --git a/package/boot/uboot-mediatek/patches/010-no-binman.patch b/package/boot/uboot-mediatek/patches/010-no-binman.patch index a2680e56fd..7071a6c410 100644 --- a/package/boot/uboot-mediatek/patches/010-no-binman.patch +++ b/package/boot/uboot-mediatek/patches/010-no-binman.patch @@ -1,6 +1,6 @@ ---- a/Makefile 2020-10-13 13:39:06.471438591 +0800 -+++ b/Makefile 2020-10-13 13:39:39.190798462 +0800 -@@ -1725,6 +1725,10 @@ +--- a/Makefile ++++ b/Makefile +@@ -1716,6 +1716,10 @@ u-boot-elf.lds: arch/u-boot-elf.lds prep ifeq ($(CONFIG_SPL),y) spl/u-boot-spl-mtk.bin: spl/u-boot-spl diff --git a/package/boot/uboot-mediatek/patches/010-update-u7623-defconfig.patch b/package/boot/uboot-mediatek/patches/010-update-u7623-defconfig.patch index ec189f82dc..37d1b6a671 100644 --- a/package/boot/uboot-mediatek/patches/010-update-u7623-defconfig.patch +++ b/package/boot/uboot-mediatek/patches/010-update-u7623-defconfig.patch @@ -1,5 +1,3 @@ -diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig -index 6b9fbd7e22..fb2a004803 100644 --- a/configs/mt7623a_unielec_u7623_02_defconfig +++ b/configs/mt7623a_unielec_u7623_02_defconfig @@ -52,3 +52,12 @@ CONFIG_TIMER=y diff --git a/package/boot/uboot-mediatek/patches/020-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/020-add-linksys-e8450.patch new file mode 100644 index 0000000000..711c1e6983 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/020-add-linksys-e8450.patch @@ -0,0 +1,436 @@ +--- /dev/null ++++ b/configs/mt7622_linksys_e8450_defconfig +@@ -0,0 +1,130 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_SYS_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BOOTP_SEND_HOSTNAME=y ++CONFIG_DEFAULT_ENV_FILE="linksys_e8450_env" ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7622-linksys-e8450-ubi" ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_DEFAULT_FDT_FILE="mt7622-linksys-e8450" ++CONFIG_SYS_PROMPT="MT7622> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_FS_GENERIC=y ++CONFIG_CMD_FS_UUID=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_MBR=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_MTDPART=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++CONFIG_DM_USB=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_MTD=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PCI=y ++CONFIG_MTD=y ++CONFIG_MTD_RAW_NAND=y ++CONFIG_MTD_UBI_FASTMAP=y ++CONFIG_DM_PCI=y ++CONFIG_PCIE_MEDIATEK=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7622=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++CONFIG_DM_SPI=y ++CONFIG_MTK_SNFI_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_NAND_SUPPORT=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_TIMER=y ++CONFIG_MTK_TIMER=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++CONFIG_USB=y ++CONFIG_USB_HOST=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y +--- /dev/null ++++ b/arch/arm/dts/mt7622-linksys-e8450-ubi.dts +@@ -0,0 +1,206 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2019 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7622.dtsi" ++#include "mt7622-u-boot.dtsi" ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "mt7622-linksys-e8450-ubi"; ++ compatible = "mediatek,mt7622", "linksys,e8450-ubi"; ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ aliases { ++ spi0 = &snfi; ++ }; ++ ++ gpio-keys { ++ compatible = "gpio-keys"; ++ ++ factory { ++ label = "reset"; ++ gpios = <&gpio 0 GPIO_ACTIVE_LOW>; ++ }; ++ ++ wps { ++ label = "wps"; ++ gpios = <&gpio 102 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ led_power: power_blue { ++ label = "power:blue"; ++ gpios = <&gpio 95 GPIO_ACTIVE_LOW>; ++ default-state = "on"; ++ }; ++ ++ power_orange { ++ label = "power:orange"; ++ gpios = <&gpio 96 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ ++ inet_blue { ++ label = "inet:blue"; ++ gpios = <&gpio 97 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ ++ inet_orange { ++ label = "inet:orange"; ++ gpios = <&gpio 98 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x20000000>; ++ }; ++ ++ reg_1p8v: regulator-1p8v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-1.8V"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ reg_5v: regulator-5v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-5V"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++}; ++ ++&pcie { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie0_pins>, <&pcie1_pins>; ++ status = "okay"; ++ ++ pcie@0,0 { ++ status = "okay"; ++ }; ++ ++ pcie@1,0 { ++ status = "okay"; ++ }; ++}; ++ ++&pinctrl { ++ pcie0_pins: pcie0-pins { ++ mux { ++ function = "pcie"; ++ groups = "pcie0_pad_perst", ++ "pcie0_1_waken", ++ "pcie0_1_clkreq"; ++ }; ++ }; ++ ++ pcie1_pins: pcie1-pins { ++ mux { ++ function = "pcie"; ++ groups = "pcie1_pad_perst", ++ "pcie1_0_waken", ++ "pcie1_0_clkreq"; ++ }; ++ }; ++ ++ snfi_pins: snfi-pins { ++ mux { ++ function = "flash"; ++ groups = "snfi"; ++ }; ++ }; ++ ++ uart0_pins: uart0 { ++ mux { ++ function = "uart"; ++ groups = "uart0_0_tx_rx" ; ++ }; ++ }; ++ ++ watchdog_pins: watchdog-default { ++ mux { ++ function = "watchdog"; ++ groups = "watchdog"; ++ }; ++ }; ++}; ++ ++&snfi { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&snfi_pins>; ++ status = "okay"; ++ ++ mediatek,bmt-v2; ++ ++ spi-flash@0{ ++ compatible = "jedec,spi-nor"; ++ reg = <0>; ++ u-boot,dm-pre-reloc; ++ }; ++}; ++ ++&nandc { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins>; ++ status = "okay"; ++}; ++ ++&watchdog { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&watchdog_pins>; ++ status = "okay"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "sgmii"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++}; ++ ++&ssusb { ++ vusb33-supply = <®_3p3v>; ++ vbus-supply = <®_5v>; ++ status = "okay"; ++}; ++ ++&u3phy { ++ status = "okay"; ++}; +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -963,6 +963,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ + mt7622-rfb.dtb \ + mt7623a-unielec-u7623-02-emmc.dtb \ + mt7622-bananapi-bpi-r64.dtb \ ++ mt7622-linksys-e8450-ubi.dtb \ + mt7623n-bananapi-bpi-r2.dtb \ + mt7629-rfb.dtb \ + mt8512-bm1-emmc.dtb \ +--- a/drivers/mtd/nandx/core/nand/device_spi.c ++++ b/drivers/mtd/nandx/core/nand/device_spi.c +@@ -150,6 +150,21 @@ static struct device_spi spi_nand[] = { + &spi_extend_cmds, 0xff, 0xff + }, + { ++ NAND_DEVICE("FM35X1GA", ++ NAND_PACK_ID(0xe5, 0x71, 0, 0, 0, 0, 0, 0), ++ 2, 0, 3, 3, ++ 1, 1, 1, 1024, KB(128), KB(2), 64, 1, ++ &spi_cmds, &spi_addressing, &spi_status[0], ++ &spi_endurance, &spi_array_timing), ++ { ++ NAND_SPI_PROTECT(0xa0, 1, 2, 6), ++ NAND_SPI_CONFIG(0xb0, 4, 6, 1), ++ NAND_SPI_STATUS(0xc0, 4, 5), ++ NAND_SPI_CHARACTER(0xff, 0xff, 0xff, 0xff) ++ }, ++ &spi_extend_cmds, 0xff, 0xff ++ }, ++ { + NAND_DEVICE("NO-DEVICE", + NAND_PACK_ID(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, +--- /dev/null ++++ b/linksys_e8450_env +@@ -0,0 +1,57 @@ ++mtdparts=nand0:512k(bl2),1280k(fip),1024k(factory),256k(reserved),-(ubi) ++ethaddr_factory=nand read 0x40080000 0x220000 0x20000 && env readmem -b ethaddr 0x4009fff4 0x6 ; setenv ethaddr_factory ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x4007ff28 ++bootcmd=run boot_ubi ++bootdelay=0 ++bootfile=openwrt-mediatek-mt7622-linksys_e8450-ubi-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-mt7622-linksys_e8450-ubi-preloader.bin ++bootfile_fip=openwrt-mediatek-mt7622-linksys_e8450-ubi-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-mt7622-linksys_e8450-ubi-squashfs-sysupgrade.itb ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=0. Initialize environment.=run _firstboot ++bootmenu_0d=0. Run default boot command.=run boot_default ++bootmenu_1=1. Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_3=2. Boot production system from flash.=run boot_production ; run bootmenu_confirm_return ++bootmenu_2=3. Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_5=4. Load production system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_4=5. Load recovery system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return ++bootmenu_6=6. Load BL31+U-Boot FIP via TFTP then write to flash.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=7. Load BL2 preloader via TFTP then write to flash.=run boot_tftp_write_preloader ; run bootmenu_confirm_return ++bootmenu_8=8. Reboot.=reset ++bootmenu_9=9. Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; run boot_tftp_forever ++boot_production=led power:blue on ; run ubi_read_production && bootm $loadaddr ++boot_production_or_recovery=run boot_production ; run boot_recovery ++boot_recovery=led power:blue off ; led power:orange on ; run check_recovery ++boot_serial_write_fip=loadx $loadaddr 115200 && run boot_write_fip ++boot_serial_write_preloader=loadx $loadaddr 115200 && run boot_write_preloader ++boot_tftp_forever=led inet:blue on ; while true ; do run boot_tftp_recovery ; led inet:blue off ; led inet:orange on ; sleep 1 ; done ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && ubi part ubi && run ubi_write_production ubi_prepare_rootfs ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip ++boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader ++boot_ubi=ubi part ubi && run boot_production_or_recovery ++boot_write_fip=nand erase 0x80000 0x140000 && nand write $loadaddr 0x80000 0x140000 ++boot_write_preloader=nand erase 0x0 0x80000 && nand write $loadaddr 0x0 0x20000 && nand write $loadaddr 0x20000 0x20000 && nand write $loadaddr 0x40000 0x20000 && nand write $loadaddr 0x60000 0x20000 ++check_recovery=run ubi_read_recovery ; if iminfo $loadaddr ; then bootm $loadaddr ; else ubi remove recovery ; fi ++check_ubi=ubi part ubi || run ubi_format ++reset_factory=ubi part ubi ; ubi write 0x0 ubootenv 0x0 ; ubi write 0x0 ubootenv2 0x0 ; ubi remove rootfs_data ++ubi_format=ubi detach ; nand erase 0x300000 0x7D00000 && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=run ubi_remove_rootfs ; ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ++ubi_write_recovery=run ubi_remove_rootfs ; ubi check recovery && ubi remove recovery; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_create_env=ubi create ubootenv 0x100000 dynamic ; ubi create ubootenv2 0x100000 dynamic ++_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; saveenv || run ubi_format ; saveenv || run ubi_format ++_firstboot=setenv _firstboot ; led power:orange on ; run _switch_to_menu ; run ethaddr_factory ; run check_ubi ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/package/boot/uboot-mediatek/patches/100-increase-CONFIG_SYS_BOOTM_LEN.patch b/package/boot/uboot-mediatek/patches/100-increase-CONFIG_SYS_BOOTM_LEN.patch new file mode 100644 index 0000000000..811e8489dd --- /dev/null +++ b/package/boot/uboot-mediatek/patches/100-increase-CONFIG_SYS_BOOTM_LEN.patch @@ -0,0 +1,11 @@ +--- a/include/configs/mt7622.h ++++ b/include/configs/mt7622.h +@@ -37,7 +37,7 @@ + #endif + + #define CONFIG_SYS_MAXARGS 8 +-#define CONFIG_SYS_BOOTM_LEN SZ_64M ++#define CONFIG_SYS_BOOTM_LEN SZ_128M + #define CONFIG_SYS_CBSIZE SZ_1K + #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16)