Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
858
package/boot/uboot-mediatek/Makefile
Normal file
858
package/boot/uboot-mediatek/Makefile
Normal file
@@ -0,0 +1,858 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2024.07
|
||||
PKG_HASH:=f591da9ab90ef3d6b3d173766d0ddff90c4ed7330680897486117df390d83c8f
|
||||
PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host
|
||||
|
||||
UBOOT_USE_INTREE_DTC:=1
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
MT7621_LOWLEVEL_PRELOADER_URL:=https://raw.githubusercontent.com/mtk-openwrt/mt7621-lowlevel-preloader/a03b07c60bf1ba4add9b671d32caa102fe948180/
|
||||
|
||||
define Download/mt7621-stage-sram
|
||||
FILE:=mt7621_stage_sram.bin
|
||||
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
|
||||
HASH:=1dda68aa089f0ff262e01539b990dea478952e9fb68bcc0a8cd6f76f0135c62e
|
||||
endef
|
||||
|
||||
define Download/mt7621-stage-sram-noprint
|
||||
FILE:=mt7621_stage_sram_noprint.bin
|
||||
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
|
||||
HASH:=8ee419275144fc298e9444d413d98e965a55d283152a74ea6a1f8de79eb516b6
|
||||
endef
|
||||
|
||||
ifdef CONFIG_TARGET_ramips_mt7621
|
||||
ifdef CONFIG_DEBUG
|
||||
$(eval $(call Download,mt7621-stage-sram))
|
||||
else
|
||||
$(eval $(call Download,mt7621-stage-sram-noprint))
|
||||
endif
|
||||
endif
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=mediatek
|
||||
UBOOT_IMAGE:=u-boot-mtk.bin
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7620_rfb
|
||||
NAME:=MT7620 Reference Board
|
||||
UBOOT_CONFIG:=mt7620_rfb
|
||||
BUILD_DEVICES:=ralink_mt7620a-evb
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7620
|
||||
UBOOT_IMAGE:=u-boot-with-spl.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7620_mt7530_rfb
|
||||
NAME:=MT7620+MT7530 Reference Board
|
||||
UBOOT_CONFIG:=mt7620_mt7530_rfb
|
||||
BUILD_DEVICES:=ralink_mt7620a-mt7530-evb
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7620
|
||||
UBOOT_IMAGE:=u-boot-with-spl.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7621_rfb
|
||||
NAME:=MT7621 Reference Board
|
||||
UBOOT_CONFIG:=mt7621_rfb
|
||||
BUILD_DEVICES:=mediatek_mt7621-eval-board
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7621
|
||||
UBOOT_IMAGE:=u-boot-mt7621.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7621_nand_rfb
|
||||
NAME:=MT7621 Reference Board (NAND)
|
||||
UBOOT_CONFIG:=mt7621_nand_rfb
|
||||
BUILD_DEVICES:=mediatek_mt7621-eval-board
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7621
|
||||
UBOOT_IMAGE:=u-boot-mt7621.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7621_zbtlink_zbt-wg3526-16m
|
||||
NAME:=Zbtlink ZBT-WG3526-16m
|
||||
UBOOT_CONFIG:=mt7621_zbtlink_zbt-wg3526-16m
|
||||
BUILD_DEVICES:=zbtlink_zbt-wg3526-16m
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt7621
|
||||
UBOOT_IMAGE:=u-boot-mt7621.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_rfb1
|
||||
NAME:=MT7622 Reference Board 1
|
||||
UBOOT_CONFIG:=mt7622_rfb
|
||||
BUILD_DEVICES:=mediatek_mt7622-rfb1 mediatek_mt7622-rfb1-ubi
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_linksys_e8450
|
||||
NAME:=Linksys E8450
|
||||
UBOOT_CONFIG:=mt7622_linksys_e8450
|
||||
BUILD_DEVICES:=linksys_e8450-ubi
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=snand-ubi
|
||||
BL2_DDRBLOB:=1
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-snand-ubi-1ddr
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_bananapi_bpi-r64-emmc
|
||||
NAME:=BananaPi R64 (eMMC)
|
||||
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-emmc
|
||||
BUILD_DEVICES:=bananapi_bpi-r64
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-emmc-2ddr
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_bananapi_bpi-r64-sdmmc
|
||||
NAME:=BananaPi R64 (SDMMC)
|
||||
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-sdmmc
|
||||
BUILD_DEVICES:=bananapi_bpi-r64
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-sdmmc-2ddr
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_bananapi_bpi-r64-snand
|
||||
NAME:=BananaPi R64 (SNAND)
|
||||
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-snand
|
||||
BUILD_DEVICES:=bananapi_bpi-r64
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=snand-ubi
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-snand-ubi-2ddr
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_ubnt_unifi-6-lr-v1
|
||||
NAME:=Ubiquiti UniFi 6 LR
|
||||
UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr-v1
|
||||
BUILD_DEVICES:=ubnt_unifi-6-lr-v1-ubootmod
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_ubnt_unifi-6-lr-v2
|
||||
NAME:=Ubiquiti UniFi 6 LR v2
|
||||
UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr-v2
|
||||
BUILD_DEVICES:=ubnt_unifi-6-lr-v2-ubootmod
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_ubnt_unifi-6-lr-v3
|
||||
NAME:=Ubiquiti UniFi 6 LR v3
|
||||
UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr-v3
|
||||
BUILD_DEVICES:=ubnt_unifi-6-lr-v3-ubootmod
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_DDRBLOB:=2
|
||||
DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7622_xiaomi_redmi-router-ax6s-ubi-loader
|
||||
NAME:=Xiaomi Redmi Router AX6S (as UBI loader)
|
||||
UBOOT_CONFIG:=mt7622_xiaomi_redmi-router-ax6s-ubi-loader
|
||||
BUILD_DEVICES:=xiaomi_redmi-router-ax6s
|
||||
BUILD_SUBTARGET:=mt7622
|
||||
UBOOT_IMAGE:=u-boot.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7623a_unielec_u7623
|
||||
NAME:=UniElec U7623 (mt7623)
|
||||
BUILD_DEVICES:=unielec_u7623-02
|
||||
BUILD_SUBTARGET:=mt7623
|
||||
UBOOT_CONFIG:=mt7623a_unielec_u7623_02
|
||||
endef
|
||||
|
||||
define U-Boot/mt7623n_bpir2
|
||||
NAME:=Banana Pi R2 (mt7623)
|
||||
BUILD_DEVICES:=bananapi_bpi-r2
|
||||
BUILD_SUBTARGET:=mt7623
|
||||
UBOOT_IMAGE:=u-boot.bin
|
||||
UBOOT_CONFIG:=mt7623n_bpir2
|
||||
endef
|
||||
|
||||
define U-Boot/mt7628_rfb
|
||||
NAME:=MT7628 Reference Board
|
||||
BUILD_DEVICES:=mediatek_mt7628an-eval-board
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_SUBTARGET:=mt76x8
|
||||
UBOOT_CONFIG:=mt7628_rfb
|
||||
UBOOT_IMAGE:=u-boot-with-spl.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7628_ravpower_rp-wd009
|
||||
NAME:=RAVPower RP-WD009
|
||||
BUILD_TARGET:=ramips
|
||||
BUILD_DEVICES:=ravpower_rp-wd009
|
||||
BUILD_SUBTARGET:=mt76x8
|
||||
UBOOT_CONFIG:=ravpower-rp-wd009-ram
|
||||
UBOOT_IMAGE:=u-boot.bin
|
||||
endef
|
||||
|
||||
define U-Boot/mt7629_rfb
|
||||
NAME:=MT7629 Reference Board
|
||||
BUILD_SUBTARGET:=mt7629
|
||||
BUILD_DEVICES:=mediatek_mt7629-rfb
|
||||
UBOOT_CONFIG:=mt7629_rfb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_abt_asr3000
|
||||
NAME:=ABT ASR3000
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=abt_asr3000
|
||||
UBOOT_CONFIG:=mt7981_abt_asr3000
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_rax3000m-emmc
|
||||
NAME:=CMCC RAX3000M
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=cmcc_rax3000m
|
||||
UBOOT_CONFIG:=mt7981_cmcc_rax3000m-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_cmcc_rax3000m-nand
|
||||
NAME:=CMCC RAX3000M
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=cmcc_rax3000m
|
||||
UBOOT_CONFIG:=mt7981_cmcc_rax3000m-nand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_h3c_magic-nx30-pro
|
||||
NAME:=H3C Magic NX30 Pro
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=h3c_magic-nx30-pro
|
||||
UBOOT_CONFIG:=mt7981_h3c_magic-nx30-pro
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_jcg_q30-pro
|
||||
NAME:=JCG Q30 PRO
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=jcg_q30-pro
|
||||
UBOOT_CONFIG:=mt7981_jcg_q30-pro
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_nokia_ea0326gmp
|
||||
NAME:=Nokia EA0326GMP
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=nokia_ea0326gmp
|
||||
UBOOT_CONFIG:=mt7981_nokia_ea0326gmp
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_openwrt_one-snand
|
||||
NAME:=OpenWrt One NAND
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=openwrt_one
|
||||
UBOOT_CONFIG:=mt7981_openwrt-one-spi-nand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ubi-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_openwrt_one-nor
|
||||
NAME:=OpenWrt One NOR
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=openwrt_one
|
||||
UBOOT_CONFIG:=mt7981_openwrt-one-nor
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr4
|
||||
FIP_COMPRESS:=1
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-spim-nand
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-emmc
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_emmc_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-nor
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_nor_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-nor-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-sd
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_sd_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-sdmmc-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_rfb-snfi
|
||||
NAME:=MT7981 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7981-rfb
|
||||
UBOOT_CONFIG:=mt7981_snfi_nand_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=snand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-snand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_qihoo_360t7
|
||||
NAME:=Qihoo 360T7
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=qihoo_360t7
|
||||
UBOOT_CONFIG:=mt7981_qihoo-360t7
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_xiaomi_mi-router-ax3000t
|
||||
NAME:=Xiaomi Router AX3000T
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=xiaomi_mi-router-ax3000t-ubootmod
|
||||
UBOOT_CONFIG:=mt7981_xiaomi_mi-router-ax3000t
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7981_xiaomi_mi-router-wr30u
|
||||
NAME:=Xiaomi Router WR30U
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=xiaomi_mi-router-wr30u-ubootmod
|
||||
UBOOT_CONFIG:=mt7981_xiaomi_mi-router-wr30u
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7981
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_rfb
|
||||
NAME:=MT7986 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7986-rfb
|
||||
UBOOT_CONFIG:=mt7986_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-emmc
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-sdmmc
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-sd
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-snand
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ubi-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-nor
|
||||
NAME:=BananaPi BPi-R3
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-nor
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-nor-ddr4
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-mini-emmc
|
||||
NAME:=BananaPi BPi-R3 Mini
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3-mini
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-mini-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_bananapi_bpi-r3-mini-snand
|
||||
NAME:=BananaPi BPi-R3 Mini
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r3-mini
|
||||
UBOOT_CONFIG:=mt7986a_bpi-r3-mini-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ubi-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_glinet_gl-mt6000
|
||||
NAME:=GL.iNet GL-MT6000
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=glinet_gl-mt6000
|
||||
UBOOT_CONFIG:=mt7986a_glinet_gl-mt6000
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_jdcloud_re-cp-03
|
||||
NAME:=JDCloud RE-CP-03
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=jdcloud_re-cp-03
|
||||
UBOOT_CONFIG:=mt7986a_jdcloud_re-cp-03
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_netcore_n60
|
||||
NAME:=Netcore N60
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=netcore_n60
|
||||
UBOOT_CONFIG:=mt7986_netcore_n60
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_tplink_tl-xdr4288
|
||||
NAME:=TP-LINK TL-XDR4288
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=tplink_tl-xdr4288
|
||||
UBOOT_CONFIG:=mt7986_tplink_tl-xdr4288
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_tplink_tl-xdr6086
|
||||
NAME:=TP-LINK TL-XDR6086
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=tplink_tl-xdr6086
|
||||
UBOOT_CONFIG:=mt7986_tplink_tl-xdr6086
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_tplink_tl-xdr6088
|
||||
NAME:=TP-LINK TL-XDR6088
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=tplink_tl-xdr6088
|
||||
UBOOT_CONFIG:=mt7986_tplink_tl-xdr6088
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr3
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr3
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_tplink_tl-xtr8488
|
||||
NAME:=TP-LINK TL-XTR8488
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=tplink_tl-xtr8488
|
||||
UBOOT_CONFIG:=mt7986_tplink_tl-xtr8488
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_xiaomi_redmi-router-ax6000
|
||||
NAME:=Xiaomi Redmi AX6000
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=xiaomi_redmi-router-ax6000-ubootmod
|
||||
UBOOT_CONFIG:=mt7986_xiaomi_redmi-ax6000
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7986_zyxel_ex5601-t0
|
||||
NAME:=Zyxel EX5601-T0
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=zyxel_ex5601-t0-ubootmod
|
||||
UBOOT_CONFIG:=mt7986_zyxel_ex5601-t0
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-4k
|
||||
BL2_SOC:=mt7986
|
||||
BL2_DDRTYPE:=ddr4
|
||||
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-4k-ddr4
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-emmc
|
||||
NAME:=BananaPi BPi-R4
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-sdmmc
|
||||
NAME:=BananaPi BPi-R4
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-sdmmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-snand
|
||||
NAME:=BananaPi BPi-R4
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-poe-emmc
|
||||
NAME:=BananaPi BPi-R4 2.5GE
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-poe
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-poe-emmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-poe-sdmmc
|
||||
NAME:=BananaPi BPi-R4 2.5GE
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-poe
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-poe-sdmmc
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_bananapi_bpi-r4-poe-snand
|
||||
NAME:=BananaPi BPi-R4 2.5GE
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=bananapi_bpi-r4-poe
|
||||
UBOOT_CONFIG:=mt7988a_bananapi_bpi-r4-poe-snand
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand-ubi
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-ubi-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-spim-nand
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=spim-nand
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-spim-nand-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-snand
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=snand
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-snand-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-nor
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=nor
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-nor-comb
|
||||
FIP_COMPRESS:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-emmc
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=emmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-emmc-comb
|
||||
endef
|
||||
|
||||
define U-Boot/mt7988_rfb-sd
|
||||
NAME:=MT7988 Reference Board
|
||||
BUILD_SUBTARGET:=filogic
|
||||
BUILD_DEVICES:=mediatek_mt7988a-rfb
|
||||
UBOOT_CONFIG:=mt7988_sd_rfb
|
||||
UBOOT_IMAGE:=u-boot.fip
|
||||
BL2_BOOTDEV:=sdmmc
|
||||
BL2_SOC:=mt7988
|
||||
BL2_DDRTYPE:=comb
|
||||
DEPENDS:=+trusted-firmware-a-mt7988-sdmmc-comb
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
mt7620_mt7530_rfb \
|
||||
mt7620_rfb \
|
||||
mt7621_nand_rfb \
|
||||
mt7621_rfb \
|
||||
mt7621_zbtlink_zbt-wg3526-16m \
|
||||
mt7622_bananapi_bpi-r64-emmc \
|
||||
mt7622_bananapi_bpi-r64-sdmmc \
|
||||
mt7622_bananapi_bpi-r64-snand \
|
||||
mt7622_linksys_e8450 \
|
||||
mt7622_rfb1 \
|
||||
mt7622_ubnt_unifi-6-lr-v1 \
|
||||
mt7622_ubnt_unifi-6-lr-v2 \
|
||||
mt7622_ubnt_unifi-6-lr-v3 \
|
||||
mt7622_xiaomi_redmi-router-ax6s-ubi-loader \
|
||||
mt7623n_bpir2 \
|
||||
mt7623a_unielec_u7623 \
|
||||
mt7628_rfb \
|
||||
mt7628_ravpower_rp-wd009 \
|
||||
mt7629_rfb \
|
||||
mt7981_abt_asr3000 \
|
||||
mt7981_cmcc_rax3000m-emmc \
|
||||
mt7981_cmcc_rax3000m-nand \
|
||||
mt7981_h3c_magic-nx30-pro \
|
||||
mt7981_jcg_q30-pro \
|
||||
mt7981_nokia_ea0326gmp \
|
||||
mt7981_openwrt_one-snand \
|
||||
mt7981_openwrt_one-nor \
|
||||
mt7981_rfb-spim-nand \
|
||||
mt7981_rfb-emmc \
|
||||
mt7981_rfb-nor \
|
||||
mt7981_rfb-sd \
|
||||
mt7981_rfb-snfi \
|
||||
mt7981_qihoo_360t7 \
|
||||
mt7981_xiaomi_mi-router-ax3000t \
|
||||
mt7981_xiaomi_mi-router-wr30u \
|
||||
mt7986_bananapi_bpi-r3-emmc \
|
||||
mt7986_bananapi_bpi-r3-sdmmc \
|
||||
mt7986_bananapi_bpi-r3-snand \
|
||||
mt7986_bananapi_bpi-r3-nor \
|
||||
mt7986_bananapi_bpi-r3-mini-emmc \
|
||||
mt7986_bananapi_bpi-r3-mini-snand \
|
||||
mt7986_glinet_gl-mt6000 \
|
||||
mt7986_jdcloud_re-cp-03 \
|
||||
mt7986_netcore_n60 \
|
||||
mt7986_tplink_tl-xdr4288 \
|
||||
mt7986_tplink_tl-xdr6086 \
|
||||
mt7986_tplink_tl-xdr6088 \
|
||||
mt7986_tplink_tl-xtr8488 \
|
||||
mt7986_xiaomi_redmi-router-ax6000 \
|
||||
mt7986_zyxel_ex5601-t0 \
|
||||
mt7986_rfb \
|
||||
mt7988_bananapi_bpi-r4-emmc \
|
||||
mt7988_bananapi_bpi-r4-sdmmc \
|
||||
mt7988_bananapi_bpi-r4-snand \
|
||||
mt7988_bananapi_bpi-r4-poe-emmc \
|
||||
mt7988_bananapi_bpi-r4-poe-sdmmc \
|
||||
mt7988_bananapi_bpi-r4-poe-snand \
|
||||
mt7988_rfb-spim-nand \
|
||||
mt7988_rfb-snand \
|
||||
mt7988_rfb-nor \
|
||||
mt7988_rfb-emmc \
|
||||
mt7988_rfb-sd
|
||||
|
||||
UBOOT_CUSTOMIZE_CONFIG := \
|
||||
--disable TOOLS_KWBIMAGE \
|
||||
--disable TOOLS_LIBCRYPTO
|
||||
|
||||
ifdef CONFIG_TARGET_mediatek
|
||||
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin)
|
||||
endif
|
||||
|
||||
define Build/fip-image
|
||||
$(if $(FIP_COMPRESS),\
|
||||
xz -f -e -k -9 -C crc32 $(STAGING_DIR_IMAGE)/$(if $(BL2_SOC),$(BL2_SOC),$(BUILD_SUBTARGET))-$(BL2_BOOTDEV)-$(if $(BL2_DDRTYPE),$(BL2_DDRTYPE)-)$(if $(BL2_DDRBLOB),$(BL2_DDRBLOB)ddr-)bl31.bin ;\
|
||||
xz -f -e -k -9 -C crc32 $(PKG_BUILD_DIR)/u-boot.bin \
|
||||
)
|
||||
$(STAGING_DIR_HOST)/bin/fiptool create \
|
||||
--soc-fw $(STAGING_DIR_IMAGE)/$(if $(BL2_SOC),$(BL2_SOC),$(BUILD_SUBTARGET))-$(BL2_BOOTDEV)-$(if $(BL2_DDRTYPE),$(BL2_DDRTYPE)-)$(if $(BL2_DDRBLOB),$(BL2_DDRBLOB)ddr-)bl31.bin$(if $(FIP_COMPRESS),.xz) \
|
||||
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(FIP_COMPRESS),.xz) \
|
||||
$(PKG_BUILD_DIR)/u-boot.fip
|
||||
endef
|
||||
|
||||
ifdef CONFIG_TARGET_ramips_mt7621
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
ifdef CONFIG_DEBUG
|
||||
$(CP) $(DL_DIR)/mt7621_stage_sram.bin $(PKG_BUILD_DIR)/
|
||||
else
|
||||
$(CP) $(DL_DIR)/mt7621_stage_sram_noprint.bin $(PKG_BUILD_DIR)/mt7621_stage_sram.bin
|
||||
endif
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/U-Boot)
|
||||
sed -i 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config
|
||||
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
|
||||
ifdef CONFIG_TARGET_mediatek
|
||||
define Package/u-boot/install
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
||||
@@ -0,0 +1,33 @@
|
||||
From 93d7086edb0db4b05149dfea21a2a82d8f160944 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Sat, 6 Mar 2021 16:29:33 +0800
|
||||
Subject: [PATCH 10/12] configs: mt7622: enable environment for mt7622_rfb
|
||||
|
||||
Enable environment vairables for mt7622_rfb
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -6,6 +6,8 @@ CONFIG_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7622-rfb"
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x280000
|
||||
CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x4007ff28
|
||||
@@ -25,6 +27,9 @@ CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="spi-nand0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_USE_IPADDR=y
|
||||
@@ -0,0 +1,33 @@
|
||||
--- a/arch/arm/dts/mt7622.dtsi
|
||||
+++ b/arch/arm/dts/mt7622.dtsi
|
||||
@@ -37,6 +37,30 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-1.0";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
+ secmon_reserved: secmon@43000000 {
|
||||
+ reg = <0 0x43000000 0 0x30000>;
|
||||
+ no-map;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
snfi: snfi@1100d000 {
|
||||
compatible = "mediatek,mtk-snfi-spi";
|
||||
reg = <0x1100d000 0x2000>;
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/arch/arm/dts/mt7986.dtsi
|
||||
+++ b/arch/arm/dts/mt7986.dtsi
|
||||
@@ -50,6 +50,35 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-0.2";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
+ secmon_reserved: secmon@43000000 {
|
||||
+ reg = <0 0x43000000 0 0x30000>;
|
||||
+ no-map;
|
||||
+ };
|
||||
+
|
||||
+ wmcpu_emi: wmcpu-reserved@4fc00000 {
|
||||
+ no-map;
|
||||
+ reg = <0 0x4fc00000 0 0x00100000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
dummy_clk: dummy12m {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <12000000>;
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/arch/arm/dts/mt7981.dtsi
|
||||
+++ b/arch/arm/dts/mt7981.dtsi
|
||||
@@ -32,6 +32,35 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-0.2";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
|
||||
+ secmon_reserved: secmon@43000000 {
|
||||
+ reg = <0 0x43000000 0 0x30000>;
|
||||
+ no-map;
|
||||
+ };
|
||||
+
|
||||
+ wmcpu_emi: wmcpu-reserved@4fc00000 {
|
||||
+ no-map;
|
||||
+ reg = <0 0x4fc00000 0 0x00100000>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
gpt_clk: gpt_dummy20m {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <13000000>;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,175 @@
|
||||
From a347e374cb338213632c6dde88dd226d64bd8b27 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 08:57:29 +0800
|
||||
Subject: [PATCH 37/71] mtd: mtk-snand: add support for SPL
|
||||
|
||||
Add support to initialize SPI-NAND in SPL.
|
||||
Add implementation for SPL NAND loader.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/mtk-snand/Kconfig | 6 ++
|
||||
drivers/mtd/mtk-snand/Makefile | 4 +
|
||||
drivers/mtd/mtk-snand/mtk-snand-spl.c | 133 ++++++++++++++++++++++++++
|
||||
3 files changed, 143 insertions(+)
|
||||
create mode 100644 drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
|
||||
--- a/drivers/mtd/mtk-snand/Kconfig
|
||||
+++ b/drivers/mtd/mtk-snand/Kconfig
|
||||
@@ -19,3 +19,9 @@ config MTK_SPI_NAND_MTD
|
||||
help
|
||||
This option enables access to SPI-NAND flashes through the
|
||||
MTD interface of MediaTek SPI NAND Flash Controller
|
||||
+
|
||||
+config SPL_MTK_SPI_NAND
|
||||
+ tristate "SPL support for MediaTek SPI NAND flash controller"
|
||||
+ depends on MTK_SPI_NAND
|
||||
+ help
|
||||
+ This option enables access to SPI-NAND flashes in the SPL stage
|
||||
--- a/drivers/mtd/mtk-snand/Makefile
|
||||
+++ b/drivers/mtd/mtk-snand/Makefile
|
||||
@@ -8,4 +8,8 @@
|
||||
obj-y += mtk-snand.o mtk-snand-ecc.o mtk-snand-ids.o mtk-snand-os.o
|
||||
obj-$(CONFIG_MTK_SPI_NAND_MTD) += mtk-snand-mtd.o
|
||||
|
||||
+ifdef CONFIG_SPL_BUILD
|
||||
+obj-$(CONFIG_SPL_MTK_SPI_NAND) += mtk-snand-spl.o
|
||||
+endif
|
||||
+
|
||||
ccflags-y += -DPRIVATE_MTK_SNAND_HEADER
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
@@ -0,0 +1,133 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/uclass.h>
|
||||
+#include <malloc.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <mtd.h>
|
||||
+#include <watchdog.h>
|
||||
+
|
||||
+#include "mtk-snand.h"
|
||||
+
|
||||
+static struct mtk_snand *snf;
|
||||
+static struct mtk_snand_chip_info cinfo;
|
||||
+static u32 oobavail;
|
||||
+
|
||||
+static u8 *page_cache;
|
||||
+
|
||||
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
|
||||
+{
|
||||
+ u32 sizeremain = size, chunksize, leading;
|
||||
+ uint32_t off = offs, writesize_mask = cinfo.pagesize - 1;
|
||||
+ uint8_t *ptr = dst;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!snf)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ while (sizeremain) {
|
||||
+ schedule();
|
||||
+
|
||||
+ leading = off & writesize_mask;
|
||||
+ chunksize = cinfo.pagesize - leading;
|
||||
+ if (chunksize > sizeremain)
|
||||
+ chunksize = sizeremain;
|
||||
+
|
||||
+ if (chunksize == cinfo.pagesize) {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading, ptr,
|
||||
+ NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+ } else {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading,
|
||||
+ page_cache, NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+
|
||||
+ memcpy(ptr, page_cache + leading, chunksize);
|
||||
+ }
|
||||
+
|
||||
+ off += chunksize;
|
||||
+ ptr += chunksize;
|
||||
+ sizeremain -= chunksize;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void nand_init(void)
|
||||
+{
|
||||
+ struct mtk_snand_platdata mtk_snand_pdata = {};
|
||||
+ struct udevice *dev;
|
||||
+ fdt_addr_t base;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = uclass_get_device_by_driver(UCLASS_MTD, DM_DRIVER_GET(mtk_snand),
|
||||
+ &dev);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: Device instance not found!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "nfi");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: NFI base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.nfi_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "ecc");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: ECC base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.ecc_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ mtk_snand_pdata.soc = dev_get_driver_data(dev);
|
||||
+ mtk_snand_pdata.quad_spi = dev_read_bool(dev, "quad-spi");
|
||||
+
|
||||
+ ret = mtk_snand_init(NULL, &mtk_snand_pdata, &snf);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: failed to initialize SPI-NAND\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mtk_snand_get_chip_info(snf, &cinfo);
|
||||
+
|
||||
+ oobavail = cinfo.num_sectors * (cinfo.fdm_size - 1);
|
||||
+
|
||||
+ printf("SPI-NAND: %s (%uMB)\n", cinfo.model,
|
||||
+ (u32)(cinfo.chipsize >> 20));
|
||||
+
|
||||
+ page_cache = malloc(cinfo.pagesize + cinfo.sparesize);
|
||||
+ if (!page_cache) {
|
||||
+ mtk_snand_cleanup(snf);
|
||||
+ printf("mtk-snand-spl: failed to allocate page cache\n");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void nand_deselect(void)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id mtk_snand_ids[] = {
|
||||
+ { .compatible = "mediatek,mt7622-snand", .data = SNAND_SOC_MT7622 },
|
||||
+ { .compatible = "mediatek,mt7629-snand", .data = SNAND_SOC_MT7629 },
|
||||
+ { .compatible = "mediatek,mt7981-snand", .data = SNAND_SOC_MT7981 },
|
||||
+ { .compatible = "mediatek,mt7986-snand", .data = SNAND_SOC_MT7986 },
|
||||
+ { /* sentinel */ },
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(mtk_snand) = {
|
||||
+ .name = "mtk-snand",
|
||||
+ .id = UCLASS_MTD,
|
||||
+ .of_match = mtk_snand_ids,
|
||||
+ .flags = DM_FLAG_PRE_RELOC,
|
||||
+};
|
||||
@@ -0,0 +1,390 @@
|
||||
From efc3e6f5d29f87a433b42f15a0b87e04b7cd498d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:11:32 +0800
|
||||
Subject: [PATCH 38/71] env: add support for generic MTD device
|
||||
|
||||
Add an env driver for generic MTD device.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/nvedit.c | 3 +-
|
||||
env/Kconfig | 37 +++++-
|
||||
env/Makefile | 1 +
|
||||
env/env.c | 3 +
|
||||
env/mtd.c | 256 +++++++++++++++++++++++++++++++++++++++++
|
||||
include/env_internal.h | 1 +
|
||||
tools/Makefile | 1 +
|
||||
7 files changed, 299 insertions(+), 3 deletions(-)
|
||||
create mode 100644 env/mtd.c
|
||||
|
||||
--- a/env/Kconfig
|
||||
+++ b/env/Kconfig
|
||||
@@ -61,7 +61,7 @@ config ENV_IS_DEFAULT
|
||||
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
||||
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
||||
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
||||
- !ENV_IS_IN_UBI
|
||||
+ !ENV_IS_IN_UBI && !ENV_IS_IN_MTD
|
||||
select ENV_IS_NOWHERE
|
||||
|
||||
config ENV_IS_NOWHERE
|
||||
@@ -254,6 +254,27 @@ config ENV_IS_IN_MMC
|
||||
offset: "u-boot,mmc-env-offset", "u-boot,mmc-env-offset-redundant".
|
||||
CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND are not used.
|
||||
|
||||
+config ENV_IS_IN_MTD
|
||||
+ bool "Environment in a MTD device"
|
||||
+ depends on !CHAIN_OF_TRUST
|
||||
+ depends on MTD
|
||||
+ help
|
||||
+ Define this if you have a MTD device which you want to use for
|
||||
+ the environment.
|
||||
+
|
||||
+ - CONFIG_ENV_MTD_NAME:
|
||||
+ - CONFIG_ENV_OFFSET:
|
||||
+ - CONFIG_ENV_SIZE:
|
||||
+
|
||||
+ These three #defines specify the MTD device where the environment
|
||||
+ is stored, offset and size of the environment area within the MTD
|
||||
+ device. CONFIG_ENV_OFFSET must be aligned to an erase block boundary.
|
||||
+
|
||||
+ - CONFIG_ENV_SIZE_REDUND:
|
||||
+
|
||||
+ This #define specify the maximum size allowed for read/write/erase
|
||||
+ with skipped bad blocks starting from ENV_OFFSET.
|
||||
+
|
||||
config ENV_IS_IN_NAND
|
||||
bool "Environment in a NAND device"
|
||||
depends on !CHAIN_OF_TRUST
|
||||
@@ -561,10 +582,16 @@ config ENV_ADDR_REDUND
|
||||
Offset from the start of the device (or partition) of the redundant
|
||||
environment location.
|
||||
|
||||
+config ENV_MTD_NAME
|
||||
+ string "Name of the MTD device storing the environment"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ Name of the MTD device that stores the environment
|
||||
+
|
||||
config ENV_OFFSET
|
||||
hex "Environment offset"
|
||||
depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
|
||||
- ENV_IS_IN_SPI_FLASH
|
||||
+ ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD
|
||||
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
|
||||
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
|
||||
default 0xF0000 if ARCH_SUNXI
|
||||
@@ -622,6 +649,12 @@ config ENV_SECT_SIZE
|
||||
help
|
||||
Size of the sector containing the environment.
|
||||
|
||||
+config ENV_SIZE_REDUND
|
||||
+ hex "Redundant environment size"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ The maximum size allowed for read/write/erase with skipped bad blocks.
|
||||
+
|
||||
config ENV_UBI_PART
|
||||
string "UBI partition name"
|
||||
depends on ENV_IS_IN_UBI
|
||||
--- a/env/Makefile
|
||||
+++ b/env/Makefile
|
||||
@@ -24,6 +24,7 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE)
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MMC) += mmc.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) += fat.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
|
||||
+obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MTD) += mtd.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
|
||||
--- a/env/env.c
|
||||
+++ b/env/env.c
|
||||
@@ -46,6 +46,9 @@ static enum env_location env_locations[]
|
||||
#ifdef CONFIG_ENV_IS_IN_MMC
|
||||
ENVL_MMC,
|
||||
#endif
|
||||
+#ifdef CONFIG_ENV_IS_IN_MTD
|
||||
+ ENVL_MTD,
|
||||
+#endif
|
||||
#ifdef CONFIG_ENV_IS_IN_NAND
|
||||
ENVL_NAND,
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/env/mtd.c
|
||||
@@ -0,0 +1,256 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2021 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <command.h>
|
||||
+#include <env.h>
|
||||
+#include <env_internal.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/stddef.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <malloc.h>
|
||||
+#include <memalign.h>
|
||||
+#include <mtd.h>
|
||||
+#include <search.h>
|
||||
+
|
||||
+#if CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE
|
||||
+#undef CONFIG_ENV_SIZE_REDUND
|
||||
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
|
||||
+#endif
|
||||
+
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+env_t *env_ptr = &environment;
|
||||
+#else /* ! ENV_IS_EMBEDDED */
|
||||
+env_t *env_ptr;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+static int env_mtd_init(void)
|
||||
+{
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+ int crc1_ok = 0, crc2_ok = 0;
|
||||
+ env_t *tmp_env1;
|
||||
+
|
||||
+ tmp_env1 = env_ptr;
|
||||
+ crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
|
||||
+
|
||||
+ if (!crc1_ok && !crc2_ok) {
|
||||
+ gd->env_addr = 0;
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+
|
||||
+ return 0;
|
||||
+ } else if (crc1_ok && !crc2_ok) {
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ }
|
||||
+
|
||||
+ if (gd->env_valid == ENV_VALID)
|
||||
+ env_ptr = tmp_env1;
|
||||
+
|
||||
+ gd->env_addr = (ulong)env_ptr->data;
|
||||
+
|
||||
+#else /* ENV_IS_EMBEDDED */
|
||||
+ gd->env_addr = (ulong)&default_environment[0];
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct mtd_info *env_mtd_get_dev(void)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ mtd = get_mtd_device_nm(CONFIG_ENV_MTD_NAME);
|
||||
+ if (IS_ERR(mtd) || !mtd) {
|
||||
+ printf("MTD device '%s' not found\n", CONFIG_ENV_MTD_NAME);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return mtd;
|
||||
+}
|
||||
+
|
||||
+static inline bool mtd_addr_is_block_aligned(struct mtd_info *mtd, u64 addr)
|
||||
+{
|
||||
+ return (addr & mtd->erasesize_mask) == 0;
|
||||
+}
|
||||
+
|
||||
+static int mtd_io_skip_bad(struct mtd_info *mtd, bool read, loff_t offset,
|
||||
+ size_t length, size_t redund, u8 *buffer)
|
||||
+{
|
||||
+ struct mtd_oob_ops io_op = {};
|
||||
+ size_t remaining = length;
|
||||
+ loff_t off, end;
|
||||
+ int ret;
|
||||
+
|
||||
+ io_op.mode = MTD_OPS_PLACE_OOB;
|
||||
+ io_op.len = mtd->writesize;
|
||||
+ io_op.datbuf = (void *)buffer;
|
||||
+
|
||||
+ /* Search for the first good block after the given offset */
|
||||
+ off = offset;
|
||||
+ end = (off + redund) | (mtd->erasesize - 1);
|
||||
+ while (mtd_block_isbad(mtd, off) && off < end)
|
||||
+ off += mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+
|
||||
+ /* Loop over the pages to do the actual read/write */
|
||||
+ while (remaining) {
|
||||
+ /* Skip the block if it is bad */
|
||||
+ if (mtd_addr_is_block_aligned(mtd, off) &&
|
||||
+ mtd_block_isbad(mtd, off)) {
|
||||
+ off += mtd->erasesize;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (read)
|
||||
+ ret = mtd_read_oob(mtd, off, &io_op);
|
||||
+ else
|
||||
+ ret = mtd_write_oob(mtd, off, &io_op);
|
||||
+
|
||||
+ if (ret) {
|
||||
+ printf("Failure while %s at offset 0x%llx\n",
|
||||
+ read ? "reading" : "writing", off);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ off += io_op.retlen;
|
||||
+ remaining -= io_op.retlen;
|
||||
+ io_op.datbuf += io_op.retlen;
|
||||
+ io_op.oobbuf += io_op.oobretlen;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_CMD_SAVEENV
|
||||
+static int mtd_erase_skip_bad(struct mtd_info *mtd, loff_t offset,
|
||||
+ size_t length, size_t redund)
|
||||
+{
|
||||
+ struct erase_info erase_op = {};
|
||||
+ loff_t end = (offset + redund) | (mtd->erasesize - 1);
|
||||
+ int ret;
|
||||
+
|
||||
+ erase_op.mtd = mtd;
|
||||
+ erase_op.addr = offset;
|
||||
+ erase_op.len = length;
|
||||
+
|
||||
+ while (erase_op.len) {
|
||||
+ ret = mtd_erase(mtd, &erase_op);
|
||||
+
|
||||
+ /* Abort if its not a bad block error */
|
||||
+ if (ret != -EIO)
|
||||
+ return ret;
|
||||
+
|
||||
+ printf("Skipping bad block at 0x%08llx\n", erase_op.fail_addr);
|
||||
+
|
||||
+ /* Skip bad block and continue behind it */
|
||||
+ erase_op.len -= erase_op.fail_addr - erase_op.addr;
|
||||
+ erase_op.len -= mtd->erasesize;
|
||||
+ erase_op.addr = erase_op.fail_addr + mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (erase_op.addr >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_save(void)
|
||||
+{
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ ret = env_export(env_new);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ printf("Erasing on MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_erase_skip_bad(mtd, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ if (ret) {
|
||||
+ put_mtd_device(mtd);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ printf("Writing to MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, false, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, (u8 *)env_new);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+#endif /* CONFIG_CMD_SAVEENV */
|
||||
+
|
||||
+static int readenv(size_t offset, u_char *buf)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, true, offset, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, buf);
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_load(void)
|
||||
+{
|
||||
+#if !defined(ENV_IS_EMBEDDED)
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
|
||||
+ if (ret) {
|
||||
+ env_set_default("readenv() failed", 0);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return env_import(buf, 1, H_EXTERNAL);
|
||||
+#endif /* ! ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_ENV_LOCATION(mtd) = {
|
||||
+ .location = ENVL_MTD,
|
||||
+ ENV_NAME("MTD")
|
||||
+ .load = env_mtd_load,
|
||||
+#if defined(CONFIG_CMD_SAVEENV)
|
||||
+ .save = env_save_ptr(env_mtd_save),
|
||||
+#endif
|
||||
+ .init = env_mtd_init,
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -108,6 +108,7 @@ enum env_location {
|
||||
ENVL_FAT,
|
||||
ENVL_FLASH,
|
||||
ENVL_MMC,
|
||||
+ ENVL_MTD,
|
||||
ENVL_NAND,
|
||||
ENVL_NVRAM,
|
||||
ENVL_ONENAND,
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -37,6 +37,7 @@ subdir-$(HOST_TOOLS_ALL) += gdb
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
|
||||
+ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
|
||||
@@ -0,0 +1,44 @@
|
||||
From d26a789c451068caf4bbb4d1ac7bc1f592b5493e Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 10:58:06 +0800
|
||||
Subject: [PATCH 39/71] mtd: add a new mtd device type for NMBM
|
||||
|
||||
This patch adds a new mtd device type for NMBM so that mtdparts can be
|
||||
correctly probed. And this also gives us an opportunity to add NMBM support
|
||||
for filesystems in the future.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/mtdparts.c | 3 +++
|
||||
include/jffs2/load_kernel.h | 4 +++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/cmd/mtdparts.c
|
||||
+++ b/cmd/mtdparts.c
|
||||
@@ -1057,6 +1057,9 @@ int mtd_id_parse(const char *id, const c
|
||||
} else if (strncmp(p, "spi-nand", 8) == 0) {
|
||||
*dev_type = MTD_DEV_TYPE_SPINAND;
|
||||
p += 8;
|
||||
+ } else if (strncmp(p, "nmbm", 4) == 0) {
|
||||
+ *dev_type = MTD_DEV_TYPE_NMBM;
|
||||
+ p += 4;
|
||||
} else {
|
||||
printf("incorrect device type in %s\n", id);
|
||||
return 1;
|
||||
--- a/include/jffs2/load_kernel.h
|
||||
+++ b/include/jffs2/load_kernel.h
|
||||
@@ -16,11 +16,13 @@
|
||||
#define MTD_DEV_TYPE_NAND 0x0002
|
||||
#define MTD_DEV_TYPE_ONENAND 0x0004
|
||||
#define MTD_DEV_TYPE_SPINAND 0x0008
|
||||
+#define MTD_DEV_TYPE_NMBM 0x0010
|
||||
|
||||
#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \
|
||||
(type == MTD_DEV_TYPE_NOR ? "nor" : \
|
||||
(type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
|
||||
- "spi-nand"))) \
|
||||
+ (type == MTD_DEV_TYPE_SPINAND ? "spi-nand" : \
|
||||
+ "nmbm")))) \
|
||||
|
||||
struct mtd_device {
|
||||
struct list_head link;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,958 @@
|
||||
From 0524995f07fcd216a1a7e267fdb5cf2b0ede8489 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 10:42:12 +0800
|
||||
Subject: [PATCH 41/71] mtd: nmbm: add support for mtd
|
||||
|
||||
Add support to create NMBM based on MTD devices
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/nmbm/Kconfig | 5 +
|
||||
drivers/mtd/nmbm/Makefile | 1 +
|
||||
drivers/mtd/nmbm/nmbm-mtd.c | 890 ++++++++++++++++++++++++++++++++++++
|
||||
include/nmbm/nmbm-mtd.h | 27 ++
|
||||
4 files changed, 923 insertions(+)
|
||||
create mode 100644 drivers/mtd/nmbm/nmbm-mtd.c
|
||||
create mode 100644 include/nmbm/nmbm-mtd.h
|
||||
|
||||
--- a/drivers/mtd/nmbm/Kconfig
|
||||
+++ b/drivers/mtd/nmbm/Kconfig
|
||||
@@ -27,3 +27,8 @@ config NMBM_LOG_LEVEL_NONE
|
||||
bool "5 - None"
|
||||
|
||||
endchoice
|
||||
+
|
||||
+config NMBM_MTD
|
||||
+ bool "Enable MTD based NAND mapping block management"
|
||||
+ default n
|
||||
+ depends on NMBM
|
||||
--- a/drivers/mtd/nmbm/Makefile
|
||||
+++ b/drivers/mtd/nmbm/Makefile
|
||||
@@ -3,3 +3,4 @@
|
||||
# (C) Copyright 2020 MediaTek Inc. All rights reserved.
|
||||
|
||||
obj-$(CONFIG_NMBM) += nmbm-core.o
|
||||
+obj-$(CONFIG_NMBM_MTD) += nmbm-mtd.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nmbm/nmbm-mtd.c
|
||||
@@ -0,0 +1,890 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/list.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <jffs2/load_kernel.h>
|
||||
+#include <watchdog.h>
|
||||
+
|
||||
+#include "nmbm-debug.h"
|
||||
+
|
||||
+#define NMBM_UPPER_MTD_NAME "nmbm"
|
||||
+
|
||||
+static uint32_t nmbm_id_cnt;
|
||||
+static LIST_HEAD(nmbm_devs);
|
||||
+
|
||||
+struct nmbm_mtd {
|
||||
+ struct mtd_info upper;
|
||||
+ char *name;
|
||||
+ uint32_t id;
|
||||
+
|
||||
+ struct mtd_info *lower;
|
||||
+
|
||||
+ struct nmbm_instance *ni;
|
||||
+ uint8_t *page_cache;
|
||||
+
|
||||
+ struct list_head node;
|
||||
+};
|
||||
+
|
||||
+static int nmbm_lower_read_page(void *arg, uint64_t addr, void *buf, void *oob,
|
||||
+ enum nmbm_oob_mode mode)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = arg;
|
||||
+ struct mtd_oob_ops ops;
|
||||
+ int ret;
|
||||
+
|
||||
+ memset(&ops, 0, sizeof(ops));
|
||||
+
|
||||
+ switch (mode) {
|
||||
+ case NMBM_MODE_PLACE_OOB:
|
||||
+ ops.mode = MTD_OPS_PLACE_OOB;
|
||||
+ break;
|
||||
+ case NMBM_MODE_AUTO_OOB:
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
+ break;
|
||||
+ case NMBM_MODE_RAW:
|
||||
+ ops.mode = MTD_OPS_RAW;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pr_debug("%s: unsupported NMBM mode: %u\n", __func__, mode);
|
||||
+ return -ENOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ if (buf) {
|
||||
+ ops.datbuf = buf;
|
||||
+ ops.len = nm->lower->writesize;
|
||||
+ }
|
||||
+
|
||||
+ if (oob) {
|
||||
+ ops.oobbuf = oob;
|
||||
+ ops.ooblen = mtd_oobavail(nm->lower, &ops);
|
||||
+ }
|
||||
+
|
||||
+ ret = mtd_read_oob(nm->lower, addr, &ops);
|
||||
+ nm->upper.ecc_stats.corrected = nm->lower->ecc_stats.corrected;
|
||||
+ nm->upper.ecc_stats.failed = nm->lower->ecc_stats.failed;
|
||||
+
|
||||
+ /* Report error on failure (including ecc error) */
|
||||
+ if (ret < 0 && ret != -EUCLEAN)
|
||||
+ return ret;
|
||||
+
|
||||
+ /*
|
||||
+ * Since mtd_read_oob() won't report exact bitflips, what we can know
|
||||
+ * is whether bitflips exceeds the threshold.
|
||||
+ * We want the -EUCLEAN to be passed to the upper layer, but not the
|
||||
+ * error value itself. To achieve this, report bitflips above the
|
||||
+ * threshold.
|
||||
+ */
|
||||
+
|
||||
+ if (ret == -EUCLEAN) {
|
||||
+ return min_t(u32, nm->lower->bitflip_threshold + 1,
|
||||
+ nm->lower->ecc_strength);
|
||||
+ }
|
||||
+
|
||||
+ /* For bitflips less than the threshold, return 0 */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_write_page(void *arg, uint64_t addr, const void *buf,
|
||||
+ const void *oob, enum nmbm_oob_mode mode)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = arg;
|
||||
+ struct mtd_oob_ops ops;
|
||||
+
|
||||
+ memset(&ops, 0, sizeof(ops));
|
||||
+
|
||||
+ switch (mode) {
|
||||
+ case NMBM_MODE_PLACE_OOB:
|
||||
+ ops.mode = MTD_OPS_PLACE_OOB;
|
||||
+ break;
|
||||
+ case NMBM_MODE_AUTO_OOB:
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
+ break;
|
||||
+ case NMBM_MODE_RAW:
|
||||
+ ops.mode = MTD_OPS_RAW;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pr_debug("%s: unsupported NMBM mode: %u\n", __func__, mode);
|
||||
+ return -ENOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ if (buf) {
|
||||
+ ops.datbuf = (uint8_t *)buf;
|
||||
+ ops.len = nm->lower->writesize;
|
||||
+ }
|
||||
+
|
||||
+ if (oob) {
|
||||
+ ops.oobbuf = (uint8_t *)oob;
|
||||
+ ops.ooblen = mtd_oobavail(nm->lower, &ops);
|
||||
+ }
|
||||
+
|
||||
+ return mtd_write_oob(nm->lower, addr, &ops);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_erase_block(void *arg, uint64_t addr)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = arg;
|
||||
+ struct erase_info ei;
|
||||
+
|
||||
+ memset(&ei, 0, sizeof(ei));
|
||||
+
|
||||
+ ei.mtd = nm->lower;
|
||||
+ ei.addr = addr;
|
||||
+ ei.len = nm->lower->erasesize;
|
||||
+
|
||||
+ return mtd_erase(nm->lower, &ei);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_is_bad_block(void *arg, uint64_t addr)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = arg;
|
||||
+
|
||||
+ return mtd_block_isbad(nm->lower, addr);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_mark_bad_block(void *arg, uint64_t addr)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = arg;
|
||||
+
|
||||
+ return mtd_block_markbad(nm->lower, addr);
|
||||
+}
|
||||
+
|
||||
+static void nmbm_lower_log(void *arg, enum nmbm_log_category level,
|
||||
+ const char *fmt, va_list ap)
|
||||
+{
|
||||
+ vprintf(fmt, ap);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||
+ size_t *retlen, u_char *buf)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+
|
||||
+ /* Do not allow read past end of device */
|
||||
+ if ((from + len) > mtd->size) {
|
||||
+ pr_debug("%s: attempt to write beyond end of device\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return nmbm_read_range(nm->ni, from, len, buf, MTD_OPS_PLACE_OOB,
|
||||
+ retlen);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||
+ size_t *retlen, const u_char *buf)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+
|
||||
+ /* Do not allow write past end of device */
|
||||
+ if ((to + len) > mtd->size) {
|
||||
+ pr_debug("%s: attempt to write beyond end of device\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return nmbm_write_range(nm->ni, to, len, buf, MTD_OPS_PLACE_OOB,
|
||||
+ retlen);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+ int ret;
|
||||
+
|
||||
+ instr->state = MTD_ERASING;
|
||||
+
|
||||
+ ret = nmbm_erase_block_range(nm->ni, instr->addr, instr->len,
|
||||
+ &instr->fail_addr);
|
||||
+ if (ret)
|
||||
+ instr->state = MTD_ERASE_FAILED;
|
||||
+ else
|
||||
+ instr->state = MTD_ERASE_DONE;
|
||||
+
|
||||
+ if (!ret)
|
||||
+ /* FIXME */
|
||||
+ /* mtd_erase_callback(instr); */
|
||||
+ return ret;
|
||||
+ else
|
||||
+ ret = -EIO;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_read_data(struct nmbm_mtd *nm, uint64_t addr,
|
||||
+ struct mtd_oob_ops *ops, enum nmbm_oob_mode mode)
|
||||
+{
|
||||
+ size_t len, ooblen, maxooblen, chklen;
|
||||
+ uint32_t col, ooboffs;
|
||||
+ uint8_t *datcache, *oobcache;
|
||||
+ bool has_ecc_err = false;
|
||||
+ int ret, max_bitflips = 0;
|
||||
+
|
||||
+ col = addr & nm->lower->writesize_mask;
|
||||
+ addr &= ~nm->lower->writesize_mask;
|
||||
+ maxooblen = mtd_oobavail(nm->lower, ops);
|
||||
+ ooboffs = ops->ooboffs;
|
||||
+ ooblen = ops->ooblen;
|
||||
+ len = ops->len;
|
||||
+
|
||||
+ datcache = len ? nm->page_cache : NULL;
|
||||
+ oobcache = ooblen ? nm->page_cache + nm->lower->writesize : NULL;
|
||||
+
|
||||
+ ops->oobretlen = 0;
|
||||
+ ops->retlen = 0;
|
||||
+
|
||||
+ while (len || ooblen) {
|
||||
+ schedule();
|
||||
+
|
||||
+ ret = nmbm_read_single_page(nm->ni, addr, datcache, oobcache,
|
||||
+ mode);
|
||||
+ if (ret < 0 && ret != -EBADMSG)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Continue reading on ecc error */
|
||||
+ if (ret == -EBADMSG)
|
||||
+ has_ecc_err = true;
|
||||
+
|
||||
+ /* Record the maximum bitflips between pages */
|
||||
+ if (ret > max_bitflips)
|
||||
+ max_bitflips = ret;
|
||||
+
|
||||
+ if (len) {
|
||||
+ /* Move data */
|
||||
+ chklen = nm->lower->writesize - col;
|
||||
+ if (chklen > len)
|
||||
+ chklen = len;
|
||||
+
|
||||
+ memcpy(ops->datbuf + ops->retlen, datcache + col,
|
||||
+ chklen);
|
||||
+ len -= chklen;
|
||||
+ col = 0; /* (col + chklen) % */
|
||||
+ ops->retlen += chklen;
|
||||
+ }
|
||||
+
|
||||
+ if (ooblen) {
|
||||
+ /* Move oob */
|
||||
+ chklen = maxooblen - ooboffs;
|
||||
+ if (chklen > ooblen)
|
||||
+ chklen = ooblen;
|
||||
+
|
||||
+ memcpy(ops->oobbuf + ops->oobretlen, oobcache + ooboffs,
|
||||
+ chklen);
|
||||
+ ooblen -= chklen;
|
||||
+ ooboffs = 0; /* (ooboffs + chklen) % maxooblen; */
|
||||
+ ops->oobretlen += chklen;
|
||||
+ }
|
||||
+
|
||||
+ addr += nm->lower->writesize;
|
||||
+ }
|
||||
+
|
||||
+ if (has_ecc_err)
|
||||
+ return -EBADMSG;
|
||||
+
|
||||
+ return max_bitflips;
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_read_oob(struct mtd_info *mtd, loff_t from,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+ uint32_t maxooblen;
|
||||
+ enum nmbm_oob_mode mode;
|
||||
+
|
||||
+ if (!ops->oobbuf && !ops->datbuf) {
|
||||
+ if (ops->ooblen || ops->len)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (ops->mode) {
|
||||
+ case MTD_OPS_PLACE_OOB:
|
||||
+ mode = NMBM_MODE_PLACE_OOB;
|
||||
+ break;
|
||||
+ case MTD_OPS_AUTO_OOB:
|
||||
+ mode = NMBM_MODE_AUTO_OOB;
|
||||
+ break;
|
||||
+ case MTD_OPS_RAW:
|
||||
+ mode = NMBM_MODE_RAW;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pr_debug("%s: unsupported oob mode: %u\n", __func__, ops->mode);
|
||||
+ return -ENOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ maxooblen = mtd_oobavail(mtd, ops);
|
||||
+
|
||||
+ /* Do not allow read past end of device */
|
||||
+ if (ops->datbuf && (from + ops->len) > mtd->size) {
|
||||
+ pr_debug("%s: attempt to read beyond end of device\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (!ops->oobbuf) {
|
||||
+ /* Optimized for reading data only */
|
||||
+ return nmbm_read_range(nm->ni, from, ops->len, ops->datbuf,
|
||||
+ mode, &ops->retlen);
|
||||
+ }
|
||||
+
|
||||
+ if (unlikely(ops->ooboffs >= maxooblen)) {
|
||||
+ pr_debug("%s: attempt to start read outside oob\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (unlikely(from >= mtd->size ||
|
||||
+ ops->ooboffs + ops->ooblen > ((mtd->size >> mtd->writesize_shift) -
|
||||
+ (from >> mtd->writesize_shift)) * maxooblen)) {
|
||||
+ pr_debug("%s: attempt to read beyond end of device\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return nmbm_mtd_read_data(nm, from, ops, mode);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_write_data(struct nmbm_mtd *nm, uint64_t addr,
|
||||
+ struct mtd_oob_ops *ops, enum nmbm_oob_mode mode)
|
||||
+{
|
||||
+ size_t len, ooblen, maxooblen, chklen;
|
||||
+ uint32_t col, ooboffs;
|
||||
+ uint8_t *datcache, *oobcache;
|
||||
+ int ret;
|
||||
+
|
||||
+ col = addr & nm->lower->writesize_mask;
|
||||
+ addr &= ~nm->lower->writesize_mask;
|
||||
+ maxooblen = mtd_oobavail(nm->lower, ops);
|
||||
+ ooboffs = ops->ooboffs;
|
||||
+ ooblen = ops->ooblen;
|
||||
+ len = ops->len;
|
||||
+
|
||||
+ datcache = len ? nm->page_cache : NULL;
|
||||
+ oobcache = ooblen ? nm->page_cache + nm->lower->writesize : NULL;
|
||||
+
|
||||
+ ops->oobretlen = 0;
|
||||
+ ops->retlen = 0;
|
||||
+
|
||||
+ while (len || ooblen) {
|
||||
+ schedule();
|
||||
+
|
||||
+ if (len) {
|
||||
+ /* Move data */
|
||||
+ chklen = nm->lower->writesize - col;
|
||||
+ if (chklen > len)
|
||||
+ chklen = len;
|
||||
+
|
||||
+ memset(datcache, 0xff, col);
|
||||
+ memcpy(datcache + col, ops->datbuf + ops->retlen,
|
||||
+ chklen);
|
||||
+ memset(datcache + col + chklen, 0xff,
|
||||
+ nm->lower->writesize - col - chklen);
|
||||
+ len -= chklen;
|
||||
+ col = 0; /* (col + chklen) % */
|
||||
+ ops->retlen += chklen;
|
||||
+ }
|
||||
+
|
||||
+ if (ooblen) {
|
||||
+ /* Move oob */
|
||||
+ chklen = maxooblen - ooboffs;
|
||||
+ if (chklen > ooblen)
|
||||
+ chklen = ooblen;
|
||||
+
|
||||
+ memset(oobcache, 0xff, ooboffs);
|
||||
+ memcpy(oobcache + ooboffs,
|
||||
+ ops->oobbuf + ops->oobretlen, chklen);
|
||||
+ memset(oobcache + ooboffs + chklen, 0xff,
|
||||
+ nm->lower->oobsize - ooboffs - chklen);
|
||||
+ ooblen -= chklen;
|
||||
+ ooboffs = 0; /* (ooboffs + chklen) % maxooblen; */
|
||||
+ ops->oobretlen += chklen;
|
||||
+ }
|
||||
+
|
||||
+ ret = nmbm_write_single_page(nm->ni, addr, datcache, oobcache,
|
||||
+ mode);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ addr += nm->lower->writesize;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_write_oob(struct mtd_info *mtd, loff_t to,
|
||||
+ struct mtd_oob_ops *ops)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+ enum nmbm_oob_mode mode;
|
||||
+ uint32_t maxooblen;
|
||||
+
|
||||
+ if (!ops->oobbuf && !ops->datbuf) {
|
||||
+ if (ops->ooblen || ops->len)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (ops->mode) {
|
||||
+ case MTD_OPS_PLACE_OOB:
|
||||
+ mode = NMBM_MODE_PLACE_OOB;
|
||||
+ break;
|
||||
+ case MTD_OPS_AUTO_OOB:
|
||||
+ mode = NMBM_MODE_AUTO_OOB;
|
||||
+ break;
|
||||
+ case MTD_OPS_RAW:
|
||||
+ mode = NMBM_MODE_RAW;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pr_debug("%s: unsupported oob mode: %u\n", __func__,
|
||||
+ ops->mode);
|
||||
+ return -ENOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ maxooblen = mtd_oobavail(mtd, ops);
|
||||
+
|
||||
+ /* Do not allow write past end of device */
|
||||
+ if (ops->datbuf && (to + ops->len) > mtd->size) {
|
||||
+ pr_debug("%s: attempt to write beyond end of device\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (!ops->oobbuf) {
|
||||
+ /* Optimized for writing data only */
|
||||
+ return nmbm_write_range(nm->ni, to, ops->len, ops->datbuf,
|
||||
+ mode, &ops->retlen);
|
||||
+ }
|
||||
+
|
||||
+ if (unlikely(ops->ooboffs >= maxooblen)) {
|
||||
+ pr_debug("%s: attempt to start write outside oob\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (unlikely(to >= mtd->size ||
|
||||
+ ops->ooboffs + ops->ooblen > ((mtd->size >> mtd->writesize_shift) -
|
||||
+ (to >> mtd->writesize_shift)) * maxooblen)) {
|
||||
+ pr_debug("%s: attempt to write beyond end of device\n",
|
||||
+ __func__);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return nmbm_mtd_write_data(nm, to, ops, mode);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_block_isbad(struct mtd_info *mtd, loff_t offs)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+
|
||||
+ return nmbm_check_bad_block(nm->ni, offs);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_mtd_block_markbad(struct mtd_info *mtd, loff_t offs)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm = container_of(mtd, struct nmbm_mtd, upper);
|
||||
+
|
||||
+ return nmbm_mark_bad_block(nm->ni, offs);
|
||||
+}
|
||||
+
|
||||
+int nmbm_attach_mtd(struct mtd_info *lower, int flags, uint32_t max_ratio,
|
||||
+ uint32_t max_reserved_blocks, struct mtd_info **upper)
|
||||
+{
|
||||
+ struct nmbm_lower_device nld;
|
||||
+ struct nmbm_instance *ni;
|
||||
+ struct mtd_info *mtd;
|
||||
+ struct nmbm_mtd *nm;
|
||||
+ size_t namelen, alloc_size;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!lower)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (lower->type != MTD_NANDFLASH || lower->flags != MTD_CAP_NANDFLASH)
|
||||
+ return -ENOTSUPP;
|
||||
+
|
||||
+ namelen = strlen(NMBM_UPPER_MTD_NAME) + 16;
|
||||
+
|
||||
+ nm = calloc(sizeof(*nm) + lower->writesize + lower->oobsize + namelen + 1, 1);
|
||||
+ if (!nm)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ nm->lower = lower;
|
||||
+ nm->name = (char *)nm + sizeof(*nm);
|
||||
+ nm->page_cache = (uint8_t *)nm->name + namelen + 1;
|
||||
+
|
||||
+ nm->id = nmbm_id_cnt++;
|
||||
+ snprintf(nm->name, namelen + 1, "%s%u", NMBM_UPPER_MTD_NAME, nm->id);
|
||||
+
|
||||
+ memset(&nld, 0, sizeof(nld));
|
||||
+
|
||||
+ nld.flags = flags;
|
||||
+ nld.max_ratio = max_ratio;
|
||||
+ nld.max_reserved_blocks = max_reserved_blocks;
|
||||
+
|
||||
+ nld.size = lower->size;
|
||||
+ nld.erasesize = lower->erasesize;
|
||||
+ nld.writesize = lower->writesize;
|
||||
+ nld.oobsize = lower->oobsize;
|
||||
+ nld.oobavail = lower->oobavail;
|
||||
+
|
||||
+ nld.arg = nm;
|
||||
+ nld.read_page = nmbm_lower_read_page;
|
||||
+ nld.write_page = nmbm_lower_write_page;
|
||||
+ nld.erase_block = nmbm_lower_erase_block;
|
||||
+ nld.is_bad_block = nmbm_lower_is_bad_block;
|
||||
+ nld.mark_bad_block = nmbm_lower_mark_bad_block;
|
||||
+
|
||||
+ nld.logprint = nmbm_lower_log;
|
||||
+
|
||||
+ alloc_size = nmbm_calc_structure_size(&nld);
|
||||
+ ni = calloc(alloc_size, 1);
|
||||
+ if (!ni) {
|
||||
+ free(nm);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ ret = nmbm_attach(&nld, ni);
|
||||
+ if (ret) {
|
||||
+ free(ni);
|
||||
+ free(nm);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ nm->ni = ni;
|
||||
+
|
||||
+ /* Initialize upper mtd */
|
||||
+ mtd = &nm->upper;
|
||||
+
|
||||
+ mtd->name = nm->name;
|
||||
+ mtd->type = MTD_DEV_TYPE_NMBM;
|
||||
+ mtd->flags = lower->flags;
|
||||
+
|
||||
+ mtd->size = (uint64_t)ni->data_block_count * ni->lower.erasesize;
|
||||
+ mtd->erasesize = lower->erasesize;
|
||||
+ mtd->writesize = lower->writesize;
|
||||
+ mtd->writebufsize = lower->writesize;
|
||||
+ mtd->oobsize = lower->oobsize;
|
||||
+ mtd->oobavail = lower->oobavail;
|
||||
+
|
||||
+ mtd->erasesize_shift = lower->erasesize_shift;
|
||||
+ mtd->writesize_shift = lower->writesize_shift;
|
||||
+ mtd->erasesize_mask = lower->erasesize_mask;
|
||||
+ mtd->writesize_mask = lower->writesize_mask;
|
||||
+
|
||||
+ mtd->bitflip_threshold = lower->bitflip_threshold;
|
||||
+
|
||||
+ /* XXX: should this be duplicated? */
|
||||
+ mtd->ooblayout = lower->ooblayout;
|
||||
+ mtd->ecclayout = lower->ecclayout;
|
||||
+
|
||||
+ mtd->ecc_step_size = lower->ecc_step_size;
|
||||
+ mtd->ecc_strength = lower->ecc_strength;
|
||||
+
|
||||
+ mtd->numeraseregions = lower->numeraseregions;
|
||||
+ mtd->eraseregions = lower->eraseregions;
|
||||
+
|
||||
+ mtd->_read = nmbm_mtd_read;
|
||||
+ mtd->_write = nmbm_mtd_write;
|
||||
+ mtd->_erase = nmbm_mtd_erase;
|
||||
+ mtd->_read_oob = nmbm_mtd_read_oob;
|
||||
+ mtd->_write_oob = nmbm_mtd_write_oob;
|
||||
+ mtd->_block_isbad = nmbm_mtd_block_isbad;
|
||||
+ mtd->_block_markbad = nmbm_mtd_block_markbad;
|
||||
+
|
||||
+ *upper = mtd;
|
||||
+
|
||||
+ list_add_tail(&nm->node, &nmbm_devs);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int nmbm_free_mtd(struct mtd_info *upper)
|
||||
+{
|
||||
+ struct nmbm_mtd *pos;
|
||||
+
|
||||
+ if (!upper)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ list_for_each_entry(pos, &nmbm_devs, node) {
|
||||
+ if (&pos->upper == upper) {
|
||||
+ list_del(&pos->node);
|
||||
+
|
||||
+ nmbm_detach(pos->ni);
|
||||
+ free(pos->ni);
|
||||
+ free(pos);
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return -ENODEV;
|
||||
+}
|
||||
+
|
||||
+struct mtd_info *nmbm_mtd_get_upper_by_index(uint32_t index)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ if (nm->id == index)
|
||||
+ return &nm->upper;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+struct mtd_info *nmbm_mtd_get_upper(struct mtd_info *lower)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ if (nm->lower == lower)
|
||||
+ return &nm->upper;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+void nmbm_mtd_list_devices(void)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+
|
||||
+ printf("Index NMBM device Lower device\n");
|
||||
+ printf("========================================\n");
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ printf("%-8u%-20s%s\n", nm->id, nm->name, nm->lower->name);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int nmbm_mtd_print_info(const char *name)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+ bool found = false;
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ if (!strcmp(nm->name, name)) {
|
||||
+ found = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!found) {
|
||||
+ printf("Error: NMBM device '%s' not found\n", name);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ printf("%s:\n", name);
|
||||
+ printf("Total blocks: %u\n", nm->ni->block_count);
|
||||
+ printf("Data blocks: %u\n", nm->ni->data_block_count);
|
||||
+ printf("Management start block: %u\n", nm->ni->mgmt_start_ba);
|
||||
+ printf("Info table size: 0x%x\n", nm->ni->info_table_size);
|
||||
+
|
||||
+ if (nm->ni->main_table_ba)
|
||||
+ printf("Main info table start block: %u\n", nm->ni->main_table_ba);
|
||||
+ else
|
||||
+ printf("Main info table start block: Not exist\n");
|
||||
+
|
||||
+ if (nm->ni->backup_table_ba)
|
||||
+ printf("Backup info table start block: %u\n", nm->ni->backup_table_ba);
|
||||
+ else
|
||||
+ printf("Backup info table start block: Not exist\n");
|
||||
+
|
||||
+ printf("Signature block: %u\n", nm->ni->signature_ba);
|
||||
+ printf("Mapping blocks top address: %u\n", nm->ni->mapping_blocks_top_ba);
|
||||
+ printf("Mapping blocks limit address: %u\n", nm->ni->mapping_blocks_ba);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const char nmbm_block_legends[] = {
|
||||
+ [NMBM_BLOCK_GOOD_DATA] = '-',
|
||||
+ [NMBM_BLOCK_GOOD_MGMT] = '+',
|
||||
+ [NMBM_BLOCK_BAD] = 'B',
|
||||
+ [NMBM_BLOCK_MAIN_INFO_TABLE] = 'I',
|
||||
+ [NMBM_BLOCK_BACKUP_INFO_TABLE] = 'i',
|
||||
+ [NMBM_BLOCK_REMAPPED] = 'M',
|
||||
+ [NMBM_BLOCK_SIGNATURE] = 'S',
|
||||
+};
|
||||
+
|
||||
+int nmbm_mtd_print_states(const char *name)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+ enum nmmb_block_type bt;
|
||||
+ bool found = false;
|
||||
+ uint32_t i;
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ if (!strcmp(nm->name, name)) {
|
||||
+ found = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!found) {
|
||||
+ printf("Error: NMBM device '%s' not found\n", name);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ printf("Physical blocks:\n");
|
||||
+ printf("\n");
|
||||
+
|
||||
+ printf("Legends:\n");
|
||||
+ printf(" - Good data block\n");
|
||||
+ printf(" + Good management block\n");
|
||||
+ printf(" B Bad block\n");
|
||||
+ printf(" I Main info table\n");
|
||||
+ printf(" i Backup info table\n");
|
||||
+ printf(" M Remapped spare block\n");
|
||||
+ printf(" S Signature block\n");
|
||||
+ printf("\n");
|
||||
+
|
||||
+ for (i = 0; i < nm->ni->block_count; i++) {
|
||||
+ if (i % 64 == 0)
|
||||
+ printf(" ");
|
||||
+
|
||||
+ bt = nmbm_debug_get_phys_block_type(nm->ni, i);
|
||||
+ if (bt < __NMBM_BLOCK_TYPE_MAX)
|
||||
+ putc(nmbm_block_legends[bt]);
|
||||
+ else
|
||||
+ putc('?');
|
||||
+
|
||||
+ if (i % 64 == 63)
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
+ printf("\n");
|
||||
+ printf("Logical blocks:\n");
|
||||
+ printf("\n");
|
||||
+
|
||||
+ printf("Legends:\n");
|
||||
+ printf(" - Good block\n");
|
||||
+ printf(" + Initially remapped block\n");
|
||||
+ printf(" M Remapped block\n");
|
||||
+ printf(" B Bad/Unmapped block\n");
|
||||
+ printf("\n");
|
||||
+
|
||||
+ for (i = 0; i < nm->ni->data_block_count; i++) {
|
||||
+ if (i % 64 == 0)
|
||||
+ printf(" ");
|
||||
+
|
||||
+ if (nm->ni->block_mapping[i] < 0)
|
||||
+ putc('B');
|
||||
+ else if (nm->ni->block_mapping[i] == i)
|
||||
+ putc('-');
|
||||
+ else if (nm->ni->block_mapping[i] < nm->ni->data_block_count)
|
||||
+ putc('+');
|
||||
+ else if (nm->ni->block_mapping[i] > nm->ni->mapping_blocks_top_ba &&
|
||||
+ nm->ni->block_mapping[i] < nm->ni->signature_ba)
|
||||
+ putc('M');
|
||||
+ else
|
||||
+ putc('?');
|
||||
+
|
||||
+ if (i % 64 == 63)
|
||||
+ printf("\n");
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int nmbm_mtd_print_bad_blocks(const char *name)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+ bool found = false;
|
||||
+ uint32_t i;
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ if (!strcmp(nm->name, name)) {
|
||||
+ found = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!found) {
|
||||
+ printf("Error: NMBM device '%s' not found\n", name);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ printf("Physical blocks:\n");
|
||||
+
|
||||
+ for (i = 0; i < nm->ni->block_count; i++) {
|
||||
+ switch (nmbm_debug_get_block_state(nm->ni, i)) {
|
||||
+ case BLOCK_ST_BAD:
|
||||
+ printf("%-12u [0x%08llx] - Bad\n", i,
|
||||
+ (uint64_t)i << nm->ni->erasesize_shift);
|
||||
+ break;
|
||||
+ case BLOCK_ST_NEED_REMAP:
|
||||
+ printf("%-12u [0x%08llx] - Awaiting remapping\n", i,
|
||||
+ (uint64_t)i << nm->ni->erasesize_shift);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ printf("\n");
|
||||
+ printf("Logical blocks:\n");
|
||||
+
|
||||
+ for (i = 0; i < nm->ni->data_block_count; i++) {
|
||||
+ if (nm->ni->block_mapping[i] < 0) {
|
||||
+ printf("%-12u [0x%08llx] - Bad\n", i,
|
||||
+ (uint64_t)i << nm->ni->erasesize_shift);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int nmbm_mtd_print_mappings(const char *name, int printall)
|
||||
+{
|
||||
+ struct nmbm_mtd *nm;
|
||||
+ bool found = false;
|
||||
+ int32_t pb;
|
||||
+ uint32_t i;
|
||||
+
|
||||
+ list_for_each_entry(nm, &nmbm_devs, node) {
|
||||
+ if (!strcmp(nm->name, name)) {
|
||||
+ found = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!found) {
|
||||
+ printf("Error: NMBM device '%s' not found\n", name);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ printf("Logical Block Physical Block\n");
|
||||
+ printf("==================================\n");
|
||||
+
|
||||
+ if (!printall) {
|
||||
+ for (i = 0; i < nm->ni->data_block_count; i++) {
|
||||
+ pb = nm->ni->block_mapping[i];
|
||||
+ if (pb < 0)
|
||||
+ printf("%-20uUnmapped\n", i);
|
||||
+ else if ((uint32_t)pb > nm->ni->mapping_blocks_top_ba &&
|
||||
+ (uint32_t)pb < nm->ni->signature_ba)
|
||||
+ printf("%-20u%u\n", i, pb);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < nm->ni->data_block_count; i++) {
|
||||
+ pb = nm->ni->block_mapping[i];
|
||||
+
|
||||
+ if (pb >= 0)
|
||||
+ printf("%-20u%u\n", i, pb);
|
||||
+ else
|
||||
+ printf("%-20uUnmapped\n", i);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/include/nmbm/nmbm-mtd.h
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef _NMBM_MTD_H_
|
||||
+#define _NMBM_MTD_H_
|
||||
+
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+
|
||||
+int nmbm_attach_mtd(struct mtd_info *lower, int flags, uint32_t max_ratio,
|
||||
+ uint32_t max_reserved_blocks, struct mtd_info **upper);
|
||||
+
|
||||
+int nmbm_free_mtd(struct mtd_info *upper);
|
||||
+
|
||||
+struct mtd_info *nmbm_mtd_get_upper_by_index(uint32_t index);
|
||||
+struct mtd_info *nmbm_mtd_get_upper(struct mtd_info *lower);
|
||||
+
|
||||
+void nmbm_mtd_list_devices(void);
|
||||
+int nmbm_mtd_print_info(const char *name);
|
||||
+int nmbm_mtd_print_states(const char *name);
|
||||
+int nmbm_mtd_print_bad_blocks(const char *name);
|
||||
+int nmbm_mtd_print_mappings(const char *name, int printall);
|
||||
+
|
||||
+#endif /* _NMBM_MTD_H_ */
|
||||
@@ -0,0 +1,46 @@
|
||||
From dcf24c8deeb43a4406ae18136c8700dc2f867415 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 11:18:03 +0800
|
||||
Subject: [PATCH 42/71] common: board_r: add support to initialize NMBM after
|
||||
nand initialization
|
||||
|
||||
This patch add support to initialize NMBM after nand initialized.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
common/board_r.c | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
--- a/common/board_r.c
|
||||
+++ b/common/board_r.c
|
||||
@@ -373,6 +373,20 @@ static int initr_nand(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_NMBM_MTD
|
||||
+
|
||||
+__weak int board_nmbm_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* go init the NMBM */
|
||||
+static int initr_nmbm(void)
|
||||
+{
|
||||
+ return board_nmbm_init();
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#if defined(CONFIG_CMD_ONENAND)
|
||||
/* go init the NAND */
|
||||
static int initr_onenand(void)
|
||||
@@ -664,6 +678,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_CMD_ONENAND
|
||||
initr_onenand,
|
||||
#endif
|
||||
+#ifdef CONFIG_NMBM_MTD
|
||||
+ initr_nmbm,
|
||||
+#endif
|
||||
#ifdef CONFIG_MMC
|
||||
initr_mmc,
|
||||
#endif
|
||||
@@ -0,0 +1,370 @@
|
||||
From 0af8d0aac77f4df4bc7dadbcdea5d9a16f5f3e45 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 10:44:57 +0800
|
||||
Subject: [PATCH 43/71] cmd: add nmbm command
|
||||
|
||||
Add nmbm command for debugging, data operations and image-booting support
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/Kconfig | 6 +
|
||||
cmd/Makefile | 1 +
|
||||
cmd/nmbm.c | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 334 insertions(+)
|
||||
create mode 100644 cmd/nmbm.c
|
||||
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -1450,6 +1450,12 @@ config CMD_NAND_TORTURE
|
||||
|
||||
endif # CMD_NAND
|
||||
|
||||
+config CMD_NMBM
|
||||
+ depends on NMBM_MTD
|
||||
+ bool "nmbm"
|
||||
+ help
|
||||
+ NAND mapping block management (NMBM) utility
|
||||
+
|
||||
config CMD_NVME
|
||||
bool "nvme"
|
||||
depends on NVME
|
||||
--- a/cmd/Makefile
|
||||
+++ b/cmd/Makefile
|
||||
@@ -127,6 +127,7 @@ obj-y += legacy-mtd-utils.o
|
||||
endif
|
||||
obj-$(CONFIG_CMD_MUX) += mux.o
|
||||
obj-$(CONFIG_CMD_NAND) += nand.o
|
||||
+obj-$(CONFIG_CMD_NMBM) += nmbm.o
|
||||
obj-$(CONFIG_CMD_NET) += net.o
|
||||
obj-$(CONFIG_ENV_SUPPORT) += nvedit.o
|
||||
obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o
|
||||
--- /dev/null
|
||||
+++ b/cmd/nmbm.c
|
||||
@@ -0,0 +1,327 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <command.h>
|
||||
+#include <image.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <jffs2/load_kernel.h>
|
||||
+
|
||||
+#include <nmbm/nmbm-mtd.h>
|
||||
+
|
||||
+static int nmbm_parse_offset_size(struct mtd_info *mtd, char *off_str,
|
||||
+ char *size_str, uint64_t *off,
|
||||
+ uint64_t *size)
|
||||
+{
|
||||
+ char *end;
|
||||
+
|
||||
+ *off = simple_strtoull(off_str, &end, 16);
|
||||
+ if (end == off_str) {
|
||||
+ printf("Error: offset '%s' is invalid\n", off_str);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (*off >= mtd->size) {
|
||||
+ printf("Error: offset '0x%llx' is beyond the end of device\n",
|
||||
+ *off);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ *size = simple_strtoull(size_str, &end, 16);
|
||||
+ if (end == off_str) {
|
||||
+ printf("Error: size '%s' is invalid\n", off_str);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (*off + *size > mtd->size) {
|
||||
+ printf("Error: size '0x%llx' is too large\n", *size);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int do_nmbm_erase(struct mtd_info *mtd, uint64_t offset, uint64_t size)
|
||||
+{
|
||||
+ struct erase_info ei;
|
||||
+ int ret;
|
||||
+
|
||||
+ memset(&ei, 0, sizeof(ei));
|
||||
+
|
||||
+ ei.mtd = mtd;
|
||||
+ ei.addr = offset;
|
||||
+ ei.len = size;
|
||||
+
|
||||
+ printf("Erasing from 0x%llx, size 0x%llx ...\n", offset, size);
|
||||
+
|
||||
+ ret = mtd_erase(mtd, &ei);
|
||||
+
|
||||
+ if (!ret) {
|
||||
+ printf("Succeeded\n");
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ printf("Failed at 0x%llx\n", ei.fail_addr);
|
||||
+
|
||||
+ return CMD_RET_FAILURE;
|
||||
+}
|
||||
+
|
||||
+static int do_nmbm_rw(int read, struct mtd_info *mtd, uintptr_t addr,
|
||||
+ uint64_t offset, size_t size)
|
||||
+{
|
||||
+ size_t retlen;
|
||||
+ int ret;
|
||||
+
|
||||
+ printf("%s 0x%llx, size 0x%zx\n", read ? "Reading from" : "Writing to",
|
||||
+ offset, size);
|
||||
+
|
||||
+ if (read)
|
||||
+ ret = mtd_read(mtd, offset, size, &retlen, (void *)addr);
|
||||
+ else
|
||||
+ ret = mtd_write(mtd, offset, size, &retlen, (void *)addr);
|
||||
+
|
||||
+ if (!ret) {
|
||||
+ printf("Succeeded\n");
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ printf("Failed at 0x%llx\n", offset + retlen);
|
||||
+
|
||||
+ return CMD_RET_FAILURE;
|
||||
+}
|
||||
+
|
||||
+static int do_nmbm_mtd_boot(struct cmd_tbl *cmdtp, struct mtd_info *mtd,
|
||||
+ int argc, char *const argv[])
|
||||
+{
|
||||
+ bool print_image_contents = true;
|
||||
+ uintptr_t loadaddr = image_load_addr;
|
||||
+ char *end, *image_name;
|
||||
+ const char *ep;
|
||||
+ size_t retlen;
|
||||
+ uint32_t size;
|
||||
+ uint64_t off;
|
||||
+ int ret;
|
||||
+
|
||||
+#if defined(CONFIG_CMD_MTDPARTS)
|
||||
+ struct mtd_device *partdev;
|
||||
+ struct mtd_info *partmtd;
|
||||
+ struct part_info *part;
|
||||
+ u8 pnum;
|
||||
+#endif
|
||||
+
|
||||
+ ep = env_get("autostart");
|
||||
+
|
||||
+ if (ep && !strcmp(ep, "yes"))
|
||||
+ print_image_contents = false;
|
||||
+
|
||||
+ if (argc == 2) {
|
||||
+ loadaddr = simple_strtoul(argv[0], &end, 0);
|
||||
+ if (*end || end == argv[0]) {
|
||||
+ printf("'%s' is not a valid address\n", argv[0]);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ argc--;
|
||||
+ argv++;
|
||||
+ }
|
||||
+
|
||||
+ off = simple_strtoull(argv[0], &end, 0);
|
||||
+ if (*end || end == argv[0]) {
|
||||
+#if defined(CONFIG_CMD_MTDPARTS)
|
||||
+ ret = mtdparts_init();
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ ret = find_dev_and_part(argv[0], &partdev, &pnum, &part);
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ if (partdev->id->type != MTD_DEV_TYPE_NMBM) {
|
||||
+ printf("'%s' is not a NMBM device partition\n",
|
||||
+ argv[0]);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ partmtd = nmbm_mtd_get_upper_by_index(partdev->id->num);
|
||||
+
|
||||
+ if (partmtd != mtd) {
|
||||
+ printf("'%s' does not belong to this device\n",
|
||||
+ argv[0]);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ off = part->offset;
|
||||
+#else
|
||||
+ printf("'%s' is not a valid offset\n", argv[0]);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
+ ret = mtd_read(mtd, off, sizeof(struct legacy_img_hdr), &retlen,
|
||||
+ (void *)loadaddr);
|
||||
+ if (ret || retlen != sizeof(struct legacy_img_hdr)) {
|
||||
+ printf("Failed to read NMBM at offset 0x%08llx\n", off);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ switch (genimg_get_format((void *)loadaddr)) {
|
||||
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
|
||||
+ case IMAGE_FORMAT_LEGACY:
|
||||
+ size = image_get_image_size((struct legacy_img_hdr *)loadaddr);
|
||||
+ image_name = "legacy";
|
||||
+ break;
|
||||
+#endif
|
||||
+#if defined(CONFIG_FIT)
|
||||
+ case IMAGE_FORMAT_FIT:
|
||||
+ size = fit_get_size((const void *)loadaddr);
|
||||
+ image_name = "FIT";
|
||||
+ break;
|
||||
+#endif
|
||||
+ default:
|
||||
+ printf("Error: no Image found at offset 0x%08llx\n", off);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ printf("Loading %s image at offset 0x%llx to memory 0x%08lx, size 0x%x ...\n",
|
||||
+ image_name, off, loadaddr, size);
|
||||
+
|
||||
+ ret = mtd_read(mtd, off, size, &retlen, (void *)loadaddr);
|
||||
+ if (ret || retlen != size) {
|
||||
+ printf("Error: Failed to load image at offset 0x%08llx\n",
|
||||
+ off + retlen);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ switch (genimg_get_format((void *)loadaddr)) {
|
||||
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
|
||||
+ case IMAGE_FORMAT_LEGACY:
|
||||
+ if (print_image_contents)
|
||||
+ image_print_contents((void *)loadaddr);
|
||||
+ break;
|
||||
+#endif
|
||||
+#if defined(CONFIG_FIT)
|
||||
+ case IMAGE_FORMAT_FIT:
|
||||
+ if (print_image_contents)
|
||||
+ fit_print_contents((void *)loadaddr);
|
||||
+ break;
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
+ image_load_addr = loadaddr;
|
||||
+
|
||||
+ return bootm_maybe_autostart(cmdtp, "nmbm");
|
||||
+}
|
||||
+
|
||||
+static int do_nmbm(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ uint64_t offset, size;
|
||||
+ char *end;
|
||||
+ uintptr_t addr;
|
||||
+ int ret, all = 0;
|
||||
+
|
||||
+ if (argc == 1)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ if (!strcmp(argv[1], "list")) {
|
||||
+ nmbm_mtd_list_devices();
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ if (argc < 3)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ if (!strcmp(argv[2], "info"))
|
||||
+ return !!nmbm_mtd_print_info(argv[1]);
|
||||
+
|
||||
+ if (!strcmp(argv[2], "state"))
|
||||
+ return !!nmbm_mtd_print_states(argv[1]);
|
||||
+
|
||||
+ if (!strcmp(argv[2], "bad"))
|
||||
+ return !!nmbm_mtd_print_bad_blocks(argv[1]);
|
||||
+
|
||||
+ if (!strcmp(argv[2], "mapping")) {
|
||||
+ if (argc >= 4) {
|
||||
+ if (!strcmp(argv[3], "all"))
|
||||
+ all = 1;
|
||||
+ }
|
||||
+
|
||||
+ return nmbm_mtd_print_mappings(argv[1], all);
|
||||
+ }
|
||||
+
|
||||
+ if (argc < 4)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ mtd = get_mtd_device_nm(argv[1]);
|
||||
+ if (IS_ERR(mtd)) {
|
||||
+ printf("Error: NMBM device '%s' not found\n", argv[1]);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (mtd->type != MTD_DEV_TYPE_NMBM) {
|
||||
+ printf("Error: '%s' is not a NMBM device\n", argv[1]);
|
||||
+ return CMD_RET_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ if (!strcmp(argv[2], "boot"))
|
||||
+ return do_nmbm_mtd_boot(cmdtp, mtd, argc - 3, argv + 3);
|
||||
+
|
||||
+ if (argc < 5)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ if (!strcmp(argv[2], "erase")) {
|
||||
+ ret = nmbm_parse_offset_size(mtd, argv[3], argv[4], &offset,
|
||||
+ &size);
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ return do_nmbm_erase(mtd, offset, size);
|
||||
+ }
|
||||
+
|
||||
+ if (argc < 6)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ ret = nmbm_parse_offset_size(mtd, argv[4], argv[5], &offset, &size);
|
||||
+ if (ret)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ if (size > SIZE_MAX) {
|
||||
+ printf("Error: size 0x%llx is too large\n", size);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ addr = simple_strtoul(argv[3], &end, 16);
|
||||
+ if (end == argv[3]) {
|
||||
+ printf("Error: addr '%s' is invalid\n", argv[3]);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (!strcmp(argv[2], "read"))
|
||||
+ return do_nmbm_rw(1, mtd, addr, offset, (size_t)size);
|
||||
+
|
||||
+ if (!strcmp(argv[2], "write"))
|
||||
+ return do_nmbm_rw(0, mtd, addr, offset, (size_t)size);
|
||||
+
|
||||
+ return CMD_RET_USAGE;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_CMD(
|
||||
+ nmbm, CONFIG_SYS_MAXARGS, 0, do_nmbm,
|
||||
+ "NMBM utility commands",
|
||||
+ "\n"
|
||||
+ "nmbm list - List NMBM devices\n"
|
||||
+ "nmbm <name> info - Display NMBM information\n"
|
||||
+ "nmbm <name> state - Display block states\n"
|
||||
+ "nmbm <name> bad - Display bad blocks\n"
|
||||
+ "nmbm <name> boot <part | [loadaddr] offset> - Boot from NMBM\n"
|
||||
+ "nmbm <name> mapping [all] - Display block mapping\n"
|
||||
+ "nmbm <name> erase <offset> <size> - Erase blocks\n"
|
||||
+ "nmbm <name> read <addr> <offset> <size> - Read data\n"
|
||||
+ "nmbm <name> write <addr> <offset> <size> - Write data\n"
|
||||
+);
|
||||
@@ -0,0 +1,80 @@
|
||||
From 6dbbc8affb6ab22f940d13d0e928d5e881127ca4 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 11:22:57 +0800
|
||||
Subject: [PATCH 44/71] cmd: mtd: add markbad subcommand for NMBM testing
|
||||
|
||||
This patch adds:
|
||||
* Mark bad block on lower mtd device and erase on upper mtd
|
||||
device, which will trigger remapping:
|
||||
$ mtd markbad spi-nand0 0x20000 (mark block1 as bad)
|
||||
$ mtd erase nmbm0 0x20000 0x20000 (let nmbm detect the bad block and remap it)
|
||||
|
||||
* Clear bad block mark through:
|
||||
$ mtd erase.dontskipbad spi-nand0 0x20000 0x20000
|
||||
(After cleaning bad block mark, we need to rebuild nmbm manage table.)
|
||||
|
||||
Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
---
|
||||
cmd/mtd.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 39 insertions(+)
|
||||
|
||||
--- a/cmd/mtd.c
|
||||
+++ b/cmd/mtd.c
|
||||
@@ -722,6 +722,42 @@ out_put_mtd:
|
||||
return CMD_RET_SUCCESS;
|
||||
}
|
||||
|
||||
+static int do_mtd_markbad(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char * const argv[])
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ loff_t off;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (argc < 3)
|
||||
+ return CMD_RET_USAGE;
|
||||
+
|
||||
+ mtd = get_mtd_by_name(argv[1]);
|
||||
+ if (IS_ERR(mtd) || !mtd)
|
||||
+ return CMD_RET_FAILURE;
|
||||
+
|
||||
+ if (!mtd_can_have_bb(mtd)) {
|
||||
+ printf("Only NAND-based devices can have mark blocks\n");
|
||||
+ goto out_put_mtd;
|
||||
+ }
|
||||
+
|
||||
+ off = simple_strtoull(argv[2], NULL, 0);
|
||||
+
|
||||
+ ret = mtd_block_markbad(mtd, off);
|
||||
+ if (!ret) {
|
||||
+ printf("MTD device %s block at 0x%08llx marked bad\n",
|
||||
+ mtd->name, off);
|
||||
+ } else {
|
||||
+ printf("MTD device %s block at 0x%08llx mark bad failed\n",
|
||||
+ mtd->name, off);
|
||||
+ }
|
||||
+
|
||||
+out_put_mtd:
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return CMD_RET_SUCCESS;
|
||||
+}
|
||||
+
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
static int mtd_name_complete(int argc, char *const argv[], char last_char,
|
||||
int maxv, char *cmdv[])
|
||||
@@ -769,6 +805,7 @@ U_BOOT_LONGHELP(mtd,
|
||||
"\n"
|
||||
"Specific functions:\n"
|
||||
"mtd bad <name>\n"
|
||||
+ "mtd markbad <name> <off>\n"
|
||||
#if CONFIG_IS_ENABLED(CMD_MTD_OTP)
|
||||
"mtd otpread <name> [u|f] <off> <size>\n"
|
||||
"mtd otpwrite <name> <off> <hex string>\n"
|
||||
@@ -809,4 +846,6 @@ U_BOOT_CMD_WITH_SUBCMDS(mtd, "MTD utils"
|
||||
U_BOOT_SUBCMD_MKENT_COMPLETE(erase, 4, 0, do_mtd_erase,
|
||||
mtd_name_complete),
|
||||
U_BOOT_SUBCMD_MKENT_COMPLETE(bad, 2, 1, do_mtd_bad,
|
||||
+ mtd_name_complete),
|
||||
+ U_BOOT_SUBCMD_MKENT_COMPLETE(markbad, 3, 1, do_mtd_markbad,
|
||||
mtd_name_complete));
|
||||
@@ -0,0 +1,260 @@
|
||||
From 240d98e6ad0aed3c11236aa40a60bbd6fe01fae5 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 10:50:46 +0800
|
||||
Subject: [PATCH 45/71] env: add support for NMBM upper MTD layer
|
||||
|
||||
Add an env driver for NMBM upper MTD layer
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/nvedit.c | 3 +-
|
||||
env/Kconfig | 19 ++++-
|
||||
env/Makefile | 1 +
|
||||
env/env.c | 3 +
|
||||
env/nmbm.c | 155 +++++++++++++++++++++++++++++++++++++++++
|
||||
include/env_internal.h | 1 +
|
||||
tools/Makefile | 1 +
|
||||
7 files changed, 180 insertions(+), 3 deletions(-)
|
||||
create mode 100644 env/nmbm.c
|
||||
|
||||
--- a/env/Kconfig
|
||||
+++ b/env/Kconfig
|
||||
@@ -59,6 +59,7 @@ config ENV_IS_DEFAULT
|
||||
def_bool y if !ENV_IS_IN_EEPROM && !ENV_IS_IN_EXT4 && \
|
||||
!ENV_IS_IN_FAT && !ENV_IS_IN_FLASH && \
|
||||
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
||||
+ !ENV_IS_IN_NMBM && \
|
||||
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
||||
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
||||
!ENV_IS_IN_UBI && !ENV_IS_IN_MTD
|
||||
@@ -315,6 +316,21 @@ config ENV_RANGE
|
||||
Specifying a range with more erase blocks than are needed to hold
|
||||
CONFIG_ENV_SIZE allows bad blocks within the range to be avoided.
|
||||
|
||||
+config ENV_IS_IN_NMBM
|
||||
+ bool "Environment in a NMBM upper MTD layer"
|
||||
+ depends on !CHAIN_OF_TRUST
|
||||
+ depends on NMBM_MTD
|
||||
+ help
|
||||
+ Define this if you have a NMBM upper MTD which you want to use for
|
||||
+ the environment.
|
||||
+
|
||||
+ - CONFIG_ENV_OFFSET:
|
||||
+ - CONFIG_ENV_SIZE:
|
||||
+
|
||||
+ These two #defines specify the offset and size of the environment
|
||||
+ area within the first NAND device. CONFIG_ENV_OFFSET must be
|
||||
+ aligned to an erase block boundary.
|
||||
+
|
||||
config ENV_IS_IN_NVRAM
|
||||
bool "Environment in a non-volatile RAM"
|
||||
depends on !CHAIN_OF_TRUST
|
||||
@@ -591,7 +607,7 @@ config ENV_MTD_NAME
|
||||
config ENV_OFFSET
|
||||
hex "Environment offset"
|
||||
depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
|
||||
- ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD
|
||||
+ ENV_IS_IN_SPI_FLASH || ENV_IS_IN_NMBM || ENV_IS_IN_MTD
|
||||
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
|
||||
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
|
||||
default 0xF0000 if ARCH_SUNXI
|
||||
--- a/env/Makefile
|
||||
+++ b/env/Makefile
|
||||
@@ -26,6 +26,7 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) +
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MTD) += mtd.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
|
||||
+obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NMBM) += nmbm.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
|
||||
|
||||
--- a/env/env.c
|
||||
+++ b/env/env.c
|
||||
@@ -52,6 +52,9 @@ static enum env_location env_locations[]
|
||||
#ifdef CONFIG_ENV_IS_IN_NAND
|
||||
ENVL_NAND,
|
||||
#endif
|
||||
+#ifdef CONFIG_ENV_IS_IN_NMBM
|
||||
+ ENVL_NMBM,
|
||||
+#endif
|
||||
#ifdef CONFIG_ENV_IS_IN_NVRAM
|
||||
ENVL_NVRAM,
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/env/nmbm.c
|
||||
@@ -0,0 +1,155 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <command.h>
|
||||
+#include <env.h>
|
||||
+#include <env_internal.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/stddef.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <malloc.h>
|
||||
+#include <memalign.h>
|
||||
+#include <search.h>
|
||||
+
|
||||
+#include <nmbm/nmbm-mtd.h>
|
||||
+
|
||||
+#if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_NMBM_MTD)
|
||||
+#define CMD_SAVEENV
|
||||
+#endif
|
||||
+
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+env_t *env_ptr = &environment;
|
||||
+#else /* ! ENV_IS_EMBEDDED */
|
||||
+env_t *env_ptr;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+static int env_nmbm_init(void)
|
||||
+{
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+ int crc1_ok = 0, crc2_ok = 0;
|
||||
+ env_t *tmp_env1;
|
||||
+
|
||||
+ tmp_env1 = env_ptr;
|
||||
+ crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
|
||||
+
|
||||
+ if (!crc1_ok && !crc2_ok) {
|
||||
+ gd->env_addr = 0;
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+
|
||||
+ return 0;
|
||||
+ } else if (crc1_ok && !crc2_ok) {
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ }
|
||||
+
|
||||
+ if (gd->env_valid == ENV_VALID)
|
||||
+ env_ptr = tmp_env1;
|
||||
+
|
||||
+ gd->env_addr = (ulong)env_ptr->data;
|
||||
+
|
||||
+#else /* ENV_IS_EMBEDDED */
|
||||
+ gd->env_addr = (ulong)&default_environment[0];
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CMD_SAVEENV
|
||||
+static int env_nmbm_save(void)
|
||||
+{
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
+ struct mtd_info *mtd;
|
||||
+ struct erase_info ei;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ ret = env_export(env_new);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ mtd = nmbm_mtd_get_upper_by_index(0);
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ printf("Erasing on NMBM...\n");
|
||||
+ memset(&ei, 0, sizeof(ei));
|
||||
+
|
||||
+ ei.mtd = mtd;
|
||||
+ ei.addr = CONFIG_ENV_OFFSET;
|
||||
+ ei.len = CONFIG_ENV_SIZE;
|
||||
+
|
||||
+ if (mtd_erase(mtd, &ei))
|
||||
+ return 1;
|
||||
+
|
||||
+ printf("Writing on NMBM... ");
|
||||
+ ret = mtd_write(mtd, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, NULL,
|
||||
+ (u_char *)env_new);
|
||||
+ puts(ret ? "FAILED!\n" : "OK\n");
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+#endif /* CMD_SAVEENV */
|
||||
+
|
||||
+static int readenv(size_t offset, u_char *buf)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ struct mtd_oob_ops ops;
|
||||
+ int ret;
|
||||
+ size_t len = CONFIG_ENV_SIZE;
|
||||
+
|
||||
+ mtd = nmbm_mtd_get_upper_by_index(0);
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ ops.mode = MTD_OPS_AUTO_OOB;
|
||||
+ ops.ooblen = 0;
|
||||
+ while(len > 0) {
|
||||
+ ops.datbuf = buf;
|
||||
+ ops.len = min(len, (size_t)mtd->writesize);
|
||||
+ ops.oobbuf = NULL;
|
||||
+
|
||||
+ ret = mtd_read_oob(mtd, offset, &ops);
|
||||
+ if (ret)
|
||||
+ return 1;
|
||||
+
|
||||
+ buf += mtd->writesize;
|
||||
+ len -= mtd->writesize;
|
||||
+ offset += mtd->writesize;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int env_nmbm_load(void)
|
||||
+{
|
||||
+#if !defined(ENV_IS_EMBEDDED)
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
|
||||
+ if (ret) {
|
||||
+ env_set_default("readenv() failed", 0);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return env_import(buf, 1, H_EXTERNAL);
|
||||
+#endif /* ! ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_ENV_LOCATION(nmbm) = {
|
||||
+ .location = ENVL_NMBM,
|
||||
+ ENV_NAME("NMBM")
|
||||
+ .load = env_nmbm_load,
|
||||
+#if defined(CMD_SAVEENV)
|
||||
+ .save = env_save_ptr(env_nmbm_save),
|
||||
+#endif
|
||||
+ .init = env_nmbm_init,
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -110,6 +110,7 @@ enum env_location {
|
||||
ENVL_MMC,
|
||||
ENVL_MTD,
|
||||
ENVL_NAND,
|
||||
+ ENVL_NMBM,
|
||||
ENVL_NVRAM,
|
||||
ENVL_ONENAND,
|
||||
ENVL_REMOTE,
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -39,6 +39,7 @@ ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
|
||||
+ENVCRC-$(CONFIG_ENV_IS_IN_NMBM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
|
||||
BUILD_ENVCRC ?= $(ENVCRC-y)
|
||||
@@ -0,0 +1,173 @@
|
||||
From 9e8ac4fc7125795ac5e8834aaf454fd45b99c580 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 10:53:03 +0800
|
||||
Subject: [PATCH 46/71] mtd: mtk-snand: add NMBM support for SPL
|
||||
|
||||
Add NMBM support for mtk-snand SPL loader
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/mtk-snand/mtk-snand-spl.c | 127 ++++++++++++++++++++++++++
|
||||
1 file changed, 127 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
+++ b/drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
@@ -13,12 +13,134 @@
|
||||
#include <mtd.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
+#include <nmbm/nmbm.h>
|
||||
+
|
||||
#include "mtk-snand.h"
|
||||
|
||||
static struct mtk_snand *snf;
|
||||
static struct mtk_snand_chip_info cinfo;
|
||||
static u32 oobavail;
|
||||
|
||||
+#ifdef CONFIG_ENABLE_NAND_NMBM
|
||||
+static struct nmbm_instance *ni;
|
||||
+
|
||||
+static int nmbm_lower_read_page(void *arg, uint64_t addr, void *buf, void *oob,
|
||||
+ enum nmbm_oob_mode mode)
|
||||
+{
|
||||
+ int ret;
|
||||
+ bool raw = mode == NMBM_MODE_RAW ? true : false;
|
||||
+
|
||||
+ if (mode == NMBM_MODE_AUTO_OOB) {
|
||||
+ ret = mtk_snand_read_page_auto_oob(snf, addr, buf, oob,
|
||||
+ oobavail, NULL, false);
|
||||
+ } else {
|
||||
+ ret = mtk_snand_read_page(snf, addr, buf, oob, raw);
|
||||
+ }
|
||||
+
|
||||
+ if (ret == -EBADMSG)
|
||||
+ return 1;
|
||||
+ else if (ret >= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_write_page(void *arg, uint64_t addr, const void *buf,
|
||||
+ const void *oob, enum nmbm_oob_mode mode)
|
||||
+{
|
||||
+ bool raw = mode == NMBM_MODE_RAW ? true : false;
|
||||
+
|
||||
+ if (mode == NMBM_MODE_AUTO_OOB) {
|
||||
+ return mtk_snand_write_page_auto_oob(snf, addr, buf, oob,
|
||||
+ oobavail, NULL, false);
|
||||
+ }
|
||||
+
|
||||
+ return mtk_snand_write_page(snf, addr, buf, oob, raw);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_erase_block(void *arg, uint64_t addr)
|
||||
+{
|
||||
+ return mtk_snand_erase_block(snf, addr);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_is_bad_block(void *arg, uint64_t addr)
|
||||
+{
|
||||
+ return mtk_snand_block_isbad(snf, addr);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_lower_mark_bad_block(void *arg, uint64_t addr)
|
||||
+{
|
||||
+ return mtk_snand_block_markbad(snf, addr);
|
||||
+}
|
||||
+
|
||||
+static void nmbm_lower_log(void *arg, enum nmbm_log_category level,
|
||||
+ const char *fmt, va_list ap)
|
||||
+{
|
||||
+ vprintf(fmt, ap);
|
||||
+}
|
||||
+
|
||||
+static int nmbm_init(void)
|
||||
+{
|
||||
+ struct nmbm_lower_device nld;
|
||||
+ size_t ni_size;
|
||||
+ int ret;
|
||||
+
|
||||
+ memset(&nld, 0, sizeof(nld));
|
||||
+
|
||||
+ nld.flags = NMBM_F_CREATE;
|
||||
+ nld.max_ratio = CONFIG_NMBM_MAX_RATIO;
|
||||
+ nld.max_reserved_blocks = CONFIG_NMBM_MAX_BLOCKS;
|
||||
+
|
||||
+ nld.size = cinfo.chipsize;
|
||||
+ nld.erasesize = cinfo.blocksize;
|
||||
+ nld.writesize = cinfo.pagesize;
|
||||
+ nld.oobsize = cinfo.sparesize;
|
||||
+ nld.oobavail = oobavail;
|
||||
+
|
||||
+ nld.read_page = nmbm_lower_read_page;
|
||||
+ nld.write_page = nmbm_lower_write_page;
|
||||
+ nld.erase_block = nmbm_lower_erase_block;
|
||||
+ nld.is_bad_block = nmbm_lower_is_bad_block;
|
||||
+ nld.mark_bad_block = nmbm_lower_mark_bad_block;
|
||||
+
|
||||
+ nld.logprint = nmbm_lower_log;
|
||||
+
|
||||
+ ni_size = nmbm_calc_structure_size(&nld);
|
||||
+ ni = malloc(ni_size);
|
||||
+ if (!ni) {
|
||||
+ printf("Failed to allocate memory (0x%u) for NMBM instance\n",
|
||||
+ ni_size);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ memset(ni, 0, ni_size);
|
||||
+
|
||||
+ printf("Initializing NMBM ...\n");
|
||||
+
|
||||
+ ret = nmbm_attach(&nld, ni);
|
||||
+ if (ret) {
|
||||
+ ni = NULL;
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
|
||||
+{
|
||||
+ size_t retlen;
|
||||
+
|
||||
+ if (!ni)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ nmbm_read_range(ni, offs, size, dst, NMBM_MODE_PLACE_OOB, &retlen);
|
||||
+ if (retlen != size)
|
||||
+ return -EIO;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#else
|
||||
static u8 *page_cache;
|
||||
|
||||
int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
|
||||
@@ -60,6 +182,7 @@ int nand_spl_load_image(uint32_t offs, u
|
||||
|
||||
return ret;
|
||||
}
|
||||
+#endif
|
||||
|
||||
void nand_init(void)
|
||||
{
|
||||
@@ -105,11 +228,15 @@ void nand_init(void)
|
||||
printf("SPI-NAND: %s (%uMB)\n", cinfo.model,
|
||||
(u32)(cinfo.chipsize >> 20));
|
||||
|
||||
+#ifdef CONFIG_ENABLE_NAND_NMBM
|
||||
+ nmbm_init();
|
||||
+#else
|
||||
page_cache = malloc(cinfo.pagesize + cinfo.sparesize);
|
||||
if (!page_cache) {
|
||||
mtk_snand_cleanup(snf);
|
||||
printf("mtk-snand-spl: failed to allocate page cache\n");
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
void nand_deselect(void)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,142 @@
|
||||
From c4172a95df8a57a66c70a8b9948b9600a01c4cb7 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 11:32:08 +0800
|
||||
Subject: [PATCH 49/71] mtd: spi-nor: add support to read flash unique ID
|
||||
|
||||
This patch adds support to read unique ID from spi-nor flashes.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/spi/spi-nor-core.c | 95 ++++++++++++++++++++++++++++++++++
|
||||
include/linux/mtd/spi-nor.h | 2 +
|
||||
2 files changed, 97 insertions(+)
|
||||
|
||||
--- a/drivers/mtd/spi/spi-nor-core.c
|
||||
+++ b/drivers/mtd/spi/spi-nor-core.c
|
||||
@@ -2908,6 +2908,100 @@ static int spi_nor_init_params(struct sp
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int spi_nor_read_uuid(struct spi_nor *nor)
|
||||
+{
|
||||
+ u8 read_opcode, addr_width, read_dummy;
|
||||
+ loff_t addr;
|
||||
+ u8 *uuid;
|
||||
+ u8 uuid_len;
|
||||
+ int shift = 0;
|
||||
+ int ret;
|
||||
+ int i;
|
||||
+ struct spi_mem_op op;
|
||||
+
|
||||
+ read_opcode = nor->read_opcode;
|
||||
+ addr_width = nor->addr_width;
|
||||
+ read_dummy = nor->read_dummy;
|
||||
+
|
||||
+ switch (JEDEC_MFR(nor->info)) {
|
||||
+ case SNOR_MFR_WINBOND:
|
||||
+ uuid_len = 8;
|
||||
+ nor->read_opcode = 0x4b;
|
||||
+ nor->addr_width = 0;
|
||||
+ addr = 0x0;
|
||||
+ nor->read_dummy = 4;
|
||||
+ break;
|
||||
+ case SNOR_MFR_GIGADEVICE:
|
||||
+ uuid_len = 16;
|
||||
+ nor->read_opcode = 0x4b;
|
||||
+ nor->addr_width = 3;
|
||||
+ addr = 0x0;
|
||||
+ nor->read_dummy = 1;
|
||||
+ break;
|
||||
+ case CFI_MFR_ST:
|
||||
+ case SNOR_MFR_MICRON:
|
||||
+ uuid_len = 17;
|
||||
+ shift = 3;
|
||||
+ nor->read_opcode = 0x9f;
|
||||
+ nor->addr_width = 0;
|
||||
+ addr = 0x0;
|
||||
+ nor->read_dummy = 0;
|
||||
+ break;
|
||||
+ case SNOR_MFR_EON:
|
||||
+ uuid_len = 12;
|
||||
+ nor->read_opcode = 0x5a;
|
||||
+ nor->addr_width = 3;
|
||||
+ addr = 0x80;
|
||||
+ nor->read_dummy = 1;
|
||||
+ break;
|
||||
+ /* Automotive only in SPANSION's NOR devices */
|
||||
+ case SNOR_MFR_SPANSION:
|
||||
+ uuid_len = 11;
|
||||
+ shift = 386;
|
||||
+ nor->read_opcode = 0x9f;
|
||||
+ nor->addr_width = 0;
|
||||
+ addr = 0x0;
|
||||
+ nor->read_dummy = 0;
|
||||
+ break;
|
||||
+ default:
|
||||
+ printf("UUID not supported on this device.\n");
|
||||
+ return -ENOTSUPP;
|
||||
+ }
|
||||
+
|
||||
+ uuid = kmalloc((uuid_len + shift) * sizeof(*uuid), GFP_KERNEL);
|
||||
+ if (!uuid) {
|
||||
+ ret = -ENOMEM;
|
||||
+ goto read_err;
|
||||
+ }
|
||||
+ memset(uuid, 0x0, (uuid_len + shift) * sizeof(*uuid));
|
||||
+
|
||||
+ op = (struct spi_mem_op)SPI_MEM_OP(SPI_MEM_OP_CMD(nor->read_opcode, 0),
|
||||
+ SPI_MEM_OP_ADDR(nor->addr_width, addr, 0),
|
||||
+ SPI_MEM_OP_DUMMY(nor->read_dummy, 0),
|
||||
+ SPI_MEM_OP_DATA_IN(uuid_len+shift, NULL, 0));
|
||||
+
|
||||
+ spi_nor_setup_op(nor, &op, nor->reg_proto);
|
||||
+
|
||||
+ ret = spi_nor_read_write_reg(nor, &op, uuid);
|
||||
+ if (ret < 0) {
|
||||
+ dev_dbg(nor->dev, "error %d reading %x\n", ret, nor->read_opcode);
|
||||
+ goto read_err;
|
||||
+ }
|
||||
+
|
||||
+ printf("UUID: 0x");
|
||||
+ for(i = 0; i<uuid_len; i++)
|
||||
+ printf("%02x", uuid[i+shift]);
|
||||
+ puts("\n");
|
||||
+
|
||||
+read_err:
|
||||
+ nor->read_opcode = read_opcode;
|
||||
+ nor->addr_width = addr_width;
|
||||
+ nor->read_dummy = read_dummy;
|
||||
+ kfree(uuid);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int spi_nor_hwcaps2cmd(u32 hwcaps, const int table[][2], size_t size)
|
||||
{
|
||||
size_t i;
|
||||
@@ -4027,6 +4121,7 @@ int spi_nor_scan(struct spi_nor *nor)
|
||||
nor->write = spi_nor_write_data;
|
||||
nor->read_reg = spi_nor_read_reg;
|
||||
nor->write_reg = spi_nor_write_reg;
|
||||
+ nor->read_uuid = spi_nor_read_uuid;
|
||||
|
||||
nor->setup = spi_nor_default_setup;
|
||||
|
||||
--- a/include/linux/mtd/spi-nor.h
|
||||
+++ b/include/linux/mtd/spi-nor.h
|
||||
@@ -29,6 +29,7 @@
|
||||
#define SNOR_MFR_SPANSION CFI_MFR_AMD
|
||||
#define SNOR_MFR_SST CFI_MFR_SST
|
||||
#define SNOR_MFR_WINBOND 0xef /* Also used by some Spansion */
|
||||
+#define SNOR_MFR_EON CFI_MFR_EON
|
||||
#define SNOR_MFR_CYPRESS 0x34
|
||||
|
||||
/*
|
||||
@@ -567,6 +568,7 @@ struct spi_nor {
|
||||
void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops);
|
||||
int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
|
||||
int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
|
||||
+ int (*read_uuid)(struct spi_nor *nor);
|
||||
|
||||
ssize_t (*read)(struct spi_nor *nor, loff_t from,
|
||||
size_t len, u_char *read_buf);
|
||||
@@ -0,0 +1,46 @@
|
||||
From e60939acbebd07161f3978d1c6f13123fdd2ebf2 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 11:27:02 +0800
|
||||
Subject: [PATCH 50/71] cmd: sf: add support to read flash unique ID
|
||||
|
||||
This patch adds support to display unique ID from spi-nor flashes
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/sf.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/cmd/sf.c
|
||||
+++ b/cmd/sf.c
|
||||
@@ -413,6 +413,14 @@ static int do_spi_protect(int argc, char
|
||||
return ret == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
+static int do_spi_flash_read_uuid(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+ ret = flash->read_uuid(flash);
|
||||
+
|
||||
+ return ret == 0 ? 0 : 1;
|
||||
+}
|
||||
+
|
||||
enum {
|
||||
STAGE_ERASE,
|
||||
STAGE_CHECK,
|
||||
@@ -607,6 +615,8 @@ static int do_spi_flash(struct cmd_tbl *
|
||||
ret = do_spi_flash_erase(argc, argv);
|
||||
else if (IS_ENABLED(CONFIG_SPI_FLASH_LOCK) && strcmp(cmd, "protect") == 0)
|
||||
ret = do_spi_protect(argc, argv);
|
||||
+ else if (strcmp(cmd, "uuid") == 0)
|
||||
+ ret = do_spi_flash_read_uuid();
|
||||
else if (IS_ENABLED(CONFIG_CMD_SF_TEST) && !strcmp(cmd, "test"))
|
||||
ret = do_spi_flash_test(argc, argv);
|
||||
else
|
||||
@@ -637,6 +647,7 @@ U_BOOT_LONGHELP(sf,
|
||||
#ifdef CONFIG_CMD_SF_TEST
|
||||
"\nsf test offset len - run a very basic destructive test"
|
||||
#endif
|
||||
+ "sf uuid - read uuid from flash"
|
||||
);
|
||||
|
||||
U_BOOT_CMD(
|
||||
@@ -0,0 +1,323 @@
|
||||
From 5a15437610e8e8c68dc347845a83d0cbad80ca08 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 19 Jan 2021 10:58:48 +0800
|
||||
Subject: [PATCH 51/71] cmd: bootmenu: add ability to select item by shortkey
|
||||
|
||||
Add ability to use shortkey to select item for bootmenu command
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/bootmenu.c | 34 ++++++++++++++++++++++++-----
|
||||
common/menu.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
include/menu.h | 12 +++++++----
|
||||
3 files changed, 93 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -89,6 +89,7 @@ static char *bootmenu_choice_entry(void
|
||||
struct bootmenu_data *menu = data;
|
||||
struct bootmenu_entry *iter;
|
||||
enum bootmenu_key key = BKEY_NONE;
|
||||
+ int choice = -1;
|
||||
int i;
|
||||
|
||||
cli_ch_init(cch);
|
||||
@@ -96,10 +97,10 @@ static char *bootmenu_choice_entry(void
|
||||
while (1) {
|
||||
if (menu->delay >= 0) {
|
||||
/* Autoboot was not stopped */
|
||||
- key = bootmenu_autoboot_loop(menu, cch);
|
||||
+ key = bootmenu_autoboot_loop(menu, cch, &choice);
|
||||
} else {
|
||||
/* Some key was pressed, so autoboot was stopped */
|
||||
- key = bootmenu_loop(menu, cch);
|
||||
+ key = bootmenu_loop(menu, cch, &choice);
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
@@ -113,6 +114,12 @@ static char *bootmenu_choice_entry(void
|
||||
++menu->active;
|
||||
/* no menu key selected, regenerate menu */
|
||||
return NULL;
|
||||
+ case BKEY_CHOICE:
|
||||
+ menu->active = choice;
|
||||
+ if (!menu->last_choiced) {
|
||||
+ menu->last_choiced = true;
|
||||
+ return NULL;
|
||||
+ }
|
||||
case BKEY_SELECT:
|
||||
iter = menu->first;
|
||||
for (i = 0; i < menu->active; ++i)
|
||||
@@ -170,6 +177,9 @@ static int prepare_bootmenu_entry(struct
|
||||
unsigned short int i = *index;
|
||||
struct bootmenu_entry *entry = NULL;
|
||||
struct bootmenu_entry *iter = *current;
|
||||
+ char *choice_option;
|
||||
+ char choice_char;
|
||||
+ int len;
|
||||
|
||||
while ((option = bootmenu_getoption(i))) {
|
||||
|
||||
@@ -184,11 +194,24 @@ static int prepare_bootmenu_entry(struct
|
||||
if (!entry)
|
||||
return -ENOMEM;
|
||||
|
||||
- entry->title = strndup(option, sep - option);
|
||||
+ /* Add KEY_CHOICE support: '%d. %s\0' : len --> len + 4 */
|
||||
+ len = sep - option + 4;
|
||||
+ choice_option = malloc(len);
|
||||
+ if (!choice_option) {
|
||||
+ free(entry->title);
|
||||
+ free(entry);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+ if (!get_choice_char(i, &choice_char))
|
||||
+ len = snprintf(choice_option, len, "%c. %s", choice_char, option);
|
||||
+ else
|
||||
+ len = snprintf(choice_option, len, " %s", option);
|
||||
+ entry->title = strndup(choice_option, len);
|
||||
if (!entry->title) {
|
||||
free(entry);
|
||||
return -ENOMEM;
|
||||
}
|
||||
+ free(choice_option);
|
||||
|
||||
entry->command = strdup(sep + 1);
|
||||
if (!entry->command) {
|
||||
@@ -334,6 +357,7 @@ static struct bootmenu_data *bootmenu_cr
|
||||
menu->delay = delay;
|
||||
menu->active = 0;
|
||||
menu->first = NULL;
|
||||
+ menu->last_choiced = false;
|
||||
|
||||
default_str = env_get("bootmenu_default");
|
||||
if (default_str)
|
||||
@@ -369,9 +393,9 @@ static struct bootmenu_data *bootmenu_cr
|
||||
|
||||
/* Add Quit entry if exiting bootmenu is disabled */
|
||||
if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE))
|
||||
- entry->title = strdup("Exit");
|
||||
+ entry->title = strdup("0. Exit");
|
||||
else
|
||||
- entry->title = strdup("Quit");
|
||||
+ entry->title = strdup("0. Quit");
|
||||
|
||||
if (!entry->title) {
|
||||
free(entry);
|
||||
--- a/common/menu.c
|
||||
+++ b/common/menu.c
|
||||
@@ -49,6 +49,33 @@ struct menu {
|
||||
int item_cnt;
|
||||
};
|
||||
|
||||
+const char choice_chars[] = {
|
||||
+ '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
+ 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
+ 'u', 'v', 'w', 'x', 'y', 'z'
|
||||
+};
|
||||
+
|
||||
+static int find_choice(char choice)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(choice_chars); i++)
|
||||
+ if (tolower(choice) == choice_chars[i])
|
||||
+ return i;
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int get_choice_char(int index, char *result)
|
||||
+{
|
||||
+ if (index < ARRAY_SIZE(choice_chars))
|
||||
+ *result = choice_chars[index];
|
||||
+ else
|
||||
+ return -1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* An iterator function for menu items. callback will be called for each item
|
||||
* in m, with m, a pointer to the item, and extra being passed to callback. If
|
||||
@@ -428,7 +455,7 @@ int menu_destroy(struct menu *m)
|
||||
}
|
||||
|
||||
enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu,
|
||||
- struct cli_ch_state *cch)
|
||||
+ struct cli_ch_state *cch, int *choice)
|
||||
{
|
||||
enum bootmenu_key key = BKEY_NONE;
|
||||
int i, c;
|
||||
@@ -463,6 +490,19 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
break;
|
||||
default:
|
||||
key = BKEY_NONE;
|
||||
+ if (cch->esc_len || !choice)
|
||||
+ break;
|
||||
+
|
||||
+ *choice = find_choice(c);
|
||||
+ if ((*choice >= 0 &&
|
||||
+ *choice < menu->count - 1)) {
|
||||
+ key = BKEY_CHOICE;
|
||||
+ } else if (c == '0') {
|
||||
+ *choice = menu->count - 1;
|
||||
+ key = BKEY_CHOICE;
|
||||
+ } else {
|
||||
+ key = BKEY_NONE;
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -483,7 +523,8 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
return key;
|
||||
}
|
||||
|
||||
-enum bootmenu_key bootmenu_conv_key(int ichar)
|
||||
+enum bootmenu_key bootmenu_conv_key(struct bootmenu_data *menu, int ichar,
|
||||
+ int *choice)
|
||||
{
|
||||
enum bootmenu_key key;
|
||||
|
||||
@@ -515,6 +556,20 @@ enum bootmenu_key bootmenu_conv_key(int
|
||||
case ' ':
|
||||
key = BKEY_SPACE;
|
||||
break;
|
||||
+ case '0' ... '9':
|
||||
+ case 'a' ... 'z':
|
||||
+ if (choice && menu) {
|
||||
+ *choice = find_choice(ichar);
|
||||
+ if ((*choice >= 0 && *choice < menu->count - 1)) {
|
||||
+ key = BKEY_CHOICE;
|
||||
+ break;
|
||||
+ } else if (ichar == '0') {
|
||||
+ *choice = menu->count - 1;
|
||||
+ key = BKEY_CHOICE;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ fallthrough;
|
||||
default:
|
||||
key = BKEY_NONE;
|
||||
break;
|
||||
@@ -524,11 +579,16 @@ enum bootmenu_key bootmenu_conv_key(int
|
||||
}
|
||||
|
||||
enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
|
||||
- struct cli_ch_state *cch)
|
||||
+ struct cli_ch_state *cch, int *choice)
|
||||
{
|
||||
enum bootmenu_key key;
|
||||
int c;
|
||||
|
||||
+ if (menu->last_choiced) {
|
||||
+ menu->last_choiced = false;
|
||||
+ return BKEY_SELECT;
|
||||
+ }
|
||||
+
|
||||
c = cli_ch_process(cch, 0);
|
||||
if (!c) {
|
||||
while (!c && !tstc()) {
|
||||
@@ -542,7 +602,7 @@ enum bootmenu_key bootmenu_loop(struct b
|
||||
}
|
||||
}
|
||||
|
||||
- key = bootmenu_conv_key(c);
|
||||
+ key = bootmenu_conv_key(menu, c, choice);
|
||||
|
||||
return key;
|
||||
}
|
||||
--- a/include/menu.h
|
||||
+++ b/include/menu.h
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef __MENU_H__
|
||||
#define __MENU_H__
|
||||
|
||||
+#include <linux/ctype.h>
|
||||
+
|
||||
struct cli_ch_state;
|
||||
struct menu;
|
||||
|
||||
@@ -19,6 +21,8 @@ int menu_get_choice(struct menu *m, void
|
||||
int menu_item_add(struct menu *m, char *item_key, void *item_data);
|
||||
int menu_destroy(struct menu *m);
|
||||
int menu_default_choice(struct menu *m, void **choice);
|
||||
+/* Add KEY_CHOICE support */
|
||||
+int get_choice_char(int index, char *result);
|
||||
|
||||
/**
|
||||
* menu_show() Show a boot menu
|
||||
@@ -41,6 +45,7 @@ struct bootmenu_data {
|
||||
int active; /* active menu entry */
|
||||
int count; /* total count of menu entries */
|
||||
struct bootmenu_entry *first; /* first menu entry */
|
||||
+ bool last_choiced;
|
||||
};
|
||||
|
||||
/** enum bootmenu_key - keys that can be returned by the bootmenu */
|
||||
@@ -51,6 +56,7 @@ enum bootmenu_key {
|
||||
BKEY_SELECT,
|
||||
BKEY_QUIT,
|
||||
BKEY_SAVE,
|
||||
+ BKEY_CHOICE,
|
||||
|
||||
/* 'extra' keys, which are used by menus but not cedit */
|
||||
BKEY_PLUS,
|
||||
@@ -81,7 +87,7 @@ enum bootmenu_key {
|
||||
* anything else: KEY_NONE
|
||||
*/
|
||||
enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu,
|
||||
- struct cli_ch_state *cch);
|
||||
+ struct cli_ch_state *cch, int *choice);
|
||||
|
||||
/**
|
||||
* bootmenu_loop() - handle waiting for a keypress when autoboot is disabled
|
||||
@@ -107,7 +113,7 @@ enum bootmenu_key bootmenu_autoboot_loop
|
||||
* Space: BKEY_SPACE
|
||||
*/
|
||||
enum bootmenu_key bootmenu_loop(struct bootmenu_data *menu,
|
||||
- struct cli_ch_state *cch);
|
||||
+ struct cli_ch_state *cch, int *choice);
|
||||
|
||||
/**
|
||||
* bootmenu_conv_key() - Convert a U-Boot keypress into a menu key
|
||||
@@ -115,6 +121,7 @@ enum bootmenu_key bootmenu_loop(struct b
|
||||
* @ichar: Keypress to convert (ASCII, including control characters)
|
||||
* Returns: Menu key that corresponds to @ichar, or BKEY_NONE if none
|
||||
*/
|
||||
-enum bootmenu_key bootmenu_conv_key(int ichar);
|
||||
+enum bootmenu_key bootmenu_conv_key(struct bootmenu_data *menu, int ichar,
|
||||
+ int *choice);
|
||||
|
||||
#endif /* __MENU_H__ */
|
||||
--- a/cmd/eficonfig.c
|
||||
+++ b/cmd/eficonfig.c
|
||||
@@ -239,7 +239,7 @@ char *eficonfig_choice_entry(void *data)
|
||||
cli_ch_init(cch);
|
||||
|
||||
while (1) {
|
||||
- key = bootmenu_loop((struct bootmenu_data *)efi_menu, cch);
|
||||
+ key = bootmenu_loop((struct bootmenu_data *)efi_menu, cch, NULL);
|
||||
|
||||
switch (key) {
|
||||
case BKEY_UP:
|
||||
@@ -1839,7 +1839,7 @@ char *eficonfig_choice_change_boot_order
|
||||
|
||||
cli_ch_init(cch);
|
||||
while (1) {
|
||||
- key = bootmenu_loop(NULL, cch);
|
||||
+ key = bootmenu_loop(NULL, cch, NULL);
|
||||
|
||||
switch (key) {
|
||||
case BKEY_PLUS:
|
||||
--- a/boot/bootflow_menu.c
|
||||
+++ b/boot/bootflow_menu.c
|
||||
@@ -234,7 +234,7 @@ int bootflow_menu_run(struct bootstd_pri
|
||||
|
||||
key = 0;
|
||||
if (ichar) {
|
||||
- key = bootmenu_conv_key(ichar);
|
||||
+ key = bootmenu_conv_key(NULL, ichar, NULL);
|
||||
if (key == BKEY_NONE)
|
||||
key = ichar;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
From 7ab891faaaf2b6126694352d4503dc40605a6aec Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 15:10:02 +0800
|
||||
Subject: [PATCH 52/71] common: spl: spl_nand: enable
|
||||
CONFIG_SYS_NAND_U_BOOT_OFFS undefined
|
||||
|
||||
Enable using spl_nand with CONFIG_SYS_NAND_U_BOOT_OFFS undefined since
|
||||
mtk-snand does not require raw nand framework.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
common/spl/spl_nand.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/common/spl/spl_nand.c
|
||||
+++ b/common/spl/spl_nand.c
|
||||
@@ -19,7 +19,11 @@
|
||||
|
||||
uint32_t __weak spl_nand_get_uboot_raw_page(void)
|
||||
{
|
||||
+#ifdef CONFIG_SYS_NAND_U_BOOT_OFFS
|
||||
return CONFIG_SYS_NAND_U_BOOT_OFFS;
|
||||
+#else
|
||||
+ return 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SPL_NAND_RAW_ONLY)
|
||||
@@ -0,0 +1,274 @@
|
||||
From 452dc98572f8353f77551bcce5a2ca8cd050f498 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:48:53 +0800
|
||||
Subject: [PATCH 53/71] board: mt7629: add support for booting from SPI-NAND
|
||||
|
||||
Add support for mt7629 to boot from SPI-NAND.
|
||||
Add a new defconfig for mt7629+spi-nand configuration.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7629-rfb-u-boot.dtsi | 8 ++
|
||||
arch/arm/dts/mt7629-rfb.dts | 10 +++
|
||||
arch/arm/dts/mt7629.dtsi | 16 ++++
|
||||
arch/arm/mach-mediatek/Kconfig | 4 +-
|
||||
board/mediatek/mt7629/Kconfig | 40 ++++++++++
|
||||
board/mediatek/mt7629/mt7629_rfb.c | 5 ++
|
||||
configs/mt7629_nand_rfb_defconfig | 113 ++++++++++++++++++++++++++++
|
||||
7 files changed, 195 insertions(+), 1 deletion(-)
|
||||
create mode 100644 board/mediatek/mt7629/Kconfig
|
||||
create mode 100644 configs/mt7629_nand_rfb_defconfig
|
||||
|
||||
--- a/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
@@ -40,3 +40,11 @@
|
||||
&snfi {
|
||||
bootph-all;
|
||||
};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+};
|
||||
+
|
||||
+&snand {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+};
|
||||
--- a/arch/arm/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7629-rfb.dts
|
||||
@@ -47,9 +47,12 @@
|
||||
};
|
||||
|
||||
snfi_pins: snfi-pins {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+
|
||||
mux {
|
||||
function = "flash";
|
||||
groups = "snfi";
|
||||
+ u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -102,6 +105,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
--- a/arch/arm/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/dts/mt7629.dtsi
|
||||
@@ -229,6 +229,22 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ snand: snand@1100d000 {
|
||||
+ compatible = "mediatek,mt7629-snand";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
snor: snor@11014000 {
|
||||
compatible = "mediatek,mtk-snor";
|
||||
reg = <0x11014000 0x1000>;
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -147,9 +147,11 @@ config SYS_CONFIG_NAME
|
||||
|
||||
config MTK_BROM_HEADER_INFO
|
||||
string
|
||||
- default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
|
||||
+ default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7622
|
||||
default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
|
||||
default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986 || TARGET_MT7988
|
||||
default "lk=1" if TARGET_MT7623
|
||||
|
||||
+source "board/mediatek/mt7629/Kconfig"
|
||||
+
|
||||
endif
|
||||
--- /dev/null
|
||||
+++ b/board/mediatek/mt7629/Kconfig
|
||||
@@ -0,0 +1,40 @@
|
||||
+if TARGET_MT7629
|
||||
+
|
||||
+config MTK_BROM_HEADER_INFO
|
||||
+ string
|
||||
+ default "media=nor" if BOOT_FROM_SNOR
|
||||
+ default "media=snand;nandinfo=2k+64" if BOOT_FROM_SNAND_2K_64
|
||||
+ default "media=snand;nandinfo=2k+128" if BOOT_FROM_SNAND_2K_128
|
||||
+ default "media=snand;nandinfo=4k+128" if BOOT_FROM_SNAND_4K_128
|
||||
+ default "media=snand;nandinfo=4k+256" if BOOT_FROM_SNAND_4K_256
|
||||
+
|
||||
+choice
|
||||
+ prompt "Boot device"
|
||||
+ default BOOT_FROM_SNOR
|
||||
+
|
||||
+config BOOT_FROM_SNOR
|
||||
+ bool "SPI-NOR"
|
||||
+
|
||||
+config BOOT_FROM_SNAND_2K_64
|
||||
+ bool "SPI-NAND (2K+64)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+config BOOT_FROM_SNAND_2K_128
|
||||
+ bool "SPI-NAND (2K+128)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+config BOOT_FROM_SNAND_4K_128
|
||||
+ bool "SPI-NAND (4K+128)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+config BOOT_FROM_SNAND_4K_256
|
||||
+ bool "SPI-NAND (4K+256)"
|
||||
+ select MT7629_BOOT_FROM_SNAND
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config MT7629_BOOT_FROM_SNAND
|
||||
+ bool
|
||||
+ default n
|
||||
+
|
||||
+endif
|
||||
--- a/board/mediatek/mt7629/mt7629_rfb.c
|
||||
+++ b/board/mediatek/mt7629/mt7629_rfb.c
|
||||
@@ -15,3 +15,8 @@ int board_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+uint32_t spl_nand_get_uboot_raw_page(void)
|
||||
+{
|
||||
+ return CONFIG_SPL_PAD_TO;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7629_nand_rfb_defconfig
|
||||
@@ -0,0 +1,113 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_ARCH_TIMER=y
|
||||
+CONFIG_SYS_THUMB_BUILD=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x0
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
+CONFIG_SPL_TEXT_BASE=0x201000
|
||||
+CONFIG_TARGET_MT7629=y
|
||||
+CONFIG_BOOT_FROM_SNAND_2K_64=y
|
||||
+CONFIG_SPL_SERIAL=y
|
||||
+CONFIG_SPL_STACK_R_ADDR=0x40800000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x42007f1c
|
||||
+CONFIG_SPL_PAYLOAD="u-boot.img"
|
||||
+CONFIG_BUILD_TARGET="u-boot-mtk.bin"
|
||||
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41fffef0
|
||||
+CONFIG_SPL_IMAGE="spl/u-boot-spl-mtk.bin"
|
||||
+CONFIG_FIT=y
|
||||
+# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7629-rfb"
|
||||
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+CONFIG_SPL_MAX_SIZE=0x20000
|
||||
+CONFIG_SPL_FOOTPRINT_LIMIT=y
|
||||
+CONFIG_SPL_MAX_FOOTPRINT=0x20000
|
||||
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
|
||||
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
|
||||
+CONFIG_SPL_STACK=0x106000
|
||||
+CONFIG_SPL_STACK_R=y
|
||||
+CONFIG_SPL_MTD_SUPPORT=y
|
||||
+CONFIG_SPL_NAND_SUPPORT=y
|
||||
+CONFIG_SPL_WATCHDOG=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+CONFIG_SYS_BOOTM_LEN=0x4000000
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_BIND=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+# CONFIG_CMD_FLASH is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+# CONFIG_CMD_NFS is not set
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_LOG=y
|
||||
+CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-parents"
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="u-boot-env"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SPL_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SPL_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_SPL_CLK=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_SPL_MTK_SPI_NAND=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_SPL_PINCTRL=y
|
||||
+CONFIG_SPL_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7629=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SPL_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_SPI_MEM=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_SYSRESET=y
|
||||
+CONFIG_SPL_SYSRESET=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=y
|
||||
+CONFIG_USB=y
|
||||
+# CONFIG_SPL_DM_USB is not set
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_WDT_MTK=y
|
||||
+# CONFIG_SHA256 is not set
|
||||
+# CONFIG_SPL_SHA1 is not set
|
||||
+CONFIG_LZMA=y
|
||||
+CONFIG_SPL_LZMA=y
|
||||
+# CONFIG_EFI_LOADER is not set
|
||||
@@ -0,0 +1,75 @@
|
||||
From 4c1803cc08b1618d935c1386f43f43a4e9c97697 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:51:43 +0800
|
||||
Subject: [PATCH 54/71] board: mt7622: use new spi-nand driver
|
||||
|
||||
Enable new spi-nand driver support for mt7622_rfb_defconfig
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7622-rfb.dts | 7 +++++++
|
||||
arch/arm/dts/mt7622.dtsi | 16 ++++++++++++++++
|
||||
configs/mt7622_rfb_defconfig | 5 +++++
|
||||
3 files changed, 28 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7622-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7622-rfb.dts
|
||||
@@ -196,6 +196,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
--- a/arch/arm/dts/mt7622.dtsi
|
||||
+++ b/arch/arm/dts/mt7622.dtsi
|
||||
@@ -77,6 +77,22 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ snand: snand@1100d000 {
|
||||
+ compatible = "mediatek,mt7622-snand";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
snor: snor@11014000 {
|
||||
compatible = "mediatek,mtk-snor";
|
||||
reg = <0x11014000 0x1000>;
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -22,6 +22,7 @@ CONFIG_SYS_PROMPT="MT7622> "
|
||||
CONFIG_SYS_MAXARGS=8
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
@@ -42,6 +43,9 @@ CONFIG_CLK=y
|
||||
CONFIG_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH_EON=y
|
||||
CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
@@ -0,0 +1,223 @@
|
||||
From d5841f8707dcb7a1f73607de67ab45dba93a56a4 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Fri, 29 Jul 2022 17:04:12 +0800
|
||||
Subject: [PATCH 55/71] board: mt7981: add reference board using new spi-nand
|
||||
driver
|
||||
|
||||
Add a new reference board using new spi-nand driver for SPI-NAND flash on
|
||||
SNFI interface
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/Makefile | 1 +
|
||||
arch/arm/dts/mt7981-snfi-nand-rfb.dts | 132 +++++++++++++++++++++++++
|
||||
configs/mt7981_snfi_nand_rfb_defconfig | 57 +++++++++++
|
||||
3 files changed, 190 insertions(+)
|
||||
create mode 100644 arch/arm/dts/mt7981-snfi-nand-rfb.dts
|
||||
create mode 100644 configs/mt7981_snfi_nand_rfb_defconfig
|
||||
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1225,6 +1225,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7623n-bananapi-bpi-r2.dtb \
|
||||
mt7629-rfb.dtb \
|
||||
mt7981-rfb.dtb \
|
||||
+ mt7981-snfi-nand-rfb.dtb \
|
||||
mt7981-emmc-rfb.dtb \
|
||||
mt7981-sd-rfb.dtb \
|
||||
mt7986a-bpi-r3-sd.dtb \
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-snfi-nand-rfb.dts
|
||||
@@ -0,0 +1,132 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2021 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "mt7981-rfb";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "sgmii";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ snfi_pins: snfi-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "snfi";
|
||||
+ };
|
||||
+
|
||||
+ clk {
|
||||
+ pins = "SPI0_CLK";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_6mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_6mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /* pin15 as pwm0 */
|
||||
+ one_pwm_pins: one-pwm-pins {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /* pin15 as pwm0 and pin14 as pwm1 */
|
||||
+ two_pwm_pins: two-pwm-pins {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1", "pwm1_0";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /* pin15 as pwm0, pin14 as pwm1, pin7 as pwm2 */
|
||||
+ three_pwm_pins: three-pwm-pins {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1", "pwm1_0", "pwm2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ mmc0_pins_default: mmc0default {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "emmc_45";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&two_pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_snfi_nand_rfb_defconfig
|
||||
@@ -0,0 +1,57 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-snfi-nand-rfb"
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7981-snfi-nand-rfb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_SYS_CBSIZE=512
|
||||
+CONFIG_SYS_PBSIZE=1049
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_MTDIDS_DEFAULT="spi-nand0=spi-nand0"
|
||||
+CONFIG_MTDPARTS_DEFAULT="spi-nand0:1024k(bl2),512k(u-boot-env),2048k(factory),2048k(fip),65536k(ubi)"
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
@@ -0,0 +1,76 @@
|
||||
From a2df2df6fd1aec32572c7b30ccf5a184ec1763fd Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 27 Jul 2022 16:32:17 +0800
|
||||
Subject: [PATCH 56/71] mtd: spi-nor: add more flash ids
|
||||
|
||||
Add more spi-nor flash ids
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/spi/spi-nor-core.c | 1 +
|
||||
drivers/mtd/spi/spi-nor-ids.c | 23 ++++++++++++++++++++++-
|
||||
2 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mtd/spi/spi-nor-core.c
|
||||
+++ b/drivers/mtd/spi/spi-nor-core.c
|
||||
@@ -698,6 +698,7 @@ static int set_4byte(struct spi_nor *nor
|
||||
case SNOR_MFR_ISSI:
|
||||
case SNOR_MFR_MACRONIX:
|
||||
case SNOR_MFR_WINBOND:
|
||||
+ case SNOR_MFR_EON:
|
||||
if (need_wren)
|
||||
write_enable(nor);
|
||||
|
||||
--- a/drivers/mtd/spi/spi-nor-ids.c
|
||||
+++ b/drivers/mtd/spi/spi-nor-ids.c
|
||||
@@ -84,7 +84,8 @@ const struct flash_info spi_nor_ids[] =
|
||||
{ INFO("en25q32b", 0x1c3016, 0, 64 * 1024, 64, 0) },
|
||||
{ INFO("en25q64", 0x1c3017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
{ INFO("en25q128b", 0x1c3018, 0, 64 * 1024, 256, 0) },
|
||||
- { INFO("en25qh128", 0x1c7018, 0, 64 * 1024, 256, 0) },
|
||||
+ { INFO("en25qh128", 0x1c7018, 0, 64 * 1024, 256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
+ { INFO("en25qh256", 0x1c7019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ INFO("en25s64", 0x1c3817, 0, 64 * 1024, 128, SECT_4K) },
|
||||
#endif
|
||||
#ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */
|
||||
@@ -150,6 +151,11 @@ const struct flash_info spi_nor_ids[] =
|
||||
{INFO("gd55x02g", 0xc8481C, 0, 64 * 1024, 4096, SECT_4K |
|
||||
SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES)},
|
||||
{
|
||||
+ INFO("gd25q256", 0xc84019, 0, 64 * 1024, 512,
|
||||
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
+ },
|
||||
+ {
|
||||
INFO("gd25lq128", 0xc86018, 0, 64 * 1024, 256,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
@@ -489,6 +495,16 @@ const struct flash_info spi_nor_ids[] =
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
},
|
||||
{
|
||||
+ INFO("w25q256jv", 0xef7019, 0, 64 * 1024, 512,
|
||||
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
+ },
|
||||
+ {
|
||||
+ INFO("w25q512jv", 0xef7020, 0, 64 * 1024, 1024,
|
||||
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
+ },
|
||||
+ {
|
||||
INFO("w25q128jw", 0xef8018, 0, 64 * 1024, 256,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
@@ -548,6 +564,11 @@ const struct flash_info spi_nor_ids[] =
|
||||
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
},
|
||||
{ INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
+ {
|
||||
+ INFO("w25q512", 0xef4020, 0, 64 * 1024, 1024,
|
||||
+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
|
||||
+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
|
||||
+ },
|
||||
{ INFO("w25m512jw", 0xef6119, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ INFO("w25m512jv", 0xef7119, 0, 64 * 1024, 1024, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
{ INFO("w25h02jv", 0xef9022, 0, 64 * 1024, 4096, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
@@ -0,0 +1,550 @@
|
||||
From 8d0665327819c41fce2c8d50f19c967b22eae564 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 27 Jul 2022 16:36:13 +0800
|
||||
Subject: [PATCH 57/71] mtd: spi-nand: backport from upstream kernel
|
||||
|
||||
Backport new features from upstream kernel
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/Kconfig | 1 +
|
||||
drivers/mtd/nand/spi/Makefile | 2 +-
|
||||
drivers/mtd/nand/spi/core.c | 102 ++++++----
|
||||
drivers/mtd/nand/spi/etron.c | 181 +++++++++++++++++
|
||||
drivers/mtd/nand/spi/gigadevice.c | 322 ++++++++++++++++++++++++++----
|
||||
drivers/mtd/nand/spi/macronix.c | 173 +++++++++++++---
|
||||
drivers/mtd/nand/spi/micron.c | 50 ++---
|
||||
drivers/mtd/nand/spi/toshiba.c | 66 +++---
|
||||
drivers/mtd/nand/spi/winbond.c | 164 ++++++++++++---
|
||||
include/linux/mtd/spinand.h | 87 +++++---
|
||||
10 files changed, 923 insertions(+), 225 deletions(-)
|
||||
create mode 100644 drivers/mtd/nand/spi/etron.c
|
||||
|
||||
--- a/drivers/mtd/nand/spi/Makefile
|
||||
+++ b/drivers/mtd/nand/spi/Makefile
|
||||
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
-spinand-objs := core.o esmt.o gigadevice.o macronix.o micron.o paragon.o
|
||||
+spinand-objs := core.o esmt.o etron.o gigadevice.o macronix.o micron.o paragon.o
|
||||
spinand-objs += toshiba.o winbond.o xtx.o
|
||||
obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -822,6 +822,7 @@ static const struct nand_ops spinand_ops
|
||||
};
|
||||
|
||||
static const struct spinand_manufacturer *spinand_manufacturers[] = {
|
||||
+ &etron_spinand_manufacturer,
|
||||
&gigadevice_spinand_manufacturer,
|
||||
¯onix_spinand_manufacturer,
|
||||
µn_spinand_manufacturer,
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nand/spi/etron.c
|
||||
@@ -0,0 +1,181 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2020 Etron Technology, Inc.
|
||||
+ *
|
||||
+ */
|
||||
+#ifndef __UBOOT__
|
||||
+#include <malloc.h>
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#endif
|
||||
+#include <linux/bug.h>
|
||||
+#include <linux/mtd/spinand.h>
|
||||
+
|
||||
+#define SPINAND_MFR_ETRON 0xD5
|
||||
+
|
||||
+#define STATUS_ECC_LIMIT_BITFLIPS (3 << 4)
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(read_cache_variants,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(write_cache_variants,
|
||||
+ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
|
||||
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
|
||||
+
|
||||
+static SPINAND_OP_VARIANTS(update_cache_variants,
|
||||
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
|
||||
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
|
||||
+
|
||||
+static int etron_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (14 * section) + 72;
|
||||
+ region->length = 14;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int etron_ooblayout_free(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ if (section) {
|
||||
+ region->offset = 18 * section;
|
||||
+ region->length = 18;
|
||||
+ } else {
|
||||
+ /* section 0 has one byte reserved for bad block mark */
|
||||
+ region->offset = 2;
|
||||
+ region->length = 16;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct mtd_ooblayout_ops etron_ooblayout = {
|
||||
+ .ecc = etron_ooblayout_ecc,
|
||||
+ .rfree = etron_ooblayout_free,
|
||||
+};
|
||||
+
|
||||
+static int etron_ecc_get_status(struct spinand_device *spinand,
|
||||
+ u8 status)
|
||||
+{
|
||||
+ struct nand_device *nand = spinand_to_nand(spinand);
|
||||
+
|
||||
+ switch (status & STATUS_ECC_MASK) {
|
||||
+ case STATUS_ECC_NO_BITFLIPS:
|
||||
+ return 0;
|
||||
+
|
||||
+ case STATUS_ECC_UNCOR_ERROR:
|
||||
+ return -EBADMSG;
|
||||
+
|
||||
+ case STATUS_ECC_HAS_BITFLIPS:
|
||||
+ return nand->eccreq.strength >> 1;
|
||||
+
|
||||
+ case STATUS_ECC_LIMIT_BITFLIPS:
|
||||
+ return nand->eccreq.strength;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
+static const struct spinand_info etron_spinand_table[] = {
|
||||
+ /* EM73C 1Gb 3.3V */
|
||||
+ SPINAND_INFO("EM73C044VCF",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x25),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ /* EM7xD 2Gb */
|
||||
+ SPINAND_INFO("EM73D044VCR",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x41),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ SPINAND_INFO("EM73D044VCO",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x3A),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ SPINAND_INFO("EM78D044VCM",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x8E),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ /* EM7xE 4Gb */
|
||||
+ SPINAND_INFO("EM73E044VCE",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x3B),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ SPINAND_INFO("EM78E044VCD",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x8F),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ /* EM7xF044VCA 8Gb */
|
||||
+ SPINAND_INFO("EM73F044VCA",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x15),
|
||||
+ NAND_MEMORG(1, 4096, 256, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+ SPINAND_INFO("EM78F044VCA",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x8D),
|
||||
+ NAND_MEMORG(1, 4096, 256, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&etron_ooblayout, etron_ecc_get_status)),
|
||||
+};
|
||||
+
|
||||
+static const struct spinand_manufacturer_ops etron_spinand_manuf_ops = {
|
||||
+};
|
||||
+
|
||||
+const struct spinand_manufacturer etron_spinand_manufacturer = {
|
||||
+ .id = SPINAND_MFR_ETRON,
|
||||
+ .name = "Etron",
|
||||
+ .chips = etron_spinand_table,
|
||||
+ .nchips = ARRAY_SIZE(etron_spinand_table),
|
||||
+ .ops = &etron_spinand_manuf_ops,
|
||||
+};
|
||||
--- a/drivers/mtd/nand/spi/gigadevice.c
|
||||
+++ b/drivers/mtd/nand/spi/gigadevice.c
|
||||
@@ -43,6 +43,24 @@ static SPINAND_OP_VARIANTS(read_cache_va
|
||||
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
|
||||
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
|
||||
|
||||
+/* Q5 1Gb */
|
||||
+static SPINAND_OP_VARIANTS(dummy2_read_cache_variants,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
+/* Q5 2Gb & 4Gb */
|
||||
+static SPINAND_OP_VARIANTS(dummy4_read_cache_variants,
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
||||
+
|
||||
static SPINAND_OP_VARIANTS(write_cache_variants,
|
||||
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
|
||||
SPINAND_PROG_LOAD(true, 0, NULL, 0));
|
||||
@@ -268,7 +286,45 @@ static int gd5fxgq4ufxxg_ecc_get_status(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+static int esmt_1_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (16 * section) + 8;
|
||||
+ region->length = 8;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int esmt_1_ooblayout_free(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (16 * section) + 2;
|
||||
+ region->length = 6;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct mtd_ooblayout_ops esmt_1_ooblayout = {
|
||||
+ .ecc = esmt_1_ooblayout_ecc,
|
||||
+ .rfree = esmt_1_ooblayout_free,
|
||||
+ };
|
||||
+
|
||||
static const struct spinand_info gigadevice_spinand_table[] = {
|
||||
+ SPINAND_INFO("F50L1G41LB",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&dummy2_read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ 0,
|
||||
+ SPINAND_ECCINFO(&esmt_1_ooblayout, NULL)),
|
||||
SPINAND_INFO("GD5F1GQ4xA",
|
||||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf1),
|
||||
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
@@ -349,6 +405,87 @@ static const struct spinand_info gigadev
|
||||
SPINAND_HAS_QE_BIT,
|
||||
SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ5UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x52),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&dummy4_read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GQ6UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x55),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&dummy4_read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GM7UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x91),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GM7UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x92),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GM8UExxG",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x95),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
|
||||
+ NAND_ECCREQ(8, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq4uexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F1GQ5UExxH",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x31),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&dummy2_read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F2GQ5UExxH",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x32),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&dummy4_read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+ SPINAND_INFO("GD5F4GQ6UExxH",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 4096, 40, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&dummy4_read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ SPINAND_HAS_QE_BIT,
|
||||
+ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
|
||||
+ gd5fxgq5xexxg_ecc_get_status)),
|
||||
+
|
||||
};
|
||||
|
||||
static const struct spinand_manufacturer_ops gigadevice_spinand_manuf_ops = {
|
||||
--- a/drivers/mtd/nand/spi/winbond.c
|
||||
+++ b/drivers/mtd/nand/spi/winbond.c
|
||||
@@ -18,6 +18,23 @@
|
||||
|
||||
#define WINBOND_CFG_BUF_READ BIT(3)
|
||||
|
||||
+#define W25N02_N04KV_STATUS_ECC_MASK (3 << 4)
|
||||
+#define W25N02_N04KV_STATUS_ECC_NO_BITFLIPS (0 << 4)
|
||||
+#define W25N02_N04KV_STATUS_ECC_1_4_BITFLIPS (1 << 4)
|
||||
+#define W25N02_N04KV_STATUS_ECC_5_8_BITFLIPS (3 << 4)
|
||||
+#define W25N02_N04KV_STATUS_ECC_UNCOR_ERROR (2 << 4)
|
||||
+
|
||||
+#define W25N01_M02GV_STATUS_ECC_MASK (3 << 4)
|
||||
+#define W25N01_M02GV_STATUS_ECC_NO_BITFLIPS (0 << 4)
|
||||
+#define W25N01_M02GV_STATUS_ECC_1_BITFLIPS (1 << 4)
|
||||
+#define W25N01_M02GV_STATUS_ECC_UNCOR_ERROR (2 << 4)
|
||||
+
|
||||
+#define W25N01KV_STATUS_ECC_MASK (3 << 4)
|
||||
+#define W25N01KV_STATUS_ECC_NO_BITFLIPS (0 << 4)
|
||||
+#define W25N01KV_STATUS_ECC_1_3_BITFLIPS (1 << 4)
|
||||
+#define W25N01KV_STATUS_ECC_4_BITFLIPS (3 << 4)
|
||||
+#define W25N01KV_STATUS_ECC_UNCOR_ERROR (2 << 4)
|
||||
+
|
||||
static SPINAND_OP_VARIANTS(read_cache_variants,
|
||||
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
|
||||
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
||||
@@ -34,6 +51,35 @@ static SPINAND_OP_VARIANTS(update_cache_
|
||||
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
|
||||
SPINAND_PROG_LOAD(false, 0, NULL, 0));
|
||||
|
||||
+static int w25n02kv_n04kv_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (16 * section) + 64;
|
||||
+ region->length = 16;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int w25n02kv_n04kv_ooblayout_free(struct mtd_info *mtd, int section,
|
||||
+ struct mtd_oob_region *region)
|
||||
+{
|
||||
+ if (section > 3)
|
||||
+ return -ERANGE;
|
||||
+
|
||||
+ region->offset = (16 * section) + 2;
|
||||
+ region->length = 14;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct mtd_ooblayout_ops w25n02kv_n04kv_ooblayout = {
|
||||
+ .ecc = w25n02kv_n04kv_ooblayout_ecc,
|
||||
+ .rfree = w25n02kv_n04kv_ooblayout_free,
|
||||
+};
|
||||
+
|
||||
static int w25m02gv_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
struct mtd_oob_region *region)
|
||||
{
|
||||
@@ -106,6 +152,58 @@ static const struct mtd_ooblayout_ops w2
|
||||
.rfree = w25n02kv_ooblayout_free,
|
||||
};
|
||||
|
||||
+static int w25n01kv_ecc_get_status(struct spinand_device *spinand,
|
||||
+ u8 status)
|
||||
+{
|
||||
+ switch (status & W25N01KV_STATUS_ECC_MASK) {
|
||||
+ case W25N01KV_STATUS_ECC_NO_BITFLIPS:
|
||||
+ return 0;
|
||||
+
|
||||
+ case W25N01KV_STATUS_ECC_1_3_BITFLIPS:
|
||||
+ return 3;
|
||||
+
|
||||
+ case W25N01KV_STATUS_ECC_4_BITFLIPS:
|
||||
+ return 4;
|
||||
+
|
||||
+ case W25N01KV_STATUS_ECC_UNCOR_ERROR:
|
||||
+ return -EBADMSG;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
+static int w25n02kv_n04kv_ecc_get_status(struct spinand_device *spinand,
|
||||
+ u8 status)
|
||||
+{
|
||||
+ switch (status & W25N02_N04KV_STATUS_ECC_MASK) {
|
||||
+ case W25N02_N04KV_STATUS_ECC_NO_BITFLIPS:
|
||||
+ return 0;
|
||||
+
|
||||
+ case W25N02_N04KV_STATUS_ECC_1_4_BITFLIPS:
|
||||
+ return 3;
|
||||
+
|
||||
+ case W25N02_N04KV_STATUS_ECC_5_8_BITFLIPS:
|
||||
+ return 4;
|
||||
+
|
||||
+ /* W25N02_N04KV_use internal 8bit ECC algorithm.
|
||||
+ * But the ECC strength is 4 bit requried.
|
||||
+ * Return 3 if the bit bit flip count less than 5.
|
||||
+ * Return 4 if the bit bit flip count more than 5 to 8.
|
||||
+ */
|
||||
+
|
||||
+ case W25N02_N04KV_STATUS_ECC_UNCOR_ERROR:
|
||||
+ return -EBADMSG;
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
|
||||
u8 status)
|
||||
{
|
||||
@@ -163,6 +261,15 @@ static const struct spinand_info winbond
|
||||
&update_cache_variants),
|
||||
0,
|
||||
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
|
||||
+ SPINAND_INFO("W25N01KV",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21),
|
||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ 0,
|
||||
+ SPINAND_ECCINFO(&w25n02kv_n04kv_ooblayout, w25n01kv_ecc_get_status)),
|
||||
SPINAND_INFO("W25N02KV",
|
||||
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x22),
|
||||
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|
||||
@@ -172,6 +279,16 @@ static const struct spinand_info winbond
|
||||
&update_cache_variants),
|
||||
0,
|
||||
SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)),
|
||||
+ SPINAND_INFO("W25N04KV",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x23),
|
||||
+ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 2, 1, 1),
|
||||
+ NAND_ECCREQ(4, 512),
|
||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
||||
+ &write_cache_variants,
|
||||
+ &update_cache_variants),
|
||||
+ 0,
|
||||
+ SPINAND_ECCINFO(&w25n02kv_n04kv_ooblayout,
|
||||
+ w25n02kv_n04kv_ecc_get_status)),
|
||||
};
|
||||
|
||||
static int winbond_spinand_init(struct spinand_device *spinand)
|
||||
--- a/include/linux/mtd/spinand.h
|
||||
+++ b/include/linux/mtd/spinand.h
|
||||
@@ -244,6 +244,7 @@ struct spinand_manufacturer {
|
||||
};
|
||||
|
||||
/* SPI NAND manufacturers */
|
||||
+extern const struct spinand_manufacturer etron_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer macronix_spinand_manufacturer;
|
||||
extern const struct spinand_manufacturer micron_spinand_manufacturer;
|
||||
@@ -0,0 +1,78 @@
|
||||
From 793bed29e78cc54d989333d756fef51efaca4e56 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 26 Jul 2022 09:29:18 +0800
|
||||
Subject: [PATCH 58/71] mmc: mtk-sd: add support to display verbose error log
|
||||
|
||||
Add an option to enable debug log, and also display verbose error log for
|
||||
both command and data.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mmc/Kconfig | 8 ++++++++
|
||||
drivers/mmc/Makefile | 4 ++++
|
||||
drivers/mmc/mtk-sd.c | 24 +++++++++++++++---------
|
||||
3 files changed, 27 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/drivers/mmc/Kconfig
|
||||
+++ b/drivers/mmc/Kconfig
|
||||
@@ -855,6 +855,14 @@ config MMC_MTK
|
||||
This is needed if support for any SD/SDIO/MMC devices is required.
|
||||
If unsure, say N.
|
||||
|
||||
+config MMC_MTK_DEBUG
|
||||
+ bool "Display verbose error log"
|
||||
+ default n
|
||||
+ depends on MMC_MTK
|
||||
+ help
|
||||
+ Enable this option to allow verbose error log being displayed for
|
||||
+ debugging.
|
||||
+
|
||||
endif
|
||||
|
||||
config FSL_SDHC_V2_3
|
||||
--- a/drivers/mmc/Makefile
|
||||
+++ b/drivers/mmc/Makefile
|
||||
@@ -83,3 +83,7 @@ obj-$(CONFIG_RENESAS_SDHI) += tmio-comm
|
||||
obj-$(CONFIG_MMC_BCM2835) += bcm2835_sdhost.o
|
||||
obj-$(CONFIG_MMC_MTK) += mtk-sd.o
|
||||
obj-$(CONFIG_MMC_SDHCI_F_SDH30) += f_sdh30.o
|
||||
+
|
||||
+ifdef CONFIG_MMC_MTK_DEBUG
|
||||
+CFLAGS_mtk-sd.o += -DDEBUG
|
||||
+endif
|
||||
--- a/drivers/mmc/mtk-sd.c
|
||||
+++ b/drivers/mmc/mtk-sd.c
|
||||
@@ -779,18 +779,24 @@ static int msdc_ops_send_cmd(struct udev
|
||||
if (cmd_ret &&
|
||||
!(cmd_ret == -EIO &&
|
||||
(cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
|
||||
- cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)))
|
||||
+ cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200))) {
|
||||
+ dev_dbg(dev, "MSDC start command failure with %d, cmd=%d, arg=0x%x\n",
|
||||
+ cmd_ret, cmd->cmdidx, cmd->cmdarg);
|
||||
return cmd_ret;
|
||||
-
|
||||
- if (data) {
|
||||
- data_ret = msdc_start_data(host, data);
|
||||
- if (cmd_ret)
|
||||
- return cmd_ret;
|
||||
- else
|
||||
- return data_ret;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ if (!data)
|
||||
+ return cmd_ret;
|
||||
+
|
||||
+ data_ret = msdc_start_data(host, data);
|
||||
+ if (cmd_ret)
|
||||
+ return cmd_ret;
|
||||
+
|
||||
+ if (data_ret)
|
||||
+ dev_dbg(dev, "MSDC start data failure with %d, cmd=%d, arg=0x%x\n",
|
||||
+ data_ret, cmd->cmdidx, cmd->cmdarg);
|
||||
+
|
||||
+ return data_ret;
|
||||
}
|
||||
|
||||
static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks)
|
||||
@@ -0,0 +1,58 @@
|
||||
From dd66fc817f7ab7a4fcab9836a9251a8f64f329df Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 16:58:36 +0800
|
||||
Subject: [PATCH 59/71] cmd: ubi: make volume find/create/remove APIs public
|
||||
|
||||
Export ubi_create_vol/ubi_find_volume/ubi_remove_vol to public so that they
|
||||
can be used by other programs.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/ubi.c | 8 ++++----
|
||||
include/ubi_uboot.h | 4 ++++
|
||||
2 files changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/cmd/ubi.c
|
||||
+++ b/cmd/ubi.c
|
||||
@@ -213,8 +213,8 @@ bad:
|
||||
return err;
|
||||
}
|
||||
|
||||
-static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
|
||||
- bool skipcheck)
|
||||
+int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
|
||||
+ bool skipcheck)
|
||||
{
|
||||
struct ubi_mkvol_req req;
|
||||
int err;
|
||||
@@ -247,7 +247,7 @@ static int ubi_create_vol(char *volume,
|
||||
return ubi_create_volume(ubi, &req);
|
||||
}
|
||||
|
||||
-static struct ubi_volume *ubi_find_volume(char *volume)
|
||||
+struct ubi_volume *ubi_find_volume(char *volume)
|
||||
{
|
||||
struct ubi_volume *vol = NULL;
|
||||
int i;
|
||||
@@ -262,7 +262,7 @@ static struct ubi_volume *ubi_find_volum
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static int ubi_remove_vol(char *volume)
|
||||
+int ubi_remove_vol(char *volume)
|
||||
{
|
||||
int err, reserved_pebs, i;
|
||||
struct ubi_volume *vol;
|
||||
--- a/include/ubi_uboot.h
|
||||
+++ b/include/ubi_uboot.h
|
||||
@@ -50,6 +50,10 @@ extern void ubi_exit(void);
|
||||
extern int ubi_part(char *part_name, const char *vid_header_offset);
|
||||
extern int ubi_volume_write(char *volume, void *buf, size_t size);
|
||||
extern int ubi_volume_read(char *volume, char *buf, size_t size);
|
||||
+extern int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id,
|
||||
+ bool skipcheck);
|
||||
+extern struct ubi_volume *ubi_find_volume(char *volume);
|
||||
+extern int ubi_remove_vol(char *volume);
|
||||
|
||||
extern struct ubi_device *ubi_devices[];
|
||||
int cmd_ubifs_mount(char *vol_name);
|
||||
@@ -0,0 +1,27 @@
|
||||
From f6a4130959af1e6d13d616203e42ed3c894666ad Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 17:00:00 +0800
|
||||
Subject: [PATCH 60/71] cmd: ubi: allow creating volume with all free spaces
|
||||
|
||||
Allow creating volume with all free spaces by giving a negative size value.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/ubi.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/cmd/ubi.c
|
||||
+++ b/cmd/ubi.c
|
||||
@@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t
|
||||
|
||||
req.vol_id = vol_id;
|
||||
req.alignment = 1;
|
||||
- req.bytes = size;
|
||||
+
|
||||
+ if (size < 0)
|
||||
+ req.bytes = ubi->avail_pebs * ubi->leb_size;
|
||||
+ else
|
||||
+ req.bytes = size;
|
||||
|
||||
strcpy(req.name, volume);
|
||||
req.name_len = strlen(volume);
|
||||
@@ -0,0 +1,72 @@
|
||||
From fc0c70a7c6a088072d0c77e5a59d5e9b7754c6db Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 17:01:20 +0800
|
||||
Subject: [PATCH 61/71] env: ubi: add support to create environment volume if
|
||||
it does not exist
|
||||
|
||||
Add an option to allow environment volume being auto created if not exist.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
env/Kconfig | 6 ++++++
|
||||
env/ubi.c | 20 ++++++++++++++++++++
|
||||
2 files changed, 26 insertions(+)
|
||||
|
||||
--- a/env/Kconfig
|
||||
+++ b/env/Kconfig
|
||||
@@ -689,6 +689,12 @@ config ENV_UBI_VOLUME_REDUND
|
||||
help
|
||||
Name of the redundant volume that you want to store the environment in.
|
||||
|
||||
+config ENV_UBI_VOLUME_CREATE
|
||||
+ bool "Create UBI volume if not exist"
|
||||
+ depends on ENV_IS_IN_UBI
|
||||
+ help
|
||||
+ Create the UBI volume if it does not exist.
|
||||
+
|
||||
config ENV_UBI_VID_OFFSET
|
||||
int "ubi environment VID offset"
|
||||
depends on ENV_IS_IN_UBI
|
||||
--- a/env/ubi.c
|
||||
+++ b/env/ubi.c
|
||||
@@ -106,6 +106,18 @@ static int env_ubi_save(void)
|
||||
#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
|
||||
#endif /* CONFIG_CMD_SAVEENV */
|
||||
|
||||
+int __weak env_ubi_volume_create(const char *volume)
|
||||
+{
|
||||
+ struct ubi_volume *vol;
|
||||
+
|
||||
+ vol = ubi_find_volume((char *)volume);
|
||||
+ if (vol)
|
||||
+ return 0;
|
||||
+
|
||||
+ return ubi_create_vol((char *)volume, CONFIG_ENV_SIZE, true,
|
||||
+ UBI_VOL_NUM_AUTO, false);
|
||||
+}
|
||||
+
|
||||
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
|
||||
static int env_ubi_load(void)
|
||||
{
|
||||
@@ -135,6 +147,11 @@ static int env_ubi_load(void)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
+ if (IS_ENABLED(CONFIG_ENV_UBI_VOLUME_CREATE)) {
|
||||
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME);
|
||||
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME_REDUND);
|
||||
+ }
|
||||
+
|
||||
read1_fail = ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)tmp_env1,
|
||||
CONFIG_ENV_SIZE);
|
||||
if (read1_fail)
|
||||
@@ -172,6 +189,9 @@ static int env_ubi_load(void)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
+ if (IS_ENABLED(CONFIG_ENV_UBI_VOLUME_CREATE))
|
||||
+ env_ubi_volume_create(CONFIG_ENV_UBI_VOLUME);
|
||||
+
|
||||
if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) {
|
||||
printf("\n** Unable to read env from %s:%s **\n",
|
||||
CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
|
||||
@@ -0,0 +1,66 @@
|
||||
From 189a2fe96931ef3ea0e187c8e9bfa589c2a0ae10 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jul 2022 17:24:56 +0800
|
||||
Subject: [PATCH 62/71] mtd: ubi: add support for UBI end-of-filesystem marker
|
||||
used by OpenWrt
|
||||
|
||||
Add support for UBI end-of-filesystem marker used by OpenWrt to allow
|
||||
attaching a new UBI mtd partition just upgraded.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/ubi/attach.c | 25 ++++++++++++++++++++++---
|
||||
drivers/mtd/ubi/ubi.h | 1 +
|
||||
2 files changed, 23 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/ubi/attach.c
|
||||
+++ b/drivers/mtd/ubi/attach.c
|
||||
@@ -803,6 +803,13 @@ out_unlock:
|
||||
return err;
|
||||
}
|
||||
|
||||
+static bool ec_hdr_has_eof(struct ubi_ec_hdr *ech)
|
||||
+{
|
||||
+ return ech->padding1[0] == 'E' &&
|
||||
+ ech->padding1[1] == 'O' &&
|
||||
+ ech->padding1[2] == 'F';
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* scan_peb - scan and process UBI headers of a PEB.
|
||||
* @ubi: UBI device description object
|
||||
@@ -833,9 +840,21 @@ static int scan_peb(struct ubi_device *u
|
||||
return 0;
|
||||
}
|
||||
|
||||
- err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
|
||||
- if (err < 0)
|
||||
- return err;
|
||||
+ if (!ai->eof_found) {
|
||||
+ err = ubi_io_read_ec_hdr(ubi, pnum, ech, 0);
|
||||
+ if (err < 0)
|
||||
+ return err;
|
||||
+
|
||||
+ if (ec_hdr_has_eof(ech)) {
|
||||
+ pr_notice("UBI: EOF marker found, PEBs from %d will be erased\n",
|
||||
+ pnum);
|
||||
+ ai->eof_found = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (ai->eof_found)
|
||||
+ err = UBI_IO_FF_BITFLIPS;
|
||||
+
|
||||
switch (err) {
|
||||
case 0:
|
||||
break;
|
||||
--- a/drivers/mtd/ubi/ubi.h
|
||||
+++ b/drivers/mtd/ubi/ubi.h
|
||||
@@ -746,6 +746,7 @@ struct ubi_attach_info {
|
||||
int mean_ec;
|
||||
uint64_t ec_sum;
|
||||
int ec_count;
|
||||
+ bool eof_found;
|
||||
struct kmem_cache *aeb_slab_cache;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
From 6792b57b3ba61ca6d69ea4a13a58bed65fc5da87 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sun, 7 Aug 2022 04:04:46 +0200
|
||||
Subject: [PATCH] board: mediatek: wire-up NMBM support
|
||||
|
||||
---
|
||||
board/mediatek/mt7622/mt7622_rfb.c | 38 +++++++++++++++++++++
|
||||
board/mediatek/mt7629/mt7629_rfb.c | 38 +++++++++++++++++++++
|
||||
board/mediatek/mt7981/mt7981_rfb.c | 52 ++++++++++++++++++++++++++++
|
||||
board/mediatek/mt7986/mt7986_rfb.c | 54 ++++++++++++++++++++++++++++++
|
||||
4 files changed, 182 insertions(+)
|
||||
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -10,6 +10,11 @@
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
+#include <mtd.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <nmbm/nmbm.h>
|
||||
+#include <nmbm/nmbm-mtd.h>
|
||||
+
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_init(void)
|
||||
@@ -23,3 +28,36 @@ int board_late_init(void)
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int board_nmbm_init(void)
|
||||
+{
|
||||
+#ifdef CONFIG_ENABLE_NAND_NMBM
|
||||
+ struct mtd_info *lower, *upper;
|
||||
+ int ret;
|
||||
+
|
||||
+ printf("\n");
|
||||
+ printf("Initializing NMBM ...\n");
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ lower = get_mtd_device_nm("spi-nand0");
|
||||
+ if (IS_ERR(lower) || !lower) {
|
||||
+ printf("Lower MTD device 'spi-nand0' not found\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ ret = nmbm_attach_mtd(lower,
|
||||
+ NMBM_F_CREATE | NMBM_F_EMPTY_PAGE_ECC_OK,
|
||||
+ CONFIG_NMBM_MAX_RATIO,
|
||||
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
|
||||
+
|
||||
+ printf("\n");
|
||||
+
|
||||
+ if (ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ add_mtd_device(upper);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- a/board/mediatek/mt7629/mt7629_rfb.c
|
||||
+++ b/board/mediatek/mt7629/mt7629_rfb.c
|
||||
@@ -6,6 +6,11 @@
|
||||
#include <common.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
+#include <mtd.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <nmbm/nmbm.h>
|
||||
+#include <nmbm/nmbm-mtd.h>
|
||||
+
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_init(void)
|
||||
@@ -20,3 +25,36 @@ uint32_t spl_nand_get_uboot_raw_page(voi
|
||||
{
|
||||
return CONFIG_SPL_PAD_TO;
|
||||
}
|
||||
+
|
||||
+int board_nmbm_init(void)
|
||||
+{
|
||||
+#ifdef CONFIG_ENABLE_NAND_NMBM
|
||||
+ struct mtd_info *lower, *upper;
|
||||
+ int ret;
|
||||
+
|
||||
+ printf("\n");
|
||||
+ printf("Initializing NMBM ...\n");
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ lower = get_mtd_device_nm("spi-nand0");
|
||||
+ if (IS_ERR(lower) || !lower) {
|
||||
+ printf("Lower MTD device 'spi-nand0' not found\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ ret = nmbm_attach_mtd(lower,
|
||||
+ NMBM_F_CREATE | NMBM_F_EMPTY_PAGE_ECC_OK,
|
||||
+ CONFIG_NMBM_MAX_RATIO,
|
||||
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
|
||||
+
|
||||
+ printf("\n");
|
||||
+
|
||||
+ if (ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ add_mtd_device(upper);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- a/board/mediatek/mt7981/mt7981_rfb.c
|
||||
+++ b/board/mediatek/mt7981/mt7981_rfb.c
|
||||
@@ -4,7 +4,58 @@
|
||||
* Author: Sam Shih <sam.shih@mediatek.com>
|
||||
*/
|
||||
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <env.h>
|
||||
+#include <init.h>
|
||||
+#include <asm/global_data.h>
|
||||
+
|
||||
+#include <mtd.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <nmbm/nmbm.h>
|
||||
+#include <nmbm/nmbm-mtd.h>
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
int board_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int board_late_init(void)
|
||||
+{
|
||||
+ gd->env_valid = 1; //to load environment variable from persistent store
|
||||
+ env_relocate();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int board_nmbm_init(void)
|
||||
+{
|
||||
+#ifdef CONFIG_ENABLE_NAND_NMBM
|
||||
+ struct mtd_info *lower, *upper;
|
||||
+ int ret;
|
||||
+
|
||||
+ printf("\n");
|
||||
+ printf("Initializing NMBM ...\n");
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ lower = get_mtd_device_nm("spi-nand0");
|
||||
+ if (IS_ERR(lower) || !lower) {
|
||||
+ printf("Lower MTD device 'spi-nand0' not found\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ ret = nmbm_attach_mtd(lower, NMBM_F_CREATE, CONFIG_NMBM_MAX_RATIO,
|
||||
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
|
||||
+
|
||||
+ printf("\n");
|
||||
+
|
||||
+ if (ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ add_mtd_device(upper);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- a/board/mediatek/mt7986/mt7986_rfb.c
|
||||
+++ b/board/mediatek/mt7986/mt7986_rfb.c
|
||||
@@ -4,7 +4,60 @@
|
||||
* Author: Sam Shih <sam.shih@mediatek.com>
|
||||
*/
|
||||
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <env.h>
|
||||
+#include <init.h>
|
||||
+#include <asm/global_data.h>
|
||||
+
|
||||
+#include <mtd.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <nmbm/nmbm.h>
|
||||
+#include <nmbm/nmbm-mtd.h>
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
int board_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int board_late_init(void)
|
||||
+{
|
||||
+ gd->env_valid = 1; //to load environment variable from persistent store
|
||||
+ env_relocate();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int board_nmbm_init(void)
|
||||
+{
|
||||
+#ifdef CONFIG_ENABLE_NAND_NMBM
|
||||
+ struct mtd_info *lower, *upper;
|
||||
+ int ret;
|
||||
+
|
||||
+ printf("\n");
|
||||
+ printf("Initializing NMBM ...\n");
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ lower = get_mtd_device_nm("spi-nand0");
|
||||
+ if (IS_ERR(lower) || !lower) {
|
||||
+ printf("Lower MTD device 'spi-nand0' not found\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ ret = nmbm_attach_mtd(lower,
|
||||
+ NMBM_F_CREATE | NMBM_F_EMPTY_PAGE_ECC_OK,
|
||||
+ CONFIG_NMBM_MAX_RATIO,
|
||||
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
|
||||
+
|
||||
+ printf("\n");
|
||||
+
|
||||
+ if (ret)
|
||||
+ return 0;
|
||||
+
|
||||
+ add_mtd_device(upper);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,33 @@
|
||||
--- a/arch/arm/dts/mt7988.dtsi
|
||||
+++ b/arch/arm/dts/mt7988.dtsi
|
||||
@@ -63,6 +63,30 @@
|
||||
#clock-cells = <0>;
|
||||
};
|
||||
|
||||
+ psci {
|
||||
+ compatible = "arm,psci-0.2";
|
||||
+ method = "smc";
|
||||
+ };
|
||||
+
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <2>;
|
||||
+ #size-cells = <2>;
|
||||
+ ranges;
|
||||
+
|
||||
+ /* 64 KiB reserved for ramoops/pstore */
|
||||
+ ramoops@42ff0000 {
|
||||
+ compatible = "ramoops";
|
||||
+ reg = <0 0x42ff0000 0 0x10000>;
|
||||
+ record-size = <0x1000>;
|
||||
+ };
|
||||
+
|
||||
+ /* 320 KiB reserved for ARM Trusted Firmware (BL31+BL32) */
|
||||
+ secmon_reserved: secmon@43000000 {
|
||||
+ reg = <0 0x43000000 0 0x50000>;
|
||||
+ no-map;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
hwver: hwver {
|
||||
compatible = "mediatek,hwver", "syscon";
|
||||
reg = <0 0x8000000 0 0x1000>;
|
||||
@@ -0,0 +1,341 @@
|
||||
--- a/configs/mt7988_sd_rfb_defconfig
|
||||
+++ b/configs/mt7988_sd_rfb_defconfig
|
||||
@@ -11,6 +11,23 @@ CONFIG_DEBUG_UART_BASE=0x11000000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_SPI_BOOT=y
|
||||
+CONFIG_SD_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
# CONFIG_AUTOBOOT is not set
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7988-sd-rfb"
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
@@ -22,15 +39,118 @@ CONFIG_SYS_PROMPT="MT7988> "
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=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_FDT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DM=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_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_NAND=y
|
||||
+CONFIG_CMD_NAND_TRIMFFS=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
CONFIG_CMD_PWM=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_SF=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_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_DISPLAY_CPUINFO=y
|
||||
+CONFIG_DM_MMC=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_PARTITION_UUIDS=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DM_SCSI=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+# CONFIG_MTD_RAW_NAND is not set
|
||||
+CONFIG_DM_PCI=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PINCTRL_MT7988=y
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=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
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x440000
|
||||
+CONFIG_ENV_SIZE=0x40000
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
CONFIG_DOS_PARTITION=y
|
||||
CONFIG_EFI_PARTITION=y
|
||||
CONFIG_PARTITION_TYPE_GUID=y
|
||||
@@ -46,6 +166,9 @@ CONFIG_PROT_TCP=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
+CONFIG_MMC=y
|
||||
+CONFIG_MMC_DEFAULT_DEV=1
|
||||
+CONFIG_MMC_SUPPORTS_TUNING=y
|
||||
CONFIG_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_MTD=y
|
||||
--- a/configs/mt7988_rfb_defconfig
|
||||
+++ b/configs/mt7988_rfb_defconfig
|
||||
@@ -11,7 +11,23 @@ CONFIG_DEBUG_UART_BASE=0x11000000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
-# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_SPI_BOOT=y
|
||||
+CONFIG_SD_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7988-rfb"
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
@@ -22,15 +38,120 @@ CONFIG_SYS_PROMPT="MT7988> "
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=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_FDT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_CLK=y
|
||||
CONFIG_CMD_DM=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_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_NAND=y
|
||||
+CONFIG_CMD_NAND_TRIMFFS=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
CONFIG_CMD_PWM=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_SF=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_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_DISPLAY_CPUINFO=y
|
||||
+CONFIG_DM_MMC=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_PARTITION_UUIDS=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DM_SCSI=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+# CONFIG_MTD_RAW_NAND is not set
|
||||
+CONFIG_DM_PCI=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PINCTRL_MT7988=y
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=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
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_SIZE=0x1f000
|
||||
+CONFIG_ENV_SIZE_REDUND=0x1f000
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
CONFIG_DOS_PARTITION=y
|
||||
CONFIG_EFI_PARTITION=y
|
||||
CONFIG_PARTITION_TYPE_GUID=y
|
||||
@@ -46,6 +167,9 @@ CONFIG_PROT_TCP=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
+CONFIG_MMC=y
|
||||
+CONFIG_MMC_DEFAULT_DEV=1
|
||||
+CONFIG_MMC_SUPPORTS_TUNING=y
|
||||
CONFIG_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_MTD=y
|
||||
--- a/arch/arm/dts/mt7988-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7988-rfb.dts
|
||||
@@ -144,6 +144,23 @@
|
||||
compatible = "spi-nand";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@200000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x200000 0x7e00000>;
|
||||
+ compatible = "linux,ubi";
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
--- a/configs/mt7981_rfb_defconfig
|
||||
+++ b/configs/mt7981_rfb_defconfig
|
||||
@@ -30,6 +30,9 @@ CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
--- a/configs/mt7981_snfi_nand_rfb_defconfig
|
||||
+++ b/configs/mt7981_snfi_nand_rfb_defconfig
|
||||
@@ -1,11 +1,12 @@
|
||||
CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
CONFIG_POSITION_INDEPENDENT=y
|
||||
CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
-CONFIG_ENV_SIZE=0x20000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7981-snfi-nand-rfb"
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
CONFIG_TARGET_MT7981=y
|
||||
CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
@@ -15,7 +16,6 @@ CONFIG_DEBUG_UART=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7981-snfi-nand-rfb"
|
||||
CONFIG_LOGLEVEL=7
|
||||
CONFIG_LOG=y
|
||||
-CONFIG_SYS_PROMPT="MT7981> "
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
# CONFIG_BOOTM_NETBSD is not set
|
||||
@@ -29,8 +29,6 @@ CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
-CONFIG_MTDIDS_DEFAULT="spi-nand0=spi-nand0"
|
||||
-CONFIG_MTDPARTS_DEFAULT="spi-nand0:1024k(bl2),512k(u-boot-env),2048k(factory),2048k(fip),65536k(ubi)"
|
||||
CONFIG_CMD_UBI=y
|
||||
CONFIG_CMD_UBI_RENAME=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
@@ -45,7 +43,6 @@ CONFIG_DM_MTD=y
|
||||
CONFIG_MTK_SPI_NAND=y
|
||||
CONFIG_MTK_SPI_NAND_MTD=y
|
||||
CONFIG_PHY_FIXED=y
|
||||
-CONFIG_DM_ETH=y
|
||||
CONFIG_MEDIATEK_ETH=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCONF=y
|
||||
@@ -55,3 +52,4 @@ CONFIG_MTK_POWER_DOMAIN=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
CONFIG_MTK_SERIAL=y
|
||||
CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_nor_rfb_defconfig
|
||||
@@ -0,0 +1,68 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-rfb"
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7981-rfb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_SYS_CBSIZE=512
|
||||
+CONFIG_SYS_PBSIZE=1049
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_ISSI=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_XTX=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
@@ -0,0 +1,474 @@
|
||||
--- a/configs/mt7981_emmc_rfb_defconfig
|
||||
+++ b/configs/mt7981_emmc_rfb_defconfig
|
||||
@@ -13,7 +13,22 @@ CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
-# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_MMC_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7981-emmc-rfb"
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
@@ -24,9 +39,23 @@ CONFIG_SYS_PROMPT="MT7981> "
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_UNLZ4 is not set
|
||||
# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_ECHO=y
|
||||
+CONFIG_CMD_ENV_READMEM=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_FDT=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
CONFIG_CMD_GPT_RENAME=y
|
||||
@@ -36,13 +65,35 @@ CONFIG_CMD_PART=y
|
||||
CONFIG_CMD_READ=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_TFTPBOOT=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
CONFIG_CMD_FAT=y
|
||||
CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_ITEST=y
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_SF=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
CONFIG_PARTITION_TYPE_GUID=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGEX=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
--- a/configs/mt7981_rfb_defconfig
|
||||
+++ b/configs/mt7981_rfb_defconfig
|
||||
@@ -11,7 +11,23 @@ CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
-# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_SPI_BOOT=y
|
||||
+CONFIG_NAND_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7981-rfb"
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
@@ -22,23 +38,74 @@ CONFIG_SYS_PROMPT="MT7981> "
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_UNLZ4 is not set
|
||||
# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_ECHO=y
|
||||
+CONFIG_CMD_ENV_READMEM=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_FDT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_MTD=y
|
||||
-CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_ITEST=y
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_NAND=y
|
||||
+# CONFIG_MTD_RAW_NAND is not set
|
||||
+CONFIG_CMD_NAND_TRIMFFS=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_SF=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_SMC=y
|
||||
CONFIG_CMD_UBI=y
|
||||
CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_CMD_UBIFS=y
|
||||
+CONFIG_CMD_TFTPBOOT=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_SIZE=0x1f000
|
||||
+CONFIG_ENV_SIZE_REDUND=0x1f000
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGEX=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
# CONFIG_MMC is not set
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_DM_MTD=y
|
||||
CONFIG_MTD_SPI_NAND=y
|
||||
--- a/configs/mt7981_sd_rfb_defconfig
|
||||
+++ b/configs/mt7981_sd_rfb_defconfig
|
||||
@@ -13,7 +13,22 @@ CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
-# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_MMC_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7981-sd-rfb"
|
||||
CONFIG_SYS_CBSIZE=512
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
@@ -24,9 +39,23 @@ CONFIG_SYS_PROMPT="MT7981> "
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_UNLZ4 is not set
|
||||
# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_ECHO=y
|
||||
+CONFIG_CMD_ENV_READMEM=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_FDT=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_GPT=y
|
||||
CONFIG_CMD_GPT_RENAME=y
|
||||
@@ -36,13 +65,35 @@ CONFIG_CMD_PART=y
|
||||
CONFIG_CMD_READ=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_TFTPBOOT=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
CONFIG_CMD_FAT=y
|
||||
CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_ITEST=y
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_SF=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
CONFIG_PARTITION_TYPE_GUID=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGEX=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
--- a/configs/mt7981_snfi_nand_rfb_defconfig
|
||||
+++ b/configs/mt7981_snfi_nand_rfb_defconfig
|
||||
@@ -12,7 +12,23 @@ CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
-# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_SPI_BOOT=y
|
||||
+CONFIG_NAND_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7981-snfi-nand-rfb"
|
||||
CONFIG_LOGLEVEL=7
|
||||
CONFIG_LOG=y
|
||||
@@ -22,22 +38,73 @@ CONFIG_SYS_PBSIZE=1049
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_UNLZ4 is not set
|
||||
# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_ECHO=y
|
||||
+CONFIG_CMD_ENV_READMEM=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_FDT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_ITEST=y
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_NAND=y
|
||||
+# CONFIG_MTD_RAW_NAND is not set
|
||||
+CONFIG_CMD_NAND_TRIMFFS=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_SF=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
CONFIG_CMD_SMC=y
|
||||
CONFIG_CMD_UBI=y
|
||||
CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_CMD_UBIFS=y
|
||||
+CONFIG_CMD_TFTPBOOT=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_SIZE=0x1f000
|
||||
+CONFIG_ENV_SIZE_REDUND=0x1f000
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGEX=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
# CONFIG_MMC is not set
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_DM_MTD=y
|
||||
CONFIG_MTK_SPI_NAND=y
|
||||
--- a/configs/mt7981_nor_rfb_defconfig
|
||||
+++ b/configs/mt7981_nor_rfb_defconfig
|
||||
@@ -12,7 +12,22 @@ CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
CONFIG_DEBUG_UART=y
|
||||
-# CONFIG_AUTOBOOT is not set
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=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_SPI_BOOT=y
|
||||
+CONFIG_BOOTSTD_DEFAULTS=y
|
||||
+CONFIG_BOOTSTD_FULL=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7981-rfb"
|
||||
CONFIG_LOGLEVEL=7
|
||||
CONFIG_LOG=y
|
||||
@@ -22,21 +37,66 @@ CONFIG_SYS_PBSIZE=1049
|
||||
# CONFIG_BOOTM_PLAN9 is not set
|
||||
# CONFIG_BOOTM_RTEMS is not set
|
||||
# CONFIG_BOOTM_VXWORKS is not set
|
||||
-# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_UNLZ4 is not set
|
||||
# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_ELF=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_ECHO=y
|
||||
+CONFIG_CMD_ENV_READMEM=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_FDT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_ITEST=y
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_SF=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_ASKENV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_SOURCE=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="u-boot-env"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_ENV_SIZE=0x4000
|
||||
+CONFIG_ENV_OFFSET=0x0
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGEX=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
CONFIG_CLK=y
|
||||
# CONFIG_MMC is not set
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_MTD=y
|
||||
CONFIG_DM_MTD=y
|
||||
CONFIG_MTD_SPI_NAND=y
|
||||
@@ -0,0 +1,140 @@
|
||||
--- a/arch/arm/dts/mt7981-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7981-rfb.dts
|
||||
@@ -143,6 +143,37 @@
|
||||
compatible = "spi-nand";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "BL2";
|
||||
+ reg = <0x00000 0x0100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x0100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ factory: partition@180000 {
|
||||
+ label = "Factory";
|
||||
+ reg = <0x180000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "FIP";
|
||||
+ reg = <0x380000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x4000000>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -164,6 +195,37 @@
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@00000 {
|
||||
+ label = "BL2";
|
||||
+ reg = <0x00000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@40000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x40000 0x0010000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@50000 {
|
||||
+ label = "Factory";
|
||||
+ reg = <0x50000 0x00B0000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "FIP";
|
||||
+ reg = <0x100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "firmware";
|
||||
+ reg = <0x180000 0xE00000>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
--- a/arch/arm/dts/mt7981-snfi-nand-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7981-snfi-nand-rfb.dts
|
||||
@@ -107,11 +107,11 @@
|
||||
};
|
||||
|
||||
mmc0_pins_default: mmc0default {
|
||||
- mux {
|
||||
- function = "flash";
|
||||
- groups = "emmc_45";
|
||||
- };
|
||||
- };
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "emmc_45";
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&snand {
|
||||
@@ -119,6 +119,42 @@
|
||||
pinctrl-0 = <&snfi_pins>;
|
||||
status = "okay";
|
||||
quad-spi;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "BL2";
|
||||
+ reg = <0x00000 0x0100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x0100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ factory: partition@180000 {
|
||||
+ label = "Factory";
|
||||
+ reg = <0x180000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "FIP";
|
||||
+ reg = <0x380000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x4000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&pwm {
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1085,7 +1085,7 @@ quiet_cmd_pad_cat = CAT $@
|
||||
cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; }
|
||||
|
||||
quiet_cmd_lzma = LZMA $@
|
||||
-cmd_lzma = lzma -c -z -k -9 $< > $@
|
||||
+cmd_lzma = xz --format=lzma -c -z -k -9 $< > $@
|
||||
|
||||
cfg: u-boot.cfg
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--- a/tools/image-host.c
|
||||
+++ b/tools/image-host.c
|
||||
@@ -1162,6 +1162,7 @@ static int fit_config_add_verification_d
|
||||
* 2) get public key (X509_get_pubkey)
|
||||
* 3) provide der format (d2i_RSAPublicKey)
|
||||
*/
|
||||
+#ifdef CONFIG_TOOLS_LIBCRYPTO
|
||||
static int read_pub_key(const char *keydir, const void *name,
|
||||
unsigned char **pubkey, int *pubkey_len)
|
||||
{
|
||||
@@ -1215,6 +1216,13 @@ err_cert:
|
||||
fclose(f);
|
||||
return ret;
|
||||
}
|
||||
+#else
|
||||
+static int read_pub_key(const char *keydir, const void *name,
|
||||
+ unsigned char **pubkey, int *pubkey_len)
|
||||
+{
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
|
||||
{
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,130 @@
|
||||
--- a/cmd/bootm.c
|
||||
+++ b/cmd/bootm.c
|
||||
@@ -262,6 +262,67 @@ U_BOOT_CMD(
|
||||
/* iminfo - print header info for a requested image */
|
||||
/*******************************************************************/
|
||||
#if defined(CONFIG_CMD_IMI)
|
||||
+#if defined(CONFIG_FIT)
|
||||
+#define SECTOR_SHIFT 9
|
||||
+static int image_totalsize(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[], short int in_blocks)
|
||||
+{
|
||||
+ ulong addr;
|
||||
+ void *fit;
|
||||
+ int bsize, tsize;
|
||||
+ char buf[16];
|
||||
+
|
||||
+ if (argc >= 2)
|
||||
+ addr = simple_strtoul(argv[1], NULL, 16);
|
||||
+ else
|
||||
+ addr = image_load_addr;
|
||||
+
|
||||
+ fit = (void *)map_sysmem(addr, 0);
|
||||
+ tsize = fit_get_totalsize(fit);
|
||||
+ unmap_sysmem(fit);
|
||||
+ if (tsize == 0)
|
||||
+ return 1;
|
||||
+
|
||||
+ bsize = (tsize >> SECTOR_SHIFT) + ((tsize & ((1 << SECTOR_SHIFT) - 1))?1:0);
|
||||
+
|
||||
+ if (!in_blocks)
|
||||
+ snprintf(buf, sizeof(buf), "%x", tsize);
|
||||
+ else
|
||||
+ snprintf(buf, sizeof(buf), "%x", bsize);
|
||||
+
|
||||
+ if (argc >= 3)
|
||||
+ return env_set(argv[2], buf);
|
||||
+ else
|
||||
+ printf("%s\n", buf);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int do_imsz(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ return image_totalsize(cmdtp, flag, argc, argv, 0);
|
||||
+}
|
||||
+
|
||||
+static int do_imszb(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char *const argv[])
|
||||
+{
|
||||
+ return image_totalsize(cmdtp, flag, argc, argv, 1);
|
||||
+}
|
||||
+
|
||||
+U_BOOT_CMD(
|
||||
+ imsz, CONFIG_SYS_MAXARGS, 1, do_imsz,
|
||||
+ "get image total size (in bytes)",
|
||||
+ "addr [maxhdrlen] [varname]\n"
|
||||
+);
|
||||
+
|
||||
+U_BOOT_CMD(
|
||||
+ imszb, CONFIG_SYS_MAXARGS, 1, do_imszb,
|
||||
+ "get image total size (in blocks)",
|
||||
+ "addr [maxhdrlen] [varname]\n"
|
||||
+);
|
||||
+
|
||||
+#endif
|
||||
static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
--- a/boot/image-fit.c
|
||||
+++ b/boot/image-fit.c
|
||||
@@ -2051,6 +2051,47 @@ static const char *fit_get_image_type_pr
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
+size_t fit_get_totalsize(const void *fit)
|
||||
+{
|
||||
+ int ret, ndepth, noffset, images_noffset;
|
||||
+ size_t data_size, hdrsize, img_total, max_size = 0;
|
||||
+ const void *data;
|
||||
+
|
||||
+ ret = fdt_check_header(fit);
|
||||
+ if (ret) {
|
||||
+ debug("Wrong FIT format: not a flattened device tree (err=%d)\n",
|
||||
+ ret);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ hdrsize = fdt_totalsize(fit);
|
||||
+
|
||||
+ /* take care of simple FIT with internal images */
|
||||
+ max_size = hdrsize;
|
||||
+
|
||||
+ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
|
||||
+ if (images_noffset < 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ for (ndepth = 0,
|
||||
+ noffset = fdt_next_node(fit, images_noffset, &ndepth);
|
||||
+ (noffset >= 0) && (ndepth > 0);
|
||||
+ noffset = fdt_next_node(fit, noffset, &ndepth)) {
|
||||
+ if (ndepth == 1) {
|
||||
+ ret = fit_image_get_data_and_size(fit, noffset, &data, &data_size);
|
||||
+ if (ret)
|
||||
+ goto out;
|
||||
+
|
||||
+ img_total = data_size + (data - fit);
|
||||
+
|
||||
+ max_size = (max_size > img_total) ? max_size : img_total;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ return max_size;
|
||||
+}
|
||||
+
|
||||
int fit_image_load(struct bootm_headers *images, ulong addr,
|
||||
const char **fit_unamep, const char **fit_uname_configp,
|
||||
int arch, int ph_type, int bootstage_id,
|
||||
--- a/include/image.h
|
||||
+++ b/include/image.h
|
||||
@@ -1123,6 +1123,7 @@ int fit_parse_subimage(const char *spec,
|
||||
ulong *addr, const char **image_name);
|
||||
|
||||
int fit_get_subimage_count(const void *fit, int images_noffset);
|
||||
+size_t fit_get_totalsize(const void *fit);
|
||||
void fit_print_contents(const void *fit);
|
||||
void fit_image_print(const void *fit, int noffset, const char *p);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -452,7 +452,11 @@ static void menu_display_statusline(stru
|
||||
printf(ANSI_CURSOR_POSITION, 1, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
printf(ANSI_CURSOR_POSITION, 2, 3);
|
||||
- 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);
|
||||
@@ -537,6 +541,7 @@ static enum bootmenu_ret bootmenu_show(i
|
||||
return BOOTMENU_RET_FAIL;
|
||||
}
|
||||
|
||||
+ bootmenu->mtitle = env_get("bootmenu_title");
|
||||
for (iter = bootmenu->first; iter; iter = iter->next) {
|
||||
if (menu_item_add(menu, iter->key, iter) != 1)
|
||||
goto cleanup;
|
||||
--- a/include/menu.h
|
||||
+++ b/include/menu.h
|
||||
@@ -45,6 +45,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 */
|
||||
bool last_choiced;
|
||||
};
|
||||
|
||||
116
package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch
Normal file
116
package/boot/uboot-mediatek/patches/220-cmd-env-readmem.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -676,6 +676,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
|
||||
@@ -273,6 +273,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 env_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)
|
||||
@@ -1089,6 +1143,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
|
||||
@@ -1172,6 +1229,9 @@ U_BOOT_LONGHELP(env,
|
||||
#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
|
||||
@@ -1280,6 +1340,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,
|
||||
@@ -0,0 +1,78 @@
|
||||
--- a/cmd/pstore.c
|
||||
+++ b/cmd/pstore.c
|
||||
@@ -208,6 +208,58 @@ static int pstore_set(struct cmd_tbl *cm
|
||||
}
|
||||
|
||||
/**
|
||||
+ * pstore_check() - Check for pstore records
|
||||
+ * @cmdtp: Command data struct pointer
|
||||
+ * @flag: Command flag
|
||||
+ * @argc: Command-line argument count
|
||||
+ * @argv: Array of command-line arguments
|
||||
+ *
|
||||
+ * Return: 0 if there are records in pstore, 1 otherwise
|
||||
+ */
|
||||
+static int pstore_check(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
+ char * const argv[])
|
||||
+{
|
||||
+ phys_addr_t ptr;
|
||||
+ char *buffer;
|
||||
+ u32 size;
|
||||
+ int header_len = 0;
|
||||
+ bool compressed;
|
||||
+
|
||||
+ if (pstore_length == 0) {
|
||||
+ printf("Please set PStore configuration\n");
|
||||
+ return CMD_RET_USAGE;
|
||||
+ }
|
||||
+
|
||||
+ if (buffer_size == 0)
|
||||
+ pstore_init_buffer_size();
|
||||
+
|
||||
+ buffer = malloc_cache_aligned(buffer_size);
|
||||
+
|
||||
+ ptr = pstore_addr;
|
||||
+ phys_addr_t ptr_end = ptr + pstore_length - pstore_pmsg_size
|
||||
+ - pstore_ftrace_size - pstore_console_size;
|
||||
+
|
||||
+ while (ptr < ptr_end) {
|
||||
+ size = pstore_get_buffer(PERSISTENT_RAM_SIG, ptr,
|
||||
+ pstore_record_size, buffer);
|
||||
+ ptr += pstore_record_size;
|
||||
+
|
||||
+ if (size == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ header_len = pstore_read_kmsg_hdr(buffer, &compressed);
|
||||
+ if (header_len == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ free(buffer);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ free(buffer);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* pstore_print_buffer() - Print buffer
|
||||
* @type: buffer type
|
||||
* @buffer: buffer to print
|
||||
@@ -459,6 +511,7 @@ static int pstore_save(struct cmd_tbl *c
|
||||
|
||||
static struct cmd_tbl cmd_pstore_sub[] = {
|
||||
U_BOOT_CMD_MKENT(set, 8, 0, pstore_set, "", ""),
|
||||
+ U_BOOT_CMD_MKENT(check, 1, 0, pstore_check, "", ""),
|
||||
U_BOOT_CMD_MKENT(display, 3, 0, pstore_display, "", ""),
|
||||
U_BOOT_CMD_MKENT(save, 4, 0, pstore_save, "", ""),
|
||||
};
|
||||
@@ -566,6 +619,8 @@ U_BOOT_CMD(pstore, 10, 0, do_pstore,
|
||||
" 'pmsg-size' is the size of the user space logs record.\n"
|
||||
" 'ecc-size' enables/disables ECC support and specifies ECC buffer size in\n"
|
||||
" bytes (0 disables it, 1 is a special value, means 16 bytes ECC).\n"
|
||||
+ "pstore check\n"
|
||||
+ "- Returns true if there are records in pstore.\n"
|
||||
"pstore display [record-type] [nb]\n"
|
||||
"- Display existing records in pstore reserved memory. A 'record-type' can\n"
|
||||
" be given to only display records of this kind. 'record-type' can be one\n"
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/drivers/mmc/mmc_write.c
|
||||
+++ b/drivers/mmc/mmc_write.c
|
||||
@@ -80,7 +80,7 @@ ulong mmc_berase(struct blk_desc *block_
|
||||
u32 start_rem, blkcnt_rem, erase_args = 0;
|
||||
struct mmc *mmc = find_mmc_device(dev_num);
|
||||
lbaint_t blk = 0, blk_r = 0;
|
||||
- int timeout_ms = 1000;
|
||||
+ int timeout_ms = blkcnt;
|
||||
|
||||
if (!mmc)
|
||||
return -1;
|
||||
@@ -0,0 +1,31 @@
|
||||
From 5f2d5915f8ea4785bc2b8a26955e176a7898c15b Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 12 Apr 2022 21:00:43 +0100
|
||||
Subject: [PATCH] image-fdt: save name of FIT configuration in '/chosen' node
|
||||
|
||||
It can be useful for the OS (Linux) to know which configuration has
|
||||
been chosen by U-Boot when launching a FIT image.
|
||||
Store the name of the FIT configuration node used in a new string
|
||||
property called 'u-boot,bootconf' in the '/chosen' node in device tree.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Tom Rini <trini@konsulko.com>
|
||||
---
|
||||
boot/image-fdt.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/boot/image-fdt.c
|
||||
+++ b/boot/image-fdt.c
|
||||
@@ -618,6 +618,12 @@ int image_setup_libfdt(struct bootm_head
|
||||
images->fit_uname_cfg,
|
||||
strlen(images->fit_uname_cfg) + 1, 1);
|
||||
|
||||
+ /* Store name of configuration node as u-boot,bootconf in /chosen node */
|
||||
+ if (images->fit_uname_cfg)
|
||||
+ fdt_find_and_setprop(blob, "/chosen", "u-boot,bootconf",
|
||||
+ images->fit_uname_cfg,
|
||||
+ strlen(images->fit_uname_cfg) + 1, 1);
|
||||
+
|
||||
/* Update ethernet nodes */
|
||||
fdt_fixup_ethernet(blob);
|
||||
#if IS_ENABLED(CONFIG_CMD_PSTORE)
|
||||
@@ -0,0 +1,71 @@
|
||||
From cca5775031e4890f195246772e00f7f4ae7438f6 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Mon, 19 Feb 2024 05:52:24 +0100
|
||||
Subject: [PATCH 1/2] mt7981.dtsi: add USB nodes
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
arch/arm/dts/mt7981.dtsi | 47 ++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 47 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7981.dtsi
|
||||
+++ b/arch/arm/dts/mt7981.dtsi
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
+#include <dt-bindings/phy/phy.h>
|
||||
#include <dt-bindings/clock/mt7981-clk.h>
|
||||
#include <dt-bindings/reset/mt7629-reset.h>
|
||||
#include <dt-bindings/pinctrl/mt65xx.h>
|
||||
@@ -342,4 +343,50 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ xhci: xhci@11200000 {
|
||||
+ compatible = "mediatek,mt7981-xhci",
|
||||
+ "mediatek,mtk-xhci";
|
||||
+ reg = <0x11200000 0x2e00>,
|
||||
+ <0x11203e00 0x0100>;
|
||||
+ reg-names = "mac", "ippc";
|
||||
+ interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ phys = <&u2port0 PHY_TYPE_USB2>,
|
||||
+ <&u3port0 PHY_TYPE_USB3>;
|
||||
+ clocks = <&infracfg_ao CK_INFRA_IUSB_SYS_CK>,
|
||||
+ <&infracfg_ao CK_INFRA_IUSB_CK>,
|
||||
+ <&infracfg_ao CK_INFRA_IUSB_133_CK>,
|
||||
+ <&infracfg_ao CK_INFRA_IUSB_66M_CK>,
|
||||
+ <&topckgen CK_TOP_U2U3_XHCI_SEL>;
|
||||
+ clock-names = "sys_ck",
|
||||
+ "ref_ck",
|
||||
+ "mcu_ck",
|
||||
+ "dma_ck",
|
||||
+ "xhci_ck";
|
||||
+ mediatek,u3p-dis-msk = <0x1>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usbtphy: usb-phy@11e10000 {
|
||||
+ compatible = "mediatek,mt7981",
|
||||
+ "mediatek,generic-tphy-v2";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ u2port0: usb-phy@11e10000 {
|
||||
+ reg = <0x11e10000 0x700>;
|
||||
+ clocks = <&topckgen CK_TOP_USB_FRMCNT_SEL>;
|
||||
+ clock-names = "ref";
|
||||
+ #phy-cells = <1>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ u3port0: usb-phy@11e10700 {
|
||||
+ reg = <0x11e10700 0x900>;
|
||||
+ clocks = <&topckgen CK_TOP_USB3_PHY_SEL>;
|
||||
+ clock-names = "ref";
|
||||
+ #phy-cells = <1>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/board/mediatek/mt7623/mt7623_rfb.c
|
||||
+++ b/board/mediatek/mt7623/mt7623_rfb.c
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <mmc.h>
|
||||
+#include <part.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
@@ -22,8 +23,9 @@ int mmc_get_boot_dev(void)
|
||||
{
|
||||
int g_mmc_devid = -1;
|
||||
char *uflag = (char *)0x81DFFFF0;
|
||||
+ struct blk_desc *desc;
|
||||
|
||||
- if (!find_mmc_device(1))
|
||||
+ if (blk_get_device_by_str("mmc", "1", &desc) < 0)
|
||||
return 0;
|
||||
|
||||
if (strncmp(uflag,"eMMC",4)==0) {
|
||||
@@ -38,6 +40,23 @@ int mmc_get_boot_dev(void)
|
||||
|
||||
int mmc_get_env_dev(void)
|
||||
{
|
||||
- return mmc_get_boot_dev();
|
||||
+ struct udevice *dev;
|
||||
+ const char *mmcdev;
|
||||
+
|
||||
+ switch (mmc_get_boot_dev()) {
|
||||
+ case 0:
|
||||
+ mmcdev = "mmc@11230000";
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ mmcdev = "mmc@11240000";
|
||||
+ break;
|
||||
+ default:
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (uclass_get_device_by_name(UCLASS_MMC, mmcdev, &dev))
|
||||
+ return -1;
|
||||
+
|
||||
+ return dev_seq(dev);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -6,9 +6,16 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
+#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
+#endif
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -24,7 +31,22 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
- gd->env_valid = 1; //to load environment variable from persistent store
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
|
||||
+ puts("reset button found\n");
|
||||
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
|
||||
+ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
|
||||
+ button_get_state(dev);
|
||||
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
|
||||
+ }
|
||||
+#endif
|
||||
+ if (button_get_state(dev) == BUTTON_ON) {
|
||||
+ puts("button pushed, resetting environment\n");
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -154,4 +154,11 @@ config MTK_BROM_HEADER_INFO
|
||||
|
||||
source "board/mediatek/mt7629/Kconfig"
|
||||
|
||||
+config RESET_BUTTON_LABEL
|
||||
+ string "Button to trigger factory reset"
|
||||
+ default "reset"
|
||||
+
|
||||
+config RESET_BUTTON_SETTLE_DELAY
|
||||
+ int "Delay to wait for button to settle"
|
||||
+ default 0
|
||||
endif
|
||||
@@ -0,0 +1,47 @@
|
||||
--- a/board/mediatek/mt7623/mt7623_rfb.c
|
||||
+++ b/board/mediatek/mt7623/mt7623_rfb.c
|
||||
@@ -4,9 +4,18 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
+#include <env.h>
|
||||
+#include <init.h>
|
||||
#include <mmc.h>
|
||||
#include <part.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
+#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
+#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@@ -60,3 +69,25 @@ int mmc_get_env_dev(void)
|
||||
return dev_seq(dev);
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+int board_late_init(void)
|
||||
+{
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
|
||||
+ puts("reset button found\n");
|
||||
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
|
||||
+ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
|
||||
+ button_get_state(dev);
|
||||
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
|
||||
+ }
|
||||
+#endif
|
||||
+ if (button_get_state(dev) == BUTTON_ON) {
|
||||
+ puts("button pushed, resetting environment\n");
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ env_relocate();
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,43 @@
|
||||
--- a/board/mediatek/mt7986/mt7986_rfb.c
|
||||
+++ b/board/mediatek/mt7986/mt7986_rfb.c
|
||||
@@ -6,9 +6,16 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
+#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
+#endif
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -24,7 +31,22 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
- gd->env_valid = 1; //to load environment variable from persistent store
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
|
||||
+ puts("reset button found\n");
|
||||
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
|
||||
+ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
|
||||
+ button_get_state(dev);
|
||||
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
|
||||
+ }
|
||||
+#endif
|
||||
+ if (button_get_state(dev) == BUTTON_ON) {
|
||||
+ puts("button pushed, resetting environment\n");
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+ }
|
||||
+ }
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
--- a/board/mediatek/mt7981/mt7981_rfb.c
|
||||
+++ b/board/mediatek/mt7981/mt7981_rfb.c
|
||||
@@ -6,9 +6,16 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
+#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
+#endif
|
||||
|
||||
#include <mtd.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -24,7 +31,22 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
- gd->env_valid = 1; //to load environment variable from persistent store
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
|
||||
+ puts("reset button found\n");
|
||||
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
|
||||
+ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
|
||||
+ button_get_state(dev);
|
||||
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
|
||||
+ }
|
||||
+#endif
|
||||
+ if (button_get_state(dev) == BUTTON_ON) {
|
||||
+ puts("button pushed, resetting environment\n");
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+ }
|
||||
+ }
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/board/mediatek/mt7988/mt7988_rfb.c
|
||||
+++ b/board/mediatek/mt7988/mt7988_rfb.c
|
||||
@@ -4,7 +4,43 @@
|
||||
* Author: Sam Shih <sam.shih@mediatek.com>
|
||||
*/
|
||||
|
||||
+#include <common.h>
|
||||
+#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
+#include <env.h>
|
||||
+#include <init.h>
|
||||
+#include <asm/global_data.h>
|
||||
+#include <linux/delay.h>
|
||||
+
|
||||
+#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
+#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
+#endif
|
||||
+
|
||||
int board_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int board_late_init(void)
|
||||
+{
|
||||
+ gd->env_valid = 1; //to load environment variable from persistent store
|
||||
+ struct udevice *dev;
|
||||
+
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
|
||||
+ puts("reset button found\n");
|
||||
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
|
||||
+ if (CONFIG_RESET_BUTTON_SETTLE_DELAY > 0) {
|
||||
+ button_get_state(dev);
|
||||
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
|
||||
+ }
|
||||
+#endif
|
||||
+ if (button_get_state(dev) == BUTTON_ON) {
|
||||
+ puts("button pushed, resetting environment\n");
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+ }
|
||||
+ }
|
||||
+ env_relocate();
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,67 @@
|
||||
--- a/board/mediatek/mt7988/mt7988_rfb.c
|
||||
+++ b/board/mediatek/mt7988/mt7988_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <asm/io.h>
|
||||
#include <linux/delay.h>
|
||||
+#include <linux/libfdt.h>
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -44,3 +46,54 @@ int board_late_init(void)
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#define MT7988_BOOT_NOR 0
|
||||
+#define MT7988_BOOT_SPIM_NAND 1
|
||||
+#define MT7988_BOOT_EMMC 2
|
||||
+#define MT7988_BOOT_SNFI_NAND 3
|
||||
+
|
||||
+int ft_system_setup(void *blob, struct bd_info *bd)
|
||||
+{
|
||||
+ const u32 *media_handle_p;
|
||||
+ int chosen, len, ret;
|
||||
+ const char *media;
|
||||
+ u32 media_handle;
|
||||
+
|
||||
+ switch ((readl(0x1001f6f0) & 0xc00) >> 10) {
|
||||
+ case MT7988_BOOT_NOR:
|
||||
+ media = "rootdisk-nor";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7988_BOOT_SPIM_NAND:
|
||||
+ media = "rootdisk-spim-nand";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7988_BOOT_EMMC:
|
||||
+ media = "rootdisk-emmc";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7988_BOOT_SNFI_NAND:
|
||||
+ media = "rootdisk-sd";
|
||||
+ break
|
||||
+ ;;
|
||||
+ }
|
||||
+
|
||||
+ chosen = fdt_path_offset(blob, "/chosen");
|
||||
+ if (chosen <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle_p = fdt_getprop(blob, chosen, media, &len);
|
||||
+ if (media_handle_p <= 0 || len != 4)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle = *media_handle_p;
|
||||
+ ret = fdt_setprop(blob, chosen, "rootdisk", &media_handle, sizeof(media_handle));
|
||||
+ if (ret) {
|
||||
+ printf("cannot set media phandle %s as rootdisk /chosen node\n", media);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ printf("set /chosen/rootdisk to bootrom media: %s (phandle 0x%08x)\n", media, fdt32_to_cpu(media_handle));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,67 @@
|
||||
--- a/board/mediatek/mt7986/mt7986_rfb.c
|
||||
+++ b/board/mediatek/mt7986/mt7986_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <asm/io.h>
|
||||
#include <linux/delay.h>
|
||||
+#include <linux/libfdt.h>
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -83,3 +85,54 @@ int board_nmbm_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+#define MT7986_BOOT_NOR 0
|
||||
+#define MT7986_BOOT_SPIM_NAND 1
|
||||
+#define MT7986_BOOT_EMMC 2
|
||||
+#define MT7986_BOOT_SNFI_NAND 3
|
||||
+
|
||||
+int ft_system_setup(void *blob, struct bd_info *bd)
|
||||
+{
|
||||
+ const u32 *media_handle_p;
|
||||
+ int chosen, len, ret;
|
||||
+ const char *media;
|
||||
+ u32 media_handle;
|
||||
+
|
||||
+ switch ((readl(0x1001f6f0) & 0x300) >> 8) {
|
||||
+ case MT7986_BOOT_NOR:
|
||||
+ media = "rootdisk-nor";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7986_BOOT_SPIM_NAND:
|
||||
+ media = "rootdisk-spim-nand";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7986_BOOT_EMMC:
|
||||
+ media = "rootdisk-emmc";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7986_BOOT_SNFI_NAND:
|
||||
+ media = "rootdisk-sd";
|
||||
+ break
|
||||
+ ;;
|
||||
+ }
|
||||
+
|
||||
+ chosen = fdt_path_offset(blob, "/chosen");
|
||||
+ if (chosen <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle_p = fdt_getprop(blob, chosen, media, &len);
|
||||
+ if (media_handle_p <= 0 || len != 4)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle = *media_handle_p;
|
||||
+ ret = fdt_setprop(blob, chosen, "rootdisk", &media_handle, sizeof(media_handle));
|
||||
+ if (ret) {
|
||||
+ printf("cannot set media phandle %s as rootdisk /chosen node\n", media);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ printf("set /chosen/rootdisk to bootrom media: %s (phandle 0x%08x)\n", media, fdt32_to_cpu(media_handle));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,141 @@
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -11,7 +11,9 @@
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
+#include <asm/io.h>
|
||||
#include <linux/delay.h>
|
||||
+#include <linux/libfdt.h>
|
||||
|
||||
#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@@ -22,10 +24,43 @@
|
||||
#include <nmbm/nmbm.h>
|
||||
#include <nmbm/nmbm-mtd.h>
|
||||
|
||||
+#define MT7622_TOPRGUSTRAP_PAR 0x10212060
|
||||
+#define MT7622_BOOT_SEQ_MASK 0x18
|
||||
+#define MT7622_BOOT_SEQ_SHIFT 3
|
||||
+#define MT7622_BOOT_SEQ_NOR_EMMC_SDXC 0x0
|
||||
+#define MT7622_BOOT_SEQ_SPI_NAND_EMMC_SDXC 0x1
|
||||
+#define MT7622_BOOT_SEQ_NAND_EMMC_SDXC 0x2
|
||||
+#define MT7622_BOOT_SEQ_SDXC_EMMC_NAND 0x3
|
||||
+
|
||||
+#define MT7622_GPIO_MODE0 0x10211300
|
||||
+#define MT7622_GPIO_NAND_MODE_MASK 0x00f00000
|
||||
+#define MT7622_GPIO_NAND_MODE_SHIFT 20
|
||||
+#define MT7622_GPIO_NAND_MODE_EMMC 0x2
|
||||
+#define MT7622_GPIO_RGMII_MODE_MASK 0x0000f000
|
||||
+#define MT7622_GPIO_RGMII_MODE_SHIFT 12
|
||||
+#define MT7622_GPIO_RGMII_MODE_SDCX 0x2
|
||||
+#define MT7622_GPIO_SPI_MODE_MASK 0x00000f00
|
||||
+#define MT7622_GPIO_SPI_MODE_SHIFT 8
|
||||
+#define MT7622_GPIO_SPI_MODE_NAND 0x2
|
||||
+
|
||||
+#define MT7622_MSDC_INT 0x1124000C
|
||||
+#define MT7622_MSDC_INT_BD_CS_ERR 0x200
|
||||
+
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
+static int gpio_mode0;
|
||||
+static int msdc_int;
|
||||
+
|
||||
int board_init(void)
|
||||
{
|
||||
+ /*
|
||||
+ * Save content of GPIO_MODE0 as left behind by the BootROM.
|
||||
+ * Also grab MSDC1 INT status to see if BootROM has been reading
|
||||
+ * from SD card.
|
||||
+ * Together this will allow to infer the device used for booting.
|
||||
+ */
|
||||
+ gpio_mode0 = readl(MT7622_GPIO_MODE0);
|
||||
+ msdc_int = readl(MT7622_MSDC_INT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,3 +118,84 @@ int board_nmbm_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int ft_system_setup(void *blob, struct bd_info *bd)
|
||||
+{
|
||||
+ bool pinctrl_set_mmc = false;
|
||||
+ bool pinctrl_set_snfi = false;
|
||||
+ bool pinctrl_set_emmc = false;
|
||||
+ bool msdc_bd_cs_err = false;
|
||||
+
|
||||
+ const u32 *media_handle_p;
|
||||
+ int chosen, len, ret;
|
||||
+ const char *media;
|
||||
+ u32 media_handle, strap;
|
||||
+
|
||||
+ if ((gpio_mode0 & MT7622_GPIO_RGMII_MODE_MASK) >>
|
||||
+ MT7622_GPIO_RGMII_MODE_SHIFT == MT7622_GPIO_RGMII_MODE_SDCX)
|
||||
+ pinctrl_set_mmc = true;
|
||||
+
|
||||
+ if ((gpio_mode0 & MT7622_GPIO_SPI_MODE_MASK) >>
|
||||
+ MT7622_GPIO_SPI_MODE_SHIFT == MT7622_GPIO_SPI_MODE_NAND)
|
||||
+ pinctrl_set_snfi = true;
|
||||
+
|
||||
+ if ((gpio_mode0 & MT7622_GPIO_NAND_MODE_MASK) >>
|
||||
+ MT7622_GPIO_NAND_MODE_SHIFT == MT7622_GPIO_NAND_MODE_EMMC)
|
||||
+ pinctrl_set_emmc = true;
|
||||
+
|
||||
+ if (msdc_int & MT7622_MSDC_INT_BD_CS_ERR)
|
||||
+ msdc_bd_cs_err = true;
|
||||
+
|
||||
+ strap = readl(MT7622_TOPRGUSTRAP_PAR);
|
||||
+ strap &= MT7622_BOOT_SEQ_MASK;
|
||||
+ strap >>= MT7622_BOOT_SEQ_SHIFT;
|
||||
+ switch (strap) {
|
||||
+ case MT7622_BOOT_SEQ_NOR_EMMC_SDXC:
|
||||
+ if (!pinctrl_set_emmc)
|
||||
+ media = "rootdisk-nor";
|
||||
+ else if (pinctrl_set_mmc)
|
||||
+ media = "rootdisk-emmc";
|
||||
+ else
|
||||
+ media = "rootdisk-sd";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7622_BOOT_SEQ_SPI_NAND_EMMC_SDXC:
|
||||
+ if (pinctrl_set_snfi)
|
||||
+ media = "rootdisk-snfi";
|
||||
+ else if (pinctrl_set_emmc)
|
||||
+ media = "rootdisk-emmc";
|
||||
+ else
|
||||
+ media = "rootdisk-sd";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case MT7622_BOOT_SEQ_NAND_EMMC_SDXC:
|
||||
+ case MT7622_BOOT_SEQ_SDXC_EMMC_NAND:
|
||||
+ if (!pinctrl_set_emmc && pinctrl_set_mmc)
|
||||
+ media = "rootdisk-nand";
|
||||
+ else if (pinctrl_set_emmc)
|
||||
+ media = "rootdisk-emmc";
|
||||
+ else
|
||||
+ media = "rootdisk-sd";
|
||||
+ break
|
||||
+ ;;
|
||||
+ }
|
||||
+
|
||||
+ chosen = fdt_path_offset(blob, "/chosen");
|
||||
+ if (chosen <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle_p = fdt_getprop(blob, chosen, media, &len);
|
||||
+ if (media_handle_p <= 0 || len != 4)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle = *media_handle_p;
|
||||
+ ret = fdt_setprop(blob, chosen, "rootdisk", &media_handle, sizeof(media_handle));
|
||||
+ if (ret) {
|
||||
+ printf("cannot set media phandle %s as rootdisk /chosen node\n", media);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ printf("set /chosen/rootdisk to bootrom media: %s (phandle 0x%08x)\n", media, fdt32_to_cpu(media_handle));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,46 @@
|
||||
--- a/board/mediatek/mt7623/mt7623_rfb.c
|
||||
+++ b/board/mediatek/mt7623/mt7623_rfb.c
|
||||
@@ -91,3 +91,43 @@ int board_late_init(void)
|
||||
env_relocate();
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int ft_system_setup(void *blob, struct bd_info *bd)
|
||||
+{
|
||||
+ const u32 *media_handle_p;
|
||||
+ int chosen, len, ret;
|
||||
+ const char *media;
|
||||
+ u32 media_handle;
|
||||
+
|
||||
+#ifdef CONFIG_MMC
|
||||
+ switch (mmc_get_boot_dev()) {
|
||||
+ case 0:
|
||||
+ media = "rootdisk-emmc";
|
||||
+ break
|
||||
+ ;;
|
||||
+ case 1:
|
||||
+ media = "rootdisk-sd";
|
||||
+ break
|
||||
+ ;;
|
||||
+ }
|
||||
+
|
||||
+ chosen = fdt_path_offset(blob, "/chosen");
|
||||
+ if (chosen <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle_p = fdt_getprop(blob, chosen, media, &len);
|
||||
+ if (media_handle_p <= 0 || len != 4)
|
||||
+ return 0;
|
||||
+
|
||||
+ media_handle = *media_handle_p;
|
||||
+ ret = fdt_setprop(blob, chosen, "rootdisk", &media_handle, sizeof(media_handle));
|
||||
+ if (ret) {
|
||||
+ printf("cannot set media phandle %s as rootdisk /chosen node\n", media);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ printf("set /chosen/rootdisk to bootrom media: %s (phandle 0x%08x)\n", media, fdt32_to_cpu(media_handle));
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
@@ -0,0 +1,211 @@
|
||||
--- a/configs/mt7623n_bpir2_defconfig
|
||||
+++ b/configs/mt7623n_bpir2_defconfig
|
||||
@@ -7,52 +7,98 @@ CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x81ffff10
|
||||
-CONFIG_ENV_SIZE=0x1000
|
||||
+CONFIG_ENV_SIZE=0x10000
|
||||
CONFIG_ENV_OFFSET=0x100000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
CONFIG_TARGET_MT7623=y
|
||||
+CONFIG_RESET_BUTTON_LABEL="factory"
|
||||
CONFIG_SYS_LOAD_ADDR=0x84000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_AHCI=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
+# CONFIG_BOOTSTD is not set
|
||||
CONFIG_SYS_BOOTM_LEN=0x4000000
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=3
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb"
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
+CONFIG_LOGLEVEL=7
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
+CONFIG_LOG=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
-CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_SYS_PROMPT="MT7623> "
|
||||
CONFIG_SYS_MAXARGS=8
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
-CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MBR=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_READ=y
|
||||
-# CONFIG_CMD_SETEXPR is not set
|
||||
+CONFIG_CMD_SATA=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r2_env"
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
CONFIG_USE_IPADDR=y
|
||||
CONFIG_IPADDR="192.168.1.1"
|
||||
CONFIG_USE_SERVERIP=y
|
||||
CONFIG_SERVERIP="192.168.1.2"
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
CONFIG_CLK=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
# CONFIG_MMC_QUIRKS is not set
|
||||
CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
CONFIG_MMC_HS400_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_PHY_FIXED=y
|
||||
CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_MT7623=y
|
||||
CONFIG_POWER_DOMAIN=y
|
||||
CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_SCSI=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
CONFIG_MTK_SERIAL=y
|
||||
CONFIG_SYSRESET=y
|
||||
@@ -60,5 +106,6 @@ CONFIG_SYSRESET_WATCHDOG=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_MTK_TIMER=y
|
||||
CONFIG_WDT_MTK=y
|
||||
+CONFIG_RANDOM_UUID=y
|
||||
CONFIG_LZMA=y
|
||||
# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r2_env
|
||||
@@ -0,0 +1,69 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x88000000
|
||||
+dtaddr=0x83f00000
|
||||
+console=earlycon=uart8250,mmio32,0x11004000 console=ttyS2,115200 console=tty1
|
||||
+initrd_high=0xafffffff
|
||||
+part_default=3
|
||||
+part_recovery=2
|
||||
+bootcmd=run boot_mmc
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7623-bananapi_bpi-r2-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-mt7623-bananapi_bpi-r2-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=bpi-r2:pio:green
|
||||
+bootled_rec=bpi-r2:pio:blue
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_first=if button factory ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_tftp_forever=led bpi-r2:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run mmc_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run mmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
|
||||
+boot_mmc=run boot_production ; run boot_recovery
|
||||
+emmc_init=run emmc_init_bl && run emmc_init_openwrt ; env default bootcmd ; saveenv
|
||||
+emmc_init_bl=run sdmmc_read_emmc_hdr && run emmc_write_hdr && run sdmmc_read_preloader && run emmc_write_preloader && run sdmmc_read_uboot && run emmc_write_uboot
|
||||
+emmc_init_openwrt=run sdmmc_read_recovery && run emmc_write_recovery ; run sdmmc_read_production && run emmc_write_production
|
||||
+emmc_write_hdr=mmc dev 0 0 ; mmc erase 0x0 0x2000 ; mmc write $loadaddr 0x0 0x4 ; mmc dev 0 1 ; mmc partconf 0 1 1 1 ; mmc erase 0x0 0x400 ; mmc write $loadaddr 0x0 0x4 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_preloader=mmc dev 0 1 ; mmc partconf 0 1 1 1 ; mmc write $loadaddr 0x4 0x100 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_uboot=mmc dev 0 0 ; part size mmc 0 1 part_size && part start mmc 0 1 part_addr && mmc write $loadaddr $part_addr 0x400
|
||||
+emmc_write_production=mmc dev 0 0 ; iminfo $loadaddr && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=mmc dev 0 0 ; iminfo $loadaddr && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+emmc_read_production=mmc dev 0 0 ; part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=mmc dev 0 0 ; part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+mmc_write_production=if test "$bootedfrom" = "SD" ; then run sdmmc_write_production ; else run emmc_write_production ; fi
|
||||
+mmc_write_recovery=if test "$bootedfrom" = "SD" ; run sdmmc_write_recovery ; else run emmc_write_recovery ; fi
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+reset_factory=eraseenv && reset
|
||||
+sdmmc_read_emmc_hdr=mmc dev 1 && mmc read $loadaddr 0x1ff8 0x8
|
||||
+sdmmc_read_preloader=mmc dev 1 && mmc read $loadaddr 0x4 0x100
|
||||
+sdmmc_read_uboot=mmc dev 1 ; part start mmc 1 1 part_addr && part size mmc 1 1 part_size && mmc read $loadaddr $part_addr $part_size
|
||||
+sdmmc_read_production=mmc dev 1 ; part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_read_vol
|
||||
+sdmmc_read_recovery=mmc dev 1 ; part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_read_vol
|
||||
+sdmmc_write_production=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_write_vol
|
||||
+sdmmc_write_recovery=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol
|
||||
+_checkbootedfrom=setenv _checkbootedfrom ; if itest.l *81dffff0 == 434d4d65 ; then setenv bootedfrom eMMC ; else setenv bootedfrom SD ; fi
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; led $bootled_pwr off ;led $bootled_rec on ; run _checkbootedfrom _switch_to_menu _update_bootcmd _update_bootcmd2 _init_env boot_first
|
||||
+_set_bootcmd_sdmmc=setenv boot_production "led $bootled_rec off ; led $bootled_pwr on ; run sdmmc_read_production && bootm $loadaddr ; led $bootled_pwr off"
|
||||
+_set_bootcmd_emmc=setenv boot_production "led $bootled_rec off ; led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr ; led $bootled_pwr off"
|
||||
+_update_bootcmd=setenv _update_bootcmd ; if test "$bootedfrom" = "SD" ; then run _set_bootcmd_sdmmc ; else run _set_bootcmd_emmc ; fi ; setenv _set_bootcmd_sdmmc ; setenv _set_bootcmd_emmc
|
||||
+_set_bootcmd2_sdmmc=setenv boot_recovery "led $bootled_pwr off ; led $bootled_rec on ; run sdmmc_read_recovery && bootm $loadaddr ; led $bootled_rec off"
|
||||
+_set_bootcmd2_emmc=setenv boot_recovery "led $bootled_pwr off ; led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr ; led $bootled_rec off"
|
||||
+_update_bootcmd2=setenv _update_bootcmd2 ; if test "$bootedfrom" = "SD" ; then run _set_bootcmd2_sdmmc ; else run _set_bootcmd2_emmc ; fi ; setenv _set_bootcmd2_sdmmc ; setenv _set_bootcmd2_emmc
|
||||
+_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 [0;36m[$bootedfrom][0m [33m$ver[0m" ; run _set_bm2
|
||||
+_set_bm2=setenv _set_bm2 ; setenv bootmenu_2 "Boot production system from $bootedfrom.=run boot_production ; run bootmenu_confirm_return" ; run _set_bm3
|
||||
+_set_bm3=setenv _set_bm3 ; setenv bootmenu_3 "Boot recovery system from $bootedfrom.=run boot_recovery ; run bootmenu_confirm_return" ; run _set_bm4
|
||||
+_set_bm4=setenv _set_bm4 ; setenv bootmenu_4 "Load production system via TFTP then write to $bootedfrom.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return" ; run _set_bm5
|
||||
+_set_bm5=setenv _set_bm5 ; setenv bootmenu_5 "Load recovery system via TFTP then write to $bootedfrom.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return" ; run _set_bm5a
|
||||
+_set_bm5a=setenv _set_bm5a ; if test "$bootedfrom" = "SD" ; then run _set_bm6 ; else setenv _set_bm6 ; setenv _menu_next 6 ; fi ; run _set_bmr
|
||||
+_set_bm6=setenv _set_bm6 ; setenv bootmenu_6 "[31mInstall bootloader, recovery and production to eMMC.[0m=run emmc_init ; run bootmenu_confirm_return" ; setenv _menu_next 7
|
||||
+_set_bmr=setenv _set_bmr ; setenv bootmenu_${_menu_next} "Reboot.=reset" ; setexpr _menu_next ${_menu_next} + 1 ; run _set_bmf
|
||||
+_set_bmf=setenv _set_bmf ; setenv bootmenu_${_menu_next} "Reset all settings to factory defaults.=run reset_factory ; reset" ; setenv _menu_next
|
||||
--- a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
#include "mt7623.dtsi"
|
||||
#include "mt7623-u-boot.dtsi"
|
||||
|
||||
@@ -66,6 +67,16 @@
|
||||
default-state = "off";
|
||||
};
|
||||
};
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "factory";
|
||||
+ gpios = <&gpio 256 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
ð {
|
||||
@@ -0,0 +1,209 @@
|
||||
--- a/configs/mt7623a_unielec_u7623_02_defconfig
|
||||
+++ b/configs/mt7623a_unielec_u7623_02_defconfig
|
||||
@@ -7,51 +7,97 @@ CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
|
||||
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x81ffff10
|
||||
-CONFIG_ENV_SIZE=0x1000
|
||||
+CONFIG_ENV_SIZE=0x10000
|
||||
CONFIG_ENV_OFFSET=0x100000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7623a-unielec-u7623-02-emmc"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
CONFIG_TARGET_MT7623=y
|
||||
+CONFIG_RESET_BUTTON_LABEL="factory"
|
||||
CONFIG_SYS_LOAD_ADDR=0x84000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_AHCI=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
+# CONFIG_BOOTSTD is not set
|
||||
CONFIG_SYS_BOOTM_LEN=0x4000000
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=3
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7623a-unielec-u7623-02-emmc.dtb"
|
||||
CONFIG_SYS_PBSIZE=1049
|
||||
+CONFIG_LOGLEVEL=7
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
+CONFIG_LOG=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
-CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_SYS_PROMPT="MT7623> "
|
||||
CONFIG_SYS_MAXARGS=8
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
CONFIG_CMD_GPIO=y
|
||||
-CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MBR=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_READ=y
|
||||
-# CONFIG_CMD_SETEXPR is not set
|
||||
+CONFIG_CMD_SATA=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="unielec_u7623-02_env"
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
CONFIG_USE_IPADDR=y
|
||||
CONFIG_IPADDR="192.168.1.1"
|
||||
CONFIG_USE_SERVERIP=y
|
||||
CONFIG_SERVERIP="192.168.1.2"
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
CONFIG_CLK=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
# CONFIG_MMC_QUIRKS is not set
|
||||
CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
CONFIG_MMC_HS400_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_PHY_FIXED=y
|
||||
CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_MT7623=y
|
||||
CONFIG_POWER_DOMAIN=y
|
||||
CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_SCSI=y
|
||||
CONFIG_DM_SERIAL=y
|
||||
CONFIG_MTK_SERIAL=y
|
||||
CONFIG_SYSRESET=y
|
||||
@@ -59,4 +105,5 @@ CONFIG_SYSRESET_WATCHDOG=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_MTK_TIMER=y
|
||||
CONFIG_WDT_MTK=y
|
||||
+CONFIG_RANDOM_UUID=y
|
||||
CONFIG_LZMA=y
|
||||
--- /dev/null
|
||||
+++ b/unielec_u7623-02_env
|
||||
@@ -0,0 +1,47 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x88000000
|
||||
+dtaddr=0x83f00000
|
||||
+console=earlycon=uart8250,mmio32,0x11004000 console=ttyS0,115200
|
||||
+initrd_high=0xafffffff
|
||||
+part_default=3
|
||||
+part_recovery=2
|
||||
+bootcmd=run boot_mmc
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7623-unielec_u7623-02-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-mt7623-unielec_u7623-02-squashfs-sysupgrade.itb
|
||||
+bootled_rec=u7623-01:green:led3
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=Reboot.=reset
|
||||
+bootmenu_7=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_first=if button factory ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_production=run emmc_read_production && bootm $loadaddr
|
||||
+boot_recovery=run emmc_read_recovery && bootm $loadaddr
|
||||
+boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
|
||||
+boot_mmc=run boot_production ; run boot_recovery
|
||||
+emmc_write_production=mmc dev 0 0 ; iminfo $loadaddr && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=mmc dev 0 0 ; iminfo $loadaddr && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+emmc_read_production=mmc dev 0 0 ; part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=mmc dev 0 0 ; part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+reset_factory=eraseenv && reset
|
||||
+_init_env=setenv _init_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu _update_bootdev _init_env boot_first
|
||||
+_update_bootdev=setenv _update_bootdev ; setenv bootargs "$console root=/dev/fit0 rootwait"
|
||||
+_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 [33m$ver[0m"
|
||||
--- a/arch/arm/dts/mt7623a-unielec-u7623-02-emmc.dts
|
||||
+++ b/arch/arm/dts/mt7623a-unielec-u7623-02-emmc.dts
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
#include "mt7623.dtsi"
|
||||
#include "mt7623-u-boot.dtsi"
|
||||
|
||||
@@ -50,6 +51,18 @@
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&key_pins_a>;
|
||||
+
|
||||
+ factory {
|
||||
+ label = "factory";
|
||||
+ gpios = <&gpio 256 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@@ -109,6 +122,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ key_pins_a: keys-alt {
|
||||
+ mux {
|
||||
+ function = "gpio";
|
||||
+ groups = "msdc3";
|
||||
+ };
|
||||
+
|
||||
+ conf {
|
||||
+ pins = "MSDC0E_DAT0", "MSDC0E_DAT1";
|
||||
+ input-enable;
|
||||
+ bias-pull-up;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
mmc0_pins_default: mmc0default {
|
||||
mux {
|
||||
function = "msdc";
|
||||
@@ -0,0 +1,89 @@
|
||||
--- a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
#include "mt7622.dtsi"
|
||||
#include "mt7622-u-boot.dtsi"
|
||||
|
||||
@@ -20,6 +21,7 @@
|
||||
|
||||
aliases {
|
||||
spi0 = &snfi;
|
||||
+ ethernet0 = ð
|
||||
};
|
||||
|
||||
memory@40000000 {
|
||||
@@ -27,6 +29,44 @@
|
||||
reg = <0x40000000 0x40000000>;
|
||||
};
|
||||
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ gpios = <&gpio 102 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+/*
|
||||
+ * red {
|
||||
+ * label = "bpi-r64:pio:red";
|
||||
+ * gpios = <&gpio 88 GPIO_ACTIVE_HIGH>;
|
||||
+ * default-state = "off";
|
||||
+ * };
|
||||
+ */
|
||||
+ green {
|
||||
+ label = "bpi-r64:pio:green";
|
||||
+ gpios = <&gpio 89 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ blue {
|
||||
+ label = "bpi-r64:pio:blue";
|
||||
+ gpios = <&gpio 85 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
reg_1p8v: regulator-1p8v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "fixed-1.8V";
|
||||
@@ -182,6 +222,7 @@
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -197,7 +238,7 @@
|
||||
status = "okay";
|
||||
bus-width = <8>;
|
||||
max-frequency = <50000000>;
|
||||
- cap-sd-highspeed;
|
||||
+ cap-mmc-highspeed;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
vqmmc-supply = <®_3p3v>;
|
||||
non-removable;
|
||||
@@ -208,7 +249,7 @@
|
||||
pinctrl-0 = <&mmc1_pins_default>;
|
||||
status = "okay";
|
||||
bus-width = <4>;
|
||||
- max-frequency = <50000000>;
|
||||
+ max-frequency = <12000000>;
|
||||
cap-sd-highspeed;
|
||||
r_smpl = <1>;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
@@ -0,0 +1,47 @@
|
||||
--- a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts
|
||||
+++ b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts
|
||||
@@ -20,7 +20,7 @@
|
||||
};
|
||||
|
||||
aliases {
|
||||
- spi0 = &snfi;
|
||||
+ spi0 = &snand;
|
||||
ethernet0 = ð
|
||||
};
|
||||
|
||||
@@ -208,16 +208,27 @@
|
||||
};
|
||||
};
|
||||
|
||||
-&snfi {
|
||||
- pinctrl-names = "default", "snfi";
|
||||
- pinctrl-0 = <&snor_pins>;
|
||||
- pinctrl-1 = <&snfi_pins>;
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ quad-spi;
|
||||
status = "okay";
|
||||
|
||||
- spi-flash@0{
|
||||
- compatible = "jedec,spi-nor";
|
||||
- reg = <0>;
|
||||
- bootph-all;
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@80000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x80000 0x7f80000>;
|
||||
+ compatible = "linux,ubi";
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,568 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_bananapi_bpi-r64-sdmmc_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x80000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x480000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7622-bananapi-bpi-r64.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_SYS_MMC_ENV_DEV=1
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-sdmmc_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r64-sdmmc_env
|
||||
@@ -0,0 +1,81 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi
|
||||
+bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1
|
||||
+bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1
|
||||
+bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb
|
||||
+bootfile_emmcbl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-preloader.bin
|
||||
+bootfile_emmcbl3=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=bpi-r64:pio:green
|
||||
+bootled_rec=bpi-r64:pio:blue
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SD card][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from SD card.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mInstall bootloader, recovery and production to eMMC.[0m=run emmc_init ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mInstall bootloader, recovery and production to NAND.[0m=run ubi_init ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run sdmmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run sdmmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_sdmmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run sdmmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
|
||||
+boot_ubi=ubi part ubi && setenv bootargs && run boot_ubi_production ; run boot_ubi_recovery
|
||||
+boot_ubi_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr ; led $bootled_pwr off
|
||||
+boot_ubi_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off
|
||||
+emmc_init=run emmc_init_bl && run emmc_init_openwrt ; env default bootcmd ; saveenv ; saveenv
|
||||
+emmc_init_bl=run sdmmc_read_emmc_bl2 && run emmc_write_bl2 && run sdmmc_read_emmc_hdr && run emmc_write_hdr && run sdmmc_read_emmc_fip && run emmc_write_fip
|
||||
+emmc_init_openwrt=run sdmmc_read_recovery && iminfo $loadaddr && run emmc_write_recovery ; run sdmmc_read_production && iminfo $loadaddr && run emmc_write_production
|
||||
+emmc_write_bl2=mmc dev 0 1 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $loadaddr 0x0 0x100 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc dev 0 0 && mmc erase 0x1000 0x1000 && mmc write $loadaddr 0x1000 0x1000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_hdr=mmc dev 0 0 && mmc erase 0x0 0x40 && mmc write $loadaddr 0x0 0x40
|
||||
+emmc_write_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+sdmmc_read_emmc_hdr=mmc dev 1 && part start mmc 1 install part_addr && mmc read $loadaddr $part_addr 0x40
|
||||
+sdmmc_read_emmc_bl2=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x400 && mmc read $loadaddr $offset 0x400
|
||||
+sdmmc_read_emmc_fip=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x1000 && mmc read $loadaddr $offset 0x1000
|
||||
+sdmmc_read_production=mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_read_vol
|
||||
+sdmmc_read_recovery=mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_read_vol
|
||||
+sdmmc_read_snand_bl2=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x2000 && mmc read $loadaddr $offset 0x400
|
||||
+sdmmc_read_snand_fip=mmc dev 1 && part start mmc 1 install part_addr && setexpr offset $part_addr + 0x2400 && mmc read $loadaddr $offset 0x1000
|
||||
+sdmmc_write_production=mmc dev 1 && part start mmc 1 $part_default part_addr && part size mmc 1 $part_default part_size && run mmc_write_vol
|
||||
+sdmmc_write_recovery=mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol
|
||||
+snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x20000 && mtd write bl2 $loadaddr 0x20000 0x20000 && mtd write bl2 $loadaddr 0x40000 0x20000 && mtd write bl2 $loadaddr 0x60000 0x20000
|
||||
+ubi_create_env=ubi create ubootenv 0x1f000 dynamic ; ubi create ubootenv2 0x1f000 dynamic
|
||||
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi
|
||||
+ubi_init=run ubi_format && run ubi_init_bl && run ubi_create_env && run ubi_init_openwrt
|
||||
+ubi_init_openwrt=run sdmmc_read_recovery && iminfo $loadaddr && run ubi_write_recovery ; run sdmmc_read_production && iminfo $loadaddr && run ubi_write_production
|
||||
+ubi_init_bl=run sdmmc_read_snand_bl2 && run snand_write_bl2 && run sdmmc_read_snand_fip && run ubi_write_fip
|
||||
+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_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_bananapi_bpi-r64-emmc_defconfig
|
||||
@@ -0,0 +1,119 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x80000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x480000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7622-bananapi-bpi-r64"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-emmc_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_LZO=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r64-emmc_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1
|
||||
+bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1
|
||||
+bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
|
||||
+bootfile_bl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-mt7622-bananapi_bpi-r64-emmc-bl31-uboot.fip
|
||||
+bootled_pwr=bpi-r64:pio:green
|
||||
+bootled_rec=bpi-r64:pio:blue
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[eMMC][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to eMMC.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_emmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
|
||||
+emmc_write_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+emmc_write_bl2=mmc dev 0 1 && mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $loadaddr 0x0 0x100 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc dev 0 0 && mmc erase 0x1000 0x1000 && mmc write $loadaddr 0x1000 0x1000 && mmc erase 0x2000 0x800
|
||||
+emmc_read_production=mmc dev 0 && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=mmc dev 0 && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+mmc_write_vol=imszb $fileaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $fileaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_bananapi_bpi-r64-snand_defconfig
|
||||
@@ -0,0 +1,108 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_DISTRO_DEFAULTS=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7622-bananapi-bpi-r64.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_EFIDEBUG=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-snand_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.3"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r64-snand_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootargs=ubi.block=0,fit root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1
|
||||
+bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1
|
||||
+bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb
|
||||
+bootfile_fip=openwrt-mediatek-mt7622-bananapi_bpi-r64-snand-bl31-uboot.fip
|
||||
+bootfile_bl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-snand-preloader.bin
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=bpi-r64:pio:green
|
||||
+bootled_rec=bpi-r64:pio:blue
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NAND][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; 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#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip
|
||||
+boot_ubi=ubi part ubi && run boot_production ; run boot_recovery
|
||||
+snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x20000 && mtd write bl2 $loadaddr 0x20000 0x20000 && mtd write bl2 $loadaddr 0x40000 0x20000 && mtd write bl2 $loadaddr 0x60000 0x20000
|
||||
+check_ubi=ubi part ubi || run ubi_format
|
||||
+reset_factory=mw $loadaddr 0x0 0x1f000 ; ubi part ubi ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
|
||||
+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_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
|
||||
+ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ; fi
|
||||
+ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ; fi
|
||||
+_create_env=ubi create ubootenv 0x1f000 dynamic ; ubi create ubootenv2 0x1f000 dynamic
|
||||
+_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,25 @@
|
||||
--- a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -51,19 +51,19 @@
|
||||
|
||||
blue {
|
||||
label = "bpi-r2:pio:blue";
|
||||
- gpios = <&gpio 241 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio 240 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
green {
|
||||
label = "bpi-r2:pio:green";
|
||||
- gpios = <&gpio 240 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio 241 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
||||
};
|
||||
|
||||
red {
|
||||
label = "bpi-r2:pio:red";
|
||||
- gpios = <&gpio 239 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&gpio 239 GPIO_ACTIVE_LOW>;
|
||||
default-state = "off";
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -245,6 +245,7 @@
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins_a>;
|
||||
+ mediatek,force-highspeed;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
400
package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
Normal file
400
package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch
Normal file
@@ -0,0 +1,400 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_linksys_e8450_defconfig
|
||||
@@ -0,0 +1,112 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-linksys-e8450-ubi"
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7622-linksys-e8450"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="linksys_e8450_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7622-linksys-e8450-ubi.dts
|
||||
@@ -0,0 +1,214 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2019 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#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 = &snand;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ gpios = <&gpio 102 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@80000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x80000 0x7f80000>;
|
||||
+ compatible = "linux,ubi";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&watchdog_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&ssusb {
|
||||
+ vusb33-supply = <®_3p3v>;
|
||||
+ vbus-supply = <®_5v>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&u3phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1222,6 +1222,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 \
|
||||
mt7981-rfb.dtb \
|
||||
--- /dev/null
|
||||
+++ b/linksys_e8450_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ethaddr_factory=ubi read 0x40080000 factory && env readmem -b ethaddr 0x400ffff4 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+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
|
||||
+bootled_pwr=power:blue
|
||||
+bootled_rec=inet:orange on
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )[0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery ; bootm $loadaddr#$bootconf ; ubi remove recovery ; led $bootled_rec off
|
||||
+boot_serial_write_bl2=loadx $loadaddr 115200 && run snand_write_bl2
|
||||
+boot_serial_write_fip=loadx $loadaddr 115200 && run ubi_write_fip
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; 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#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && iminfo $loadaddr && ubi part ubi && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip
|
||||
+boot_ubi=ubi part ubi && run boot_production ; run boot_recovery
|
||||
+snand_write_bl2=mtd erase bl2 && mtd write spi-nand0 $loadaddr 0x0 0x20000 && mtd write spi-nand0 $loadaddr 0x20000 0x20000 && mtd write spi-nand0 $loadaddr 0x40000 0x20000 && mtd write spi-nand0 $loadaddr 0x60000 0x20000
|
||||
+reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi part ubi ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
|
||||
+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_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
|
||||
+ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ; fi
|
||||
+ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ; fi
|
||||
+_create_env=ubi create ubootenv 0x1f000 dynamic ; ubi create ubootenv2 0x1f000 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 ; run _switch_to_menu ; run ethaddr_factory ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,950 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_ubnt_unifi-6-lr-v1_defconfig
|
||||
@@ -0,0 +1,113 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_ENV_SIZE=0x4000
|
||||
+CONFIG_ENV_OFFSET=0xc0000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-ubnt-unifi-6-lr"
|
||||
+CONFIG_RESET_BUTTON_SETTLE_DELAY=400
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7622-ubnt-unifi-6-lr"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="ubnt_unifi-6-lr_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_BAR=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_SST=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHY_ADDR_ENABLE=y
|
||||
+CONFIG_PHY_ADDR=8
|
||||
+CONFIG_PHY_AQUANTIA=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
+CONFIG_DM_ETH_PHY=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SNOR=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_RANDOM_UUID=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_ubnt_unifi-6-lr-v2_defconfig
|
||||
@@ -0,0 +1,113 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_ENV_SIZE=0x4000
|
||||
+CONFIG_ENV_OFFSET=0xc0000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-ubnt-unifi-6-lr"
|
||||
+CONFIG_RESET_BUTTON_SETTLE_DELAY=400
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7622-ubnt-unifi-6-lr"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="ubnt_unifi-6-lr-v2_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_BAR=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_SST=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHY_ADDR_ENABLE=y
|
||||
+CONFIG_PHY_ADDR=8
|
||||
+CONFIG_PHY_AQUANTIA=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
+CONFIG_DM_ETH_PHY=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SNOR=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_RANDOM_UUID=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_ubnt_unifi-6-lr-v3_defconfig
|
||||
@@ -0,0 +1,112 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_ENV_SIZE=0x4000
|
||||
+CONFIG_ENV_OFFSET=0xc0000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-ubnt-unifi-6-lr-v3"
|
||||
+CONFIG_RESET_BUTTON_SETTLE_DELAY=400
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7622-ubnt-unifi-6-lr-v3"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x4000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="ubnt_unifi-6-lr_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_BAR=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_SST=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHY_ADDR_ENABLE=y
|
||||
+CONFIG_PHY_REALTEK=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
+CONFIG_DM_ETH_PHY=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SNOR=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_RANDOM_UUID=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7622-ubnt-unifi-6-lr.dts
|
||||
@@ -0,0 +1,193 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2019 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include "mt7622.dtsi"
|
||||
+#include "mt7622-u-boot.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "mt7622-ubnt-unifi-6-lr";
|
||||
+ compatible = "mediatek,mt7622", "ubnt,unifi-6-lr";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ aliases {
|
||||
+ spi0 = &snor;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 62 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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 {
|
||||
+ eth_pins: eth-pins {
|
||||
+ mux {
|
||||
+ function = "eth";
|
||||
+ groups = "mdc_mdio", "rgmii_via_gmac2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ snor_pins: snor-pins {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi_nor";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart0_pins: uart0 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart0_0_tx_rx" ;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ watchdog_pins: watchdog-default {
|
||||
+ mux {
|
||||
+ function = "watchdog";
|
||||
+ groups = "watchdog";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&snor {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snor_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ spi-flash@0 {
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ reg = <0>;
|
||||
+ spi-tx-bus-width = <1>;
|
||||
+ spi-rx-bus-width = <4>;
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&watchdog_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <ð_pins>;
|
||||
+
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ phy-handle = <&gphy>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+
|
||||
+ mdio-bus {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ gphy: ethernet-phy@8 {
|
||||
+ /* Marvell AQRate AQR112W - no driver */
|
||||
+ compatible = "ethernet-phy-ieee802.3-c45";
|
||||
+ reg = <0x8>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7622-ubnt-unifi-6-lr-v3.dts
|
||||
@@ -0,0 +1,193 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2019 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include "mt7622.dtsi"
|
||||
+#include "mt7622-u-boot.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "mt7622-ubnt-unifi-6-lr-v3";
|
||||
+ compatible = "mediatek,mt7622", "ubnt,unifi-6-lr-v3";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ aliases {
|
||||
+ spi0 = &snor;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 62 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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 {
|
||||
+ eth_pins: eth-pins {
|
||||
+ mux {
|
||||
+ function = "eth";
|
||||
+ groups = "mdc_mdio", "rgmii_via_gmac2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ snor_pins: snor-pins {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi_nor";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart0_pins: uart0 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart0_0_tx_rx" ;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ watchdog_pins: watchdog-default {
|
||||
+ mux {
|
||||
+ function = "watchdog";
|
||||
+ groups = "watchdog";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&snor {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snor_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ spi-flash@0 {
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ reg = <0>;
|
||||
+ spi-tx-bus-width = <1>;
|
||||
+ spi-rx-bus-width = <4>;
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&watchdog_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <ð_pins>;
|
||||
+
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "sgmii";
|
||||
+ phy-handle = <&gphy>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+
|
||||
+ mdio-bus {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ gphy: ethernet-phy@0 {
|
||||
+ /* RealTek RTL8211FS */
|
||||
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <0x0>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1223,6 +1223,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7623a-unielec-u7623-02-emmc.dtb \
|
||||
mt7622-bananapi-bpi-r64.dtb \
|
||||
mt7622-linksys-e8450-ubi.dtb \
|
||||
+ mt7622-ubnt-unifi-6-lr.dtb \
|
||||
+ mt7622-ubnt-unifi-6-lr-v3.dtb \
|
||||
mt7623n-bananapi-bpi-r2.dtb \
|
||||
mt7629-rfb.dtb \
|
||||
mt7981-rfb.dtb \
|
||||
--- /dev/null
|
||||
+++ b/ubnt_unifi-6-lr_env
|
||||
@@ -0,0 +1,50 @@
|
||||
+ethaddr_factory=mtd read nor0 $loadaddr 0x110000 0x10000 && env readmem -b ethaddr $loadaddr 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v1-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v1-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v1-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v1-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )[0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_preloader ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run nor_read_production && bootm $loadaddr
|
||||
+boot_recovery=run nor_read_recovery ; bootm $loadaddr
|
||||
+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=while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_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_nor=run boot_production ; run boot_recovery
|
||||
+boot_write_fip=mtd erase nor0 0x20000 0x80000 && mtd write nor0 $loadaddr 0x20000 0x80000
|
||||
+boot_write_preloader=mtd erase nor0 0x0 0x20000 && mtd write nor0 $loadaddr 0x0 0x20000
|
||||
+reset_factory=mtd erase nor0 0xc0000 0x10000 && reset
|
||||
+nor_read_production=mtd read nor0 $loadaddr 0x1000000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x1000000 $image_size
|
||||
+nor_read_recovery=mtd read nor0 $loadaddr 0x120000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x120000 $image_size
|
||||
+nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x1000 ; setexpr tmp1 0x$image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb 0x$image_eb * 0x1000
|
||||
+nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase nor0 0x1000000 0x$image_eb && mtd write nor0 $loadaddr 0x1000000 $filesize
|
||||
+nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0xee0000 && mtd erase nor0 0x120000 0x$image_eb && mtd write nor0 $loadaddr 0x120000 $filesize
|
||||
+_init_env=setenv _init_env ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/ubnt_unifi-6-lr-v2_env
|
||||
@@ -0,0 +1,50 @@
|
||||
+ethaddr_factory=mtd read nor0 $loadaddr 0x110000 0x10000 && env readmem -b ethaddr $loadaddr 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v2-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )[0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_preloader ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run nor_read_production && bootm $loadaddr
|
||||
+boot_recovery=run nor_read_recovery ; bootm $loadaddr
|
||||
+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=while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_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_nor=run boot_production ; run boot_recovery
|
||||
+boot_write_fip=mtd erase nor0 0x20000 0x80000 && mtd write nor0 $loadaddr 0x20000 0x80000
|
||||
+boot_write_preloader=mtd erase nor0 0x0 0x20000 && mtd write nor0 $loadaddr 0x0 0x20000
|
||||
+reset_factory=mtd erase nor0 0xc0000 0x10000 && reset
|
||||
+nor_read_production=mtd read nor0 $loadaddr 0x1000000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x1000000 $image_size
|
||||
+nor_read_recovery=mtd read nor0 $loadaddr 0x120000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x120000 $image_size
|
||||
+nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x1000 ; setexpr tmp1 0x$image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb 0x$image_eb * 0x1000
|
||||
+nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase nor0 0x1000000 0x$image_eb && mtd write nor0 $loadaddr 0x1000000 $filesize
|
||||
+nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0xee0000 && mtd erase nor0 0x120000 0x$image_eb && mtd write nor0 $loadaddr 0x120000 $filesize
|
||||
+_init_env=setenv _init_env ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; 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 [33m$ver[0m"--- /dev/null
|
||||
--- /dev/null
|
||||
+++ b/ubnt_unifi-6-lr-v3_env
|
||||
@@ -0,0 +1,50 @@
|
||||
+ethaddr_factory=mtd read nor0 $loadaddr 0x110000 0x10000 && env readmem -b ethaddr $loadaddr 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x48000000
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-ubnt_unifi-6-lr-v3-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )[0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_preloader ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run nor_read_production && bootm $loadaddr
|
||||
+boot_recovery=run nor_read_recovery ; bootm $loadaddr
|
||||
+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=while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_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_nor=run boot_production ; run boot_recovery
|
||||
+boot_write_fip=mtd erase nor0 0x20000 0x80000 && mtd write nor0 $loadaddr 0x20000 0x80000
|
||||
+boot_write_preloader=mtd erase nor0 0x0 0x20000 && mtd write nor0 $loadaddr 0x0 0x20000
|
||||
+reset_factory=mtd erase nor0 0xc0000 0x10000 && reset
|
||||
+nor_read_production=mtd read nor0 $loadaddr 0x1000000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x1000000 $image_size
|
||||
+nor_read_recovery=mtd read nor0 $loadaddr 0x120000 0x1000 && imsz $loadaddr image_size && mtd read nor0 $loadaddr 0x120000 $image_size
|
||||
+nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x1000 ; setexpr tmp1 0x$image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb 0x$image_eb * 0x1000
|
||||
+nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase nor0 0x1000000 0x$image_eb && mtd write nor0 $loadaddr 0x1000000 $filesize
|
||||
+nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0xee0000 && mtd erase nor0 0x120000 0x$image_eb && mtd write nor0 $loadaddr 0x120000 $filesize
|
||||
+_init_env=setenv _init_env ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; 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 [33m$ver[0m"
|
||||
--- a/common/board_r.c
|
||||
+++ b/common/board_r.c
|
||||
@@ -66,6 +66,7 @@
|
||||
#include <asm-generic/gpio.h>
|
||||
#include <efi_loader.h>
|
||||
#include <relocate.h>
|
||||
+#include <spi_flash.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@@ -397,6 +398,20 @@ static int initr_onenand(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if defined(CONFIG_SPI_FLASH)
|
||||
+/* probe SPI FLASH */
|
||||
+static int initr_spiflash(void)
|
||||
+{
|
||||
+ struct udevice *new;
|
||||
+
|
||||
+spi_flash_probe_bus_cs(CONFIG_SF_DEFAULT_BUS,
|
||||
+ CONFIG_SF_DEFAULT_CS,
|
||||
+ &new);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_MMC
|
||||
static int initr_mmc(void)
|
||||
{
|
||||
@@ -681,6 +696,9 @@ static init_fnc_t init_sequence_r[] = {
|
||||
#ifdef CONFIG_NMBM_MTD
|
||||
initr_nmbm,
|
||||
#endif
|
||||
+#ifdef CONFIG_SPI_FLASH
|
||||
+ initr_spiflash,
|
||||
+#endif
|
||||
#ifdef CONFIG_MMC
|
||||
initr_mmc,
|
||||
#endif
|
||||
@@ -0,0 +1,234 @@
|
||||
From 593db38363297247df731566c2aa307a5d795005 Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Thu, 18 Jun 2020 00:13:11 +0200
|
||||
Subject: [PATCH] add support for RAVPower RP-WD009
|
||||
|
||||
---
|
||||
arch/mips/dts/Makefile | 3 +-
|
||||
arch/mips/dts/ravpower-rp-wd009.dts | 50 +++++++++++++++++++++
|
||||
arch/mips/mach-mtmips/Kconfig | 9 ++++
|
||||
board/ravpower/rp-wd009/Kconfig | 12 +++++
|
||||
board/ravpower/rp-wd009/Makefile | 3 ++
|
||||
board/ravpower/rp-wd009/board.c | 16 +++++++
|
||||
configs/ravpower-rp-wd009-ram_defconfig | 59 +++++++++++++++++++++++++
|
||||
include/configs/ravpower-rp-wd009.h | 48 ++++++++++++++++++++
|
||||
8 files changed, 199 insertions(+), 1 deletion(-)
|
||||
create mode 100644 arch/mips/dts/ravpower-rp-wd009.dts
|
||||
create mode 100644 board/ravpower/rp-wd009/Kconfig
|
||||
create mode 100644 board/ravpower/rp-wd009/Makefile
|
||||
create mode 100644 board/ravpower/rp-wd009/board.c
|
||||
create mode 100644 configs/ravpower-rp-wd009-ram_defconfig
|
||||
create mode 100644 include/configs/ravpower-rp-wd009.h
|
||||
|
||||
--- a/arch/mips/dts/Makefile
|
||||
+++ b/arch/mips/dts/Makefile
|
||||
@@ -26,6 +26,7 @@ dtb-$(CONFIG_TARGET_OCTEON_EBB7304) += m
|
||||
dtb-$(CONFIG_TARGET_OCTEON_NIC23) += mrvl,octeon-nic23.dtb
|
||||
dtb-$(CONFIG_BOARD_NETGEAR_CG3100D) += netgear,cg3100d.dtb
|
||||
dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) += netgear,dgnd3700v2.dtb
|
||||
+dtb-$(CONFIG_BOARD_RAVPOWER_RP_WD009) += ravpower-rp-wd009.dtb
|
||||
dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f@st1704.dtb
|
||||
dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb
|
||||
dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/dts/ravpower-rp-wd009.dts
|
||||
@@ -0,0 +1,50 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Stefan Roese <sr@denx.de>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "mt7628a.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "ravpower,rp-wd009", "ralink,mt7628a-soc";
|
||||
+ model = "RAVPower RP-WD009";
|
||||
+
|
||||
+ aliases {
|
||||
+ serial0 = &uart0;
|
||||
+ spi0 = &spi0;
|
||||
+ };
|
||||
+
|
||||
+ memory@0 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x0 0x4000000>;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = "serial0:115200n8";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ status = "okay";
|
||||
+ num-cs = <2>;
|
||||
+
|
||||
+ spi-flash@0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ spi-max-frequency = <40000000>;
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ephy_router_mode>;
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/board/ravpower/rp-wd009/Kconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
+if BOARD_RAVPOWER_RP_WD009
|
||||
+
|
||||
+config SYS_BOARD
|
||||
+ default "rp-wd009"
|
||||
+
|
||||
+config SYS_VENDOR
|
||||
+ default "ravpower"
|
||||
+
|
||||
+config SYS_CONFIG_NAME
|
||||
+ default "ravpower-rp-wd009"
|
||||
+
|
||||
+endif
|
||||
--- /dev/null
|
||||
+++ b/board/ravpower/rp-wd009/Makefile
|
||||
@@ -0,0 +1,3 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0+
|
||||
+
|
||||
+obj-y += board.o
|
||||
--- /dev/null
|
||||
+++ b/board/ravpower/rp-wd009/board.c
|
||||
@@ -0,0 +1,16 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Stefan Roese <sr@denx.de>
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+int board_early_init_f(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int board_late_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/configs/ravpower-rp-wd009-ram_defconfig
|
||||
@@ -0,0 +1,61 @@
|
||||
+CONFIG_MIPS=y
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="ravpower-rp-wd009"
|
||||
+CONFIG_SYS_LOAD_ADDR=0x80010000
|
||||
+CONFIG_ARCH_MTMIPS=y
|
||||
+CONFIG_SOC_MT7628=y
|
||||
+CONFIG_BOARD_RAVPOWER_RP_WD009=y
|
||||
+CONFIG_SYS_MIPS_TIMER_FREQ=290000000
|
||||
+CONFIG_MIPS_BOOT_FDT=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_OF_STDOUT_VIA_ALIAS=y
|
||||
+CONFIG_USE_BOOTCOMMAND=y
|
||||
+CONFIG_BOOTCOMMAND="sf probe && mtd read firmware 82000000 && bootm 82000000"
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_SYS_CBSIZE=512
|
||||
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_MEMINFO=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+# CONFIG_CMD_LOADS is not set
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SPI=y
|
||||
+CONFIG_CMD_WDT=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_MII=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_TIME=y
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
|
||||
+CONFIG_MTDPARTS_DEFAULT="spi0.0:192k(factory-uboot),64k(config),64k(factory),1536k(loader),64k(params),64k(user_backup),64k(user),14272k(firmware),64k(mode)"
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+# CONFIG_DM_DEVICE_REMOVE is not set
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_MT7628_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_BAUDRATE=57600
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_MT7621_SPI=y
|
||||
+CONFIG_SYSRESET_SYSCON=y
|
||||
+CONFIG_WDT=y
|
||||
+CONFIG_WDT_MT7621=y
|
||||
+CONFIG_LZMA=y
|
||||
--- /dev/null
|
||||
+++ b/include/configs/ravpower-rp-wd009.h
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Stefan Roese <sr@denx.de>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __CONFIG_RAVPOWER_RP_WD009_H
|
||||
+#define __CONFIG_RAVPOWER_RP_WD009_H
|
||||
+
|
||||
+/* RAM */
|
||||
+#define CFG_SYS_SDRAM_BASE 0x80000000
|
||||
+
|
||||
+#define CFG_SYS_INIT_SP_OFFSET 0x400000
|
||||
+
|
||||
+/* UART */
|
||||
+#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \
|
||||
+ 230400, 460800, 921600 }
|
||||
+#endif /* __CONFIG_RAVPOWER_RP_WD009_H */
|
||||
--- a/arch/mips/mach-mtmips/mt7628/Kconfig
|
||||
+++ b/arch/mips/mach-mtmips/mt7628/Kconfig
|
||||
@@ -27,6 +27,14 @@ config BOARD_MT7628_RFB
|
||||
SPI-NOR flash, 1 built-in switch with 5 ports, 1 UART, 1 USB host,
|
||||
1 SDXC, 1 PCIe socket and JTAG pins.
|
||||
|
||||
+config BOARD_RAVPOWER_RP_WD009
|
||||
+ bool "RAVPower RP-WD009"
|
||||
+ depends on SOC_MT7628
|
||||
+ select BOARD_LATE_INIT
|
||||
+ select SUPPORTS_BOOT_RAM
|
||||
+ help
|
||||
+ RAVPower RP-WD009
|
||||
+
|
||||
config BOARD_VOCORE2
|
||||
bool "VoCore2"
|
||||
select SPL_SERIAL
|
||||
@@ -52,6 +60,7 @@ config SYS_CONFIG_NAME
|
||||
default "mt7628" if BOARD_MT7628_RFB
|
||||
|
||||
source "board/gardena/smart-gateway-mt7688/Kconfig"
|
||||
+source "board/ravpower/rp-wd009/Kconfig"
|
||||
source "board/seeed/linkit-smart-7688/Kconfig"
|
||||
source "board/vocore/vocore2/Kconfig"
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7621_zbtlink_zbt-wg3526-16m_defconfig
|
||||
@@ -0,0 +1,97 @@
|
||||
+CONFIG_MIPS=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_SYS_MALLOC_LEN=0x100000
|
||||
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
|
||||
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_SF_DEFAULT_SPEED=20000000
|
||||
+CONFIG_ENV_SIZE=0x10000
|
||||
+CONFIG_ENV_OFFSET=0x30000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="zbtlink,zbt-wg3526"
|
||||
+CONFIG_SPL_SERIAL=y
|
||||
+CONFIG_TPL_SYS_MALLOC_F_LEN=0x1000
|
||||
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x40000
|
||||
+CONFIG_SPL_BSS_START_ADDR=0x80140000
|
||||
+CONFIG_SPL_BSS_MAX_SIZE=0x80000
|
||||
+CONFIG_SPL=y
|
||||
+CONFIG_DEBUG_UART_BASE=0xbe000c00
|
||||
+CONFIG_DEBUG_UART_CLOCK=50000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x83000000
|
||||
+CONFIG_ARCH_MTMIPS=y
|
||||
+CONFIG_SOC_MT7621=y
|
||||
+CONFIG_SYS_MIPS_TIMER_FREQ=440000000
|
||||
+# CONFIG_MIPS_CACHE_SETUP is not set
|
||||
+# CONFIG_MIPS_CACHE_DISABLE is not set
|
||||
+CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
|
||||
+CONFIG_MIPS_BOOT_FDT=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+# CONFIG_BOOTSTD is not set
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
|
||||
+CONFIG_LOGLEVEL=6
|
||||
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
|
||||
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
|
||||
+CONFIG_SPL_NOR_SUPPORT=y
|
||||
+CONFIG_TPL=y
|
||||
+# CONFIG_TPL_FRAMEWORK is not set
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+# CONFIG_SYS_LONGHELP is not set
|
||||
+# CONFIG_SYS_XTRACE is not set
|
||||
+# CONFIG_CMD_BOOTD is not set
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+# CONFIG_CMD_BOOTP is not set
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_DOS_PARTITION=y
|
||||
+# CONFIG_SPL_DOS_PARTITION is not set
|
||||
+# CONFIG_ISO_PARTITION is not set
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="nor0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x10000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="zbtlink_zbt-wg3526-16m_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+# CONFIG_I2C is not set
|
||||
+# CONFIG_INPUT is not set
|
||||
+CONFIG_MMC=y
|
||||
+# CONFIG_MMC_QUIRKS is not set
|
||||
+# CONFIG_MMC_HW_PARTITIONING is not set
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_DEBUG_UART_SHIFT=2
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_MT7621_SPI=y
|
||||
+CONFIG_SYSRESET=y
|
||||
+CONFIG_SYSRESET_RESETCTL=y
|
||||
+CONFIG_WDT=y
|
||||
+CONFIG_WDT_MT7621=y
|
||||
+# CONFIG_BINMAN_FDT is not set
|
||||
+CONFIG_LZMA=y
|
||||
+# CONFIG_GZIP is not set
|
||||
+CONFIG_SPL_LZMA=y
|
||||
--- /dev/null
|
||||
+++ b/zbtlink_zbt-wg3526-16m_env
|
||||
@@ -0,0 +1,36 @@
|
||||
+ethaddr_factory=mtd read factory $loadaddr 0x0 0x10000 ; setexpr macoffs $loadaddr + 0xe000 ; env readmem -b ethaddr $macoffs 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x83000000
|
||||
+bootcmd=run boot_nor
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-ramips-mt7621-zbtlink_zbt-wg3526-16m-initramfs-kernel.bin
|
||||
+bootfile_uboot=u-boot-mt7621.bin
|
||||
+bootfile_upg=openwrt-ramips-mt7621-zbtlink_zbt-wg3526-16m-squashfs-sysupgrade.bin
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )[0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot system from flash.=run boot_nor ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Load system via TFTP then write to flash.=run boot_tftp_sysupgrade ; run bootmenu_confirm_return
|
||||
+bootmenu_4=[31mLoad U-Boot via TFTP then write to flash.[0m=run boot_tftp_write_uboot ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+bootmenu_6=Reboot.=reset
|
||||
+boot_first=if button reset ; then run boot_tftp ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_tftp_forever
|
||||
+boot_nor=bootm 0x1fc50000
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
|
||||
+boot_tftp_forever=while true ; do run boot_tftp ; sleep 1 ; done
|
||||
+boot_tftp_sysupgrade=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && run nor_write_production
|
||||
+boot_tftp_write_uboot=tftpboot $loadaddr $bootfile_uboot && run nor_write_uboot
|
||||
+reset_factory=mtd erase u-boot-env 0x0 0x10000 && reset
|
||||
+nor_pad_size=setexpr image_eb $filesize / 0x1000 ; setexpr tmp1 image_size % 0x1000 ; test 0x$tmp1 -gt 0 && setexpr image_eb $image_eb + 1 ; setexpr image_eb $image_eb * 0x1000
|
||||
+nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0xfb0000 && mtd erase firmware 0x0 0x$image_eb && mtd write firmware $loadaddr 0x0 $filesize
|
||||
+nor_write_uboot=mtd erase u-boot 0x0 0x30000 && mtd write u-boot $loadaddr 0x0 0x30000
|
||||
+_init_env=setenv _init_env ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run ethaddr_factory ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/dts/zbtlink,zbt-wg3526.dts
|
||||
@@ -0,0 +1,131 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2022 MediaTek Inc. All rights reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "mt7621.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "zbtlink,zbt-wg3526", "mediatek,mt7621-rfb", "mediatek,mt7621-soc";
|
||||
+ model = "Zbtlink WG3526";
|
||||
+
|
||||
+ aliases {
|
||||
+ ethernet0 = ð
|
||||
+ serial0 = &uart0;
|
||||
+ spi0 = &spi;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led_status: status {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ state_default: pin_state {
|
||||
+ gpios {
|
||||
+ groups = "i2c", "uart3", "pcie reset";
|
||||
+ function = "gpio";
|
||||
+ };
|
||||
+
|
||||
+ wdt {
|
||||
+ groups = "wdt";
|
||||
+ function = "wdt rst";
|
||||
+ };
|
||||
+
|
||||
+ jtag {
|
||||
+ groups = "jtag";
|
||||
+ function = "jtag";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&gpio {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi {
|
||||
+ status = "okay";
|
||||
+ num-cs = <2>;
|
||||
+
|
||||
+ spi-flash@0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ spi-max-frequency = <25000000>;
|
||||
+ reg = <0>;
|
||||
+
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "u-boot";
|
||||
+ reg = <0x0 0x30000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@30000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x30000 0x10000>;
|
||||
+ };
|
||||
+
|
||||
+ factory: partition@40000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x40000 0x10000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ firmware: partition@50000 {
|
||||
+ compatible = "denx,uimage";
|
||||
+ label = "firmware";
|
||||
+ reg = <0x50000 0xfb0000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&mmc {
|
||||
+ cap-sd-highspeed;
|
||||
+
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ssusb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&u3phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
381
package/boot/uboot-mediatek/patches/429-add-netcore-n60.patch
Normal file
381
package/boot/uboot-mediatek/patches/429-add-netcore-n60.patch
Normal file
@@ -0,0 +1,381 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986_netcore_n60_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-netcore-n60"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-netcore-n60.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="netcore_n60_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-netcore-n60.dts
|
||||
@@ -0,0 +1,185 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2021 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Netcore N60";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_red {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ status_green {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 32 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <1>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@1 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <1>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "orig-env";
|
||||
+ reg = <0x100000 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@160000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7280000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/netcore_n60_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-netcore_n60-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-netcore_n60-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-netcore_n60-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-netcore_n60-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+ethaddr_factory=mtd read factory 0x40080000 0x1fe000 0x1000 && env readmem -b ethaddr 0x40080f20 0x6 ; setenv ethaddr_factory
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
879
package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch
Normal file
879
package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch
Normal file
@@ -0,0 +1,879 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-emmc_defconfig
|
||||
@@ -0,0 +1,139 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x40000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-emmc"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x440000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-emmc.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r3_emmc_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-nor_defconfig
|
||||
@@ -0,0 +1,139 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x0
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-emmc"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-emmc.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_MTD_NAME="u-boot-env"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x20000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r3_nor_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_LZO=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-sd_defconfig
|
||||
@@ -0,0 +1,139 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x40000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-sd"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x440000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-sd.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r3_sdmmc_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-snand_defconfig
|
||||
@@ -0,0 +1,134 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-emmc"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-emmc.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r3_snand_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r3_sdmmc_env
|
||||
@@ -0,0 +1,81 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi
|
||||
+bootconf=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_base=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_nor=mt7986a-bananapi-bpi-r3-nor
|
||||
+bootconf_nand=mt7986a-bananapi-bpi-r3-nand
|
||||
+bootconf_sd=mt7986a-bananapi-bpi-r3-sd
|
||||
+bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SD card][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from SD card.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mInstall bootloader, recovery and production to NOR.[0m=if sf probe ; then run nor_init ; else echo "NOR not detected" ; fi ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mInstall bootloader, recovery and production to NAND.[0m=if nand info ; then run ubi_init ; else echo "NAND not detected" ; fi ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_update_conf=if nand info ; then setenv bootconf $bootconf_base#$bootconf_sd#$bootconf_nand ; else if sf probe ; then setenv bootconf $bootconf_base#$bootconf_sd#$bootconf_nor ; else setenv bootconf $bootconf_base#$bootconf_sd ; fi ; fi
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run boot_update_conf ; run sdmmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run boot_update_conf ; run sdmmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_sdmmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=run boot_update_conf ; tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run sdmmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=run boot_update_conf ; tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run sdmmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+sdmmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+sdmmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+sdmmc_read_snand_bl2=part start mmc 0 install part_addr && mmc read $loadaddr $part_addr 0x400
|
||||
+sdmmc_read_snand_fip=part start mmc 0 install part_addr && setexpr offset $part_addr + 0x800 && mmc read $loadaddr $offset 0x1000
|
||||
+sdmmc_read_nor_bl2=part start mmc 0 install part_addr && setexpr offset $part_addr + 0x2800 && mmc read $loadaddr $offset 0x400
|
||||
+sdmmc_read_nor_fip=part start mmc 0 install part_addr && setexpr offset $part_addr + 0x3000 && mmc read $loadaddr $offset 0x1000
|
||||
+sdmmc_read_emmc_install=part start mmc 0 install part_addr && setexpr offset $part_addr + 0x3800 && mmc read $loadaddr $offset 0x4000
|
||||
+sdmmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+sdmmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+snand_write_bl2=mtd erase bl2 0x0 0x100000 && mtd write bl2 $loadaddr 0x0 0x40000 && mtd write bl2 $loadaddr 0x40000 0x40000 && mtd write bl2 $loadaddr 0x80000 0x40000 && mtd write bl2 $loadaddr 0xc0000 0x40000
|
||||
+nor_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+nor_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x10000 ; setexpr tmp1 0x$image_size % 0x10000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb $image_eb * 0x10000
|
||||
+nor_erase_env=mtd erase u-boot-env
|
||||
+nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase fit && mtd write fit $loadaddr 0x0 $image_eb
|
||||
+nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0x900000 && mtd erase recovery 0x0 0x$image_eb && mtd write recovery $loadaddr 0x0 $image_eb
|
||||
+nor_init=run nor_init_bl && run nor_init_openwrt
|
||||
+nor_init_bl=run sdmmc_read_nor_bl2 && run nor_write_bl2 && run sdmmc_read_nor_fip && run nor_write_fip && run nor_erase_env
|
||||
+nor_init_openwrt=run sdmmc_read_recovery && iminfo $loadaddr && run nor_write_recovery ; run sdmmc_read_production && iminfo $loadaddr && run nor_write_production
|
||||
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi
|
||||
+ubi_init=run ubi_format && run ubi_init_bl && run ubi_init_openwrt && run ubi_init_emmc_install
|
||||
+ubi_init_openwrt=run sdmmc_read_recovery && iminfo $loadaddr && run ubi_write_recovery ; run sdmmc_read_production && iminfo $loadaddr && run ubi_write_production
|
||||
+ubi_init_bl=run sdmmc_read_snand_bl2 && run snand_write_bl2 && run sdmmc_read_snand_fip && run ubi_write_fip
|
||||
+ubi_init_emmc_install=run sdmmc_read_emmc_install && run ubi_write_emmc_install
|
||||
+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_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
|
||||
+ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
|
||||
+ubi_write_emmc_install=ubi check emmc_install && ubi remove emmc_install ; ubi create emmc_install 0x800000 dynamic ; ubi write $loadaddr emmc_install 0x800000
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r3_nor_env
|
||||
@@ -0,0 +1,60 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi
|
||||
+bootconf=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_base=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_nor=mt7986a-bananapi-bpi-r3-nor
|
||||
+bootconf_nand=mt7986a-bananapi-bpi-r3-nand
|
||||
+bootconf_sd=mt7986a-bananapi-bpi-r3-sd
|
||||
+bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-nor-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-nor-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NOR][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run boot_update_conf ; led $bootled_pwr on ; run nor_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=run boot_update_conf ; led $bootled_rec on ; run nor_read_recovery ; bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+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 $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=run boot_update_conf ; tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run nor_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=run boot_update_conf ; tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run nor_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run nor_write_fip
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run nor_write_bl2
|
||||
+boot_update_conf=if mmc partconf 0 ; then setenv bootconf $bootconf_base#$bootconf_nor#$bootconf_emmc ; else setenv bootconf $bootconf_base#$bootconf_nor#$bootconf_sd ; fi
|
||||
+boot_nor=run boot_production ; run boot_recovery
|
||||
+reset_factory=mtd erase u-boot-env
|
||||
+nor_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+nor_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+nor_read_production=mtd read fit $loadaddr 0x0 0x20000 && imsz $loadaddr image_size && mtd read fit $loadaddr 0x0 $image_size
|
||||
+nor_read_recovery=mtd read recovery $loadaddr 0x0 0x20000 && imsz $loadaddr image_size && mtd read recovery $loadaddr 0x0 $image_size
|
||||
+nor_pad_size=imsz $loadaddr image_size ; setexpr image_eb 0x$image_size / 0x10000 ; setexpr tmp1 0x$image_size % 0x10000 ; test 0x$tmp1 -gt 0 && setexpr image_eb 0x$image_eb + 1 ; setexpr image_eb $image_eb * 0x10000
|
||||
+nor_write_production=run nor_pad_size ; test 0x$image_eb -le 0x3000000 && mtd erase fit && mtd write fit $loadaddr 0x0 $image_eb
|
||||
+nor_write_recovery=run nor_pad_size ; test 0x$image_eb -le 0x900000 && mtd erase recovery 0x0 0x$image_eb && mtd write recovery $loadaddr 0x0 $image_eb
|
||||
+_init_env=setenv _init_env ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r3_snand_env
|
||||
@@ -0,0 +1,73 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootconf=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_base=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_nor=mt7986a-bananapi-bpi-r3-nor
|
||||
+bootconf_nand=mt7986a-bananapi-bpi-r3-nand
|
||||
+bootconf_sd=mt7986a-bananapi-bpi-r3-sd
|
||||
+bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-snand-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-snand-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NAND][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=[31mInstall bootloader, recovery and production to eMMC.[0m=if mmc partconf 0 ; then run emmc_init ; else echo "eMMC not detected" ; fi ; run bootmenu_confirm_return
|
||||
+bootmenu_9=Reboot.=reset
|
||||
+bootmenu_10=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run boot_update_conf ; led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=run boot_update_conf ; led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=run boot_update_conf ; tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=run boot_update_conf ; tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
|
||||
+boot_update_conf=if mmc partconf 0 ; then setenv bootconf $bootconf_base#$bootconf_nand#$bootconf_emmc ; else setenv bootconf $bootconf_base#$bootconf_nand#$bootconf_sd ; fi
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000
|
||||
+snand_write_bl2=mtd erase bl2 0x0 0x100000 && mtd write bl2 $loadaddr 0x0 0x40000 && mtd write bl2 $loadaddr 0x40000 0x40000 && mtd write bl2 $loadaddr 0x80000 0x40000 && mtd write bl2 $loadaddr 0xc0000 0x40000
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic
|
||||
+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_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install
|
||||
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
|
||||
+ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+emmc_init=mmc dev 0 && mmc bootbus 0 0 0 0 && run emmc_init_bl && run emmc_init_openwrt ; env default bootcmd ; saveenv ; saveenv
|
||||
+emmc_init_bl=run ubi_read_emmc_install && setenv fileaddr $loadaddr && run emmc_write_bl2 && setexpr fileaddr $loadaddr + 0x100000 && run emmc_write_fip && setexpr fileaddr $loadaddr + 0x500000 && run emmc_write_hdr
|
||||
+emmc_init_openwrt=run ubi_read_recovery && iminfo $loadaddr && run emmc_write_recovery ; run ubi_read_production && iminfo $loadaddr && run emmc_write_production
|
||||
+emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_hdr=mmc erase 0x0 0x40 && mmc write $fileaddr 0x0 0x40
|
||||
+emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r3_emmc_env
|
||||
@@ -0,0 +1,61 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
|
||||
+bootconf=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_base=config-mt7986a-bananapi-bpi-r3
|
||||
+bootconf_nor=mt7986a-bananapi-bpi-r3-nor
|
||||
+bootconf_nand=mt7986a-bananapi-bpi-r3-nand
|
||||
+bootconf_sd=mt7986a-bananapi-bpi-r3-sd
|
||||
+bootconf_emmc=mt7986a-bananapi-bpi-r3-emmc
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-emmc-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-emmc-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[eMMC][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to eMMC.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run boot_update_conf ; led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=run boot_update_conf ; led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_emmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=run boot_update_conf ; tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=run boot_update_conf ; tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
|
||||
+boot_tftp=run boot_update_conf ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_update_conf=if nand info ; then setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nand ; else setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nor ; fi
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- a/arch/arm/dts/mt7986a-bpi-r3-sd.dts
|
||||
+++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts
|
||||
@@ -235,22 +235,13 @@
|
||||
|
||||
partition@0 {
|
||||
label = "bl2";
|
||||
- reg = <0x0 0x80000>;
|
||||
+ reg = <0x0 0x200000>;
|
||||
};
|
||||
|
||||
- partition@80000 {
|
||||
- label = "factory";
|
||||
- reg = <0x80000 0x300000>;
|
||||
- };
|
||||
-
|
||||
- partition@380000 {
|
||||
- label = "fip";
|
||||
- reg = <0x380000 0x200000>;
|
||||
- };
|
||||
-
|
||||
- partition@580000 {
|
||||
+ partition@200000 {
|
||||
label = "ubi";
|
||||
- reg = <0x580000 0x7a80000>;
|
||||
+ reg = <0x200000 0x7e00000>;
|
||||
+ compatible = "linux,ubi";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,328 @@
|
||||
+++ b/configs/mt7986_xiaomi_redmi-ax6000_defconfig
|
||||
@@ -0,0 +1,104 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-xiaomi_redmi-ax6000"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-xiaomi_redmi-ax6000.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="xiaomi_redmi-ax6000_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+# CONFIG_I2C is not set
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_RANDOM_UUID=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-xiaomi_redmi-ax6000.dts
|
||||
@@ -0,0 +1,161 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2021 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Xiaomi Redmi AX6000";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-sd-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ mesh {
|
||||
+ label = "mesh";
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <1>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "nvram";
|
||||
+ reg = <0x100000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "bdata";
|
||||
+ reg = <0x140000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@600000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7a80000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/xiaomi_redmi-ax6000_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ethaddr_factory=mtd read factory 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x40080004 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=console=ttyS0,115200n8 console_msg_format=syslog
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run ubi_read_production && bootm $loadaddr#$bootconf
|
||||
+boot_recovery=run ubi_read_recovery && bootm $loadaddr#$bootconf
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_fit=fit
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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 $part_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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
778
package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch
Normal file
778
package/boot/uboot-mediatek/patches/432-add-tplink-xdr608x.patch
Normal file
@@ -0,0 +1,778 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986_tplink_tl-xdr4288_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-tplink-tl-xdr608x"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-tplink-tl-xdr608x.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="tplink_tl-xdr4288_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986_tplink_tl-xdr6086_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-tplink-tl-xdr608x"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-tplink-tl-xdr608x.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="tplink_tl-xdr6086_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986_tplink_tl-xdr6088_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-tplink-tl-xdr608x"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-tplink-tl-xdr608x.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="tplink_tl-xdr6088_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-tplink-tl-xdr608x.dts
|
||||
@@ -0,0 +1,196 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2021 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "TP-Link TL-XDR608x";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ turbo {
|
||||
+ label = "turbo";
|
||||
+ linux,code = <BTN_1>;
|
||||
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_red {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ status_green {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ turbo {
|
||||
+ label = "green:turbo";
|
||||
+ gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <1>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@1 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <1>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "config";
|
||||
+ reg = <0x100000 0x60000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@160000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x160000 0x60000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7800000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/tplink_tl-xdr4288_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+ethaddr_factory=mtd read config 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x4008001c 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-tplink_tl-xdr4288-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-tplink_tl-xdr4288-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-tplink_tl-xdr4288-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-tplink_tl-xdr4288-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/tplink_tl-xdr6086_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+ethaddr_factory=mtd read config 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x4008001c 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-tplink_tl-xdr6086-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-tplink_tl-xdr6086-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-tplink_tl-xdr6086-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-tplink_tl-xdr6086-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/tplink_tl-xdr6088_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+ethaddr_factory=mtd read config 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x4008001c 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-tplink_tl-xdr6088-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-tplink_tl-xdr6088-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-tplink_tl-xdr6088-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-tplink_tl-xdr6088-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
375
package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch
Normal file
375
package/boot/uboot-mediatek/patches/433-add-qihoo_360t7.patch
Normal file
@@ -0,0 +1,375 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_qihoo-360t7_defconfig
|
||||
@@ -0,0 +1,125 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981_qihoo-360t7"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_qihoo-360t7.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="qihoo-360t7_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981_qihoo-360t7.dts
|
||||
@@ -0,0 +1,185 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2022 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Qihoo 360T7";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_red {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ status_green {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1", "pwm1_0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "orig-env";
|
||||
+ reg = <0x100000 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@160000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x6c00000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/qihoo-360t7_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-qihoo_360t7-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-qihoo_360t7-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-qihoo_360t7-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-qihoo_360t7-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,411 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_xiaomi_mi-router-wr30u_defconfig
|
||||
@@ -0,0 +1,125 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981_xiaomi_mi-router-wr30u"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_xiaomi_mi-router-wr30u.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="xiaomi_mi-router-wr30u_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981_xiaomi_mi-router-wr30u.dts
|
||||
@@ -0,0 +1,221 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2022 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Xiaomi Router WR30U";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ config {
|
||||
+ blink_led = "yellow:network";
|
||||
+ system_led = "yellow:system";
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+
|
||||
+ mesh {
|
||||
+ label = "mesh";
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <BTN_9>;
|
||||
+ linux,input-type = <EV_SW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led_system_blue {
|
||||
+ label = "blue:system";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_system_yellow {
|
||||
+ label = "yellow:system";
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_network_blue {
|
||||
+ label = "blue:network";
|
||||
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_network_yellow {
|
||||
+ label = "yellow:network";
|
||||
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "sgmii";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1", "pwm1_0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x00 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "Nvram";
|
||||
+ reg = <0x100000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "Bdata";
|
||||
+ reg = <0x140000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "crash";
|
||||
+ reg = <0x580000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@5c0000 {
|
||||
+ label = "crash_log";
|
||||
+ reg = <0x5c0000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@600000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x600000 0x7000000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@7600000 {
|
||||
+ label = "KF";
|
||||
+ reg = <0x7600000 0x40000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/xiaomi_mi-router-wr30u_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-xiaomi_mi-router-wr30u-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=yellow:system
|
||||
+bootled_rec=yellow:network
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,395 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_h3c_magic-nx30-pro_defconfig
|
||||
@@ -0,0 +1,125 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981_h3c_magic-nx30-pro"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_h3c_magic-nx30-pro.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="h3c_magic-nx30-pro_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981_h3c_magic-nx30-pro.dts
|
||||
@@ -0,0 +1,205 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2022 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "H3C Magic NX30 Pro";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_red {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ status_green {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1", "pwm1_0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0000000 0x0100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "orig-env";
|
||||
+ reg = <0x0100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x0180000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x0380000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x0580000 0x4000000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@4580000 {
|
||||
+ label = "pdt_data";
|
||||
+ reg = <0x4580000 0x0600000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@4b80000 {
|
||||
+ label = "pdt_data_1";
|
||||
+ reg = <0x4b80000 0x0600000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@5180000 {
|
||||
+ label = "exp";
|
||||
+ reg = <0x5180000 0x0100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@5280000 {
|
||||
+ label = "plugin";
|
||||
+ reg = <0x5280000 0x2580000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/h3c_magic-nx30-pro_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-h3c_magic-nx30-pro-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-h3c_magic-nx30-pro-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-h3c_magic-nx30-pro-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-h3c_magic-nx30-pro-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
275
package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch
Normal file
275
package/boot/uboot-mediatek/patches/436-add-glinet-mt6000.patch
Normal file
@@ -0,0 +1,275 @@
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-glinet-gl-mt6000.dts
|
||||
@@ -0,0 +1,135 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+#include "mt7986.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "GL.iNet GL-MT6000";
|
||||
+ compatible = "glinet,gl-mt6000", "mediatek,mt7986-emmc-rfb", "mediatek,mt7986";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x40000000>;
|
||||
+ };
|
||||
+
|
||||
+ 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;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ wps {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led_status_blue: green {
|
||||
+ label = "blue:status";
|
||||
+ gpios = <&gpio 28 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_status_white: blue {
|
||||
+ label = "white:status";
|
||||
+ gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ mmc0_pins_default: mmc0default {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "emmc_51";
|
||||
+ };
|
||||
+
|
||||
+ conf-cmd-dat {
|
||||
+ pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
|
||||
+ "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
|
||||
+ "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
|
||||
+ input-enable;
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+
|
||||
+ conf-clk {
|
||||
+ pins = "EMMC_CK";
|
||||
+ drive-strength = <MTK_DRIVE_6mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+
|
||||
+ conf-dsl {
|
||||
+ pins = "EMMC_DSL";
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+
|
||||
+ conf-rst {
|
||||
+ pins = "EMMC_RSTB";
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mmc0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc0_pins_default>;
|
||||
+ bus-width = <8>;
|
||||
+ max-frequency = <200000000>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ cap-mmc-hw-reset;
|
||||
+ vmmc-supply = <®_3p3v>;
|
||||
+ vqmmc-supply = <®_1p8v>;
|
||||
+ non-removable;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&wmcpu_emi {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_glinet_gl-mt6000_defconfig
|
||||
@@ -0,0 +1,106 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x80000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-glinet-gl-mt6000"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-glinet-gl-mt6000.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="glinet_gl-mt6000_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/glinet_gl-mt6000_env
|
||||
@@ -0,0 +1,25 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+bootdelay=3
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-glinet_gl-mt6000-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-glinet_gl-mt6000-bl31-uboot.fip
|
||||
+bootfile_firmware=openwrt-mediatek-filogic-glinet_gl-mt6000-squashfs-factory.bin
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_title= *** U-Boot Boot Menu for GL-iNet GL-MT6000 ***
|
||||
+bootmenu_0=Startup system (Default).=run boot_system
|
||||
+bootmenu_1=Load Firmware via TFTP then write to eMMC.=run boot_tftp_firmware ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Load BL2 preloader via TFTP then write to eMMC.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Reboot.=reset
|
||||
+bootmenu_5=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+filesize_to_blk=setexpr cnt $filesize + 0x1ff && setexpr cnt $cnt / 0x200
|
||||
+mmc_read_kernel=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr $part_addr $image_size
|
||||
+boot_system=part start mmc 0 kernel part_addr && part size mmc 0 kernel part_size && run mmc_read_kernel && bootm
|
||||
+boot_tftp_firmware=tftpboot $loadaddr $bootfile_firmware && run emmc_write_firmware
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
|
||||
+emmc_write_firmware=part start mmc 0 kernel part_addr && run filesize_to_blk && mmc write $loadaddr $part_addr $cnt
|
||||
+emmc_write_bl2=run filesize_to_blk && test 0x$cnt -le 0x800 && mmc partconf 0 1 1 1 && && mmc write $loadaddr 0x0 0x800 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=part start mmc 0 fip part_addr && part size mmc 0 fip part_size && run filesize_to_blk && test 0x$cnt -le 0x$part_size && mmc write $loadaddr $part_addr $cnt
|
||||
+reset_factory=eraseenv && reset
|
||||
597
package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch
Normal file
597
package/boot/uboot-mediatek/patches/437-add-cmcc_rax3000m.patch
Normal file
@@ -0,0 +1,597 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_cmcc_rax3000m-emmc_defconfig
|
||||
@@ -0,0 +1,125 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x40000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-rax3000m-emmc"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x440000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-rax3000m-emmc.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="cmcc_rax3000m-emmc_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_LZO=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_cmcc_rax3000m-nand_defconfig
|
||||
@@ -0,0 +1,125 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-cmcc-rax3000m-nand"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-cmcc-rax3000m-nand.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="cmcc_rax3000m-nand_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-cmcc-rax3000m.dtsi
|
||||
@@ -0,0 +1,85 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (c) 2022 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "CMCC RAX3000M";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ button-reset {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ button-mesh {
|
||||
+ label = "mesh";
|
||||
+ linux,code = <BTN_9>;
|
||||
+ linux,input-type = <EV_SW>;
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led-0 {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ label = "blue:status";
|
||||
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led-2 {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-cmcc-rax3000m-emmc.dts
|
||||
@@ -0,0 +1,53 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981-cmcc-rax3000m.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ 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;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mmc0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc0_pins_default>;
|
||||
+ max-frequency = <26000000>;
|
||||
+ bus-width = <8>;
|
||||
+ cap-mmc-hw-reset;
|
||||
+ vmmc-supply = <®_3p3v>;
|
||||
+ non-removable;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ mmc0_pins_default: mmc0default {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "emmc_45";
|
||||
+ };
|
||||
+ conf-cmd-dat {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO",
|
||||
+ "SPI0_CS", "SPI0_HOLD", "SPI0_WP",
|
||||
+ "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO";
|
||||
+ input-enable;
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+ conf-clk {
|
||||
+ pins = "SPI1_CS";
|
||||
+ drive-strength = <MTK_DRIVE_6mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+ conf-rst {
|
||||
+ pins = "PWM0";
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-cmcc-rax3000m-nand.dts
|
||||
@@ -0,0 +1,77 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981-cmcc-rax3000m.dtsi"
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "orig-env";
|
||||
+ reg = <0x100000 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@160000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7200000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/cmcc_rax3000m-emmc_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
|
||||
+bootconf=config-1#mt7981b-cmcc-rax3000m-emmc
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=red:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[eMMC][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to eMMC.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_emmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/cmcc_rax3000m-nand_env
|
||||
@@ -0,0 +1,56 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootconf=config-1#mt7981b-cmcc-rax3000m-nand
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-cmcc_rax3000m-nand-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-cmcc_rax3000m-nand-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-cmcc_rax3000m-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=red:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NAND][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
370
package/boot/uboot-mediatek/patches/438-add-jcg_q30-pro.patch
Normal file
370
package/boot/uboot-mediatek/patches/438-add-jcg_q30-pro.patch
Normal file
@@ -0,0 +1,370 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_jcg_q30-pro_defconfig
|
||||
@@ -0,0 +1,125 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981_jcg_q30-pro"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_jcg_q30-pro.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="jcg_q30-pro_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981_jcg_q30-pro.dts
|
||||
@@ -0,0 +1,179 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2022 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "JCG Q30 PRO";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_red {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ status_blue {
|
||||
+ label = "blue:status";
|
||||
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0_1", "pwm1_0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "orig-env";
|
||||
+ reg = <0x100000 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@160000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/jcg_q30-pro_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-jcg_q30-pro-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-jcg_q30-pro-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-jcg_q30-pro-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-jcg_q30-pro-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=blue:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+ethaddr_factory=mtd read factory 0x40080000 0xa0000 0x800 && env readmem -b ethaddr 0x4008002a 0x6 ; setenv ethaddr_factory
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,375 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986_zyxel_ex5601-t0_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-zyxel_ex5601-t0"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-zyxel_ex5601-t0.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="EX5601> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="zyxel_ex5601-t0_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+# CONFIG_I2C is not set
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-zyxel_ex5601-t0.dts
|
||||
@@ -0,0 +1,181 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Author: Valerio 'ftp21' Mancini <ftp21@ftp21.eu>
|
||||
+ * Author: Nicolò Veronese <nicveronese@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Zyxel EX5601-T0 ubootmod";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-sd-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x20000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+ factory {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ gpios = <&gpio 56 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led_status_green: pwr {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led_sfp_green: sfp {
|
||||
+ label = "green:sfp";
|
||||
+ gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <1>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <20000000>;
|
||||
+ spi-tx-buswidth = <4>;
|
||||
+ spi-rx-buswidth = <4>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x0100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "Factory";
|
||||
+ reg = <0x180000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@540000 {
|
||||
+ label = "zloader";
|
||||
+ reg = <0x540000 0x0040000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x1da80000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
--- /dev/null
|
||||
+++ b/zyxel_ex5601-t0_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ethaddr_factory=mtd read Factory 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x4008002A 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=console=ttyS0,115200n8 console_msg_format=syslog
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=run ubi_read_production && bootm $loadaddr#$bootconf
|
||||
+boot_recovery=run ubi_read_recovery && bootm $loadaddr#$bootconf
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_fit=fit
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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 $part_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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,358 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_xiaomi_mi-router-ax3000t_defconfig
|
||||
@@ -0,0 +1,107 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981_xiaomi_mi-router-ax3000t"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_xiaomi_mi-router-ax3000t.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="xiaomi_mi-router-ax3000t_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981_xiaomi_mi-router-ax3000t.dts
|
||||
@@ -0,0 +1,187 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2022 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Xiaomi Router AX3000T";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+
|
||||
+ mesh {
|
||||
+ label = "mesh";
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <BTN_9>;
|
||||
+ linux,input-type = <EV_SW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led_status_blue {
|
||||
+ label = "blue:status";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_status_yellow {
|
||||
+ label = "yellow:status";
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_1";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x00 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "Nvram";
|
||||
+ reg = <0x100000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "Bdata";
|
||||
+ reg = <0x140000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "crash";
|
||||
+ reg = <0x580000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@5c0000 {
|
||||
+ label = "crash_log";
|
||||
+ reg = <0x5c0000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@600000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x600000 0x7000000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@7600000 {
|
||||
+ label = "KF";
|
||||
+ reg = <0x7600000 0x40000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/xiaomi_mi-router-ax3000t_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=console=ttyS0,115200n8 console_msg_format=syslog
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=yellow:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,324 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_jdcloud_re-cp-03_defconfig
|
||||
@@ -0,0 +1,112 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x40000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-jdcloud_re-cp-03"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x440000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-jdcloud_re-cp-03.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="jdcloud_re-cp-03_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-jdcloud_re-cp-03.dts
|
||||
@@ -0,0 +1,148 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "JDCloud RE-CP-03";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x40000000>;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ button-joylink {
|
||||
+ label = "joylink";
|
||||
+ linux,code = <BTN_0>;
|
||||
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ button-reset {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gpio-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led-0 {
|
||||
+ label = "blue:status";
|
||||
+ gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "on";
|
||||
+ };
|
||||
+
|
||||
+ led-2 {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mmc0 {
|
||||
+ bus-width = <8>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ cap-mmc-hw-reset;
|
||||
+ max-frequency = <200000000>;
|
||||
+ non-removable;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc0_pins_default>;
|
||||
+ vmmc-supply = <®_3p3v>;
|
||||
+ vqmmc-supply = <®_1p8v>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ mmc0_pins_default: mmc0default {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "emmc_51";
|
||||
+ };
|
||||
+
|
||||
+ conf-cmd-dat {
|
||||
+ pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
|
||||
+ "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
|
||||
+ "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
|
||||
+ input-enable;
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+
|
||||
+ conf-clk {
|
||||
+ pins = "EMMC_CK";
|
||||
+ drive-strength = <MTK_DRIVE_6mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+
|
||||
+ conf-dsl {
|
||||
+ pins = "EMMC_DSL";
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+
|
||||
+ conf-rst {
|
||||
+ pins = "EMMC_RSTB";
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/jdcloud_re-cp-03_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-jdcloud_re-cp-03-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-jdcloud_re-cp-03-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-jdcloud_re-cp-03-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-jdcloud_re-cp-03-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=red:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to eMMC.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_emmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
658
package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch
Normal file
658
package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch
Normal file
@@ -0,0 +1,658 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-mini-emmc_defconfig
|
||||
@@ -0,0 +1,146 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x40000
|
||||
+CONFIG_ENV_OFFSET=0x400000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-mini"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_ENV_OFFSET_REDUND=0x440000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-mini.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_MII=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r3-mini_emmc_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_AIROHA=y
|
||||
+CONFIG_PHY_AIROHA_EN8811H=y
|
||||
+CONFIG_PHY_AIROHA_FW_IN_MMC=y
|
||||
+CONFIG_PHY_ETHERNET_ID=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
+CONFIG_DM_ETH_PHY=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986a_bpi-r3-mini-snand_defconfig
|
||||
@@ -0,0 +1,139 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-mini"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_OF_SYSTEM_SETUP=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-mini.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_MII=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r3-mini_snand_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_AIROHA=y
|
||||
+CONFIG_PHY_AIROHA_EN8811H=y
|
||||
+CONFIG_PHY_ETHERNET_ID=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_MDIO=y
|
||||
+CONFIG_DM_ETH_PHY=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r3-mini_snand_env
|
||||
@@ -0,0 +1,61 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=ubi.block=0,fit root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-mt7986a-bananapi-bpi-r3-mini
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb
|
||||
+bootfile_en8811h_fw=EthMD32.bin
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NAND][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad Airoha EN8811H firmware via TFTP then write to NAND.[0m=run boot_tftp_write_en8811h_fw ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_8=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_9=Reboot.=reset
|
||||
+bootmenu_10=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
|
||||
+boot_tftp_write_en8811h_fw=tftpboot $loadaddr $bootfile_en8811h_fw && run ubi_write_en8811h_fw
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
|
||||
+snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x40000 && mtd write bl2 $loadaddr 0x40000 0x40000 && mtd write bl2 $loadaddr 0x80000 0x40000 && mtd write bl2 $loadaddr 0xc0000 0x40000
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic
|
||||
+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_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install
|
||||
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
|
||||
+ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
|
||||
+ubi_write_en8811h_fw=ubi check en8811h-fw && ubi remove en8811h-fw ; ubi create en8811h-fw 0x24000 static ; ubi write $loadaddr en8811h-fw 0x24000
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/bananapi_bpi-r3-mini_emmc_env
|
||||
@@ -0,0 +1,59 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
|
||||
+bootconf=config-mt7986a-bananapi-bpi-r3-mini
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb
|
||||
+bootfile_en8811h_fw=EthMD32.bin
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=blue:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[eMMC][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad Airoha EN8811H firmware via TFTP then write to eMMC.[0m=run boot_tftp_write_en8811h_fw ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_8=[31mLoad BL2 preloader via TFTP then write to eMMC.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_9=Reboot.=reset
|
||||
+bootmenu_10=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_emmc=run boot_production ; run boot_recovery
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
|
||||
+boot_tftp_write_en8811h_fw=tftpboot $loadaddr $bootfile_en8811h_fw && run emmc_write_en8811h_fw
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
|
||||
+mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=eraseenv && reset
|
||||
+emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
|
||||
+emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
|
||||
+emmc_write_en8811h_fw=mmc partconf 0 1 2 2 && mmc erase 0x0 0x120 && mmc write $fileaddr 0x0 0x120 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
|
||||
+emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
|
||||
+emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
|
||||
+emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
|
||||
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-bpi-r3-mini.dts
|
||||
@@ -0,0 +1,238 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Bananapi BPi-R3 Mini";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x80000000>;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ button-reset {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_led: led-0 {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ label = "blue:wlan2g";
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ led-2 {
|
||||
+ label = "blue:wlan5g";
|
||||
+ gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mdio_pins>;
|
||||
+
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ phy-handle = <&phy14>;
|
||||
+
|
||||
+ phy14: eth-phy@e {
|
||||
+ compatible = "ethernet-phy-id03a2.a411";
|
||||
+ reg = <14>;
|
||||
+
|
||||
+ airoha,rx-pol-reverse;
|
||||
+
|
||||
+ reset-gpios = <&gpio 49 GPIO_ACTIVE_LOW>;
|
||||
+ reset-assert-us = <10000>;
|
||||
+ reset-deassert-us = <20000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mmc0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc0_pins_default>;
|
||||
+ bus-width = <8>;
|
||||
+ max-frequency = <200000000>;
|
||||
+ cap-mmc-highspeed;
|
||||
+ cap-mmc-hw-reset;
|
||||
+ vmmc-supply = <®_3p3v>;
|
||||
+ vqmmc-supply = <®_1p8v>;
|
||||
+ non-removable;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ mdio_pins: mdio-pins {
|
||||
+ mux {
|
||||
+ function = "eth";
|
||||
+ groups = "mdc_mdio";
|
||||
+ };
|
||||
+
|
||||
+ conf-en8811-pwr-a {
|
||||
+ pins = "GPIO_11";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ output-low;
|
||||
+ };
|
||||
+
|
||||
+ conf-en8811-pwr-b {
|
||||
+ pins = "GPIO_12";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ output-low;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ mmc0_pins_default: mmc0default {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "emmc_51";
|
||||
+ };
|
||||
+
|
||||
+ conf-cmd-dat {
|
||||
+ pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
|
||||
+ "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
|
||||
+ "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
|
||||
+ input-enable;
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+
|
||||
+ conf-clk {
|
||||
+ pins = "EMMC_CK";
|
||||
+ drive-strength = <MTK_DRIVE_6mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+
|
||||
+ conf-dsl {
|
||||
+ pins = "EMMC_DSL";
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
|
||||
+ };
|
||||
+
|
||||
+ conf-rst {
|
||||
+ pins = "EMMC_RSTB";
|
||||
+ drive-strength = <MTK_DRIVE_4mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <1>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <20000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@200000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x200000 0x7e00000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
@@ -0,0 +1,357 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_nokia_ea0326gmp_defconfig
|
||||
@@ -0,0 +1,107 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-nokia-ea0326gmp"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-nokia-ea0326gmp.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="nokia_ea0326gmp_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-nokia-ea0326gmp.dts
|
||||
@@ -0,0 +1,186 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Nokia EA0326GMP";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+
|
||||
+ button-reset {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ button-wps {
|
||||
+ label = "wps";
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gpio-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ power_led: led-0 {
|
||||
+ label = "green:power";
|
||||
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "on";
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ label = "green:wan";
|
||||
+ gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-2 {
|
||||
+ label = "red:wan";
|
||||
+ gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-3 {
|
||||
+ label = "green:lan";
|
||||
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-4 {
|
||||
+ label = "green:wlan";
|
||||
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-5 {
|
||||
+ label = "green:wps";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x00000 0x0100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x0100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x180000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x0200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "config";
|
||||
+ reg = <0x580000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@780000 {
|
||||
+ label = "config2";
|
||||
+ reg = <0x780000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@980000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x980000 0x7680000>;
|
||||
+ compatible = "linux,ubi";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/nokia_ea0326gmp_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-nokia_ea0326gmp-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-nokia_ea0326gmp-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-nokia_ea0326gmp-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-nokia_ea0326gmp-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:power
|
||||
+bootled_rec=green:power
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
347
package/boot/uboot-mediatek/patches/444-add-abt_asr3000.patch
Normal file
347
package/boot/uboot-mediatek/patches/444-add-abt_asr3000.patch
Normal file
@@ -0,0 +1,347 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_abt_asr3000_defconfig
|
||||
@@ -0,0 +1,107 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-abt-asr3000"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-abt-asr3000.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7981> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="abt_asr3000_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7981-abt-asr3000.dts
|
||||
@@ -0,0 +1,176 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "ABT ASR3000";
|
||||
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+
|
||||
+ button-reset {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ button-wps {
|
||||
+ label = "mesh";
|
||||
+ linux,code = <BTN_9>;
|
||||
+ linux,input-type = <EV_SW>;
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ gpio-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led-0 {
|
||||
+ label = "red:wan";
|
||||
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-1 {
|
||||
+ label = "green:wan";
|
||||
+ gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ mesh_led: led-2 {
|
||||
+ label = "green:mesh";
|
||||
+ gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "on";
|
||||
+ };
|
||||
+
|
||||
+ led-3 {
|
||||
+ label = "green:wlan2g";
|
||||
+ gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ led-4 {
|
||||
+ label = "green:wlan5g";
|
||||
+ gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "u-boot-env";
|
||||
+ reg = <0x100000 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "art";
|
||||
+ reg = <0x180000 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@280000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x280000 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7a80000>;
|
||||
+ compatible = "linux,ubi";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/abt_asr3000_env
|
||||
@@ -0,0 +1,55 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootargs=root=/dev/fit0 rootwait
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-abt_asr3000-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-abt_asr3000-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-abt_asr3000-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-abt_asr3000-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:mesh
|
||||
+bootled_rec=green:mesh
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
1504
package/boot/uboot-mediatek/patches/450-add-bpi-r4.patch
Normal file
1504
package/boot/uboot-mediatek/patches/450-add-bpi-r4.patch
Normal file
File diff suppressed because it is too large
Load Diff
392
package/boot/uboot-mediatek/patches/451-add-tplink-xtr8488.patch
Normal file
392
package/boot/uboot-mediatek/patches/451-add-tplink-xtr8488.patch
Normal file
@@ -0,0 +1,392 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7986_tplink_tl-xtr8488_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7986a-tplink-tl-xtr8488"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7986=y
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-tplink-tl-xtr8488.dtb"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="MT7986> "
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_GPT=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_EXT4=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_OF_EMBED=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="tplink_tl-xtr8488_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_PINCTRL_MT7986=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7986a-tplink-tl-xtr8488.dts
|
||||
@@ -0,0 +1,196 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2021 MediaTek Inc.
|
||||
+ * Author: Sam Shih <sam.shih@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7986.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "TP-Link TL-XTR8488";
|
||||
+ compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x40000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ wps {
|
||||
+ label = "wps";
|
||||
+ linux,code = <KEY_WPS_BUTTON>;
|
||||
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ turbo {
|
||||
+ label = "turbo";
|
||||
+ linux,code = <BTN_1>;
|
||||
+ gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ status_red {
|
||||
+ label = "red:status";
|
||||
+ gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ status_green {
|
||||
+ label = "green:status";
|
||||
+ gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ turbo {
|
||||
+ label = "green:turbo";
|
||||
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spic_pins: spi1-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ uart1_pins: spi1-pins-func-3 {
|
||||
+ mux {
|
||||
+ function = "uart";
|
||||
+ groups = "uart1_2";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ pwm_pins: pwm0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "pwm";
|
||||
+ groups = "pwm0";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <1>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@1 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <1>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x80000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "config";
|
||||
+ reg = <0x100000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x140000 0x40000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@380000 {
|
||||
+ label = "fip";
|
||||
+ reg = <0x380000 0x200000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@580000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x580000 0x7800000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/tplink_tl-xtr8488_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-tplink_tl-xtr8488-initramfs-recovery.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-tplink_tl-xtr8488-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-tplink_tl-xtr8488-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-tplink_tl-xtr8488-squashfs-sysupgrade.itb
|
||||
+bootled_pwr=green:status
|
||||
+bootled_rec=red:status
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
|
||||
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
|
||||
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
|
||||
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
|
||||
+part_default=production
|
||||
+part_recovery=recovery
|
||||
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
|
||||
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
|
||||
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
|
||||
+ubi_format=ubi detach ; mtd erase ubi && 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=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+ethaddr_factory=mtd read config 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x4008001c 0x6 ; setenv ethaddr_factory
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; 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 [33m$ver[0m"
|
||||
@@ -0,0 +1,320 @@
|
||||
From 57dc777bddf0baf3c27177576c40b5113309ce54 Mon Sep 17 00:00:00 2001
|
||||
From: Chuanhong Guo <gch981213@gmail.com>
|
||||
Date: Sat, 2 Mar 2024 20:30:16 +0800
|
||||
Subject: [PATCH] add xiaomi redmi ax6s
|
||||
|
||||
---
|
||||
arch/arm/dts/Makefile | 1 +
|
||||
.../dts/mt7622-xiaomi-redmi-router-ax6s.dts | 166 ++++++++++++++++++
|
||||
...omi_redmi-router-ax6s-ubi-loader_defconfig | 98 +++++++++++
|
||||
xiaomi-redmi-router-ax6s-ubi-loader_env | 22 +++
|
||||
4 files changed, 287 insertions(+)
|
||||
create mode 100644 arch/arm/dts/mt7622-xiaomi-redmi-router-ax6s.dts
|
||||
create mode 100644 configs/mt7622_xiaomi_redmi-router-ax6s-ubi-loader_defconfig
|
||||
create mode 100644 xiaomi-redmi-router-ax6s-ubi-loader_env
|
||||
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -1225,6 +1225,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7622-linksys-e8450-ubi.dtb \
|
||||
mt7622-ubnt-unifi-6-lr.dtb \
|
||||
mt7622-ubnt-unifi-6-lr-v3.dtb \
|
||||
+ mt7622-xiaomi-redmi-router-ax6s.dtb \
|
||||
mt7623n-bananapi-bpi-r2.dtb \
|
||||
mt7629-rfb.dtb \
|
||||
mt7981-rfb.dtb \
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7622-xiaomi-redmi-router-ax6s.dts
|
||||
@@ -0,0 +1,166 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include <dt-bindings/input/linux-event-codes.h>
|
||||
+#include <dt-bindings/leds/common.h>
|
||||
+#include "mt7622.dtsi"
|
||||
+#include "mt7622-u-boot.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "Xiaomi Redmi Router AX6S";
|
||||
+ compatible = "xiaomi,redmi-router-ax6s", "mediatek,mt7622";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ aliases {
|
||||
+ spi0 = &snand;
|
||||
+ ethernet0 = ð
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x8000000>;
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ led_power_blue: power_blue {
|
||||
+ function = LED_FUNCTION_POWER;
|
||||
+ color = <LED_COLOR_ID_BLUE>;
|
||||
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_power_amber: power_amber {
|
||||
+ function = LED_FUNCTION_POWER;
|
||||
+ color = <LED_COLOR_ID_AMBER>;
|
||||
+ gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_net_blue: net_blue {
|
||||
+ label = "blue:net";
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ led_net_amber: net_amber {
|
||||
+ label = "amber:net";
|
||||
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ reset {
|
||||
+ label = "reset";
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <KEY_RESTART>;
|
||||
+ };
|
||||
+
|
||||
+ mesh {
|
||||
+ label = "mesh";
|
||||
+ gpios = <&gpio 102 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <BTN_9>;
|
||||
+ linux,input-type = <EV_SW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ 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;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pcie {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pcie0_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ pcie@0,0 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ pcie0_pins: pcie0-pins {
|
||||
+ mux {
|
||||
+ function = "pcie";
|
||||
+ groups = "pcie0_pad_perst",
|
||||
+ "pcie0_1_waken",
|
||||
+ "pcie0_1_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";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ quad-spi;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_pins>;
|
||||
+ mediatek,force-highspeed;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&watchdog_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "2500base-x";
|
||||
+ mediatek,switch = "mt7531";
|
||||
+ reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <2500>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_xiaomi_redmi-router-ax6s-ubi-loader_defconfig
|
||||
@@ -0,0 +1,98 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-xiaomi-redmi-router-ax6s"
|
||||
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x40080000
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7622-xiaomi-redmi-router-ax6s"
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_PRE_CONSOLE_BUFFER=y
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_LAST_STAGE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+# CONFIG_AUTO_COMPLETE is not set
|
||||
+CONFIG_SYS_PROMPT="MT7622> "
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+# CONFIG_CMD_BOOTP is not set
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_MTDPARTS=y
|
||||
+CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:512k(preloader),2816k(reserved),117248k(ubi)"
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_DOS_PARTITION=y
|
||||
+CONFIG_EFI_PARTITION=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="xiaomi-redmi-router-ax6s-ubi-loader_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_PROT_UDP=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_NETCONSOLE=y
|
||||
+CONFIG_USE_IPADDR=y
|
||||
+CONFIG_IPADDR="192.168.1.1"
|
||||
+CONFIG_USE_SERVERIP=y
|
||||
+CONFIG_SERVERIP="192.168.1.254"
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_UBI_SILENCE_MSG=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7622=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_UBIFS_SILENCE_MSG=y
|
||||
+CONFIG_LZ4=y
|
||||
+CONFIG_ZSTD=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
--- /dev/null
|
||||
+++ b/xiaomi-redmi-router-ax6s-ubi-loader_env
|
||||
@@ -0,0 +1,22 @@
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootled_pwr=power_blue
|
||||
+bootled_rec=power_amber
|
||||
+bootcmd=run boot_or_recovery
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-squashfs-sysupgrade.itb
|
||||
+boot_or_recovery=run boot_production ; led $bootled_pwr off ; led $bootled_rec on ; if ubi check fit ; then run boot_tftp_forever ; else run tftp_production ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_forever=while true ; do run boot_tftp ; sleep 1 ; done
|
||||
+boot_production=run ubi_read_production && bootm $loadaddr#$bootconf
|
||||
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi
|
||||
+ubi_init=ubi part ubi || run ubi_format
|
||||
+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_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_read_production=run ubi_init && ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
|
||||
+tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && run ubi_write_production && reset
|
||||
582
package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch
Normal file
582
package/boot/uboot-mediatek/patches/453-add-openwrt-one.patch
Normal file
@@ -0,0 +1,582 @@
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/openwrt-one.dts
|
||||
@@ -0,0 +1,203 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2024 John Crispin <john@phrozen.org>
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "mt7981.dtsi"
|
||||
+#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+
|
||||
+/ {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ model = "OpenWrt One";
|
||||
+ compatible = "openwrt,one", "mediatek,mt7981";
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ tick-timer = &timer0;
|
||||
+ };
|
||||
+
|
||||
+ memory@40000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x40000000 0x10000000>;
|
||||
+ };
|
||||
+
|
||||
+ keys {
|
||||
+ compatible = "gpio-keys";
|
||||
+
|
||||
+ user {
|
||||
+ label = "front";
|
||||
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <BTN_0>;
|
||||
+ };
|
||||
+
|
||||
+ reset {
|
||||
+ label = "back";
|
||||
+ gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
+ linux,code = <BTN_1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ red {
|
||||
+ label = "red";
|
||||
+ gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ white {
|
||||
+ label = "white";
|
||||
+ gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ green {
|
||||
+ label = "green";
|
||||
+ gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <1>;
|
||||
+ phy-mode = "gmii";
|
||||
+ phy-handle = <&phy0>;
|
||||
+
|
||||
+ phy0: eth-phy@0 {
|
||||
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ spi_flash_pins: spi0-pins-func-1 {
|
||||
+ mux {
|
||||
+ function = "flash";
|
||||
+ groups = "spi0", "spi0_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spi2_flash_pins: spi2-spi2-pins {
|
||||
+ mux {
|
||||
+ function = "spi";
|
||||
+ groups = "spi2", "spi2_wp_hold";
|
||||
+ };
|
||||
+
|
||||
+ conf-pu {
|
||||
+ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+
|
||||
+ conf-pd {
|
||||
+ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
|
||||
+ drive-strength = <MTK_DRIVE_8mA>;
|
||||
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ support_quad;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ compatible = "spi-nand";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <52000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "bl2";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@200000 {
|
||||
+ label = "ubi";
|
||||
+ reg = <0x100000 0x7f00000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&spi2 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&spi2_flash_pins>;
|
||||
+ status = "okay";
|
||||
+ must_tx;
|
||||
+ enhance_timing;
|
||||
+ dma_ext;
|
||||
+ ipm_design;
|
||||
+ tick_dly = <2>;
|
||||
+ sample_sel = <0>;
|
||||
+
|
||||
+ spi_nor@0 {
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ reg = <0>;
|
||||
+ spi-max-frequency = <5000000>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@00000 {
|
||||
+ label = "bl2-nor";
|
||||
+ reg = <0x00000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@40000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x40000 0x00C0000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "fip-nor";
|
||||
+ reg = <0x100000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@180000 {
|
||||
+ label = "recovery";
|
||||
+ reg = <0x180000 0xc80000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&watchdog {
|
||||
+ status = "disabled";
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_openwrt-one-nor_defconfig
|
||||
@@ -0,0 +1,129 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x8000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="openwrt-one"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_RESET_BUTTON_LABEL="back"
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_NAND_BOOT=y
|
||||
+CONFIG_SPI_BOOT=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="openwrt-one"
|
||||
+CONFIG_SYS_CBSIZE=512
|
||||
+CONFIG_SYS_PBSIZE=1049
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="OpenWrt One> "
|
||||
+CONFIG_SYS_MAXARGS=16
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="openwrt-one-nor_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+# CONFIG_MTD_RAW_NAND is not set
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_ISSI=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_XTX=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_UBI_SILENCE_MSG=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_UBIFS_SILENCE_MSG=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7981_openwrt-one-spi-nand_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
|
||||
+CONFIG_POSITION_INDEPENDENT=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="openwrt-one"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_TARGET_MT7981=y
|
||||
+CONFIG_RESET_BUTTON_LABEL="back"
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=40000000
|
||||
+CONFIG_SYS_LOAD_ADDR=0x46000000
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_NAND_BOOT=y
|
||||
+CONFIG_SPI_BOOT=y
|
||||
+CONFIG_AUTOBOOT_MENU_SHOW=y
|
||||
+CONFIG_USE_PREBOOT=y
|
||||
+CONFIG_DEFAULT_FDT_FILE="openwrt-one"
|
||||
+CONFIG_SYS_CBSIZE=512
|
||||
+CONFIG_SYS_PBSIZE=1049
|
||||
+CONFIG_LOGLEVEL=7
|
||||
+CONFIG_LOG=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="OpenWrt One> "
|
||||
+CONFIG_SYS_MAXARGS=16
|
||||
+CONFIG_CMD_CPU=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_ERASEENV=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+# CONFIG_CMD_UNLZ4 is not set
|
||||
+# CONFIG_CMD_UNZIP is not set
|
||||
+CONFIG_CMD_DM=y
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_PWM=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_TFTPSRV=y
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_SNTP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_PXE=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
|
||||
+CONFIG_CMD_UUID=y
|
||||
+CONFIG_CMD_HASH=y
|
||||
+CONFIG_CMD_SMC=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_FS_UUID=y
|
||||
+CONFIG_CMD_UBI=y
|
||||
+CONFIG_CMD_UBI_RENAME=y
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_UBI=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_ENV_UBI_PART="ubi"
|
||||
+CONFIG_ENV_UBI_VOLUME="ubootenv"
|
||||
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="openwrt-one-spi-nand_env"
|
||||
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
+CONFIG_VERSION_VARIABLE=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_LED=y
|
||||
+CONFIG_LED_BLINK=y
|
||||
+CONFIG_LED_GPIO=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+# CONFIG_MTD_RAW_NAND is not set
|
||||
+CONFIG_MTD_SPI_NAND=y
|
||||
+CONFIG_DM_SPI_FLASH=y
|
||||
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
|
||||
+CONFIG_SPI_FLASH_EON=y
|
||||
+CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
+CONFIG_SPI_FLASH_ISSI=y
|
||||
+CONFIG_SPI_FLASH_MACRONIX=y
|
||||
+CONFIG_SPI_FLASH_SPANSION=y
|
||||
+CONFIG_SPI_FLASH_STMICRO=y
|
||||
+CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_SPI_FLASH_XMC=y
|
||||
+CONFIG_SPI_FLASH_XTX=y
|
||||
+CONFIG_SPI_FLASH_MTD=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7981=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SPIM=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_HEXDUMP=y
|
||||
+CONFIG_LMB_MAX_REGIONS=64
|
||||
--- /dev/null
|
||||
+++ b/openwrt-one-nor_env
|
||||
@@ -0,0 +1,46 @@
|
||||
+bl2_mtd_write=mtd erase bl2-nor && mtd write bl2-nor $loadaddr 0x0 0x40000
|
||||
+bl2_tftp_write=tftpboot $loadaddr $bootfile_bl2_nor && run bl2_mtd_write
|
||||
+bootcmd=run check_button ; run led_start ; mtd read recovery ${loadaddr} ; bootm ; run led_loop_error
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-openwrt_one-initramfs.itb
|
||||
+bootfile_bl2_nor=openwrt-mediatek-filogic-openwrt_one-nor-preloader.bin
|
||||
+bootfile_fip_nor=openwrt-mediatek-filogic-openwrt_one-nor-bl31-uboot.fip
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run bootcmd
|
||||
+bootmenu_1=Boot system via TFTP.=run tftp_boot ; run bootmenu_confirm_return
|
||||
+bootmenu_2=[31mUnlock NOR. (Make sure the NOR/WP jumper is populated)[0m=sf probe 1:0 && sf protect unlock 0x0 0x1000000 ; run bootmenu_confirm_return
|
||||
+bootmenu_3=[31mLoad BL31+U-Boot FIP via TFTP then write to NOR.[0m=run fip_tftp_write ; run bootmenu_confirm_return
|
||||
+bootmenu_4=[31mLoad BL2 preloader via TFTP then write to NOR.[0m=run bl2_tftp_write ; run bootmenu_confirm_return
|
||||
+bootmenu_5=[31mLoad recovery system via TFTP then write to NOR.[0m=run tftp_write ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLock NOR. (Remove jumper afterwards)[0m=sf probe 1:0 && sf protect lock 0x0 0x1000000 ; run bootmenu_confirm_return
|
||||
+bootmenu_7=Reboot.=reset
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NOR][0m
|
||||
+check_button=if button front ; then run usb_recovery ; run led_loop_error ; fi
|
||||
+fip_mtd_write=mtd erase fip-nor && mtd write fip-nor $loadaddr
|
||||
+fip_tftp_write=tftpboot $loadaddr $bootfile_fip_nor && run fip_mtd_write
|
||||
+ipaddr=192.168.11.11
|
||||
+led_done=led green off ; led white on
|
||||
+led_loop_done=led white off ; led green on ; echo done ; while true ; do sleep 1 ; done
|
||||
+led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done
|
||||
+led_boot=led green on ; led white on ; led red on
|
||||
+led_start=led green off ; led red off; led white on
|
||||
+loadaddr=0x46000000
|
||||
+preboot=run led_boot
|
||||
+recoverfile_bl2=openwrt-mediatek-filogic-openwrt_one-snand-preloader.bin
|
||||
+recoverfile_ubi=openwrt-mediatek-filogic-openwrt_one-factory.ubi
|
||||
+recovery_write_bl2=mtd erase bl2 && for offset in 0x0 0x40000 0x80000; do mtd write bl2 $loadaddr $offset 0x40000 ; done
|
||||
+recovery_write_ubi=mtd erase ubi && mtd write ubi $loadaddr 0 ${filesize}
|
||||
+serverip=192.168.11.23
|
||||
+tftp_boot=run led_start ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+tftp_write=run led_start ; tftpboot $loadaddr $bootfile && mtd erase recovery 0x0 ${filesize} && mtd write recovery $loadaddr 0x0 ${filesize}
|
||||
+usb_recovery=run led_start ; usb start && run usb_recovery_bl2 && run usb_recovery_ubi && run led_loop_done
|
||||
+usb_recovery_bl2=fatload usb 0:1 ${loadaddr} ${recoverfile_bl2} && run recovery_write_bl2
|
||||
+usb_recovery_ubi=fatload usb 0:1 ${loadaddr} ${recoverfile_ubi} && run recovery_write_ubi
|
||||
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m"
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; bootmenu
|
||||
+_init_env=setenv _init_env ; echo Initialize Env ; run ubi_create_env ; saveenv
|
||||
+_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
|
||||
--- /dev/null
|
||||
+++ b/openwrt-one-spi-nand_env
|
||||
@@ -0,0 +1,59 @@
|
||||
+ipaddr=192.168.11.11
|
||||
+serverip=192.168.11.23
|
||||
+loadaddr=0x46000000
|
||||
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
|
||||
+bootcmd=run check_buttons ; run led_start ; run boot_calibration ; run boot_production ; run boot_recovery
|
||||
+bootconf=config-1
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-filogic-openwrt_one-initramfs.itb
|
||||
+bootfile_bl2=openwrt-mediatek-filogic-openwrt_one-snand-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-filogic-openwrt_one-snand-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; run led_boot ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SPI-NAND][0m
|
||||
+bootmenu_0=Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=Run default boot command.=run boot_default
|
||||
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to NAND.=noboot=1 ; replacevol=1 ; run boot_tftp_production ; noboot= ; replacevol= ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to NAND.=noboot=1 ; replacevol=1 ; run boot_tftp_recovery ; noboot= ; replacevol= ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_default=run bootcmd ; run boot_recovery ; replacevol=1 ; run boot_tftp_forever
|
||||
+boot_calibration=ubi read $loadaddr calibration && bootm $loadaddr#$bootconf
|
||||
+boot_production=led white on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led white off
|
||||
+boot_recovery=led green on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led green off
|
||||
+boot_tftp=run led_start ; tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_forever=led green off ; led white off ; led red on ; while true ; do run boot_tftp_recovery ; led red off ; sleep 1 ; done
|
||||
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && test $replacevol = 1 && iminfo $loadaddr && run ubi_write_production ; if test $noboot = 1 ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && test $replacevol = 1 && iminfo $loadaddr && run ubi_write_recovery ; if test $noboot = 1 ; then else bootm $loadaddr#$bootconf ; fi
|
||||
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory
|
||||
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
|
||||
+check_buttons=if button front ; then run boot_recovery ; run boot_tftp ; run led_loop_error ; else if button back ; then ; run usb_recover ; run led_loop_error ; fi ; fi
|
||||
+led_boot=led green on ; led white on ; led red on
|
||||
+led_done=led green on ; led white off ; led red off
|
||||
+led_loop_error=led white off ; led green off ; while true ; do led red on ; sleep 1 ; led red off ; sleep 1 ; done
|
||||
+led_start=led white on ; led green off ; led red off
|
||||
+preboot=run led_boot
|
||||
+reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
|
||||
+snand_write_bl2=mtd erase bl2 && for offset in 0x0 0x40000 0x80000 0xc0000 ; do mtd write bl2 $loadaddr $offset 0x40000 ; done
|
||||
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic
|
||||
+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
|
||||
+usb_recover=run led_start ; usb start && run usb_recover_production && run led_loop_done
|
||||
+usb_recover_production=fatload usb 0:1 ${loadaddr} ${bootfile_upg} && iminfo $loadaddr && run ubi_write_production
|
||||
+ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip $filesize static && ubi write $loadaddr fip $filesize
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
|
||||
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; bootmenu
|
||||
+_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 [33m$ver[0m"
|
||||
Reference in New Issue
Block a user