Lines Matching +full:long +full:- +full:ram +full:- +full:code
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Common CPM code
7 * Copyright 2007-2008,2010 Freescale Semiconductor, Inc.
11 * Copyright (c) 1999-2001 Dan Malek <dan@embeddedalley.com>
57 np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data"); in cpm_muram_init()
60 np = of_find_node_by_name(NULL, "data-only"); in cpm_muram_init()
63 ret = -ENODEV; in cpm_muram_init()
68 muram_pool = gen_pool_create(0, -1); in cpm_muram_init()
71 ret = -ENOMEM; in cpm_muram_init()
77 ret = -ENODEV; in cpm_muram_init()
84 ret = gen_pool_add(muram_pool, r.start - muram_pbase + in cpm_muram_init()
85 GENPOOL_OFFSET, resource_size(&r), -1); in cpm_muram_init()
92 muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1); in cpm_muram_init()
95 ret = -ENOMEM; in cpm_muram_init()
107 * cpm_muram_alloc_common - cpm_muram_alloc common code
112 * This function returns a non-negative offset into the muram area, or
115 static s32 cpm_muram_alloc_common(unsigned long size, in cpm_muram_alloc_common()
123 return -ENOMEM; in cpm_muram_alloc_common()
127 return -ENOMEM; in cpm_muram_alloc_common()
129 start = start - GENPOOL_OFFSET; in cpm_muram_alloc_common()
131 entry->start = start; in cpm_muram_alloc_common()
132 entry->size = size; in cpm_muram_alloc_common()
133 list_add(&entry->head, &muram_block_list); in cpm_muram_alloc_common()
139 * cpm_muram_alloc - allocate the requested size worth of multi-user ram
143 * This function returns a non-negative offset into the muram area, or
148 s32 cpm_muram_alloc(unsigned long size, unsigned long align) in cpm_muram_alloc()
151 unsigned long flags; in cpm_muram_alloc()
164 * cpm_muram_free - free a chunk of multi-user ram
169 unsigned long flags; in cpm_muram_free()
179 if (tmp->start == offset) { in cpm_muram_free()
180 size = tmp->size; in cpm_muram_free()
181 list_del(&tmp->head); in cpm_muram_free()
199 * devm_cpm_muram_alloc - Resource-managed cpm_muram_alloc
204 * This function returns a non-negative offset into the muram area, or
209 * resource-managed version is automatically freed on driver detach and so,
212 s32 devm_cpm_muram_alloc(struct device *dev, unsigned long size, in devm_cpm_muram_alloc()
213 unsigned long align) in devm_cpm_muram_alloc()
220 return -ENOMEM; in devm_cpm_muram_alloc()
235 * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram
243 s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) in cpm_muram_alloc_fixed()
246 unsigned long flags; in cpm_muram_alloc_fixed()
259 * devm_cpm_muram_alloc_fixed - Resource-managed cpm_muram_alloc_fixed
264 * This function returns a non-negative offset into the muram area, or
269 * resource-managed version is automatically freed on driver detach and so,
272 s32 devm_cpm_muram_alloc_fixed(struct device *dev, unsigned long offset, in devm_cpm_muram_alloc_fixed()
273 unsigned long size) in devm_cpm_muram_alloc_fixed()
280 return -ENOMEM; in devm_cpm_muram_alloc_fixed()
295 * cpm_muram_addr - turn a muram offset into a virtual address
298 void __iomem *cpm_muram_addr(unsigned long offset) in cpm_muram_addr()
304 unsigned long cpm_muram_offset(const void __iomem *addr) in cpm_muram_offset()
306 return addr - muram_vbase; in cpm_muram_offset()
311 * cpm_muram_dma - turn a muram virtual address into a DMA address
316 return muram_pbase + (addr - muram_vbase); in cpm_muram_dma()