Commit Graph

1581 Commits

Author SHA1 Message Date
Heiko Schocher 620f1f6a64 relocation: fixup cmdtable
fixup_cmdtable() did all work for fixing up the cmdtable,
if CONFIG_RELOC_FIXUP_WORKS is not defined.

CONFIG_RELOC_FIXUP_WORKS is missing for i386! I talked
with Graeme Russ, and he will fix this soon.

Portions of this work were supported by funding from
the CE Linux Forum.

Signed-off-by: Heiko Schocher <hs@denx.de>
2010-09-19 19:29:51 +02:00
Heiko Schocher 55e97429d1 arm: get rid of bi_env
bi_env is nowhere used, so delete it!

Signed-off-by: Heiko Schocher <hs@denx.de>

similar patch posted from Dirk Behme Tue Jul 27 18:36:09 CEST 2010
http://lists.denx.de/pipermail/u-boot/2010-July/074542.html
2010-09-19 19:29:50 +02:00
Wolfgang Denk ea882baf9c New implementation for internal handling of environment variables.
Motivation:

* Old environment code used a pessimizing implementation:
  - variable lookup used linear search => slow
  - changed/added variables were added at the end, i. e. most
    frequently used variables had the slowest access times => slow
  - each setenv() would calculate the CRC32 checksum over the whole
    environment block => slow
* "redundant" envrionment was locked down to two copies
* No easy way to implement features like "reset to factory defaults",
  or to select one out of several pre-defined (previously saved) sets
  of environment settings ("profiles")
* No easy way to import or export environment settings

======================================================================

API Changes:

- Variable names starting with '#' are no longer allowed

  I didn't find any such variable names being used; it is highly
  recommended to follow standard conventions and start variable names
  with an alphanumeric character

- "printenv" will now print a backslash at the end of all but the last
  lines of a multi-line variable value.

  Multi-line variables have never been formally defined, allthough
  there is no reason not to use them. Now we define rules how to deal
  with them, allowing for import and export.

- Function forceenv() and the related code in saveenv() was removed.
  At the moment this is causing build problems for the only user of
  this code (schmoogie - which has no entry in MAINTAINERS); may be
  fixed later by implementing the "env set -f" feature.

Inconsistencies:

- "printenv" will '\\'-escape the '\n' in multi-line variables, while
  "printenv var" will not do that.

======================================================================

Advantages:

- "printenv" output much better readable (sorted)
- faster!
- extendable (additional variable properties can be added)
- new, powerful features like "factory reset" or easy switching
  between several different environment settings ("profiles")

Disadvantages:

- Image size grows by typically 5...7 KiB (might shrink a bit again on
  systems with redundant environment with a following patch series)

======================================================================

Implemented:

- env command with subcommands:

  - env print [arg ...]

    same as "printenv": print environment

  - env set [-f] name [arg ...]

    same as "setenv": set (and delete) environment variables

    ["-f" - force setting even for read-only variables - not
    implemented yet.]

  - end delete [-f] name

    not implemented yet

    ["-f" - force delete even for read-only variables]

  - env save

    same as "saveenv": save environment

  - env export [-t | -b | -c] addr [size]

    export internal representation (hash table) in formats usable for
    persistent storage or processing:

	-t:	export as text format; if size is given, data will be
		padded with '\0' bytes; if not, one terminating '\0'
		will be added (which is included in the "filesize"
		setting so you can for exmple copy this to flash and
		keep the termination).
	-b:	export as binary format (name=value pairs separated by
		'\0', list end marked by double "\0\0")
	-c:	export as checksum protected environment format as
		used for example by "saveenv" command
	addr:	memory address where environment gets stored
	size:	size of output buffer

	With "-c" and size is NOT given, then the export command will
	format the data as currently used for the persistent storage,
	i. e. it will use CONFIG_ENV_SECT_SIZE as output block size and
	prepend a valid CRC32 checksum and, in case of resundant
	environment, a "current" redundancy flag. If size is given, this
	value will be used instead of CONFIG_ENV_SECT_SIZE; again, CRC32
	checksum and redundancy flag will be inserted.

	With "-b" and "-t", always only the real data (including a
	terminating '\0' byte) will be written; here the optional size
	argument will be used to make sure not to overflow the user
	provided buffer; the command will abort if the size is not
	sufficient. Any remainign space will be '\0' padded.

        On successful return, the variable "filesize" will be set.
        Note that filesize includes the trailing/terminating '\0'
        byte(s).

        Usage szenario: create a text snapshot/backup of the current
	settings:

		=> env export -t 100000
		=> era ${backup_addr} +${filesize}
		=> cp.b 100000 ${backup_addr} ${filesize}

	Re-import this snapshot, deleting all other settings:

		=> env import -d -t ${backup_addr}

  - env import [-d] [-t | -b | -c] addr [size]

    import external format (text or binary) into hash table,
    optionally deleting existing values:

	-d:	delete existing environment before importing;
		otherwise overwrite / append to existion definitions
	-t:	assume text format; either "size" must be given or the
		text data must be '\0' terminated
	-b:	assume binary format ('\0' separated, "\0\0" terminated)
	-c:	assume checksum protected environment format
	addr:	memory address to read from
	size:	length of input data; if missing, proper '\0'
		termination is mandatory

  - env default -f

    reset default environment: drop all environment settings and load
    default environment

  - env ask name [message] [size]

    same as "askenv": ask for environment variable

  - env edit name

    same as "editenv": edit environment variable

  - env run

    same as "run": run commands in an environment variable

======================================================================

TODO:

- drop default env as implemented now; provide a text file based
  initialization instead (eventually using several text files to
  incrementally build it from common blocks) and a tool to convert it
  into a binary blob / object file.

- It would be nice if we could add wildcard support for environment
  variables; this is needed for variable name auto-completion,
  but it would also be nice to be able to say "printenv ip*" or
  "printenv *addr*"

- Some boards don't link any more due to the grown code size:
  DU405, canyonlands, sequoia, socrates.

	=> cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>,
	       Stefan Roese <sr@denx.de>,
	       Heiko Schocher <hs@denx.de>

- Dropping forceenv() causes build problems on schmoogie

	=> cc: Sergey Kubushyn <ksi@koi8.net>

- Build tested on PPC and ARM only; runtime tested with NOR and NAND
  flash only => needs testing!!

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com>,
Cc: Stefan Roese <sr@denx.de>,
Cc: Heiko Schocher <hs@denx.de>
Cc: Sergey Kubushyn <ksi@koi8.net>
2010-09-19 19:29:48 +02:00
Wolfgang Denk 91a76751a0 Make getenv() work before relocation.
So far, getenv() would work before relocation is most cases, even
though it was not intended to be used that way.  When switching to a
hash table based implementation, this would break a number of boards.

For convenience, we make getenv() check if it's running before
relocation and, if so, use getenv_f() internally.

Note that this is limited to simple cases, as we use a small static
buffer (32 bytes) in the global data for this purpose.

