2 * cmd_cplbinfo.c - dump the instruction/data cplb tables
4 * Copyright (c) 2007-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
11 #include <asm/blackfin.h>
13 #include <asm/mach-common/bits/mpu.h>
16 * Translate the PAGE_SIZE bits into a human string
18 static const char *cplb_page_size(uint32_t data)
20 static const char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" };
21 return page_size_string_table[(data & PAGE_SIZE_MASK) >> PAGE_SIZE_SHIFT];
25 * show a hardware cplb table
27 static void show_cplb_table(uint32_t *addr, uint32_t *data)
30 printf(" Address Data Size Valid Locked\n");
31 for (i = 1; i <= 16; ++i) {
32 printf(" %2i 0x%p 0x%05X %s %c %c\n",
33 i, (void *)*addr, *data,
34 cplb_page_size(*data),
35 (*data & CPLB_VALID ? 'Y' : 'N'),
36 (*data & CPLB_LOCK ? 'Y' : 'N'));
43 * display current instruction and data cplb tables
45 int do_cplbinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
47 printf("%s CPLB table [%08x]:\n", "Instruction", *(uint32_t *)DMEM_CONTROL);
48 show_cplb_table((uint32_t *)ICPLB_ADDR0, (uint32_t *)ICPLB_DATA0);
50 printf("%s CPLB table [%08x]:\n", "Data", *(uint32_t *)IMEM_CONTROL);
51 show_cplb_table((uint32_t *)DCPLB_ADDR0, (uint32_t *)DCPLB_DATA0);
56 U_BOOT_CMD(cplbinfo, 1, 0, do_cplbinfo,
57 "display current CPLB tables",