Commit Graph

1654 Commits

Author SHA1 Message Date
Scott Wood eef1d7199d NAND: env: remember the flags used in the previous environment
Previously, uninitialized stack space was being referenced.

Signed-off-by: Scott Wood <scottwood@freescale.com>
2011-02-08 15:25:02 -06:00
Alexander Holler ce297a8f7e USB: Change the necessary defines to get debug output
While debugging some USB stuff, I've first missed that there are actually
two defines necessary to get usefull output. The one needed to get debug output
for the communication with HUBs was burried somewhere deep inside the code.

Change that so that a #define DEBUG is enough while still leaving the possibility
to reduce unwanted debug output.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2011-02-05 13:54:51 +01:00
Alexander Holler cb44091fdf USB: Fix device stati for removable and powerctrl (typo)
I currently don't know if the error could have other consequences
than a wrong output when turning debug on.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2011-02-05 13:54:51 +01:00
Shinya Kuribayashi c6dc8a734d cmd_ide: Fix an unused CONFIG_AU1X00 symbol to work as intended
commit 8bde63eb3f ([MIPS] Rename Alchemy
processor configs into CONFIG_SOC_*) forgot to pick up this one.

Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
2011-02-05 20:06:03 +09:00
Alexander Holler 920a5dd232 NAND: Fix saving of redundand environment
When redundand environments are used the serial needs
to get increased, otherwise the old one will still be used.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2011-02-02 16:14:08 -06:00
Wolfgang Denk d1a24f0618 Minor Coding Style Cleanup.
Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-02-02 22:36:10 +01:00
Alexander Holler 89ffa8dbb5 Print compiler and linker version with the version command
After years of unsuccessful research I've finally shamelessly stolen other
peoples intellectual properties to present the all-new and world-changing
updated version command:
-
U-Boot>> version

U-Boot 2010.12-00014-g7435056-dirty (Jan 18 2011 - 23:19:38)
MyBoard
gcc (GCC) 0.42 (Distro foobar)
GNU ld (GNU Binutils) 0.314159265
-
May the toolchain bugs rest in peace.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2011-02-02 21:56:39 +01:00
Liu Ying 8d46d5b186 lcd: align fb writing address for horizontal display offset
CONFIG_SPLASH_SCREEN_ALIGN makes uboot support display
offset for splashimage. The framebuffer writing address
should be calculated according to different kinds of
framebuffer pixel format, i.e., bits per pixel value.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
2011-01-27 00:20:59 +01:00
Wolfgang Denk 5aebe3b072 Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx 2011-01-25 21:13:04 +01:00
Kumar Gala dd50af2515 powerpc/8xxx: Add hwconfig APIs to address early parsing used by DDR init
There are several users of the hwconfig APIs (8xxx DDR) before we have
the environment properly setup.  This causes issues because of the
numerous ways the environment might be accessed because of the
non-volatile memory it might be stored in.  Additionally the access
might be so early that memory isn't even properly setup for us.

Towards resolving these issues we provide versions of all the hwconfig
APIs that can be passed in a buffer to parse and leave it to the caller
to determine how to allocate and populate the buffer.

We use the _f naming convention for these new APIs even though they are
perfectly useable after relocation and the environment being ready.

We also now warn if the non-f APIs are called before the environment is
ready to allow users to address the issues.

Finally, we convert the 8xxx DDR code to utilize the new APIs to
hopefully address the issue once and for all.  We have the 8xxx DDR code
create a buffer on the stack and populate it via getenv_f().

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>
2011-01-19 22:58:23 -06:00
Alexander Holler c6b1ee664a Fix defines needed to enable command sha1sum
Documented is CONFIG_CMD_SHA1, through confusion in the source
CONFIG_CMD_SHA1 and CONFIG_CMD_SHA1SUM has to be used to enable
sha1sum.

Fix both, the documentation and the source, so that only
CONFIG_CMD_SHA1SUM is needed to enable the command sha1sum.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2011-01-19 09:39:10 +01:00
Peter Tyser 141053d60a cmd_jffs2: Fix get_part_sector_size_nor() overflow bug
When a flash partition was positioned at the very top of a 32-bit memory
map (eg located at 0xf8000000 with a size of 0x8000000)
get_part_sector_size_nor() would incorrectly calculate the partition's
ending address to 0x0 due to overflow.  When the overflow occurred
get_part_sector_size_nor() would falsely return a sector size of 0.
A sector size of 0 results in subsequent jffs2 operations failing.

To workaround the overflow subtract 1 from calculated address of
the partition endpoint.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2011-01-19 00:04:43 +01:00
Lei Wen 47fc18f1e7 NAND: add the ability to directly write yaffs image
This patch add addition suffix to nand write to give the uboot
the power to directly burn the yaffs image to nand.

Signed-off-by: Lei Wen <leiwen@marvell.com>
2011-01-12 17:13:10 -06:00
Wolfgang Denk 3e5ab1af24 Revert "boot cmds: convert to getenv_yesno() with autostart"
This reverts commit 5a442c0add.

