sram.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_config {
  8. int (*init)(void);
  9. bool map_only_reserved;
  10. };
  11. struct sram_partition {
  12. void __iomem *base;
  13. struct gen_pool *pool;
  14. struct bin_attribute battr;
  15. struct mutex lock;
  16. struct list_head list;
  17. };
  18. struct sram_dev {
  19. const struct sram_config *config;
  20. struct device *dev;
  21. void __iomem *virt_base;
  22. bool no_memory_wc;
  23. struct gen_pool *pool;
  24. struct clk *clk;
  25. struct sram_partition *partition;
  26. u32 partitions;
  27. };
  28. struct sram_reserve {
  29. struct list_head list;
  30. u32 start;
  31. u32 size;
  32. struct resource res;
  33. bool export;
  34. bool pool;
  35. bool protect_exec;
  36. const char *label;
  37. };
  38. #ifdef CONFIG_SRAM_EXEC
  39. int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block,
  40. struct sram_partition *part);
  41. int sram_add_protect_exec(struct sram_partition *part);
  42. #else
  43. static inline int sram_check_protect_exec(struct sram_dev *sram,
  44. struct sram_reserve *block,
  45. struct sram_partition *part)
  46. {
  47. return -ENODEV;
  48. }
  49. static inline int sram_add_protect_exec(struct sram_partition *part)
  50. {
  51. return -ENODEV;
  52. }
  53. #endif /* CONFIG_SRAM_EXEC */
  54. #endif /* __SRAM_H */