You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
mtd: mediatek: driver for MTK Smart Device
Add support for mediatek's SDG1 NFC nand controller embedded in SoC 2701 Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Xiaolei Li <xiaolei.li@mediatek.com>
This commit is contained in:
committed by
Boris Brezillon
parent
cac4fcc0d3
commit
1d6b1e4649
@@ -563,4 +563,11 @@ config MTD_NAND_QCOM
|
||||
Enables support for NAND flash chips on SoCs containing the EBI2 NAND
|
||||
controller. This controller is found on IPQ806x SoC.
|
||||
|
||||
config MTD_NAND_MTK
|
||||
tristate "Support for NAND controller on MTK SoCs"
|
||||
depends on HAS_DMA
|
||||
help
|
||||
Enables support for NAND controller on MTK SoCs.
|
||||
This controller is found on mt27xx, mt81xx, mt65xx SoCs.
|
||||
|
||||
endif # MTD_NAND
|
||||
|
||||
@@ -57,5 +57,6 @@ obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
|
||||
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/
|
||||
obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o
|
||||
obj-$(CONFIG_MTD_NAND_MTK) += mtk_nand.o mtk_ecc.o
|
||||
|
||||
nand-objs := nand_base.o nand_bbt.o nand_timings.o
|
||||
|
||||
530
drivers/mtd/nand/mtk_ecc.c
Normal file
530
drivers/mtd/nand/mtk_ecc.c
Normal file
File diff suppressed because it is too large
Load Diff
50
drivers/mtd/nand/mtk_ecc.h
Normal file
50
drivers/mtd/nand/mtk_ecc.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
#define ECC_PARITY_BITS (14)
|
||||
|
||||
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(u32 *);
|
||||
|
||||
struct mtk_ecc *of_mtk_ecc_get(struct device_node *);
|
||||
void mtk_ecc_release(struct mtk_ecc *);
|
||||
|
||||
#endif
|
||||
1526
drivers/mtd/nand/mtk_nand.c
Normal file
1526
drivers/mtd/nand/mtk_nand.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user