add SDHC support in mmc driver
[u-boot-openmoko/mini2440.git] / common / cmd_cplbinfo.c
blobb2bbec12ea8b54093bd5c3761fa3f1a50ba2caeb
1 /*
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.
7 */
9 #include <common.h>
10 #include <command.h>
11 #include <asm/blackfin.h>
12 #include <asm/cplb.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)
29 size_t i;
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, *addr, *data,
34 cplb_page_size(*data),
35 (*data & CPLB_VALID ? 'Y' : 'N'),
36 (*data & CPLB_LOCK ? 'Y' : 'N'));
37 ++addr;
38 ++data;
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);
53 return 0;
56 U_BOOT_CMD(cplbinfo, 1, 0, do_cplbinfo,
57 "cplbinfo- display current CPLB tables\n",
58 "\n"
59 " - display current CPLB tables\n");