From: Daniel Golle Date: Sun, 10 Mar 2024 13:49:45 +0000 (+0000) Subject: uboot-mediatek: fix typo patch filename X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5f230cd0b1f141def141da1f70440a7428b5af55;p=openwrt%2Fstaging%2Fthess.git uboot-mediatek: fix typo patch filename 311-mt7986-select-roodisk.patch -> 311-mt7986-select-rootdisk.patch Signed-off-by: Daniel Golle --- diff --git a/package/boot/uboot-mediatek/patches/311-mt7986-select-roodisk.patch b/package/boot/uboot-mediatek/patches/311-mt7986-select-roodisk.patch deleted file mode 100644 index 3312162765..0000000000 --- a/package/boot/uboot-mediatek/patches/311-mt7986-select-roodisk.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- a/board/mediatek/mt7986/mt7986_rfb.c -+++ b/board/mediatek/mt7986/mt7986_rfb.c -@@ -11,7 +11,9 @@ - #include - #include - #include -+#include - #include -+#include - - #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; -+} diff --git a/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch b/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch new file mode 100644 index 0000000000..3312162765 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch @@ -0,0 +1,67 @@ +--- a/board/mediatek/mt7986/mt7986_rfb.c ++++ b/board/mediatek/mt7986/mt7986_rfb.c +@@ -11,7 +11,9 @@ + #include + #include + #include ++#include + #include ++#include + + #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; ++}