Release 4.11 arch/arm/mach-davinci/sram.c
/*
* mach-davinci/sram.c - DaVinci simple SRAM allocator
*
* Copyright (C) 2009 David Brownell
*
* 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/init.h>
#include <linux/io.h>
#include <linux/genalloc.h>
#include <mach/common.h>
#include "sram.h"
static struct gen_pool *sram_pool;
struct gen_pool *sram_get_gen_pool(void)
{
return sram_pool;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matt Porter | 12 | 100.00% | 1 | 100.00% |
Total | 12 | 100.00% | 1 | 100.00% |
void *sram_alloc(size_t len, dma_addr_t *dma)
{
dma_addr_t dma_base = davinci_soc_info.sram_dma;
if (dma)
*dma = 0;
if (!sram_pool || (dma && !dma_base))
return NULL;
return gen_pool_dma_alloc(sram_pool, len, dma);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Brownell | 49 | 90.74% | 1 | 33.33% |
Nicolin Chen | 3 | 5.56% | 1 | 33.33% |
Ben Gardiner | 2 | 3.70% | 1 | 33.33% |
Total | 54 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(sram_alloc);
void sram_free(void *addr, size_t len)
{
gen_pool_free(sram_pool, (unsigned long) addr, len);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Brownell | 25 | 100.00% | 1 | 100.00% |
Total | 25 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(sram_free);
/*
* REVISIT This supports CPU and DMA access to/from SRAM, but it
* doesn't (yet?) support some other notable uses of SRAM: as TCM
* for data and/or instructions; and holding code needed to enter
* and exit suspend states (while DRAM can't be used).
*/
static int __init sram_init(void)
{
phys_addr_t phys = davinci_soc_info.sram_dma;
unsigned len = davinci_soc_info.sram_len;
int status = 0;
void __iomem *addr;
if (len) {
len = min_t(unsigned, len, SRAM_SIZE);
sram_pool = gen_pool_create(ilog2(SRAM_GRANULARITY), -1);
if (!sram_pool)
status = -ENOMEM;
}
if (sram_pool) {
addr = ioremap(phys, len);
if (!addr)
return -ENOMEM;
status = gen_pool_add_virt(sram_pool, (unsigned long) addr,
phys, len, -1);
if (status < 0)
iounmap(addr);
}
WARN_ON(status < 0);
return status;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Brownell | 87 | 63.04% | 2 | 50.00% |
Ben Gardiner | 49 | 35.51% | 1 | 25.00% |
Sekhar Nori | 2 | 1.45% | 1 | 25.00% |
Total | 138 | 100.00% | 4 | 100.00% |
core_initcall(sram_init);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Brownell | 198 | 73.33% | 2 | 28.57% |
Ben Gardiner | 54 | 20.00% | 1 | 14.29% |
Matt Porter | 12 | 4.44% | 1 | 14.29% |
Nicolin Chen | 3 | 1.11% | 1 | 14.29% |
Sekhar Nori | 2 | 0.74% | 1 | 14.29% |
Arnd Bergmann | 1 | 0.37% | 1 | 14.29% |
Total | 270 | 100.00% | 7 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.