Lines Matching +full:use +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
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
145 * Use cpm_muram_addr() to get the virtual address of the area.
146 * Use cpm_muram_free() to free the allocation.
164 * cpm_muram_free - free a chunk of multi-user ram
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
206 * Use cpm_muram_addr() to get the virtual address of the area.
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
240 * Use cpm_muram_addr() to get the virtual address of the area.
241 * Use cpm_muram_free() to free the allocation.
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
266 * Use cpm_muram_addr() to get the virtual address of the area.
269 * resource-managed version is automatically freed on driver detach and so,
280 return -ENOMEM; in devm_cpm_muram_alloc_fixed()
295 * cpm_muram_addr - turn a muram offset into a virtual address
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()