Lines Matching +full:com +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Author: Scott Wood <scottwood@freescale.com>
7 * Copyright 2007-2008,2010 Freescale Semiconductor, Inc.
11 * Copyright (c) 1999-2001 Dan Malek <dan@embeddedalley.com>
12 * Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
14 * Vitaly Bordug <vbordug@ru.mvista.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
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
164 * cpm_muram_free - free a chunk of multi-user ram
165 * @offset: The beginning of the chunk as returned by cpm_muram_alloc().
167 void cpm_muram_free(s32 offset) in cpm_muram_free() argument
173 if (offset < 0) 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()
186 gen_pool_free(muram_pool, offset + GENPOOL_OFFSET, size); 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,
220 return -ENOMEM; in devm_cpm_muram_alloc()
235 * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram
236 * @offset: offset of allocation start address
238 * This function returns @offset if the area was available, a negative
243 s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) in cpm_muram_alloc_fixed() argument
250 muram_pool_data_fixed.offset = offset + GENPOOL_OFFSET; in cpm_muram_alloc_fixed()
259 * devm_cpm_muram_alloc_fixed - Resource-managed cpm_muram_alloc_fixed
261 * @offset: offset of allocation start address
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() argument
280 return -ENOMEM; in devm_cpm_muram_alloc_fixed()
282 info = cpm_muram_alloc_fixed(offset, size); in devm_cpm_muram_alloc_fixed()
295 * cpm_muram_addr - turn a muram offset into a virtual address
296 * @offset: muram offset to convert
298 void __iomem *cpm_muram_addr(unsigned long offset) in cpm_muram_addr() argument
300 return muram_vbase + offset; in cpm_muram_addr()
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()
322 * muram offset.