14c3f9727SGilad Ben-Yossef /* SPDX-License-Identifier: GPL-2.0 */ 203963caeSGilad Ben-Yossef /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */ 34c3f9727SGilad Ben-Yossef 44c3f9727SGilad Ben-Yossef #ifndef __CC_SRAM_MGR_H__ 54c3f9727SGilad Ben-Yossef #define __CC_SRAM_MGR_H__ 64c3f9727SGilad Ben-Yossef 74c3f9727SGilad Ben-Yossef #ifndef CC_CC_SRAM_SIZE 84c3f9727SGilad Ben-Yossef #define CC_CC_SRAM_SIZE 4096 94c3f9727SGilad Ben-Yossef #endif 104c3f9727SGilad Ben-Yossef 114c3f9727SGilad Ben-Yossef struct cc_drvdata; 124c3f9727SGilad Ben-Yossef 131a895f1dSGeert Uytterhoeven #define NULL_SRAM_ADDR ((u32)-1) 144c3f9727SGilad Ben-Yossef 154c3f9727SGilad Ben-Yossef /*! 164c3f9727SGilad Ben-Yossef * Initializes SRAM pool. 174c3f9727SGilad Ben-Yossef * The first X bytes of SRAM are reserved for ROM usage, hence, pool 184c3f9727SGilad Ben-Yossef * starts right after X bytes. 194c3f9727SGilad Ben-Yossef * 204c3f9727SGilad Ben-Yossef * \param drvdata 214c3f9727SGilad Ben-Yossef * 224c3f9727SGilad Ben-Yossef * \return int Zero for success, negative value otherwise. 234c3f9727SGilad Ben-Yossef */ 244c3f9727SGilad Ben-Yossef int cc_sram_mgr_init(struct cc_drvdata *drvdata); 254c3f9727SGilad Ben-Yossef 264c3f9727SGilad Ben-Yossef /*! 2737282f8dSGeert Uytterhoeven * Allocate buffer from SRAM pool. 284c3f9727SGilad Ben-Yossef * 294c3f9727SGilad Ben-Yossef * \param drvdata 304c3f9727SGilad Ben-Yossef * \param size The requested bytes to allocate 314c3f9727SGilad Ben-Yossef */ 321a895f1dSGeert Uytterhoeven u32 cc_sram_alloc(struct cc_drvdata *drvdata, u32 size); 334c3f9727SGilad Ben-Yossef 344c3f9727SGilad Ben-Yossef /** 354c3f9727SGilad Ben-Yossef * cc_set_sram_desc() - Create const descriptors sequence to 364c3f9727SGilad Ben-Yossef * set values in given array into SRAM. 374c3f9727SGilad Ben-Yossef * Note: each const value can't exceed word size. 384c3f9727SGilad Ben-Yossef * 394c3f9727SGilad Ben-Yossef * @src: A pointer to array of words to set as consts. 404c3f9727SGilad Ben-Yossef * @dst: The target SRAM buffer to set into 414c3f9727SGilad Ben-Yossef * @nelements: The number of words in "src" array 424c3f9727SGilad Ben-Yossef * @seq: A pointer to the given IN/OUT descriptor sequence 434c3f9727SGilad Ben-Yossef * @seq_len: A pointer to the given IN/OUT sequence length 444c3f9727SGilad Ben-Yossef */ 451a895f1dSGeert Uytterhoeven void cc_set_sram_desc(const u32 *src, u32 dst, unsigned int nelement, 461a895f1dSGeert Uytterhoeven struct cc_hw_desc *seq, unsigned int *seq_len); 474c3f9727SGilad Ben-Yossef 484c3f9727SGilad Ben-Yossef #endif /*__CC_SRAM_MGR_H__*/ 49