1 From 3757223c3354b9feeffcbe916eb18eb8873bd133 Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Wed, 3 Mar 2021 10:48:53 +0800
4 Subject: [PATCH 07/12] board: mt7629: add support for booting from SPI-NAND
6 Add support for mt7629 to boot from SPI-NAND.
7 Add a new defconfig for mt7629+spi-nand configuration.
9 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
11 arch/arm/dts/mt7629-rfb-u-boot.dtsi | 8 ++
12 arch/arm/dts/mt7629-rfb.dts | 10 +++
13 arch/arm/dts/mt7629.dtsi | 16 ++++
14 board/mediatek/mt7629/Kconfig | 35 ++++++++-
15 configs/mt7629_nand_rfb_defconfig | 111 ++++++++++++++++++++++++++++
16 include/configs/mt7629.h | 7 ++
17 6 files changed, 186 insertions(+), 1 deletion(-)
18 create mode 100644 configs/mt7629_nand_rfb_defconfig
20 --- a/arch/arm/dts/mt7629-rfb-u-boot.dtsi
21 +++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi
28 + u-boot,dm-pre-reloc;
32 + u-boot,dm-pre-reloc;
34 --- a/arch/arm/dts/mt7629-rfb.dts
35 +++ b/arch/arm/dts/mt7629-rfb.dts
39 snfi_pins: snfi-pins {
40 + u-boot,dm-pre-reloc;
45 + u-boot,dm-pre-reloc;
54 + pinctrl-names = "default";
55 + pinctrl-0 = <&snfi_pins>;
61 pinctrl-names = "default";
62 pinctrl-0 = <&uart0_pins>;
63 --- a/arch/arm/dts/mt7629.dtsi
64 +++ b/arch/arm/dts/mt7629.dtsi
69 + snand: snand@1100d000 {
70 + compatible = "mediatek,mt7629-snand";
71 + reg = <0x1100d000 0x1000>,
72 + <0x1100e000 0x1000>;
73 + reg-names = "nfi", "ecc";
74 + clocks = <&pericfg CLK_PERI_NFI_PD>,
75 + <&pericfg CLK_PERI_SNFI_PD>,
76 + <&pericfg CLK_PERI_NFIECC_PD>;
77 + clock-names = "nfi_clk", "pad_clk", "ecc_clk";
78 + assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
79 + <&topckgen CLK_TOP_NFI_INFRA_SEL>;
80 + assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
81 + <&topckgen CLK_TOP_UNIVPLL2_D8>;
82 + status = "disabled";
86 compatible = "mediatek,mtk-snor";
87 reg = <0x11014000 0x1000>;
88 --- a/board/mediatek/mt7629/Kconfig
89 +++ b/board/mediatek/mt7629/Kconfig
90 @@ -12,6 +12,39 @@ config MTK_SPL_PAD_SIZE
92 config MTK_BROM_HEADER_INFO
95 + default "media=nor" if BOOT_FROM_SNOR
96 + default "media=snand;nandinfo=2k+64" if BOOT_FROM_SNAND_2K_64
97 + default "media=snand;nandinfo=2k+128" if BOOT_FROM_SNAND_2K_128
98 + default "media=snand;nandinfo=4k+128" if BOOT_FROM_SNAND_4K_128
99 + default "media=snand;nandinfo=4k+256" if BOOT_FROM_SNAND_4K_256
102 + prompt "Boot device"
103 + default BOOT_FROM_SNOR
105 +config BOOT_FROM_SNOR
108 +config BOOT_FROM_SNAND_2K_64
109 + bool "SPI-NAND (2K+64)"
110 + select MT7629_BOOT_FROM_SNAND
112 +config BOOT_FROM_SNAND_2K_128
113 + bool "SPI-NAND (2K+128)"
114 + select MT7629_BOOT_FROM_SNAND
116 +config BOOT_FROM_SNAND_4K_128
117 + bool "SPI-NAND (4K+128)"
118 + select MT7629_BOOT_FROM_SNAND
120 +config BOOT_FROM_SNAND_4K_256
121 + bool "SPI-NAND (4K+256)"
122 + select MT7629_BOOT_FROM_SNAND
126 +config MT7629_BOOT_FROM_SNAND
132 +++ b/configs/mt7629_nand_rfb_defconfig
135 +CONFIG_SYS_ARCH_TIMER=y
136 +CONFIG_SYS_THUMB_BUILD=y
137 +CONFIG_ARCH_MEDIATEK=y
138 +CONFIG_SYS_TEXT_BASE=0x41e00000
139 +CONFIG_SYS_MALLOC_F_LEN=0x4000
140 +CONFIG_NR_DRAM_BANKS=1
141 +CONFIG_ENV_SIZE=0x20000
142 +CONFIG_ENV_OFFSET=0x100000
143 +CONFIG_SPL_TEXT_BASE=0x201000
144 +CONFIG_TARGET_MT7629=y
145 +CONFIG_BOOT_FROM_SNAND_2K_64=y
146 +CONFIG_SPL_SERIAL_SUPPORT=y
147 +CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
148 +CONFIG_SPL_STACK_R_ADDR=0x40800000
149 +CONFIG_SPL_PAYLOAD="u-boot.img"
150 +CONFIG_BUILD_TARGET="u-boot-mtk.bin"
151 +CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
152 +CONFIG_SPL_IMAGE="spl/u-boot-spl-mtk.bin"
154 +CONFIG_FIT_VERBOSE=y
156 +CONFIG_DEFAULT_FDT_FILE="mt7629-rfb"
157 +CONFIG_SYS_CONSOLE_IS_IN_ENV=y
158 +CONFIG_SYS_STDIO_DEREGISTER=y
159 +# CONFIG_DISPLAY_BOARDINFO is not set
160 +CONFIG_SPL_SYS_MALLOC_SIMPLE=y
161 +CONFIG_SPL_STACK_R=y
162 +CONFIG_SPL_MTD_SUPPORT=y
163 +CONFIG_SPL_NAND_SUPPORT=y
164 +CONFIG_SPL_WATCHDOG_SUPPORT=y
165 +CONFIG_HUSH_PARSER=y
166 +CONFIG_SYS_PROMPT="U-Boot> "
167 +CONFIG_CMD_BOOTMENU=y
168 +# CONFIG_BOOTM_NETBSD is not set
169 +# CONFIG_BOOTM_PLAN9 is not set
170 +# CONFIG_BOOTM_RTEMS is not set
171 +# CONFIG_BOOTM_VXWORKS is not set
172 +# CONFIG_CMD_ELF is not set
173 +# CONFIG_CMD_XIMG is not set
176 +# CONFIG_CMD_FLASH is not set
180 +# CONFIG_CMD_SETEXPR is not set
181 +# CONFIG_CMD_NFS is not set
184 +CONFIG_CMD_FS_GENERIC=y
186 +CONFIG_EFI_PARTITION=y
187 +# CONFIG_SPL_PARTITION_UUIDS is not set
188 +CONFIG_PARTITION_TYPE_GUID=y
189 +CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-parents"
190 +CONFIG_ENV_OVERWRITE=y
191 +CONFIG_ENV_IS_IN_MTD=y
192 +CONFIG_ENV_MTD_NAME="spi-nand0"
193 +CONFIG_ENV_SIZE_REDUND=0x40000
194 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
195 +CONFIG_NET_RANDOM_ETHADDR=y
196 +CONFIG_SPL_DM_SEQ_ALIAS=y
204 +# CONFIG_MMC is not set
207 +CONFIG_MTK_SPI_NAND=y
208 +CONFIG_MTK_SPI_NAND_MTD=y
209 +CONFIG_SPL_MTK_SPI_NAND=y
211 +CONFIG_MEDIATEK_ETH=y
213 +CONFIG_PHY_MTK_TPHY=y
216 +CONFIG_SPL_PINCTRL=y
217 +CONFIG_SPL_PINCONF=y
218 +CONFIG_PINCTRL_MT7629=y
219 +CONFIG_POWER_DOMAIN=y
220 +CONFIG_MTK_POWER_DOMAIN=y
221 +CONFIG_DM_REGULATOR=y
222 +CONFIG_DM_REGULATOR_FIXED=y
230 +CONFIG_MTK_SNFI_SPI=y
232 +CONFIG_SPL_SYSRESET=y
233 +CONFIG_SYSRESET_WATCHDOG=y
236 +# CONFIG_SPL_DM_USB is not set
237 +CONFIG_USB_XHCI_HCD=y
238 +CONFIG_USB_XHCI_MTK=y
239 +CONFIG_USB_STORAGE=y
244 +# CONFIG_EFI_LOADER is not set
245 --- a/include/configs/mt7629.h
246 +++ b/include/configs/mt7629.h
249 /* Defines for SPL */
250 #define CONFIG_SPL_STACK 0x106000
251 +#ifdef CONFIG_MT7629_BOOT_FROM_SNAND
252 +#define CONFIG_SPL_MAX_SIZE SZ_128K
253 +#define CONFIG_SPL_MAX_FOOTPRINT SZ_128K
254 +#define CONFIG_SPL_PAD_TO 0x20000
255 +#define CONFIG_SYS_NAND_U_BOOT_OFFS CONFIG_SPL_PAD_TO
257 #define CONFIG_SPL_MAX_SIZE SZ_64K
258 #define CONFIG_SPL_MAX_FOOTPRINT SZ_64K
259 #define CONFIG_SPL_PAD_TO 0x10000
261 #define CONFIG_SPI_ADDR 0x30000000
262 #define CONFIG_SYS_UBOOT_BASE (CONFIG_SPI_ADDR + CONFIG_SPL_PAD_TO)
266 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + SZ_2M - \