For this reason, it is also not a good idea to convert all current
uses of getenv_f() into getenv() - some of the existing use cases need
to be able to deal with longer variable values, so getenv_f() is still
needed and recommended for use before relocation.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-09-19 19:29:48 +02:00
Wolfgang Denk 6d014adfa2 Remove support for CONFIG_HAS_UID and "forceenv" command
This (undocumented) concept was only in use for the MVSMR and
davinci_schmoogie Sergey Kubushyn <ksi@koi8.net> boards.
Drop it for now.  If really needed, it should be reimplemented
later in the context of the new environment command set.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Andre Schwarz <andre.schwarz@matrix-vision.de>
Cc: Sergey Kubushyn <ksi@koi8.net>
Acked-by: Sergey Kubushyn <ksi@koi8.net>
2010-09-19 19:29:47 +02:00
Terry Lv a80603598c Save environment data to mmc.
This patch is to save environment data to mmc card.
It uses interfaces defined in generic mmc.

Signed-off-by: Terry Lv <r65388@freescale.com>
Acked-by: Stefano Babic <sbabic@denx.de>
2010-09-19 17:47:29 +02:00
Lei Wen 8f3b96427a mmc: print out partition table
Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-09-18 23:47:28 +02:00
Graeme Russ a806ee6fae x86: Add do_bdinfo()
x86 failed to compile with a message "a case for this architecture does
not exist!" - Add do_bdinfo() for this arch
2010-09-13 07:20:02 +10:00
Wolfgang Denk 2d941de9d5 Prepare v2010.09-rc1
Coding style cleanup.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-09-10 00:16:19 +02:00
Wolfgang Denk 09b4a9cf40 Merge branch 'master' of git://git.denx.de/u-boot-samsung 2010-09-08 00:03:22 +02:00
Wolfgang Denk f91506e283 Merge branch 'master' of /home/wd/git/u-boot/master 2010-09-07 22:19:49 +02:00
Wolfgang Denk 1b43b5d7a6 Merge branch 'master' of git://git.denx.de/u-boot-sh 2010-09-07 21:49:47 +02:00
Wolfgang Denk 67bd94148e Merge branch 'master' of git://git.denx.de/u-boot-i2c 2010-09-07 21:28:20 +02:00
Nobuhiro Iwamatsu ebd0d062ac sh: Add support do_bdinfo function
SH did not support do_bdinfo fuction.
This code based avr32 stuff.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
2010-08-30 17:02:49 +09:00
Minkyu Kang 889a275d42 ARMV7: S5P: rename from CONFIG_S5PC1XX to CONFIG_S5P
Use the same configuration around S5P SoCs.
(s5pc100, s5pc110, s5pc210 and so on)

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2010-08-26 17:33:23 +09:00
Reinhard Meyer 7a92e53cd0 CMD_I2C: make alen=0 work
Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-08-26 08:33:24 +02:00
Scott Wood 6395f318e9 fdt: call fdt_parent_offset fewer times while translating addresses
fdt_parent_offset() is an expensive operation, so we'd like to reduce
unnecessary calls to it.

Further, the practice of iterating up to the root if address/size cells
aren't found was apparently done for Linux for compatibility with certain
buggy Open Firmware implementations, and U-Boot inherited the code.  The
compliant behavior is to treat a missing #address-cells as 2, and a missing
#size-cells as 1 -- never looking anywhere but the immediate parent of the
node of interest.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-08-19 21:21:41 -05:00
Wolfgang Denk 5549d22b65 Merge branch 'master' of /home/wd/git/u-boot/master 2010-08-18 21:19:00 +02:00
Mike Frysinger 962ad59e25 env_nand: return error when no device is found
Currently, if there is an error probing the NAND chip and the env is based
in NAND, the readenv() function will use a NULL function pointer and thus
jump to address 0.

Here I just check for a non-zero value of blocksize as that shouldn't be
zero when a valid device is found, but perhaps there is a better way for
someone familiar with the NAND internals to suggest.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
2010-08-13 13:32:42 -05:00
Wolfgang Denk ae37a0704a Merge branch 'master' of git://git.denx.de/u-boot-ti 2010-08-12 23:08:05 +02:00
Sergei Poselenov 842404ea07 Fixed clobbered output of the "help usb" command
The "usb help" doesn't format the output correctly:

=> help usb
usb - USB sub-system

Usage:
usb reset - reset (rescan) USB controller
usb stop [f]  - stop USB [f]=force stop
usb tree  - show USB device tree
usb info [dev] - show available USB devices
usb storage  - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
    to memory address `addr'usb write addr blk# cnt - write `cnt'
blocks starting at block `blk#' from memory address `addr'
=>

With fix below applied, the output is correct:

=> help usb
usb - USB sub-system

