1 /* 2 * JZ4780 BCH controller 3 * 4 * Copyright (c) 2015 Imagination Technologies 5 * Author: Alex Smith <alex.smith@imgtec.com> 6 * 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. 10 */ 11 12 #ifndef __DRIVERS_MTD_NAND_JZ4780_BCH_H__ 13 #define __DRIVERS_MTD_NAND_JZ4780_BCH_H__ 14 15 #include <linux/types.h> 16 17 struct device; 18 struct device_node; 19 struct jz4780_bch; 20 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. 26 */ 27 struct jz4780_bch_params { 28 int size; 29 int bytes; 30 int strength; 31 }; 32 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); 39 40 void jz4780_bch_release(struct jz4780_bch *bch); 41 struct jz4780_bch *of_jz4780_bch_get(struct device_node *np); 42 43 #endif /* __DRIVERS_MTD_NAND_JZ4780_BCH_H__ */ 44