1
0
mirror of https://github.com/cjdelisle/openwrt.git synced 2025-08-17 04:43:13 +00:00
Files
openwrt/package/boot/uboot-mediatek/patches/100-29-board-mediatek-wire-up-NMBM-support.patch
Enrico Mioso 2a32d215ba uboot-mediatek: bump to v2025.04
The following upstreamed / superseded patches were dropped:

 060-01-clk-mediatek-mt7629-fix-parent-clock-of-some-top-clo.patch
 060-02-arm-dts-mt7629-fix-sgmii-clock-selection-for-etherne.patch
 060-03-net-mediatek-use-correct-register-field-for-SGMII-sp.patch
 060-04-net-mediatek-correct-register-name-of-ethsys-syscfg1.patch
 060-05-net-mediatek-fix-sgmii-selection-for-mt7622.patch
 060-06-net-mediatek-fix-gmac2-usability-for-mt7629.patch
 060-07-net-mediatek-add-support-for-10GBASE-R.patch
 060-08-net-mediatek-make-sgmii-usxgmii-optional.patch
 060-09-net-mediatek-don-t-enable-GDMA-cpu-bridge-unconditio.patch
 060-10-net-mediatek-fix-usability-with-wget-command.patch
 061-01-net-mediatek-split-ethernet-switch-code-from-mtk_eth.patch
 061-02-net-mediatek-add-support-for-MediaTek-MT7987-SoC.patch
 061-03-net-mediatek-add-support-for-Airoha-AN8855-ethernet-.patch
 070-01-board-mediatek-mt7622-remove-board_late_init.patch
 070-02-clk-mediatek-fix-uninitialized-fields-issue-in-INFRA.patch
 070-03-configs-mt7629-move-image-load-address-to-0x42000000.patch
 070-04-configs-mt7988-move-image-load-address-to-0x44000000.patch
 070-05-spi-mtk_spim-add-support-to-use-DT-live-tree.patch
 070-06-spi-mtk_spim-check-slave-device-mode-in-spi-mem-s-su.patch
 070-07-arm-dts-mediatek-add-quad-mode-capabilities-for-SPI-.patch
 070-08-pwm-mediatek-add-pwm3-support-for-mt7981.patch
 070-09-pci-mediatek-add-support-for-multiple-ports-in-media.patch
 070-10-arm-dts-mediatek-add-pcie-support-for-mt7988.patch
 070-11-arm-dts-medaitek-fix-internal-switch-link-speed-of-m.patch
 070-12-arm-dts-mediatek-add-support-for-all-three-GMACs-for.patch
 070-13-arm-dts-medaitek-add-flash-interface-driving-setting.patch
 070-14-arm-dts-mediatek-update-mt7981-mmc-node.patch
 070-15-MAINTAINERS-update-file-list-for-MediaTek-ARM-platfo.patch
 071-01-pinctrl-mediatek-update-mt7981-pinctrl-driver-based-.patch
 100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch
 290-mt7981-add-USB-nodes.patch

Refreshed all the patches needing it.

Run-tested: GatoNetworks GDSP, Arcadyan Mozart (ynezz),
            Zbt WG3526 (dangowrt)

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [patch refresh, Mozart testing]
Signed-off-by: Daniel Golle <daniel@makrotopia.org> [rebased, tested on MT7621]
2025-05-31 21:16:41 +02:00

236 lines
4.5 KiB
Diff

