Path: blob/master/arch/powerpc/sysdev/bestcomm/sram.h
10818 views
/*1* Handling of a sram zone for bestcomm2*3*4* Copyright (C) 2007 Sylvain Munaut <[email protected]>5*6* This file is licensed under the terms of the GNU General Public License7* version 2. This program is licensed "as is" without any warranty of any8* kind, whether express or implied.9*/1011#ifndef __BESTCOMM_SRAM_H__12#define __BESTCOMM_SRAM_H__1314#include <asm/rheap.h>15#include <asm/mmu.h>16#include <linux/spinlock.h>171819/* Structure used internally */20/* The internals are here for the inline functions21* sake, certainly not for the user to mess with !22*/23struct bcom_sram {24phys_addr_t base_phys;25void *base_virt;26unsigned int size;27rh_info_t *rh;28spinlock_t lock;29};3031extern struct bcom_sram *bcom_sram;323334/* Public API */35extern int bcom_sram_init(struct device_node *sram_node, char *owner);36extern void bcom_sram_cleanup(void);3738extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);39extern void bcom_sram_free(void *ptr);4041static inline phys_addr_t bcom_sram_va2pa(void *va) {42return bcom_sram->base_phys +43(unsigned long)(va - bcom_sram->base_virt);44}4546static inline void *bcom_sram_pa2va(phys_addr_t pa) {47return bcom_sram->base_virt +48(unsigned long)(pa - bcom_sram->base_phys);49}505152#endif /* __BESTCOMM_SRAM_H__ */53545556