#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/mutex.h>
#include <linux/mtd/nand-ecc-mtk.h>
#define ECC_IDLE_MASK …
#define ECC_IRQ_EN …
#define ECC_PG_IRQ_SEL …
#define ECC_OP_ENABLE …
#define ECC_OP_DISABLE …
#define ECC_ENCCON …
#define ECC_ENCCNFG …
#define ECC_MS_SHIFT …
#define ECC_ENCDIADDR …
#define ECC_ENCIDLE …
#define ECC_DECCON …
#define ECC_DECCNFG …
#define DEC_EMPTY_EN …
#define DEC_CNFG_CORRECT …
#define ECC_DECIDLE …
#define ECC_DECENUM0 …
#define ECC_TIMEOUT …
#define ECC_IDLE_REG(op) …
#define ECC_CTL_REG(op) …
#define ECC_ERRMASK_MT7622 …
#define ECC_ERRMASK_MT2701 …
#define ECC_ERRMASK_MT2712 …
struct mtk_ecc_caps { … };
struct mtk_ecc { … };
static const u8 ecc_strength_mt2701[] = …;
static const u8 ecc_strength_mt2712[] = …;
static const u8 ecc_strength_mt7622[] = …;
static const u8 ecc_strength_mt7986[] = …;
enum mtk_ecc_regs { … };
static int mt2701_ecc_regs[] = …;
static int mt2712_ecc_regs[] = …;
static int mt7622_ecc_regs[] = …;
static inline void mtk_ecc_wait_idle(struct mtk_ecc *ecc,
enum mtk_ecc_operation op)
{ … }
static irqreturn_t mtk_ecc_irq(int irq, void *id)
{ … }
static int mtk_ecc_config(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
{ … }
void mtk_ecc_get_stats(struct mtk_ecc *ecc, struct mtk_ecc_stats *stats,
int sectors)
{ … }
EXPORT_SYMBOL(…);
void mtk_ecc_release(struct mtk_ecc *ecc)
{ … }
EXPORT_SYMBOL(…);
static void mtk_ecc_hw_init(struct mtk_ecc *ecc)
{ … }
static struct mtk_ecc *mtk_ecc_get(struct device_node *np)
{ … }
struct mtk_ecc *of_mtk_ecc_get(struct device_node *of_node)
{ … }
EXPORT_SYMBOL(…);
int mtk_ecc_enable(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
{ … }
EXPORT_SYMBOL(…);
void mtk_ecc_disable(struct mtk_ecc *ecc)
{ … }
EXPORT_SYMBOL(…);
int mtk_ecc_wait_done(struct mtk_ecc *ecc, enum mtk_ecc_operation op)
{ … }
EXPORT_SYMBOL(…);
int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config,
u8 *data, u32 bytes)
{ … }
EXPORT_SYMBOL(…);
void mtk_ecc_adjust_strength(struct mtk_ecc *ecc, u32 *p)
{ … }
EXPORT_SYMBOL(…);
unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc)
{ … }
EXPORT_SYMBOL(…);
static const struct mtk_ecc_caps mtk_ecc_caps_mt2701 = …;
static const struct mtk_ecc_caps mtk_ecc_caps_mt2712 = …;
static const struct mtk_ecc_caps mtk_ecc_caps_mt7622 = …;
static const struct mtk_ecc_caps mtk_ecc_caps_mt7986 = …;
static const struct of_device_id mtk_ecc_dt_match[] = …;
static int mtk_ecc_probe(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int mtk_ecc_suspend(struct device *dev)
{ … }
static int mtk_ecc_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(mtk_ecc_pm_ops, mtk_ecc_suspend, mtk_ecc_resume);
#endif
MODULE_DEVICE_TABLE(of, mtk_ecc_dt_match);
static struct platform_driver mtk_ecc_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;