omap_elm.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * (C) Copyright 2010-2011 Texas Instruments, <www.ti.com>
  3. * Mansoor Ahamed <mansoor.ahamed@ti.com>
  4. *
  5. * Derived from work done by Rohit Choraria <rohitkc@ti.com> for omap3
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef __ASM_ARCH_ELM_H
  10. #define __ASM_ARCH_ELM_H
  11. /*
  12. * ELM Module Registers
  13. */
  14. /* ELM registers bit fields */
  15. #define ELM_SYSCONFIG_SOFTRESET_MASK (0x2)
  16. #define ELM_SYSCONFIG_SOFTRESET (0x2)
  17. #define ELM_SYSSTATUS_RESETDONE_MASK (0x1)
  18. #define ELM_SYSSTATUS_RESETDONE (0x1)
  19. #define ELM_LOCATION_CONFIG_ECC_BCH_LEVEL_MASK (0x3)
  20. #define ELM_LOCATION_CONFIG_ECC_SIZE_MASK (0x7FF0000)
  21. #define ELM_LOCATION_CONFIG_ECC_SIZE_POS (16)
  22. #define ELM_SYNDROME_FRAGMENT_6_SYNDROME_VALID (0x00010000)
  23. #define ELM_LOCATION_STATUS_ECC_CORRECTABLE_MASK (0x100)
  24. #define ELM_LOCATION_STATUS_ECC_NB_ERRORS_MASK (0x1F)
  25. #ifndef __ASSEMBLY__
  26. enum bch_level {
  27. BCH_4_BIT = 0,
  28. BCH_8_BIT,
  29. BCH_16_BIT
  30. };
  31. /* BCH syndrome registers */
  32. struct syndrome {
  33. u32 syndrome_fragment_x[7]; /* 0x400, 0x404.... 0x418 */
  34. u8 res1[36]; /* 0x41c */
  35. };
  36. /* BCH error status & location register */
  37. struct location {
  38. u32 location_status; /* 0x800 */
  39. u8 res1[124]; /* 0x804 */
  40. u32 error_location_x[16]; /* 0x880.... */
  41. u8 res2[64]; /* 0x8c0 */
  42. };
  43. /* BCH ELM register map - do not try to allocate memmory for this structure.
  44. * We have used plenty of reserved variables to fill the slots in the ELM
  45. * register memory map.
  46. * Directly initialize the struct pointer to ELM base address.
  47. */
  48. struct elm {
  49. u32 rev; /* 0x000 */
  50. u8 res1[12]; /* 0x004 */
  51. u32 sysconfig; /* 0x010 */
  52. u32 sysstatus; /* 0x014 */
  53. u32 irqstatus; /* 0x018 */
  54. u32 irqenable; /* 0x01c */
  55. u32 location_config; /* 0x020 */
  56. u8 res2[92]; /* 0x024 */
  57. u32 page_ctrl; /* 0x080 */
  58. u8 res3[892]; /* 0x084 */
  59. struct syndrome syndrome_fragments[8]; /* 0x400 */
  60. u8 res4[512]; /* 0x600 */
  61. struct location error_location[8]; /* 0x800 */
  62. };
  63. int elm_check_error(u8 *syndrome, u32 nibbles, u32 *error_count,
  64. u32 *error_locations);
  65. int elm_config(enum bch_level level);
  66. void elm_reset(void);
  67. void elm_init(void);
  68. #endif /* __ASSEMBLY__ */
  69. #endif /* __ASM_ARCH_ELM_H */