Merge tag 'spi-fix-v6.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
[linux-2.6-block.git] / drivers / misc / sram.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
cdd1737c
DG
2/*
3 * Defines for the SRAM driver
cdd1737c
DG
4 */
5#ifndef __SRAM_H
6#define __SRAM_H
7
fec29bf0
MP
8struct sram_config {
9 int (*init)(void);
10 bool map_only_reserved;
11};
12
cdd1737c
DG
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 {
fec29bf0
MP
23 const struct sram_config *config;
24
cdd1737c
DG
25 struct device *dev;
26 void __iomem *virt_base;
fec29bf0 27 bool no_memory_wc;
cdd1737c
DG
28
29 struct gen_pool *pool;
cdd1737c
DG
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;
fec29bf0 39 struct resource res;
cdd1737c
DG
40 bool export;
41 bool pool;
37afff0d 42 bool protect_exec;
cdd1737c
DG
43 const char *label;
44};
728bbe75
DG
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 */
cdd1737c 63#endif /* __SRAM_H */