This commit changed the behaviour of getenv_yesno() (both the default
behaviour and the documented behaviour for abbreviated arguments)
which resulted in problems in several areas.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-01-11 20:56:34 +01:00
Mike Frysinger 8ef583a035 miiphy: convert to linux/mii.h
The include/miiphy.h header duplicates a lot of things from linux/mii.h.
So punt all the things that overlap to keep the API simple and to make
merging between U-Boot and Linux simpler.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 18:06:50 +01:00
Mike Frysinger 82359aec45 cmd editing: mark erase/tab seqs constant
These strings are only read, so no need to have them be writable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 18:03:58 +01:00
Mike Frysinger d6efe244e4 cmd_mem: localize state variables
These "last" variables aren't used outside of this file, so add static.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 18:03:10 +01:00
Mike Frysinger 558605cf4f load_addr: move to common env code
Rather than keep the load_addr definition with the bootm code (which
just happens to use this), move it to the common env code.  This way
we can disable bootm support completely while retaining load_addr
usage with many other commands.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 18:02:06 +01:00
Mike Frysinger 52f0aa835f config_cmd_defaults.h: new header for common u-boot command defaults
We have config_defaults.h which are random configuration settings that
everyone gets by default.  We also have config_cmd_default.h which is a
recommended list of defaults but boards have to opt into.  Now we have
config_cmd_defaults.h which is a list of defaults that everyone gets
and has to actively opt out of.

For now, we populate it with the bootm command which previously was
unable to be disabled.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 18:01:03 +01:00
Mike Frysinger 560d424b6d env: re-add support for auto-completion
Currently, only basic completion is supported (no globs), but this is
what we had previously.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-09 17:57:37 +01:00
Wolfgang Denk 4b58266e95 cmd_net.c: fix build breakage
Commit 722b061 "autocomplete: remove runtime handler install" caused
some boards (like NETTA2_V2) to break with errors like these:

cmd_net.c:296: error: expected expression before ',' token

Fix this.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
2010-12-23 17:02:18 +01:00
Lei Wen 41c8624056 onenand: add yaffs write command
Yaffs image require to use the oob to store some info, so when we
burn the yaffs image, we need to also write the image's oob part
into flash.

This patch add addition suffix to onenand write to give the uboot
the power to directly burn the yaffs image to onenand.

Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-12-17 14:32:12 -06:00
Mike Frysinger 2eb1573f01 hashtable: drop all non-reentrant versions
The non-reentrant versions of the hashtable functions operate on a single
shared hashtable.  So if two different people try using these funcs for
two different purposes, they'll cause problems for the other.

Avoid this by converting all existing hashtable consumers over to the
reentrant versions and then punting the non-reentrant ones.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-12-17 21:07:14 +01:00
Wolfgang Denk 006915fbb0 Merge branch 'master' of ../master into next 2010-12-16 23:00:53 +01:00
Kumar Gala bb141079d3 hwconfig: Fix handling of env_hwconfig, board_hwconfig, and cpu_hwconfig
The handling of env_hwconfig, board_hwconfig, and cpu_hwconfig got
broken when we removed the boards defining dummy board_hwconfig
& cpu_hwconfig values.

We fix this by handling the various strings in priority order.  If
hwconfig_parse returns NULL for a given string we check the next one
in order (env_hwconfig, board_hwconfig, followed by cpu_hwconfig).

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-12-09 11:01:13 +01:00
Lei Wen a430b137eb onenand: fix oob print out issue
Seems original implementation forget to set the pointer to point
to the oobbuf, so when we want to see oob buf, we see nothing...
Fix it by get pointer as the oobbuf set.

Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-12-07 16:04:20 -06:00
Steve Sakoman 068a208b4a env_nand: Use nand_read_skip_bad instead of nand_read
The nand-read function returns an error code if correctable errors have occurred.
This is not desirable, since the errors have been corrected!

This patch switches to the nand_read_skip_bad function which does not
return an error code if the errors are correctable.

Signed-off-by: Steve Sakoman <steve.sakoman@linaro.org>
Acked-by: Scott Wood <scottwood@freescale.com>
2010-12-06 18:28:33 -06:00
Stefan Roese 2f15cfd187 UBI/UBIFS: Automatically unmount UBIFS volume upon UBI partition change
Automatically unmount UBIFS partition when user changes the UBI device.
Otherwise the following UBIFS commands will crash.

Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 18:24:04 +01:00
Stefan Roese 9a2ea578bc UBIFS: Change "ubifs mount" to "ubifsmount" in ubifsls output
Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 16:33:20 +01:00
Stefan Roese cb9c09d487 UBIFS: Add ubifsumount command to unmount an active volume
This new ubifsumount command allows the user to unmount a previously
mounted UBIFS volume.

Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 16:32:09 +01:00
Kumar Gala b194577b29 hwconfig: Fix dummy initialization of {board, cpu}_hwconfig
Since board_hwconfig & cpu_hwconfig are defined as weak and dont have a
default value they will get put into the BSS if they aren't defined
elsewhere.  This is problematic as we try to utilize hwconfig before
we've relocated and thus BSS isn't setup.

Instead of giving dummy values in the board files that utilize this
feature, we can just initialize the variables to an empty string and
thus move them out of the BSS if they aren't defined elsewhere.

