]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mediatek: retrieve ram_base from dts node for armv8 platform
authorWeijie Gao <weijie.gao@mediatek.com>
Wed, 19 Jul 2023 09:15:41 +0000 (17:15 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 3 Aug 2023 13:40:48 +0000 (09:40 -0400)
Now we use fdtdec_setup_mem_size_base() to get DRAM base from fdt ram node
and update gd->ram_base. CFG_SYS_SDRAM_BASE is unused and will be removed.

Also, since mt7622 always passes fdt to linux kernel, there's no need to
assign value to gd->bd->bi_boot_params.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
15 files changed:
arch/arm/dts/mt7981-emmc-rfb.dts
arch/arm/dts/mt7981-rfb.dts
arch/arm/dts/mt7981-sd-rfb.dts
arch/arm/dts/mt7986a-bpi-r3-sd.dts
arch/arm/dts/mt7986a-rfb.dts
arch/arm/dts/mt7986a-sd-rfb.dts
arch/arm/dts/mt7986b-rfb.dts
arch/arm/dts/mt7986b-sd-rfb.dts
arch/arm/mach-mediatek/mt7622/init.c
arch/arm/mach-mediatek/mt7981/init.c
arch/arm/mach-mediatek/mt7986/init.c
board/mediatek/mt7622/mt7622_rfb.c
include/configs/mt7622.h
include/configs/mt7981.h
include/configs/mt7986.h

index 2b7eae99ce4400230e6e502c745826549d1c3ff5..a0913c5b7c84abc72bd8195c1c13773aada4f1f9 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
        reg_3p3v: regulator-3p3v {
                  compatible = "regulator-fixed";
                  regulator-name = "fixed-3.3V";
index 5559ace953842de67f8ce40beb95b5e1a8b6f9d3..1dc90ac63ffcd1987bbe1705bf7ad2e15106a219 100644 (file)
                stdout-path = &uart0;
                tick-timer = &timer0;
        };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
 };
 
 &uart0 {
index 34ac227ecf40493ca86c661d61e67c46a81f6fa1..05f3fdb5ef1f6b58d23c93ca0989ff571c79c2d7 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
        reg_3p3v: regulator-3p3v {
                  compatible = "regulator-fixed";
                  regulator-name = "fixed-3.3V";
index 4d12440fa3c0cec918ccb1dfdfa44c0a044d9dc8..15256302b86b2b6c72ea405a909ae5ca3a2d4037 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x80000000>;
+       };
+
        reg_3p3v: regulator-3p3v {
                compatible = "regulator-fixed";
                regulator-name = "fixed-3.3V";
index 80def57e1a1d81a6f679a2ed4091093a2aa1019f..dce85d82772d46d53eaa8d489d58937900ed2e2b 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
        reg_1p8v: regulator-1p8v {
                compatible = "regulator-fixed";
                regulator-name = "fixed-1.8V";
index 5807c5d5ccb6ece9fa05438f5e0a1b19cfde73c0..7f32607589a34af720617f6a84bddb56fb104ed4 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
        reg_3p3v: regulator-3p3v {
                compatible = "regulator-fixed";
                regulator-name = "fixed-3.3V";
index 0c4e3e878fa941ee0aea9d8117af46f15b8a4441..3349e38a9004e8ae034a33056f41fcfb55e15406 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
        reg_3p3v: regulator-3p3v {
                compatible = "regulator-fixed";
                regulator-name = "fixed-3.3V";
index 48f9320e7ae590bb02234598f0e321233bcb34fa..6c9203332bba6acc9b329c169a3897473da5f0f4 100644 (file)
                tick-timer = &timer0;
        };
 
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
        reg_3p3v: regulator-3p3v {
                compatible = "regulator-fixed";
                regulator-name = "fixed-3.3V";
index e501907b53514c56471867cdf22d892fcfea7ce7..00d3eb9ce7a47503f8ca78e8a3cf9709cd3e8341 100644 (file)
@@ -4,11 +4,15 @@
  * Author: Sam Shih <sam.shih@mediatek.com>
  */
 
-#include <common.h>
 #include <fdtdec.h>
 #include <init.h>
 #include <asm/armv8/mmu.h>
-#include <asm/cache.h>
+#include <asm/system.h>
+#include <asm/global_data.h>
+#include <asm/u-boot.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 int print_cpuinfo(void)
 {
@@ -20,11 +24,13 @@ int dram_init(void)
 {
        int ret;
 
-       ret = fdtdec_setup_memory_banksize();
+       ret = fdtdec_setup_mem_size_base();
        if (ret)
                return ret;
-       return fdtdec_setup_mem_size_base();
 
+       gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G);
+
+       return 0;
 }
 
 void reset_cpu(void)
index 3c921d6ad5cced83997cbe8a3a7ce3ab82c445fc..862f0ca4793d5f5776bd6e2ac94c55bc1dc12620 100644 (file)
@@ -4,18 +4,25 @@
  * Author: Sam Shih <sam.shih@mediatek.com>
  */
 
-#include <cpu_func.h>
+#include <fdtdec.h>
 #include <init.h>
 #include <asm/armv8/mmu.h>
 #include <asm/system.h>
 #include <asm/global_data.h>
+#include <asm/u-boot.h>
 #include <linux/sizes.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-       gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G);
+       int ret;
+
+       ret = fdtdec_setup_mem_size_base();
+       if (ret)
+               return ret;
+
+       gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_1G);
 
        return 0;
 }
index 9d0c0cdcd08fd5d201df7142635ae26a49e042c4..905a3ab4e2721c331eacd6c8d2d12aa51f48bb59 100644 (file)
@@ -4,18 +4,25 @@
  * Author: Sam Shih <sam.shih@mediatek.com>
  */
 
-#include <cpu_func.h>
+#include <fdtdec.h>
 #include <init.h>
 #include <asm/armv8/mmu.h>
 #include <asm/system.h>
 #include <asm/global_data.h>
+#include <asm/u-boot.h>
 #include <linux/sizes.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-       gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G);
+       int ret;
+
+       ret = fdtdec_setup_mem_size_base();
+       if (ret)
+               return ret;
+
+       gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G);
 
        return 0;
 }
index ff233e920a031b5a5950784d7fa2275ee62a45c7..2cc73bc35dcae794ce15bda2f681afb90ec980ff 100644 (file)
@@ -14,7 +14,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
-       gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
        return 0;
 }
 
