aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch')
-rw-r--r--target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch45
1 files changed, 18 insertions, 27 deletions
diff --git a/target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch b/target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch
index b890a8d766..437901c943 100644
--- a/target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch
+++ b/target/linux/mediatek/patches-4.14/0166-mtd-nand-mtk-Support-different-MTK-NAND-flash-contro.patch
@@ -30,8 +30,6 @@ Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/mtk_nand.c | 27 ++++++++----
3 files changed, 89 insertions(+), 41 deletions(-)
-diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
-index c51d214d169e..6610eefaa92b 100644
--- a/drivers/mtd/nand/mtk_ecc.c
+++ b/drivers/mtd/nand/mtk_ecc.c
@@ -34,34 +34,28 @@
@@ -72,7 +70,7 @@ index c51d214d169e..6610eefaa92b 100644
int pg_irq_sel;
};
-@@ -89,6 +83,33 @@ static const u8 ecc_strength_mt2712[] = {
+@@ -89,6 +83,33 @@ static const u8 ecc_strength_mt2712[] =
40, 44, 48, 52, 56, 60, 68, 72, 80
};
@@ -106,7 +104,7 @@ index c51d214d169e..6610eefaa92b 100644
static inline void mtk_ecc_wait_idle(struct mtk_ecc *ecc,
enum mtk_ecc_operation op)
{
-@@ -107,32 +128,30 @@ static inline void mtk_ecc_wait_idle(struct mtk_ecc *ecc,
+@@ -107,32 +128,30 @@ static inline void mtk_ecc_wait_idle(str
static irqreturn_t mtk_ecc_irq(int irq, void *id)
{
struct mtk_ecc *ecc = id;
@@ -147,7 +145,7 @@ index c51d214d169e..6610eefaa92b 100644
}
return IRQ_HANDLED;
-@@ -160,7 +179,7 @@ static int mtk_ecc_config(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
+@@ -160,7 +179,7 @@ static int mtk_ecc_config(struct mtk_ecc
/* configure ECC encoder (in bits) */
enc_sz = config->len << 3;
@@ -156,7 +154,7 @@ index c51d214d169e..6610eefaa92b 100644
reg |= (enc_sz << ECC_MS_SHIFT);
writel(reg, ecc->regs + ECC_ENCCNFG);
-@@ -171,9 +190,9 @@ static int mtk_ecc_config(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
+@@ -171,9 +190,9 @@ static int mtk_ecc_config(struct mtk_ecc
} else {
/* configure ECC decoder (in bits) */
dec_sz = (config->len << 3) +
@@ -168,7 +166,7 @@ index c51d214d169e..6610eefaa92b 100644
reg |= (dec_sz << ECC_MS_SHIFT) | DEC_CNFG_CORRECT;
reg |= DEC_EMPTY_EN;
writel(reg, ecc->regs + ECC_DECCNFG);
-@@ -291,7 +310,12 @@ int mtk_ecc_enable(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
+@@ -291,7 +310,12 @@ int mtk_ecc_enable(struct mtk_ecc *ecc,
*/
if (ecc->caps->pg_irq_sel && config->mode == ECC_NFI_MODE)
reg_val |= ECC_PG_IRQ_SEL;
@@ -182,7 +180,7 @@ index c51d214d169e..6610eefaa92b 100644
}
writew(ECC_OP_ENABLE, ecc->regs + ECC_CTL_REG(op));
-@@ -310,13 +334,17 @@ void mtk_ecc_disable(struct mtk_ecc *ecc)
+@@ -310,13 +334,17 @@ void mtk_ecc_disable(struct mtk_ecc *ecc
/* disable it */
mtk_ecc_wait_idle(ecc, op);
@@ -203,7 +201,7 @@ index c51d214d169e..6610eefaa92b 100644
writew(ECC_OP_DISABLE, ecc->regs + ECC_CTL_REG(op));
mutex_unlock(&ecc->lock);
-@@ -367,11 +395,11 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config,
+@@ -367,11 +395,11 @@ int mtk_ecc_encode(struct mtk_ecc *ecc,
mtk_ecc_wait_idle(ecc, ECC_ENCODE);
/* Program ECC bytes to OOB: per sector oob = FDM + ECC + SPARE */
@@ -217,7 +215,7 @@ index c51d214d169e..6610eefaa92b 100644
round_up(len, 4));
/* copy into possibly unaligned OOB region with actual length */
-@@ -404,19 +432,29 @@ void mtk_ecc_adjust_strength(struct mtk_ecc *ecc, u32 *p)
+@@ -404,19 +432,29 @@ void mtk_ecc_adjust_strength(struct mtk_
}
EXPORT_SYMBOL(mtk_ecc_adjust_strength);
@@ -249,7 +247,7 @@ index c51d214d169e..6610eefaa92b 100644
.pg_irq_sel = 1,
};
-@@ -452,7 +490,7 @@ static int mtk_ecc_probe(struct platform_device *pdev)
+@@ -452,7 +490,7 @@ static int mtk_ecc_probe(struct platform
max_eccdata_size = ecc->caps->num_ecc_strength - 1;
max_eccdata_size = ecc->caps->ecc_strength[max_eccdata_size];
@@ -258,8 +256,6 @@ index c51d214d169e..6610eefaa92b 100644
max_eccdata_size = round_up(max_eccdata_size, 4);
ecc->eccdata = devm_kzalloc(dev, max_eccdata_size, GFP_KERNEL);
if (!ecc->eccdata)
-diff --git a/drivers/mtd/nand/mtk_ecc.h b/drivers/mtd/nand/mtk_ecc.h
-index d245c14f1b80..a455df080952 100644
--- a/drivers/mtd/nand/mtk_ecc.h
+++ b/drivers/mtd/nand/mtk_ecc.h
@@ -14,8 +14,6 @@
@@ -271,7 +267,7 @@ index d245c14f1b80..a455df080952 100644
enum mtk_ecc_mode {ECC_DMA_MODE = 0, ECC_NFI_MODE = 1};
enum mtk_ecc_operation {ECC_ENCODE, ECC_DECODE};
-@@ -43,6 +41,7 @@ int mtk_ecc_wait_done(struct mtk_ecc *, enum mtk_ecc_operation);
+@@ -43,6 +41,7 @@ int mtk_ecc_wait_done(struct mtk_ecc *,
int mtk_ecc_enable(struct mtk_ecc *, struct mtk_ecc_config *);
void mtk_ecc_disable(struct mtk_ecc *);
void mtk_ecc_adjust_strength(struct mtk_ecc *ecc, u32 *p);
@@ -279,8 +275,6 @@ index d245c14f1b80..a455df080952 100644
struct mtk_ecc *of_mtk_ecc_get(struct device_node *);
void mtk_ecc_release(struct mtk_ecc *);
-diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
-index 6d0101e13ef6..7349aa846f9a 100644
--- a/drivers/mtd/nand/mtk_nand.c
+++ b/drivers/mtd/nand/mtk_nand.c
@@ -97,7 +97,6 @@
@@ -300,7 +294,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
};
struct mtk_nfc_bad_mark_ctl {
-@@ -450,7 +451,7 @@ static inline u8 mtk_nfc_read_byte(struct mtd_info *mtd)
+@@ -450,7 +451,7 @@ static inline u8 mtk_nfc_read_byte(struc
* set to max sector to allow the HW to continue reading over
* unaligned accesses
*/
@@ -309,7 +303,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
nfi_writel(nfc, reg, NFI_CON);
/* trigger to fetch data */
-@@ -481,7 +482,7 @@ static void mtk_nfc_write_byte(struct mtd_info *mtd, u8 byte)
+@@ -481,7 +482,7 @@ static void mtk_nfc_write_byte(struct mt
reg = nfi_readw(nfc, NFI_CNFG) | CNFG_BYTE_RW;
nfi_writew(nfc, reg, NFI_CNFG);
@@ -318,7 +312,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
nfi_writel(nfc, reg, NFI_CON);
nfi_writew(nfc, STAR_EN, NFI_STRDATA);
-@@ -1126,9 +1127,11 @@ static void mtk_nfc_set_fdm(struct mtk_nfc_fdm *fdm, struct mtd_info *mtd)
+@@ -1126,9 +1127,11 @@ static void mtk_nfc_set_fdm(struct mtk_n
{
struct nand_chip *nand = mtd_to_nand(mtd);
struct mtk_nfc_nand_chip *chip = to_mtk_nand(nand);
@@ -331,7 +325,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
fdm->reg_size = chip->spare_per_sector - ecc_bytes;
if (fdm->reg_size > NFI_FDM_MAX_SIZE)
-@@ -1208,7 +1211,8 @@ static int mtk_nfc_ecc_init(struct device *dev, struct mtd_info *mtd)
+@@ -1208,7 +1211,8 @@ static int mtk_nfc_ecc_init(struct devic
* this controller only supports 512 and 1024 sizes
*/
if (nand->ecc.size < 1024) {
@@ -341,7 +335,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
nand->ecc.size = 1024;
nand->ecc.strength <<= 1;
} else {
-@@ -1223,7 +1227,8 @@ static int mtk_nfc_ecc_init(struct device *dev, struct mtd_info *mtd)
+@@ -1223,7 +1227,8 @@ static int mtk_nfc_ecc_init(struct devic
return ret;
/* calculate oob bytes except ecc parity data */
@@ -351,7 +345,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
free = spare - free;
/*
-@@ -1233,10 +1238,12 @@ static int mtk_nfc_ecc_init(struct device *dev, struct mtd_info *mtd)
+@@ -1233,10 +1238,12 @@ static int mtk_nfc_ecc_init(struct devic
*/
if (free > NFI_FDM_MAX_SIZE) {
spare -= NFI_FDM_MAX_SIZE;
@@ -366,7 +360,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
}
}
-@@ -1389,6 +1396,8 @@ static const struct mtk_nfc_caps mtk_nfc_caps_mt2701 = {
+@@ -1389,6 +1396,8 @@ static const struct mtk_nfc_caps mtk_nfc
.num_spare_size = 16,
.pageformat_spare_shift = 4,
.nfi_clk_div = 1,
@@ -375,7 +369,7 @@ index 6d0101e13ef6..7349aa846f9a 100644
};
static const struct mtk_nfc_caps mtk_nfc_caps_mt2712 = {
-@@ -1396,6 +1405,8 @@ static const struct mtk_nfc_caps mtk_nfc_caps_mt2712 = {
+@@ -1396,6 +1405,8 @@ static const struct mtk_nfc_caps mtk_nfc
.num_spare_size = 19,
.pageformat_spare_shift = 16,
.nfi_clk_div = 2,
@@ -384,6 +378,3 @@ index 6d0101e13ef6..7349aa846f9a 100644
};
static const struct of_device_id mtk_nfc_id_table[] = {
---
-2.11.0
-