Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Defines for the SRAM driver
0004  */
0005 #ifndef __SRAM_H
0006 #define __SRAM_H
0007 
0008 struct sram_config {
0009     int (*init)(void);
0010     bool map_only_reserved;
0011 };
0012 
0013 struct sram_partition {
0014     void __iomem *base;
0015 
0016     struct gen_pool *pool;
0017     struct bin_attribute battr;
0018     struct mutex lock;
0019     struct list_head list;
0020 };
0021 
0022 struct sram_dev {
0023     const struct sram_config *config;
0024 
0025     struct device *dev;
0026     void __iomem *virt_base;
0027     bool no_memory_wc;
0028 
0029     struct gen_pool *pool;
0030     struct clk *clk;
0031 
0032     struct sram_partition *partition;
0033     u32 partitions;
0034 };
0035 
0036 struct sram_reserve {
0037     struct list_head list;
0038     u32 start;
0039     u32 size;
0040     struct resource res;
0041     bool export;
0042     bool pool;
0043     bool protect_exec;
0044     const char *label;
0045 };
0046 
0047 #ifdef CONFIG_SRAM_EXEC
0048 int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block,
0049                 struct sram_partition *part);
0050 int sram_add_protect_exec(struct sram_partition *part);
0051 #else
0052 static inline int sram_check_protect_exec(struct sram_dev *sram,
0053                       struct sram_reserve *block,
0054                       struct sram_partition *part)
0055 {
0056     return -ENODEV;
0057 }
0058 
0059 static inline int sram_add_protect_exec(struct sram_partition *part)
0060 {
0061     return -ENODEV;
0062 }
0063 #endif /* CONFIG_SRAM_EXEC */
0064 #endif /* __SRAM_H */