Lines Matching refs:bcom_sram
27 struct bcom_sram *bcom_sram = NULL; variable
28 EXPORT_SYMBOL_GPL(bcom_sram); /* needed for inline functions */
45 if (bcom_sram) { in bcom_sram_init()
51 bcom_sram = kmalloc(sizeof(struct bcom_sram), GFP_KERNEL); in bcom_sram_init()
52 if (!bcom_sram) { in bcom_sram_init()
66 bcom_sram->base_phys = res.start; in bcom_sram_init()
67 bcom_sram->size = resource_size(&res); in bcom_sram_init()
79 bcom_sram->base_virt = (void *)ioremap(res.start, resource_size(&res)); in bcom_sram_init()
81 if (!bcom_sram->base_virt) { in bcom_sram_init()
84 owner, (long)bcom_sram->base_phys, bcom_sram->size ); in bcom_sram_init()
90 bcom_sram->rh = rh_create(4); in bcom_sram_init()
98 rh_attach_region(bcom_sram->rh, 0, bcom_sram->size); in bcom_sram_init()
103 rh_attach_region(bcom_sram->rh, zbase - bcom_sram->base_phys, regaddr_p[1]); in bcom_sram_init()
110 spin_lock_init(&bcom_sram->lock); in bcom_sram_init()
117 kfree(bcom_sram); in bcom_sram_init()
118 bcom_sram = NULL; in bcom_sram_init()
127 if (bcom_sram) { in bcom_sram_cleanup()
128 rh_destroy(bcom_sram->rh); in bcom_sram_cleanup()
129 iounmap((void __iomem *)bcom_sram->base_virt); in bcom_sram_cleanup()
130 release_mem_region(bcom_sram->base_phys, bcom_sram->size); in bcom_sram_cleanup()
131 kfree(bcom_sram); in bcom_sram_cleanup()
132 bcom_sram = NULL; in bcom_sram_cleanup()
141 spin_lock(&bcom_sram->lock); in bcom_sram_alloc()
142 offset = rh_alloc_align(bcom_sram->rh, size, align, NULL); in bcom_sram_alloc()
143 spin_unlock(&bcom_sram->lock); in bcom_sram_alloc()
148 *phys = bcom_sram->base_phys + offset; in bcom_sram_alloc()
149 return bcom_sram->base_virt + offset; in bcom_sram_alloc()
160 offset = ptr - bcom_sram->base_virt; in bcom_sram_free()
162 spin_lock(&bcom_sram->lock); in bcom_sram_free()
163 rh_free(bcom_sram->rh, offset); in bcom_sram_free()
164 spin_unlock(&bcom_sram->lock); in bcom_sram_free()