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