Commit Graph

218 Commits

Author SHA1 Message Date
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
c8cf4fc407 Blackfin: gpio: use common usage func
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-29 13:29:52 -04:00
Mike Frysinger
b990c7bda4 Blackfin: jtag-console: handle newline stuffing
Serial devices currently have to manually stuff \r after every \n found,
but this is a bit more difficult with the jtag console since we process
everything in chunks of 4 bit.  So we have to scan & stuff the whole
string rather than what most serial drivers do which is output on a byte
per byte basis.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-25 15:17:34 -04:00
Mike Frysinger
4fff5ac2f8 Blackfin: jtag-console: add debug markers
While we're in here, add some useful debug points.  We need custom debug
statements because we need the output to only go to the serial port.  If
we used the standard debug helpers, the output would also go to the stdout
(which would be the jtag console) and make it hard to figure out what is
going where exactly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-25 15:17:31 -04:00
Mike Frysinger
5079d8bbad Blackfin: jtag-console: robustify against missing peer
If the other side isn't listening, we should reset the state to ignore
the whole message and not just the part we missed.  This makes it easier
to connect at any time to the jtag console without worrying about the two
sides getting out of sync and thus sending garbage back and forth.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-25 15:17:27 -04:00
Mike Frysinger
bbf4fbb6cc Blackfin: bf561: use DMA for Core B L1 regions
The L1 regions of Core B are not directly accessible from Core A, so we
need to use DMA to get at them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-13 17:50:52 -04:00
Mike Frysinger
a409fdd8fe Blackfin: serial: convert to portmux framework
Use the new portmux framework to handle the details when possible.
Unfortunately, we cannot yet use this in the standalone initialization
logic, so we need to keep around the old portmux writes for now.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-13 17:50:50 -04:00
Mike Frysinger
c5530555f8 Blackfin: unify custom gpio commands
Now that we have a unified gpio layer, the misc partial gpio commands
can be unified and made complete (support all possible gpios).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 05:30:07 -04:00
Mike Frysinger
4638b21f2e Blackfin: import gpio/portmux layer from Linux
The current pinmux handling has spread throughout Blackfin drivers and
board code and is getting hideous to maintain.  So import the gpio and
portmux layer from the Blackfin Linux code.  This should spur a serious
of cleanups across the Blackfin tree.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 05:30:07 -04:00
Mike Frysinger
ce53fc6601 Blackfin: set up simple NMI handlers for anomaly 05000219
Older on-chip Blackfin bootroms do not create a dummy NMI handler, so set
up one ourselves when anomaly 05000219 applies.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 04:18:18 -04:00
Mike Frysinger
53ea1505bb Blackfin: update anomaly lists to latest sheets
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 04:18:18 -04:00
Mike Frysinger
b30453ace4 Blackfin: expand EVT1 usage documentation a bit more
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 04:18:18 -04:00
Mike Frysinger
a5384ae49a Blackfin: implement bootcount support
The default storage location for bootcount is EVT0.  This version uses
one 32bit value and combines the magic/count value in the upper/lower
16bits.  If there is demand for more, should be easy to do.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 04:18:18 -04:00
Mike Frysinger
66a4909a3d Blackfin: clean up trace buffer handling when crashing
Avoid banging on the trace MMRs when debugging is disabled, avoid calling
the funcs multiple times in a row, disable the trace buffer earlier in the
exception handler to avoid eating more user entries, and dump the buffer
before calling the kgdb hook.  This way we maximize useful debugging info
up front rather than needing external tools (like gdb/serial/etc...).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-07-05 04:18:18 -04: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
Peter Tyser
c6fb83d217 blackfin: Move cpu/blackfin/* to arch/blackfin/cpu/*
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2010-04-13 09:13:25 +02:00
Peter Tyser
819833af39 Move architecture-specific includes to arch/$ARCH/include/asm
This helps to clean up the include/ directory so that it only contains
non-architecture-specific headers and also matches Linux's directory
layout which many U-Boot developers are already familiar with.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2010-04-13 09:13:12 +02:00
Peter Tyser
ea0364f1bb Move lib_$ARCH directories to arch/$ARCH/lib
Also move lib_$ARCH/config.mk to arch/$ARCH/config.mk

This change is intended to clean up the top-level directory structure
and more closely mimic Linux's directory organization.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2010-04-13 09:13:03 +02:00