Commit 186b8daf authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Jakub Kicinski

soc: fsl: qe: add cpm_muram_free_addr() helper

Add a helper that takes a virtual address rather than the muram
offset. This will be used in a couple of places to avoid having to
store both the offset and the virtual address, as well as removing
NULL checks from the callers.
Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: default avatarLi Yang <leoyang.li@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 155ea0dc
...@@ -238,3 +238,15 @@ dma_addr_t cpm_muram_dma(void __iomem *addr) ...@@ -238,3 +238,15 @@ dma_addr_t cpm_muram_dma(void __iomem *addr)
return muram_pbase + (addr - muram_vbase); return muram_pbase + (addr - muram_vbase);
} }
EXPORT_SYMBOL(cpm_muram_dma); EXPORT_SYMBOL(cpm_muram_dma);
/*
* As cpm_muram_free, but takes the virtual address rather than the
* muram offset.
*/
void cpm_muram_free_addr(const void __iomem *addr)
{
if (!addr)
return;
cpm_muram_free(cpm_muram_offset(addr));
}
EXPORT_SYMBOL(cpm_muram_free_addr);
...@@ -104,6 +104,7 @@ s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); ...@@ -104,6 +104,7 @@ s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
void __iomem *cpm_muram_addr(unsigned long offset); void __iomem *cpm_muram_addr(unsigned long offset);
unsigned long cpm_muram_offset(const void __iomem *addr); unsigned long cpm_muram_offset(const void __iomem *addr);
dma_addr_t cpm_muram_dma(void __iomem *addr); dma_addr_t cpm_muram_dma(void __iomem *addr);
void cpm_muram_free_addr(const void __iomem *addr);
#else #else
static inline s32 cpm_muram_alloc(unsigned long size, static inline s32 cpm_muram_alloc(unsigned long size,
unsigned long align) unsigned long align)
...@@ -135,6 +136,9 @@ static inline dma_addr_t cpm_muram_dma(void __iomem *addr) ...@@ -135,6 +136,9 @@ static inline dma_addr_t cpm_muram_dma(void __iomem *addr)
{ {
return 0; return 0;
} }
static inline void cpm_muram_free_addr(const void __iomem *addr)
{
}
#endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */ #endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */
/* QE PIO */ /* QE PIO */
...@@ -239,6 +243,7 @@ static inline int qe_alive_during_sleep(void) ...@@ -239,6 +243,7 @@ static inline int qe_alive_during_sleep(void)
#define qe_muram_addr cpm_muram_addr #define qe_muram_addr cpm_muram_addr
#define qe_muram_offset cpm_muram_offset #define qe_muram_offset cpm_muram_offset
#define qe_muram_dma cpm_muram_dma #define qe_muram_dma cpm_muram_dma
#define qe_muram_free_addr cpm_muram_free_addr
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
#define qe_iowrite8(val, addr) out_8(addr, val) #define qe_iowrite8(val, addr) out_8(addr, val)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment