]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/mtd/nand/mtk_ecc.h
2 * MTK SDG1 ECC controller
4 * Copyright (c) 2016 Mediatek
5 * Authors: Xiaolei Li <xiaolei.li@mediatek.com>
6 * Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #ifndef __DRIVERS_MTD_NAND_MTK_ECC_H__
13 #define __DRIVERS_MTD_NAND_MTK_ECC_H__
15 #include <linux/types.h>
17 #define ECC_PARITY_BITS (14)
19 enum mtk_ecc_mode
{ECC_DMA_MODE
= 0, ECC_NFI_MODE
= 1};
20 enum mtk_ecc_operation
{ECC_ENCODE
, ECC_DECODE
};
25 struct mtk_ecc_stats
{
31 struct mtk_ecc_config
{
32 enum mtk_ecc_operation op
;
33 enum mtk_ecc_mode mode
;
40 int mtk_ecc_encode(struct mtk_ecc
*, struct mtk_ecc_config
*, u8
*, u32
);
41 void mtk_ecc_get_stats(struct mtk_ecc
*, struct mtk_ecc_stats
*, int);
42 int mtk_ecc_wait_done(struct mtk_ecc
*, enum mtk_ecc_operation
);
43 int mtk_ecc_enable(struct mtk_ecc
*, struct mtk_ecc_config
*);
44 void mtk_ecc_disable(struct mtk_ecc
*);
45 void mtk_ecc_adjust_strength(struct mtk_ecc
*ecc
, u32
*p
);
47 struct mtk_ecc
*of_mtk_ecc_get(struct device_node
*);
48 void mtk_ecc_release(struct mtk_ecc
*);