stm32mp_ddr.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
  5. */
  6. #ifndef STM32MP_DDR_H
  7. #define STM32MP_DDR_H
  8. #include <platform_def.h>
  9. enum stm32mp_ddr_base_type {
  10. DDR_BASE,
  11. DDRPHY_BASE,
  12. NONE_BASE
  13. };
  14. enum stm32mp_ddr_reg_type {
  15. REG_REG,
  16. REG_TIMING,
  17. REG_PERF,
  18. REG_MAP,
  19. REGPHY_REG,
  20. REGPHY_TIMING,
  21. REG_TYPE_NB
  22. };
  23. struct stm32mp_ddr_reg_desc {
  24. const char *name;
  25. uint16_t offset; /* Offset for base address */
  26. uint8_t par_offset; /* Offset for parameter array */
  27. };
  28. struct stm32mp_ddr_reg_info {
  29. const char *name;
  30. const struct stm32mp_ddr_reg_desc *desc;
  31. uint8_t size;
  32. enum stm32mp_ddr_base_type base;
  33. };
  34. struct stm32mp_ddr_size {
  35. uint64_t base;
  36. uint64_t size;
  37. };
  38. struct stm32mp_ddr_priv {
  39. struct stm32mp_ddr_size info;
  40. struct stm32mp_ddrctl *ctl;
  41. struct stm32mp_ddrphy *phy;
  42. uintptr_t pwr;
  43. uintptr_t rcc;
  44. };
  45. struct stm32mp_ddr_info {
  46. const char *name;
  47. uint32_t speed; /* in kHZ */
  48. uint32_t size; /* Memory size in byte = col * row * width */
  49. };
  50. #define TIMEOUT_US_1S 1000000U
  51. void stm32mp_ddr_set_reg(const struct stm32mp_ddr_priv *priv, enum stm32mp_ddr_reg_type type,
  52. const void *param, const struct stm32mp_ddr_reg_info *ddr_registers);
  53. void stm32mp_ddr_start_sw_done(struct stm32mp_ddrctl *ctl);
  54. void stm32mp_ddr_wait_sw_done_ack(struct stm32mp_ddrctl *ctl);
  55. void stm32mp_ddr_enable_axi_port(struct stm32mp_ddrctl *ctl);
  56. int stm32mp_board_ddr_power_init(enum ddr_type ddr_type);
  57. #endif /* STM32MP_DDR_H */