jz4780_bch.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #ifndef __DRIVERS_MTD_NAND_JZ4780_BCH_H__
  12. #define __DRIVERS_MTD_NAND_JZ4780_BCH_H__
  13. #include <linux/types.h>
  14. struct device;
  15. struct device_node;
  16. struct jz4780_bch;
  17. /**
  18. * struct jz4780_bch_params - BCH parameters
  19. * @size: data bytes per ECC step.
  20. * @bytes: ECC bytes per step.
  21. * @strength: number of correctable bits per ECC step.
  22. */
  23. struct jz4780_bch_params {
  24. int size;
  25. int bytes;
  26. int strength;
  27. };
  28. int jz4780_bch_calculate(struct jz4780_bch *bch,
  29. struct jz4780_bch_params *params,
  30. const u8 *buf, u8 *ecc_code);
  31. int jz4780_bch_correct(struct jz4780_bch *bch,
  32. struct jz4780_bch_params *params, u8 *buf,
  33. u8 *ecc_code);
  34. void jz4780_bch_release(struct jz4780_bch *bch);
  35. struct jz4780_bch *of_jz4780_bch_get(struct device_node *np);
  36. #endif /* __DRIVERS_MTD_NAND_JZ4780_BCH_H__ */