From 6792b57b3ba61ca6d69ea4a13a58bed65fc5da87 Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Sun, 7 Aug 2022 04:04:46 +0200
Subject: [PATCH] board: mediatek: wire-up NMBM support
---
board/mediatek/mt7622/mt7622_rfb.c | 38 +++++++++++++++++++++
board/mediatek/mt7629/mt7629_rfb.c | 38 +++++++++++++++++++++
board/mediatek/mt7981/mt7981_rfb.c | 52 ++++++++++++++++++++++++++++
board/mediatek/mt7986/mt7986_rfb.c | 54 ++++++++++++++++++++++++++++++
4 files changed, 182 insertions(+)
--- a/board/mediatek/mt7622/mt7622_rfb.c
+++ b/board/mediatek/mt7622/mt7622_rfb.c
@@ -9,9 +9,47 @@
#include <init.h>
#include <asm/global_data.h>
+#include <mtd.h>
+#include <linux/mtd/mtd.h>
+#include <nmbm/nmbm.h>
+#include <nmbm/nmbm-mtd.h>
+
DECLARE_GLOBAL_DATA_PTR;
int board_init(void)
{
return 0;
}
+
+int board_nmbm_init(void)
+{
+#ifdef CONFIG_ENABLE_NAND_NMBM
+ struct mtd_info *lower, *upper;
+ int ret;
+
+ printf("\n");
+ printf("Initializing NMBM ...\n");
+
+ mtd_probe_devices();
+
+ lower = get_mtd_device_nm("spi-nand0");
+ if (IS_ERR(lower) || !lower) {
+ printf("Lower MTD device 'spi-nand0' not found\n");
+ return 0;
+ }
+
+ ret = nmbm_attach_mtd(lower,
+ NMBM_F_CREATE | NMBM_F_EMPTY_PAGE_ECC_OK,
+ CONFIG_NMBM_MAX_RATIO,
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
+
+ printf("\n");
+
+ if (ret)
+ return 0;
+
+ add_mtd_device(upper);
+#endif
+
+ return 0;
+}
--- a/board/mediatek/mt7629/mt7629_rfb.c
+++ b/board/mediatek/mt7629/mt7629_rfb.c
@@ -6,6 +6,11 @@
#include <config.h>
#include <asm/global_data.h>
+#include <mtd.h>
+#include <linux/mtd/mtd.h>
+#include <nmbm/nmbm.h>
+#include <nmbm/nmbm-mtd.h>
+
DECLARE_GLOBAL_DATA_PTR;
int board_init(void)
@@ -15,3 +20,36 @@ int board_init(void)
return 0;
}
+
+int board_nmbm_init(void)
+{
+#ifdef CONFIG_ENABLE_NAND_NMBM
+ struct mtd_info *lower, *upper;
+ int ret;
+
+ printf("\n");
+ printf("Initializing NMBM ...\n");
+
+ mtd_probe_devices();
+
+ lower = get_mtd_device_nm("spi-nand0");
+ if (IS_ERR(lower) || !lower) {
+ printf("Lower MTD device 'spi-nand0' not found\n");
+ return 0;
+ }
+
+ ret = nmbm_attach_mtd(lower,
+ NMBM_F_CREATE | NMBM_F_EMPTY_PAGE_ECC_OK,
+ CONFIG_NMBM_MAX_RATIO,
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
+
+ printf("\n");
+
+ if (ret)
+ return 0;
+
+ add_mtd_device(upper);
+#endif
+
+ return 0;
+}
--- a/board/mediatek/mt7981/mt7981_rfb.c
+++ b/board/mediatek/mt7981/mt7981_rfb.c
@@ -4,7 +4,57 @@
* Author: Sam Shih <sam.shih@mediatek.com>
*/
+#include <config.h>
+#include <env.h>
+#include <init.h>
+#include <asm/global_data.h>
+
+#include <mtd.h>
+#include <linux/mtd/mtd.h>
+#include <nmbm/nmbm.h>
+#include <nmbm/nmbm-mtd.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
int board_init(void)
{
return 0;
}
+
+int board_late_init(void)
+{
+ gd->env_valid = 1; //to load environment variable from persistent store
+ env_relocate();
+ return 0;
+}
+
+int board_nmbm_init(void)
+{
+#ifdef CONFIG_ENABLE_NAND_NMBM
+ struct mtd_info *lower, *upper;
+ int ret;
+
+ printf("\n");
+ printf("Initializing NMBM ...\n");
+
+ mtd_probe_devices();
+
+ lower = get_mtd_device_nm("spi-nand0");
+ if (IS_ERR(lower) || !lower) {
+ printf("Lower MTD device 'spi-nand0' not found\n");
+ return 0;
+ }
+
+ ret = nmbm_attach_mtd(lower, NMBM_F_CREATE, CONFIG_NMBM_MAX_RATIO,
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
+
+ printf("\n");
+
+ if (ret)
+ return 0;
+
+ add_mtd_device(upper);
+#endif
+
+ return 0;
+}
--- a/board/mediatek/mt7986/mt7986_rfb.c
+++ b/board/mediatek/mt7986/mt7986_rfb.c
@@ -4,7 +4,59 @@
* Author: Sam Shih <sam.shih@mediatek.com>
*/
+#include <config.h>
+#include <env.h>
+#include <init.h>
+#include <asm/global_data.h>
+
+#include <mtd.h>
+#include <linux/mtd/mtd.h>
+#include <nmbm/nmbm.h>
+#include <nmbm/nmbm-mtd.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
int board_init(void)
{
return 0;
}
+
+int board_late_init(void)
+{
+ gd->env_valid = 1; //to load environment variable from persistent store
+ env_relocate();
+ return 0;
+}
+
+int board_nmbm_init(void)
+{
+#ifdef CONFIG_ENABLE_NAND_NMBM
+ struct mtd_info *lower, *upper;
+ int ret;
+
+ printf("\n");
+ printf("Initializing NMBM ...\n");
+
+ mtd_probe_devices();
+
+ lower = get_mtd_device_nm("spi-nand0");
+ if (IS_ERR(lower) || !lower) {
+ printf("Lower MTD device 'spi-nand0' not found\n");
+ return 0;
+ }
+
+ ret = nmbm_attach_mtd(lower,
+ NMBM_F_CREATE | NMBM_F_EMPTY_PAGE_ECC_OK,
+ CONFIG_NMBM_MAX_RATIO,
+ CONFIG_NMBM_MAX_BLOCKS, &upper);
+
+ printf("\n");
+
+ if (ret)
+ return 0;
+
+ add_mtd_device(upper);
+#endif
+
+ return 0;
+}