2 * Handling of a sram zone for bestcomm
5 * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
12 #ifndef __BESTCOMM_SRAM_H__
13 #define __BESTCOMM_SRAM_H__
15 #include <asm/rheap.h>
17 #include <linux/spinlock.h>
20 /* Structure used internally */
21 /* The internals are here for the inline functions
22 * sake, certainly not for the user to mess with !
25 phys_addr_t base_phys
;
32 extern struct bcom_sram
*bcom_sram
;
36 extern int bcom_sram_init(struct device_node
*sram_node
, char *owner
);
37 extern void bcom_sram_cleanup(void);
39 extern void* bcom_sram_alloc(int size
, int align
, phys_addr_t
*phys
);
40 extern void bcom_sram_free(void *ptr
);
42 static inline phys_addr_t
bcom_sram_va2pa(void *va
) {
43 return bcom_sram
->base_phys
+
44 (unsigned long)(va
- bcom_sram
->base_virt
);
47 static inline void *bcom_sram_pa2va(phys_addr_t pa
) {
48 return bcom_sram
->base_virt
+
49 (unsigned long)(pa
- bcom_sram
->base_phys
);
53 #endif /* __BESTCOMM_SRAM_H__ */