Also made board_hwconfig & cpu_hwconfig arrays to reduce size associated
with string pointers vs arrays.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-11-30 22:11:19 +01:00
Mike Frysinger d7be3056de stdio: constify "name" arg in public api
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:58:48 +01:00
Mike Frysinger 5a442c0add boot cmds: convert to getenv_yesno() with autostart
Use the new helper func to clean up duplicate logic handling of the
autostart env var.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:58:30 +01:00
Mike Frysinger 7edb186fcf image: constify lookup tables
These are pure lookup tables -- no need to be writable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:58:27 +01:00
Mike Frysinger fc9903f38d cmd_itest: constify & localize op table
No one else needs this table.  While we're here, use the standard
ARRAY_SIZE helper macro.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:58:26 +01:00
Mike Frysinger bdbc1303cb cmd_date: constify
Many strings in this file need not be writable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:58:24 +01:00
Mike Frysinger 722b061b6f autocomplete: remove runtime handler install
Rather than add runtime overhead of installing completion handlers, do it
statically at build time.  This requires a new build time helper macro to
declare a command and the completion handler at the same time.  Then we
convert the env related funcs over to this.

This gives an opportunity to also unify the U_BOOT_CMD macros.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:49:27 +01:00
Mike Frysinger 882b7d726f do_reset: unify duplicate prototypes
The duplication of the do_reset prototype has gotten out of hand,
and they're not all in sync.  Unify them all in command.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:47:24 +01:00
Mike Frysinger 7842fb7c4f do_bootd: unify duplicate prototypes
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:46:47 +01:00
Mike Frysinger 36ebb78779 do_bootm: unify duplicate prototypes
The duplication of the do_bootm prototype has gotten out of hand,
and they're pretty much all outdated (wrt constness).  Unify them
all in command.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:45:32 +01:00
Mike Frysinger 3a5ee0b1d6 cmd_mii: localize & constify local funcs/data
No need for these structures to be writable or global.

While we're here, also drop local versions of the ARRAY_SIZE macro.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:40:35 +01:00
Dirk Behme 71ae5f7a3f Fix compiler warning in fdt_support.c
Fix compiler warning

fdt_support.c: In function 'of_bus_default_count_cells':
fdt_support.c:957: warning: passing argument 1 of '__swab32p' discards qualifiers from pointer target type
fdt_support.c:965: warning: passing argument 1 of '__swab32p' discards qualifiers from pointer target type

be32_to_cpup() expects an 'u32 *' while prop is 'const u32 *'.

Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
2010-11-28 12:41:53 +01:00
Thomas Weber 0d302af0bb common/cmd_nvedit: Use return value of cmd_usage
Use the return value of cmd_usage instead of ignoring this
and returning a 1.

Signed-off-by: Thomas Weber <weber@corscience.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-11-27 23:35:13 +01:00
Thomas Weber 7013c06124 Common/command: Guard strchr/strlen from NULL pointer
Guard strchr/strlen from being called with NULL pointer.
This line is crashing when command "env" is called without subcommand.

The cmd is NULL in this case because the calling function "do_env"
decremented the argc without checking if there are still arguments available.

Signed-off-by: Thomas Weber <weber@corscience.de>
2010-11-27 23:35:13 +01:00
Thomas Weber 5904da0214 Common/cmd_nvedit: Check for env subcommand
The env command needs one subcommand. If this is not available
print the usage help.

Signed-off-by: Thomas Weber <weber@corscience.de>
2010-11-27 23:35:13 +01:00
Wolfgang Denk 0390e26705 common/Makefile: don't include env_embedded.o into libcommon
Some boards use an embedded environment, where env_embedded.o has to
be linked at a special position in the U-Boot image; to make this
possible, we do not include it into libcommon.o for such boards.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
2010-11-26 22:08:19 +01:00
Kumar Gala 6163f5b4c8 malloc: Fix issue with calloc memory possibly being non-zero
Since we set #define MORECORE_CLEARS 1, the code assumes 'sbrk' always
returns zero'd out memory.  However since its possible that free()
returns memory back to sbrk() via malloc_trim we could possible get
non-zero'd memory from sbrk().  This is a problem for when code might
call calloc() and expect the memory to have been zero'd out.

There are two possible solutions to this problem.
1. change #define MORECORE_CLEARS 0
2. memset to zero memory returned to sbrk.

We go with the second since the sbrk being called to free up memory
should be pretty rare.

The following code problems an example test to show the issue.  This
test code was inserted right after the call to mem_malloc_init().

