cp110_setup.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2018 Marvell International Ltd.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. * https://spdx.org/licenses
  6. */
  7. /* CP110 Marvell SoC driver */
  8. #ifndef CP110_SETUP_H
  9. #define CP110_SETUP_H
  10. #include <lib/mmio.h>
  11. #include <mvebu_def.h>
  12. #define MVEBU_DEVICE_ID_REG (MVEBU_CP_DFX_OFFSET + 0x40)
  13. #define MVEBU_DEVICE_ID_OFFSET (0)
  14. #define MVEBU_DEVICE_ID_MASK (0xffff << MVEBU_DEVICE_ID_OFFSET)
  15. #define MVEBU_DEVICE_REV_OFFSET (16)
  16. #define MVEBU_DEVICE_REV_MASK (0xf << MVEBU_DEVICE_REV_OFFSET)
  17. #define MVEBU_70X0_DEV_ID (0x7040)
  18. #define MVEBU_70X0_CP115_DEV_ID (0x7045)
  19. #define MVEBU_3900_DEV_ID (0x6025)
  20. #define MVEBU_80X0_DEV_ID (0x8040)
  21. #define MVEBU_80X0_CP115_DEV_ID (0x8045)
  22. #define MVEBU_CN9130_DEV_ID (0x7025)
  23. #define MVEBU_CP110_SA_DEV_ID (0x110)
  24. #define MVEBU_CP110_REF_ID_A1 1
  25. #define MVEBU_CP110_REF_ID_A2 2
  26. #define MAX_STREAM_ID_PER_CP (0x10)
  27. #define STREAM_ID_BASE (0x40)
  28. #define MVEBU_SECUREBOOT_CTRL_REG (MVEBU_RFU_BASE + 0x4730)
  29. #define MVEBU_SECUREBOOT_EN_MASK BIT(0)
  30. static inline uint32_t cp110_device_id_get(uintptr_t base)
  31. {
  32. /* Returns:
  33. * - MVEBU_70X0_DEV_ID for A70X0 family
  34. * - MVEBU_80X0_DEV_ID for A80X0 family
  35. * - MVEBU_CP110_SA_DEV_ID for CP that connected stand alone
  36. */
  37. return (mmio_read_32(base + MVEBU_DEVICE_ID_REG) >>
  38. MVEBU_DEVICE_ID_OFFSET) &
  39. MVEBU_DEVICE_ID_MASK;
  40. }
  41. static inline uint32_t cp110_rev_id_get(uintptr_t base)
  42. {
  43. return (mmio_read_32(base + MVEBU_DEVICE_ID_REG) &
  44. MVEBU_DEVICE_REV_MASK) >>
  45. MVEBU_DEVICE_REV_OFFSET;
  46. }
  47. static inline uint32_t is_secure(void)
  48. {
  49. return !!(mmio_read_32(MVEBU_SECUREBOOT_CTRL_REG) &
  50. MVEBU_SECUREBOOT_EN_MASK);
  51. }
  52. void cp110_init(uintptr_t cp110_base, uint32_t stream_id);
  53. void cp110_ble_init(uintptr_t cp110_base);
  54. void cp110_amb_init(uintptr_t base);
  55. #endif /* CP110_SETUP_H */