Commit 4b8afdad authored by David Brownell's avatar David Brownell Committed by Kevin Hilman

davinci: remove IRAM allocator

Remove dm6446-specific SRAM allocator, as preparation for a
more generic replacement.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent f645f2d0
......@@ -5,7 +5,7 @@
# Common objects
obj-y := time.o clock.o serial.o io.o psc.o \
gpio.o devices.o usb.o dma.o iram.o common.o
gpio.o devices.o usb.o dma.o common.o
obj-$(CONFIG_DAVINCI_MUX) += mux.o
......
......@@ -209,10 +209,6 @@ void edma_clear_event(unsigned channel);
void edma_pause(unsigned channel);
void edma_resume(unsigned channel);
/* UNRELATED TO DMA */
int davinci_alloc_iram(unsigned size);
void davinci_free_iram(unsigned addr, unsigned size);
/* platform_data for EDMA driver */
struct edma_soc_info {
......
......@@ -21,7 +21,6 @@
* Definitions
**************************************************************************/
#define DAVINCI_DDR_BASE 0x80000000
#define DAVINCI_IRAM_BASE 0x00008000 /* ARM Internal RAM */
#define PHYS_OFFSET DAVINCI_DDR_BASE
......
/*
* linux/arch/arm/mach-davinci/iram.c
*
* DaVinci iram allocation/free
* Copyright (C) 2008 Boundary Devices.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <mach/memory.h>
/*
* 2**14 (16K) / 2**5 (32) = 2**9 (512 bytes per bit)
*/
static atomic_t iram_mask;
int davinci_alloc_iram(unsigned size)
{
unsigned int mask;
unsigned int mask_prior;
unsigned addr;
unsigned cnt;
cnt = (size + 511) >> 9;
if (cnt >= 32)
return 0;
mask = atomic_read(&iram_mask);
do {
unsigned int need_mask = (1 << cnt) - 1;
addr = DAVINCI_IRAM_BASE;
while (mask & need_mask) {
if (need_mask & (1<<31))
return -ENOMEM;
need_mask <<= 1;
addr += 512;
}
mask_prior = mask;
mask = atomic_cmpxchg(&iram_mask, mask, mask | need_mask);
} while (mask != mask_prior);
return addr;
}
EXPORT_SYMBOL(davinci_alloc_iram);
void davinci_free_iram(unsigned addr, unsigned size)
{
unsigned mask;
addr -= DAVINCI_IRAM_BASE;
addr >>= 9;
size = (size + 511) >> 9;
if ((size + addr) >= 32)
return;
mask = ((1 << size) - 1) << addr;
atomic_clear_mask(mask, (unsigned long *)&iram_mask.counter);
}
EXPORT_SYMBOL(davinci_free_iram);
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