mediatek: remove spi-nand hacks from 5.10
we now have a standalone mtd driver and the old spi-mem driver along with the hack in spi-nand core can be removed. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
This commit is contained in:
parent
e8e8487603
commit
c6ed31630d
@ -1,139 +0,0 @@
|
|||||||
From a2479dc254ebe31c84fbcfda73f35e2321576494 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
|
||||||
Date: Tue, 19 Mar 2019 13:57:38 +0800
|
|
||||||
Subject: [PATCH 1/6] mtd: mtk ecc: move mtk ecc header file to include/mtd
|
|
||||||
|
|
||||||
Change-Id: I8dc1d30e21b40d68ef5efd9587012f82970156a5
|
|
||||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
|
||||||
---
|
|
||||||
drivers/mtd/nand/raw/mtk_ecc.c | 3 +--
|
|
||||||
drivers/mtd/nand/raw/mtk_nand.c | 2 +-
|
|
||||||
{drivers/mtd/nand/raw => include/linux/mtd}/mtk_ecc.h | 0
|
|
||||||
3 files changed, 2 insertions(+), 3 deletions(-)
|
|
||||||
rename {drivers/mtd/nand/raw => include/linux/mtd}/mtk_ecc.h (100%)
|
|
||||||
|
|
||||||
--- a/drivers/mtd/nand/raw/mtk_ecc.c
|
|
||||||
+++ b/drivers/mtd/nand/raw/mtk_ecc.c
|
|
||||||
@@ -15,8 +15,7 @@
|
|
||||||
#include <linux/of.h>
|
|
||||||
#include <linux/of_platform.h>
|
|
||||||
#include <linux/mutex.h>
|
|
||||||
-
|
|
||||||
-#include "mtk_ecc.h"
|
|
||||||
+#include <linux/mtd/mtk_ecc.h>
|
|
||||||
|
|
||||||
#define ECC_IDLE_MASK BIT(0)
|
|
||||||
#define ECC_IRQ_EN BIT(0)
|
|
||||||
--- a/drivers/mtd/nand/raw/mtk_nand.c
|
|
||||||
+++ b/drivers/mtd/nand/raw/mtk_nand.c
|
|
||||||
@@ -17,7 +17,7 @@
|
|
||||||
#include <linux/iopoll.h>
|
|
||||||
#include <linux/of.h>
|
|
||||||
#include <linux/of_device.h>
|
|
||||||
-#include "mtk_ecc.h"
|
|
||||||
+#include <linux/mtd/mtk_ecc.h>
|
|
||||||
|
|
||||||
/* NAND controller register definition */
|
|
||||||
#define NFI_CNFG (0x00)
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/include/linux/mtd/mtk_ecc.h
|
|
||||||
@@ -0,0 +1,49 @@
|
|
||||||
+/*
|
|
||||||
+ * MTK SDG1 ECC controller
|
|
||||||
+ *
|
|
||||||
+ * Copyright (c) 2016 Mediatek
|
|
||||||
+ * Authors: Xiaolei Li <xiaolei.li@mediatek.com>
|
|
||||||
+ * Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify it
|
|
||||||
+ * under the terms of the GNU General Public License version 2 as published
|
|
||||||
+ * by the Free Software Foundation.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#ifndef __DRIVERS_MTD_NAND_MTK_ECC_H__
|
|
||||||
+#define __DRIVERS_MTD_NAND_MTK_ECC_H__
|
|
||||||
+
|
|
||||||
+#include <linux/types.h>
|
|
||||||
+
|
|
||||||
+enum mtk_ecc_mode {ECC_DMA_MODE = 0, ECC_NFI_MODE = 1};
|
|
||||||
+enum mtk_ecc_operation {ECC_ENCODE, ECC_DECODE};
|
|
||||||
+
|
|
||||||
+struct device_node;
|
|
||||||
+struct mtk_ecc;
|
|
||||||
+
|
|
||||||
+struct mtk_ecc_stats {
|
|
||||||
+ u32 corrected;
|
|
||||||
+ u32 bitflips;
|
|
||||||
+ u32 failed;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+struct mtk_ecc_config {
|
|
||||||
+ enum mtk_ecc_operation op;
|
|
||||||
+ enum mtk_ecc_mode mode;
|
|
||||||
+ dma_addr_t addr;
|
|
||||||
+ u32 strength;
|
|
||||||
+ u32 sectors;
|
|
||||||
+ u32 len;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+int mtk_ecc_encode(struct mtk_ecc *, struct mtk_ecc_config *, u8 *, u32);
|
|
||||||
+void mtk_ecc_get_stats(struct mtk_ecc *, struct mtk_ecc_stats *, int);
|
|
||||||
+int mtk_ecc_wait_done(struct mtk_ecc *, enum mtk_ecc_operation);
|
|
||||||
+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);
|
|
||||||
+unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc);
|
|
||||||
+
|
|
||||||
+struct mtk_ecc *of_mtk_ecc_get(struct device_node *);
|
|
||||||
+void mtk_ecc_release(struct mtk_ecc *);
|
|
||||||
+
|
|
||||||
+#endif
|
|
||||||
--- a/drivers/mtd/nand/raw/mtk_ecc.h
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,47 +0,0 @@
|
|
||||||
-/* SPDX-License-Identifier: GPL-2.0 OR MIT */
|
|
||||||
-/*
|
|
||||||
- * MTK SDG1 ECC controller
|
|
||||||
- *
|
|
||||||
- * Copyright (c) 2016 Mediatek
|
|
||||||
- * Authors: Xiaolei Li <xiaolei.li@mediatek.com>
|
|
||||||
- * Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
|
|
||||||
- */
|
|
||||||
-
|
|
||||||
-#ifndef __DRIVERS_MTD_NAND_MTK_ECC_H__
|
|
||||||
-#define __DRIVERS_MTD_NAND_MTK_ECC_H__
|
|
||||||
-
|
|
||||||
-#include <linux/types.h>
|
|
||||||
-
|
|
||||||
-enum mtk_ecc_mode {ECC_DMA_MODE = 0, ECC_NFI_MODE = 1};
|
|
||||||
-enum mtk_ecc_operation {ECC_ENCODE, ECC_DECODE};
|
|
||||||
-
|
|
||||||
-struct device_node;
|
|
||||||
-struct mtk_ecc;
|
|
||||||
-
|
|
||||||
-struct mtk_ecc_stats {
|
|
||||||
- u32 corrected;
|
|
||||||
- u32 bitflips;
|
|
||||||
- u32 failed;
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-struct mtk_ecc_config {
|
|
||||||
- enum mtk_ecc_operation op;
|
|
||||||
- enum mtk_ecc_mode mode;
|
|
||||||
- dma_addr_t addr;
|
|
||||||
- u32 strength;
|
|
||||||
- u32 sectors;
|
|
||||||
- u32 len;
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-int mtk_ecc_encode(struct mtk_ecc *, struct mtk_ecc_config *, u8 *, u32);
|
|
||||||
-void mtk_ecc_get_stats(struct mtk_ecc *, struct mtk_ecc_stats *, int);
|
|
||||||
-int mtk_ecc_wait_done(struct mtk_ecc *, enum mtk_ecc_operation);
|
|
||||||
-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);
|
|
||||||
-unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc);
|
|
||||||
-
|
|
||||||
-struct mtk_ecc *of_mtk_ecc_get(struct device_node *);
|
|
||||||
-void mtk_ecc_release(struct mtk_ecc *);
|
|
||||||
-
|
|
||||||
-#endif
|
|
@ -1,31 +0,0 @@
|
|||||||
From b341f120cfc9ca1dfd48364b7f36ac2c1fbdea43 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
|
||||||
Date: Wed, 3 Apr 2019 16:30:01 +0800
|
|
||||||
Subject: [PATCH 3/6] mtd: spinand: disable on-die ECC
|
|
||||||
|
|
||||||
Change-Id: I9745adaed5295202fabbe8ab8947885c57a5b847
|
|
||||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
|
||||||
---
|
|
||||||
drivers/mtd/nand/spi/core.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
--- a/drivers/mtd/nand/spi/core.c
|
|
||||||
+++ b/drivers/mtd/nand/spi/core.c
|
|
||||||
@@ -493,7 +493,7 @@ static int spinand_mtd_read(struct mtd_i
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (ops->mode != MTD_OPS_RAW && spinand->eccinfo.ooblayout)
|
|
||||||
- enable_ecc = true;
|
|
||||||
+ enable_ecc = false;
|
|
||||||
|
|
||||||
mutex_lock(&spinand->lock);
|
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ static int spinand_mtd_write(struct mtd_
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (ops->mode != MTD_OPS_RAW && mtd->ooblayout)
|
|
||||||
- enable_ecc = true;
|
|
||||||
+ enable_ecc = false;
|
|
||||||
|
|
||||||
mutex_lock(&spinand->lock);
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,122 +0,0 @@
|
|||||||
From ea0df4552efcdcc2806fe6eba0540b5f719d80b6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Davide Fioravanti <pantanastyle@gmail.com>
|
|
||||||
Date: Fri, 8 Jan 2021 15:35:24 +0100
|
|
||||||
Subject: [PATCH 1/1] mtd: spinand: Add support for the Fidelix FM35X1GA
|
|
||||||
|
|
||||||
Datasheet: http://www.hobos.com.cn/upload/datasheet/DS35X1GAXXX_100_rev00.pdf
|
|
||||||
|
|
||||||
Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
|
|
||||||
---
|
|
||||||
drivers/mtd/nand/spi/Makefile | 2 +-
|
|
||||||
drivers/mtd/nand/spi/core.c | 1 +
|
|
||||||
drivers/mtd/nand/spi/fidelix.c | 80 ++++++++++++++++++++++++++++++++++
|
|
||||||
include/linux/mtd/spinand.h | 1 +
|
|
||||||
4 files changed, 83 insertions(+), 1 deletion(-)
|
|
||||||
create mode 100644 drivers/mtd/nand/spi/fidelix.c
|
|
||||||
|
|
||||||
--- a/drivers/mtd/nand/spi/Makefile
|
|
||||||
+++ b/drivers/mtd/nand/spi/Makefile
|
|
||||||
@@ -1,3 +1,3 @@
|
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
|
||||||
-spinand-objs := core.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o xtx.o
|
|
||||||
+spinand-objs := core.o fidelix.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o xtx.o
|
|
||||||
obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
|
|
||||||
--- a/drivers/mtd/nand/spi/core.c
|
|
||||||
+++ b/drivers/mtd/nand/spi/core.c
|
|
||||||
@@ -755,6 +755,7 @@ static const struct nand_ops spinand_ops
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct spinand_manufacturer *spinand_manufacturers[] = {
|
|
||||||
+ &fidelix_spinand_manufacturer,
|
|
||||||
&gigadevice_spinand_manufacturer,
|
|
||||||
¯onix_spinand_manufacturer,
|
|
||||||
µn_spinand_manufacturer,
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/drivers/mtd/nand/spi/fidelix.c
|
|
||||||
@@ -0,0 +1,76 @@
|
|
||||||
+// SPDX-License-Identifier: GPL-2.0
|
|
||||||
+/*
|
|
||||||
+ * Copyright (c) 2020 Davide Fioravanti <pantanastyle@gmail.com>
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <linux/device.h>
|
|
||||||
+#include <linux/kernel.h>
|
|
||||||
+#include <linux/mtd/spinand.h>
|
|
||||||
+
|
|
||||||
+#define SPINAND_MFR_FIDELIX 0xE5
|
|
||||||
+#define FIDELIX_ECCSR_MASK 0x0F
|
|
||||||
+
|
|
||||||
+static SPINAND_OP_VARIANTS(read_cache_variants,
|
|
||||||
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
|
|
||||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
|
|
||||||
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
|
|
||||||
+
|
|
||||||
+static SPINAND_OP_VARIANTS(write_cache_variants,
|
|
||||||
+ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
|
|
||||||
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
|
|
||||||
+
|
|
||||||
+static SPINAND_OP_VARIANTS(update_cache_variants,
|
|
||||||
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
|
|
||||||
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
|
|
||||||
+
|
|
||||||
+static int fm35x1ga_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
||||||
+ struct mtd_oob_region *region)
|
|
||||||
+{
|
|
||||||
+ if (section > 3)
|
|
||||||
+ return -ERANGE;
|
|
||||||
+
|
|
||||||
+ region->offset = (16 * section) + 8;
|
|
||||||
+ region->length = 8;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int fm35x1ga_ooblayout_free(struct mtd_info *mtd, int section,
|
|
||||||
+ struct mtd_oob_region *region)
|
|
||||||
+{
|
|
||||||
+ if (section > 3)
|
|
||||||
+ return -ERANGE;
|
|
||||||
+
|
|
||||||
+ region->offset = (16 * section) + 2;
|
|
||||||
+ region->length = 6;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static const struct mtd_ooblayout_ops fm35x1ga_ooblayout = {
|
|
||||||
+ .ecc = fm35x1ga_ooblayout_ecc,
|
|
||||||
+ .free = fm35x1ga_ooblayout_free,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct spinand_info fidelix_spinand_table[] = {
|
|
||||||
+ SPINAND_INFO("FM35X1GA",
|
|
||||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x71),
|
|
||||||
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
|
|
||||||
+ NAND_ECCREQ(4, 512),
|
|
||||||
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
|
||||||
+ &write_cache_variants,
|
|
||||||
+ &update_cache_variants),
|
|
||||||
+ SPINAND_HAS_QE_BIT,
|
|
||||||
+ SPINAND_ECCINFO(&fm35x1ga_ooblayout, NULL)),
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct spinand_manufacturer_ops fidelix_spinand_manuf_ops = {
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+const struct spinand_manufacturer fidelix_spinand_manufacturer = {
|
|
||||||
+ .id = SPINAND_MFR_FIDELIX,
|
|
||||||
+ .name = "Fidelix",
|
|
||||||
+ .chips = fidelix_spinand_table,
|
|
||||||
+ .nchips = ARRAY_SIZE(fidelix_spinand_table),
|
|
||||||
+ .ops = &fidelix_spinand_manuf_ops,
|
|
||||||
+};
|
|
||||||
--- a/include/linux/mtd/spinand.h
|
|
||||||
+++ b/include/linux/mtd/spinand.h
|
|
||||||
@@ -238,6 +238,7 @@ struct spinand_manufacturer {
|
|
||||||
};
|
|
||||||
|
|
||||||
/* SPI NAND manufacturers */
|
|
||||||
+extern const struct spinand_manufacturer fidelix_spinand_manufacturer;
|
|
||||||
extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
|
|
||||||
extern const struct spinand_manufacturer macronix_spinand_manufacturer;
|
|
||||||
extern const struct spinand_manufacturer micron_spinand_manufacturer;
|
|
Loading…
x
Reference in New Issue
Block a user