...
       u8 *p2;
       int i;

       printf("MALLOC TEST\n");
       p1 = malloc(135176);
       printf("P1 = %p\n", p1);
       memset(p1, 0xab, 135176);

       free(p1);
       p2 = calloc(4097, 1);
       printf("P2 = %p %p\n", p2, p2 + 4097);

       for (i = 0; i < 4097; i++) {
	       if (p2[i] != 0)
		       printf("miscompare at byte %d got %x\n", i, p2[i]);

       free(p2);
       printf("END MALLOC TEST\n\n");
...

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Tested-by: Wolfgang Denk <wd@denx.de>
2010-11-17 22:06:40 +01:00
Sebastien Carlier 6d8962e814 Switch from archive libraries to partial linking
Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils.  As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o".  This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols.  Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
2010-11-17 21:02:18 +01:00
Peter Tyser 983eb9d162 pci: Clean up PCI info when CONFIG_PCI_SCAN_SHOW
This change does the following:
- Removes the printing of the PCI interrupt line value.  This is
  normally set to 0 by U-Boot on bootup and is rarely used during
  everyday operation.

- Prints out the PCI function number of a device.  Previously a device
  with multiple functions would be printed identically 2 times, which is
  generally confusing.  For example, on an Intel 2 port gigabit Ethernet
  card the following was displayed:
    ...
    04  01  8086  1010  0200  00
    04  01  8086  1010  0200  00
    ...

- Prints a text description of each device's PCI class instead of the
  raw PCI class code.  The textual description makes it much easier to
  determine what devices are installed on a PCI bus.

- Changes the general formatting of the PCI device output.

Previous output:
  PCIE1: connected as Root Complex
          04  01  8086  1010  0200  00
          04  01  8086  1010  0200  00
          03  00  10b5  8112  0604  00
          02  01  10b5  8518  0604  00
          02  02  10b5  8518  0604  00
          08  00  1957  0040  0b20  00
          07  00  10b5  8518  0604  00
          09  00  10b5  8112  0604  00
          07  01  10b5  8518  0604  00
          07  02  10b5  8518  0604  00
          06  00  10b5  8518  0604  00
          02  03  10b5  8518  0604  00
          01  00  10b5  8518  0604  00
  PCIE1: Bus 00 - 0b
  PCIE2: connected as Root Complex
          0d  00  1957  0040  0b20  00
  PCIE2: Bus 0c - 0d

Updated output:
  PCIE1: connected as Root Complex
          04:01.0 - 8086:1010 - Network controller
          04:01.1 - 8086:1010 - Network controller
          03:00.0 - 10b5:8112 - Bridge device
          02:01.0 - 10b5:8518 - Bridge device
          02:02.0 - 10b5:8518 - Bridge device
          08:00.0 - 1957:0040 - Processor
          07:00.0 - 10b5:8518 - Bridge device
          09:00.0 - 10b5:8112 - Bridge device
          07:01.0 - 10b5:8518 - Bridge device
          07:02.0 - 10b5:8518 - Bridge device
          06:00.0 - 10b5:8518 - Bridge device
          02:03.0 - 10b5:8518 - Bridge device
          01:00.0 - 10b5:8518 - Bridge device
  PCIE1: Bus 00 - 0b
  PCIE2: connected as Root Complex
          0d:00.0 - 1957:0040 - Processor
  PCIE2: Bus 0c - 0d

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2010-11-14 23:46:46 +01:00
Lei Wen 6d1d51b32b env_mmc: fix compile warning
hexport would complain implicit declaration, if we don't add the
include file.

env_mmc.c: In function 'saveenv':
env_mmc.c:109: warning: implicit declaration of function 'hexport'

Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-11-14 23:28:21 +01:00
Stefano Babic 590084a2f7 env_sf: remove warning introduced with last patch
Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-29 23:07:59 +02:00
Wolfgang Denk a9aa392629 Drop support for CONFIG_SYS_ARM_WITHOUT_RELOC
When this define was introduced, the idea was to provide a soft
migration path for ARM boards to get adapted to the new relocation
support.  However, other recent changes led to a different
implementation (ELF relocation), where this no longer works.  By now
CONFIG_SYS_ARM_WITHOUT_RELOC does not only not help any more, but it
actually hurts because it obfuscates the actual code by sprinkling it
with lots of dead and non-working debris.

So let's make a clean cut and drop CONFIG_SYS_ARM_WITHOUT_RELOC.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-10-29 21:39:59 +02:00
Wolfgang Denk 2e5167ccad Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOC
By now, the majority of architectures have working relocation
support, so the few remaining architectures have become exceptions.
To make this more obvious, we make working relocation now the default
case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-10-29 21:32:07 +02:00
Enric Balletbo i Serra 57ff9f2421 cmd_onenand.c: Fix command usage help.
Running the onenand command without arguments does nothing, with this
patch shows the command usage.

Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
2010-10-27 20:51:22 +02:00
Stefano Babic a3110f01c4 env_sf: updated to the new environment code
Functions to store/retrieve the environment from a SPI flash was not updated
to the new environment code. The non-redundant case was
not working correctly, reporting ""Environment SPI flash not initialized"
and the code was not compiled clean in the redundant case.

The patch fixes these issue and makes the code more coherent
with other environment storage (nand, flash).

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-27 20:30:23 +02:00
Wolfgang Denk ec5c04cdb5 Revert "cmd_net: drop spurious comma in U_BOOT_CMD"
This commit causes build errors like this:

cmd_net.c:301:1: error: macro "U_BOOT_CMD" requires 6 arguments, but only 5 given
cmd_net.c:298: warning: data definition has no type or storage class
cmd_net.c:298: warning: type defaults to 'int' in declaration of 'U_BOOT_CMD'

This reverts commit 8f4cb77ef7.
2010-10-27 20:13:46 +02:00
Mike Frysinger 8f4cb77ef7 cmd_net: drop spurious comma in U_BOOT_CMD
Building for boards that have CONFIG_CMD_CDP enabled fail with:
cmd_net.c:301: error: expected expression before ',' token

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-26 21:14:55 +02:00
Wolfgang Denk 25ddd1fb0a Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value
CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not
being able to use "sizeof(struct global_data)" in assembler files.
Recent experience has shown that manual synchronization is not
reliable enough.  This patch renames CONFIG_SYS_GBL_DATA_SIZE into
GENERATED_GBL_DATA_SIZE which gets automatically generated by the
asm-offsets tool.  In the result, all definitions of this value can be
deleted from the board config files.  We have to make sure that all
files that reference such data include the new <asm-offsets.h> file.

No other changes have been done yet, but it is obvious that similar
changes / simplifications can be done for other, related macro
definitions as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
2010-10-26 21:05:30 +02:00
Enric Balletbo i Serra cdb1d4f97e ARM: fix relocation support for onenand device.
We also have to relocate the onenand command table manually, otherwise
onenand command don't work.

Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
2010-10-23 22:55:47 +02:00
Kumar Gala c4b115f536 hwconfig: Utilize getenv_f before relocation to allow for larger buffer
Since we use hwconfig in cases before relocation (like getting DDR
params on FSL PPC systems), we can have strings that exceed the early
small (32 byte) buffer size that getenv will handle.

So we explicitly allocate our own buffer on the stack and use if to
handle getting the hwconfig env string.  We currently utilize a string
length of 128 bytes.

This allows us to get rid of boot messages like:

env_buf too small [32]

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-10-23 22:10:54 +02:00
Peter Tyser 3f7ffa440a env_flash: Disable debug print statements
With debug the follow is printed:
  => saveenv
  Saving Environment to Flash...
  Data to save 0x18000
  Data (start 0xfff48000, len 0x18000) saved at 0x7fe63f20
  Protect off FFF40000 ... FFF5FFFF
  Un-Protected 1 sectors
  Erasing Flash...
  . done
  Erased 1 sectors
  Writing to Flash... Restoring the rest of data to 0xfff48000 len 0x18000
  done
  Protected 1 sectors
  =>

Without debug:
  => saveenv
  Saving Environment to Flash...
  Un-Protected 1 sectors
  Erasing Flash...
  . done
  Erased 1 sectors
  Writing to Flash... done
  Protected 1 sectors
  =>

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2010-10-23 22:10:14 +02:00
Wolfgang Denk f2b382ea06 Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx 2010-10-23 21:59:42 +02:00
Mike Frysinger 2ff1228542 usb_storage: constify us_direction lookup table
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-22 21:41:46 +02:00
John Schmoller 96d6160324 pci: Add ability to re-enumerate PCI buses
Add a new 'pci enum' command which re-enumerates the PCI buses.  This
command is enabled via the CONFIG_CMD_PCI_ENUM define and can be useful
in boards with FPGAs connected via PCI/PCIe, boards that support PCI
hot-plugging, or during PCI debug.

Also enable the 'pci enum' command for X-ES's Freescale-based boards.

Signed-off-by: John Schmoller <jschmoller@xes-inc.com>
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Wolfgang Denk <wd@denx.de>
2010-10-22 02:17:12 -05:00
Timur Tabi 43b08af53e always relocate fdt into an lmb-allocated memory block
The device tree (fdt) must always exist in within the bootmap (usually the
first 16MB of RAM).  If it doesn't, then boot_relocate_fdt() will allocate
an LMB region in the bootmap and copy the fdt into that region.  It will
also increase the size of the fdt.

If the fdt is already in the bootmap, then previously the memory was just
reserved.  There was no contingency if the reservation failed, however.

By always allocating an lmb region and copying/resizing the fdt into that
region, the code is simplified and the memory region is always allocated
properly.

Also change the types of some variables to avoid some typecasts.

Signed-off-by: Timur Tabi <timur@freescale.com>
Tested-by: Ira Snyder <iws@ovro.caltech.edu>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-10-20 02:28:00 -05:00
Wolfgang Denk 70994c79ca common/fdt_support.c: Fix compile warnings
Commit a6bd9e8 "FDT: Add fixup support for multiple banks of memory"
removed code but forgot to remove the variables used by it, resulting
in warnings:

fdt_support.c: In function 'fdt_fixup_memory_banks':
fdt_support.c:399: warning: unused variable 'sizecell'
fdt_support.c:399: warning: unused variable 'addrcell'

Remove the declarations, too.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-10-20 08:59:16 +02:00
Wolfgang Denk b18815752f Merge branch 'master' of git://git.denx.de/u-boot-arm 2010-10-20 00:10:07 +02:00
Stefano Babic a790b5b232 cmd_fpga: cleanup help and check parameters
The usage and help for the fpga command is wrong and incomplete,
and the parameters are not checked before to be passed to the
underlying subfunction.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-19 23:52:45 +02:00
Marek Vasut dd88d79e31 common: Enable serial for PXA250
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
2010-10-19 22:46:59 +02:00
John Rigby fca43cc801 boot: change some arch ifdefs to feature ifdefs
The routines boot_ramdisk_high, boot_get_cmdline and boot_get_kbd
are currently enabled by various combinations of CONFIG_M68K,
CONFIG_POWERPC and CONFIG_SPARC.

Use CONFIG_SYS_BOOT_<FEATURE> defines instead.

CONFIG_SYS_BOOT_RAMDISK_HIGH
CONFIG_SYS_BOOT_GET_CMDLINE
CONFIG_SYS_BOOT_GET_KBD

Define these as appropriate in arch/include/asm/config.h files.

Signed-off-by: John Rigby <john.rigby@linaro.org>
Acked-by: Wolfgang Denk <wd@denx.de>
2010-10-18 22:53:32 +02:00
John Rigby 5a75e12107 FDT: only call boot_get_fdt from generic code
All arches except nios2 and microblaze call boot_get_fdt
from bootm_start in common/cmd_bootm.c.

Having nios2 and microblaze do so as well removes code from
their respective do_bootm_linux routines and allows removal of
a nasty ifdef from bootm_start.

In the case where boot_get_fdt returns an error bootm_start
returns and the platform specific do_bootm_linux routines
will never get called.

Also only check argv[3] for an fdt addr if argc > 3 first.
This is already the case for nios2.

Signed-off-by: John Rigby <john.rigby@linaro.org>
CC: Scott McNutt <smcnutt@psyent.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Thomas Chou <thomas@wytron.com.tw>
Acked-by: Wolfgang Denk <wd@denx.de>
Acked-by: Michal Simek <monstr@monstr.eu>
Tested-by: Thomas Chou <thomas@wytron.com.tw>
2010-10-18 22:52:10 +02:00
John Rigby a6bd9e83ab FDT: Add fixup support for multiple banks of memory
Add fdt_fixup_memory_banks and reimplement fdt_fixup_memory
using it.  Tested on OMAP3 beagle board with two banks of
memory.

Signed-off-by: John Rigby <john.rigby@linaro.org>
CC: Jerry Van Baren <vanbaren@cideas.com>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-10-18 22:50:53 +02:00
John Rigby d1263fced2 common/image.c remove extra calls to be32_to_cpu in boot_get_fdt
fdt_totalsize returns size in cpu endian so don't call be32_to_cpu
on the result.  This was harmless on big endian platforms but not
on little endian ARMs.

Signed-off-by: John Rigby <john.rigby@linaro.org>
2010-10-18 22:50:17 +02:00
John Rigby 758b39979d common/image.c fix length calculation in boot_relocate_fdt
boot_relocate_fdt is called on platforms with CONFIG_SYS_BOOTMAPSZ
defined to relocate the device tree blob to be inside the
boot map area between bootmap_base and bootmap_base+CONFIG_SYS_BOOTMAPSZ.

For the case where the blob needs to be relocated, space is
allocated inside the bootmap by calling lmb_alloc_base with
size passed in plus some padding:

    of_len = *of_size + CONFIG_SYS_FDT_PAD;

For the case where the blob is already inside the bounds of the boot map
area, lmb_reserve is called to reserve the the space where the blob is
already residing.  The calculation for this case is currently:

    of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;

This is wrong because it reserves all the space in the boot map area
from the blob to the end ignoring completely the actual size. The
worst case is where the blob is at the beginning and the entire boot map
area get reserved. Fix this by changing the length calculation to this:

    of_len = *of_size + CONFIG_SYS_FDT_PAD;

This bug has likely never manifested itself because bootm has never
been called with the fdt blob already in the bootmap area.  In my
testing on an OMAP3 beagle board I initially worked around the bug
by simply moving the initial location of the fdt blob.  I have tested
with the new calculation with the fdt blob both inside and outside
the boot map area.

Signed-off-by: John Rigby <john.rigby@linaro.org>
2010-10-18 22:49:47 +02:00
Joakim Tjernlund 1ba91ba233 dlmalloc.c: Fix gcc alias warning
Fix these warnings:
dlmalloc.c: In function 'free':
dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
dlmalloc.c:2507: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules

Some page(http://blog.worldofcoding.com/2010/02/solving-gcc-44-strict-aliasing-problems.html)
suggests adding __attribute__((__may_alias__)). Doing so makes the warnings go away.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-10-18 22:44:31 +02:00
Scott Wood 16e00992d8 Fix warning in nand unlock command
Commit ea533c260a changed
arg_off_size to take a pointer to a device index, rather than
to the device itself.  When updating callers, the nand unlock
code was missed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
2010-10-18 14:54:08 -05:00
Wolfgang Denk cacc342d5a Merge branch 'master' of git://git.denx.de/u-boot-arm 2010-10-17 20:25:05 +02:00
Lei Wen e79f48393d env_mmc: fix cannot save env issue
The env change its implementation after this log, while env mmc
didn't change it immediately, which cause issue. Follow to the
new style to fix it.

commit ea882baf9c
Author: Wolfgang Denk <wd@denx.de>
Date:   Sun Jun 20 23:33:59 2010 +0200

    New implementation for internal handling of environment variables.

Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-10-13 22:02:32 +02:00
Steve Sakoman d470a6f60a env_mmc: Fix crashing bug encountered after enabling ARM relocation
The crash was occuring in env_relocate because it was being called prior
to mmc_initialize.  This patch moves the MMC initialization earlier in
the init process.

This patch also cleans up the env_relocate_spec code in env_mmc.c

Signed-off-by: Steve Sakoman <steve.sakoman@linaro.org>
Acked-by: Stefano Babic <sbabic@denx.de>
2010-10-13 21:52:13 +02:00
Wolfgang Denk 9de9932693 Merge branch 'master' of git://git.denx.de/u-boot-usb 2010-10-13 20:57:34 +02:00
Matthew McClintock cb2707af7a common/fdt_support.c: fix compile error
Fix build error introduced in beca5a5f5b

common/libcommon.a(fdt_support.o): In function `fdt_add_edid':
/local/hudson/jobs/mirrors-u-boot.git/workspace/common/fdt_support.c:1205: undefined reference to `fdt_increase_size'
make: *** [u-boot] Error 1

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-10-13 20:25:33 +02:00
Ludovic Courtès 99e9ed1f49 usb: Add support for multiple-LUN mass storage devices
This patch changes `usb_stor_scan' to scan all the LUNs of each mass
storage device.  It also fixes the various commands to correctly set
the LUN field.

Notably, it allows each LUN of GuruPlug's microSD card reader to be
accessed.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
2010-10-13 12:07:58 +02:00
Brent Darley 076f1be8e1 TSI148: Fix argument parsing
This patch does 2 things:
 - Fix the argument number assigned to the vdw (VME data width) value.
   Previously, a nonexistent 7th arument was read as the vdw variable.

 - Reduce the size of the argument array for the tsi148 command from
   8 to 7.  The tsi148 command itself is argument index 0, and the
   maximum number arguments passed to the command is 6, making a total
   of 7 for the array.

Signed-off-by: Brent Darley <bdarley@xes-inc.com>
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2010-10-12 23:31:10 +02:00
Stefan Roese eaadb44edf cp/cmp: Add WATCHDOG_RESET in copy and compare loop
On some boards with a very short watchdog timeout, the "cp" and
"cmp" commands may reset the board. This patch adds some
watchdog resets inside the loops. Otherwise for example the lwmon5
board will reset while doing something like this:

=> cp.b fc000000 1000000 100000

Signed-off-by: Stefan Roese <sr@denx.de>
2010-10-12 22:50:19 +02:00
Ilya Yanok 7f0d241d5c led_display: split led display support into generic and hw-dependent parts
Split the display command into generic interface and hardware-specific
realization for PDSP188x LED display found on hmi1001 and manroland
boards. Simple interface for LED displays is defined in
include/led-display.h and described in doc/README.LED_display.
Driver-specific implementation was moved into drivers/misc/pdsp188x.c
file (enabled with CONFIG_PDSP188x set).

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
2010-10-12 22:44:33 +02:00
Lei Wen d259079d6d env: don't set to default env twice when use CONFIG_ENV_IS_NOWHERE
When use the CONFIG_ENV_IS_NOWHERE, I met such issue:

	DRAM:  256 MiB
	Using default environment

	*** Warning - bad CRC, using default environment

Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-10-12 21:31:04 +02:00
Anatolij Gustschin beca5a5f5b fdt_support: support adding EDID property to FDT display nodes
Boards can pass display timing info for drivers using EDID
block. Provide common function to add board specific EDID
data to the device tree. Subsequent patch makes use of this
functionality.

Detailed timing descriptor data from EDID is used for
programming the display controller. This is currently
implemented on the Linux side by the fsl-diu-fb frame
buffer driver and it is documented there in
Documentation/powerpc/dts-bindings/fsl/diu.txt.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
Cc: Gerald Van Baren <vanbaren@cideas.com>
2010-10-12 21:05:58 +02:00
Alexander Stein c000808b6a CONFIG_CMD_JFFS2 is not necessary to use mtdparts on erase & protect on/off
The include <jffs2/jffs2.h> is still necessary though.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Acked-by: Stefan Roese <sr@denx.de>
2010-10-12 21:02:55 +02:00
Wolfgang Denk 0ee8746a93 Merge branch 'master' of git://git.denx.de/u-boot-net 2010-10-12 20:44:46 +02:00
Peter Tyser bf6cb247a5 rarp: Condtionally compile rarp support
Most people don't use the 'rarpboot' command, so only enable it when
CONFIG_CMD_RARP is defined.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-10-11 23:00:29 -07:00
Scott Wood 36650ca9f1 Followup fixes on the mtdparts spread patchset
Consolidate some code in mtd_get_len_incl_bad(), and fix a condition
where a valid partition could be reported as truncated if it has a
good block at the end of the device (unlikely, since the BBT is usually
there).

Fix mid-block declarations in net_part_size().

Signed-off-by: Scott Wood <scottwood@freescale.com>
Reviewed-by: Ben Gardiner <bengardiner@nanometrics.ca>
2010-10-11 15:11:01 -05:00
Ben Gardiner 59a50d2de1 mtdparts: new add.spread: add part skipping bad blocks
This patch adds a new 'mtdparts add' variant: add.spread. This command variant
adds a new partition to the mtdparts variable but also increases the partitions
size by skipping bad blocks and aggregating any additional bad blocks found at
the end of the partition.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Wolfgang Denk <wd@denx.de>
CC: Scott Wood <scottwood@freescale.com>
2010-10-11 15:11:01 -05:00
Ben Gardiner ca75b20ebb mtdparts: add new sub-command "spread"
This patch introduces the 'spread' sub-command of the mtdparts command.
This command will modify the existing mtdparts variable by increasing
the size of the partitions such that 1) each partition's net size is at
least as large as the size specified in the mtdparts variable and 2)
each partition starts on a good block.

The new subcommand is implemented by iterating over the mtd device
partitions and collecting a bad blocks count in each -- including any
trailing bad blocks -- and then modifying that partitions's part_info
structure and checking if the modification affects the next partition.

This patch is based on a port of the 'dynnamic partitions' feature by
Harald Welte <laforge@gnumonks.org>; ported from commit
e05835df019027391f58f9d8ce5e1257d6924798 of
git://git.openmoko.org/u-boot.git. Whereas Harald's feature used a
compile-time array to specify partitions, the feature introduced by
this patch uses the mtdparts environment variable.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Signed-off-by: Harald Welte <laforge@gnumonks.org>
CC: Wolfgang Denk <wd@denx.de>
CC: Scott Wood <scottwood@freescale.com>
2010-10-11 15:11:01 -05:00
Ben Gardiner 04ac380288 mtdparts: show net size in mtdparts list
This patch adds an additional column to the output of list_partitions. The
additional column will contain the net size and a '(!)' beside it if the net
size is not equal to the partition size.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Wolfgang Denk <wd@denx.de>
CC: Scott Wood <scottwood@freescale.com>
2010-10-11 15:11:00 -05:00
Ben Gardiner 0a026d3e86 mtdparts: regroup calls to get_mtd_device_nm
The get_mtd_device_nm function is called in a couple places and the
string that is passed to it is not really used after the calls.

This patch regroups the calls to this function into a new function,
get_mtd_info.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Acked-by: Stefan Roese <sr@denx.de>
CC: Wolfgang Denk <wd@denx.de>
2010-10-11 15:11:00 -05:00
Scott Wood 8c5659a6da nand commands: make only "dump" repeatable.
The dump command is made to increment its address on repeat,
as md does.  Other commands do not make sense to issue repeatedly,
and can be irritating when it happens accidentally, so don't.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
2010-10-11 15:10:26 -05:00
Scott Wood 3048632251 nand erase: .spread, .part, .chip subcommands
A while back, in http://lists.denx.de/pipermail/u-boot/2009-June/054428.html,
Michele De Candia posted a patch to not count bad blocks toward the
requested size to be erased.  This is desireable when you're passing in
something like $filesize, but not when you're trying to erase a partition.

Thus, a .spread subcommand (named for consistency with
http://lists.denx.de/pipermail/u-boot/2010-August/075163.html) is introduced
to make explicit the user's desire to erase for a given amount of data,
rather than to erase a specific region of the chip.

While passing $filesize to "nand erase" is useful, accidentally passing
something like $fliesize currently produces quite unpleasant results, as the
variable evaluates to nothing and U-Boot assumes that you want to erase
the entire rest of the chip/partition.  To improve the safety of the
erase command, require the user to make explicit their intentions by
using a .part or .chip subcommand.  This is an incompatible user interface
change, but keeping compatibility would eliminate the safety gain, and IMHO
it's worth it.

While touching nand_erase_opts(), make it accept 64-bit offsets and sizes,
fix the percentage display when erase length is rounded up, eliminate
an inconsistent warning about rounding up the erase length which only
happened when the length was less than one block (rounding up for $filesize
is normal operation), and add a diagnostic if there's an attempt to erase
beginning at a non-block boundary.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
2010-10-11 15:10:17 -05:00
Scott Wood ea533c260a cmd_nand: some infrastructure fixes and refactoring
- If the current device is overridden by a named partition,
  - update the caller's pointer/index, rather than copy over the
    nand_info struct, and
  - be sure to call board_nand_select_device even when the device
    is overridden by a named partition.
- Support 64-bit offsets/sizes in a few more places.
- Refactor arg_off_size for added readability and flexibility,
  and some added checks such as partition size.
- Remove redundant check for bad subcommands -- if there's no match
  it'll print usage when it gets to the end anyway.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
2010-10-11 15:09:54 -05:00
Wolfgang Denk bfc7bea6ad Merge branch 'master' of git://git.denx.de/u-boot-x86 2010-10-11 10:00:34 +02:00
Wolfgang Denk 02b117d42b Merge branch 'sf' of git://git.denx.de/u-boot-blackfin 2010-10-11 09:52:16 +02:00