ccu.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. /* CCU unit device driver for Marvell AP807, AP807 and AP810 SoCs */
  8. #ifndef CCU_H
  9. #define CCU_H
  10. #ifndef __ASSEMBLER__
  11. #include <drivers/marvell/addr_map.h>
  12. #endif
  13. /* CCU registers definitions */
  14. #define CCU_WIN_CR_OFFSET(ap, win) (MVEBU_CCU_BASE(ap) + 0x0 + \
  15. (0x10 * win))
  16. #define CCU_TARGET_ID_OFFSET (8)
  17. #define CCU_TARGET_ID_MASK (0x7F)
  18. #define CCU_WIN_SCR_OFFSET(ap, win) (MVEBU_CCU_BASE(ap) + 0x4 + \
  19. (0x10 * win))
  20. #define CCU_WIN_ENA_WRITE_SECURE (0x1)
  21. #define CCU_WIN_ENA_READ_SECURE (0x2)
  22. #define CCU_WIN_ALR_OFFSET(ap, win) (MVEBU_CCU_BASE(ap) + 0x8 + \
  23. (0x10 * win))
  24. #define CCU_WIN_AHR_OFFSET(ap, win) (MVEBU_CCU_BASE(ap) + 0xC + \
  25. (0x10 * win))
  26. #define CCU_WIN_GCR_OFFSET(ap) (MVEBU_CCU_BASE(ap) + 0xD0)
  27. #define CCU_GCR_TARGET_OFFSET (8)
  28. #define CCU_GCR_TARGET_MASK (0xFF)
  29. #define CCU_SRAM_WIN_CR CCU_WIN_CR_OFFSET(MVEBU_AP0, 1)
  30. #ifndef __ASSEMBLER__
  31. int init_ccu(int);
  32. void ccu_win_check(struct addr_map_win *win);
  33. void ccu_enable_win(int ap_index, struct addr_map_win *win, uint32_t win_id);
  34. void ccu_temp_win_insert(int ap_index, struct addr_map_win *win, int size);
  35. void ccu_temp_win_remove(int ap_index, struct addr_map_win *win, int size);
  36. void ccu_dram_win_config(int ap_index, struct addr_map_win *win);
  37. void ccu_dram_target_set(int ap_index, uint32_t target);
  38. void ccu_save_win_all(int ap_id);
  39. void ccu_restore_win_all(int ap_id);
  40. int ccu_is_win_enabled(int ap_index, uint32_t win_id);
  41. void errata_wa_init(void);
  42. #endif
  43. #endif /* CCU_H */