From 4f93f8b1a4d35b6d302842132edba920ef8f62aa Mon Sep 17 00:00:00 2001 From: Becky Bruce Date: Wed, 23 Jan 2008 16:31:06 -0600 Subject: 86xx: Add reginfo command Signed-off-by: Becky Bruce --- common/cmd_reginfo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c index bb6aa30d18..11af22bc3f 100644 --- a/common/cmd_reginfo.c +++ b/common/cmd_reginfo.c @@ -31,6 +31,8 @@ #include #elif defined (CONFIG_MPC5200) #include +#elif defined (CONFIG_MPC86xx) +extern void mpc86xx_reginfo(void); #endif int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -329,14 +331,18 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) *(volatile ulong*)MPC5XXX_SDRAM_CS0CFG); printf ("\tSDRAMCS1: %08X\n", *(volatile ulong*)MPC5XXX_SDRAM_CS1CFG); -#endif /* CONFIG_MPC5200 */ +#elif defined(CONFIG_MPC86xx) + mpc86xx_reginfo(); +#endif /* CONFIG_MPC86xx */ + return 0; } /**************************************************/ #if ( defined(CONFIG_8xx) || defined(CONFIG_405GP) || \ - defined(CONFIG_405EP) || defined(CONFIG_MPC5200) ) && \ + defined(CONFIG_405EP) || defined(CONFIG_MPC5200) || \ + defined(CONFIG_MPC86xx)) && \ defined(CONFIG_CMD_REGINFO) U_BOOT_CMD( -- cgit From 4087bc88cebec75c432a7fe9f6afb545b0919831 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Feb 2008 19:26:54 -0500 Subject: fix building on Blackfin as the assembler supports the .set syntax, not the = syntax, for assigning symbols Signed-off-by: Mike Frysinger --- common/environment.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/environment.c b/common/environment.c index 24257f7c52..3b9914f498 100644 --- a/common/environment.c +++ b/common/environment.c @@ -70,11 +70,16 @@ /* * Macros to generate global absolutes. */ +#if defined(__bfin__) +# define GEN_SET_VALUE(name, value) asm (".set " GEN_SYMNAME(name) ", " GEN_VALUE(value)) +#else +# define GEN_SET_VALUE(name, value) asm (GEN_SYMNAME(name) " = " GEN_VALUE(value)) +#endif #define GEN_SYMNAME(str) SYM_CHAR #str #define GEN_VALUE(str) #str #define GEN_ABS(name, value) \ asm (".globl " GEN_SYMNAME(name)); \ - asm (GEN_SYMNAME(name) " = " GEN_VALUE(value)) + GEN_SET_VALUE(name, value) /* * Macros to transform values -- cgit From 8dc48d71a4be753ea9f84956cd33600de35fad04 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Feb 2008 19:26:55 -0500 Subject: add Blackfin-specific bdinfo command Signed-off-by: Mike Frysinger --- common/cmd_bdinfo.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'common') diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index c28a155453..3a4dbcf6bd 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -273,6 +273,37 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } +#elif defined(CONFIG_BLACKFIN) + +int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + int i; + bd_t *bd = gd->bd; + + printf("U-Boot = %s\n", bd->bi_r_version); + printf("CPU = %s\n", bd->bi_cpu); + printf("Board = %s\n", bd->bi_board_name); + printf("VCO = %lu MHz\n", bd->bi_vco / 1000000); + printf("CCLK = %lu MHz\n", bd->bi_cclk / 1000000); + printf("SCLK = %lu MHz\n", bd->bi_sclk / 1000000); + + print_num("boot_params", (ulong)bd->bi_boot_params); + print_num("memstart", (ulong)bd->bi_memstart); + print_num("memsize", (ulong)bd->bi_memsize); + print_num("flashstart", (ulong)bd->bi_flashstart); + print_num("flashsize", (ulong)bd->bi_flashsize); + print_num("flashoffset", (ulong)bd->bi_flashoffset); + + puts("ethaddr ="); + for (i = 0; i < 6; ++i) + printf("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]); + puts("\nip_addr = "); + print_IPaddr(bd->bi_ip_addr); + printf("\nbaudrate = %d bps\n", bd->bi_baudrate); + + return 0; +} + #else /* ! PPC, which leaves MIPS */ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) -- cgit From 97c26e006d2fa6d4e1560933ee6f385d8b8908b9 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Feb 2008 19:26:56 -0500 Subject: add Blackfin-specific reginfo command Signed-off-by: Mike Frysinger --- common/cmd_reginfo.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/cmd_reginfo.c b/common/cmd_reginfo.c index bb6aa30d18..980664d142 100644 --- a/common/cmd_reginfo.c +++ b/common/cmd_reginfo.c @@ -329,16 +329,53 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) *(volatile ulong*)MPC5XXX_SDRAM_CS0CFG); printf ("\tSDRAMCS1: %08X\n", *(volatile ulong*)MPC5XXX_SDRAM_CS1CFG); + +#elif defined(CONFIG_BLACKFIN) + puts("\nSystem Configuration registers\n"); + + puts("\nPLL Registers\n"); + printf("\tPLL_DIV: 0x%04x PLL_CTL: 0x%04x\n", + bfin_read_PLL_DIV(), bfin_read_PLL_CTL()); + printf("\tPLL_STAT: 0x%04x PLL_LOCKCNT: 0x%04x\n", + bfin_read_PLL_STAT(), bfin_read_PLL_LOCKCNT()); + printf("\tVR_CTL: 0x%04x\n", bfin_read_VR_CTL()); + + puts("\nEBIU AMC Registers\n"); + printf("\tEBIU_AMGCTL: 0x%04x\n", bfin_read_EBIU_AMGCTL()); + printf("\tEBIU_AMBCTL0: 0x%08x EBIU_AMBCTL1: 0x%08x\n", + bfin_read_EBIU_AMBCTL0(), bfin_read_EBIU_AMBCTL1()); +# ifdef EBIU_MODE + printf("\tEBIU_MBSCTL: 0x%08x EBIU_ARBSTAT: 0x%08x\n", + bfin_read_EBIU_MBSCTL(), bfin_read_EBIU_ARBSTAT()); + printf("\tEBIU_MODE: 0x%08x EBIU_FCTL: 0x%08x\n", + bfin_read_EBIU_MODE(), bfin_read_EBIU_FCTL()); +# endif + +# ifdef EBIU_RSTCTL + puts("\nEBIU DDR Registers\n"); + printf("\tEBIU_DDRCTL0: 0x%08x EBIU_DDRCTL1: 0x%08x\n", + bfin_read_EBIU_DDRCTL0(), bfin_read_EBIU_DDRCTL1()); + printf("\tEBIU_DDRCTL2: 0x%08x EBIU_DDRCTL3: 0x%08x\n", + bfin_read_EBIU_DDRCTL2(), bfin_read_EBIU_DDRCTL3()); + printf("\tEBIU_DDRQUE: 0x%08x EBIU_RSTCTL 0x%04x\n", + bfin_read_EBIU_DDRQUE(), bfin_read_EBIU_RSTCTL()); + printf("\tEBIU_ERRADD: 0x%08x EBIU_ERRMST: 0x%04x\n", + bfin_read_EBIU_ERRADD(), bfin_read_EBIU_ERRMST()); +# else + puts("\nEBIU SDC Registers\n"); + printf("\tEBIU_SDRRC: 0x%04x EBIU_SDBCTL: 0x%04x\n", + bfin_read_EBIU_SDRRC(), bfin_read_EBIU_SDBCTL()); + printf("\tEBIU_SDSTAT: 0x%04x EBIU_SDGCTL: 0x%08x\n", + bfin_read_EBIU_SDSTAT(), bfin_read_EBIU_SDGCTL()); +# endif + #endif /* CONFIG_MPC5200 */ return 0; } /**************************************************/ -#if ( defined(CONFIG_8xx) || defined(CONFIG_405GP) || \ - defined(CONFIG_405EP) || defined(CONFIG_MPC5200) ) && \ - defined(CONFIG_CMD_REGINFO) - +#if defined(CONFIG_CMD_REGINFO) U_BOOT_CMD( reginfo, 2, 1, do_reginfo, "reginfo - print register information\n", -- cgit From 4c727c77e43872d3a1d1f76a949fcb3f26a38788 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Feb 2008 19:26:56 -0500 Subject: add support for memory commands with Blackfin L1 instruction memory Signed-off-by: Mike Frysinger --- common/cmd_mem.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/cmd_mem.c b/common/cmd_mem.c index a994211138..d080810eca 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -154,9 +154,32 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } } while (nbytes > 0); #else - /* Print the lines. */ - print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size); - addr += size*length; + +# if defined(CONFIG_BLACKFIN) + /* See if we're trying to display L1 inst */ + if (addr_bfin_on_chip_mem(addr)) { + char linebuf[DISP_LINE_LEN]; + ulong linebytes, nbytes = length * size; + do { + linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes; + memcpy(linebuf, (void *)addr, linebytes); + print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size); + + nbytes -= linebytes; + addr += linebytes; + if (ctrlc()) { + rc = 1; + break; + } + } while (nbytes > 0); + } else +# endif + + { + /* Print the lines. */ + print_buffer(addr, (void*)addr, size, length, DISP_LINE_LEN/size); + addr += size*length; + } #endif dp_last_addr = addr; @@ -308,6 +331,13 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #endif +#ifdef CONFIG_BLACKFIN + if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) { + puts ("Comparison with L1 instruction memory not supported.\n\r"); + return 0; + } +#endif + ngood = 0; while (count-- > 0) { @@ -478,6 +508,14 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #endif +#ifdef CONFIG_BLACKFIN + /* See if we're copying to/from L1 inst */ + if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) { + memcpy((void *)dest, (void *)addr, count * size); + return 0; + } +#endif + while (count-- > 0) { if (size == 4) *((ulong *)dest) = *((ulong *)addr); @@ -1006,6 +1044,13 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) } #endif +#ifdef CONFIG_BLACKFIN + if (addr_bfin_on_chip_mem(addr)) { + puts ("Can't modify L1 instruction in place. Use cp instead.\n\r"); + return 0; + } +#endif + /* Print the address, followed by value. Then accept input for * the next value. A non-converted value exits. */ -- cgit From d0b01a246d0a351bc7dce1d0c9cf6aebdf6d7505 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Feb 2008 19:26:57 -0500 Subject: interface to Blackfin on-chip One-Time-Programmable memory Signed-off-by: Mike Frysinger --- common/Makefile | 1 + common/cmd_otp.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 common/cmd_otp.c (limited to 'common') diff --git a/common/Makefile b/common/Makefile index fbfa536a30..3cdab37a4e 100644 --- a/common/Makefile +++ b/common/Makefile @@ -76,6 +76,7 @@ COBJS-y += cmd_nand.o COBJS-$(CONFIG_CMD_NET) += cmd_net.o COBJS-y += cmd_nvedit.o COBJS-y += cmd_onenand.o +COBJS-$(CONFIG_CMD_OTP) += cmd_otp.o ifdef CONFIG_PCI COBJS-$(CONFIG_CMD_PCI) += cmd_pci.o endif diff --git a/common/cmd_otp.c b/common/cmd_otp.c new file mode 100644 index 0000000000..825fa34ceb --- /dev/null +++ b/common/cmd_otp.c @@ -0,0 +1,163 @@ +/* + * cmd_otp.c - interface to Blackfin on-chip One-Time-Programmable memory + * + * Copyright (c) 2007-2008 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +/* There are 512 128-bit "pages" (0x000 to 0x1FF). + * The pages are accessable as 64-bit "halfpages" (an upper and lower half). + * The pages are not part of the memory map. There is an OTP controller which + * handles scanning in/out of bits. While access is done through OTP MMRs, + * the bootrom provides C-callable helper functions to handle the interaction. + */ + +#include +#include +#include + +#ifdef CONFIG_CMD_OTP + +#include +#include + +static const char *otp_strerror(uint32_t err) +{ + switch (err) { + case 0: return "no error"; + case OTP_WRITE_ERROR: return "OTP fuse write error"; + case OTP_READ_ERROR: return "OTP fuse read error"; + case OTP_ACC_VIO_ERROR: return "invalid OTP address"; + case OTP_DATA_MULT_ERROR: return "multiple bad bits detected"; + case OTP_ECC_MULT_ERROR: return "error in ECC bits"; + case OTP_PREV_WR_ERROR: return "space already written"; + case OTP_DATA_SB_WARN: return "single bad bit in half page"; + case OTP_ECC_SB_WARN: return "single bad bit in ECC"; + default: return "unknown error"; + } +} + +#define lowup(x) ((x) % 2 ? "upper" : "lower") + +int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + bool force = false; + if (!strcmp(argv[1], "--force")) { + force = true; + argv[1] = argv[0]; + argv++; + --argc; + } + + uint32_t (*otp_func)(uint32_t page, uint32_t flags, uint64_t *page_content); + if (!strcmp(argv[1], "read")) + otp_func = otp_read; + else if (!strcmp(argv[1], "write")) + otp_func = otp_write; + else { + usage: + printf("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + uint64_t *addr = (uint64_t *)simple_strtoul(argv[2], NULL, 16); + uint32_t page = simple_strtoul(argv[3], NULL, 16); + uint32_t flags, ret; + size_t i, count; + ulong half; + + if (argc > 4) + count = simple_strtoul(argv[4], NULL, 16); + else + count = 2; + + if (argc > 5) { + half = simple_strtoul(argv[5], NULL, 16); + if (half != 0 && half != 1) { + puts("Error: 'half' can only be '0' or '1'\n"); + goto usage; + } + } else + half = 0; + + /* do to the nature of OTP, make sure users are sure */ + if (!force && otp_func == otp_write) { + printf( + "Writing one time programmable memory\n" + "Make sure your operating voltages and temperature are within spec\n" + " source address: 0x%p\n" + " OTP destination: %s page 0x%03X - %s page 0x%03X\n" + " number to write: %ld halfpages\n" + " type \"YES\" (no quotes) to confirm: ", + addr, + lowup(half), page, + lowup(half + count - 1), page + (half + count - 1) / 2, + half + count + ); + + i = 0; + while (1) { + if (tstc()) { + const char exp_ans[] = "YES\r"; + char c; + putc(c = getc()); + if (exp_ans[i++] != c) { + printf(" Aborting\n"); + return 1; + } else if (!exp_ans[i]) { + puts("\n"); + break; + } + } + } + + /* Only supported in newer silicon ... enable writing */ +#if (0) + otp_command(OTP_INIT, ...); +#else + *pOTP_TIMING = 0x32149485; +#endif + } + + printf("OTP memory %s: addr 0x%08lx page 0x%03X count %ld ... ", + argv[1], addr, page, count); + + ret = 0; + for (i = half; i < count + half; ++i) { + flags = (i % 2) ? OTP_UPPER_HALF : OTP_LOWER_HALF; + ret = otp_func(page, flags, addr); + if (ret & 0x1) + break; + else if (ret) + puts("W"); + else + puts("."); + ++addr; + if (i % 2) + ++page; + } + if (ret & 0x1) + printf("\nERROR at page 0x%03X (%s-halfpage): 0x%03X: %s\n", + page, lowup(i), ret, otp_strerror(ret)); + else + puts(" done\n"); + + if (otp_func == otp_write) + /* Only supported in newer silicon ... disable writing */ +#if (0) + otp_command(OTP_INIT, ...); +#else + *pOTP_TIMING = 0x1485; +#endif + + return ret; +} + +U_BOOT_CMD(otp, 6, 0, do_otp, + "otp - One-Time-Programmable sub-system\n", + "read [count] [half]\n" + "otp write [--force] [count] [half]\n" + " - read/write 'count' half-pages starting at page 'page' (offset 'half')\n"); + +#endif -- cgit From 30942b18b66f35f2ceedab39af10e9eccaa943cc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 4 Feb 2008 19:26:57 -0500 Subject: new command for displaying strings at specified memory locations Signed-off-by: Mike Frysinger --- common/Makefile | 1 + common/cmd_strings.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 common/cmd_strings.c (limited to 'common') diff --git a/common/Makefile b/common/Makefile index 3cdab37a4e..a88d1ef536 100644 --- a/common/Makefile +++ b/common/Makefile @@ -87,6 +87,7 @@ COBJS-$(CONFIG_CMD_REISER) += cmd_reiser.o COBJS-y += cmd_sata.o COBJS-$(CONFIG_CMD_SCSI) += cmd_scsi.o COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o +COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o COBJS-$(CONFIG_CMD_USB) += cmd_usb.o diff --git a/common/cmd_strings.c b/common/cmd_strings.c new file mode 100644 index 0000000000..bbf56a033b --- /dev/null +++ b/common/cmd_strings.c @@ -0,0 +1,49 @@ +/* + * cmd_strings.c - just like `strings` command + * + * Copyright (c) 2008 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include + +#ifdef CONFIG_CFG_STRINGS + +static char *start_addr, *last_addr; + +int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + if (argc == 1) { + printf("Usage:\n%s\n", cmdtp->usage); + return 1; + } + + if ((flag & CMD_FLAG_REPEAT) == 0) { + start_addr = (char *)simple_strtoul(argv[1], NULL, 16); + if (argc > 2) + last_addr = (char *)simple_strtoul(argv[2], NULL, 16); + else + last_addr = (char *)-1; + } + + char *addr = start_addr; + do { + printf("%s\n", addr); + addr += strlen(addr) + 1; + } while (addr[0] && addr < last_addr); + + last_addr = addr + (last_addr - start_addr); + start_addr = addr; + + return 0; +} + +U_BOOT_CMD(strings, 3, 1, do_strings, + "strings - display strings\n", + " [byte count]\n" + " - display strings at for at least [byte count] or first double NUL\n"); + +#endif -- cgit From 69018ce2e086e9caf35b914d675b82bc4888f077 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Thu, 17 Jan 2008 08:25:45 -0600 Subject: QE: Move FDT support into a common file Move the flat device tree setup for QE related devices into a common file shared between 83xx & 85xx platforms that have QE's. Signed-off-by: Kumar Gala --- common/fdt_support.c | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) (limited to 'common') diff --git a/common/fdt_support.c b/common/fdt_support.c index a13c140cff..92f1c7f54f 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -30,9 +30,6 @@ #include #include -#ifdef CONFIG_QE -#include "../drivers/qe/qe.h" -#endif /* * Global data (for the gd->bd) */ @@ -617,49 +614,4 @@ void fdt_fixup_ethernet(void *fdt, bd_t *bd) #endif } } - -#ifdef CONFIG_QE -/* - * If a QE firmware has been uploaded, then add the 'firmware' node under - * the 'qe' node. - */ -void fdt_fixup_qe_firmware(void *fdt) -{ - struct qe_firmware_info *qe_fw_info; - int node, ret; - - qe_fw_info = qe_get_firmware_info(); - if (!qe_fw_info) - return; - - node = fdt_path_offset(fdt, "/qe"); - if (node < 0) - return; - - /* We assume the node doesn't exist yet */ - node = fdt_add_subnode(fdt, node, "firmware"); - if (node < 0) - return; - - ret = fdt_setprop(fdt, node, "extended-modes", - &qe_fw_info->extended_modes, sizeof(u64)); - if (ret < 0) - goto error; - - ret = fdt_setprop_string(fdt, node, "id", qe_fw_info->id); - if (ret < 0) - goto error; - - ret = fdt_setprop(fdt, node, "virtual-traps", qe_fw_info->vtraps, - sizeof(qe_fw_info->vtraps)); - if (ret < 0) - goto error; - - return; - -error: - fdt_del_node(fdt, node); -} -#endif - #endif -- cgit From d9ad115bbf7bb0842de7dbd2502b7e430f83cc3d Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 13 Feb 2008 15:09:58 -0600 Subject: Fix building of fdt_support.c if DEBUG set Signed-off-by: Kumar Gala --- common/fdt_support.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/fdt_support.c b/common/fdt_support.c index 92f1c7f54f..69eb667954 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -415,7 +415,7 @@ void do_fixup_by_path(void *fdt, const char *path, const char *prop, { #if defined(DEBUG) int i; - debug("Updating property '%s/%s' = ", node, prop); + debug("Updating property '%s/%s' = ", path, prop); for (i = 0; i < len; i++) debug(" %.2x", *(u8*)(val+i)); debug("\n"); @@ -441,7 +441,7 @@ void do_fixup_by_prop(void *fdt, int off; #if defined(DEBUG) int i; - debug("Updating property '%s/%s' = ", node, prop); + debug("Updating property '%s' = ", prop); for (i = 0; i < len; i++) debug(" %.2x", *(u8*)(val+i)); debug("\n"); @@ -468,7 +468,7 @@ void do_fixup_by_compat(void *fdt, const char *compat, int off = -1; #if defined(DEBUG) int i; - debug("Updating property '%s/%s' = ", node, prop); + debug("Updating property '%s' = ", prop); for (i = 0; i < len; i++) debug(" %.2x", *(u8*)(val+i)); debug("\n"); -- cgit From 9604b6e53ddae4fe00a488cbcd6b0e6cb344bccc Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 11 Feb 2008 10:50:19 +0000 Subject: AT91CAP9 support --------------------------------- read_dataflash() takes a signed char pointer as a parameter. Silence a few warnings dues to incorrect parameter types in env_dataflash.c. Signed-off-by: Stelian Pop --- common/env_dataflash.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/env_dataflash.c b/common/env_dataflash.c index 93fff29b05..8a944324f2 100644 --- a/common/env_dataflash.c +++ b/common/env_dataflash.c @@ -44,22 +44,22 @@ extern uchar default_environment[]; uchar env_get_char_spec (int index) { uchar c; - read_dataflash (CFG_ENV_ADDR+index+offsetof(env_t,data),1,&c); + read_dataflash(CFG_ENV_ADDR + index + offsetof(env_t,data), + 1, (char *)&c); return (c); } void env_relocate_spec (void) { - read_dataflash (CFG_ENV_ADDR,CFG_ENV_SIZE,(uchar *)env_ptr); + read_dataflash(CFG_ENV_ADDR, CFG_ENV_SIZE, (char *)env_ptr); } int saveenv(void) { -/* env must be copied to do not alter env structure in memory*/ -unsigned char temp[CFG_ENV_SIZE]; -int i; + /* env must be copied to do not alter env structure in memory*/ + unsigned char temp[CFG_ENV_SIZE]; memcpy(temp, env_ptr, CFG_ENV_SIZE); - return write_dataflash (CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE); + return write_dataflash(CFG_ENV_ADDR, (unsigned long)temp, CFG_ENV_SIZE); } /************************************************************************ @@ -77,13 +77,14 @@ int env_init(void) AT91F_DataflashInit(); /* prepare for DATAFLASH read/write */ /* read old CRC */ - read_dataflash (CFG_ENV_ADDR+offsetof(env_t,crc),sizeof(ulong),&crc); + read_dataflash(CFG_ENV_ADDR + offsetof(env_t, crc), + sizeof(ulong), (char *)&crc); new = 0; len = ENV_SIZE; off = offsetof(env_t,data); while (len > 0) { int n = (len > sizeof(buf)) ? sizeof(buf) : len; - read_dataflash (CFG_ENV_ADDR+off,n , buf); + read_dataflash(CFG_ENV_ADDR + off, n, (char *)buf); new = crc32 (new, buf, n); len -= n; off += n; -- cgit From 26c7bab81e08dc7bd696c48f753428a829629bd8 Mon Sep 17 00:00:00 2001 From: Shinya Kuribayashi Date: Sat, 19 Jan 2008 10:25:59 +0900 Subject: common/miiphyutil.c: Cleanup MII_DEBUG and debug() Current MII_DEBUG is confusing in two ways. One is useless define-then- undef at the top of the file. The other is there is only one debug() in this file, and that doesn't seem worthwhile to bother having MII_DEBUG. While there are many useful printf()/puts() debug codes, but they are for DEBUG, not for MII_DEBUG. This patch tries to put them all together into MII_DEBUG and debug(). Signed-off-by: Shinya Kuribayashi --- common/miiphyutil.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'common') diff --git a/common/miiphyutil.c b/common/miiphyutil.c index 281f0b29e3..eac8275a40 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -36,7 +36,6 @@ #include /* local debug macro */ -#define MII_DEBUG #undef MII_DEBUG #undef debug @@ -261,31 +260,25 @@ int miiphy_info (char *devname, unsigned char addr, unsigned int *oui, unsigned short tmp; if (miiphy_read (devname, addr, PHY_PHYIDR2, &tmp) != 0) { -#ifdef DEBUG - puts ("PHY ID register 2 read failed\n"); -#endif + debug ("PHY ID register 2 read failed\n"); return (-1); } reg = tmp; -#ifdef DEBUG - printf ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg); -#endif + debug ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg); + if (reg == 0xFFFF) { /* No physical device present at this address */ return (-1); } if (miiphy_read (devname, addr, PHY_PHYIDR1, &tmp) != 0) { -#ifdef DEBUG - puts ("PHY ID register 1 read failed\n"); -#endif + debug ("PHY ID register 1 read failed\n"); return (-1); } reg |= tmp << 16; -#ifdef DEBUG - printf ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg); -#endif + debug ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg); + *oui = (reg >> 10); *model = (unsigned char)((reg >> 4) & 0x0000003F); *rev = (unsigned char)(reg & 0x0000000F); @@ -304,15 +297,11 @@ int miiphy_reset (char *devname, unsigned char addr) int loop_cnt; if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) { -#ifdef DEBUG - printf ("PHY status read failed\n"); -#endif + debug ("PHY status read failed\n"); return (-1); } if (miiphy_write (devname, addr, PHY_BMCR, reg | 0x8000) != 0) { -#ifdef DEBUG - puts ("PHY reset failed\n"); -#endif + debug ("PHY reset failed\n"); return (-1); } #ifdef CONFIG_PHY_RESET_DELAY @@ -327,9 +316,7 @@ int miiphy_reset (char *devname, unsigned char addr) reg = 0x8000; while (((reg & 0x8000) != 0) && (loop_cnt++ < 1000000)) { if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) { -# ifdef DEBUG - puts ("PHY status read failed\n"); -# endif + debug ("PHY status read failed\n"); return (-1); } } -- cgit From 1f780aa6f17a5d79791d69ec1d2f66d76ac45d8e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 13 Feb 2008 11:19:19 +0100 Subject: Fix return value of mtest when CFG_ALT_MEMTEST set Fix a missing return statement from a non-void function. Signed-off-by: Guennadi Liakhovetski --- common/cmd_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/cmd_mem.c b/common/cmd_mem.c index a994211138..5fce773a9b 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -659,6 +659,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) vu_long *addr, *start, *end; ulong val; ulong readback; + int rcode = 0; #if defined(CFG_ALT_MEMTEST) vu_long addr_mask; @@ -689,7 +690,6 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #else ulong incr; ulong pattern; - int rcode = 0; #endif if (argc > 1) { @@ -954,8 +954,8 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } incr = -incr; } - return rcode; #endif + return rcode; } -- cgit From 6f4abee789b6d9be3ec4b97ad48f509355559e9e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 8 Feb 2008 21:25:58 +0100 Subject: Fix wrong memory limit calculation in memory-test If the length of the memory address range passed to the "mtest" command is not of the form 2^x - 1, not all address lines are tested. This bug is inherited from the original software at http://www.netrino.com/Embedded-Systems/How-To/Memory-Test-Suite-C. Fix this. Signed-off-by: Guennadi Liakhovetski --- common/cmd_mem.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'common') diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 000107f726..ed91f27046 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -700,7 +700,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int rcode = 0; #if defined(CFG_ALT_MEMTEST) - vu_long addr_mask; + vu_long len; vu_long offset; vu_long test_offset; vu_long pattern; @@ -836,26 +836,19 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) * all possible. * * Returns: 0 if the test succeeds, 1 if the test fails. - * - * ## NOTE ## Be sure to specify start and end - * addresses such that addr_mask has - * lots of bits set. For example an - * address range of 01000000 02000000 is - * bad while a range of 01000000 - * 01ffffff is perfect. */ - addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long); + len = ((ulong)end - (ulong)start)/sizeof(vu_long); pattern = (vu_long) 0xaaaaaaaa; anti_pattern = (vu_long) 0x55555555; - PRINTF("%s:%d: addr mask = 0x%.8lx\n", + PRINTF("%s:%d: length = 0x%.8lx\n", __FUNCTION__, __LINE__, - addr_mask); + len); /* * Write the default pattern at each of the * power-of-two offsets. */ - for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) { + for (offset = 1; offset < len; offset <<= 1) { start[offset] = pattern; } @@ -865,7 +858,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) test_offset = 0; start[test_offset] = anti_pattern; - for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) { + for (offset = 1; offset < len; offset <<= 1) { temp = start[offset]; if (temp != pattern) { printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:" @@ -879,10 +872,10 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* * Check for addr bits stuck low or shorted. */ - for (test_offset = 1; (test_offset & addr_mask) != 0; test_offset <<= 1) { + for (test_offset = 1; test_offset < len; test_offset <<= 1) { start[test_offset] = anti_pattern; - for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) { + for (offset = 1; offset < len; offset <<= 1) { temp = start[offset]; if ((temp != pattern) && (offset != test_offset)) { printf ("\nFAILURE: Address bit stuck low or shorted @" -- cgit