cache_llc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (C) 2018-2020 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. /* LLC driver is the Last Level Cache (L3C) driver
  8. * for Marvell SoCs in AP806, AP807, and AP810
  9. */
  10. #ifndef CACHE_LLC_H
  11. #define CACHE_LLC_H
  12. #define LLC_CTRL(ap) (MVEBU_LLC_BASE(ap) + 0x100)
  13. #define LLC_SECURE_CTRL(ap) (MVEBU_LLC_BASE(ap) + 0x10C)
  14. #define LLC_SYNC(ap) (MVEBU_LLC_BASE(ap) + 0x700)
  15. #define LLC_BANKED_MNT_AHR(ap) (MVEBU_LLC_BASE(ap) + 0x724)
  16. #define LLC_INV_WAY(ap) (MVEBU_LLC_BASE(ap) + 0x77C)
  17. #define LLC_BLK_ALOC(ap) (MVEBU_LLC_BASE(ap) + 0x78c)
  18. #define LLC_CLEAN_WAY(ap) (MVEBU_LLC_BASE(ap) + 0x7BC)
  19. #define LLC_CLEAN_INV_WAY(ap) (MVEBU_LLC_BASE(ap) + 0x7FC)
  20. #define LLC_TCN_LOCK(ap, tc) (MVEBU_LLC_BASE(ap) + 0x920 + 4 * (tc))
  21. #define MASTER_LLC_CTRL LLC_CTRL(MVEBU_AP0)
  22. #define MASTER_LLC_INV_WAY LLC_INV_WAY(MVEBU_AP0)
  23. #define MASTER_LLC_TC0_LOCK LLC_TCN_LOCK(MVEBU_AP0, 0)
  24. #define LLC_CTRL_EN 1
  25. #define LLC_EXCLUSIVE_EN 0x100
  26. #define LLC_ALL_WAYS_MASK 0xFFFFFFFF
  27. /* AP806/AP807 - 1MB 8-ways LLC */
  28. #define LLC_WAYS 8
  29. #define LLC_WAY_MASK ((1 << LLC_WAYS) - 1)
  30. #define LLC_SIZE (1024 * 1024)
  31. #define LLC_WAY_SIZE (LLC_SIZE / LLC_WAYS)
  32. #define LLC_TC_NUM 15
  33. #define LLC_BLK_ALOC_WAY_ID(way) ((way) & 0x1f)
  34. #define LLC_BLK_ALOC_WAY_DATA_DSBL (0x0 << 6)
  35. #define LLC_BLK_ALOC_WAY_DATA_CLR (0x1 << 6)
  36. #define LLC_BLK_ALOC_WAY_DATA_SET (0x3 << 6)
  37. #define LLC_BLK_ALOC_BASE_ADDR(addr) ((addr) & ~(LLC_WAY_SIZE - 1))
  38. #ifndef __ASSEMBLER__
  39. void llc_cache_sync(int ap_index);
  40. void llc_flush_all(int ap_index);
  41. void llc_clean_all(int ap_index);
  42. void llc_inv_all(int ap_index);
  43. void llc_disable(int ap_index);
  44. void llc_enable(int ap_index, int excl_mode);
  45. int llc_is_exclusive(int ap_index);
  46. void llc_runtime_enable(int ap_index);
  47. #if LLC_SRAM
  48. int llc_sram_enable(int ap_index, int size);
  49. void llc_sram_disable(int ap_index);
  50. int llc_sram_test(int ap_index, int size, char *msg);
  51. #endif /* LLC_SRAM */
  52. #endif /* __ASSEMBLER__ */
  53. #endif /* CACHE_LLC_H */