aboutsummaryrefslogtreecommitdiff
path: root/package/boot/uboot-mediatek/patches/100-03-mtd-add-a-new-mtd-device-type-for-NMBM.patch
blob: 9512adb71d2b1e4f2b78111c51a462bccb568e36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 6571329dbac9f2278b6a5d36999982220b17daf4 Mon Sep 17 00:00:00 2001
From: Weijie Gao <weijie.gao@mediatek.com>
Date: Mon, 25 Jul 2022 10:58:06 +0800
Subject: [PATCH 03/30] mtd: add a new mtd device type for NMBM

This patch adds a new mtd device type for NMBM so that mtdparts can be
correctly probed. And this also gives us an opportunity to add NMBM support
for filesystems in the future.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
 cmd/mtdparts.c              | 3 +++
 include/jffs2/load_kernel.h | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -1054,6 +1054,9 @@ int mtd_id_parse(const char *id, const c
 	} else if (strncmp(p, "spi-nand", 8) == 0) {
 		*dev_type = MTD_DEV_TYPE_SPINAND;
 		p += 8;
+	} else if (strncmp(p, "nmbm", 4) == 0) {
+		*dev_type = MTD_DEV_TYPE_NMBM;
+		p += 4;
 	} else {
 		printf("incorrect device type in %s\n", id);
 		return 1;
--- a/include/jffs2/load_kernel.h
+++ b/include/jffs2/load_kernel.h
@@ -17,11 +17,13 @@
 #define MTD_DEV_TYPE_NAND	0x0002
 #define MTD_DEV_TYPE_ONENAND	0x0004
 #define MTD_DEV_TYPE_SPINAND	0x0008
+#define MTD_DEV_TYPE_NMBM	0x0010
 
 #define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" :	\
 			    (type == MTD_DEV_TYPE_NOR ? "nor" :		\
 			     (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
-			      "spi-nand")))				\
+			      (type == MTD_DEV_TYPE_SPINAND ? "spi-nand" : \
+			       "nmbm"))))				\
 
 struct mtd_device {
 	struct list_head link;