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>
56 np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data"); in cpm_muram_init()
59 np = of_find_node_by_name(NULL, "data-only"); in cpm_muram_init()
62 ret = -ENODEV; in cpm_muram_init()
67 muram_pool = gen_pool_create(0, -1); in cpm_muram_init()
70 ret = -ENOMEM; in cpm_muram_init()
76 ret = -ENODEV; in cpm_muram_init()
83 ret = gen_pool_add(muram_pool, r.start - muram_pbase + in cpm_muram_init()
84 GENPOOL_OFFSET, resource_size(&r), -1); in cpm_muram_init()
91 muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1); in cpm_muram_init()
94 ret = -ENOMEM; in cpm_muram_init()
106 * cpm_muram_alloc_common - cpm_muram_alloc common code
111 * This function returns a non-negative offset into the muram area, or
114 static s32 cpm_muram_alloc_common(unsigned long size, in cpm_muram_alloc_common()
122 return -ENOMEM; in cpm_muram_alloc_common()
126 return -ENOMEM; in cpm_muram_alloc_common()
128 start = start - GENPOOL_OFFSET; in cpm_muram_alloc_common()
130 entry->start = start; in cpm_muram_alloc_common()
131 entry->size = size; in cpm_muram_alloc_common()
132 list_add(&entry->head, &muram_block_list); in cpm_muram_alloc_common()
138 * cpm_muram_alloc - allocate the requested size worth of multi-user ram
142 * This function returns a non-negative offset into the muram area, or
147 s32 cpm_muram_alloc(unsigned long size, unsigned long align) in cpm_muram_alloc()
150 unsigned long flags; in cpm_muram_alloc()
163 * cpm_muram_free - free a chunk of multi-user ram
168 unsigned long flags; in cpm_muram_free()
178 if (tmp->start == offset) { in cpm_muram_free()
179 size = tmp->size; in cpm_muram_free()
180 list_del(&tmp->head); in cpm_muram_free()
191 * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram
199 s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size) in cpm_muram_alloc_fixed()
202 unsigned long flags; in cpm_muram_alloc_fixed()
215 * cpm_muram_addr - turn a muram offset into a virtual address
218 void __iomem *cpm_muram_addr(unsigned long offset) in cpm_muram_addr()
224 unsigned long cpm_muram_offset(const void __iomem *addr) in cpm_muram_offset()
226 return addr - muram_vbase; in cpm_muram_offset()
231 * cpm_muram_dma - turn a muram virtual address into a DMA address
236 return muram_pbase + (addr - muram_vbase); in cpm_muram_dma()