# CONFIG_CRC32_SARWATE is not set
CONFIG_CRC32_SLICEBY8=y
CONFIG_CROSS_MEMORY_ATTACH=y
+CONFIG_CRYPTO_DEFLATE=y
+CONFIG_CRYPTO_LZO=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_WORKQUEUE=y
+CONFIG_CRYPTO_XZ=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_GPIO=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_HAVE_IDE=y
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZ4=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_MEMBLOCK=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_HAVE_NET_DSA=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_MTK=y
CONFIG_MTD_SPI_NOR=y
+CONFIG_MTD_UBI=y
+CONFIG_MTD_UBI_BEB_LIMIT=20
+CONFIG_MTD_UBI_BLOCK=y
+# CONFIG_MTD_UBI_FASTMAP is not set
+# CONFIG_MTD_UBI_GLUEBI is not set
+CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTK_INFRACFG=y
CONFIG_MTK_PMIC_WRAP=y
CONFIG_MTK_SCPSYS=y
CONFIG_NEED_DMA_MAP_STATE=y
# CONFIG_NEON is not set
CONFIG_NET_FLOW_LIMIT=y
-CONFIG_NET_INGRESS=y
CONFIG_NET_MEDIATEK_SOC=y
# CONFIG_NET_VENDOR_AURORA is not set
CONFIG_NET_VENDOR_MEDIATEK=y
# CONFIG_THUMB2_KERNEL is not set
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_TIMER_STATS=y
+CONFIG_UBIFS_FS=y
+# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
+CONFIG_UBIFS_FS_LZO=y
+CONFIG_UBIFS_FS_XZ=y
+CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_USB=y
CONFIG_USB_COMMON=y
+# CONFIG_USB_EHCI_HCD is not set
CONFIG_USB_SUPPORT=y
# CONFIG_USB_UHCI_HCD is not set
CONFIG_USB_XHCI_HCD=y
CONFIG_XZ_DEC_BCJ=y
CONFIG_ZBOOT_ROM_BSS=0
CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=y
CONFIG_ZONE_DMA_FLAG=0
drivers/mtd/tests/mtd_nandecctest.c | 2 +-
drivers/mtd/tests/oobtest.c | 49 ++-
drivers/mtd/tests/pagetest.c | 3 +-
- drivers/mtd/ubi/cdev.c | 4 +-
- drivers/mtd/ubi/misc.c | 49 +++
- drivers/mtd/ubi/ubi.h | 16 +-
- drivers/mtd/ubi/upd.c | 2 +-
- drivers/mtd/ubi/wl.c | 21 +-
include/linux/mtd/bbm.h | 1 -
include/linux/mtd/fsmc.h | 18 --
include/linux/mtd/inftl.h | 1 -
addr0 = 0;
for (i = 0; i < ebcnt && bbt[i]; ++i)
---- a/drivers/mtd/ubi/cdev.c
-+++ b/drivers/mtd/ubi/cdev.c
-@@ -174,9 +174,9 @@ static int vol_cdev_fsync(struct file *f
- struct ubi_device *ubi = desc->vol->ubi;
- struct inode *inode = file_inode(file);
- int err;
-- mutex_lock(&inode->i_mutex);
-+ inode_lock(inode);
- err = ubi_sync(ubi->ubi_num);
-- mutex_unlock(&inode->i_mutex);
-+ inode_unlock(inode);
- return err;
- }
-
---- a/drivers/mtd/ubi/misc.c
-+++ b/drivers/mtd/ubi/misc.c
-@@ -153,3 +153,52 @@ int ubi_check_pattern(const void *buf, u
- return 0;
- return 1;
- }
-+
-+/* Normal UBI messages */
-+void ubi_msg(const struct ubi_device *ubi, const char *fmt, ...)
-+{
-+ struct va_format vaf;
-+ va_list args;
-+
-+ va_start(args, fmt);
-+
-+ vaf.fmt = fmt;
-+ vaf.va = &args;
-+
-+ pr_notice(UBI_NAME_STR "%d: %pV\n", ubi->ubi_num, &vaf);
-+
-+ va_end(args);
-+}
-+
-+/* UBI warning messages */
-+void ubi_warn(const struct ubi_device *ubi, const char *fmt, ...)
-+{
-+ struct va_format vaf;
-+ va_list args;
-+
-+ va_start(args, fmt);
-+
-+ vaf.fmt = fmt;
-+ vaf.va = &args;
-+
-+ pr_warn(UBI_NAME_STR "%d warning: %ps: %pV\n",
-+ ubi->ubi_num, __builtin_return_address(0), &vaf);
-+
-+ va_end(args);
-+}
-+
-+/* UBI error messages */
-+void ubi_err(const struct ubi_device *ubi, const char *fmt, ...)
-+{
-+ struct va_format vaf;
-+ va_list args;
-+
-+ va_start(args, fmt);
-+
-+ vaf.fmt = fmt;
-+ vaf.va = &args;
-+
-+ pr_err(UBI_NAME_STR "%d error: %ps: %pV\n",
-+ ubi->ubi_num, __builtin_return_address(0), &vaf);
-+ va_end(args);
-+}
---- a/drivers/mtd/ubi/ubi.h
-+++ b/drivers/mtd/ubi/ubi.h
-@@ -49,15 +49,19 @@
- /* UBI name used for character devices, sysfs, etc */
- #define UBI_NAME_STR "ubi"
-
-+struct ubi_device;
-+
- /* Normal UBI messages */
--#define ubi_msg(ubi, fmt, ...) pr_notice(UBI_NAME_STR "%d: " fmt "\n", \
-- ubi->ubi_num, ##__VA_ARGS__)
-+__printf(2, 3)
-+void ubi_msg(const struct ubi_device *ubi, const char *fmt, ...);
-+
- /* UBI warning messages */
--#define ubi_warn(ubi, fmt, ...) pr_warn(UBI_NAME_STR "%d warning: %s: " fmt "\n", \
-- ubi->ubi_num, __func__, ##__VA_ARGS__)
-+__printf(2, 3)
-+void ubi_warn(const struct ubi_device *ubi, const char *fmt, ...);
-+
- /* UBI error messages */
--#define ubi_err(ubi, fmt, ...) pr_err(UBI_NAME_STR "%d error: %s: " fmt "\n", \
-- ubi->ubi_num, __func__, ##__VA_ARGS__)
-+__printf(2, 3)
-+void ubi_err(const struct ubi_device *ubi, const char *fmt, ...);
-
- /* Background thread name pattern */
- #define UBI_BGT_NAME_PATTERN "ubi_bgt%dd"
---- a/drivers/mtd/ubi/wl.c
-+++ b/drivers/mtd/ubi/wl.c
-@@ -628,6 +628,7 @@ static int do_sync_erase(struct ubi_devi
- return __erase_worker(ubi, &wl_wrk);
- }
-
-+static int ensure_wear_leveling(struct ubi_device *ubi, int nested);
- /**
- * wear_leveling_worker - wear-leveling worker function.
- * @ubi: UBI device description object
-@@ -649,6 +650,7 @@ static int wear_leveling_worker(struct u
- #endif
- struct ubi_wl_entry *e1, *e2;
- struct ubi_vid_hdr *vid_hdr;
-+ int dst_leb_clean = 0;
-
- kfree(wrk);
- if (shutdown)
-@@ -753,6 +755,7 @@ static int wear_leveling_worker(struct u
-
- err = ubi_io_read_vid_hdr(ubi, e1->pnum, vid_hdr, 0);
- if (err && err != UBI_IO_BITFLIPS) {
-+ dst_leb_clean = 1;
- if (err == UBI_IO_FF) {
- /*
- * We are trying to move PEB without a VID header. UBI
-@@ -798,10 +801,12 @@ static int wear_leveling_worker(struct u
- * protection queue.
- */
- protect = 1;
-+ dst_leb_clean = 1;
- goto out_not_moved;
- }
- if (err == MOVE_RETRY) {
- scrubbing = 1;
-+ dst_leb_clean = 1;
- goto out_not_moved;
- }
- if (err == MOVE_TARGET_BITFLIPS || err == MOVE_TARGET_WR_ERR ||
-@@ -827,6 +832,7 @@ static int wear_leveling_worker(struct u
- ubi->erroneous_peb_count);
- goto out_error;
- }
-+ dst_leb_clean = 1;
- erroneous = 1;
- goto out_not_moved;
- }
-@@ -897,15 +903,24 @@ out_not_moved:
- wl_tree_add(e1, &ubi->scrub);
- else
- wl_tree_add(e1, &ubi->used);
-+ if (dst_leb_clean) {
-+ wl_tree_add(e2, &ubi->free);
-+ ubi->free_count++;
-+ }
-+
- ubi_assert(!ubi->move_to_put);
- ubi->move_from = ubi->move_to = NULL;
- ubi->wl_scheduled = 0;
- spin_unlock(&ubi->wl_lock);
-
- ubi_free_vid_hdr(ubi, vid_hdr);
-- err = do_sync_erase(ubi, e2, vol_id, lnum, torture);
-- if (err)
-- goto out_ro;
-+ if (dst_leb_clean) {
-+ ensure_wear_leveling(ubi, 1);
-+ } else {
-+ err = do_sync_erase(ubi, e2, vol_id, lnum, torture);
-+ if (err)
-+ goto out_ro;
-+ }
-
- mutex_unlock(&ubi->move_mutex);
- return 0;
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -166,7 +166,6 @@ struct bbm_info {