Usage:
usb reset - reset (rescan) USB controller
usb stop [f]  - stop USB [f]=force stop
usb tree  - show USB device tree
usb info [dev] - show available USB devices
usb storage  - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
    to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'
    from memory address `addr'
=>

Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
2010-08-12 16:40:00 +02:00
Matthias Weisser 6052ac8386 ARM: Add support for MB86R0x SoCs
Signed-off-by: Matthias Weisser <weisserm@arcor.de>
2010-08-10 23:13:28 +02:00
Wolfgang Denk b9d51fbb18 Merge branch 'master' of git://git.denx.de/u-boot-arm 2010-08-10 23:03:15 +02:00
Wolfgang Denk b77f380115 Merge branch 'master' of git://git.denx.de/u-boot-imx 2010-08-10 22:49:09 +02:00
Wolfgang Denk fe8d63c8c7 Merge branch 'master' of git://git.denx.de/u-boot-marvell 2010-08-10 22:37:27 +02:00
Reinhard Meyer a9804be868 fix cmd_mmc.c, line 136 missing "
Remove warning for missing " at the end of line 136

Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-08-10 09:43:26 +02:00
Mike Frysinger ede16ea32d miiphy: leverage current_mii cache more
For code that uses miiphy_{read,write}, every call invokes a full look up
of the mii list.  There is already a "current_mii" cache that is used by
some code, but have the miiphy_{read,write} function use it as well.  This
does increase the code size slightly, but I think it's worth it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-08-09 11:52:30 -07:00
Mike Frysinger 0daac97801 miiphy: unify device list lookup
Rather than have every func re-implement the list walking code, do it one
local function.  This shrinks the resulting object code a little while
making the source much more manageable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-08-09 11:52:29 -07:00
Mike Frysinger 5700bb6352 miiphy: constify device name
The driver name does not need to be writable, so constify it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-08-09 11:52:29 -07:00
Feng Wang 3840ebfaf8 fdt: Fix bug in size calculation in fdt_resize() with initrd use
Original bug description from Feng (fdt_resize() bug caused "WARNING:
could not set linux, initrd-start FDT_ERR_NOSPACE."):

What I got is an error: "WARNING: could not set linux,initrd-start
FDT_ERR_NOSPACE." after loading Device Tree blob. This in turn caused
linux to miss init part.

After some digging, I found out the reason for this error, it is caused
by fdt_resize().

FDT blob got resized after filling in all board specific information of
PowerPC. (in boot_body_linux()). It reduced blob size with only extra
space for two fdt_reserve_entry, one for fdt itself, and one for initrd.
Then it's aligned to a 0x1000 page boundary. However, later in
fdt_initrd(), it could add two more properties, initrd-start AND
initrd-end, each one needs at least two fdt_reserve_entry sizes done by
_fdt_add_property() (name and value). Thus, the two fdt_reserve_entry
extra space is not sufficient.

So for some specific fdt size which is just under the page boundary
after resizing, this will cause an error of FDT_ERR_NOSPACE in
fdt_initrd() when setting those two properties, and failed to pass
initrd information to linux.

My fix is in fdt_resize(), leave at least 4 fdt_reserve_entry for
initrd. So instead of 2*sizeof(struct fdt_reserve_entry) for
actual_totalsize, use 5*sizeof(struc fdt_reserve_entry).

Stefan: I got this same error on katmai, when trying to boot with
initrd (run flash_self). This patch fixes this issue.

Signed-off-by: Feng Wang <fwang02@harris.com>
Tested-by: Stefan Roese <sr@denx.de>
Cc: Jerry Van Baren <gvb.uboot@gmail.com>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-08-09 01:10:30 +02:00
Frans Meulenbroeks 388a29d024 various cmd_* files: fixed layout a little bit
Most of the files have U_BOOT_CMD on a separate line,
but a few didn't and had the first line on the same line
as U_BOOT_CMD.

This changes these files by adding a line break and a tab

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-08-09 01:07:37 +02:00
Frans Meulenbroeks cc9f607beb various cmd_* files: remove the command name from the help message
removed the command name from the help message as it is already printed.
for cmd_mmc also rewrote the message a little bit

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-08-09 01:06:34 +02:00
Mike Frysinger a4e8d9f5f9 flash_protect: check for NULL flash info
If a flash is unable to be detected, and then someone calls flash_protect
on it (like the common code does in flash_init), the flash_protect logic
will dereference a NULL pointer.

Since flash_protect already does sanity checking on the info structs, add
a NULL pointer check in there.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-09 01:03:54 +02:00
Wolfgang Denk 9ed4a9582f getenv_f(): fix handling of too short buffers
Fix error handling in getenv_f() when the user provided buffer is too
short to hold the variable name; make sure to truncate and
NUL-terminate without overwriting the buffer limits.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-08-09 00:53:57 +02:00
Mike Frysinger 739b8080af dataflash mmc mux: use common cmd_usage function
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-09 00:32:26 +02:00
Mike Frysinger a7481b353b mflash: use common cmd_usage function
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-09 00:32:06 +02:00
Mike Frysinger 8faba4894c cmd editing: optimize/shrink output blanking
No need to output spaces 1 char at a time in a loop when the printf code
can do the same thing with the right format string.  This shrinks things
and gives a nice speed up when killing off lines more than a byte or two
as printf will send out the buffer in one big chunk.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-09 00:26:04 +02:00
Stephan Linz 958e120643 fdt relocate: have more attention to use a bootmap or not
Platforms with flat device tree support can use a bootmap to relocate
the fdt_blob. This is not a must. That's why the relocation function
boot_relocate_fdt() should be use only if CONFIG_OF_LIBFDT was defined
together with CONFIG_SYS_BOOTMAPSZ (see common/cmd_bootm.c).

On MicroBlaze platforms there is no need to use a bootmap to relocate
a fdt blob. So we need a more precise focus on the compilation and usage
of boot_relocate_fdt().

In general it is valid to exclude the function boot_relocate_fdt() if
the bootmap size CONFIG_SYS_BOOTMAPSZ is not defined.

Signed-off-by: Stephan Linz <linz@li-pro.net>
2010-08-08 22:16:05 +02:00
Prafulla Wadaskar 5f30500316 cmd_ide: add support for Kirkwood
Added MVSATAC definitions to Kirkwood.
Added support for Kirkwood in cmd_ide.

Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
2010-08-08 05:17:55 +05:30
Albert Aribaud 113bfe48bc cmd_ide: add support for orion5x
Add MVSATAHC definitions to orion5x.
Add support for orion5x in cmd_ide.

Signed-off-by: Albert Aribaud <albert.aribaud@free.fr>
2010-08-08 05:17:06 +05:30
Albert Aribaud f2a37fcd9b ide: add configuration
CONFIG_IDE_SWAP_IO

This configuration option replaces a complex conditional
in cmd_ide.c with an explicit define to be added to SoC or
board configs.

Signed-off-by: Albert Aribaud <albert.aribaud@free.fr>
2010-08-08 05:17:05 +05:30
Matthias Weisser 60fdc5f2f0 LZMA and LZO causes compile error
If both LZMA and LZO compressions are used there is a compile error
in cmd_bootm.c

Signed-off-by: Matthias Weisser <weisserm@arcor.de>
2010-08-07 23:49:59 +02:00
Matthew McClintock c519facc64 Fix condition where bootm_size not set and wrong memory size reported
If the user sets bootm_low and does not set bootm_size, u-boot will
report the memory node in the flat device tree incorrectly. Instead
of reporting the remaining size of memory, it will report the total
available memory which is incorrect.

Specifically this fixes the situation when booting a relocatable
kernel and the memory is reported as an offset and size in the
device tree, and the size needs to be adjusted accordingly.

Signed-off-by: Matthew McClintock <msm@freescale.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
2010-08-07 21:55:03 +02:00
Wolfgang Denk cdb749778a Rename getenv_r() into getenv_f()
While running from flash, i. e. before relocation, we have only a
limited C runtime environment without writable data segment. In this
phase, some configurations (for example with environment in EEPROM)
must not use the normal getenv(), but a special function.  This
function had been called getenv_r(), with the idea that the "_r"
suffix would mean the same as in the _r_eentrant versions of some of
the C library functions (for example getdate vs. getdate_r, getgrent
vs. getgrent_r, etc.).

Unfortunately this was a misleading name, as in U-Boot the "_r"
generally means "running from RAM", i. e. _after_ relocation.

To avoid confusion, rename into getenv_f() [as "running from flash"]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
2010-08-04 00:45:36 +02:00
Mike Frysinger 78e1e84677 bootm: fix pointer warning with lzma
Avoid warning:
cmd_bootm.c: In function 'bootm_load_os':
cmd_bootm.c:394: warning: passing argument 2 of
	'lzmaBuffToBuffDecompress' from incompatible pointer type

For 32 bit systems, this change shouldn't make a difference to code size
since sizeof(size_t) and sizeof(unsigned int) are equal.  But it does fix
the warning.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-04 00:43:53 +02:00
Kumar Gala b4b847e951 fdt: Add function to alloc phandle values
If we are creating reference (handles) to nodes in a device tree we need
to first create a new phandle in node and this needs a new phandle
value.  So we search through the whole dtb to find the max phandle value
and return the next greater value for a new phandle allocation.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-07-26 13:07:56 -05:00
Wolfgang Denk 7385c28e9b fs/fat: Big code cleanup.
- reformat
- throw out macros like FAT_DPRINT and FAT_DPRINT
- remove dead code

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:54:46 +02:00
Wolfgang Denk 226fa9bb9e usb_storage.c: change progress output in debug() message
The dots printed by common/usb_storage.c as progress meter corrupt the
output for example of "fatls usb" commands like this:

=> fatls usb 0
.			<<==== here
       29   file.001
       29   file.002
       29   file.003
       29   file.004
       29   file.005
       29   file.006
       29   file.007
       29   file.008
       29   file.009
       29   file.010
       29   file.011
       29   file.012
       29   file.013
       29   file.014
       29   file.015
       29   file.016
.			<<==== here
       29   file.017
       29   file.018
       29   file.019
...

Turn the progress output into a debug message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
2010-07-24 20:53:50 +02:00
Wolfgang Denk a17c548b53 usb_storage.c: initialize device type
The device type was left uninitialized which caused later tests
against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would
attempt to print information about non-existent devices like this:

	=> usb part
	print_part of 0

	Partition Map for USB device 0  --   Partition Type: DOS

	Partition     Start Sector     Num Sectors     Type
	    1                    0         2031616      f8

	print_part of 1
	## Unknown partition table

	print_part of 2
	## Unknown partition table

	print_part of 3
	## Unknown partition table

	print_part of 4
	## Unknown partition table
	=>

By initializing the type as DEV_TYPE_UNKNOWN we avoid all the
"Unknown partition table" messages.

[Note: the "print_part of ?" messages is left over debug code that
will be removed in another patch.]

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
2010-07-24 20:45:39 +02:00
Wolfgang Denk 47e26b1bf9 cmd_usage(): simplify return code handling
Lots of code use this construct:

	cmd_usage(cmdtp);
	return 1;

Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by

	return cmd_usage(cmdtp);

This fixes a few places with incorrect return code handling, too.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:43:57 +02:00
Kumar Gala 75e73afd57 fdt: Add fdt_node_offset_by_compat_reg helper
Given a compatible string and physical address try and find a node that
matches.  This is useful when we want to find a specific device node to
update (for example if we have multiple PCI nodes we can use the
physical address to distinguish them when trying to update the device
tree).

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-07-20 04:40:06 -05:00
Kumar Gala a0342c0804 fdt: Add fdt_translate_address to convert reg node to cpu phys addr
This code is extracted out of the Linux Kernel code from
arch/powerpc/kernel/prom_parse.c.

We maintain some of the same structure to support multiple bus types even
though we only have one in the current code.  In the future we might want
to translate across a PCI bus and thus it will be easier to add that
functionality back in.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-07-20 04:40:00 -05:00
Wolfgang Denk 0fe247b973 Drop support for GTH board
The board maintainer states:

    The GTH board is obsolete and has not been manufactured for
    several years.
    To my knowledge, no recent U-Boot build has been tested on that
    card.

So drop support for this board.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Thomas Lange <thomas@corelatus.se>
Acked-by: Thomas Lange<thomas@corelatus.se>
2010-07-17 20:47:08 +02:00
Wolfgang Denk b6c208ab1e Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx 2010-07-16 23:15:01 +02:00
Becky Bruce 199e262eb3 mpc85xx: Add reginfo command
The new command dumps the TLBCAM, the LAWs, and the BR/OR regs.
Add CONFIG_CMD_REGINFO to the config for all MPC85xx parts.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-07-16 10:55:09 -05:00
Kim Phillips 5d0c3b57b2 fdt: move fsl specific code from common fdt area to mpc8xxx/fdt.c
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-07-16 10:55:07 -05:00
Marek Vasut 8c35d0c570 Enable PXAFB for PXA27X and PXA3XX 2010-07-14 22:41:39 +02:00
Scott Wood 53504a2789 NAND: formatting cleanups from env.oob support
Change if (ok) {
	bunch of stuff
} else {
	error
}

to

if (error) {
	get out
}

proceed with bunch of stuff

Plus a few whitespace cleanups.

Signed-off-by: Scott Wood <scottwood@freescale.com>
2010-07-12 18:17:40 -05:00
Ben Gardiner c9f7351b5b NAND: environment offset in OOB (CONFIG_ENV_OFFSET_OOB)
This is a re-submission of the patch by Harald Welte
<laforge@openmoko.org> with minor modifications for rebase and changes
as suggested by Scott Wood <scottwood@freescale.com> [1] [2].

This patch enables the environment partition to have a run-time dynamic
location (offset) in the NAND flash.  The reason for this is simply that
all NAND flashes have factory-default bad blocks, and a fixed compile
time offset would mean that sometimes the environment partition would
live inside factory bad blocks. Since the number of factory default
blocks can be quite high (easily 1.3MBytes in current standard
components), it is not economic to keep that many spare blocks inside
the environment partition.

With this patch and CONFIG_ENV_OFFSET_OOB enabled, the location of the
environment partition is stored in the out-of-band (OOB) data of the
first block in flash. Since the first block is where most systems boot
from, the vendors guarantee that the first block is not a factory
default block.

This patch introduces the 'nand env.oob' command, which can be called
from the u-boot command line. 'nand env.oob get' reads the address of
the environment partition from the OOB data, 'nand env.oob set
{offset,partition-name}' allows the setting of the marker by specifying
a numeric offset or a partition name.

[1] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/43916
[2] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/79195

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Acked-by: Harald Welte <laforge@gnumonks.org>
2010-07-12 13:56:46 -05:00
Wolfgang Denk 54841ab50c Make sure that argv[] argument pointers are not modified.
The hush shell dynamically allocates (and re-allocates) memory for the
argument strings in the "char *argv[]" argument vector passed to
commands.  Any code that modifies these pointers will cause serious
corruption of the malloc data structures and crash U-Boot, so make
sure the compiler can check that no such modifications are being done
by changing the code into "char * const argv[]".

This modification is the result of debugging a strange crash caused
after adding a new command, which used the following argument
processing code which has been working perfectly fine in all Unix
systems since version 6 - but not so in U-Boot:

int main (int argc, char **argv)
{
	while (--argc > 0 && **++argv == '-') {
/* ====> */	while (*++*argv) {
			switch (**argv) {
			case 'd':
				debug++;
				break;
			...
			default:
				usage ();
			}
		}
	}
	...
}

The line marked "====>" will corrupt the malloc data structures and
usually cause U-Boot to crash when the next command gets executed by
the shell.  With the modification, the compiler will prevent this with
an
	error: increment of read-only location '*argv'

N.B.: The code above can be trivially rewritten like this:

	while (--argc > 0 && **++argv == '-') {
		char *arg = *argv;
		while (*++arg) {
			switch (*arg) {
			...

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-07-04 23:55:42 +02:00
Wolfgang Denk b218ccb543 Redundant environment: move flag definitions to header file
Instead of defining the flags sevaral times in different source files
(which is error prone), move them to a central place in a header file.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-04 23:52:42 +02:00
Wolfgang Denk d9c27253ce Make *printf() return "int" instead of "void"
Change the return type of the *printf() functions to the standard
"int"; no changes are needed but returning the already available
length count.

This will save a few additional strlen() calls later...

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-04 23:51:49 +02:00
Wolfgang Denk c0c15379e2 exports.c: fix warning: 'dummy' defined but not used
Also get rid of the #ifdef's while doing this.

Suggested-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-04 23:50:55 +02:00
Wolfgang Denk cd47a83b07 cmd_ide.c: fix unused variable warning for SC3 board
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-04 23:49:33 +02:00
Wolfgang Denk 0e70aaa485 shannon/INFERNO: fix special handling of environment configuration
Remove some INFERNO related #ifdef's from common environment code by
fixing the board configuration settings (add CONFIG_ENV_SECT_SIZE).

While we are at it, fix comment which incorrectly talks about 4 KB
environment size, while it's actually 0x4000 = 16 KiB.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Rolf Offermanns <rof@sysgo.de>
2010-07-04 23:48:55 +02:00
Wolfgang Wegner 7319bcaf8b add redundant environment for env_sf.c
This patch adds redundant environment for environment in SPI flash.
I took env_flash.c as an example and slightly modified it. Apart
from adapting things to SF, I also slightly changed the decision
logic to use area 2 as a default in case the flags are wrong because
not having a default path worried me.

I did not add a section for CONFIG_ENV_IS_IN_SPI_FLASH in environment.h
because I did not understand if this is desired and/or needed.
So to use the feature, one has to set CONFIG_ENV_OFFSET_REDUND _and_
CONFIG_SYS_REDUNDAND_ENVIRONMENT.

I checked it by powering off my board several times during flash
erase or write, because I do not know if there are other stress
test scenarios.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-06-30 23:47:08 -04:00
Wolfgang Denk 0a9463e935 Merge branch 'master' into next 2010-06-30 01:02:11 +02:00
Reinhard Meyer c99ea79078 Fix #if chain and added AVR32 case in cmd_bdinfo.c
AVR32 case was missing in cmd_bdinfo, resulting in compiler warning
(bd->bi_baudrate declared unsigned int at AVR32, but printf used %d)

At the same time slightly reordered #if #elif #endif to make ARM one
of the cases and not an extra case surrounding all others

Signed-off-by: Reinhard Meyer <info@emk-elektronik.de>
Tested-by: Andreas Biemann <biessmann@corscience.de>
2010-06-29 22:32:13 +02:00
Anton Vorontsov 3bf74a4183 hwconfig: Add some unit tests
I use this for testing, and I think this might be useful in the
future.

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
2010-06-29 22:24:48 +02:00
Anton Vorontsov 81f8d3b021 hwconfig: Fix stop characters parsing for subkeys
For the following hwconfig string:

  key1:subkey1=value1,subkey2=value2;key2:value3

The subkey2 cannot be extracted correctly. The parsing code looks
for comma as a stopch, but there may be two kind of stop characters:
a comma and a semicolon.

Currently the code would return "value2;key2:value3", while just
"value2" is the correct answer.

This patch fixes the issue by making the code aware of multiple
stop characters.

For old U-Boots, the issue can be workarounded by placing a comma
before a semicolon, i.e.:

  hwconfig=key1:subkey1=value1,subkey2=value2,;key2:value3

Reported-by: York Sun <yorksun@freescale.com>
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
2010-06-29 22:24:11 +02:00
Remy Bohmer 1f9d10f694 Fix console_buffer size conflict error.
The console_buffer size is declared in common/main.c as
   -- char console_buffer[CONFIG_SYS_CBSIZE + 1];
so this extern definition is wrong.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
2010-06-29 21:12:43 +02:00
Wolfgang Denk 953b7e6291 Remove AmigaOneG3SE board
The AmigaOneG3SE board has been orphaned or a very long time, and
broken for more than 12 releases resp. more than 3 years.  As nobody
seems to be interested any more in this stuff we may as well ged rid
of it, especially as it clutters many areas of the code so it is a
continuous pain for all kinds of ongoing work.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-06-23 23:24:20 +02:00
Wolfgang Denk 482126e27b Prepare v2010.06-rc3
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-06-23 20:50:54 +02:00
Kim Phillips 3057c6be5e fdt_support: add entry for sec3.1 and fix sec3.3
Add sec3.1 h/w geometry for fdt node fixups.

Also, technically, whilst SEC v3.3 h/w honours the tls_ssl_stream descriptor
type, it lacks the ARC4 algorithm execution unit required to be able
to execute anything meaningful with it.  Change the node to agree with
the documentation that declares that the sec3.3 really doesn't have such
a descriptor type.

Reported-by: Haiying Wang <Haiying.Wang@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-05-30 11:14:37 -05:00
Thomas Chou 1117cbf2ad nios: remove nios-32 arch
The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2010-05-28 10:56:04 -04:00
Wolfgang Denk 445093d175 Fix "par[t]ition" typo.
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-05-21 22:05:05 +02:00
York Sun bcb6c2bb84 Enabled support for Rev 1.3 SPD for DDR2 DIMMs
SPD has minor change from Rev 1.2 to 1.3. This patch enables Rev 1.3.
The difference has ben examined and the code is compatible.
Speed bins is not verified on hardware for CL7 at this moment.

This patch also enables SPD Rev 1.x where x is up to "F". According to SPD
spec, the lower nibble is optionally used to determine which additinal bytes
or attribute bits have been defined. Software can safely use defaults. However,
the upper nibble should always be checked.

Signed-off-by: York Sun <yorksun@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-05-12 04:54:30 -05:00
Serge Ziryukin 65d342541e cmd_usb.c: show cmd usage if no args given
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
2010-05-06 23:35:34 +02:00
Larry Johnson 54fa2c5b51 Move test for unnecessary memmove to memmove_wd()
Signed-off-by: Larry Johnson <lrj@acm.org>
2010-05-06 00:38:06 +02:00
Trübenbach, Ralf 39f7aacf3f command.c: Enable auto tab for the editenv command
Enable the auto completion (with TAB) of the environment variable name
after the editenv command.

Signed-off-by: Ralf Trbenbach <ralf.truebenbach@men.de>
2010-05-06 00:37:50 +02:00
Graeme Russ bf16500f79 x86: Use CONFIG_SERIAL_MULTI
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
2010-05-06 00:16:46 +02:00
Frans Meulenbroeks 8cd852824d cmd_onenand.c: moved to standard subcommand handling
On the fly also fixed the following things:
- write help talked about a parameter oob, but that one was not used, so
  removed it from the help message.
- the test command also allowed a force subcommand but didn't use it.
  eliminated the code.
- do_onenand made static
- do_onenand contained
	int blocksize;
	...
	mtd = &onenand_mtd;
	this = mtd->priv;
	blocksize = (1 << this->erase_shift);
  As blocksize was not used the last two statements were unneeded so
  removed them.
  The first statement (mtd = ....) assigns to a global. Not sure if it
  is needed, and since I could not test this, left the line for now

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-05-05 23:57:17 +02:00
Wolfgang Denk 900a1fe8c8 Merge branch 'master' of git://git.denx.de/u-boot-arm 2010-05-04 22:49:15 +02:00
Minkyu Kang 46a3b5c8df SAMSUNG: serial: modify name from s5pc1xx to s5p
Because of other s5p series SoC will use these serial functions,
modify function's name and structure's name.

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2010-04-30 05:23:23 -05:00
Wolfgang Denk e1d2950d0f mtdparts: get rid of custom DEBUG macro, use debug()
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-04-28 10:58:10 +02:00
Wolfgang Denk 2697eff1af mtdparts: fix write through NULL pointer
The "mtdparts add" command wrote through a NULL pointer - on many
systems this went unnoticed (PowerPC has writable RAM there, some ARM
systems have ROM where a write has no effect), but on arm1136
(i.MX31) it crashed the system.

Add appropriate checks.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-04-28 10:53:47 +02:00
Anatolij Gustschin e3b28e6732 mpc512x: add multi serial PSC support
Extend mpc512x serial driver to support multiple PSC ports.

Subsequent patches for PDM360NG board support make use of this
functionality by defining CONFIG_SERIAL_MULTI in the board config
file. Additionally the used PSC devices are specified by defining
e.g. CONFIG_SYS_PSC1, CONFIG_SYS_PSC4 and CONFIG_SYS_PSC6.

Support for PSC devices other than 1, 3, 4 and 6 is not added
by this patch because these aren't used currently. In the future
it can be easily added using DECLARE_PSC_SERIAL_FUNCTIONS(N) and
INIT_PSC_SERIAL_STRUCTURE(N) macros in cpu/mpc512x/serial.c.
Additionally you have to add code for registering added
devices in serial_initialize() in common/serial.c.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-04-24 22:56:30 +02:00
Stefan Roese a47a12becf Move arch/ppc to arch/powerpc
As discussed on the list, move "arch/ppc" to "arch/powerpc" to
better match the Linux directory structure.

Please note that this patch also changes the "ppc" target in
MAKEALL to "powerpc" to match this new infrastructure. But "ppc"
is kept as an alias for now, to not break compatibility with
scripts using this name.

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Anatolij Gustschin <agust@denx.de>
2010-04-21 23:42:38 +02:00
Jens Scharsig 30dc165a76 FIX: watchdog timeout, while waiting for input
* add WATCHDOG_RESET to !tstc() loops
* prevents watchdog timeout, while waiting for input,
  if CONFIG_BOOT_RETRY_TIME or CONFIG_SHOW_ACTIVITY defined

Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
2010-04-10 23:31:31 +02:00
karl.beldan@gmail.com ae30b8c200 malloc: sbrk() should return MORECORE_FAILURE instead of NULL on failure
Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
2010-04-10 00:30:27 +02:00
Frans Meulenbroeks 9acd4f0e91 cmd_bmp.c: add standard subcommand handling
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Acked-by: Detlev Zundel <dzu@denx.de>
2010-04-09 23:37:06 +02:00
Wolfgang Denk 74b86d2d51 Merge branch 'master' of git://git.denx.de/u-boot-ubi 2010-04-09 21:49:42 +02:00
Peter Tyser 3b653fdb32 cmd_ubi: Fix uninitialized variable warning
gcc 3.4.6 previously reported the following error on many MIPS boards
which utilize UBI:
  cmd_ubi.c:193: warning: 'vol' might be used uninitialized in this function

The current code is structured such that 'vol' will never be used when
it is NULL anyway, but gcc isn't smart enough to figure this out.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2010-04-09 16:30:29 +02:00
Kim B. Heino fac71cc49f USB storage probe
While debugging one ill behaving USB device I found two bugs in USB
storage probe.

usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part
of this patch fixes error case.

Second part fixes usb_inquiry()'s retry counter handling. Original code
had retry = -1 on error case, not retry = 0 as checked in the next line.

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
2010-04-08 21:40:00 +02:00
Kim B. Heino aaad108b88 USB storage count
Here's another USB storage patch. Currently U-Boot handles storage
devices #0 - #4 as valid devices, even if there is none connected. This
patch fixes usb_stor_get_dev() to check detected device count instead
of MAX-define.

This is very important for ill behaving devices. usb_dev_desc[] can be
partially initialized if device probe fails.

After fixing get_dev() it was easy to fix "usb part" etc commands.
Previously it outputed "Unknown partition table" five times, now it's
"no USB devices available".

Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
2010-04-08 21:40:00 +02:00
Kumar Gala 49b97d9c8e fdt: Add fdt_del_node_and_alias helper
Add a helper function that given an alias will delete both the node
the alias points to and the alias itself

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2010-04-07 00:08:18 -05:00
Wolfgang Denk ffa37fc98d Merge branch 'next' 2010-04-01 11:28:32 +02:00
Heiko Schocher 24de2f4be0 bootm, linux: fix booting Multi-File Image with "kernel+ramdisk+fdt"
Booting a "Multi-File Image" including a linux kernel, ramdisk and
fdt, generated with

mkimage -A ppc \
    -O linux \
    -T multi \
    -C gzip \
    -a 00000000 \
    -e 00000000 \
    -n "kernel-2.6+initrd+dtb" \
    -d "vmlinux.bin.gz:ramdisk_image.gz:board.dtb" \
    multi.bin

actually fails, because ramdisk start and end addresses
didn;t get initialized. This patch fixes this issue.

Tested on the KUP4K board.

Signed-off-by: Heiko Schocher <hs@denx.de>
2010-03-29 14:31:42 +02:00
Frans Meulenbroeks fd03ea8964 i2c: made unused function i2c_mux_add_device static
and removed it from the .h file

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29 13:29:12 +02:00
Frans Meulenbroeks 2c0dc99020 cmd_i2c: introduced get_alen helper function
The code to parse alen appeared 6 times in the function.
Factored this out in a small helper function

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29 13:28:57 +02:00
Frans Meulenbroeks a266fe955a cmd_i2c: moved a define to before the functions
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29 13:28:49 +02:00
Frans Meulenbroeks 4a8cf3382a cmd_i2c: moved mispositioned comment for i2c md
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29 13:28:40 +02:00
Frans Meulenbroeks 3a6dcb988e cmd_i2c.c: declared local functions as static
Declared all functions that were not called outside the file as static

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29 13:25:43 +02:00
Wolfgang Denk 0020db3f0d Merge remote branch 'origin/master' into next 2010-03-29 12:33:43 +02:00
Wolfgang Denk 060f28532b cmd_usb.c: print debug messages only when DEBUG is defined
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-03-28 00:19:45 +01:00
Wolfgang Denk be1a91320c Merge branch 'next' of git://git.denx.de/u-boot-coldfire into next 2010-03-28 00:04:18 +01:00
Philippe De Muyter 116095eb1f fix cmd_bdinfo.c:354: warning: 'print_eth' defined but not used
This fixes the following warnings when running MAKEALL for coldfire :
cmd_bdinfo.c:354: warning: 'print_eth' defined but not used

Signed-off-by: Philippe De Muyter <phdm at macqel.be>
2010-03-24 11:08:53 -05:00
Alessandro Rubini acb1386893 lcd: make 16bpp work
Support for 16bpp was supposed to be in the code but was not working.
This makes it work and has been tested in the nhk8815 board.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-03-24 11:23:15 +01:00
Florian Fainelli 6b94b49622 cmd_nand: show nand scrub confirmation character
When issuing a nand scrub command, the entered character is not displayed
this may be confusing. This patch makes the input character being
displayed if it is a 'y' so that an user knows he is about to scrub his
nand.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2010-03-23 14:29:10 -05:00
Wolfgang Denk b46b353b90 Merge remote branch 'origin/master' into next 2010-03-21 22:45:36 +01:00
Anatolij Gustschin 3c950e2ebf fdt_support: add partitions fixup in mtd node
Allow overwriting defined partitions in the device tree blob
using partition info defined in the 'mtdparts' environment
variable.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Gerald Van Baren <vanbaren@cideas.com>
2010-03-21 22:44:59 +01:00
John Schmoller d611295032 cmd history: Match history buffer size to console buffer
Match history buffer size to console buffer size. History buffer size
was hard coded to 256, artificially limiting the command buffer size.
The history buffer now tracks CONFIG_SYS_CBSIZE.

Signed-off-by: John Schmoller <jschmoller@xes-inc.com>
2010-03-21 22:44:59 +01:00
John Schmoller 6475b9f91b console: Fix console buffer overrun
When CONFIG_SYS_CBSIZE equals MAX_CMDBUF_SIZE, a command string of
maximum length will overwrite part of the history buffer, causing the
board to die. Expand the console_buffer and hist_lines buffer by one
character each to hold the missing NULL char.

Signed-off-by: John Schmoller <jschmoller@xes-inc.com>
2010-03-21 22:44:58 +01:00
Frans Meulenbroeks 47ab5ad145 cmd_setexpr: allow memory addresses in expressions
This patch add functionality to use memory addresses in expressions.
This increases the power of expressions substantially

It adheres to the standard convemtions: memory addresses can be given
in the format *address (e.g. *1000)

Rationale for this change is that it allows masking off bits from a
byte that is obtained by reading data from e.g. i2c.

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>

Fix warning: control reaches end of non-void function
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-03-21 22:44:43 +01:00
Frans Meulenbroeks 652e53546b cmd_i2c.c: added i2c read to memory function
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 22:44:43 +01:00
Frans Meulenbroeks fb0070e910 cmd_i2c.c: sorted commands alphabetically
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 22:44:43 +01:00
Frans Meulenbroeks bfc3b77ebe cmd_i2c.c: reworked subcommand handling
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 22:44:43 +01:00
Frans Meulenbroeks f74d9bd2a2 cmd_bootm.c: made subcommand array static
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 22:44:43 +01:00
Frans Meulenbroeks faffe14f01 cmd_i2c.c: reduced subaddress length to 3 bytes
according to some of the comments the subaddress length is 1 or 2, but we are being
prepared for the case it becomes 3. However the code also accepted 4.
This repairs this by changing the constand 4 to 3.

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 22:44:42 +01:00
Anatolij Gustschin a74908161a console.c: fix problem with splashimage
If a board uses cfb_console driver and splash image
and also defines CONFIG_SILENT_CONSOLE, the user is
locked out even if "silent" is not set. It is not
possible to get any output, neither on vga console
device nor on serial console after redirecting the
output to the serial console, since the GD_FLG_SILENT
flag remains set.

Fix the problem by redirecting the output from frame
buffer to serial console if splashimage is used.
Only suppress the output if "silent" environment
variable was set and don't set the GD_FLG_SILENT
flag arbitrarily.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-03-21 22:22:53 +01:00
Frans Meulenbroeks 9d90a93d36 cmd_mmc remove \n
This patch removes the \n after the help message for mmcinfo.
This resulted in an empty line being displayed after the mmcinfo line
when the help command was given.

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 16:44:04 +01:00
Wolfgang Denk 93910edb59 Prepare v2010.03-rc1
Coding style cleanup, update CHANGELOG.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-03-12 23:06:04 +01:00
Michael Zaidman 5f8419597f Cosmetic change - indentation correction.
Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
2010-03-12 00:19:11 +01:00
Anatolij Gustschin a693447cea cmd_mtdparts.c: prevent printbuffer overflows
The length of configured MTDPARTS_DEFAULT string
could be greater than console printbuffer size.
Replace printf() by puts() to avoid potential buffer
overflows.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-03-12 00:18:08 +01:00
Wolfgang Denk 143cd21fe2 Move CONFIG_UPDATE_TFTP code after CONFIG_PREBOOT
The auto-update feature (CONFIG_UPDATE_TFTP) requires that the env
variable serverip be set for the TFTP access. If DHCP is to be used
to get the serverip env variable, this doesn't work as DHCP happens
after the auto-update attempt has run. A solution is to run DHCP in
PREBOOT, but even this is too late.

To solve this, we move update_tftp() below the PREBOOT stuff.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-03-11 23:56:03 +01:00
Richard Retanubun 4b99327a41 PPC: Record U-Boot's relocated address in RAM and show in bdinfo.
This patch uses gd->relocaddr variable to store uboot's relocated
address in RAM and shows it in bdinfo command.

This patch moves CONFIG_AMIGAONEG3SE style copying of the address
in board_init_f to just before relocation is actually done.

Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Tested-by: Detlev Zundel <dzu@denx.de>
2010-03-11 23:49:16 +01:00
Frans Meulenbroeks f3651764e5 cmd_itest.c: fix pointer dereferencing
fix pointer dereferencing
if the size is .b and .w an 8 or 16 bit access is done.

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Acked-by: Detlev Zundel <dzu@denx.de>
2010-02-24 00:09:45 +01:00
Stefan Roese ab5a0dcb9c net: Use 0.5 sec timeout in miiphy_reset() instead of counting loop
This patch fixes a problem I've notived on a buggy PPC4xx system. This
system has problems with the PHY MDIO communication and seemed to be
stuck/crashed in miiphy_reset(). But degugging revealed, that the CPU
didn't crash, but "only" hung in this counting loop for about 2 minutes.

This patch now uses a real timeout of 0.5 seconds (as mentioned in the
comment in miiphy_reset).

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
2010-02-06 22:52:21 -08:00
Remy Bohmer 84d36b3018 USB: usb_control_msg wait for driver ISR to set status.
This patch changes usb_control_msg back to the state prior to commit
4886720844.

The USB driver ISR routine may update the status.

Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
2010-02-03 22:06:59 +01:00
Wolfgang Denk 5c1a1a3069 Merge branch 'master' of git://git.denx.de/u-boot-nand-flash 2010-02-03 20:05:27 +01:00
Wolfgang Denk 0ae016f1ff Merge branch 'master' of git://git.denx.de/u-boot-video 2010-02-03 20:03:46 +01:00
Wolfgang Denk 5f566f4547 cmd_ximg.c: fix error: 'i' undeclared
Fix compile error:

	cmd_ximg.c: In function 'do_imgextract':
	cmd_ximg.c:234: error: 'i' undeclared (first use in this function)
	cmd_ximg.c:234: error: (Each undeclared identifier is reported only once
	cmd_ximg.c:234: error: for each function it appears in.)

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-01-31 21:51:43 +01:00
Anatolij Gustschin a6e42ed097 lcd: remove CONFIG_ATMEL_LCD ifdefs from lcd_setfgcolor
Not all boards defining LCD_COLOR16 are able to set
lcd_color_fg/lcd_color_bg correctly. The issue seems to
be caused by CONFIG_ATMEL_LCD ifdefs in lcd_setfgcolor()
and lcd_setbgcolor(). Actually, the color values passed
to these functions are already correct, we don't need
to fix them. So remove ifdefs here.

Reported-by: Alessandro Rubini <rubini@unipv.it>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-01-27 21:23:30 +01:00
Wolfgang Denk 15b86c3d6c env_nand.c: print error message and fail gracefully
env_nand.c would crash silently if a malloc() for the environment
buffers failed; make it print an error message and fail gracefully,
i. e. use the default environment then.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: John Rigby <jcrigby@gmail.com>
2010-01-27 14:22:41 -06:00
Kumar Gala 4194b3668a Add support to disable cpu's in multicore processors
Add a disable sub-command to the cpu command that allows for disabling
cores in multicore processors.  This can be useful for systems that are
using multicore chips but aren't utilizing all the cores as a way to
reduce power and possibly improve performance.

Also updated an added missing copyright.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2010-01-26 23:17:49 -06:00
Wolfgang Wegner 5912d36507 add ability to handle compressed images to imxtract
imxtract currently can not handle compressed images. This patch adds
handling for bzip2 and zip compression. In both cases, a destination
address has to be specified for extraction.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
2010-01-26 19:36:07 +01:00
Mike Frysinger 2903ad33a7 jffs2: fix hangs/crashs when not using CONFIG_JFFS2_PART_SIZE
Commit b5b004ad8a caused the sector_size to
be calculated incorrectly when the part size was not hardcoded.  This is
because the new code relied on part->size but tried to do the calculation
before it was initialized properly, and it did not take into consideration
the magic SIZE_REMAINING define.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-26 00:07:50 +01:00
Mike Frysinger 44431cabbb gzip/zlib: make features optional
If you really want to slim down U-Boot and you would rather use a higher
compression scheme (like LZMA), it'd be nice to disable gzip/zlib since
these code bases take up a significant amount of space.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-26 00:04:57 +01:00
Stefano Babic 8edcde5e4e mkimage: Add Freescale imx Boot Image support (imximage)
This patch adds support for "imximage" (MX Boot Image)
to the mkimage utility. The imximage is used on the Freescales's
MX.25, MX.35 and MX.51 processors.

Further details under doc/README.imximage.

This patch was tested on a Freescale mx51evk board.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-01-25 23:58:29 +01:00
Mike Frysinger a16028da63 lmb: only force on arches that use it
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-21 22:26:00 +01:00
Heiko Schocher 88ffb2665c CRAMFS: support cramfs in RAM
cramfsls and cramfsload are added to the command list.
A cramfs placed at 'cramfs_addr' can the be listed with 'cramfsls' and files
can be loaded with 'cramfsload'. 'cramfs_addr' is an environment variable
specifying the address the cramfs is located.
This works for powerpc and for ARM.

Use CONFIG_CMD_CRAMFS.

Signed-off-by: Andreas Huber <andreas.huber@keymile.com>
Signed-off-by: Heiko Schocher <hs@denx.de>
2010-01-18 00:44:13 +01:00
Heiko Schocher 1567b596d9 env, eeprom: add redundant environment support
Add redundant environment support for environment lying on a EEPROM.

Tested on uppcoming suen3 support

Signed-off-by: Andreas Huber <andreas.huber@keymile.com>
2010-01-18 00:43:16 +01:00
Heiko Schocher 548738b4d4 cmd_eeprom: I2C updates
- CONFIG_ENV_EEPROM_IS_ON_I2C
  define this, if you have I2C and SPI activated, and your
  EEPROM, which holds the environment, is on the I2C bus.

- CONFIG_I2C_ENV_EEPROM_BUS
  if you have an Environment on an EEPROM reached over
  I2C muxes, you can now define, how to reach this
  EEPROM.

Signed-off-by: Heiko Schocher <hs@denx.de>
2010-01-18 00:42:37 +01:00
Detlev Zundel c3d7eec6d8 cmd_bootm.c: Change interpretation of standalone image parameters.
Current code uses the second argument to bootm for standalone images to
override the load address specified in the image instead of passing all
parameters as is to the application.  This behaviour is not documented
and not in line with how the go command works for standalone applications,
so we simply drop it.

Signed-off-by: Detlev Zundel <dzu@denx.de>
2010-01-18 00:26:36 +01:00
Detlev Zundel 8b828a8f44 cmd_bootm.c: Do not load a ramdisk when not booting a kernel.
In case we boot an image marked as 'standalone' and 'linux', the current
code erroneously tried to load a ramdisk.

Signed-off-by: Detlev Zundel <dzu@denx.de>
2010-01-18 00:26:34 +01:00
Robin Getz 16035bcd8c kgdb: update mem2hex/hex2mem funcs
Convert the funcs to do the conversion inline so that we can do the copy
all at once with memcpy.  This let's us push out an weird arch-specific
issue with accessing different regions of memory to the memcpy function
like the MMRs on Blackfin systems, and it should be a bit faster.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-18 00:24:21 +01:00
Robin Getz 0c909551f8 kgdb: add default generic stubs
The default kgdb functions can be implemented with common U-Boot functions,
so rather than force everyone to copy & paste these things, create a set of
weak stubs.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-18 00:23:00 +01:00
Mike Frysinger 10c32ff59f config_defaults.h: new header for common u-boot config defaults
There are a bunch of features in U-Boot that we want to enable by default,
and it's best if we centralize them in one place rather than updating all
the board files out there.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-01-18 00:04:42 +01:00
Wolfgang Denk 2740544881 malloc: return NULL if not initialized yet
When malloc() was called before it was properly initialized
(as would happen if when used before relocation to RAM) it returned
random, non-NULL values, which called all kinds of difficult to debug
subsequent errors.

Make sure to return NULL when initialization was not done yet.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-01-15 13:26:20 +01:00
Sanjeev Premi b821cead7d onenand: Fix compile errors due to FlexOneNAND
This patch fixes the compile error while trying to
compile for omap3evm.

env_onenand.c: In function 'env_relocate_spec':
env_onenand.c:70: error: 'CONFIG_ENV_ADDR_FLEX' undeclared
 (first use in this function)
env_onenand.c:70: error: (Each undeclared identifier is re
ported only once
env_onenand.c:70: error: for each function it appears in.)
env_onenand.c: In function 'saveenv':
env_onenand.c:106: error: 'CONFIG_ENV_ADDR_FLEX' undeclare
d (first use in this function)
env_onenand.c:107: error: 'CONFIG_ENV_SIZE_FLEX' undeclare
d (first use in this function)

Signed-off-by: Sanjeev Premi <premi@ti.com>
Acked-by: Tom Rix <Tom.Rix@windriver.com>
2010-01-06 16:28:00 -06:00