1 From 63336ec7fd7d480ac58a91f3b20d08bf1b3a13ad Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Wed, 19 Jul 2023 17:15:41 +0800
4 Subject: [PATCH 01/29] arm: mediatek: retrieve ram_base from dts node for
7 Now we use fdtdec_setup_mem_size_base() to get DRAM base from fdt ram node
8 and update gd->ram_base. CFG_SYS_SDRAM_BASE is unused and will be removed.
10 Also, since mt7622 always passes fdt to linux kernel, there's no need to
11 assign value to gd->bd->bi_boot_params.
13 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
15 arch/arm/dts/mt7981-emmc-rfb.dts | 5 +++++
16 arch/arm/dts/mt7981-rfb.dts | 5 +++++
17 arch/arm/dts/mt7981-sd-rfb.dts | 5 +++++
18 arch/arm/dts/mt7986a-bpi-r3-sd.dts | 5 +++++
19 arch/arm/dts/mt7986a-rfb.dts | 5 +++++
20 arch/arm/dts/mt7986a-sd-rfb.dts | 5 +++++
21 arch/arm/dts/mt7986b-rfb.dts | 5 +++++
22 arch/arm/dts/mt7986b-sd-rfb.dts | 5 +++++
23 arch/arm/mach-mediatek/mt7622/init.c | 13 +++++++++----
24 arch/arm/mach-mediatek/mt7981/init.c | 11 +++++++++--
25 arch/arm/mach-mediatek/mt7986/init.c | 11 +++++++++--
26 board/mediatek/mt7622/mt7622_rfb.c | 1 -
27 include/configs/mt7622.h | 10 ----------
28 include/configs/mt7981.h | 9 ---------
29 include/configs/mt7986.h | 9 ---------
30 15 files changed, 67 insertions(+), 37 deletions(-)
32 --- a/arch/arm/dts/mt7981-emmc-rfb.dts
33 +++ b/arch/arm/dts/mt7981-emmc-rfb.dts
39 + device_type = "memory";
40 + reg = <0x40000000 0x10000000>;
43 reg_3p3v: regulator-3p3v {
44 compatible = "regulator-fixed";
45 regulator-name = "fixed-3.3V";
46 --- a/arch/arm/dts/mt7981-rfb.dts
47 +++ b/arch/arm/dts/mt7981-rfb.dts
54 + device_type = "memory";
55 + reg = <0x40000000 0x10000000>;
60 --- a/arch/arm/dts/mt7981-sd-rfb.dts
61 +++ b/arch/arm/dts/mt7981-sd-rfb.dts
67 + device_type = "memory";
68 + reg = <0x40000000 0x10000000>;
71 reg_3p3v: regulator-3p3v {
72 compatible = "regulator-fixed";
73 regulator-name = "fixed-3.3V";
74 --- a/arch/arm/dts/mt7986a-bpi-r3-sd.dts
75 +++ b/arch/arm/dts/mt7986a-bpi-r3-sd.dts
81 + device_type = "memory";
82 + reg = <0x40000000 0x80000000>;
85 reg_3p3v: regulator-3p3v {
86 compatible = "regulator-fixed";
87 regulator-name = "fixed-3.3V";
88 --- a/arch/arm/dts/mt7986a-rfb.dts
89 +++ b/arch/arm/dts/mt7986a-rfb.dts
95 + device_type = "memory";
96 + reg = <0x40000000 0x10000000>;
99 reg_1p8v: regulator-1p8v {
100 compatible = "regulator-fixed";
101 regulator-name = "fixed-1.8V";
102 --- a/arch/arm/dts/mt7986a-sd-rfb.dts
103 +++ b/arch/arm/dts/mt7986a-sd-rfb.dts
105 tick-timer = &timer0;
109 + device_type = "memory";
110 + reg = <0x40000000 0x10000000>;
113 reg_3p3v: regulator-3p3v {
114 compatible = "regulator-fixed";
115 regulator-name = "fixed-3.3V";
116 --- a/arch/arm/dts/mt7986b-rfb.dts
117 +++ b/arch/arm/dts/mt7986b-rfb.dts
119 tick-timer = &timer0;
123 + device_type = "memory";
124 + reg = <0x40000000 0x10000000>;
127 reg_3p3v: regulator-3p3v {
128 compatible = "regulator-fixed";
129 regulator-name = "fixed-3.3V";
130 --- a/arch/arm/dts/mt7986b-sd-rfb.dts
131 +++ b/arch/arm/dts/mt7986b-sd-rfb.dts
133 tick-timer = &timer0;
137 + device_type = "memory";
138 + reg = <0x40000000 0x10000000>;
141 reg_3p3v: regulator-3p3v {
142 compatible = "regulator-fixed";
143 regulator-name = "fixed-3.3V";
144 --- a/arch/arm/mach-mediatek/mt7622/init.c
145 +++ b/arch/arm/mach-mediatek/mt7622/init.c
147 * Author: Sam Shih <sam.shih@mediatek.com>
153 #include <asm/armv8/mmu.h>
154 -#include <asm/cache.h>
155 +#include <asm/global_data.h>
156 +#include <asm/u-boot.h>
157 +#include <linux/sizes.h>
159 +DECLARE_GLOBAL_DATA_PTR;
161 int print_cpuinfo(void)
163 @@ -20,11 +23,13 @@ int dram_init(void)
167 - ret = fdtdec_setup_memory_banksize();
168 + ret = fdtdec_setup_mem_size_base();
171 - return fdtdec_setup_mem_size_base();
173 + gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G);
179 --- a/arch/arm/mach-mediatek/mt7981/init.c
180 +++ b/arch/arm/mach-mediatek/mt7981/init.c
182 * Author: Sam Shih <sam.shih@mediatek.com>
185 -#include <cpu_func.h>
188 #include <asm/armv8/mmu.h>
189 #include <asm/system.h>
190 #include <asm/global_data.h>
191 +#include <asm/u-boot.h>
192 #include <linux/sizes.h>
194 DECLARE_GLOBAL_DATA_PTR;
198 - gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G);
201 + ret = fdtdec_setup_mem_size_base();
205 + gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_1G);
209 --- a/arch/arm/mach-mediatek/mt7986/init.c
210 +++ b/arch/arm/mach-mediatek/mt7986/init.c
212 * Author: Sam Shih <sam.shih@mediatek.com>
215 -#include <cpu_func.h>
218 #include <asm/armv8/mmu.h>
219 #include <asm/system.h>
220 #include <asm/global_data.h>
221 +#include <asm/u-boot.h>
222 #include <linux/sizes.h>
224 DECLARE_GLOBAL_DATA_PTR;
228 - gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G);
231 + ret = fdtdec_setup_mem_size_base();
235 + gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G);
239 --- a/board/mediatek/mt7622/mt7622_rfb.c
240 +++ b/board/mediatek/mt7622/mt7622_rfb.c
241 @@ -19,7 +19,6 @@ DECLARE_GLOBAL_DATA_PTR;
245 - gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
249 --- a/include/configs/mt7622.h
250 +++ b/include/configs/mt7622.h
255 -/* Uboot definition */
256 -#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE
259 -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE
261 -#define CFG_SYS_SDRAM_BASE 0x40000000
266 --- a/include/configs/mt7981.h
267 +++ b/include/configs/mt7981.h
272 -/* Uboot definition */
273 -#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE
276 -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE
279 -#define CFG_SYS_SDRAM_BASE 0x40000000
282 --- a/include/configs/mt7986.h
283 +++ b/include/configs/mt7986.h
288 -/* Uboot definition */
289 -#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE
292 -#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE
295 -#define CFG_SYS_SDRAM_BASE 0x40000000