sram.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Defines for the SRAM driver
  4. */
  5. #ifndef __SRAM_H
  6. #define __SRAM_H
  7. struct sram_partition {
  8. void __iomem *base;
  9. struct gen_pool *pool;
  10. struct bin_attribute battr;
  11. struct mutex lock;
  12. struct list_head list;
  13. };
  14. struct sram_dev {
  15. struct device *dev;
  16. void __iomem *virt_base;
  17. struct gen_pool *pool;
  18. struct clk *clk;
  19. struct sram_partition *partition;
  20. u32 partitions;
  21. };
  22. struct sram_reserve {
  23. struct list_head list;
  24. u32 start;
  25. u32 size;
  26. bool export;
  27. bool pool;
  28. bool protect_exec;
  29. const char *label;
  30. };
  31. #ifdef CONFIG_SRAM_EXEC
  32. int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block,
  33. struct sram_partition *part);
  34. int sram_add_protect_exec(struct sram_partition *part);
  35. #else
  36. static inline int sram_check_protect_exec(struct sram_dev *sram,
  37. struct sram_reserve *block,
  38. struct sram_partition *part)
  39. {
  40. return -ENODEV;
  41. }
  42. static inline int sram_add_protect_exec(struct sram_partition *part)
  43. {
  44. return -ENODEV;
  45. }
  46. #endif /* CONFIG_SRAM_EXEC */
  47. #endif /* __SRAM_H */