forked from Openwrt-EcoNet/openwrt
EcoNet EN75xx is a big endian MIPS platform used in XPON (fiber), DSL, and SIM (3g/4g) applications. Complete GPL vender SDKs exist for this platform, but are based on Linux 2.6. The bulk of this submission has already been accepted upstream: https://patchwork.kernel.org/project/linux-mips/list/?series=960479&state=* This platform uses a bootloader that is derived from old TrendChip code. This bootloader implements a frustratingly complex Bad Block Table which is implemented here in en75_bmt.c This BMT is not upstreamed because it depends on mtk_bmt framework which likewise is not upstreamed. This BMT system rewrites block indexes in flash and if the bootloader considers it to be corrupted, it will attempt to automatically rebuild on boot. So without implementing the algorithm, you can't safely use the disk at all. Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
33 lines
1.2 KiB
Diff
33 lines
1.2 KiB
Diff
--- a/drivers/mtd/nand/Makefile
|
|
+++ b/drivers/mtd/nand/Makefile
|
|
@@ -3,7 +3,7 @@
|
|
nandcore-objs := core.o bbt.o
|
|
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
|
|
obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
|
|
-obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o mtk_bmt_v2.o mtk_bmt_bbt.o mtk_bmt_nmbm.o
|
|
+obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o mtk_bmt_v2.o mtk_bmt_bbt.o mtk_bmt_nmbm.o en75_bmt.o
|
|
ifeq ($(CONFIG_SPI_QPIC_SNAND),y)
|
|
obj-$(CONFIG_SPI_QPIC_SNAND) += qpic_common.o
|
|
else
|
|
--- a/drivers/mtd/nand/mtk_bmt.h
|
|
+++ b/drivers/mtd/nand/mtk_bmt.h
|
|
@@ -77,6 +77,7 @@ extern struct bmt_desc bmtd;
|
|
extern const struct mtk_bmt_ops mtk_bmt_v2_ops;
|
|
extern const struct mtk_bmt_ops mtk_bmt_bbt_ops;
|
|
extern const struct mtk_bmt_ops mtk_bmt_nmbm_ops;
|
|
+extern const struct mtk_bmt_ops en75_bmt_ops;
|
|
|
|
static inline u32 blk_pg(u16 block)
|
|
{
|
|
--- a/drivers/mtd/nand/mtk_bmt.c
|
|
+++ b/drivers/mtd/nand/mtk_bmt.c
|
|
@@ -422,6 +422,8 @@ int mtk_bmt_attach(struct mtd_info *mtd)
|
|
bmtd.ops = &mtk_bmt_nmbm_ops;
|
|
else if (of_property_read_bool(np, "mediatek,bbt"))
|
|
bmtd.ops = &mtk_bmt_bbt_ops;
|
|
+ else if (of_property_read_bool(np, "econet,bmt"))
|
|
+ bmtd.ops = &en75_bmt_ops;
|
|
else
|
|
return 0;
|
|
|