Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258219
b: refs/heads/master
c: 201043f
h: refs/heads/master
i:
  258217: f2f578a
  258215: 7fcdfc7
v: v3
  • Loading branch information
Linus Walleij authored and Russell King committed Jul 6, 2011
1 parent 40e3582 commit a470709
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9715efb8dc9ffa629bf5a1215b11bf2f2f29908b
refs/heads/master: 201043f227576d42529ddb340746a060a00f57f6
2 changes: 2 additions & 0 deletions trunk/arch/arm/include/asm/tcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@

void *tcm_alloc(size_t len);
void tcm_free(void *addr, size_t len);
bool tcm_dtcm_present(void);
bool tcm_itcm_present(void);

#endif
21 changes: 18 additions & 3 deletions trunk/arch/arm/kernel/tcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "tcm.h"

static struct gen_pool *tcm_pool;
static bool dtcm_present;
static bool itcm_present;

/* TCM section definitions from the linker */
extern char __itcm_start, __sitcm_text, __eitcm_text;
Expand Down Expand Up @@ -90,6 +92,18 @@ void tcm_free(void *addr, size_t len)
}
EXPORT_SYMBOL(tcm_free);

bool tcm_dtcm_present(void)
{
return dtcm_present;
}
EXPORT_SYMBOL(tcm_dtcm_present);

bool tcm_itcm_present(void)
{
return itcm_present;
}
EXPORT_SYMBOL(tcm_itcm_present);

static int __init setup_tcm_bank(u8 type, u8 bank, u8 banks,
u32 *offset)
{
Expand Down Expand Up @@ -208,6 +222,7 @@ void __init tcm_init(void)
memcpy(start, ram, dtcm_code_sz);
pr_debug("CPU DTCM: copied data from %p - %p\n",
start, end);
dtcm_present = true;
} else if (dtcm_code_sz) {
pr_info("CPU DTCM: %u bytes of code compiled to DTCM but no "
"DTCM banks present in CPU\n", dtcm_code_sz);
Expand Down Expand Up @@ -239,6 +254,7 @@ void __init tcm_init(void)
memcpy(start, ram, itcm_code_sz);
pr_debug("CPU ITCM: copied code from %p - %p\n",
start, end);
itcm_present = true;
} else if (itcm_code_sz) {
pr_info("CPU ITCM: %u bytes of code compiled to ITCM but no "
"ITCM banks present in CPU\n", itcm_code_sz);
Expand All @@ -252,7 +268,6 @@ void __init tcm_init(void)
*/
static int __init setup_tcm_pool(void)
{
u32 tcm_status = read_cpuid_tcmstatus();
u32 dtcm_pool_start = (u32) &__edtcm_data;
u32 itcm_pool_start = (u32) &__eitcm_text;
int ret;
Expand All @@ -267,7 +282,7 @@ static int __init setup_tcm_pool(void)
pr_debug("Setting up TCM memory pool\n");

/* Add the rest of DTCM to the TCM pool */
if (tcm_status & (0x03 << 16)) {
if (dtcm_present) {
if (dtcm_pool_start < dtcm_end) {
ret = gen_pool_add(tcm_pool, dtcm_pool_start,
dtcm_end - dtcm_pool_start, -1);
Expand All @@ -284,7 +299,7 @@ static int __init setup_tcm_pool(void)
}

/* Add the rest of ITCM to the TCM pool */
if (tcm_status & 0x03) {
if (itcm_present) {
if (itcm_pool_start < itcm_end) {
ret = gen_pool_add(tcm_pool, itcm_pool_start,
itcm_end - itcm_pool_start, -1);
Expand Down

0 comments on commit a470709

Please sign in to comment.