Linux 4.9.89
[linux/fpc-iii.git] / drivers / mtd / nand / jz4780_bch.h
blobbf4718088a3ab82fe0108d510cc6fc30197e3548
1 /*
2 * JZ4780 BCH controller
4 * Copyright (c) 2015 Imagination Technologies
5 * Author: Alex Smith <alex.smith@imgtec.com>
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_JZ4780_BCH_H__
13 #define __DRIVERS_MTD_NAND_JZ4780_BCH_H__
15 #include <linux/types.h>
17 struct device;
18 struct device_node;
19 struct jz4780_bch;
21 /**
22 * struct jz4780_bch_params - BCH parameters
23 * @size: data bytes per ECC step.
24 * @bytes: ECC bytes per step.
25 * @strength: number of correctable bits per ECC step.
27 struct jz4780_bch_params {
28 int size;
29 int bytes;
30 int strength;
33 int jz4780_bch_calculate(struct jz4780_bch *bch,
34 struct jz4780_bch_params *params,
35 const u8 *buf, u8 *ecc_code);
36 int jz4780_bch_correct(struct jz4780_bch *bch,
37 struct jz4780_bch_params *params, u8 *buf,
38 u8 *ecc_code);
40 void jz4780_bch_release(struct jz4780_bch *bch);
41 struct jz4780_bch *of_jz4780_bch_get(struct device_node *np);
43 #endif /* __DRIVERS_MTD_NAND_JZ4780_BCH_H__ */