u-boot-nuvoton: Move patches from internal repo
Tested:
Built successfully
Platforms-Affected: npcm8xx platforms
Fusion-Link: fusion2 n/a in the cherry-pick CL
Smoke-Bug-Id: 357538971
Google-Bug-Id: 356721575
Change-Id: I604303dc5d4afd542d394696ceac0eed5731e135
Signed-off-by: David Wang <davidwang@quanta.corp-partner.google.com>
(cherry picked from commit 9e2f3c3264b549ac9f7a5e8e56cd0596334313a9)
diff --git a/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0002-set-all-RCRs-TIP_reset.patch b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0002-set-all-RCRs-TIP_reset.patch
new file mode 100644
index 0000000..2678944
--- /dev/null
+++ b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0002-set-all-RCRs-TIP_reset.patch
@@ -0,0 +1,32 @@
+From ba9353426bbfdf1a17f8d23fc441ef6495f4b876 Mon Sep 17 00:00:00 2001
+From: Jerry Wan <jerry.wan@quantatw.com>
+Date: Thu, 16 Feb 2023 13:35:03 +0800
+Subject: [PATCH] set all RCRs TIP_reset
+
+---
+ board/nuvoton/arbel/arbel.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/board/nuvoton/arbel/arbel.c b/board/nuvoton/arbel/arbel.c
+index 53d1790773..95581ca990 100644
+--- a/board/nuvoton/arbel/arbel.c
++++ b/board/nuvoton/arbel/arbel.c
+@@ -81,6 +81,15 @@ static void arbel_clk_init(void)
+ val &= ~PIXCKSEL_MASK;
+ val |= FIELD_PREP(PIXCKSEL_MASK, PIXCKSEL_GFX);
+ writel(val, NPCM_CLK_BA + CLKSEL);
++ /* set 1 in all RCRs of TIP_reset */
++ int i;
++ int RCRs[] = {0x38, 0x3c, 0x40, 0x44, 0x48, 0x4c, 0x5c};
++ for (i = 0; i < 7; i++)
++ {
++ val = readl(NPCM_CLK_BA + RCRs[i]);
++ val |= BIT(12);
++ writel(val, NPCM_CLK_BA + RCRs[i]);
++ }
+ }
+
+ int board_init(void)
+--
+2.34.1
+
diff --git a/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0003-Reserve-memory-for-ramoops.patch b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0003-Reserve-memory-for-ramoops.patch
new file mode 100644
index 0000000..3d69b7d
--- /dev/null
+++ b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0003-Reserve-memory-for-ramoops.patch
@@ -0,0 +1,33 @@
+From b17cdf6c636dfb9c6a07ab89774cd59581a05013 Mon Sep 17 00:00:00 2001
+From: Jeff Lin <JeffLin2@quantatw.com>
+Date: Tue, 26 Sep 2023 09:02:19 +0800
+Subject: [PATCH] Reserve memory for ramoops
+
+---
+ include/configs/arbel.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/configs/arbel.h b/include/configs/arbel.h
+index d8b89e63c9..6ea2de59f2 100644
+--- a/include/configs/arbel.h
++++ b/include/configs/arbel.h
+@@ -26,6 +26,7 @@
+ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 14400, 19200, 38400, 57600, 115200, 230400, \
+ 380400, 460800, 921600 }
+ #define CONFIG_BITBANGMII_MULTI
++#define CONFIG_PRAM 33024 /* 32MB + 256KB */
+
+ /* NPCM specific defines */
+ #define SPI_FLASH_BASE_ADDR 0x80000000
+@@ -60,7 +61,7 @@
+ "earlycon=uart8250,mmio32,0xf0000000\0" \
+ "console=ttyS0,115200n8\0" \
+ "common_bootargs=setenv bootargs earlycon=${earlycon} root=/dev/ram " \
+- "console=${console} mem=${mem} ramdisk_size=48000 oops=panic panic=20\0" \
++ "console=${console} mem=${mem} ramdisk_size=48000 oops=panic panic=20 crashkernel=64M\0" \
+ "ftp_prog=setenv ethact eth${eth_num}; dhcp; tftp 10000000 image-bmc; cp.b 10000000 80000000 ${filesize}\0" \
+ "ftp_run=setenv ethact eth${eth_num}; dhcp; tftp 10000000 image-bmc; bootm 10200000\0" \
+ "usb_prog=usb start; fatload usb 0 10000000 image-bmc; cp.b 10000000 80000000 ${filesize}\0" \
+--
+2.25.1
+
diff --git a/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0004-recipe-uboot-WA-to-disable-GFX-module.patch b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0004-recipe-uboot-WA-to-disable-GFX-module.patch
new file mode 100644
index 0000000..39fac2a
--- /dev/null
+++ b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton/0004-recipe-uboot-WA-to-disable-GFX-module.patch
@@ -0,0 +1,54 @@
+From 11fe092d03b1d033fa97c22a6a2f8a821e004d22 Mon Sep 17 00:00:00 2001
+From: Fran Hsu <fran.hsu@quanta.corp-partner.google.com>
+Date: Tue, 24 Oct 2023 16:19:13 +0800
+Subject: [PATCH] recipe-uboot: WA to disable GFX module Apply a WA
+ to disable BMC GFX module.
+
+Signed-off-by: Fran Hsu <fran.hsu@quanta.corp-partner.google.com>
+---
+ board/nuvoton/arbel/arbel.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/board/nuvoton/arbel/arbel.c b/board/nuvoton/arbel/arbel.c
+index 3cb8fb9423..ed556137c5 100644
+--- a/board/nuvoton/arbel/arbel.c
++++ b/board/nuvoton/arbel/arbel.c
+@@ -31,6 +31,8 @@ DECLARE_GLOBAL_DATA_PTR;
+ #define PIXCKSEL_MASK GENMASK(5, 4)
+ #define SR_MII_CTRL_SWR_BIT15 15
+
++#define MDLR_GFX BIT(3)
++
+ #define DRAM_512MB_ECC_SIZE 0x1C000000ULL
+ #define DRAM_512MB_SIZE 0x20000000ULL
+ #define DRAM_1GB_ECC_SIZE 0x38000000ULL
+@@ -57,6 +59,18 @@ extern int get_tpm(struct udevice **devp);
+ extern void print_byte_string(u8 *data, size_t count);
+ #endif
+
++static void arbel_wa_disable_gfx(void)
++{
++ struct npcm_gcr *gcr = (struct npcm_gcr *)(uintptr_t)npcm_get_base_gcr();
++ u32 val;
++ val = readl(&gcr->mdlr);
++ if (!(val & MDLR_GFX)) {
++ printf("[WA]Disable GFX support on BMC A2 Sample.\n");
++ val |= MDLR_GFX;
++ writel(val, &gcr->mdlr);
++ }
++}
++
+ static void arbel_eth_init(void)
+ {
+ struct npcm_gcr *gcr = (struct npcm_gcr *)(uintptr_t)npcm_get_base_gcr();
+@@ -119,6 +133,7 @@ int board_init(void)
+
+ arbel_clk_init();
+ arbel_eth_init();
++ arbel_wa_disable_gfx();
+
+ return 0;
+ }
+--
+2.37.3
+
diff --git a/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton_%.bbappend b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton_%.bbappend
index 1396f34..a838bc3 100644
--- a/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton_%.bbappend
+++ b/dynamic-layers/nuvoton-layer/recipes-bsp/u-boot/u-boot-nuvoton_%.bbappend
@@ -1,3 +1,8 @@
FILESEXTRAPATHS:prepend:gbmc:npcm8xx := "${THISDIR}/${PN}:"
-SRC_URI:append:gbmc:npcm8xx = " file://0001-pinctrl-npcm8xx-clear-all-gpio-events.patch"
+SRC_URI:append:gbmc:npcm8xx = " \
+ file://0001-pinctrl-npcm8xx-clear-all-gpio-events.patch \
+ file://0002-set-all-RCRs-TIP_reset.patch \
+ file://0003-Reserve-memory-for-ramoops.patch \
+ file://0004-recipe-uboot-WA-to-disable-GFX-module.patch \
+ "