index 65415129534507812c9ce7100ed4de3983c47f04..4a056954bf846f84c1e7df9b81b728b86816b71c 100644 (file)
@@ -9,14 +9,4 @@
 #ifndef __MT7622_H
 #define __MT7622_H
 
-/* Uboot definition */
-#define CFG_SYS_UBOOT_BASE                   CONFIG_TEXT_BASE
-
-/* SPL -> Uboot */
-#define CFG_SYS_UBOOT_START            CONFIG_TEXT_BASE
-/* DRAM */
-#define CFG_SYS_SDRAM_BASE             0x40000000
-
-/* Ethernet */
-
 #endif
index 14c885ec55c5c8eba312371c48eb49fa178c9fd4..a6d647edc42f8d5487f4fcab5f0a354704720da0 100644 (file)
@@ -9,13 +9,4 @@
 #ifndef __MT7981_H
 #define __MT7981_H
 
-/* Uboot definition */
-#define CFG_SYS_UBOOT_BASE             CONFIG_TEXT_BASE
-
-/* SPL -> Uboot */
-#define CFG_SYS_UBOOT_START            CONFIG_TEXT_BASE
-
-/* DRAM */
-#define CFG_SYS_SDRAM_BASE             0x40000000
-
 #endif
index 0c41af1fc3293d98d340a785d5d6be1ba519c7a0..090b4c6833e2ae2f15d614d3064e6689cbb96204 100644 (file)
@@ -9,13 +9,4 @@
 #ifndef __MT7986_H
 #define __MT7986_H
 
-/* Uboot definition */
-#define CFG_SYS_UBOOT_BASE             CONFIG_TEXT_BASE
-
-/* SPL -> Uboot */
-#define CFG_SYS_UBOOT_START            CONFIG_TEXT_BASE
-
-/* DRAM */
-#define CFG_SYS_SDRAM_BASE             0x40000000
-
 #endif