mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 17:56:44 +03:00
Compare commits
15 Commits
LABEL_2003
...
LABEL_2003
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a6fd34b26 | ||
|
|
69f8f827d5 | ||
|
|
759a51b4f3 | ||
|
|
d126bfbdbd | ||
|
|
60fbe25424 | ||
|
|
3e38691e8f | ||
|
|
36c05a80ec | ||
|
|
afcc4a7404 | ||
|
|
9e7d5ebea9 | ||
|
|
baa3d528fe | ||
|
|
c1551ea817 | ||
|
|
0587597ca3 | ||
|
|
0db5bca807 | ||
|
|
85ec0bcc1b | ||
|
|
506f044131 |
91
CHANGELOG
91
CHANGELOG
@@ -1,7 +1,96 @@
|
||||
======================================================================
|
||||
Changes since U-Boot 0.2.2:
|
||||
Changes since U-Boot 0.3.0:
|
||||
======================================================================
|
||||
|
||||
* Patch by Lutz Dennig, 10 Apr 2003:
|
||||
Update for R360MPI board
|
||||
|
||||
* Add new meaning to "autostart" environment variable:
|
||||
If set to "no", a standalone image passed to the
|
||||
"bootm" command will be copied to the load address
|
||||
(and eventually uncompressed), but NOT be started.
|
||||
This can be used to load and uncompress arbitrary
|
||||
data.
|
||||
|
||||
* Patch by Stefan Roese, 10 Apr 2003:
|
||||
Changed DHCP client to use IP address from server option field #54
|
||||
from the OFFER packet in the server option field #54 in the REQUEST
|
||||
packet. This fixes a problem using a Windows 2000 DHCP server,
|
||||
where the DHCP-server is not the TFTP-server.
|
||||
|
||||
* Set max brightness for MN11236 displays on TRAB board
|
||||
|
||||
* Add support for TQM862L modules
|
||||
|
||||
======================================================================
|
||||
Changes for U-Boot 0.3.0:
|
||||
======================================================================
|
||||
|
||||
* Patch by Arun Dharankar, 4 Apr 2003:
|
||||
Add IDMA example code (tested on 8260 only)
|
||||
|
||||
* Add support for Purple Board (MIPS64 5Kc)
|
||||
|
||||
* Add support for MIPS64 5Kc CPUs
|
||||
|
||||
* Fix missing setting of "loadaddr" and "bootfile" on ARM and MIPS
|
||||
|
||||
* Patch by Denis Peter, 04 Apr 2003:
|
||||
- update MIP405-4 board
|
||||
|
||||
* Patch by Stefan Roese, 4 Apr 2003:
|
||||
- U-Boot version environment variable "ver" added
|
||||
(CONFIG_VERSION_VARIABLE).
|
||||
- Changed PPC405GPr version from A to B.
|
||||
- Changed CPCI405 to use CTS instead of DSR on PPC405 UART1.
|
||||
|
||||
* Patches by Denis Peter, 03 April 2003:
|
||||
- fix PCI IRQs on MPL boards
|
||||
- fix two more un-relocated pointer problems
|
||||
|
||||
* Fix behaviour of "run" command:
|
||||
- print error message iv variable does not exist
|
||||
- terminate processing of arguments in case of error
|
||||
|
||||
* Patches by Peter Figuli, 10 Mar 2003
|
||||
- Add support for BTUART on PXA platform
|
||||
- Add support for WEP EP250 (PXA) board
|
||||
|
||||
* Fix flash problems on INCA-IP; add tool to allow bruning images to
|
||||
flash using a BDI2000
|
||||
|
||||
* Implement fix for I2C Edge Conditions problem for all boards that
|
||||
use the bit-banging driver (common/soft_i2c.c)
|
||||
|
||||
* Patch by Martin Winistoerfer, 23 Mar 2003
|
||||
- Add port to MPC555/556 microcontrollers
|
||||
- Add support for cmi customer board with
|
||||
Intel 28F128J3A, 28F320J3A or 28F640J3A flash.
|
||||
|
||||
* Patch by Rick Bronson, 28 Mar 2003:
|
||||
- fix common/cmd_nand.c
|
||||
|
||||
* Patch by Arun Dharankar, 24 Mar 2003:
|
||||
- add threads / scheduler example code
|
||||
|
||||
* Add patches by Robert Schwebel, 31 Mar 2003:
|
||||
- add ctrl-c support for kermit download
|
||||
- align bdinfo output on ARM
|
||||
- csb226 board: bring in sync with innokom/memsetup.S
|
||||
- csb226 board: fix MDREFR handling
|
||||
- misc doc fixes / extensions
|
||||
- innokom board: cleanup, MDREFR fix in memsetup.S, config update
|
||||
- add BOOT_PROGRESS to armlinux.c
|
||||
|
||||
* Add CPU ID, version, and clock speed for INCA-IP
|
||||
|
||||
* Patches by Dave Ellis, 18 Mar 2003 for SXNI855T board:
|
||||
- fix SRAM and SDRAM memory sizing
|
||||
- add status LED support
|
||||
- add MAC address for second (SCC1) ethernet port
|
||||
|
||||
* Update default environment for TQM8260 board
|
||||
|
||||
* Patch by Rick Bronson, 16 Mar 2003:
|
||||
- Add NAND flash support for reading, writing, and erasing NAND
|
||||
flash (certain forms of which are called SmartMedia).
|
||||
|
||||
12
CREDITS
12
CREDITS
@@ -70,6 +70,10 @@ N: Magnus Damm
|
||||
E: eramdam@kieray1.p.y.ki.era.ericsson.se
|
||||
D: 8xxrom
|
||||
|
||||
N: Arun Dharankar
|
||||
E: ADharankar@ATTBI.Com
|
||||
D: threads / scheduler example code
|
||||
|
||||
N: Kári Davíðsson
|
||||
E: kd@flaga.is
|
||||
D: FLAGA DM Support
|
||||
@@ -100,6 +104,10 @@ E: wg@denx.de
|
||||
D: Support for Interphase 4539 T1/E1/J1 PMC, PN62, CCM, SCM boards
|
||||
W: www.denx.de
|
||||
|
||||
N: Peter Figuli
|
||||
E: peposh@etc.sk
|
||||
D: Support for WEP EP250 (PXA) board
|
||||
|
||||
N: Thomas Frieden
|
||||
E: ThomasF@hyperion-entertainment.com
|
||||
D: Support for AmigaOne
|
||||
@@ -262,6 +270,10 @@ N: David Updegraff
|
||||
E: dave@cray.com
|
||||
D: Port to Cray L1 board; DHCP vendor extensions
|
||||
|
||||
N: Martin Winistoerfer
|
||||
E: martinwinistoerfer@gmx.ch
|
||||
D: Port to MPC555/556 microcontrollers and support for cmi board
|
||||
|
||||
N: Christian Vejlbo
|
||||
E: christian.vejlbo@tellabs.com
|
||||
D: FADS860T ethernet support
|
||||
|
||||
@@ -241,6 +241,10 @@ Unknown / orphaned boards:
|
||||
# Board CPU #
|
||||
#########################################################################
|
||||
|
||||
Peter Figuli <peposh@etc.sk>
|
||||
|
||||
wepep250 xscale
|
||||
|
||||
Marius Gröger <mag@sysgo.de>
|
||||
|
||||
impa7 ARM720T (EP7211)
|
||||
@@ -296,6 +300,7 @@ Daniel Engstr
|
||||
Wolfgang Denk <wd@denx.de>
|
||||
|
||||
incaip MIPS32 4Kc
|
||||
purple MIPS64 5Kc
|
||||
|
||||
#########################################################################
|
||||
# End of MAINTAINERS list #
|
||||
|
||||
26
MAKEALL
26
MAKEALL
@@ -10,6 +10,14 @@ fi
|
||||
|
||||
LIST=""
|
||||
|
||||
#########################################################################
|
||||
## MPC5xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_5xx=" \
|
||||
cmi_mpc5xx \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
@@ -77,14 +85,16 @@ LIST_7xx=" \
|
||||
BAB7xx ELPPC \
|
||||
"
|
||||
|
||||
LIST_ppc="${LIST_8xx} ${LIST_824x} ${LIST_8260} \
|
||||
${LIST_4xx} ${LIST_74xx} ${LIST_7xx}"
|
||||
LIST_ppc="${LIST_5xx} ${LIST_8xx} \
|
||||
${LIST_824x} ${LIST_8260} \
|
||||
${LIST_4xx} \
|
||||
${LIST_74xx} ${LIST_7xx}"
|
||||
|
||||
#########################################################################
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_SA="at91rm9200dk dnp1110 lart shannon"
|
||||
LIST_SA="dnp1110 lart shannon"
|
||||
|
||||
#########################################################################
|
||||
## ARM7 Systems
|
||||
@@ -96,13 +106,13 @@ LIST_ARM7="ep7312 impa7"
|
||||
## ARM9 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_ARM9="smdk2400 smdk2410 trab VCMA9"
|
||||
LIST_ARM9="at91rm9200dk smdk2400 smdk2410 trab VCMA9"
|
||||
|
||||
#########################################################################
|
||||
## Xscale Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_xscale="cradle csb226 innokom lubbock"
|
||||
LIST_xscale="cradle csb226 innokom lubbock wepep250"
|
||||
|
||||
|
||||
LIST_arm="${LIST_SA} ${LIST_ARM7} ${LIST_ARM9} ${LIST_xscale}"
|
||||
@@ -113,7 +123,9 @@ LIST_arm="${LIST_SA} ${LIST_ARM7} ${LIST_ARM9} ${LIST_xscale}"
|
||||
|
||||
LIST_mips4kc="incaip"
|
||||
|
||||
LIST_mips="${LIST_mips4kc}"
|
||||
LIST_mips5kc="purple"
|
||||
|
||||
LIST_mips="${LIST_mips4kc} ${LIST_mips5kc}"
|
||||
|
||||
|
||||
#----- for now, just run PPC by default -----
|
||||
@@ -136,7 +148,7 @@ build_target() {
|
||||
for arg in $@
|
||||
do
|
||||
case "$arg" in
|
||||
8xx|824x|8260|4xx|7xx|74xx|SA|ARM7|ARM9|ppc|arm|xscale|mips)
|
||||
5xx|8xx|824x|8260|4xx|7xx|74xx|SA|ARM7|ARM9|ppc|arm|xscale|mips)
|
||||
for target in `eval echo '$LIST_'${arg}`
|
||||
do
|
||||
build_target ${target}
|
||||
|
||||
32
Makefile
32
Makefile
@@ -168,6 +168,14 @@ unconfig:
|
||||
#========================================================================
|
||||
# PowerPC
|
||||
#========================================================================
|
||||
|
||||
#########################################################################
|
||||
## MPC5xx Systems
|
||||
#########################################################################
|
||||
|
||||
cmi_mpc5xx_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc5xx cmi
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
@@ -345,15 +353,12 @@ TQM850L_80MHz_config \
|
||||
TQM855L_config \
|
||||
TQM855L_66MHz_config \
|
||||
TQM855L_80MHz_config \
|
||||
TQM855L_FEC_config \
|
||||
TQM855L_FEC_66MHz_config \
|
||||
TQM855L_FEC_80MHz_config \
|
||||
TQM860L_config \
|
||||
TQM860L_66MHz_config \
|
||||
TQM860L_80MHz_config \
|
||||
TQM860L_FEC_config \
|
||||
TQM860L_FEC_66MHz_config \
|
||||
TQM860L_FEC_80MHz_config: unconfig
|
||||
TQM862L_config \
|
||||
TQM862L_66MHz_config \
|
||||
TQM862L_80MHz_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _FEC,$@)" ] || \
|
||||
{ echo "#define CONFIG_FEC_ENET" >>include/config.h ; \
|
||||
@@ -690,6 +695,9 @@ innokom_config : unconfig
|
||||
lubbock_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm xscale lubbock
|
||||
|
||||
wepep250_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm xscale wepep250
|
||||
|
||||
#========================================================================
|
||||
# i386
|
||||
#========================================================================
|
||||
@@ -709,14 +717,20 @@ sc520_cdp_config : unconfig
|
||||
incaip_config : unconfig
|
||||
@./mkconfig $(@:_config=) mips mips incaip
|
||||
|
||||
purple_config : unconfig
|
||||
@./mkconfig $(@:_config=) mips mips purple
|
||||
|
||||
#########################################################################
|
||||
#########################################################################
|
||||
|
||||
clean:
|
||||
find . -type f \
|
||||
\( -name 'core' -o -name '*.bak' -o -name '*~' \
|
||||
-o -name '*.o' -o -name '*.a' \) -print \
|
||||
| xargs rm -f
|
||||
rm -f examples/hello_world examples/timer examples/eepro100_eeprom
|
||||
rm -f examples/hello_world examples/timer \
|
||||
examples/eepro100_eeprom examples/sched \
|
||||
examples/mem_to_mem_idma2intr
|
||||
rm -f tools/img2srec tools/mkimage tools/envcrc tools/gen_eth_addr
|
||||
rm -f tools/easylogo/easylogo tools/bmp_logo
|
||||
rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
|
||||
@@ -729,9 +743,9 @@ clobber: clean
|
||||
| xargs rm -f
|
||||
rm -f $(OBJS) *.bak tags TAGS
|
||||
rm -fr *.*~
|
||||
rm -f u-boot u-boot.bin u-boot.elf u-boot.srec u-boot.map System.map
|
||||
rm -f u-boot u-boot.bin u-boot.srec u-boot.map System.map
|
||||
rm -f tools/crc32.c tools/environment.c tools/env/crc32.c
|
||||
rm -f cpu/mpc824x/bedbug_603e.c
|
||||
rm -f tools/inca-swap-bytes cpu/mpc824x/bedbug_603e.c
|
||||
rm -f include/asm/arch include/asm
|
||||
|
||||
mrproper \
|
||||
|
||||
87
README
87
README
@@ -140,6 +140,7 @@ Directory Hierarchy:
|
||||
- tools Tools to build S-Record or U-Boot images, etc.
|
||||
|
||||
- cpu/74xx_7xx Files specific to Motorola MPC74xx and 7xx CPUs
|
||||
- cpu/mpc5xx Files specific to Motorola MPC5xx CPUs
|
||||
- cpu/mpc8xx Files specific to Motorola MPC8xx CPUs
|
||||
- cpu/mpc824x Files specific to Motorola MPC824x CPUs
|
||||
- cpu/mpc8260 Files specific to Motorola MPC8260 CPU
|
||||
@@ -151,6 +152,7 @@ Directory Hierarchy:
|
||||
Files specific to RPXClassic boards
|
||||
- board/RPXlite Files specific to RPXlite boards
|
||||
- board/c2mon Files specific to c2mon boards
|
||||
- board/cmi Files specific to cmi boards
|
||||
- board/cogent Files specific to Cogent boards
|
||||
(need further configuration)
|
||||
Files specific to CPCIISER4 boards
|
||||
@@ -292,6 +294,7 @@ The following options need to be configured:
|
||||
PowerPC based CPUs:
|
||||
-------------------
|
||||
CONFIG_MPC823, CONFIG_MPC850, CONFIG_MPC855, CONFIG_MPC860
|
||||
or CONFIG_MPC5xx
|
||||
or CONFIG_MPC824X, CONFIG_MPC8260
|
||||
or CONFIG_IOP480
|
||||
or CONFIG_405GP
|
||||
@@ -340,7 +343,7 @@ The following options need to be configured:
|
||||
CONFIG_GTH, CONFIG_RPXClassic, CONFIG_rsdproto,
|
||||
CONFIG_IAD210, CONFIG_RPXlite, CONFIG_sbc8260,
|
||||
CONFIG_EBONY, CONFIG_sacsng, CONFIG_FPS860L,
|
||||
CONFIG_V37, CONFIG_ELPT860
|
||||
CONFIG_V37, CONFIG_ELPT860, CONFIG_CMI
|
||||
|
||||
ARM based boards:
|
||||
-----------------
|
||||
@@ -617,6 +620,13 @@ The following options need to be configured:
|
||||
SIU Watchdog feature is enabled in the SYPCR
|
||||
register.
|
||||
|
||||
- U-Boot Version:
|
||||
CONFIG_VERSION_VARIABLE
|
||||
If this variable is defined, an environment variable
|
||||
named "ver" is created by U-Boot showing the U-Boot
|
||||
version as printed by the "version" command.
|
||||
This variable is readonly.
|
||||
|
||||
- Real-Time Clock:
|
||||
|
||||
When CFG_CMD_DATE is selected, the type of the RTC
|
||||
@@ -730,7 +740,7 @@ The following options need to be configured:
|
||||
16,7 Mill (24bit) 315 318 31b
|
||||
(i.e. setenv videomode 317; saveenv; reset;)
|
||||
|
||||
CONFIG_VIDEO_SED13806
|
||||
CONFIG_VIDEO_SED13806
|
||||
Enable Epson SED13806 driver. This driver supports 8bpp
|
||||
and 16bpp modes defined by CONFIG_VIDEO_SED13806_8BPP
|
||||
or CONFIG_VIDEO_SED13806_16BPP
|
||||
@@ -1245,7 +1255,7 @@ The following options need to be configured:
|
||||
Modem Support:
|
||||
--------------
|
||||
|
||||
[so far only for SMDK2400 board]
|
||||
[so far only for SMDK2400 and TRAB boards]
|
||||
|
||||
- Modem support endable:
|
||||
CONFIG_MODEM_SUPPORT
|
||||
@@ -1452,7 +1462,7 @@ following configurations:
|
||||
|
||||
These settings describe a second storage area used to hold
|
||||
a redundand copy of the environment data, so that there is
|
||||
a valid backup copy in case there is a power failur during
|
||||
a valid backup copy in case there is a power failure during
|
||||
a "saveenv" operation.
|
||||
|
||||
BE CAREFUL! Any changes to the flash layout, and some changes to the
|
||||
@@ -1532,20 +1542,16 @@ has been relocated to RAM and a RAM copy of the environment has been
|
||||
created; also, when using EEPROM you will have to use getenv_r()
|
||||
until then to read environment variables.
|
||||
|
||||
The environment is now protected by a CRC32 checksum. Before the
|
||||
monitor is relocated into RAM, as a result of a bad CRC you will be
|
||||
working with the compiled-in default environment - *silently*!!!
|
||||
[This is necessary, because the first environment variable we need is
|
||||
the "baudrate" setting for the console - if we have a bad CRC, we
|
||||
don't have any device yet where we could complain.]
|
||||
The environment is protected by a CRC32 checksum. Before the monitor
|
||||
is relocated into RAM, as a result of a bad CRC you will be working
|
||||
with the compiled-in default environment - *silently*!!! [This is
|
||||
necessary, because the first environment variable we need is the
|
||||
"baudrate" setting for the console - if we have a bad CRC, we don't
|
||||
have any device yet where we could complain.]
|
||||
|
||||
Note: once the monitor has been relocated, then it will complain if
|
||||
the default environment is used; a new CRC is computed as soon as you
|
||||
use the "setenv" command to modify / delete / add any environment
|
||||
variable [even when you try to delete a non-existing variable!].
|
||||
|
||||
Note2: you must edit your u-boot.lds file to reflect this
|
||||
configuration.
|
||||
use the "saveenv" command to store a valid environment.
|
||||
|
||||
|
||||
Low Level (hardware related) configuration options:
|
||||
@@ -1605,16 +1611,16 @@ Low Level (hardware related) configuration options:
|
||||
- MPC824X: data cache
|
||||
- PPC4xx: data cache
|
||||
|
||||
- CFG_INIT_DATA_OFFSET:
|
||||
- CFG_GBL_DATA_OFFSET:
|
||||
|
||||
Offset of the initial data structure in the memory
|
||||
area defined by CFG_INIT_RAM_ADDR. Usually
|
||||
CFG_INIT_DATA_OFFSET is chosen such that the initial
|
||||
CFG_GBL_DATA_OFFSET is chosen such that the initial
|
||||
data is located at the end of the available space
|
||||
(sometimes written as (CFG_INIT_RAM_END -
|
||||
CFG_INIT_DATA_SIZE), and the initial stack is just
|
||||
below that area (growing from (CFG_INIT_RAM_ADDR +
|
||||
CFG_INIT_DATA_OFFSET) downward.
|
||||
CFG_GBL_DATA_OFFSET) downward.
|
||||
|
||||
Note:
|
||||
On the MPC824X (or other systems that use the data
|
||||
@@ -1720,7 +1726,7 @@ configurations; the following names are supported:
|
||||
FPS850L_config Sandpoint8240_config sbc8260_config
|
||||
GENIETV_config TQM823L_config PIP405_config
|
||||
GEN860T_config EBONY_config FPS860L_config
|
||||
ELPT860_config
|
||||
ELPT860_config cmi_mpc5xx_config
|
||||
|
||||
Note: for some board special configuration names may exist; check if
|
||||
additional information is available from the board vendor; for
|
||||
@@ -1771,14 +1777,21 @@ to port U-Boot to your hardware platform. To do this, follow these
|
||||
steps:
|
||||
|
||||
1. Add a new configuration option for your board to the toplevel
|
||||
"Makefile", using the existing entries as examples.
|
||||
"Makefile" and to the "MAKEALL" script, using the existing
|
||||
entries as examples. Note that here and at many other places
|
||||
boards and other names are listed alphabetically sorted. Please
|
||||
keep this order.
|
||||
2. Create a new directory to hold your board specific code. Add any
|
||||
files you need.
|
||||
files you need. In your board directory, you will need at least
|
||||
the "Makefile", a "<board>.c", "flash.c" and "u-boot.lds".
|
||||
3. Create a new configuration file "include/configs/<board>.h" for
|
||||
your board
|
||||
3. If you're porting U-Boot to a new CPU, then also create a new
|
||||
directory to hold your CPU specific code. Add any files you need.
|
||||
4. Run "make config_name" with your new name.
|
||||
4. Run "make <board>_config" with your new name.
|
||||
5. Type "make", and you should get a working "u-boot.srec" file
|
||||
to be installed on your target system.
|
||||
6. Debug and solve any problems that might arise.
|
||||
[Of course, this last step is much harder than it sounds.]
|
||||
|
||||
|
||||
@@ -1905,6 +1918,12 @@ Some configuration options can be set using Environment Variables:
|
||||
be automatically started (by internally calling
|
||||
"bootm")
|
||||
|
||||
If set to "no", a standalone image passed to the
|
||||
"bootm" command will be copied to the load address
|
||||
(and eventually uncompressed), but NOT be started.
|
||||
This can be used to load and uncompress arbitrary
|
||||
data.
|
||||
|
||||
initrd_high - restrict positioning of initrd images:
|
||||
If this variable is not set, initrd images will be
|
||||
copied to the highest possible address in RAM; this
|
||||
@@ -1967,6 +1986,13 @@ the board). U-Boot refuses to delete or overwrite these variables
|
||||
once they have been set once.
|
||||
|
||||
|
||||
Further special Environment Variables:
|
||||
|
||||
ver - Contains the U-Boot version string as printed
|
||||
with the "version" command. This variable is
|
||||
readonly (see CONFIG_VERSION_VARIABLE).
|
||||
|
||||
|
||||
Please note that changes to some configuration parameters may take
|
||||
only effect after the next boot (yes, that's just like Windoze :-).
|
||||
|
||||
@@ -2375,18 +2401,18 @@ U-Boot supports the following image types:
|
||||
to boot over the network using BOOTP etc., where the boot
|
||||
server provides just a single image file, but you want to get
|
||||
for instance an OS kernel and a RAMDisk image.
|
||||
|
||||
|
||||
"Multi-File Images" start with a list of image sizes, each
|
||||
image size (in bytes) specified by an "uint32_t" in network
|
||||
byte order. This list is terminated by an "(uint32_t)0".
|
||||
Immediately after the terminating 0 follow the images, one by
|
||||
one, all aligned on "uint32_t" boundaries (size rounded up to
|
||||
a multiple of 4 bytes).
|
||||
|
||||
|
||||
"Firmware Images" are binary images containing firmware (like
|
||||
U-Boot or FPGA images) which usually will be programmed to
|
||||
flash memory.
|
||||
|
||||
|
||||
"Script files" are command sequences that will be executed by
|
||||
U-Boot's command interpreter; this feature is especially
|
||||
useful when you configure U-Boot to use a real shell (hush)
|
||||
@@ -2481,6 +2507,17 @@ Hit 'q':
|
||||
[q, b, e, ?] ## Application terminated, rc = 0x0
|
||||
|
||||
|
||||
|
||||
Minicom warning:
|
||||
================
|
||||
|
||||
Over time, many people have reported problems when trying to used the
|
||||
"minicom" terminal emulation program for serial download. I (wd)
|
||||
consider minicom to be broken, and recommend not to use it. Under
|
||||
Unix, I recommend to use CKermit for general purpose use (and
|
||||
especially for kermit binary protocol download ("loadb" command), and
|
||||
use "cu" for S-Record download ("loads" command).
|
||||
|
||||
NetBSD Notes:
|
||||
=============
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <AT91RM9200.h>
|
||||
#include <asm/arch/AT91RM9200.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/*
|
||||
|
||||
47
board/cmi/Makefile
Normal file
47
board/cmi/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2001 Wolfgang Denk, DENX Software Engineering, wd@denx.de
|
||||
#
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := flash.o cmi.o
|
||||
SOBJS :=
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
73
board/cmi/cmi.c
Normal file
73
board/cmi/cmi.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: cmi.c
|
||||
*
|
||||
* Discription: For generic board specific functions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xx.h>
|
||||
|
||||
#define SRAM_SIZE 1024000L /* 1M RAM available*/
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* Leading underscore on symbols */
|
||||
# define SYM_CHAR "_"
|
||||
#else /* No leading character on symbols */
|
||||
# define SYM_CHAR
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros to generate global absolutes.
|
||||
*/
|
||||
#define GEN_SYMNAME(str) SYM_CHAR #str
|
||||
#define GEN_VALUE(str) #str
|
||||
#define GEN_ABS(name, value) \
|
||||
asm (".globl " GEN_SYMNAME(name)); \
|
||||
asm (GEN_SYMNAME(name) " = " GEN_VALUE(value))
|
||||
|
||||
/*
|
||||
* Check the board
|
||||
*/
|
||||
int checkboard(void)
|
||||
{
|
||||
puts ("Board: ### No HW ID - assuming CMI board\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get RAM size.
|
||||
*/
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
return (SRAM_SIZE); /* We currently have a static size adapted for cmi board. */
|
||||
}
|
||||
|
||||
/*
|
||||
* Absolute environment address for linker file.
|
||||
*/
|
||||
GEN_ABS(env_start, CFG_ENV_OFFSET + CFG_FLASH_BASE);
|
||||
31
board/cmi/config.mk
Normal file
31
board/cmi/config.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# EPQ Board Configuration
|
||||
#
|
||||
|
||||
# Boot from flash at location 0x00000000
|
||||
TEXT_BASE = 0x02000000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
|
||||
517
board/cmi/flash.c
Normal file
517
board/cmi/flash.c
Normal file
@@ -0,0 +1,517 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: flash.c
|
||||
*
|
||||
* Discription: This Driver is for 28F320J3A, 28F640J3A and
|
||||
* 28F128J3A Intel flashs working in 16 Bit mode.
|
||||
* They are single bank flashs.
|
||||
*
|
||||
* Most of this code is taken from existing u-boot
|
||||
* source code.
|
||||
*/
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xx.h>
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define FLASH_ID_MASK 0xFFFF
|
||||
#define FLASH_BLOCK_SIZE 0x00010000
|
||||
#define FLASH_CMD_READ_ID 0x0090
|
||||
#define FLASH_CMD_RESET 0x00ff
|
||||
#define FLASH_CMD_BLOCK_ERASE 0x0020
|
||||
#define FLASH_CMD_ERASE_CONFIRM 0x00D0
|
||||
#define FLASH_CMD_CLEAR_STATUS 0x0050
|
||||
#define FLASH_CMD_SUSPEND_ERASE 0x00B0
|
||||
#define FLASH_CMD_WRITE 0x0040
|
||||
#define FLASH_CMD_PROTECT 0x0060
|
||||
#define FLASH_CMD_PROTECT_SET 0x0001
|
||||
#define FLASH_CMD_PROTECT_CLEAR 0x00D0
|
||||
#define FLASH_STATUS_DONE 0x0080
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
static ulong flash_get_size (vu_short *addr, flash_info_t *info);
|
||||
static int write_short (flash_info_t *info, ulong dest, ushort data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
|
||||
/*
|
||||
* Initialize flash
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
#if 1
|
||||
debug ("\n## Get flash bank 1 size @ 0x%08x\n",FLASH_BASE0_PRELIM);
|
||||
#endif
|
||||
size_b0 = flash_get_size((vu_short *)FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0: "
|
||||
"ID 0x%lx, Size = 0x%08lx = %ld MB\n",
|
||||
flash_info[0].flash_id,
|
||||
size_b0, size_b0<<20);
|
||||
}
|
||||
|
||||
flash_get_offsets (FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
flash_info[0].size = size_b0;
|
||||
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SECT_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
return size_b0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute start adress of each sector (block)
|
||||
*/
|
||||
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + i * FLASH_BLOCK_SIZE;
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
printf ("Don't know sector offsets for flash type 0x%lx\n",
|
||||
info->flash_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print flash information
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD: printf ("AMD "); break;
|
||||
case FLASH_MAN_FUJ: printf ("Fujitsu "); break;
|
||||
case FLASH_MAN_SST: printf ("SST "); break;
|
||||
case FLASH_MAN_STM: printf ("STM "); break;
|
||||
case FLASH_MAN_INTEL: printf ("Intel "); break;
|
||||
case FLASH_MAN_MT: printf ("MT "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F320J3A: printf ("28F320J3A (32Mbit) 16-Bit\n");
|
||||
break;
|
||||
case FLASH_28F640J3A: printf ("28F640J3A (64Mbit) 16-Bit\n");
|
||||
break;
|
||||
case FLASH_28F128J3A: printf ("28F128J3A (128Mbit) 16-Bit\n");
|
||||
break;
|
||||
default: printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->size >= (1 << 20)) {
|
||||
i = 20;
|
||||
} else {
|
||||
i = 10;
|
||||
}
|
||||
printf (" Size: %ld %cB in %d Sectors\n",
|
||||
info->size >> i,
|
||||
(i == 20) ? 'M' : 'k',
|
||||
info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get size of flash in bytes.
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size (vu_short *addr, flash_info_t *info)
|
||||
{
|
||||
vu_short value;
|
||||
|
||||
/* Read Manufacturer ID */
|
||||
addr[0] = FLASH_CMD_READ_ID;
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
case (AMD_MANUFACT & FLASH_ID_MASK):
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (FUJ_MANUFACT & FLASH_ID_MASK):
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case (SST_MANUFACT & FLASH_ID_MASK):
|
||||
info->flash_id = FLASH_MAN_SST;
|
||||
break;
|
||||
case (STM_MANUFACT & FLASH_ID_MASK):
|
||||
info->flash_id = FLASH_MAN_STM;
|
||||
break;
|
||||
case (INTEL_MANUFACT & FLASH_ID_MASK):
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = FLASH_CMD_RESET; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
case (INTEL_ID_28F320J3A & FLASH_ID_MASK):
|
||||
info->flash_id += FLASH_28F320J3A;
|
||||
info->sector_count = 32;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 32 MBit */
|
||||
|
||||
case (INTEL_ID_28F640J3A & FLASH_ID_MASK):
|
||||
info->flash_id += FLASH_28F640J3A;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 64 MBit */
|
||||
|
||||
case (INTEL_ID_28F128J3A & FLASH_ID_MASK):
|
||||
info->flash_id += FLASH_28F128J3A;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 128 MBit */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
addr[0] = FLASH_CMD_RESET; /* restore read mode */
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = FLASH_CMD_RESET; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Erase unprotected sectors
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL) {
|
||||
printf ("Can erase only Intel flash types - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
vu_short *addr = (vu_short *)(info->start[sect]);
|
||||
unsigned long status;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Erase sector %d at start addr 0x%08X", sect, (unsigned int)info->start[sect]);
|
||||
#endif
|
||||
|
||||
*addr = FLASH_CMD_CLEAR_STATUS;
|
||||
*addr = FLASH_CMD_BLOCK_ERASE;
|
||||
*addr = FLASH_CMD_ERASE_CONFIRM;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
while (((status = *addr) & FLASH_STATUS_DONE) != FLASH_STATUS_DONE) {
|
||||
if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Flash erase timeout at address %lx\n", info->start[sect]);
|
||||
*addr = FLASH_CMD_SUSPEND_ERASE;
|
||||
*addr = FLASH_CMD_RESET;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
*addr = FLASH_CMD_RESET;
|
||||
}
|
||||
}
|
||||
printf (" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
ushort data;
|
||||
int i, rc;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
wp = (addr & ~1); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start byte
|
||||
*/
|
||||
|
||||
if (addr - wp) {
|
||||
data = 0;
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
if ((rc = write_short(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
|
||||
while (cnt >= 2) {
|
||||
data = 0;
|
||||
for (i=0; i<2; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
|
||||
if ((rc = write_short(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 2;
|
||||
cnt -= 2;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i<2; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
return (write_short(info, wp, data));
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Write 16 bit (short) to flash
|
||||
*/
|
||||
|
||||
static int write_short (flash_info_t *info, ulong dest, ushort data)
|
||||
{
|
||||
vu_short *addr = (vu_short*)(info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_short *)dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
if (!(info->flash_id & FLASH_VENDMASK)) {
|
||||
return 4;
|
||||
}
|
||||
*addr = FLASH_CMD_ERASE_CONFIRM;
|
||||
*addr = FLASH_CMD_WRITE;
|
||||
|
||||
*((vu_short *)dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag) {
|
||||
enable_interrupts();
|
||||
}
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
|
||||
/* wait for error or finish */
|
||||
while(!(addr[0] & FLASH_STATUS_DONE)){
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
addr[0] = FLASH_CMD_RESET;
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
*addr = FLASH_CMD_RESET;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Protects a flash sector
|
||||
*/
|
||||
|
||||
int flash_real_protect(flash_info_t *info, long sector, int prot)
|
||||
{
|
||||
vu_short *addr = (vu_short*)(info->start[sector]);
|
||||
ulong start;
|
||||
|
||||
*addr = FLASH_CMD_CLEAR_STATUS;
|
||||
*addr = FLASH_CMD_PROTECT;
|
||||
|
||||
if(prot) {
|
||||
*addr = FLASH_CMD_PROTECT_SET;
|
||||
} else {
|
||||
*addr = FLASH_CMD_PROTECT_CLEAR;
|
||||
}
|
||||
|
||||
/* wait for error or finish */
|
||||
start = get_timer (0);
|
||||
while(!(addr[0] & FLASH_STATUS_DONE)){
|
||||
if (get_timer(start) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Flash protect timeout at address %lx\n", info->start[sector]);
|
||||
addr[0] = FLASH_CMD_RESET;
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
/* Set software protect flag */
|
||||
info->protect[sector] = prot;
|
||||
*addr = FLASH_CMD_RESET;
|
||||
return (0);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* (C) Copyright 2001 Wolfgang Denk, DENX Software Engineering, wd@denx.de
|
||||
* (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
@@ -56,15 +56,7 @@ SECTIONS
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
ppc/ppcstring.o (.text)
|
||||
ppc/vsprintf.o (.text)
|
||||
ppc/crc32.o (.text)
|
||||
ppc/zlib.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
cpu/mpc5xx/start.o (.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
@@ -127,7 +119,13 @@ SECTIONS
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
. = env_start;
|
||||
.ppcenv :
|
||||
{
|
||||
common/environment.o (.ppcenv)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,6 +38,9 @@ DRAM_SIZE: .long CFG_DRAM_SIZE
|
||||
sub pc,pc,#4
|
||||
.endm
|
||||
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
/*
|
||||
* Memory setup
|
||||
@@ -222,24 +225,29 @@ mem_init:
|
||||
/* Step 2c: Write FLYCNFG FIXME: what's that??? */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* test if we run from flash or RAM - RAM/BDI: don't setup RAM */
|
||||
adr r3, mem_init /* r0 <- current position of code */
|
||||
ldr r2, =mem_init
|
||||
cmp r3, r2 /* skip init if in place */
|
||||
beq initirqs
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2d: Initialize Timing for Sync Memory (SDCLK0) */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Before accessing MDREFR we need a valid DRI field, so we set */
|
||||
/* this to power on defaults + DIR field. */
|
||||
/* this to power on defaults + DRI field. */
|
||||
|
||||
ldr r3, =CFG_MDREFR_VAL
|
||||
ldr r2, =0xFFF
|
||||
and r3, r3, r2
|
||||
ldr r4, =0x03ca4000
|
||||
orr r4, r4, r3
|
||||
|
||||
ldr r4, =0x03ca4fff
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
ldr r4, =0x03ca4030
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
/* Note: preserve the mdrefr value in r4 */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 3: Initialize Synchronous Static Memory (Flash/Peripherals) */
|
||||
@@ -258,18 +266,16 @@ mem_init:
|
||||
/* Step 4: Initialize SDRAM */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Step 4a: assert MDREFR:K1RUN and MDREFR:K2RUN and configure */
|
||||
/* Step 4a: assert MDREFR:K?RUN and configure */
|
||||
/* MDREFR:K1DB2 and MDREFR:K2DB2 as desired. */
|
||||
|
||||
orr r4, r4, #(MDREFR_K1RUN|MDREFR_K0RUN)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
ldr r4, =CFG_MDREFR_VAL
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
/* Step 4b: de-assert MDREFR:SLFRSH. */
|
||||
|
||||
bic r4, r4, #(MDREFR_SLFRSH)
|
||||
bic r4, r4, #(MDREFR_SLFRSH)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@@ -234,6 +234,7 @@ int misc_init_r (void)
|
||||
|
||||
bd_t *bd = gd->bd;
|
||||
char * tmp; /* Temporary char pointer */
|
||||
unsigned long cntrl0Reg;
|
||||
|
||||
#ifdef CONFIG_CPCI405_VER2
|
||||
unsigned char *dst;
|
||||
@@ -241,7 +242,6 @@ int misc_init_r (void)
|
||||
int status;
|
||||
int index;
|
||||
int i;
|
||||
unsigned long cntrl0Reg;
|
||||
|
||||
/*
|
||||
* On CPCI-405 version 2 the environment is saved in eeprom!
|
||||
@@ -377,6 +377,12 @@ int misc_init_r (void)
|
||||
|
||||
#endif /* CONFIG_CPCI405_VER2 */
|
||||
|
||||
/*
|
||||
* Select cts (and not dsr) on uart1
|
||||
*/
|
||||
cntrl0Reg = mfdcr(cntrl0);
|
||||
mtdcr(cntrl0, cntrl0Reg | 0x00001000);
|
||||
|
||||
/*
|
||||
* Write ethernet addr in NVRAM for VxWorks
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <asm/inca-ip.h>
|
||||
|
||||
|
||||
extern uint incaip_get_cpuclk(void);
|
||||
|
||||
static ulong max_sdram_size(void)
|
||||
{
|
||||
/* The only supported SDRAM data width is 16bit.
|
||||
@@ -127,3 +129,29 @@ long int initdram(int board_type)
|
||||
return max_size;
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
|
||||
unsigned long chipid = *INCA_IP_WDT_CHIPID;
|
||||
int part_num;
|
||||
|
||||
puts ("Board: INCA-IP ");
|
||||
part_num = (chipid >> 12) & 0xffff;
|
||||
switch (part_num) {
|
||||
case 0xc0:
|
||||
printf ("Standard Version, ");
|
||||
break;
|
||||
case 0xc1:
|
||||
printf ("Basic Version, ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Part Number 0x%x ", part_num);
|
||||
break;
|
||||
}
|
||||
|
||||
printf ("Chip V1.%ld, ", (chipid >> 28));
|
||||
|
||||
printf("CPU Speed %d MHz\n", incaip_get_cpuclk()/1000000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ memsetup:
|
||||
sw t1, EBU_ADDSEL0(t0)
|
||||
|
||||
#if CPU_CLOCK_RATE==150000000 /* 150 MHz clock for the MIPS core */
|
||||
li t1, 0xE841417E
|
||||
li t1, 0xA841417E
|
||||
sw t1, EBU_BUSCON0(t0) /* value set up by magic flash word */
|
||||
sw t1, EBU_BUSCON2(t0)
|
||||
#else /* 100 MHz */
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
* Robert Schwebel, Pengutronix, <r.schwebel@pengutronix.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Kai-Uwe Bloem, GDS, <kai-uwe.bloem@auerswald.de>
|
||||
* Auerswald GmbH & Co KG, Germany
|
||||
* Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
|
||||
@@ -48,7 +48,7 @@ int i2c_init_board(void)
|
||||
icr = ICR; ICR &= ~(ICR_SCLE | ICR_IUE);
|
||||
|
||||
/* set gpio pin low _before_ we change direction to output */
|
||||
GPCR(70) = GPIO_bit(70);
|
||||
GPCR(70) = GPIO_bit(70);
|
||||
|
||||
/* now toggle between output=low and high-impedance */
|
||||
for (i = 0; i < 20; i++) {
|
||||
@@ -100,13 +100,8 @@ int board_init (void)
|
||||
/* memory and cpu-speed are setup before relocation */
|
||||
/* so we do _nothing_ here */
|
||||
|
||||
/* arch number of Innokom board */
|
||||
gd->bd->bi_arch_number = MACH_TYPE_INNOKOM;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0xa0000100;
|
||||
|
||||
/* baud rate */
|
||||
gd->bd->bi_baudrate = CONFIG_BAUDRATE;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -237,18 +237,17 @@ mem_init:
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Before accessing MDREFR we need a valid DRI field, so we set */
|
||||
/* this to power on defaults + DIR field. */
|
||||
/* this to power on defaults + DRI field. */
|
||||
|
||||
ldr r3, =CFG_MDREFR_VAL
|
||||
ldr r2, =0xFFF
|
||||
and r3, r3, r2
|
||||
ldr r4, =0x03ca4000
|
||||
orr r4, r4, r3
|
||||
|
||||
ldr r4, =0x03ca4fff
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
ldr r4, =0x03ca4030
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
/* Note: preserve the mdrefr value in r4 */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 3: Initialize Synchronous Static Memory (Flash/Peripherals) */
|
||||
@@ -267,18 +266,16 @@ mem_init:
|
||||
/* Step 4: Initialize SDRAM */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Step 4a: assert MDREFR:K1RUN and MDREFR:K2RUN and configure */
|
||||
/* Step 4a: assert MDREFR:K?RUN and configure */
|
||||
/* MDREFR:K1DB2 and MDREFR:K2DB2 as desired. */
|
||||
|
||||
orr r4, r4, #(MDREFR_K1RUN|MDREFR_K0RUN)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
ldr r4, =CFG_MDREFR_VAL
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
/* Step 4b: de-assert MDREFR:SLFRSH. */
|
||||
|
||||
bic r4, r4, #(MDREFR_SLFRSH)
|
||||
bic r4, r4, #(MDREFR_SLFRSH)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@@ -65,21 +65,22 @@ void pci_pip405_write_regs(struct pci_controller *hose, pci_dev_t dev,
|
||||
static void pci_pip405_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
|
||||
{
|
||||
unsigned char int_line = 0xff;
|
||||
unsigned char pin;
|
||||
/*
|
||||
* Write pci interrupt line register
|
||||
*/
|
||||
if(PCI_DEV(dev)==0) /* Device0 = PPC405 -> skip */
|
||||
return;
|
||||
if(PCI_FUNC(dev)==0)
|
||||
{
|
||||
/* assuming all function 0 are using their INTA# Pin*/
|
||||
int_line=PCI_IRQ_VECTOR(dev);
|
||||
pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, int_line);
|
||||
pci_hose_read_config_byte(hose, dev, PCI_INTERRUPT_PIN, &pin);
|
||||
if ((pin == 0) || (pin > 4))
|
||||
return;
|
||||
|
||||
int_line = ((PCI_DEV(dev) + (pin-1) + 10) % 4) + 28;
|
||||
pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, int_line);
|
||||
#ifdef DEBUG
|
||||
printf("Fixup IRQ: dev %d (%x) int line %d 0x%x\n",
|
||||
PCI_DEV(dev),dev,int_line,int_line);
|
||||
printf("Fixup IRQ: dev %d (%x) int line %d 0x%x\n",
|
||||
PCI_DEV(dev),dev,int_line,int_line);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
extern void pci_405gp_init(struct pci_controller *hose);
|
||||
@@ -90,11 +91,34 @@ static struct pci_controller hose = {
|
||||
fixup_irq: pci_pip405_fixup_irq,
|
||||
};
|
||||
|
||||
|
||||
static void reloc_pci_cfg_table(struct pci_config_table *table)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
unsigned long addr;
|
||||
|
||||
for (; table && table->vendor; table++) {
|
||||
addr = (ulong) (table->config_device) + gd->reloc_off;
|
||||
#ifdef DEBUG
|
||||
printf ("device \"%d\": 0x%08lx => 0x%08lx\n",
|
||||
table->device, (ulong) (table->config_device), addr);
|
||||
#endif
|
||||
table->config_device =
|
||||
(void (*)(struct pci_controller* hose, pci_dev_t dev,
|
||||
struct pci_config_table *))addr;
|
||||
table->priv[0]+=gd->reloc_off;
|
||||
}
|
||||
}
|
||||
|
||||
void pci_init_board(void)
|
||||
{
|
||||
/*we want the ptrs to RAM not flash (ie don't use init list)*/
|
||||
hose.fixup_irq = pci_pip405_fixup_irq;
|
||||
hose.config_table = pci_pip405_config_table;
|
||||
reloc_pci_cfg_table(hose.config_table);
|
||||
#ifdef DEBUG
|
||||
printf("Init PCI: fixup_irq=%p config_table=%p hose=%p\n",pci_pip405_fixup_irq,pci_pip405_config_table,hose);
|
||||
#endif
|
||||
pci_405gp_init(&hose);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,15 @@ const sdram_t sdram_table[] = {
|
||||
2, /* Address Mode = 2 */
|
||||
4, /* size value */
|
||||
1}, /* ECC enabled */
|
||||
{ 0x03, /* Rev A, 128MByte -4 Board */
|
||||
3, /* Case Latenty = 3 */
|
||||
3, /* trp 20ns / 7.5 ns datain[27] */
|
||||
3, /* trcd 20ns /7.5 ns (datain[29]) */
|
||||
6, /* tras 44ns /7.5 ns (datain[30]) */
|
||||
4, /* tcpt 44 - 20ns = 24ns */
|
||||
3, /* Address Mode = 3 */
|
||||
5, /* size value */
|
||||
1}, /* ECC enabled */
|
||||
{ 0xff, /* terminator */
|
||||
0xff,
|
||||
0xff,
|
||||
@@ -616,9 +625,15 @@ void print_mip405_rev (void)
|
||||
|
||||
int last_stage_init (void)
|
||||
{
|
||||
/* write correct LED configuration */
|
||||
if (miiphy_write (0x1, 0x14, 0x2402) != 0) {
|
||||
printf ("Error writing to the PHY\n");
|
||||
}
|
||||
/* since LED/CFG2 is not connected on the -2,
|
||||
* write to correct capability information */
|
||||
if (miiphy_write (0x1, 0x4, 0x01E1) != 0) {
|
||||
printf ("Error writing to the PHY\n");
|
||||
}
|
||||
print_mip405_rev ();
|
||||
show_stdio_dev ();
|
||||
check_env ();
|
||||
|
||||
41
board/purple/Makefile
Normal file
41
board/purple/Makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o sconsole.o
|
||||
SOBJS = memsetup.o
|
||||
|
||||
$(LIB): .depend $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
32
board/purple/config.mk
Normal file
32
board/purple/config.mk
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# Purple board with MIPS 5Kc CPU core
|
||||
#
|
||||
|
||||
# ROM version
|
||||
TEXT_BASE = 0xB0000000
|
||||
|
||||
# RAM version
|
||||
#TEXT_BASE = 0x80100000
|
||||
596
board/purple/flash.c
Normal file
596
board/purple/flash.c
Normal file
@@ -0,0 +1,596 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/inca-ip.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
typedef unsigned long FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned long FLASH_PORT_WIDTHV;
|
||||
|
||||
#define FLASH_ID_MASK 0xFFFFFFFF
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define ORMASK(size) ((-size) & OR_AM_MSK)
|
||||
|
||||
#define FLASH29_REG_ADRS(reg) ((FPWV *)PHYS_FLASH_1 + (reg))
|
||||
|
||||
/* FLASH29 command register addresses */
|
||||
|
||||
#define FLASH29_REG_FIRST_CYCLE FLASH29_REG_ADRS (0x1555)
|
||||
#define FLASH29_REG_SECOND_CYCLE FLASH29_REG_ADRS (0x2aaa)
|
||||
#define FLASH29_REG_THIRD_CYCLE FLASH29_REG_ADRS (0x3555)
|
||||
#define FLASH29_REG_FOURTH_CYCLE FLASH29_REG_ADRS (0x4555)
|
||||
#define FLASH29_REG_FIFTH_CYCLE FLASH29_REG_ADRS (0x5aaa)
|
||||
#define FLASH29_REG_SIXTH_CYCLE FLASH29_REG_ADRS (0x6555)
|
||||
|
||||
/* FLASH29 command definitions */
|
||||
|
||||
#define FLASH29_CMD_FIRST 0xaaaaaaaa
|
||||
#define FLASH29_CMD_SECOND 0x55555555
|
||||
#define FLASH29_CMD_FOURTH 0xaaaaaaaa
|
||||
#define FLASH29_CMD_FIFTH 0x55555555
|
||||
#define FLASH29_CMD_SIXTH 0x10101010
|
||||
|
||||
#define FLASH29_CMD_SECTOR 0x30303030
|
||||
#define FLASH29_CMD_PROGRAM 0xa0a0a0a0
|
||||
#define FLASH29_CMD_CHIP_ERASE 0x80808080
|
||||
#define FLASH29_CMD_READ_RESET 0xf0f0f0f0
|
||||
#define FLASH29_CMD_AUTOSELECT 0x90909090
|
||||
#define FLASH29_CMD_READ 0x70707070
|
||||
|
||||
#define IN_RAM_CMD_READ 0x1
|
||||
#define IN_RAM_CMD_WRITE 0x2
|
||||
|
||||
#define FLASH_WRITE_CMD ((ulong)(flash_write_cmd) & 0x7)+0xbf008000
|
||||
#define FLASH_READ_CMD ((ulong)(flash_read_cmd) & 0x7)+0xbf008000
|
||||
|
||||
typedef void (*FUNCPTR_CP)(ulong *source, ulong *destination, ulong nlongs);
|
||||
typedef void (*FUNCPTR_RD)(int cmd, FPWV * pFA, char * string, int strLen);
|
||||
typedef void (*FUNCPTR_WR)(int cmd, FPWV * pFA, FPW value);
|
||||
|
||||
static ulong flash_get_size(FPWV *addr, flash_info_t *info);
|
||||
static int write_word(flash_info_t *info, FPWV *dest, FPW data);
|
||||
static void flash_get_offsets(ulong base, flash_info_t *info);
|
||||
static flash_info_t *flash_get_info(ulong base);
|
||||
|
||||
static void load_cmd(ulong cmd);
|
||||
static ulong in_ram_cmd = 0;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Don't change the program architecture
|
||||
* This architecture assure the program
|
||||
* can be relocated to scratch ram
|
||||
*/
|
||||
static void flash_read_cmd(int cmd, FPWV * pFA, char * string, int strLen)
|
||||
{
|
||||
int i,j;
|
||||
FPW temp,temp1;
|
||||
FPWV *str;
|
||||
|
||||
str = (FPWV *)string;
|
||||
|
||||
j= strLen/4;
|
||||
|
||||
if(cmd == FLASH29_CMD_AUTOSELECT)
|
||||
{
|
||||
*(FLASH29_REG_FIRST_CYCLE) = FLASH29_CMD_FIRST;
|
||||
*(FLASH29_REG_SECOND_CYCLE) = FLASH29_CMD_SECOND;
|
||||
*(FLASH29_REG_THIRD_CYCLE) = FLASH29_CMD_AUTOSELECT;
|
||||
}
|
||||
|
||||
if(cmd == FLASH29_CMD_READ)
|
||||
{
|
||||
i = 0;
|
||||
while(i<j)
|
||||
{
|
||||
temp = *pFA++;
|
||||
temp1 = *(int *)0xa0000000;
|
||||
*(int *)0xbf0081f8 = temp1 + temp;
|
||||
*str++ = temp;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if(cmd == FLASH29_CMD_READ_RESET)
|
||||
{
|
||||
*(FLASH29_REG_FIRST_CYCLE) = FLASH29_CMD_FIRST;
|
||||
*(FLASH29_REG_SECOND_CYCLE) = FLASH29_CMD_SECOND;
|
||||
*(FLASH29_REG_THIRD_CYCLE) = FLASH29_CMD_READ_RESET;
|
||||
}
|
||||
|
||||
*(int *)0xbf0081f8 = *(int *)0xa0000000; /* dummy read switch back to sdram interface */
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Don't change the program architecture
|
||||
* This architecture assure the program
|
||||
* can be relocated to scratch ram
|
||||
*/
|
||||
static void flash_write_cmd(int cmd, FPWV * pFA, FPW value)
|
||||
{
|
||||
*(FLASH29_REG_FIRST_CYCLE) = FLASH29_CMD_FIRST;
|
||||
*(FLASH29_REG_SECOND_CYCLE) = FLASH29_CMD_SECOND;
|
||||
|
||||
if (cmd == FLASH29_CMD_SECTOR)
|
||||
{
|
||||
*(FLASH29_REG_THIRD_CYCLE) = FLASH29_CMD_CHIP_ERASE;
|
||||
*(FLASH29_REG_FOURTH_CYCLE) = FLASH29_CMD_FOURTH;
|
||||
*(FLASH29_REG_FIFTH_CYCLE) = FLASH29_CMD_FIFTH;
|
||||
*pFA = FLASH29_CMD_SECTOR;
|
||||
}
|
||||
|
||||
if (cmd == FLASH29_CMD_SIXTH)
|
||||
{
|
||||
*(FLASH29_REG_THIRD_CYCLE) = FLASH29_CMD_CHIP_ERASE;
|
||||
*(FLASH29_REG_FOURTH_CYCLE) = FLASH29_CMD_FOURTH;
|
||||
*(FLASH29_REG_FIFTH_CYCLE) = FLASH29_CMD_FIFTH;
|
||||
*(FLASH29_REG_SIXTH_CYCLE) = FLASH29_CMD_SIXTH;
|
||||
}
|
||||
|
||||
if (cmd == FLASH29_CMD_PROGRAM)
|
||||
{
|
||||
*(FLASH29_REG_THIRD_CYCLE) = FLASH29_CMD_PROGRAM;
|
||||
*pFA = value;
|
||||
}
|
||||
|
||||
if (cmd == FLASH29_CMD_READ_RESET)
|
||||
{
|
||||
*(FLASH29_REG_THIRD_CYCLE) = FLASH29_CMD_READ_RESET;
|
||||
}
|
||||
|
||||
*(int *)0xbf0081f8 = *(int *)0xa0000000; /* dummy read switch back to sdram interface */
|
||||
}
|
||||
|
||||
static void load_cmd(ulong cmd)
|
||||
{
|
||||
ulong *src;
|
||||
ulong *dst;
|
||||
FUNCPTR_CP absEntry;
|
||||
ulong func;
|
||||
|
||||
if (in_ram_cmd & cmd) return;
|
||||
|
||||
if (cmd == IN_RAM_CMD_READ)
|
||||
{
|
||||
func = (ulong)flash_read_cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
func = (ulong)flash_write_cmd;
|
||||
}
|
||||
|
||||
src = (ulong *)(func & 0xfffffff8);
|
||||
dst = (ulong *)0xbf008000;
|
||||
absEntry = (FUNCPTR_CP)(0xbf0081d0);
|
||||
absEntry(src,dst,0x38);
|
||||
|
||||
in_ram_cmd = cmd;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* flash_init()
|
||||
*
|
||||
* sets up flash_info and returns size of FLASH (bytes)
|
||||
*/
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size = 0;
|
||||
int i;
|
||||
|
||||
load_cmd(IN_RAM_CMD_READ);
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i < CFG_MAX_FLASH_BANKS; ++i) {
|
||||
ulong flashbase = PHYS_FLASH_1;
|
||||
ulong * buscon = (ulong *) INCA_IP_EBU_EBU_BUSCON0;
|
||||
|
||||
/* Disable write protection */
|
||||
*buscon &= ~INCA_IP_EBU_EBU_BUSCON1_WRDIS;
|
||||
|
||||
#if 1
|
||||
memset(&flash_info[i], 0, sizeof(flash_info_t));
|
||||
#endif
|
||||
|
||||
flash_info[i].size =
|
||||
flash_get_size((FPW *)flashbase, &flash_info[i]);
|
||||
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx\n",
|
||||
i, flash_info[i].size);
|
||||
}
|
||||
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+CFG_MONITOR_LEN-1,
|
||||
flash_get_info(CFG_MONITOR_BASE));
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SIZE-1,
|
||||
flash_get_info(CFG_ENV_ADDR));
|
||||
#endif
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD
|
||||
&& (info->flash_id & FLASH_TYPEMASK) == FLASH_AM160B) {
|
||||
|
||||
int bootsect_size[4]; /* number of bytes/boot sector */
|
||||
int sect_size; /* number of bytes/regular sector */
|
||||
|
||||
bootsect_size[0] = 0x00008000;
|
||||
bootsect_size[1] = 0x00004000;
|
||||
bootsect_size[2] = 0x00004000;
|
||||
bootsect_size[3] = 0x00010000;
|
||||
sect_size = 0x00020000;
|
||||
|
||||
/* set sector offsets for bottom boot block type */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base;
|
||||
base += i < 4 ? bootsect_size[i] : sect_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static flash_info_t *flash_get_info(ulong base)
|
||||
{
|
||||
int i;
|
||||
flash_info_t * info;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i ++) {
|
||||
info = & flash_info[i];
|
||||
if (info->start[0] <= base && base < info->start[0] + info->size)
|
||||
break;
|
||||
}
|
||||
|
||||
return i == CFG_MAX_FLASH_BANKS ? 0 : info;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
uchar *boottype;
|
||||
uchar *bootletter;
|
||||
uchar *fmt;
|
||||
uchar botbootletter[] = "B";
|
||||
uchar topbootletter[] = "T";
|
||||
uchar botboottype[] = "bottom boot sector";
|
||||
uchar topboottype[] = "top boot sector";
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD: printf ("AMD "); break;
|
||||
case FLASH_MAN_BM: printf ("BRIGHT MICRO "); break;
|
||||
case FLASH_MAN_FUJ: printf ("FUJITSU "); break;
|
||||
case FLASH_MAN_SST: printf ("SST "); break;
|
||||
case FLASH_MAN_STM: printf ("STM "); break;
|
||||
case FLASH_MAN_INTEL: printf ("INTEL "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
/* check for top or bottom boot, if it applies */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
boottype = botboottype;
|
||||
bootletter = botbootletter;
|
||||
}
|
||||
else {
|
||||
boottype = topboottype;
|
||||
bootletter = topbootletter;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM160B:
|
||||
fmt = "29LV160B%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F800C3B:
|
||||
case FLASH_28F800C3T:
|
||||
fmt = "28F800C3%s (8 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL800B:
|
||||
case FLASH_INTEL800T:
|
||||
fmt = "28F800B3%s (8 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F160C3B:
|
||||
case FLASH_28F160C3T:
|
||||
fmt = "28F160C3%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL160B:
|
||||
case FLASH_INTEL160T:
|
||||
fmt = "28F160B3%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F320C3B:
|
||||
case FLASH_28F320C3T:
|
||||
fmt = "28F320C3%s (32 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL320B:
|
||||
case FLASH_INTEL320T:
|
||||
fmt = "28F320B3%s (32 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F640C3B:
|
||||
case FLASH_28F640C3T:
|
||||
fmt = "28F640C3%s (64 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL640B:
|
||||
case FLASH_INTEL640T:
|
||||
fmt = "28F640B3%s (64 Mbit, %s)\n";
|
||||
break;
|
||||
default:
|
||||
fmt = "Unknown Chip Type\n";
|
||||
break;
|
||||
}
|
||||
|
||||
printf (fmt, bootletter, boottype);
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20,
|
||||
info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0) {
|
||||
printf ("\n ");
|
||||
}
|
||||
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
ulong flash_get_size (FPWV *addr, flash_info_t *info)
|
||||
{
|
||||
FUNCPTR_RD absEntry;
|
||||
FPW retValue;
|
||||
int flag;
|
||||
|
||||
load_cmd(IN_RAM_CMD_READ);
|
||||
absEntry = (FUNCPTR_RD)FLASH_READ_CMD;
|
||||
|
||||
flag = disable_interrupts();
|
||||
absEntry(FLASH29_CMD_AUTOSELECT,0,0,0);
|
||||
if (flag) enable_interrupts();
|
||||
|
||||
udelay(100);
|
||||
|
||||
flag = disable_interrupts();
|
||||
absEntry(FLASH29_CMD_READ, addr + 1, (char *)&retValue, sizeof(retValue));
|
||||
absEntry(FLASH29_CMD_READ_RESET,0,0,0);
|
||||
if (flag) enable_interrupts();
|
||||
|
||||
udelay(100);
|
||||
|
||||
switch (retValue) {
|
||||
|
||||
case (FPW)AMD_ID_LV160B:
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 8 or 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
flash_get_offsets((ulong)addr, info);
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
FPWV *addr;
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
int rcode = 0;
|
||||
FUNCPTR_WR absEntry;
|
||||
|
||||
load_cmd(IN_RAM_CMD_WRITE);
|
||||
absEntry = (FUNCPTR_WR)FLASH_WRITE_CMD;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM160B:
|
||||
break;
|
||||
case FLASH_UNKNOWN:
|
||||
default:
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
last = get_timer(0);
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last && rcode == 0; sect++) {
|
||||
|
||||
if (info->protect[sect] != 0) /* protected, skip it */
|
||||
continue;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr = (FPWV *)(info->start[sect]);
|
||||
absEntry(FLASH29_CMD_SECTOR, addr, 0);
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
start = get_timer(0);
|
||||
|
||||
while ((now = get_timer(start)) <= CFG_FLASH_ERASE_TOUT) {
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((get_timer(last)) > CFG_HZ) {/* every second */
|
||||
putc ('.');
|
||||
last = get_timer(0);
|
||||
}
|
||||
}
|
||||
|
||||
flag = disable_interrupts();
|
||||
absEntry(FLASH29_CMD_READ_RESET,0,0);
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
}
|
||||
|
||||
printf (" done\n");
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
FPW data = 0; /* 16 or 32 bit word, matches flash bus width on MPC8XX */
|
||||
int bytes; /* number of bytes to program in current word */
|
||||
int left; /* number of bytes left to program */
|
||||
int i, res;
|
||||
|
||||
for (left = cnt, res = 0;
|
||||
left > 0 && res == 0;
|
||||
addr += sizeof(data), left -= sizeof(data) - bytes) {
|
||||
|
||||
bytes = addr & (sizeof(data) - 1);
|
||||
addr &= ~(sizeof(data) - 1);
|
||||
|
||||
/* combine source and destination data so can program
|
||||
* an entire word of 16 or 32 bits
|
||||
*/
|
||||
for (i = 0; i < sizeof(data); i++) {
|
||||
data <<= 8;
|
||||
if (i < bytes || i - bytes >= left )
|
||||
data += *((uchar *)addr + i);
|
||||
else
|
||||
data += *src++;
|
||||
}
|
||||
|
||||
res = write_word(info, (FPWV *)addr, data);
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
static int write_word (flash_info_t *info, FPWV *dest, FPW data)
|
||||
{
|
||||
int res = 0; /* result, assume success */
|
||||
FUNCPTR_WR absEntry;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*dest & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
if (info->start[0] != PHYS_FLASH_1)
|
||||
{
|
||||
return (3);
|
||||
}
|
||||
|
||||
load_cmd(IN_RAM_CMD_WRITE);
|
||||
absEntry = (FUNCPTR_WR)FLASH_WRITE_CMD;
|
||||
|
||||
flag = disable_interrupts();
|
||||
absEntry(FLASH29_CMD_PROGRAM,dest,data);
|
||||
if (flag) enable_interrupts();
|
||||
|
||||
udelay(100);
|
||||
|
||||
flag = disable_interrupts();
|
||||
absEntry(FLASH29_CMD_READ_RESET,0,0);
|
||||
if (flag) enable_interrupts();
|
||||
|
||||
return (res);
|
||||
}
|
||||
35
board/purple/memsetup.S
Normal file
35
board/purple/memsetup.S
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Memory sub-system initialization code for PURPLE development board.
|
||||
*
|
||||
* Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
#include <asm/regdef.h>
|
||||
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
|
||||
j ra
|
||||
nop
|
||||
|
||||
197
board/purple/purple.c
Normal file
197
board/purple/purple.c
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <asm/inca-ip.h>
|
||||
#include <asm/regdef.h>
|
||||
#include <asm/mipsregs.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/cacheops.h>
|
||||
|
||||
#include "sconsole.h"
|
||||
|
||||
#define cache_unroll(base,op) \
|
||||
__asm__ __volatile__(" \
|
||||
.set noreorder; \
|
||||
.set mips3; \
|
||||
cache %1, (%0); \
|
||||
.set mips0; \
|
||||
.set reorder" \
|
||||
: \
|
||||
: "r" (base), \
|
||||
"i" (op));
|
||||
|
||||
typedef void (*FUNCPTR)(ulong *source, ulong *destination, ulong nlongs);
|
||||
|
||||
extern void asc_serial_init (void);
|
||||
extern void asc_serial_putc (char);
|
||||
extern void asc_serial_puts (const char *);
|
||||
extern int asc_serial_getc (void);
|
||||
extern int asc_serial_tstc (void);
|
||||
extern void asc_serial_setbrg (void);
|
||||
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
/* The only supported number of SDRAM banks is 4.
|
||||
*/
|
||||
#define CFG_NB 4
|
||||
|
||||
ulong cfgpb0 = *INCA_IP_SDRAM_MC_CFGPB0;
|
||||
ulong cfgdw = *INCA_IP_SDRAM_MC_CFGDW;
|
||||
int cols = cfgpb0 & 0xF;
|
||||
int rows = (cfgpb0 & 0xF0) >> 4;
|
||||
int dw = cfgdw & 0xF;
|
||||
ulong size = (1 << (rows + cols)) * (1 << (dw - 1)) * CFG_NB;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
|
||||
unsigned long chipid = *(unsigned long *)0xB800C800;
|
||||
|
||||
printf ("Board: Purple PLB 2800 chip version %ld, ", chipid & 0xF);
|
||||
|
||||
printf("CPU Speed %d MHz\n", CPU_CLOCK_RATE/1000000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
asc_serial_init ();
|
||||
|
||||
sconsole_putc = asc_serial_putc;
|
||||
sconsole_puts = asc_serial_puts;
|
||||
sconsole_getc = asc_serial_getc;
|
||||
sconsole_tstc = asc_serial_tstc;
|
||||
sconsole_setbrg = asc_serial_setbrg;
|
||||
|
||||
sconsole_flush ();
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* copydwords - copy one buffer to another a long at a time
|
||||
*
|
||||
* This routine copies the first <nlongs> longs from <source> to <destination>.
|
||||
*/
|
||||
static void copydwords (ulong *source, ulong *destination, ulong nlongs)
|
||||
{
|
||||
ulong temp,temp1;
|
||||
ulong *dstend = destination + nlongs;
|
||||
|
||||
while (destination < dstend)
|
||||
{
|
||||
temp = *source++;
|
||||
/* dummy read from sdram */
|
||||
temp1 = *(ulong *)0xa0000000;
|
||||
/* avoid optimization from compliler */
|
||||
*(ulong *)0xbf0081f8 = temp1 + temp;
|
||||
*destination++ = temp;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* copyLongs - copy one buffer to another a long at a time
|
||||
*
|
||||
* This routine copies the first <nlongs> longs from <source> to <destination>.
|
||||
*/
|
||||
static void copyLongs (ulong *source, ulong *destination, ulong nlongs)
|
||||
{
|
||||
FUNCPTR absEntry;
|
||||
|
||||
absEntry = (FUNCPTR)(0xbf008000+((ulong)copydwords & 0x7));
|
||||
absEntry(source, destination, nlongs);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* programLoad - load program into ram
|
||||
*
|
||||
* This routine load copydwords into ram
|
||||
*
|
||||
*/
|
||||
static void programLoad(void)
|
||||
{
|
||||
FUNCPTR absEntry;
|
||||
ulong *src,*dst;
|
||||
|
||||
src = (ulong *)(TEXT_BASE + 0x428);
|
||||
dst = (ulong *)0xbf0081d0;
|
||||
|
||||
absEntry = (FUNCPTR)(TEXT_BASE + 0x400);
|
||||
absEntry(src,dst,0x6);
|
||||
|
||||
src = (ulong *)((ulong)copydwords & 0xfffffff8);
|
||||
dst = (ulong *)0xbf008000;
|
||||
|
||||
absEntry(src,dst,0x38);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* copy_code - copy u-boot image from flash to RAM
|
||||
*
|
||||
* This routine is needed to solve flash problems on this board
|
||||
*
|
||||
*/
|
||||
void copy_code (ulong dest_addr)
|
||||
{
|
||||
unsigned long start;
|
||||
unsigned long end;
|
||||
|
||||
/* load copydwords into ram
|
||||
*/
|
||||
programLoad();
|
||||
|
||||
/* copy u-boot code
|
||||
*/
|
||||
copyLongs((ulong *)CFG_MONITOR_BASE,
|
||||
(ulong *)dest_addr,
|
||||
(CFG_MONITOR_LEN + 3) / 4);
|
||||
|
||||
|
||||
/* flush caches
|
||||
*/
|
||||
|
||||
start = KSEG0;
|
||||
end = start + CFG_DCACHE_SIZE;
|
||||
while(start < end) {
|
||||
cache_unroll(start,Index_Writeback_Inv_D);
|
||||
start += CFG_CACHELINE_SIZE;
|
||||
}
|
||||
|
||||
start = KSEG0;
|
||||
end = start + CFG_ICACHE_SIZE;
|
||||
while(start < end) {
|
||||
cache_unroll(start,Index_Invalidate_I);
|
||||
start += CFG_CACHELINE_SIZE;
|
||||
}
|
||||
}
|
||||
125
board/purple/sconsole.c
Normal file
125
board/purple/sconsole.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <common.h>
|
||||
|
||||
#include "sconsole.h"
|
||||
|
||||
void (*sconsole_putc) (char) = 0;
|
||||
void (*sconsole_puts) (const char *) = 0;
|
||||
int (*sconsole_getc) (void) = 0;
|
||||
int (*sconsole_tstc) (void) = 0;
|
||||
void (*sconsole_setbrg) (void) = 0;
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
sconsole_buffer_t *sb = SCONSOLE_BUFFER;
|
||||
|
||||
sb->pos = 0;
|
||||
sb->size = 0;
|
||||
sb->max_size = CFG_SCONSOLE_SIZE - sizeof (sconsole_buffer_t);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void serial_putc (char c)
|
||||
{
|
||||
if (sconsole_putc) {
|
||||
(*sconsole_putc) (c);
|
||||
} else {
|
||||
sconsole_buffer_t *sb = SCONSOLE_BUFFER;
|
||||
|
||||
if (c) {
|
||||
sb->data[sb->pos++] = c;
|
||||
if (sb->pos == sb->max_size) {
|
||||
sb->pos = 0;
|
||||
}
|
||||
if (sb->size < sb->max_size) {
|
||||
sb->size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
if (sconsole_puts) {
|
||||
(*sconsole_puts) (s);
|
||||
} else {
|
||||
sconsole_buffer_t *sb = SCONSOLE_BUFFER;
|
||||
|
||||
while (*s) {
|
||||
sb->data[sb->pos++] = *s++;
|
||||
if (sb->pos == sb->max_size) {
|
||||
sb->pos = 0;
|
||||
}
|
||||
if (sb->size < sb->max_size) {
|
||||
sb->size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc (void)
|
||||
{
|
||||
if (sconsole_getc) {
|
||||
return (*sconsole_getc) ();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int serial_tstc (void)
|
||||
{
|
||||
if (sconsole_tstc) {
|
||||
return (*sconsole_tstc) ();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
if (sconsole_setbrg) {
|
||||
(*sconsole_setbrg) ();
|
||||
}
|
||||
}
|
||||
|
||||
void sconsole_flush (void)
|
||||
{
|
||||
if (sconsole_putc) {
|
||||
sconsole_buffer_t *sb = SCONSOLE_BUFFER;
|
||||
unsigned int end = sb->pos < sb->size
|
||||
? sb->pos + sb->max_size - sb->size
|
||||
: sb->pos - sb->size;
|
||||
|
||||
while (sb->size) {
|
||||
(*sconsole_putc) (sb->data[end++]);
|
||||
if (end == sb->max_size) {
|
||||
end = 0;
|
||||
}
|
||||
sb->size--;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
board/purple/sconsole.h
Normal file
47
board/purple/sconsole.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _SCONSOLE_H_
|
||||
#define _SCONSOLE_H_
|
||||
|
||||
#include <config.h>
|
||||
|
||||
typedef struct sconsole_buffer_s
|
||||
{
|
||||
unsigned long size;
|
||||
unsigned long max_size;
|
||||
unsigned long pos;
|
||||
char data [1];
|
||||
} sconsole_buffer_t;
|
||||
|
||||
#define SCONSOLE_BUFFER ((sconsole_buffer_t *) CFG_SCONSOLE_ADDR)
|
||||
|
||||
extern void (* sconsole_putc) (char);
|
||||
extern void (* sconsole_puts) (const char *);
|
||||
extern int (* sconsole_getc) (void);
|
||||
extern int (* sconsole_tstc) (void);
|
||||
extern void (* sconsole_setbrg) (void);
|
||||
|
||||
extern void sconsole_flush (void);
|
||||
|
||||
#endif
|
||||
74
board/purple/u-boot.lds
Normal file
74
board/purple/u-boot.lds
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk Engineering, <wd@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
|
||||
*/
|
||||
OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradbigmips")
|
||||
OUTPUT_ARCH(mips)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/mips/start.o (.text)
|
||||
board/purple/memsetup.o (.text)
|
||||
cpu/mips/cache.o (.text)
|
||||
common/main.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
common/cmd_boot.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/environment.o (.ppcenv)
|
||||
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.sdata : { *(.sdata) }
|
||||
|
||||
_gp = ALIGN(16);
|
||||
|
||||
__got_start = .;
|
||||
.got : { *(.got) }
|
||||
__got_end = .;
|
||||
|
||||
.sdata : { *(.sdata) }
|
||||
|
||||
uboot_end_data = .;
|
||||
num_got_entries = (__got_end - __got_start) >> 2;
|
||||
|
||||
. = ALIGN(4);
|
||||
.sbss : { *(.sbss) }
|
||||
.bss : { *(.bss) }
|
||||
uboot_end = .;
|
||||
}
|
||||
@@ -126,12 +126,12 @@ long int initdram (int board_type)
|
||||
memctl->memc_mar = 0x00000088;
|
||||
|
||||
/*
|
||||
* Map controller bank 1 to the SDRAM bank at
|
||||
* Map controller bank 2 to the SDRAM bank at
|
||||
* preliminary address - these have to be modified after the
|
||||
* SDRAM size has been determined.
|
||||
*/
|
||||
memctl->memc_or1 = CFG_OR1_PRELIM;
|
||||
memctl->memc_br1 = CFG_BR1_PRELIM;
|
||||
memctl->memc_or2 = CFG_OR2_PRELIM;
|
||||
memctl->memc_br2 = CFG_BR2_PRELIM;
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR_8COL & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
@@ -139,9 +139,9 @@ long int initdram (int board_type)
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
|
||||
memctl->memc_mcr = 0x80004105; /* SDRAM bank 0 */
|
||||
udelay (200);
|
||||
memctl->memc_mcr = 0x80002230; /* SDRAM bank 0 - execute twice */
|
||||
memctl->memc_mcr = 0x80004230; /* SDRAM bank 0 - execute twice */
|
||||
udelay (200);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
@@ -153,7 +153,7 @@ long int initdram (int board_type)
|
||||
*
|
||||
* try 8 column mode
|
||||
*/
|
||||
size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE1_PRELIM,
|
||||
size8 = dram_size (CFG_MAMR_8COL, (ulong *) SDRAM_BASE2_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
udelay (1000);
|
||||
@@ -161,13 +161,13 @@ long int initdram (int board_type)
|
||||
/*
|
||||
* try 9 column mode
|
||||
*/
|
||||
size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE1_PRELIM,
|
||||
size9 = dram_size (CFG_MAMR_9COL, (ulong *) SDRAM_BASE2_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
if (size8 < size9) { /* leave configuration at 9 columns */
|
||||
size_b0 = size9;
|
||||
/* debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size >> 20); */
|
||||
} else { /* back to 8 columns */
|
||||
} else { /* back to 8 columns */
|
||||
size_b0 = size8;
|
||||
memctl->memc_mamr = CFG_MAMR_8COL;
|
||||
udelay (500);
|
||||
@@ -200,6 +200,47 @@ long int initdram (int board_type)
|
||||
|
||||
udelay (10000);
|
||||
|
||||
#ifdef CONFIG_CAN_DRIVER
|
||||
/* Initialize OR3 / BR3 */
|
||||
memctl->memc_or3 = CFG_OR3_CAN; /* switch GPLB_5 to GPLA_5 */
|
||||
memctl->memc_br3 = CFG_BR3_CAN;
|
||||
|
||||
/* Initialize MBMR */
|
||||
memctl->memc_mbmr = MAMR_GPL_B4DIS; /* GPL_B4 works as UPWAITB */
|
||||
|
||||
/* Initialize UPMB for CAN: single read */
|
||||
memctl->memc_mdr = 0xFFFFC004;
|
||||
memctl->memc_mcr = 0x0100 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x0FFFD004;
|
||||
memctl->memc_mcr = 0x0101 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x0FFFC000;
|
||||
memctl->memc_mcr = 0x0102 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x3FFFC004;
|
||||
memctl->memc_mcr = 0x0103 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xFFFFDC05;
|
||||
memctl->memc_mcr = 0x0104 | UPMB;
|
||||
|
||||
/* Initialize UPMB for CAN: single write */
|
||||
memctl->memc_mdr = 0xFFFCC004;
|
||||
memctl->memc_mcr = 0x0118 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xCFFCD004;
|
||||
memctl->memc_mcr = 0x0119 | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x0FFCC000;
|
||||
memctl->memc_mcr = 0x011A | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0x7FFCC004;
|
||||
memctl->memc_mcr = 0x011B | UPMB;
|
||||
|
||||
memctl->memc_mdr = 0xFFFDCC05;
|
||||
memctl->memc_mcr = 0x011C | UPMB;
|
||||
#endif
|
||||
|
||||
return (size_b0);
|
||||
}
|
||||
|
||||
@@ -213,8 +254,8 @@ long int initdram (int board_type)
|
||||
* - short between data lines
|
||||
*/
|
||||
|
||||
static long int dram_size (long int mamr_value, long int *base,
|
||||
long int maxsize)
|
||||
static long int dram_size (long int mamr_value,
|
||||
long int *base, long int maxsize)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
@@ -257,10 +298,10 @@ static long int dram_size (long int mamr_value, long int *base,
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void r360_pwm_write (uchar reg, uchar val)
|
||||
void r360_i2c_lcd_write (uchar data0, uchar data1)
|
||||
{
|
||||
if (i2c_write (CFG_I2C_PWM_ADDR, reg, 1, &val, 1)) {
|
||||
printf ("Can't write PWM register 0x%02X.\n", reg);
|
||||
if (i2c_write (CFG_I2C_LCD_ADDR, data0, 1, &data1, 1)) {
|
||||
printf("Can't write lcd data 0x%02X 0x%02X.\n", data0, data1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,10 +312,8 @@ void r360_pwm_write (uchar reg, uchar val)
|
||||
*/
|
||||
|
||||
/* Number of bytes returned from Keyboard Controller */
|
||||
#define KEYBD_KEY_MAX 20 /* maximum key number */
|
||||
#define KEYBD_DATALEN ((KEYBD_KEY_MAX + 7) / 8) /* normal key scan data */
|
||||
|
||||
static uchar kbd_addr = CFG_I2C_KBD_ADDR;
|
||||
#define KEYBD_KEY_MAX 16 /* maximum key number */
|
||||
#define KEYBD_DATALEN ((KEYBD_KEY_MAX + 7) / 8) /* normal key scan data */
|
||||
|
||||
static uchar *key_match (uchar *);
|
||||
|
||||
@@ -287,14 +326,14 @@ int misc_init_r (void)
|
||||
|
||||
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
|
||||
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
i2c_read (CFG_I2C_KEY_ADDR, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
|
||||
for (i = 0; i < KEYBD_DATALEN; ++i) {
|
||||
sprintf (keybd_env + i + i, "%02X", kbd_data[i]);
|
||||
}
|
||||
setenv ("keybd", keybd_env);
|
||||
|
||||
str = strdup (key_match (kbd_data)); /* decode keys */
|
||||
str = strdup (key_match (keybd_env)); /* decode keys */
|
||||
|
||||
#ifdef CONFIG_PREBOOT /* automatically configure "preboot" command on key match */
|
||||
setenv ("preboot", str); /* set or delete definition */
|
||||
@@ -324,16 +363,13 @@ int misc_init_r (void)
|
||||
static uchar kbd_magic_prefix[] = "key_magic";
|
||||
static uchar kbd_command_prefix[] = "key_cmd";
|
||||
|
||||
static uchar *key_match (uchar * kbd_data)
|
||||
static uchar *key_match (uchar * kbd_str)
|
||||
{
|
||||
uchar compare[KEYBD_DATALEN];
|
||||
uchar magic[sizeof (kbd_magic_prefix) + 1];
|
||||
uchar cmd_name[sizeof (kbd_command_prefix) + 1];
|
||||
uchar key_mask;
|
||||
uchar *str, *nxt, *suffix;
|
||||
uchar *str, *suffix;
|
||||
uchar *kbd_magic_keys;
|
||||
char *cmd;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* The following string defines the characters that can pe appended
|
||||
@@ -343,62 +379,48 @@ static uchar *key_match (uchar * kbd_data)
|
||||
* "key_magic" is checked (old behaviour); the string "125" causes
|
||||
* checks for "key_magic1", "key_magic2" and "key_magic5", etc.
|
||||
*/
|
||||
if ((kbd_magic_keys = getenv ("magic_keys")) == NULL)
|
||||
kbd_magic_keys = "";
|
||||
if ((kbd_magic_keys = getenv ("magic_keys")) != NULL) {
|
||||
/* loop over all magic keys;
|
||||
* use '\0' suffix in case of empty string
|
||||
*/
|
||||
for (suffix = kbd_magic_keys;
|
||||
*suffix || suffix == kbd_magic_keys;
|
||||
++suffix) {
|
||||
sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
|
||||
|
||||
/* loop over all magic keys;
|
||||
* use '\0' suffix in case of empty string
|
||||
*/
|
||||
for (suffix=kbd_magic_keys; *suffix || suffix==kbd_magic_keys; ++suffix) {
|
||||
sprintf (magic, "%s%c", kbd_magic_prefix, *suffix);
|
||||
#if 0
|
||||
printf ("### Check magic \"%s\"\n", magic);
|
||||
printf ("### Check magic \"%s\"\n", magic);
|
||||
#endif
|
||||
|
||||
memcpy(compare, kbd_data, KEYBD_DATALEN);
|
||||
if ((str = getenv (magic)) != 0) {
|
||||
|
||||
for (str = getenv(magic); str != NULL; str = (*nxt) ? nxt+1 : nxt) {
|
||||
uchar c;
|
||||
#if 0
|
||||
printf ("### Compare \"%s\" \"%s\"\n",
|
||||
kbd_str, str);
|
||||
#endif
|
||||
if (strcmp (kbd_str, str) == 0) {
|
||||
sprintf (cmd_name, "%s%c",
|
||||
kbd_command_prefix,
|
||||
*suffix);
|
||||
|
||||
c = (uchar) simple_strtoul (str, (char **) (&nxt), 16);
|
||||
|
||||
if (str == nxt) /* invalid character */
|
||||
break;
|
||||
|
||||
if (c >= KEYBD_KEY_MAX) /* bad key number */
|
||||
goto next_magic;
|
||||
|
||||
key_mask = 0x80 >> (c % 8);
|
||||
|
||||
if (!(compare[c / 8] & key_mask)) /* key not pressed */
|
||||
goto next_magic;
|
||||
|
||||
compare[c / 8] &= ~key_mask;
|
||||
if ((cmd = getenv (cmd_name)) != 0) {
|
||||
#if 0
|
||||
printf ("### Set PREBOOT to $(%s): \"%s\"\n",
|
||||
cmd_name, cmd);
|
||||
#endif
|
||||
return (cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<KEYBD_DATALEN; i++)
|
||||
if (compare[i]) /* key(s) not released */
|
||||
goto next_magic;
|
||||
|
||||
sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix);
|
||||
|
||||
cmd = getenv (cmd_name);
|
||||
#if 0
|
||||
printf ("### Set PREBOOT to $(%s): \"%s\"\n",
|
||||
cmd_name, cmd ? cmd : "<<NULL>>");
|
||||
#endif
|
||||
*kbd_data = *suffix;
|
||||
return (cmd);
|
||||
|
||||
next_magic:;
|
||||
}
|
||||
#if 0
|
||||
printf ("### Delete PREBOOT\n");
|
||||
#endif
|
||||
*kbd_data = '\0';
|
||||
*kbd_str = '\0';
|
||||
return (NULL);
|
||||
}
|
||||
#endif /* CONFIG_PREBOOT */
|
||||
#endif /* CONFIG_PREBOOT */
|
||||
|
||||
/* Read Keyboard status */
|
||||
int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
@@ -410,7 +432,7 @@ int do_kbd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
|
||||
|
||||
/* Read keys */
|
||||
i2c_read (kbd_addr, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
i2c_read (CFG_I2C_KEY_ADDR, 0, 0, kbd_data, KEYBD_DATALEN);
|
||||
|
||||
puts ("Keys:");
|
||||
for (i = 0; i < KEYBD_DATALEN; ++i) {
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#include <net.h> /* for eth_init() */
|
||||
#include <rtc.h>
|
||||
#include "sixnet.h"
|
||||
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
||||
# include <status_led.h>
|
||||
#endif
|
||||
|
||||
#define ORMASK(size) ((-size) & OR_AM_MSK)
|
||||
|
||||
@@ -35,6 +38,22 @@ static long ram_size(ulong *, long);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
||||
void show_boot_progress (int status)
|
||||
{
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
# if defined(STATUS_LED_BOOT)
|
||||
if (status == 15) {
|
||||
/* ready to transfer to kernel, make sure LED is proper state */
|
||||
status_led_set(STATUS_LED_BOOT, CONFIG_BOOT_LED_STATE);
|
||||
}
|
||||
# endif /* STATUS_LED_BOOT */
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
* returns 0 if recognized, -1 if unknown
|
||||
@@ -235,6 +254,9 @@ int misc_init_r (void)
|
||||
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
char* s;
|
||||
char* e;
|
||||
int reg;
|
||||
bd_t *bd = gd->bd;
|
||||
|
||||
memctl->memc_or2 = NVRAM_OR_PRELIM;
|
||||
@@ -283,18 +305,19 @@ int misc_init_r (void)
|
||||
immap->im_sit.sit_rtc = tim;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* The code below is no longer valid since the prototype of
|
||||
* eth_init() and eth_halt() have been changed to support
|
||||
* multi-ethernet feature in U-Boot; the eth_initialize()
|
||||
* routine should be called before any access to the ethernet
|
||||
* callbacks.
|
||||
/* set up ethernet address for SCC ethernet. If eth1addr
|
||||
* is present it gets a unique address, otherwise it
|
||||
* shares the FEC address.
|
||||
*/
|
||||
s = getenv("eth1addr");
|
||||
if (s == NULL)
|
||||
s = getenv("ethaddr");
|
||||
for (reg=0; reg<6; ++reg) {
|
||||
bd->bi_enet1addr[reg] = s ? simple_strtoul(s, &e, 16) : 0;
|
||||
if (s)
|
||||
s = (*e) ? e+1 : e;
|
||||
}
|
||||
|
||||
/* FIXME - for now init ethernet to force PHY special mode */
|
||||
eth_init(bd);
|
||||
eth_halt();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -307,7 +330,7 @@ int misc_init_r (void)
|
||||
*
|
||||
* The memory size MUST be a power of 2 for this to work.
|
||||
*
|
||||
* The only memory modified is 4 bytes at offset 0. This is important
|
||||
* The only memory modified is 8 bytes at offset 0. This is important
|
||||
* since for the SRAM this location is reserved for autosizing, so if
|
||||
* it is modified and the board is reset before ram_size() completes
|
||||
* no damage is done. Normally even the memory at 0 is preserved. The
|
||||
@@ -319,28 +342,27 @@ static long ram_size(ulong *base, long maxsize)
|
||||
{
|
||||
volatile long *test_addr;
|
||||
volatile long *base_addr = base;
|
||||
volatile long *flash = (volatile long*)CFG_FLASH_BASE;
|
||||
ulong ofs; /* byte offset from base_addr */
|
||||
ulong save; /* to make test non-destructive */
|
||||
ulong junk;
|
||||
ulong save2; /* to make test non-destructive */
|
||||
long ramsize = -1; /* size not determined yet */
|
||||
|
||||
save = *base_addr; /* save value at 0 so can restore */
|
||||
save2 = *(base_addr+1); /* save value at 4 so can restore */
|
||||
|
||||
/* is any SRAM present? */
|
||||
*base_addr = 0x5555aaaa;
|
||||
|
||||
/* use flash read to modify data bus, since with no SRAM present
|
||||
* the data bus may retain the value if our code is running
|
||||
* completely in the cache.
|
||||
/* It is important to drive the data bus with different data so
|
||||
* it doesn't remember the value and look like RAM that isn't there.
|
||||
*/
|
||||
junk = *flash;
|
||||
*(base_addr + 1) = 0xaaaa5555; /* use write to modify data bus */
|
||||
|
||||
if (*base_addr != 0x5555aaaa)
|
||||
ramsize = 0; /* no RAM present, or defective */
|
||||
else {
|
||||
*base_addr = 0xaaaa5555;
|
||||
junk = *flash; /* use flash read to modify data bus */
|
||||
*(base_addr + 1) = 0x5555aaaa; /* use write to modify data bus */
|
||||
if (*base_addr != 0xaaaa5555)
|
||||
ramsize = 0; /* no RAM present, or defective */
|
||||
}
|
||||
@@ -355,6 +377,7 @@ static long ram_size(ulong *base, long maxsize)
|
||||
}
|
||||
|
||||
*base_addr = save; /* restore value at 0 */
|
||||
*(base_addr+1) = save2; /* restore value at 4 */
|
||||
return (ramsize);
|
||||
}
|
||||
|
||||
@@ -426,18 +449,21 @@ const uint sdram_table[] =
|
||||
MCR_MLCF(2) | MCR_MAD(0x30)) /* twice at 0x30 */
|
||||
|
||||
/* MAMR values work in either mamr or mbmr */
|
||||
/* 8 column SDRAM */
|
||||
#define SDRAM_MAMR_8COL /* refresh at 50MHz */ \
|
||||
#define SDRAM_MAMR_BASE /* refresh at 50MHz */ \
|
||||
((195 << MAMR_PTA_SHIFT) | MAMR_PTAE \
|
||||
| MAMR_AMA_TYPE_0 /* Address MUX 0 */ \
|
||||
| MAMR_DSA_1_CYCL /* 1 cycle disable */ \
|
||||
| MAMR_G0CLA_A11 /* GPL0 A11[MPC] */ \
|
||||
| MAMR_RLFA_1X /* Read loop 1 time */ \
|
||||
| MAMR_WLFA_1X /* Write loop 1 time */ \
|
||||
| MAMR_TLFA_4X) /* Timer loop 4 times */
|
||||
/* 8 column SDRAM */
|
||||
#define SDRAM_MAMR_8COL (SDRAM_MAMR_BASE \
|
||||
| MAMR_AMA_TYPE_0 /* Address MUX 0 */ \
|
||||
| MAMR_G0CLA_A11) /* GPL0 A11[MPC] */
|
||||
|
||||
/* 9 column SDRAM */
|
||||
#define SDRAM_MAMR_9COL ((SDRAM_MAMR_8COL & (~MAMR_G0CLA_A11)) | MAMR_G0CLA_A10)
|
||||
#define SDRAM_MAMR_9COL (SDRAM_MAMR_BASE \
|
||||
| MAMR_AMA_TYPE_1 /* Address MUX 1 */ \
|
||||
| MAMR_G0CLA_A10) /* GPL0 A10[MPC] */
|
||||
|
||||
/* base address 0, 32-bit port, SDRAM UPM, valid */
|
||||
#define SDRAM_BR_VALUE (BR_PS_32 | BR_MS_UPMA | BR_V)
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
ppc/vsprintf.o (.text)
|
||||
ppc/crc32.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
@@ -486,7 +486,11 @@ int drv_vfd_init(void)
|
||||
/* frame buffer endadr */
|
||||
rLCDSADDR2 = (gd->fb_base + FRAME_BUF_SIZE) >> 1;
|
||||
rLCDSADDR3 = ((256/4));
|
||||
rLCDCON2 = 0x000DC000;
|
||||
rLCDCON2 = 0x000DC000;
|
||||
if(gd->vfd_type == VFD_TYPE_MN11236)
|
||||
rLCDCON2 = 37 << 14; /* MN11236: 38 lines */
|
||||
else
|
||||
rLCDCON2 = 55 << 14; /* T119C: 56 lines */
|
||||
rLCDCON3 = 0x0051000A;
|
||||
rLCDCON4 = 0x00000001;
|
||||
if (gd->vfd_type && vfd_inv_data)
|
||||
|
||||
47
board/wepep250/Makefile
Normal file
47
board/wepep250/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000, 2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := wepep250.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
11
board/wepep250/config.mk
Normal file
11
board/wepep250/config.mk
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# This is config used for compilation of WEP EP250 sources
|
||||
#
|
||||
# You might change location of U-Boot in memory by setting right TEXT_BASE.
|
||||
# This allows for example having one copy located at the end of ram and stored
|
||||
# in flash device and later on while developing use other location to test
|
||||
# the code in RAM device only.
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xa1fe0000
|
||||
#TEXT_BASE = 0xa1001000
|
||||
321
board/wepep250/flash.c
Normal file
321
board/wepep250/flash.c
Normal file
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
* Copyright (C) 2003 ETC s.r.o.
|
||||
*
|
||||
* This code was inspired by Marius Groeger and Kyle Harris code
|
||||
* available in other board ports for U-Boot
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Written by Peter Figuli <peposh@etc.sk>, 2003.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include "intel.h"
|
||||
|
||||
|
||||
/*
|
||||
* This code should handle CFI FLASH memory device. This code is very
|
||||
* minimalistic approach without many essential error handling code as well.
|
||||
* Because U-Boot actually is missing smart handling of FLASH device,
|
||||
* we just set flash_id to anything else to FLASH_UNKNOW, so common code
|
||||
* can call us without any restrictions.
|
||||
* TODO: Add CFI Query, to be able to determine FLASH device.
|
||||
* TODO: Add error handling code
|
||||
* NOTE: This code was tested with BUS_WIDTH 4 and ITERLEAVE 2 only, but
|
||||
* hopefully may work with other configurations.
|
||||
*/
|
||||
|
||||
#if ( WEP_FLASH_BUS_WIDTH == 1 )
|
||||
# define FLASH_BUS vu_char
|
||||
# if ( WEP_FLASH_INTERLEAVE == 1 )
|
||||
# define FLASH_CMD( x ) x
|
||||
# else
|
||||
# error "With 8bit bus only one chip is allowed"
|
||||
# endif
|
||||
|
||||
|
||||
#elif ( WEP_FLASH_BUS_WIDTH == 2 )
|
||||
# define FLASH_BUS vu_short
|
||||
# if ( WEP_FLASH_INTERLEAVE == 1 )
|
||||
# define FLASH_CMD( x ) x
|
||||
# elif ( WEP_FLASH_INTERLEAVE == 2 )
|
||||
# define FLASH_CMD( x ) (( x << 8 )| x )
|
||||
# else
|
||||
# error "With 16bit bus only 1 or 2 chip(s) are allowed"
|
||||
# endif
|
||||
|
||||
|
||||
#elif ( WEP_FLASH_BUS_WIDTH == 4 )
|
||||
# define FLASH_BUS vu_long
|
||||
# if ( WEP_FLASH_INTERLEAVE == 1 )
|
||||
# define FLASH_CMD( x ) x
|
||||
# elif ( WEP_FLASH_INTERLEAVE == 2 )
|
||||
# define FLASH_CMD( x ) (( x << 16 )| x )
|
||||
# elif ( WEP_FLASH_INTERLEAVE == 4 )
|
||||
# define FLASH_CMD( x ) (( x << 24 )|( x << 16 ) ( x << 8 )| x )
|
||||
# else
|
||||
# error "With 32bit bus only 1,2 or 4 chip(s) are allowed"
|
||||
# endif
|
||||
|
||||
#else
|
||||
# error "Flash bus width might be 1,2,4 for 8,16,32 bit configuration"
|
||||
#endif
|
||||
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
static FLASH_BUS flash_status_reg (void)
|
||||
{
|
||||
|
||||
FLASH_BUS *addr = (FLASH_BUS *) 0;
|
||||
|
||||
*addr = FLASH_CMD (CFI_INTEL_CMD_READ_STATUS_REGISTER);
|
||||
|
||||
return *addr;
|
||||
}
|
||||
|
||||
static int flash_ready (ulong timeout)
|
||||
{
|
||||
int ok = 1;
|
||||
|
||||
reset_timer_masked ();
|
||||
while ((flash_status_reg () & FLASH_CMD (CFI_INTEL_SR_READY)) !=
|
||||
FLASH_CMD (CFI_INTEL_SR_READY)) {
|
||||
if (get_timer_masked () > timeout && timeout != 0) {
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
#if ( CFG_MAX_FLASH_BANKS != 1 )
|
||||
# error "WEP platform has only one flash bank!"
|
||||
#endif
|
||||
|
||||
|
||||
ulong flash_init (void)
|
||||
{
|
||||
int i;
|
||||
FLASH_BUS address = WEP_FLASH_BASE;
|
||||
|
||||
flash_info[0].size = WEP_FLASH_BANK_SIZE;
|
||||
flash_info[0].sector_count = CFG_MAX_FLASH_SECT;
|
||||
flash_info[0].flash_id = INTEL_MANUFACT;
|
||||
memset (flash_info[0].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_SECT; i++) {
|
||||
flash_info[0].start[i] = address;
|
||||
#ifdef WEP_FLASH_UNLOCK
|
||||
/* Some devices are hw locked after start. */
|
||||
*((FLASH_BUS *) address) = FLASH_CMD (CFI_INTEL_CMD_LOCK_SETUP);
|
||||
*((FLASH_BUS *) address) = FLASH_CMD (CFI_INTEL_CMD_UNLOCK_BLOCK);
|
||||
flash_ready (0);
|
||||
*((FLASH_BUS *) address) = FLASH_CMD (CFI_INTEL_CMD_READ_ARRAY);
|
||||
#endif
|
||||
address += WEP_FLASH_SECT_SIZE;
|
||||
}
|
||||
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
|
||||
|
||||
return WEP_FLASH_BANK_SIZE;
|
||||
}
|
||||
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf (" Intel vendor\n");
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (!(i % 5)) {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, non_protected = 0, sector;
|
||||
int rc = ERR_OK;
|
||||
|
||||
FLASH_BUS *address;
|
||||
|
||||
for (sector = s_first; sector <= s_last; sector++) {
|
||||
if (!info->protect[sector]) {
|
||||
non_protected++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!non_protected) {
|
||||
return ERR_PROTECTED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
flag = disable_interrupts ();
|
||||
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sector = s_first; sector <= s_last && !ctrlc (); sector++) {
|
||||
if (info->protect[sector]) {
|
||||
printf ("Protected sector %2d skipping...\n", sector);
|
||||
continue;
|
||||
} else {
|
||||
printf ("Erasing sector %2d ... ", sector);
|
||||
}
|
||||
|
||||
address = (FLASH_BUS *) (info->start[sector]);
|
||||
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_BLOCK_ERASE);
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_CONFIRM);
|
||||
if (flash_ready (CFG_FLASH_ERASE_TOUT)) {
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
|
||||
printf ("ok.\n");
|
||||
} else {
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_SUSPEND);
|
||||
rc = ERR_TIMOUT;
|
||||
printf ("timeout! Aborting...\n");
|
||||
break;
|
||||
}
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_READ_ARRAY);
|
||||
}
|
||||
if (ctrlc ())
|
||||
printf ("User Interrupt!\n");
|
||||
|
||||
/* allow flash to settle - wait 10 ms */
|
||||
udelay_masked (10000);
|
||||
if (flag) {
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int write_data (flash_info_t * info, ulong dest, FLASH_BUS data)
|
||||
{
|
||||
FLASH_BUS *address = (FLASH_BUS *) dest;
|
||||
int rc = ERR_OK;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*address & data) != data) {
|
||||
return ERR_NOT_ERASED;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
|
||||
flag = disable_interrupts ();
|
||||
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_PROGRAM1);
|
||||
*address = data;
|
||||
|
||||
if (!flash_ready (CFG_FLASH_WRITE_TOUT)) {
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_SUSPEND);
|
||||
rc = ERR_TIMOUT;
|
||||
printf ("timeout! Aborting...\n");
|
||||
}
|
||||
|
||||
*address = FLASH_CMD (CFI_INTEL_CMD_READ_ARRAY);
|
||||
if (flag) {
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong read_addr, write_addr;
|
||||
FLASH_BUS data;
|
||||
int i, result = ERR_OK;
|
||||
|
||||
|
||||
read_addr = addr & ~(sizeof (FLASH_BUS) - 1);
|
||||
write_addr = read_addr;
|
||||
if (read_addr != addr) {
|
||||
data = 0;
|
||||
for (i = 0; i < sizeof (FLASH_BUS); i++) {
|
||||
if (read_addr < addr || cnt == 0) {
|
||||
data |= *((uchar *) read_addr) << i * 8;
|
||||
} else {
|
||||
data |= (*src++) << i * 8;
|
||||
cnt--;
|
||||
}
|
||||
read_addr++;
|
||||
}
|
||||
if ((result = write_data (info, write_addr, data)) != ERR_OK) {
|
||||
return result;
|
||||
}
|
||||
write_addr += sizeof (FLASH_BUS);
|
||||
}
|
||||
for (; cnt >= sizeof (FLASH_BUS); cnt -= sizeof (FLASH_BUS)) {
|
||||
if ((result = write_data (info, write_addr,
|
||||
*((FLASH_BUS *) src))) != ERR_OK) {
|
||||
return result;
|
||||
}
|
||||
write_addr += sizeof (FLASH_BUS);
|
||||
src += sizeof (FLASH_BUS);
|
||||
}
|
||||
if (cnt > 0) {
|
||||
read_addr = write_addr;
|
||||
data = 0;
|
||||
for (i = 0; i < sizeof (FLASH_BUS); i++) {
|
||||
if (cnt > 0) {
|
||||
data |= (*src++) << i * 8;
|
||||
cnt--;
|
||||
} else {
|
||||
data |= *((uchar *) read_addr) << i * 8;
|
||||
}
|
||||
read_addr++;
|
||||
}
|
||||
if ((result = write_data (info, write_addr, data)) != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
100
board/wepep250/intel.h
Normal file
100
board/wepep250/intel.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2002 ETC s.r.o.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the ETC s.r.o. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2002.
|
||||
*
|
||||
* Documentation:
|
||||
* [1] Intel Corporation, "3 Volt Intel Strata Flash Memory 28F128J3A, 28F640J3A,
|
||||
* 28F320J3A (x8/x16)", April 2002, Order Number: 290667-011
|
||||
* [2] Intel Corporation, "3 Volt Synchronous Intel Strata Flash Memory 28F640K3, 28F640K18,
|
||||
* 28F128K3, 28F128K18, 28F256K3, 28F256K18 (x16)", June 2002, Order Number: 290737-005
|
||||
*
|
||||
* This file is taken from OpenWinCE project hosted by SourceForge.net
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FLASH_INTEL_H
|
||||
#define FLASH_INTEL_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
/* Intel CFI commands - see Table 4. in [1] and Table 3. in [2] */
|
||||
|
||||
#define CFI_INTEL_CMD_READ_ARRAY 0xFF /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_READ_IDENTIFIER 0x90 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_READ_QUERY 0x98 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_READ_STATUS_REGISTER 0x70 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_CLEAR_STATUS_REGISTER 0x50 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_PROGRAM1 0x40 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_PROGRAM2 0x10 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_WRITE_TO_BUFFER 0xE8 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_CONFIRM 0xD0 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_BLOCK_ERASE 0x20 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_SUSPEND 0xB0 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_RESUME 0xD0 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_LOCK_SETUP 0x60 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_LOCK_BLOCK 0x01 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_UNLOCK_BLOCK 0xD0 /* 28FxxxJ3A - unlocks all blocks, 28FFxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_CMD_LOCK_DOWN_BLOCK 0x2F /* 28FxxxK3, 28FxxxK18 */
|
||||
|
||||
/* Intel CFI Status Register bits - see Table 6. in [1] and Table 7. in [2] */
|
||||
|
||||
#define CFI_INTEL_SR_READY 1 << 7 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_ERASE_SUSPEND 1 << 6 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_ERASE_ERROR 1 << 5 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_PROGRAM_ERROR 1 << 4 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_VPEN_ERROR 1 << 3 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_PROGRAM_SUSPEND 1 << 2 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_BLOCK_LOCKED 1 << 1 /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
|
||||
#define CFI_INTEL_SR_BEFP 1 << 0 /* 28FxxxK3, 28FxxxK18 */
|
||||
|
||||
/* Intel flash device ID codes for 28FxxxJ3A - see Table 5. in [1] */
|
||||
|
||||
#define CFI_CHIP_INTEL_28F320J3A 0x0016
|
||||
#define CFI_CHIPN_INTEL_28F320J3A "28F320J3A"
|
||||
#define CFI_CHIP_INTEL_28F640J3A 0x0017
|
||||
#define CFI_CHIPN_INTEL_28F640J3A "28F640J3A"
|
||||
#define CFI_CHIP_INTEL_28F128J3A 0x0018
|
||||
#define CFI_CHIPN_INTEL_28F128J3A "28F128J3A"
|
||||
|
||||
/* Intel flash device ID codes for 28FxxxK3 and 28FxxxK18 - see Table 8. in [2] */
|
||||
|
||||
#define CFI_CHIP_INTEL_28F640K3 0x8801
|
||||
#define CFI_CHIPN_INTEL_28F640K3 "28F640K3"
|
||||
#define CFI_CHIP_INTEL_28F128K3 0x8802
|
||||
#define CFI_CHIPN_INTEL_28F128K3 "28F128K3"
|
||||
#define CFI_CHIP_INTEL_28F256K3 0x8803
|
||||
#define CFI_CHIPN_INTEL_28F256K3 "28F256K3"
|
||||
#define CFI_CHIP_INTEL_28F640K18 0x8805
|
||||
#define CFI_CHIPN_INTEL_28F640K18 "28F640K18"
|
||||
#define CFI_CHIP_INTEL_28F128K18 0x8806
|
||||
#define CFI_CHIPN_INTEL_28F128K18 "28F128K18"
|
||||
#define CFI_CHIP_INTEL_28F256K18 0x8807
|
||||
#define CFI_CHIPN_INTEL_28F256K18 "28F256K18"
|
||||
|
||||
#endif /* FLASH_INTEL_H */
|
||||
|
||||
147
board/wepep250/memsetup.S
Normal file
147
board/wepep250/memsetup.S
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (C) 2001, 2002 ETC s.r.o.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2001, 2002.
|
||||
* Changes for U-Boot Peter Figuli <peposh@etc.sk>, 2003.
|
||||
*
|
||||
* This file is taken from OpenWinCE project hosted by SourceForge.net
|
||||
*
|
||||
* Documentation:
|
||||
* [1] Intel Corporation, "Intel PXA250 and PXA210 Application Processors
|
||||
* Developer's Manual", February 2002, Order Number: 278522-001
|
||||
* [2] Samsung Electronics, "8Mx16 SDRAM 54CSP K4S281633D-RL/N/P",
|
||||
* Revision 1.0, February 2002
|
||||
* [3] Samsung Electronics, "16Mx16 SDRAM 54CSP K4S561633C-RL(N)",
|
||||
* Revision 1.0, February 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
|
||||
mov r10, lr
|
||||
|
||||
/* setup memory - see 6.12 in [1]
|
||||
* Step 1 - wait 200 us
|
||||
*/
|
||||
mov r0,#0x2700 /* wait 200 us @ 99.5 MHz */
|
||||
1: subs r0, r0, #1
|
||||
bne 1b
|
||||
/* TODO: complete step 1 for Synchronous Static memory*/
|
||||
|
||||
ldr r0, =0x48000000 /* MC_BASE */
|
||||
|
||||
|
||||
|
||||
/* step 1.a - setup MSCx
|
||||
*/
|
||||
ldr r1, =0x000012B3 /* MSC0_RRR0(1) | MSC0_RDN0(2) | MSC0_RDF0(11) | MSC0_RT0(3) */
|
||||
str r1, [r0, #0x8] /* MSC0_OFFSET */
|
||||
|
||||
/* step 1.c - clear MDREFR:K1FREE, set MDREFR:DRI
|
||||
* see AUTO REFRESH chapter in section D. in [2] and in [3]
|
||||
* DRI = (64ms / 4096) * 99.53MHz / 32 = 48 for K4S281633
|
||||
* DRI = (64ms / 8192) * 99.52MHz / 32 = 24 for K4S561633
|
||||
* TODO: complete for Synchronous Static memory
|
||||
*/
|
||||
ldr r1, [r0, #4] /* MDREFR_OFFSET */
|
||||
ldr r2, =0x01000FFF /* MDREFR_K1FREE | MDREFR_DRI_MASK */
|
||||
bic r1, r1, r2
|
||||
#if defined( WEP_SDRAM_K4S281633 )
|
||||
orr r1, r1, #48 /* MDREFR_DRI(48) */
|
||||
#elif defined( WEP_SDRAM_K4S561633 )
|
||||
orr r1, r1, #24 /* MDREFR_DRI(24) */
|
||||
#else
|
||||
#error SDRAM chip is not defined
|
||||
#endif
|
||||
|
||||
str r1, [r0, #4] /* MDREFR_OFFSET */
|
||||
|
||||
/* Step 2 - only for Synchronous Static memory (TODO)
|
||||
*
|
||||
* Step 3 - same as step 4
|
||||
*
|
||||
* Step 4
|
||||
*
|
||||
* Step 4.a - set MDREFR:K1RUN, clear MDREFR:K1DB2
|
||||
*/
|
||||
orr r1, r1, #0x00010000 /* MDREFR_K1RUN */
|
||||
bic r1, r1, #0x00020000 /* MDREFR_K1DB2 */
|
||||
str r1, [r0, #4] /* MDREFR_OFFSET */
|
||||
|
||||
/* Step 4.b - clear MDREFR:SLFRSH */
|
||||
bic r1, r1, #0x00400000 /* MDREFR_SLFRSH */
|
||||
str r1, [r0, #4] /* MDREFR_OFFSET */
|
||||
|
||||
/* Step 4.c - set MDREFR:E1PIN */
|
||||
orr r1, r1, #0x00008000 /* MDREFR_E1PIN */
|
||||
str r1, [r0, #4] /* MDREFR_OFFSET */
|
||||
|
||||
/* Step 4.d - automatically done
|
||||
*
|
||||
* Steps 4.e and 4.f - configure SDRAM
|
||||
*/
|
||||
#if defined( WEP_SDRAM_K4S281633 )
|
||||
ldr r1, =0x00000AA8 /* MDCNFG_DTC0(2) | MDCNFG_DLATCH0 | MDCNFG_DCAC0(1) | MDCNFG_DRAC0(1) | MDCNFG_DNB0 */
|
||||
#elif defined( WEP_SDRAM_K4S561633 )
|
||||
ldr r1, =0x00000AC8 /* MDCNFG_DTC0(2) | MDCNFG_DLATCH0 | MDCNFG_DCAC0(1) | MDCNFG_DRAC0(2) | MDCNFG_DNB0 */
|
||||
#else
|
||||
#error SDRAM chip is not defined
|
||||
#endif
|
||||
str r1, [r0, #0] /* MDCNFG_OFFSET */
|
||||
|
||||
/* Step 5 - wait at least 200 us for SDRAM
|
||||
* see section B. in [2]
|
||||
*/
|
||||
mov r2,#0x2700 /* wait 200 us @ 99.5 MHz */
|
||||
1: subs r2, r2, #1
|
||||
bne 1b
|
||||
|
||||
/* Step 6 - after reset dcache is disabled, so automatically done
|
||||
*
|
||||
* Step 7 - eight refresh cycles
|
||||
*/
|
||||
mov r2, #0xA0000000
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
ldr r3, [r2]
|
||||
|
||||
/* Step 8 - we don't need dcache now
|
||||
*
|
||||
* Step 9 - enable SDRAM partition 0
|
||||
*/
|
||||
orr r1, r1, #1 /* MDCNFG_DE0 */
|
||||
str r1, [r0, #0] /* MDCNFG_OFFSET */
|
||||
|
||||
/* Step 10 - write MDMRS */
|
||||
mov r1, #0
|
||||
str r1, [r0, #0x40] /* MDMRS_OFFSET */
|
||||
|
||||
/* Step 11 - optional (TODO) */
|
||||
|
||||
mov pc,r10
|
||||
|
||||
55
board/wepep250/u-boot.lds
Normal file
55
board/wepep250/u-boot.lds
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/xscale/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
bss_end = .;
|
||||
|
||||
armboot_end = .;
|
||||
}
|
||||
77
board/wepep250/wepep250.c
Normal file
77
board/wepep250/wepep250.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2003 ETC s.r.o.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Written by Peter Figuli <peposh@etc.sk>, 2003.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
int board_init( void ){
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_arch_number = 288;
|
||||
gd->bd->bi_boot_params = 0xa0000000;
|
||||
/*
|
||||
* Setup GPIO stuff to get serial working
|
||||
*/
|
||||
#if defined( CONFIG_FFUART )
|
||||
GPDR1 = 0x80;
|
||||
GAFR1_L = 0x8010;
|
||||
#elif defined( CONFIG_BTUART )
|
||||
GPDR1 = 0x800;
|
||||
GAFR1_L = 0x900000;
|
||||
#endif
|
||||
PSSR = 0x20;
|
||||
|
||||
/*
|
||||
* Following code is just bug workaround, remove it if not neccessary
|
||||
*/
|
||||
|
||||
/* cpu/xscale/cpu.c do not set armboot_real_end that is used for
|
||||
malloc pool.*/
|
||||
if( _armboot_real_end == 0xbadc0de ){
|
||||
_armboot_real_end = _armboot_end;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dram_init( void ){
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if ( CONFIG_NR_DRAM_BANKS > 0 )
|
||||
gd->bd->bi_dram[0].start = WEP_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = WEP_SDRAM_1_SIZE;
|
||||
#endif
|
||||
#if ( CONFIG_NR_DRAM_BANKS > 1 )
|
||||
gd->bd->bi_dram[1].start = WEP_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = WEP_SDRAM_2_SIZE;
|
||||
#endif
|
||||
#if ( CONFIG_NR_DRAM_BANKS > 2 )
|
||||
gd->bd->bi_dram[2].start = WEP_SDRAM_3;
|
||||
gd->bd->bi_dram[2].size = WEP_SDRAM_3_SIZE;
|
||||
#endif
|
||||
#if ( CONFIG_NR_DRAM_BANKS > 3 )
|
||||
gd->bd->bi_dram[3].start = WEP_SDRAM_4;
|
||||
gd->bd->bi_dram[3].size = WEP_SDRAM_4_SIZE;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void bedbug_init( void )
|
||||
#if defined(CONFIG_4xx)
|
||||
void bedbug405_init( void );
|
||||
bedbug405_init();
|
||||
#elif defined(CONFIG_MPC860)
|
||||
#elif defined(CONFIG_8xx)
|
||||
void bedbug860_init( void );
|
||||
bedbug860_init();
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
print_num ("flashoffset", bd->bi_flashoffset );
|
||||
print_num ("sramstart", bd->bi_sramstart );
|
||||
print_num ("sramsize", bd->bi_sramsize );
|
||||
#if defined(CONFIG_8xx) || defined(CONFIG_8260)
|
||||
#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260)
|
||||
print_num ("immr_base", bd->bi_immr_base );
|
||||
#endif
|
||||
print_num ("bootflags", bd->bi_bootflags );
|
||||
@@ -163,10 +163,10 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
|
||||
}
|
||||
printf ("\n"
|
||||
"ip_addr = ");
|
||||
"ip_addr = ");
|
||||
print_IPaddr (bd->bi_ip_addr);
|
||||
printf ("\n"
|
||||
"baudrate = %d bps\n", bd->bi_baudrate);
|
||||
"baudrate = %d bps\n", bd->bi_baudrate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -575,6 +575,7 @@ write_record (char *buf)
|
||||
#define XON_CHAR 17
|
||||
#define XOFF_CHAR 19
|
||||
#define START_CHAR 0x01
|
||||
#define ETX_CHAR 0x03
|
||||
#define END_CHAR 0x0D
|
||||
#define SPACE 0x20
|
||||
#define K_ESCAPE 0x23
|
||||
@@ -995,8 +996,18 @@ static int k_recv (void)
|
||||
#endif
|
||||
|
||||
/* get a packet */
|
||||
/* wait for the starting character */
|
||||
while (serial_getc () != START_CHAR);
|
||||
/* wait for the starting character or ^C */
|
||||
for (;;) {
|
||||
switch (serial_getc ()) {
|
||||
case START_CHAR: /* start packet */
|
||||
goto START;
|
||||
case ETX_CHAR: /* ^C waiting for packet */
|
||||
return (0);
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
START:
|
||||
/* get length of packet */
|
||||
sum = 0;
|
||||
new_char = serial_getc ();
|
||||
|
||||
@@ -287,12 +287,17 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
switch (hdr->ih_type) {
|
||||
case IH_TYPE_STANDALONE:
|
||||
appl = (int (*)(cmd_tbl_t *, int, int, char *[]))ntohl(hdr->ih_ep);
|
||||
if (iflag)
|
||||
enable_interrupts();
|
||||
|
||||
/* load (and uncompress), but don't start if "autostart"
|
||||
* is set to "no"
|
||||
*/
|
||||
if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0))
|
||||
return 0;
|
||||
appl = (int (*)(cmd_tbl_t *, int, int, char *[]))ntohl(hdr->ih_ep);
|
||||
(*appl)(cmdtp, flag, argc-1, &argv[1]);
|
||||
break;
|
||||
return 0;
|
||||
case IH_TYPE_KERNEL:
|
||||
case IH_TYPE_MULTI:
|
||||
/* handled below */
|
||||
|
||||
@@ -34,10 +34,13 @@ const char *weekdays[] = {
|
||||
"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
|
||||
};
|
||||
|
||||
#define RELOC(a) ((typeof(a))((unsigned long)(a) + gd->reloc_off))
|
||||
|
||||
int mk_date (char *, struct rtc_time *);
|
||||
|
||||
int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
struct rtc_time tm;
|
||||
int rcode = 0;
|
||||
|
||||
@@ -64,7 +67,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf ("Date: %4d-%02d-%02d (%sday) Time: %2d:%02d:%02d\n",
|
||||
tm.tm_year, tm.tm_mon, tm.tm_mday,
|
||||
(tm.tm_wday<0 || tm.tm_wday>6) ?
|
||||
"unknown " : weekdays[tm.tm_wday],
|
||||
"unknown " : RELOC(weekdays[tm.tm_wday]),
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
unsigned short data;
|
||||
int rcode = 0;
|
||||
|
||||
#ifdef CONFIG_MPC860
|
||||
#ifdef CONFIG_8xx
|
||||
mii_init ();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ static int nand_rw (struct nand_chip* nand, int cmd,
|
||||
}
|
||||
|
||||
static void nand_print(struct nand_chip *nand)
|
||||
{
|
||||
{
|
||||
printf("%s at 0x%lX,\n"
|
||||
"\t %d chip%s %s, size %d MB, \n"
|
||||
"\t total size %ld MB, sector size %ld kB\n",
|
||||
@@ -333,16 +333,17 @@ static void nand_print(struct nand_chip *nand)
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* This function is needed to avoid calls of the __ashrdi3 function. */
|
||||
#if 0
|
||||
static int shr(int val, int shift)
|
||||
{
|
||||
{
|
||||
return val >> shift;
|
||||
}
|
||||
|
||||
#endif
|
||||
static int NanD_WaitReady(struct nand_chip *nand)
|
||||
{
|
||||
/* This is inline, to optimise the common case, where it's ready instantly */
|
||||
int ret = 0;
|
||||
NAND_WAIT_READY(nand);
|
||||
NAND_WAIT_READY(nand);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -368,42 +369,42 @@ static inline int NanD_Command(struct nand_chip *nand, unsigned char command)
|
||||
/* NanD_Address: Set the current address for the flash chip */
|
||||
|
||||
static int NanD_Address(struct nand_chip *nand, int numbytes, unsigned long ofs)
|
||||
{
|
||||
unsigned long nandptr;
|
||||
int i;
|
||||
{
|
||||
unsigned long nandptr;
|
||||
int i;
|
||||
|
||||
nandptr = nand->IO_ADDR;
|
||||
nandptr = nand->IO_ADDR;
|
||||
|
||||
/* Assert the ALE (Address Latch Enable) line to the flash chip */
|
||||
NAND_CTL_SETALE(nandptr);
|
||||
NAND_CTL_SETALE(nandptr);
|
||||
|
||||
/* Send the address */
|
||||
/* Devices with 256-byte page are addressed as:
|
||||
Column (bits 0-7), Page (bits 8-15, 16-23, 24-31)
|
||||
* there is no device on the market with page256
|
||||
and more than 24 bits.
|
||||
Devices with 512-byte page are addressed as:
|
||||
Column (bits 0-7), Page (bits 9-16, 17-24, 25-31)
|
||||
* 25-31 is sent only if the chip support it.
|
||||
* bit 8 changes the read command to be sent
|
||||
(NAND_CMD_READ0 or NAND_CMD_READ1).
|
||||
/* Send the address */
|
||||
/* Devices with 256-byte page are addressed as:
|
||||
* Column (bits 0-7), Page (bits 8-15, 16-23, 24-31)
|
||||
* there is no device on the market with page256
|
||||
* and more than 24 bits.
|
||||
* Devices with 512-byte page are addressed as:
|
||||
* Column (bits 0-7), Page (bits 9-16, 17-24, 25-31)
|
||||
* 25-31 is sent only if the chip support it.
|
||||
* bit 8 changes the read command to be sent
|
||||
* (NAND_CMD_READ0 or NAND_CMD_READ1).
|
||||
*/
|
||||
|
||||
if (numbytes == ADDR_COLUMN || numbytes == ADDR_COLUMN_PAGE)
|
||||
WRITE_NAND_ADDRESS(ofs, nandptr);
|
||||
if (numbytes == ADDR_COLUMN || numbytes == ADDR_COLUMN_PAGE)
|
||||
WRITE_NAND_ADDRESS(ofs, nandptr);
|
||||
|
||||
ofs = ofs >> nand->page_shift;
|
||||
ofs = ofs >> nand->page_shift;
|
||||
|
||||
if (numbytes == ADDR_PAGE || numbytes == ADDR_COLUMN_PAGE)
|
||||
for (i = 0; i < nand->pageadrlen; i++, ofs = ofs >> 8)
|
||||
WRITE_NAND_ADDRESS(ofs, nandptr);
|
||||
if (numbytes == ADDR_PAGE || numbytes == ADDR_COLUMN_PAGE)
|
||||
for (i = 0; i < nand->pageadrlen; i++, ofs = ofs >> 8)
|
||||
WRITE_NAND_ADDRESS(ofs, nandptr);
|
||||
|
||||
/* Lower the ALE line */
|
||||
NAND_CTL_CLRALE(nandptr);
|
||||
/* Lower the ALE line */
|
||||
NAND_CTL_CLRALE(nandptr);
|
||||
|
||||
/* Wait for the chip to respond */
|
||||
return NanD_WaitReady(nand);
|
||||
}
|
||||
/* Wait for the chip to respond */
|
||||
return NanD_WaitReady(nand);
|
||||
}
|
||||
|
||||
/* NanD_SelectChip: Select a given flash chip within the current floor */
|
||||
|
||||
@@ -419,14 +420,14 @@ static int NanD_IdentChip(struct nand_chip *nand, int floor, int chip)
|
||||
{
|
||||
int mfr, id, i;
|
||||
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
/* Reset the chip */
|
||||
if (NanD_Command(nand, NAND_CMD_RESET)) {
|
||||
#ifdef NAND_DEBUG
|
||||
printf("NanD_Command (reset) for %d,%d returned true\n",
|
||||
floor, chip);
|
||||
#endif
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -436,7 +437,7 @@ static int NanD_IdentChip(struct nand_chip *nand, int floor, int chip)
|
||||
printf("NanD_Command (ReadID) for %d,%d returned true\n",
|
||||
floor, chip);
|
||||
#endif
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -451,11 +452,10 @@ static int NanD_IdentChip(struct nand_chip *nand, int floor, int chip)
|
||||
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
/* No response - return failure */
|
||||
if (mfr == 0xff || mfr == 0)
|
||||
{
|
||||
printf("NanD_Command (ReadID) got %d %d\n", mfr, id);
|
||||
return 0;
|
||||
}
|
||||
if (mfr == 0xff || mfr == 0) {
|
||||
printf("NanD_Command (ReadID) got %d %d\n", mfr, id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check it's the same as the first chip we identified.
|
||||
* M-Systems say that any given nand_chip device should only
|
||||
@@ -578,66 +578,66 @@ static void NanD_ScanChips(struct nand_chip *nand)
|
||||
nand->numchips, nand->totlen >> 20);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MTD_NAND_ECC
|
||||
/* we need to be fast here, 1 us per read translates to 1 second per meg */
|
||||
static void nand_fast_copy (unsigned char *source, unsigned char *dest, long cntr)
|
||||
{
|
||||
while (cntr > 16)
|
||||
{
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
cntr -= 16;
|
||||
}
|
||||
while (cntr > 0)
|
||||
{
|
||||
*dest++ = *source++;
|
||||
cntr--;
|
||||
}
|
||||
}
|
||||
{
|
||||
while (cntr > 16) {
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
*dest++ = *source++;
|
||||
cntr -= 16;
|
||||
}
|
||||
|
||||
while (cntr > 0) {
|
||||
*dest++ = *source++;
|
||||
cntr--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* we need to be fast here, 1 us per read translates to 1 second per meg */
|
||||
static void nand_fast_read(unsigned char *data_buf, int cntr, unsigned long nandptr)
|
||||
{
|
||||
while (cntr > 16)
|
||||
{
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
cntr -= 16;
|
||||
}
|
||||
while (cntr > 0)
|
||||
{
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
cntr--;
|
||||
}
|
||||
}
|
||||
{
|
||||
while (cntr > 16) {
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
cntr -= 16;
|
||||
}
|
||||
|
||||
while (cntr > 0) {
|
||||
*data_buf++ = READ_NAND(nandptr);
|
||||
cntr--;
|
||||
}
|
||||
}
|
||||
|
||||
/* This routine is made available to other mtd code via
|
||||
* inter_module_register. It must only be accessed through
|
||||
@@ -665,13 +665,14 @@ static int nand_read_ecc(struct nand_chip *nand, size_t start, size_t len,
|
||||
|
||||
/* Do not allow reads past end of device */
|
||||
if ((start + len) > nand->totlen) {
|
||||
printf ("nand_read_ecc: Attempt read beyond end of device %x %x %x\n", (uint) start, (uint) len, (uint) nand->totlen);
|
||||
printf ("%s: Attempt read beyond end of device %x %x %x\n", __FUNCTION__, (uint) start, (uint) len, (uint) nand->totlen);
|
||||
*retlen = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* First we calculate the starting page */
|
||||
page = shr(start, nand->page_shift);
|
||||
/*page = shr(start, nand->page_shift);*/
|
||||
page = start >> nand->page_shift;
|
||||
|
||||
/* Get raw starting column */
|
||||
col = start & (nand->oobblock - 1);
|
||||
@@ -713,7 +714,7 @@ static int nand_read_ecc(struct nand_chip *nand, size_t start, size_t len,
|
||||
nand_calculate_ecc (&nand->data_buf[0], &ecc_calc[0]);
|
||||
switch (nand_correct_data (&nand->data_buf[0], &ecc_code[0], &ecc_calc[0])) {
|
||||
case -1:
|
||||
printf ("nand_read_ecc: " "Failed ECC read, page 0x%08x\n", page);
|
||||
printf ("%s: Failed ECC read, page 0x%08x\n", __FUNCTION__, page);
|
||||
ecc_failed++;
|
||||
break;
|
||||
case 1:
|
||||
@@ -729,7 +730,7 @@ static int nand_read_ecc(struct nand_chip *nand, size_t start, size_t len,
|
||||
nand_calculate_ecc (&nand->data_buf[256], &ecc_calc[3]);
|
||||
switch (nand_correct_data (&nand->data_buf[256], &ecc_code[3], &ecc_calc[3])) {
|
||||
case -1:
|
||||
printf ("nand_read_ecc: " "Failed ECC read, page 0x%08x\n", page);
|
||||
printf ("%s: Failed ECC read, page 0x%08x\n", __FUNCTION__, page);
|
||||
ecc_failed++;
|
||||
break;
|
||||
case 1:
|
||||
@@ -778,7 +779,7 @@ readdata:
|
||||
}
|
||||
|
||||
/* De-select the NAND device */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
|
||||
/*
|
||||
* Return success, if no ECC failures, else -EIO
|
||||
@@ -788,7 +789,6 @@ readdata:
|
||||
return ecc_status ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Nand_page_program function is used for write and writev !
|
||||
*/
|
||||
@@ -815,7 +815,7 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
/* Read back previous written data, if col > 0 */
|
||||
if (col) {
|
||||
NanD_Command(nand, NAND_CMD_READ0);
|
||||
NanD_Address(nand, ADDR_COLUMN_PAGE, (page << nand->page_shift) + col);
|
||||
NanD_Address(nand, ADDR_COLUMN_PAGE, (page << nand->page_shift) + col);
|
||||
for (i = 0; i < col; i++)
|
||||
nand->data_buf[i] = READ_NAND (nandptr);
|
||||
}
|
||||
@@ -852,15 +852,15 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
|
||||
/* Write out complete page of data */
|
||||
for (i = 0; i < (nand->oobblock + nand->oobsize); i++)
|
||||
WRITE_NAND(nand->data_buf[i], nand->IO_ADDR);
|
||||
WRITE_NAND(nand->data_buf[i], nand->IO_ADDR);
|
||||
|
||||
/* Send command to actually program the data */
|
||||
NanD_Command(nand, NAND_CMD_PAGEPROG);
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
NanD_Command(nand, NAND_CMD_PAGEPROG);
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
|
||||
/* See if device thinks it succeeded */
|
||||
if (READ_NAND(nand->IO_ADDR) & 0x01) {
|
||||
printf ("nand_write_ecc: " "Failed write, page 0x%08x, ", page);
|
||||
printf ("%s: Failed write, page 0x%08x, ", __FUNCTION__, page);
|
||||
return -1;
|
||||
}
|
||||
#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
|
||||
@@ -879,15 +879,15 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
|
||||
/* Send command to read back the page */
|
||||
if (col < nand->eccsize)
|
||||
NanD_Command(nand, NAND_CMD_READ0);
|
||||
NanD_Command(nand, NAND_CMD_READ0);
|
||||
else
|
||||
NanD_Command(nand, NAND_CMD_READ1);
|
||||
NanD_Address(nand, ADDR_COLUMN_PAGE, (page << nand->page_shift) + col);
|
||||
NanD_Command(nand, NAND_CMD_READ1);
|
||||
NanD_Address(nand, ADDR_COLUMN_PAGE, (page << nand->page_shift) + col);
|
||||
|
||||
/* Loop through and verify the data */
|
||||
for (i = col; i < last; i++) {
|
||||
if (nand->data_buf[i] != readb (nand->IO_ADDR)) {
|
||||
printf ("nand_write_ecc: " "Failed write verify, page 0x%08x ", page);
|
||||
printf ("%s: Failed write verify, page 0x%08x ", __FUNCTION__, page);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -903,8 +903,8 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
nand->data_buf[i] = readb (nand->IO_ADDR);
|
||||
for (i = 0; i < ecc_bytes; i++) {
|
||||
if ((nand->data_buf[(oob_config.ecc_pos[i])] != ecc_code[i]) && ecc_code[i]) {
|
||||
printf ("nand_write_ecc: Failed ECC write "
|
||||
"verify, page 0x%08x, " "%6i bytes were succesful\n", page, i);
|
||||
printf ("%s: Failed ECC write "
|
||||
"verify, page 0x%08x, " "%6i bytes were succesful\n", __FUNCTION__, page, i);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -912,6 +912,7 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nand_write_ecc (struct nand_chip* nand, size_t to, size_t len,
|
||||
size_t * retlen, const u_char * buf, u_char * ecc_code)
|
||||
{
|
||||
@@ -919,7 +920,7 @@ static int nand_write_ecc (struct nand_chip* nand, size_t to, size_t len,
|
||||
|
||||
/* Do not allow write past end of device */
|
||||
if ((to + len) > nand->totlen) {
|
||||
printf ("nand_write_oob: Attempt to write past end of page\n");
|
||||
printf ("%s: Attempt to write past end of page\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -933,12 +934,12 @@ static int nand_write_ecc (struct nand_chip* nand, size_t to, size_t len,
|
||||
*retlen = 0;
|
||||
|
||||
/* Select the NAND device */
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
|
||||
/* Check the WP bit */
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
if (!(READ_NAND(nand->IO_ADDR) & 0x80)) {
|
||||
printf ("nand_write_ecc: Device is write protected!!!\n");
|
||||
printf ("%s: Device is write protected!!!\n", __FUNCTION__);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
@@ -976,7 +977,7 @@ static int nand_write_ecc (struct nand_chip* nand, size_t to, size_t len,
|
||||
|
||||
out:
|
||||
/* De-select the NAND device */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1150,6 +1151,7 @@ static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
|
||||
int len256 = 0, ret;
|
||||
unsigned long nandptr;
|
||||
struct Nand *mychip;
|
||||
int ret = 0;
|
||||
|
||||
nandptr = nand->IO_ADDR;
|
||||
|
||||
@@ -1266,6 +1268,7 @@ static int nand_erase(struct nand_chip* nand, size_t ofs, size_t len)
|
||||
{
|
||||
unsigned long nandptr;
|
||||
struct Nand *mychip;
|
||||
int ret = 0;
|
||||
|
||||
if (ofs & (nand->erasesize-1) || len & (nand->erasesize-1)) {
|
||||
printf ("Offset and size must be sector aligned, erasesize = %d\n",
|
||||
@@ -1275,9 +1278,32 @@ static int nand_erase(struct nand_chip* nand, size_t ofs, size_t len)
|
||||
|
||||
nandptr = nand->IO_ADDR;
|
||||
|
||||
/* Select the NAND device */
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
|
||||
/* Check the WP bit */
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
if (!(READ_NAND(nand->IO_ADDR) & 0x80)) {
|
||||
printf ("nand_write_ecc: Device is write protected!!!\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Select the NAND device */
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
|
||||
/* Check the WP bit */
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
if (!(READ_NAND(nand->IO_ADDR) & 0x80)) {
|
||||
printf ("%s: Device is write protected!!!\n", __FUNCTION__);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* FIXME: Do nand in the background. Use timers or schedule_task() */
|
||||
while(len) {
|
||||
mychip = &nand->chips[shr(ofs, nand->chipshift)];
|
||||
/*mychip = &nand->chips[shr(ofs, nand->chipshift)];*/
|
||||
mychip = &nand->chips[ofs >> nand->chipshift];
|
||||
|
||||
NanD_Command(nand, NAND_CMD_ERASE1);
|
||||
NanD_Address(nand, ADDR_PAGE, ofs);
|
||||
@@ -1286,22 +1312,25 @@ static int nand_erase(struct nand_chip* nand, size_t ofs, size_t len)
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
|
||||
if (READ_NAND(nandptr) & 1) {
|
||||
printf("Error erasing at 0x%lx\n", (long)ofs);
|
||||
printf ("%s: Error erasing at 0x%lx\n",
|
||||
__FUNCTION__, (long)ofs);
|
||||
/* There was an error */
|
||||
goto callback;
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
ofs += nand->erasesize;
|
||||
len -= nand->erasesize;
|
||||
}
|
||||
|
||||
callback:
|
||||
return 0;
|
||||
out:
|
||||
/* De-select the NAND device */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int nandcheck(unsigned long potential, unsigned long physadr)
|
||||
{
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1337,20 +1366,20 @@ void nand_probe(unsigned long physadr)
|
||||
}
|
||||
}
|
||||
|
||||
if (curr_device == -1)
|
||||
curr_device = i;
|
||||
if (curr_device == -1)
|
||||
curr_device = i;
|
||||
|
||||
memset((char *)nand, 0, sizeof(struct nand_chip));
|
||||
memset((char *)nand, 0, sizeof(struct nand_chip));
|
||||
|
||||
nand->cache_page = -1; /* init the cache page */
|
||||
nand->IO_ADDR = physadr;
|
||||
nand->ChipID = ChipID;
|
||||
NanD_ScanChips(nand);
|
||||
nand->data_buf = malloc (nand->oobblock + nand->oobsize);
|
||||
if (!nand->data_buf) {
|
||||
puts ("Cannot allocate memory for data structures.\n");
|
||||
return;
|
||||
}
|
||||
nand->cache_page = -1; /* init the cache page */
|
||||
nand->IO_ADDR = physadr;
|
||||
nand->ChipID = ChipID;
|
||||
NanD_ScanChips(nand);
|
||||
nand->data_buf = malloc (nand->oobblock + nand->oobsize);
|
||||
if (!nand->data_buf) {
|
||||
puts ("Cannot allocate memory for data structures.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MTD_NAND_ECC
|
||||
|
||||
@@ -180,9 +180,13 @@ int _do_setenv (int flag, int argc, char *argv[])
|
||||
#ifndef CONFIG_ENV_OVERWRITE
|
||||
|
||||
/*
|
||||
* Ethernet Address and serial# can be set only once
|
||||
* Ethernet Address and serial# can be set only once,
|
||||
* ver is readonly.
|
||||
*/
|
||||
if ( (strcmp (name, "serial#") == 0) ||
|
||||
#if defined(CONFIG_VERSION_VARIABLE)
|
||||
(strcmp (name, "ver") == 0) ||
|
||||
#endif /* CONFIG_VERSION_VARIABLE */
|
||||
((strcmp (name, "ethaddr") == 0)
|
||||
#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
|
||||
&& (strcmp (env_get_addr(oldval),MK_STR(CONFIG_ETHADDR)) != 0)
|
||||
@@ -358,7 +362,7 @@ int _do_setenv (int flag, int argc, char *argv[])
|
||||
}
|
||||
#endif /* CFG_CMD_NET */
|
||||
|
||||
#ifdef CONFIG_AMIGAONEG3SE
|
||||
#ifdef CONFIG_AMIGAONEG3SE
|
||||
if (strcmp(argv[1], "vga_fg_color") == 0 ||
|
||||
strcmp(argv[1], "vga_bg_color") == 0 ) {
|
||||
extern void video_set_color(unsigned char attr);
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <mpc8xx.h>
|
||||
#elif defined (CONFIG_405GP)
|
||||
#include <asm/processor.h>
|
||||
#elif defined (CONFIG_5xx)
|
||||
#include <mpc5xx.h>
|
||||
#endif
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_REGINFO)
|
||||
|
||||
@@ -172,9 +174,42 @@ mfdcr(dmacr3), mfdcr(dmact3),mfdcr(dmada3), mfdcr(dmasa3), mfdcr(dmasb3) );
|
||||
mtdcr(ebccfga,pb7ap); printf ("%08x ", mfdcr(ebccfgd));
|
||||
|
||||
printf ("\n\n");
|
||||
#endif /*(CONFIG_405GP)*/
|
||||
#elif defined(CONFIG_5xx)
|
||||
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile memctl5xx_t *memctl = &immap->im_memctl;
|
||||
volatile sysconf5xx_t *sysconf = &immap->im_siu_conf;
|
||||
volatile sit5xx_t *timers = &immap->im_sit;
|
||||
volatile car5xx_t *car = &immap->im_clkrst;
|
||||
volatile uimb5xx_t *uimb = &immap->im_uimb;
|
||||
|
||||
printf("\nSystem Configuration registers\n");
|
||||
printf("\tIMMR\t0x%08X\tSIUMCR\t0x%08X \n", get_immr(0), sysconf->sc_siumcr);
|
||||
printf("\tSYPCR\t0x%08X\tSWSR\t0x%04X \n" ,sysconf->sc_sypcr, sysconf->sc_swsr);
|
||||
printf("\tSIPEND\t0x%08X\tSIMASK\t0x%08X \n", sysconf->sc_sipend, sysconf->sc_simask);
|
||||
printf("\tSIEL\t0x%08X\tSIVEC\t0x%08X \n", sysconf->sc_siel, sysconf->sc_sivec);
|
||||
printf("\tTESR\t0x%08X\n", sysconf->sc_tesr);
|
||||
|
||||
printf("\nMemory Controller Registers\n");
|
||||
printf("\tBR0\t0x%08X\tOR0\t0x%08X \n", memctl->memc_br0, memctl->memc_or0);
|
||||
printf("\tBR1\t0x%08X\tOR1\t0x%08X \n", memctl->memc_br1, memctl->memc_or1);
|
||||
printf("\tBR2\t0x%08X\tOR2\t0x%08X \n", memctl->memc_br2, memctl->memc_or2);
|
||||
printf("\tBR3\t0x%08X\tOR3\t0x%08X \n", memctl->memc_br3, memctl->memc_or3);
|
||||
printf("\tDMBR\t0x%08X\tDMOR\t0x%08X \n", memctl->memc_dmbr, memctl->memc_dmor );
|
||||
printf("\tMSTAT\t0x%08X\n", memctl->memc_mstat);
|
||||
|
||||
printf("\nSystem Integration Timers\n");
|
||||
printf("\tTBSCR\t0x%08X\tRTCSC\t0x%08X \n", timers->sit_tbscr, timers->sit_rtcsc);
|
||||
printf("\tPISCR\t0x%08X \n", timers->sit_piscr);
|
||||
|
||||
printf("\nClocks and Reset\n");
|
||||
printf("\tSCCR\t0x%08X\tPLPRCR\t0x%08X \n", car->car_sccr, car->car_plprcr);
|
||||
|
||||
printf("\nU-Bus to IMB3 Bus Interface\n");
|
||||
printf("\tUMCR\t0x%08X\tUIPEND\t0x%08X \n", uimb->uimb_umcr, uimb->uimb_uipend);
|
||||
printf ("\n\n");
|
||||
#endif /* CONFIG_5xx */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_8xx && CFG_CMD_REGINFO */
|
||||
#endif /* CONFIG_COMMANDS & CFG_CMD_REGINFO */
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
* a seperate section. Note that ENV_CRC is only defined when building
|
||||
* U-Boot itself.
|
||||
*/
|
||||
#if (defined(CONFIG_FADS) || \
|
||||
#if (defined(CONFIG_CMI) || \
|
||||
defined(CONFIG_FADS) || \
|
||||
defined(CONFIG_HYMOD) || \
|
||||
defined(CONFIG_ICU862) || \
|
||||
defined(CONFIG_R360MPI) || \
|
||||
|
||||
@@ -2357,34 +2357,35 @@ static void initialize_context(struct p_context *ctx)
|
||||
* should handle if, then, elif, else, fi, for, while, until, do, done.
|
||||
* case, function, and select are obnoxious, save those for later.
|
||||
*/
|
||||
struct reserved_combo {
|
||||
char *literal;
|
||||
int code;
|
||||
long flag;
|
||||
};
|
||||
/* Mostly a list of accepted follow-up reserved words.
|
||||
* FLAG_END means we are done with the sequence, and are ready
|
||||
* to turn the compound list into a command.
|
||||
* FLAG_START means the word must start a new compound list.
|
||||
*/
|
||||
static struct reserved_combo reserved_list[] = {
|
||||
{ "if", RES_IF, FLAG_THEN | FLAG_START },
|
||||
{ "then", RES_THEN, FLAG_ELIF | FLAG_ELSE | FLAG_FI },
|
||||
{ "elif", RES_ELIF, FLAG_THEN },
|
||||
{ "else", RES_ELSE, FLAG_FI },
|
||||
{ "fi", RES_FI, FLAG_END },
|
||||
{ "for", RES_FOR, FLAG_IN | FLAG_START },
|
||||
{ "while", RES_WHILE, FLAG_DO | FLAG_START },
|
||||
{ "until", RES_UNTIL, FLAG_DO | FLAG_START },
|
||||
{ "in", RES_IN, FLAG_DO },
|
||||
{ "do", RES_DO, FLAG_DONE },
|
||||
{ "done", RES_DONE, FLAG_END }
|
||||
};
|
||||
#define NRES (sizeof(reserved_list)/sizeof(struct reserved_combo))
|
||||
|
||||
int reserved_word(o_string *dest, struct p_context *ctx)
|
||||
{
|
||||
struct reserved_combo {
|
||||
char *literal;
|
||||
int code;
|
||||
long flag;
|
||||
};
|
||||
/* Mostly a list of accepted follow-up reserved words.
|
||||
* FLAG_END means we are done with the sequence, and are ready
|
||||
* to turn the compound list into a command.
|
||||
* FLAG_START means the word must start a new compound list.
|
||||
*/
|
||||
static struct reserved_combo reserved_list[] = {
|
||||
{ "if", RES_IF, FLAG_THEN | FLAG_START },
|
||||
{ "then", RES_THEN, FLAG_ELIF | FLAG_ELSE | FLAG_FI },
|
||||
{ "elif", RES_ELIF, FLAG_THEN },
|
||||
{ "else", RES_ELSE, FLAG_FI },
|
||||
{ "fi", RES_FI, FLAG_END },
|
||||
{ "for", RES_FOR, FLAG_IN | FLAG_START },
|
||||
{ "while", RES_WHILE, FLAG_DO | FLAG_START },
|
||||
{ "until", RES_UNTIL, FLAG_DO | FLAG_START },
|
||||
{ "in", RES_IN, FLAG_DO },
|
||||
{ "do", RES_DO, FLAG_DONE },
|
||||
{ "done", RES_DONE, FLAG_END }
|
||||
};
|
||||
struct reserved_combo *r;
|
||||
for (r=reserved_list;
|
||||
#define NRES sizeof(reserved_list)/sizeof(struct reserved_combo)
|
||||
r<reserved_list+NRES; r++) {
|
||||
if (strcmp(dest->data, r->literal) == 0) {
|
||||
debug_printf("found reserved word %s, code %d\n",r->literal,r->code);
|
||||
@@ -3169,6 +3170,18 @@ int parse_file_outer(void)
|
||||
}
|
||||
|
||||
#ifdef __U_BOOT__
|
||||
static void u_boot_hush_reloc(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
unsigned long addr;
|
||||
struct reserved_combo *r;
|
||||
|
||||
for (r=reserved_list; r<reserved_list+NRES; r++) {
|
||||
addr = (ulong) (r->literal) + gd->reloc_off;
|
||||
r->literal = (char *)addr;
|
||||
}
|
||||
}
|
||||
|
||||
int u_boot_hush_start(void)
|
||||
{
|
||||
top_vars = malloc(sizeof(struct variables));
|
||||
@@ -3177,6 +3190,7 @@ int u_boot_hush_start(void)
|
||||
top_vars->next = 0;
|
||||
top_vars->flg_export = 0;
|
||||
top_vars->flg_read_only = 1;
|
||||
u_boot_hush_reloc();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -279,6 +279,16 @@ void main_loop (void)
|
||||
}
|
||||
#endif /* CONFIG_MODEM_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_VERSION_VARIABLE
|
||||
{
|
||||
extern char version_string[];
|
||||
char *str = getenv("ver");
|
||||
|
||||
if (!str)
|
||||
setenv ("ver", version_string); /* set version variable */
|
||||
}
|
||||
#endif /* CONFIG_VERSION_VARIABLE */
|
||||
|
||||
#ifdef CFG_HUSH_PARSER
|
||||
u_boot_hush_start ();
|
||||
#endif
|
||||
@@ -852,7 +862,6 @@ int run_command (const char *cmd, int flag)
|
||||
int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int rcode = 1;
|
||||
|
||||
if (argc < 2) {
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
@@ -860,13 +869,21 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
|
||||
for (i=1; i<argc; ++i) {
|
||||
char *arg;
|
||||
|
||||
if ((arg = getenv (argv[i])) == NULL) {
|
||||
printf ("## Error: \"%s\" not defined\n", argv[i]);
|
||||
return 1;
|
||||
}
|
||||
#ifndef CFG_HUSH_PARSER
|
||||
if (run_command (getenv (argv[i]), flag) != -1) ++rcode;
|
||||
if (run_command (arg, flag) == -1)
|
||||
return 1;
|
||||
#else
|
||||
if (parse_string_outer(getenv (argv[i]),
|
||||
FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) == 0) ++rcode;
|
||||
if (parse_string_outer(arg,
|
||||
FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) == 0)
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
return ((rcode == i) ? 0 : 1);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* CFG_CMD_RUN */
|
||||
|
||||
@@ -83,8 +83,12 @@ static void send_reset(void)
|
||||
#endif
|
||||
int j;
|
||||
|
||||
I2C_ACTIVE;
|
||||
I2C_SCL(1);
|
||||
I2C_SDA(1);
|
||||
#ifdef I2C_INIT
|
||||
I2C_INIT;
|
||||
#endif
|
||||
I2C_TRISTATE;
|
||||
for(j = 0; j < 9; j++) {
|
||||
I2C_SCL(0);
|
||||
I2C_DELAY;
|
||||
@@ -262,13 +266,6 @@ static uchar read_byte(int ack)
|
||||
*/
|
||||
void i2c_init (int speed, int slaveaddr)
|
||||
{
|
||||
#ifdef CONFIG_8xx
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
#endif
|
||||
|
||||
#ifdef I2C_INIT
|
||||
I2C_INIT;
|
||||
#endif
|
||||
/*
|
||||
* WARNING: Do NOT save speed in a static variable: if the
|
||||
* I2C routines are called before RAM is initialized (to read
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <AT91RM9200.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
/* read co-processor 15, register #1 (control register) */
|
||||
static unsigned long read_p15_c1(void)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <AT91RM9200.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/proc-armv/ptrace.h>
|
||||
|
||||
extern void reset_cpu(ulong addr);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <AT91RM9200.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
/* ggi thunder */
|
||||
AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU;
|
||||
|
||||
@@ -250,12 +250,17 @@ dcache_disable:
|
||||
* RETURNS: N/A
|
||||
*
|
||||
*/
|
||||
#if defined(CONFIG_INCA_IP)
|
||||
# define CACHE_LOCK_SIZE (CFG_DCACHE_SIZE)
|
||||
#elif defined(CONFIG_PURPLE)
|
||||
# define CACHE_LOCK_SIZE (CFG_DCACHE_SIZE/2)
|
||||
#endif
|
||||
.globl mips_cache_lock
|
||||
.ent mips_cache_lock
|
||||
mips_cache_lock:
|
||||
li a1, K0BASE - CFG_DCACHE_SIZE
|
||||
li a1, K0BASE - CACHE_LOCK_SIZE
|
||||
addu a0, a1
|
||||
li a2, CFG_DCACHE_SIZE
|
||||
li a2, CACHE_LOCK_SIZE
|
||||
li a3, CFG_CACHELINE_SIZE
|
||||
move a1, a2
|
||||
icacheop(a0,a1,a2,a3,0x1d)
|
||||
|
||||
@@ -27,8 +27,12 @@
|
||||
|
||||
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
#ifdef CONFIG_INCA_IP
|
||||
#if defined(CONFIG_INCA_IP)
|
||||
*INCA_IP_WDT_RST_REQ = 0x3f;
|
||||
#elif defined(CONFIG_PURPLE)
|
||||
void (*f)(void) = (void *) 0xbfc00000;
|
||||
|
||||
f();
|
||||
#endif
|
||||
fprintf(stderr, "*** reset failed ***\n");
|
||||
return 0;
|
||||
|
||||
@@ -2,10 +2,49 @@
|
||||
* (INCA) ASC UART support
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef CONFIG_PURPLE
|
||||
#define serial_init asc_serial_init
|
||||
#define serial_putc asc_serial_putc
|
||||
#define serial_puts asc_serial_puts
|
||||
#define serial_getc asc_serial_getc
|
||||
#define serial_tstc asc_serial_tstc
|
||||
#define serial_setbrg asc_serial_setbrg
|
||||
#endif
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/inca-ip.h>
|
||||
#include "serial.h"
|
||||
|
||||
#ifdef CONFIG_PURPLE
|
||||
|
||||
#undef ASC_FIFO_PRESENT
|
||||
#define TOUT_LOOP 100000
|
||||
|
||||
/* Set base address for second FPI interrupt control register bank */
|
||||
#define SFPI_INTCON_BASEADDR 0xBF0F0000
|
||||
|
||||
/* Register offset from base address */
|
||||
#define FBS_ISR 0x00000000 /* Interrupt status register */
|
||||
#define FBS_IMR 0x00000008 /* Interrupt mask register */
|
||||
#define FBS_IDIS 0x00000010 /* Interrupt disable register */
|
||||
|
||||
/* Interrupt status register bits */
|
||||
#define FBS_ISR_AT 0x00000040 /* ASC transmit interrupt */
|
||||
#define FBS_ISR_AR 0x00000020 /* ASC receive interrupt */
|
||||
#define FBS_ISR_AE 0x00000010 /* ASC error interrupt */
|
||||
#define FBS_ISR_AB 0x00000008 /* ASC transmit buffer interrupt */
|
||||
#define FBS_ISR_AS 0x00000004 /* ASC start of autobaud detection interrupt */
|
||||
#define FBS_ISR_AF 0x00000002 /* ASC end of autobaud detection interrupt */
|
||||
|
||||
#else
|
||||
|
||||
#define ASC_FIFO_PRESENT
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define SET_BIT(reg, mask) reg |= (mask)
|
||||
#define CLEAR_BIT(reg, mask) reg &= (~mask)
|
||||
#define CLEAR_BITS(reg, mask) CLEAR_BIT(reg, mask)
|
||||
@@ -32,8 +71,10 @@ static volatile incaAsc_t *pAsc = (incaAsc_t *)INCA_IP_ASC;
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
#ifdef CONFIG_INCA_IP
|
||||
/* we have to set PMU.EN13 bit to enable an ASC device*/
|
||||
INCAASC_PMU_ENABLE(13);
|
||||
#endif
|
||||
|
||||
/* and we have to set CLC register*/
|
||||
CLEAR_BIT(pAsc->asc_clc, ASCCLC_DISS);
|
||||
@@ -45,6 +86,7 @@ int serial_init (void)
|
||||
/* select input port */
|
||||
pAsc->asc_pisel = (CONSOLE_TTY & 0x1);
|
||||
|
||||
#ifdef ASC_FIFO_PRESENT
|
||||
/* TXFIFO's filling level */
|
||||
SET_BITFIELD(pAsc->asc_txfcon, ASCTXFCON_TXFITLMASK,
|
||||
ASCTXFCON_TXFITLOFF, INCAASC_TXFIFO_FL);
|
||||
@@ -56,20 +98,25 @@ int serial_init (void)
|
||||
ASCRXFCON_RXFITLOFF, INCAASC_RXFIFO_FL);
|
||||
/* enable RXFIFO */
|
||||
SET_BIT(pAsc->asc_rxfcon, ASCRXFCON_RXFEN);
|
||||
#endif
|
||||
|
||||
/* enable error signals */
|
||||
SET_BIT(pAsc->asc_con, ASCCON_FEN);
|
||||
SET_BIT(pAsc->asc_con, ASCCON_OEN);
|
||||
|
||||
#ifdef CONFIG_INCA_IP
|
||||
/* acknowledge ASC interrupts */
|
||||
ASC_INTERRUPTS_CLEAR(INCAASC_IRQ_LINE_ALL);
|
||||
|
||||
/* disable ASC interrupts */
|
||||
ASC_INTERRUPTS_DISABLE(INCAASC_IRQ_LINE_ALL);
|
||||
#endif
|
||||
|
||||
#ifdef ASC_FIFO_PRESENT
|
||||
/* set FIFOs into the transparent mode */
|
||||
SET_BIT(pAsc->asc_txfcon, ASCTXFCON_TXTMEN);
|
||||
SET_BIT(pAsc->asc_rxfcon, ASCRXFCON_RXTMEN);
|
||||
#endif
|
||||
|
||||
/* set baud rate */
|
||||
serial_setbrg();
|
||||
@@ -85,7 +132,11 @@ void serial_setbrg (void)
|
||||
ulong uiReloadValue, fdv;
|
||||
ulong f_ASC;
|
||||
|
||||
#ifdef CONFIG_INCA_IP
|
||||
f_ASC = incaip_get_fpiclk();
|
||||
#else
|
||||
f_ASC = ASC_CLOCK_RATE;
|
||||
#endif
|
||||
|
||||
#ifndef INCAASC_USE_FDV
|
||||
fdv = 2;
|
||||
@@ -210,10 +261,15 @@ static int serial_setopt (void)
|
||||
|
||||
void serial_putc (const char c)
|
||||
{
|
||||
#ifdef ASC_FIFO_PRESENT
|
||||
uint txFl = 0;
|
||||
#else
|
||||
uint timeout = 0;
|
||||
#endif
|
||||
|
||||
if (c == '\n') serial_putc ('\r');
|
||||
|
||||
#ifdef ASC_FIFO_PRESENT
|
||||
/* check do we have a free space in the TX FIFO */
|
||||
/* get current filling level */
|
||||
do
|
||||
@@ -221,8 +277,25 @@ void serial_putc (const char c)
|
||||
txFl = ( pAsc->asc_fstat & ASCFSTAT_TXFFLMASK ) >> ASCFSTAT_TXFFLOFF;
|
||||
}
|
||||
while ( txFl == INCAASC_TXFIFO_FULL );
|
||||
#else
|
||||
|
||||
while(!(*(volatile unsigned long*)(SFPI_INTCON_BASEADDR + FBS_ISR) &
|
||||
FBS_ISR_AB))
|
||||
{
|
||||
if (timeout++ > TOUT_LOOP)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pAsc->asc_tbuf = c; /* write char to Transmit Buffer Register */
|
||||
|
||||
#ifndef ASC_FIFO_PRESENT
|
||||
*(volatile unsigned long*)(SFPI_INTCON_BASEADDR + FBS_ISR) = FBS_ISR_AB |
|
||||
FBS_ISR_AT;
|
||||
#endif
|
||||
|
||||
/* check for errors */
|
||||
if ( pAsc->asc_con & ASCCON_OE )
|
||||
{
|
||||
@@ -251,6 +324,10 @@ int serial_getc (void)
|
||||
|
||||
c = (char)(pAsc->asc_rbuf & symbol_mask);
|
||||
|
||||
#ifndef ASC_FIFO_PRESENT
|
||||
*(volatile unsigned long*)(SFPI_INTCON_BASEADDR + FBS_ISR) = FBS_ISR_AR;
|
||||
#endif
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -258,10 +335,19 @@ int serial_tstc (void)
|
||||
{
|
||||
int res = 1;
|
||||
|
||||
#ifdef ASC_FIFO_PRESENT
|
||||
if ( (pAsc->asc_fstat & ASCFSTAT_RXFFLMASK) == 0 )
|
||||
{
|
||||
res = 0;
|
||||
}
|
||||
#else
|
||||
if (!(*(volatile unsigned long*)(SFPI_INTCON_BASEADDR + FBS_ISR) &
|
||||
FBS_ISR_AR))
|
||||
|
||||
{
|
||||
res = 0;
|
||||
}
|
||||
#endif
|
||||
else if ( pAsc->asc_con & ASCCON_FE )
|
||||
{
|
||||
SET_BIT(pAsc->asc_whbcon, ASCWHBCON_CLRFE);
|
||||
|
||||
@@ -42,9 +42,12 @@
|
||||
_start:
|
||||
RVECENT(reset,0) /* U-boot entry point */
|
||||
RVECENT(reset,1) /* software reboot */
|
||||
#ifdef CONFIG_INCA_IP
|
||||
.word 0x000020C4 /* EBU init code, fetched during booting */
|
||||
.word 0x00000000 /* phase of the flash */
|
||||
#if defined(CONFIG_INCA_IP)
|
||||
.word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
|
||||
.word 0x00000000 /* phase of the flash */
|
||||
#elif defined(CONFIG_PURPLE)
|
||||
.word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
|
||||
.word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
|
||||
#else
|
||||
RVECENT(romReserved,2)
|
||||
#endif
|
||||
@@ -178,6 +181,30 @@ _start:
|
||||
* 128 * 8 == 1024 == 0x400
|
||||
* so this is address R_VEC+0x400 == 0xbfc00400
|
||||
*/
|
||||
#ifdef CONFIG_PURPLE
|
||||
/* 0xbfc00400 */
|
||||
.word 0xdc870000
|
||||
.word 0xfca70000
|
||||
.word 0x20840008
|
||||
.word 0x20a50008
|
||||
.word 0x20c6ffff
|
||||
.word 0x14c0fffa
|
||||
.word 0x00000000
|
||||
.word 0x03e00008
|
||||
.word 0x00000000
|
||||
.word 0x00000000
|
||||
/* 0xbfc00428 */
|
||||
.word 0xdc870000
|
||||
.word 0xfca70000
|
||||
.word 0x20840008
|
||||
.word 0x20a50008
|
||||
.word 0x20c6ffff
|
||||
.word 0x14c0fffa
|
||||
.word 0x00000000
|
||||
.word 0x03e00008
|
||||
.word 0x00000000
|
||||
.word 0x00000000
|
||||
#endif /* CONFIG_PURPLE */
|
||||
.align 4
|
||||
reset:
|
||||
|
||||
@@ -283,12 +310,17 @@ relocate_code:
|
||||
* t1 = target address
|
||||
* t2 = source end address
|
||||
*/
|
||||
/* On the purple board we copy the code earlier in a special way
|
||||
* in order to solve flash problems
|
||||
*/
|
||||
#ifndef CONFIG_PURPLE
|
||||
1:
|
||||
lw t3, 0(t0)
|
||||
sw t3, 0(t1)
|
||||
addu t0, 4
|
||||
ble t0, t2, 1b
|
||||
addu t1, 4 /* delay slot */
|
||||
#endif
|
||||
|
||||
/* If caches were enabled, we would have to flush them here.
|
||||
*/
|
||||
|
||||
52
cpu/mpc5xx/Makefile
Normal file
52
cpu/mpc5xx/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# File: cpu/mpc5xx/Makefile
|
||||
#
|
||||
# Discription: Makefile to build mpc5xx cpu configuration.
|
||||
# Will include top config.mk which itselfs
|
||||
# uses the definitions made in cpu/mpc5xx/config.mk
|
||||
#
|
||||
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(CPU).a
|
||||
|
||||
START = start.S
|
||||
OBJS = serial.o cpu.o cpu_init.o interrupts.o traps.o speed.o status_led.o
|
||||
|
||||
all: .depend $(START) $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(START:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
34
cpu/mpc5xx/config.mk
Normal file
34
cpu/mpc5xx/config.mk
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# File: config.mk
|
||||
#
|
||||
# Discription: compiler flags and make definitions
|
||||
#
|
||||
|
||||
|
||||
PLATFORM_RELFLAGS += -mrelocatable -ffixed-r14 -meabi
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_5xx -ffixed-r2 -ffixed-r29 -mpowerpc -msoft-float
|
||||
|
||||
155
cpu/mpc5xx/cpu.c
Normal file
155
cpu/mpc5xx/cpu.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation,
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: cpu.c
|
||||
*
|
||||
* Discription: Some cpu specific function for watchdog,
|
||||
* cpu version test, clock setting ...
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <mpc5xx.h>
|
||||
|
||||
|
||||
#if (defined(CONFIG_MPC555))
|
||||
# define ID_STR "MPC555/556"
|
||||
|
||||
/*
|
||||
* Check version of cpu with Processor Version Register (PVR)
|
||||
*/
|
||||
static int check_cpu_version (long clock, uint pvr, uint immr)
|
||||
{
|
||||
char buf[32];
|
||||
/* The highest 16 bits should be 0x0002 for a MPC555/556 */
|
||||
if ((pvr >> 16) == 0x0002) {
|
||||
printf (" " ID_STR " Version %x", (pvr >> 16));
|
||||
printf (" at %s MHz:", strmhz (buf, clock));
|
||||
} else {
|
||||
printf ("Not supported cpu version");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_MPC555 */
|
||||
|
||||
|
||||
/*
|
||||
* Check version of mpc5xx
|
||||
*/
|
||||
int checkcpu (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
ulong clock = gd->cpu_clk;
|
||||
uint immr = get_immr (0); /* Return full IMMR contents */
|
||||
uint pvr = get_pvr (); /* Retrieve PVR register */
|
||||
|
||||
puts ("CPU: ");
|
||||
|
||||
return check_cpu_version (clock, pvr, immr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Called by macro WATCHDOG_RESET
|
||||
*/
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
void watchdog_reset (void)
|
||||
{
|
||||
int re_enable = disable_interrupts ();
|
||||
|
||||
reset_5xx_watchdog ((immap_t *) CFG_IMMR);
|
||||
if (re_enable)
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Will clear software reset
|
||||
*/
|
||||
void reset_5xx_watchdog (volatile immap_t * immr)
|
||||
{
|
||||
/* Use the MPC5xx Internal Watchdog */
|
||||
immr->im_siu_conf.sc_swsr = 0x556c; /* Prevent SW time-out */
|
||||
immr->im_siu_conf.sc_swsr = 0xaa39;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
|
||||
/*
|
||||
* Get timebase clock frequency
|
||||
*/
|
||||
unsigned long get_tbclk (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
volatile immap_t *immr = (volatile immap_t *) CFG_IMMR;
|
||||
ulong oscclk, factor;
|
||||
|
||||
if (immr->im_clkrst.car_sccr & SCCR_TBS) {
|
||||
return (gd->cpu_clk / 16);
|
||||
}
|
||||
|
||||
factor = (((CFG_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1;
|
||||
|
||||
oscclk = gd->cpu_clk / factor;
|
||||
|
||||
if ((immr->im_clkrst.car_sccr & SCCR_RTSEL) == 0 || factor > 2) {
|
||||
return (oscclk / 4);
|
||||
}
|
||||
return (oscclk / 16);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reset board
|
||||
*/
|
||||
int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr;
|
||||
|
||||
/* Interrupts off, enable reset */
|
||||
__asm__ volatile (" mtspr 81, %r0 \n\t
|
||||
mfmsr %r3 \n\t
|
||||
rlwinm %r31,%r3,0,25,23\n\t
|
||||
mtmsr %r31 \n\t");
|
||||
/*
|
||||
* Trying to execute the next instruction at a non-existing address
|
||||
* should cause a machine check, resulting in reset
|
||||
*/
|
||||
#ifdef CFG_RESET_ADDRESS
|
||||
addr = CFG_RESET_ADDRESS;
|
||||
#else
|
||||
/*
|
||||
* note: when CFG_MONITOR_BASE points to a RAM address, CFG_MONITOR_BASE * - sizeof (ulong) is usually a valid address. Better pick an address
|
||||
* known to be invalid on your system and assign it to CFG_RESET_ADDRESS.
|
||||
* "(ulong)-1" used to be a good choice for many systems...
|
||||
*/
|
||||
addr = CFG_MONITOR_BASE - sizeof (ulong);
|
||||
#endif
|
||||
((void (*) (void)) addr) ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
119
cpu/mpc5xx/cpu_init.c
Normal file
119
cpu/mpc5xx/cpu_init.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation,
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: cpu_init.c
|
||||
*
|
||||
* Discription: Contains initialisation functions to setup
|
||||
* the cpu properly
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xx.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
/*
|
||||
* Setup essential cpu registers to run
|
||||
*/
|
||||
void cpu_init_f (volatile immap_t * immr)
|
||||
{
|
||||
volatile memctl5xx_t *memctl = &immr->im_memctl;
|
||||
ulong reg;
|
||||
|
||||
/* SYPCR - contains watchdog control. This will enable watchdog */
|
||||
/* if CONFIG_WATCHDOG is set */
|
||||
immr->im_siu_conf.sc_sypcr = CFG_SYPCR;
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
reset_5xx_watchdog (immr);
|
||||
#endif
|
||||
|
||||
/* SIUMCR - contains debug pin configuration */
|
||||
immr->im_siu_conf.sc_siumcr |= CFG_SIUMCR;
|
||||
|
||||
/* Initialize timebase. Unlock TBSCRK */
|
||||
immr->im_sitk.sitk_tbscrk = KAPWR_KEY;
|
||||
immr->im_sit.sit_tbscr = CFG_TBSCR;
|
||||
|
||||
/* Full IMB bus speed */
|
||||
immr->im_uimb.uimb_umcr = CFG_UMCR;
|
||||
|
||||
/* Time base and decrementer will be enables (TBE) */
|
||||
/* in init_timebase() in time.c called from board_init_f(). */
|
||||
|
||||
/* Initialize the PIT. Unlock PISCRK */
|
||||
immr->im_sitk.sitk_piscrk = KAPWR_KEY;
|
||||
immr->im_sit.sit_piscr = CFG_PISCR;
|
||||
|
||||
/* PLL (CPU clock) settings */
|
||||
immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
|
||||
|
||||
/* If CFG_PLPRCR (set in the various *_config.h files) tries to
|
||||
* set the MF field, then just copy CFG_PLPRCR over car_plprcr,
|
||||
* otherwise OR in CFG_PLPRCR so we do not change the currentMF
|
||||
* field value.
|
||||
*/
|
||||
#if ((CFG_PLPRCR & PLPRCR_MF_MSK) != 0)
|
||||
reg = CFG_PLPRCR; /* reset control bits */
|
||||
#else
|
||||
reg = immr->im_clkrst.car_plprcr;
|
||||
reg &= PLPRCR_MF_MSK; /* isolate MF field */
|
||||
reg |= CFG_PLPRCR; /* reset control bits */
|
||||
#endif
|
||||
immr->im_clkrst.car_plprcr = reg;
|
||||
|
||||
/* System integration timers. CFG_MASK has EBDF configuration */
|
||||
immr->im_clkrstk.cark_sccrk = KAPWR_KEY;
|
||||
reg = immr->im_clkrst.car_sccr;
|
||||
reg &= SCCR_MASK;
|
||||
reg |= CFG_SCCR;
|
||||
immr->im_clkrst.car_sccr = reg;
|
||||
|
||||
/* Memory Controller */
|
||||
memctl->memc_br0 = CFG_BR0_PRELIM;
|
||||
memctl->memc_or0 = CFG_OR0_PRELIM;
|
||||
|
||||
#if (defined(CFG_OR1_PRELIM) && defined(CFG_BR1_PRELIM))
|
||||
memctl->memc_or1 = CFG_OR1_PRELIM;
|
||||
memctl->memc_br1 = CFG_BR1_PRELIM;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_OR2_PRELIM) && defined(CFG_BR2_PRELIM)
|
||||
memctl->memc_or2 = CFG_OR2_PRELIM;
|
||||
memctl->memc_br2 = CFG_BR2_PRELIM;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_OR3_PRELIM) && defined(CFG_BR3_PRELIM)
|
||||
memctl->memc_or3 = CFG_OR3_PRELIM;
|
||||
memctl->memc_br3 = CFG_BR3_PRELIM;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize higher level parts of cpu
|
||||
*/
|
||||
int cpu_init_r (void)
|
||||
{
|
||||
/* Nothing to do at the moment */
|
||||
return (0);
|
||||
}
|
||||
273
cpu/mpc5xx/interrupts.c
Normal file
273
cpu/mpc5xx/interrupts.c
Normal file
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002 Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation,
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: interrupt.c
|
||||
*
|
||||
* Discription: Contains interrupt routines needed by U-Boot
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <mpc5xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
struct interrupt_action {
|
||||
interrupt_handler_t *handler;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
static struct interrupt_action irq_vecs[NR_IRQS];
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
static __inline__ unsigned long get_msr (void)
|
||||
{
|
||||
unsigned long msr;
|
||||
|
||||
asm volatile ("mfmsr %0":"=r" (msr):);
|
||||
|
||||
return msr;
|
||||
}
|
||||
|
||||
static __inline__ void set_msr (unsigned long msr)
|
||||
{
|
||||
asm volatile ("mtmsr %0"::"r" (msr));
|
||||
}
|
||||
|
||||
static __inline__ unsigned long get_dec (void)
|
||||
{
|
||||
unsigned long val;
|
||||
|
||||
asm volatile ("mfdec %0":"=r" (val):);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
static __inline__ void set_dec (unsigned long val)
|
||||
{
|
||||
asm volatile ("mtdec %0"::"r" (val));
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable interrupts
|
||||
*/
|
||||
void enable_interrupts (void)
|
||||
{
|
||||
set_msr (get_msr () | MSR_EE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns flag if MSR_EE was set before
|
||||
*/
|
||||
int disable_interrupts (void)
|
||||
{
|
||||
ulong msr = get_msr ();
|
||||
|
||||
set_msr (msr & ~MSR_EE);
|
||||
return ((msr & MSR_EE) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise interrupts
|
||||
*/
|
||||
|
||||
int interrupt_init (void)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
|
||||
/* Decrementer used here for status led */
|
||||
decrementer_count = get_tbclk () / CFG_HZ;
|
||||
|
||||
/* Disable all interrupts */
|
||||
immr->im_siu_conf.sc_simask = 0;
|
||||
|
||||
set_dec (decrementer_count);
|
||||
|
||||
set_msr (get_msr () | MSR_EE);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle external interrupts
|
||||
*/
|
||||
void external_interrupt (struct pt_regs *regs)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
int irq;
|
||||
ulong simask, newmask;
|
||||
ulong vec, v_bit;
|
||||
|
||||
/*
|
||||
* read the SIVEC register and shift the bits down
|
||||
* to get the irq number
|
||||
*/
|
||||
vec = immr->im_siu_conf.sc_sivec;
|
||||
irq = vec >> 26;
|
||||
v_bit = 0x80000000UL >> irq;
|
||||
|
||||
/*
|
||||
* Read Interrupt Mask Register and Mask Interrupts
|
||||
*/
|
||||
simask = immr->im_siu_conf.sc_simask;
|
||||
newmask = simask & (~(0xFFFF0000 >> irq));
|
||||
immr->im_siu_conf.sc_simask = newmask;
|
||||
|
||||
if (!(irq & 0x1)) { /* External Interrupt ? */
|
||||
ulong siel;
|
||||
|
||||
/*
|
||||
* Read Interrupt Edge/Level Register
|
||||
*/
|
||||
siel = immr->im_siu_conf.sc_siel;
|
||||
|
||||
if (siel & v_bit) { /* edge triggered interrupt ? */
|
||||
/*
|
||||
* Rewrite SIPEND Register to clear interrupt
|
||||
*/
|
||||
immr->im_siu_conf.sc_sipend = v_bit;
|
||||
}
|
||||
}
|
||||
|
||||
if (irq_vecs[irq].handler != NULL) {
|
||||
irq_vecs[irq].handler (irq_vecs[irq].arg);
|
||||
} else {
|
||||
printf ("\nBogus External Interrupt IRQ %d Vector %ld\n",
|
||||
irq, vec);
|
||||
/* turn off the bogus interrupt to avoid it from now */
|
||||
simask &= ~v_bit;
|
||||
}
|
||||
/*
|
||||
* Re-Enable old Interrupt Mask
|
||||
*/
|
||||
immr->im_siu_conf.sc_simask = simask;
|
||||
}
|
||||
|
||||
/*
|
||||
* Install and free an interrupt handler
|
||||
*/
|
||||
void irq_install_handler (int vec, interrupt_handler_t * handler,
|
||||
void *arg)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
/* SIU interrupt */
|
||||
if (irq_vecs[vec].handler != NULL) {
|
||||
printf ("SIU interrupt %d 0x%x\n",
|
||||
vec,
|
||||
(uint) handler);
|
||||
}
|
||||
irq_vecs[vec].handler = handler;
|
||||
irq_vecs[vec].arg = arg;
|
||||
immr->im_siu_conf.sc_simask |= 1 << (31 - vec);
|
||||
#if 0
|
||||
printf ("Install SIU interrupt for vector %d ==> %p\n",
|
||||
vec, handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
void irq_free_handler (int vec)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
/* SIU interrupt */
|
||||
#if 0
|
||||
printf ("Free CPM interrupt for vector %d\n",
|
||||
vec);
|
||||
#endif
|
||||
immr->im_siu_conf.sc_simask &= ~(1 << (31 - vec));
|
||||
irq_vecs[vec].handler = NULL;
|
||||
irq_vecs[vec].arg = NULL;
|
||||
}
|
||||
|
||||
volatile ulong timestamp = 0;
|
||||
|
||||
/*
|
||||
* Timer interrupt - gets called when bit 0 of DEC changes from
|
||||
* 0. Decrementer is enabled with bit TBE in TBSCR.
|
||||
*/
|
||||
void timer_interrupt (struct pt_regs *regs)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
extern void status_led_tick (ulong);
|
||||
#endif
|
||||
#if 0
|
||||
printf ("*** Timer Interrupt *** ");
|
||||
#endif
|
||||
/* Reset Timer Status Bit and Timers Interrupt Status */
|
||||
immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
|
||||
__asm__ ("nop");
|
||||
immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
|
||||
|
||||
/* Restore Decrementer Count */
|
||||
set_dec (decrementer_count);
|
||||
|
||||
timestamp++;
|
||||
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
status_led_tick (timestamp);
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
/*
|
||||
* The shortest watchdog period of all boards
|
||||
* is approx. 1 sec, thus re-trigger watchdog at least
|
||||
* every 500 ms = CFG_HZ / 2
|
||||
*/
|
||||
if ((timestamp % (CFG_HZ / 2)) == 0) {
|
||||
reset_5xx_watchdog (immr);
|
||||
}
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset timer
|
||||
*/
|
||||
void reset_timer (void)
|
||||
{
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get Timer
|
||||
*/
|
||||
ulong get_timer (ulong base)
|
||||
{
|
||||
return (timestamp - base);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set timer
|
||||
*/
|
||||
void set_timer (ulong t)
|
||||
{
|
||||
timestamp = t;
|
||||
}
|
||||
171
cpu/mpc5xx/serial.c
Normal file
171
cpu/mpc5xx/serial.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation,
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: serial.c
|
||||
*
|
||||
* Discription: Serial interface driver for SCI1 and SCI2.
|
||||
* Since this code will be called from ROM use
|
||||
* only non-static local variables.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <mpc5xx.h>
|
||||
|
||||
|
||||
/*
|
||||
* Local function prototypes
|
||||
*/
|
||||
|
||||
static int ready_to_send(void);
|
||||
|
||||
/*
|
||||
* Minimal global serial functions needed to use one of the SCI modules.
|
||||
*/
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
|
||||
serial_setbrg();
|
||||
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
/* 10-Bit, 1 start bit, 8 data bit, no parity, 1 stop bit */
|
||||
immr->im_qsmcm.qsmcm_scc1r1 = SCI_M_10;
|
||||
immr->im_qsmcm.qsmcm_scc1r1 = SCI_TE | SCI_RE;
|
||||
#else
|
||||
immr->im_qsmcm.qsmcm_scc2r1 = SCI_M_10;
|
||||
immr->im_qsmcm.qsmcm_scc2r1 = SCI_TE | SCI_RE;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_putc(const char c)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
|
||||
/* Test for completition */
|
||||
if(ready_to_send()) {
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
immr->im_qsmcm.qsmcm_sc1dr = (short)c;
|
||||
#else
|
||||
immr->im_qsmcm.qsmcm_sc2dr = (short)c;
|
||||
#endif
|
||||
if(c == '\n') {
|
||||
if(ready_to_send());
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
immr->im_qsmcm.qsmcm_sc1dr = (short)'\r';
|
||||
#else
|
||||
immr->im_qsmcm.qsmcm_sc2dr = (short)'\r';
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc(void)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
volatile short status;
|
||||
unsigned char tmp;
|
||||
|
||||
/* New data ? */
|
||||
do {
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
status = immr->im_qsmcm.qsmcm_sc1sr;
|
||||
#else
|
||||
status = immr->im_qsmcm.qsmcm_sc2sr;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
reset_5xx_watchdog (immr);
|
||||
#endif
|
||||
} while ((status & SCI_RDRF) == 0);
|
||||
|
||||
/* Read data */
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
tmp = (unsigned char)(immr->im_qsmcm.qsmcm_sc1dr & SCI_SCXDR_MK);
|
||||
#else
|
||||
tmp = (unsigned char)( immr->im_qsmcm.qsmcm_sc2dr & SCI_SCXDR_MK);
|
||||
#endif
|
||||
return tmp;
|
||||
}
|
||||
|
||||
int serial_tstc()
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
short status;
|
||||
|
||||
/* New data character ? */
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
status = immr->im_qsmcm.qsmcm_sc1sr;
|
||||
#else
|
||||
status = immr->im_qsmcm.qsmcm_sc2sr;
|
||||
#endif
|
||||
return (status & SCI_RDRF);
|
||||
}
|
||||
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
short scxbr;
|
||||
|
||||
/* Set baudrate */
|
||||
scxbr = (gd->cpu_clk / (32 * gd->baudrate));
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
immr->im_qsmcm.qsmcm_scc1r0 = (scxbr & SCI_SCXBR_MK);
|
||||
#else
|
||||
immr->im_qsmcm.qsmcm_scc2r0 = (scxbr & SCI_SCXBR_MK);
|
||||
#endif
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc(*s);
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
int ready_to_send(void)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
volatile short status;
|
||||
|
||||
do {
|
||||
#if defined(CONFIG_5xx_CONS_SCI1)
|
||||
status = immr->im_qsmcm.qsmcm_sc1sr;
|
||||
#else
|
||||
status = immr->im_qsmcm.qsmcm_sc2sr;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
reset_5xx_watchdog (immr);
|
||||
#endif
|
||||
} while ((status & SCI_TDRE) == 0);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
66
cpu/mpc5xx/speed.c
Normal file
66
cpu/mpc5xx/speed.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation,
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: speed.c
|
||||
*
|
||||
* Discription: Provides cpu speed calculation
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
/*
|
||||
* Get cpu and bus clock
|
||||
*/
|
||||
int get_clocks (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
|
||||
#ifndef CONFIG_5xx_GCLK_FREQ
|
||||
uint divf = (immr->im_clkrst.car_plprcr & PLPRCR_DIVF_MSK);
|
||||
uint mf = ((immr->im_clkrst.car_plprcr & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT);
|
||||
ulong vcoout;
|
||||
|
||||
vcoout = (CFG_OSC_CLK / (divf + 1)) * (mf + 1) * 2;
|
||||
if(immr->im_clkrst.car_plprcr & PLPRCR_CSRC_MSK) {
|
||||
gd->cpu_clk = vcoout / (2^(((immr->im_clkrst.car_sccr & SCCR_DFNL_MSK) >> SCCR_DFNL_SHIFT) + 1));
|
||||
} else {
|
||||
gd->cpu_clk = vcoout / (2^(immr->im_clkrst.car_sccr & SCCR_DFNH_MSK));
|
||||
}
|
||||
|
||||
#else /* CONFIG_5xx_GCLK_FREQ */
|
||||
gd->bus_clk = CONFIG_5xx_GCLK_FREQ;
|
||||
#endif /* CONFIG_5xx_GCLK_FREQ */
|
||||
|
||||
if ((immr->im_clkrst.car_sccr & SCCR_EBDF11) == 0) {
|
||||
/* No Bus Divider active */
|
||||
gd->bus_clk = gd->cpu_clk;
|
||||
} else {
|
||||
/* CLKOUT is GCLK / 2 */
|
||||
gd->bus_clk = gd->cpu_clk / 2;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
629
cpu/mpc5xx/start.S
Normal file
629
cpu/mpc5xx/start.S
Normal file
@@ -0,0 +1,629 @@
|
||||
/*
|
||||
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
|
||||
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
|
||||
* Copyright (C) 2000, 2001, 2002 Wolfgang Denk <wd@denx.de>
|
||||
* Copyright (C) 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: start.S
|
||||
*
|
||||
* Discription: startup code
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <mpc5xx.h>
|
||||
#include <version.h>
|
||||
|
||||
#define CONFIG_5xx 1 /* needed for Linux kernel header files */
|
||||
#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
#include <ppc_defs.h>
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#ifndef CONFIG_IDENT_STRING
|
||||
#define CONFIG_IDENT_STRING ""
|
||||
#endif
|
||||
|
||||
/* We don't have a MMU.
|
||||
*/
|
||||
#undef MSR_KERNEL
|
||||
#define MSR_KERNEL ( MSR_ME | MSR_RI ) /* Machine Check and Recoverable Interr. */
|
||||
|
||||
/*
|
||||
* Set up GOT: Global Offset Table
|
||||
*
|
||||
* Use r14 to access the GOT
|
||||
*/
|
||||
START_GOT
|
||||
GOT_ENTRY(_GOT2_TABLE_)
|
||||
GOT_ENTRY(_FIXUP_TABLE_)
|
||||
|
||||
GOT_ENTRY(_start)
|
||||
GOT_ENTRY(_start_of_vectors)
|
||||
GOT_ENTRY(_end_of_vectors)
|
||||
GOT_ENTRY(transfer_to_handler)
|
||||
|
||||
GOT_ENTRY(_end)
|
||||
GOT_ENTRY(.bss)
|
||||
END_GOT
|
||||
|
||||
/*
|
||||
* r3 - 1st arg to board_init(): IMMP pointer
|
||||
* r4 - 2nd arg to board_init(): boot flag
|
||||
*/
|
||||
.text
|
||||
.long 0x27051956 /* U-Boot Magic Number */
|
||||
.globl version_string
|
||||
version_string:
|
||||
.ascii U_BOOT_VERSION
|
||||
.ascii " (", __DATE__, " - ", __TIME__, ")"
|
||||
.ascii CONFIG_IDENT_STRING, "\0"
|
||||
|
||||
. = EXC_OFF_SYS_RESET
|
||||
.globl _start
|
||||
_start:
|
||||
mfspr r3, 638
|
||||
li r4, CFG_ISB /* Set ISB bit */
|
||||
or r3, r3, r4
|
||||
mtspr 638, r3
|
||||
li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
|
||||
b boot_cold
|
||||
|
||||
. = EXC_OFF_SYS_RESET + 0x20
|
||||
|
||||
.globl _start_warm
|
||||
_start_warm:
|
||||
li r21, BOOTFLAG_WARM /* Software reboot */
|
||||
b boot_warm
|
||||
|
||||
boot_cold:
|
||||
boot_warm:
|
||||
|
||||
/* Initialize machine status; enable machine check interrupt */
|
||||
/*----------------------------------------------------------------------*/
|
||||
li r3, MSR_KERNEL /* Set ME, RI flags */
|
||||
mtmsr r3
|
||||
mtspr SRR1, r3 /* Make SRR1 match MSR */
|
||||
|
||||
/* Initialize debug port registers */
|
||||
/*----------------------------------------------------------------------*/
|
||||
xor r0, r0, r0 /* Clear R0 */
|
||||
mtspr LCTRL1, r0 /* Initialize debug port regs */
|
||||
mtspr LCTRL2, r0
|
||||
mtspr COUNTA, r0
|
||||
mtspr COUNTB, r0
|
||||
|
||||
/*
|
||||
* Calculate absolute address in FLASH and jump there
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
lis r3, CFG_MONITOR_BASE@h
|
||||
ori r3, r3, CFG_MONITOR_BASE@l
|
||||
addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
|
||||
mtlr r3
|
||||
blr
|
||||
|
||||
in_flash:
|
||||
|
||||
/* Initialize some SPRs that are hard to access from C */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
lis r3, CFG_IMMR@h /* Pass IMMR as arg1 to C routine */
|
||||
lis r2, CFG_INIT_SP_ADDR@h
|
||||
ori r1, r2, CFG_INIT_SP_ADDR@l /* Set up the stack in internal SRAM */
|
||||
/* Note: R0 is still 0 here */
|
||||
stwu r0, -4(r1) /* Clear final stack frame so that */
|
||||
stwu r0, -4(r1) /* stack backtraces terminate cleanly */
|
||||
|
||||
/*
|
||||
* Disable serialized ifetch and show cycles
|
||||
* (i.e. set processor to normal mode) for maximum
|
||||
* performance.
|
||||
*/
|
||||
|
||||
li r2, 0x0007
|
||||
mtspr ICTRL, r2
|
||||
|
||||
/* Set up debug mode entry */
|
||||
|
||||
lis r2, CFG_DER@h
|
||||
ori r2, r2, CFG_DER@l
|
||||
mtspr DER, r2
|
||||
|
||||
/* Let the C-code set up the rest */
|
||||
/* */
|
||||
/* Be careful to keep code relocatable ! */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
GET_GOT /* initialize GOT access */
|
||||
|
||||
/* r3: IMMR */
|
||||
bl cpu_init_f /* run low-level CPU init code (from Flash) */
|
||||
|
||||
mr r3, r21
|
||||
/* r3: BOOTFLAG */
|
||||
bl board_init_f /* run 1st part of board init code (from Flash) */
|
||||
|
||||
|
||||
|
||||
.globl _start_of_vectors
|
||||
_start_of_vectors:
|
||||
|
||||
/* Machine check */
|
||||
STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
|
||||
|
||||
/* Data Storage exception. "Never" generated on the 860. */
|
||||
STD_EXCEPTION(0x300, DataStorage, UnknownException)
|
||||
|
||||
/* Instruction Storage exception. "Never" generated on the 860. */
|
||||
STD_EXCEPTION(0x400, InstStorage, UnknownException)
|
||||
|
||||
/* External Interrupt exception. */
|
||||
STD_EXCEPTION(0x500, ExtInterrupt, external_interrupt)
|
||||
|
||||
/* Alignment exception. */
|
||||
. = 0x600
|
||||
Alignment:
|
||||
EXCEPTION_PROLOG
|
||||
mfspr r4,DAR
|
||||
stw r4,_DAR(r21)
|
||||
mfspr r5,DSISR
|
||||
stw r5,_DSISR(r21)
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
li r20,MSR_KERNEL
|
||||
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
|
||||
lwz r6,GOT(transfer_to_handler)
|
||||
mtlr r6
|
||||
blrl
|
||||
.L_Alignment:
|
||||
.long AlignmentException - _start + EXC_OFF_SYS_RESET
|
||||
.long int_return - _start + EXC_OFF_SYS_RESET
|
||||
|
||||
/* Program check exception */
|
||||
. = 0x700
|
||||
ProgramCheck:
|
||||
EXCEPTION_PROLOG
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
li r20,MSR_KERNEL
|
||||
rlwimi r20,r23,0,16,16 /* copy EE bit from saved MSR */
|
||||
lwz r6,GOT(transfer_to_handler)
|
||||
mtlr r6
|
||||
blrl
|
||||
.L_ProgramCheck:
|
||||
.long ProgramCheckException - _start + EXC_OFF_SYS_RESET
|
||||
.long int_return - _start + EXC_OFF_SYS_RESET
|
||||
|
||||
/* FPU on MPC5xx available. We will use it later.
|
||||
*/
|
||||
STD_EXCEPTION(0x800, FPUnavailable, UnknownException)
|
||||
|
||||
/* I guess we could implement decrementer, and may have
|
||||
* to someday for timekeeping.
|
||||
*/
|
||||
STD_EXCEPTION(0x900, Decrementer, timer_interrupt)
|
||||
STD_EXCEPTION(0xa00, Trap_0a, UnknownException)
|
||||
STD_EXCEPTION(0xb00, Trap_0b, UnknownException)
|
||||
|
||||
. = 0xc00
|
||||
/*
|
||||
* r0 - SYSCALL number
|
||||
* r3-... arguments
|
||||
*/
|
||||
SystemCall:
|
||||
addis r11,r0,0 /* get functions table addr */
|
||||
ori r11,r11,0 /* Note: this code is patched in trap_init */
|
||||
addis r12,r0,0 /* get number of functions */
|
||||
ori r12,r12,0
|
||||
|
||||
cmplw 0, r0, r12
|
||||
bge 1f
|
||||
|
||||
rlwinm r0,r0,2,0,31 /* fn_addr = fn_tbl[r0] */
|
||||
add r11,r11,r0
|
||||
lwz r11,0(r11)
|
||||
|
||||
li r20,0xd00-4 /* Get stack pointer */
|
||||
lwz r12,0(r20)
|
||||
subi r12,r12,12 /* Adjust stack pointer */
|
||||
li r0,0xc00+_end_back-SystemCall
|
||||
cmplw 0, r0, r12 /* Check stack overflow */
|
||||
bgt 1f
|
||||
stw r12,0(r20)
|
||||
|
||||
mflr r0
|
||||
stw r0,0(r12)
|
||||
mfspr r0,SRR0
|
||||
stw r0,4(r12)
|
||||
mfspr r0,SRR1
|
||||
stw r0,8(r12)
|
||||
|
||||
li r12,0xc00+_back-SystemCall
|
||||
mtlr r12
|
||||
mtspr SRR0,r11
|
||||
|
||||
1: SYNC
|
||||
rfi
|
||||
|
||||
_back:
|
||||
|
||||
mfmsr r11 /* Disable interrupts */
|
||||
li r12,0
|
||||
ori r12,r12,MSR_EE
|
||||
andc r11,r11,r12
|
||||
SYNC /* Some chip revs need this... */
|
||||
mtmsr r11
|
||||
SYNC
|
||||
|
||||
li r12,0xd00-4 /* restore regs */
|
||||
lwz r12,0(r12)
|
||||
|
||||
lwz r11,0(r12)
|
||||
mtlr r11
|
||||
lwz r11,4(r12)
|
||||
mtspr SRR0,r11
|
||||
lwz r11,8(r12)
|
||||
mtspr SRR1,r11
|
||||
|
||||
addi r12,r12,12 /* Adjust stack pointer */
|
||||
li r20,0xd00-4
|
||||
stw r12,0(r20)
|
||||
|
||||
SYNC
|
||||
rfi
|
||||
_end_back:
|
||||
|
||||
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
|
||||
STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
|
||||
|
||||
/* On the MPC8xx, this is a software emulation interrupt. It occurs
|
||||
* for all unimplemented and illegal instructions.
|
||||
*/
|
||||
STD_EXCEPTION(0x1000, SoftEmu, SoftEmuException)
|
||||
STD_EXCEPTION(0x1100, InstructionTLBMiss, UnknownException)
|
||||
STD_EXCEPTION(0x1200, DataTLBMiss, UnknownException)
|
||||
STD_EXCEPTION(0x1300, InstructionTLBError, UnknownException)
|
||||
STD_EXCEPTION(0x1400, DataTLBError, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0x1500, Reserved5, UnknownException)
|
||||
STD_EXCEPTION(0x1600, Reserved6, UnknownException)
|
||||
STD_EXCEPTION(0x1700, Reserved7, UnknownException)
|
||||
STD_EXCEPTION(0x1800, Reserved8, UnknownException)
|
||||
STD_EXCEPTION(0x1900, Reserved9, UnknownException)
|
||||
STD_EXCEPTION(0x1a00, ReservedA, UnknownException)
|
||||
STD_EXCEPTION(0x1b00, ReservedB, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0x1c00, DataBreakpoint, UnknownException)
|
||||
STD_EXCEPTION(0x1d00, InstructionBreakpoint, DebugException)
|
||||
STD_EXCEPTION(0x1e00, PeripheralBreakpoint, UnknownException)
|
||||
STD_EXCEPTION(0x1f00, DevPortBreakpoint, UnknownException)
|
||||
|
||||
|
||||
.globl _end_of_vectors
|
||||
_end_of_vectors:
|
||||
|
||||
|
||||
. = 0x2000
|
||||
|
||||
/*
|
||||
* This code finishes saving the registers to the exception frame
|
||||
* and jumps to the appropriate handler for the exception.
|
||||
* Register r21 is pointer into trap frame, r1 has new stack pointer.
|
||||
*/
|
||||
.globl transfer_to_handler
|
||||
transfer_to_handler:
|
||||
stw r22,_NIP(r21)
|
||||
lis r22,MSR_POW@h
|
||||
andc r23,r23,r22
|
||||
stw r23,_MSR(r21)
|
||||
SAVE_GPR(7, r21)
|
||||
SAVE_4GPRS(8, r21)
|
||||
SAVE_8GPRS(12, r21)
|
||||
SAVE_8GPRS(24, r21)
|
||||
mflr r23
|
||||
andi. r24,r23,0x3f00 /* get vector offset */
|
||||
stw r24,TRAP(r21)
|
||||
li r22,0
|
||||
stw r22,RESULT(r21)
|
||||
mtspr SPRG2,r22 /* r1 is now kernel sp */
|
||||
lwz r24,0(r23) /* virtual address of handler */
|
||||
lwz r23,4(r23) /* where to go when done */
|
||||
mtspr SRR0,r24
|
||||
mtspr SRR1,r20
|
||||
mtlr r23
|
||||
SYNC
|
||||
rfi /* jump to handler, enable MMU */
|
||||
|
||||
int_return:
|
||||
mfmsr r28 /* Disable interrupts */
|
||||
li r4,0
|
||||
ori r4,r4,MSR_EE
|
||||
andc r28,r28,r4
|
||||
SYNC /* Some chip revs need this... */
|
||||
mtmsr r28
|
||||
SYNC
|
||||
lwz r2,_CTR(r1)
|
||||
lwz r0,_LINK(r1)
|
||||
mtctr r2
|
||||
mtlr r0
|
||||
lwz r2,_XER(r1)
|
||||
lwz r0,_CCR(r1)
|
||||
mtspr XER,r2
|
||||
mtcrf 0xFF,r0
|
||||
REST_10GPRS(3, r1)
|
||||
REST_10GPRS(13, r1)
|
||||
REST_8GPRS(23, r1)
|
||||
REST_GPR(31, r1)
|
||||
lwz r2,_NIP(r1) /* Restore environment */
|
||||
lwz r0,_MSR(r1)
|
||||
mtspr SRR0,r2
|
||||
mtspr SRR1,r0
|
||||
lwz r0,GPR0(r1)
|
||||
lwz r2,GPR2(r1)
|
||||
lwz r1,GPR1(r1)
|
||||
SYNC
|
||||
rfi
|
||||
|
||||
|
||||
/*
|
||||
* unsigned int get_immr (unsigned int mask)
|
||||
*
|
||||
* return (mask ? (IMMR & mask) : IMMR);
|
||||
*/
|
||||
.globl get_immr
|
||||
get_immr:
|
||||
mr r4,r3 /* save mask */
|
||||
mfspr r3, IMMR /* IMMR */
|
||||
cmpwi 0,r4,0 /* mask != 0 ? */
|
||||
beq 4f
|
||||
and r3,r3,r4 /* IMMR & mask */
|
||||
4:
|
||||
blr
|
||||
|
||||
.globl get_pvr
|
||||
get_pvr:
|
||||
mfspr r3, PVR
|
||||
blr
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* void relocate_code (addr_sp, gd, addr_moni)
|
||||
*
|
||||
* This "function" does not return, instead it continues in RAM
|
||||
* after relocating the monitor code.
|
||||
*
|
||||
* r3 = dest
|
||||
* r4 = src
|
||||
* r5 = length in bytes
|
||||
* r6 = cachelinesize
|
||||
*/
|
||||
.globl relocate_code
|
||||
relocate_code:
|
||||
mr r1, r3 /* Set new stack pointer in SRAM */
|
||||
mr r9, r4 /* Save copy of global data pointer in SRAM */
|
||||
mr r10, r5 /* Save copy of monitor destination Address in SRAM */
|
||||
|
||||
mr r3, r5 /* Destination Address */
|
||||
lis r4, CFG_MONITOR_BASE@h /* Source Address */
|
||||
ori r4, r4, CFG_MONITOR_BASE@l
|
||||
lis r5, CFG_MONITOR_LEN@h /* Length in Bytes */
|
||||
ori r5, r5, CFG_MONITOR_LEN@l
|
||||
|
||||
/*
|
||||
* Fix GOT pointer:
|
||||
*
|
||||
* New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address
|
||||
*
|
||||
* Offset:
|
||||
*/
|
||||
sub r15, r10, r4
|
||||
|
||||
/* First our own GOT */
|
||||
add r14, r14, r15
|
||||
/* the the one used by the C code */
|
||||
add r30, r30, r15
|
||||
|
||||
/*
|
||||
* Now relocate code
|
||||
*/
|
||||
|
||||
cmplw cr1,r3,r4
|
||||
addi r0,r5,3
|
||||
srwi. r0,r0,2
|
||||
beq cr1,4f /* In place copy is not necessary */
|
||||
beq 4f /* Protect against 0 count */
|
||||
mtctr r0
|
||||
bge cr1,2f
|
||||
|
||||
la r8,-4(r4)
|
||||
la r7,-4(r3)
|
||||
1: lwzu r0,4(r8)
|
||||
stwu r0,4(r7)
|
||||
bdnz 1b
|
||||
b 4f
|
||||
|
||||
2: slwi r0,r0,2
|
||||
add r8,r4,r0
|
||||
add r7,r3,r0
|
||||
3: lwzu r0,-4(r8)
|
||||
stwu r0,-4(r7)
|
||||
bdnz 3b
|
||||
|
||||
4: sync
|
||||
isync
|
||||
|
||||
/*
|
||||
* We are done. Do not return, instead branch to second part of board
|
||||
* initialization, now running from RAM.
|
||||
*/
|
||||
|
||||
addi r0, r10, in_ram - _start + EXC_OFF_SYS_RESET
|
||||
mtlr r0
|
||||
blr
|
||||
|
||||
in_ram:
|
||||
|
||||
/*
|
||||
* Relocation Function, r14 point to got2+0x8000
|
||||
*
|
||||
* Adjust got2 pointers, no need to check for 0, this code
|
||||
* already puts a few entries in the table.
|
||||
*/
|
||||
li r0,__got2_entries@sectoff@l
|
||||
la r3,GOT(_GOT2_TABLE_)
|
||||
lwz r11,GOT(_GOT2_TABLE_)
|
||||
mtctr r0
|
||||
sub r11,r3,r11
|
||||
addi r3,r3,-4
|
||||
1: lwzu r0,4(r3)
|
||||
add r0,r0,r11
|
||||
stw r0,0(r3)
|
||||
bdnz 1b
|
||||
|
||||
/*
|
||||
* Now adjust the fixups and the pointers to the fixups
|
||||
* in case we need to move ourselves again.
|
||||
*/
|
||||
2: li r0,__fixup_entries@sectoff@l
|
||||
lwz r3,GOT(_FIXUP_TABLE_)
|
||||
cmpwi r0,0
|
||||
mtctr r0
|
||||
addi r3,r3,-4
|
||||
beq 4f
|
||||
3: lwzu r4,4(r3)
|
||||
lwzux r0,r4,r11
|
||||
add r0,r0,r11
|
||||
stw r10,0(r3)
|
||||
stw r0,0(r4)
|
||||
bdnz 3b
|
||||
4:
|
||||
clear_bss:
|
||||
/*
|
||||
* Now clear BSS segment
|
||||
*/
|
||||
lwz r3,GOT(.bss)
|
||||
lwz r4,GOT(_end)
|
||||
cmplw 0, r3, r4
|
||||
beq 6f
|
||||
|
||||
li r0, 0
|
||||
5:
|
||||
stw r0, 0(r3)
|
||||
addi r3, r3, 4
|
||||
cmplw 0, r3, r4
|
||||
bne 5b
|
||||
6:
|
||||
|
||||
mr r3, r9 /* Global Data pointer */
|
||||
mr r4, r10 /* Destination Address */
|
||||
bl board_init_r
|
||||
|
||||
/* Problems accessing "end" in C, so do it here */
|
||||
.globl get_endaddr
|
||||
get_endaddr:
|
||||
lwz r3,GOT(_end)
|
||||
blr
|
||||
|
||||
/*
|
||||
* Copy exception vector code to low memory
|
||||
*
|
||||
* r3: dest_addr
|
||||
* r7: source address, r8: end address, r9: target address
|
||||
*/
|
||||
.globl trap_init
|
||||
trap_init:
|
||||
lwz r7, GOT(_start)
|
||||
lwz r8, GOT(_end_of_vectors)
|
||||
|
||||
rlwinm r9, r7, 0, 22, 31 /* _start & 0x3FF */
|
||||
|
||||
cmplw 0, r7, r8
|
||||
bgelr /* return if r7>=r8 - just in case */
|
||||
|
||||
mflr r4 /* save link register */
|
||||
1:
|
||||
lwz r0, 0(r7)
|
||||
stw r0, 0(r9)
|
||||
addi r7, r7, 4
|
||||
addi r9, r9, 4
|
||||
cmplw 0, r7, r8
|
||||
bne 1b
|
||||
|
||||
/*
|
||||
* relocate `hdlr' and `int_return' entries
|
||||
*/
|
||||
li r7, .L_MachineCheck - _start + EXC_OFF_SYS_RESET
|
||||
li r8, Alignment - _start + EXC_OFF_SYS_RESET
|
||||
2:
|
||||
bl trap_reloc
|
||||
addi r7, r7, 0x100 /* next exception vector */
|
||||
cmplw 0, r7, r8
|
||||
blt 2b
|
||||
|
||||
li r7, .L_Alignment - _start + EXC_OFF_SYS_RESET
|
||||
bl trap_reloc
|
||||
|
||||
li r7, .L_ProgramCheck - _start + EXC_OFF_SYS_RESET
|
||||
bl trap_reloc
|
||||
|
||||
li r7, .L_FPUnavailable - _start + EXC_OFF_SYS_RESET
|
||||
li r8, SystemCall - _start + EXC_OFF_SYS_RESET
|
||||
3:
|
||||
bl trap_reloc
|
||||
addi r7, r7, 0x100 /* next exception vector */
|
||||
cmplw 0, r7, r8
|
||||
blt 3b
|
||||
|
||||
li r7, .L_SingleStep - _start + EXC_OFF_SYS_RESET
|
||||
li r8, _end_of_vectors - _start + EXC_OFF_SYS_RESET
|
||||
4:
|
||||
bl trap_reloc
|
||||
addi r7, r7, 0x100 /* next exception vector */
|
||||
cmplw 0, r7, r8
|
||||
blt 4b
|
||||
|
||||
mtlr r4 /* restore link register */
|
||||
blr
|
||||
|
||||
/*
|
||||
* Function: relocate entries for one exception vector
|
||||
*/
|
||||
trap_reloc:
|
||||
lwz r0, 0(r7) /* hdlr ... */
|
||||
add r0, r0, r3 /* ... += dest_addr */
|
||||
stw r0, 0(r7)
|
||||
|
||||
lwz r0, 4(r7) /* int_return ... */
|
||||
add r0, r0, r3 /* ... += dest_addr */
|
||||
stw r0, 4(r7)
|
||||
|
||||
sync
|
||||
isync
|
||||
|
||||
blr
|
||||
161
cpu/mpc5xx/status_led.c
Normal file
161
cpu/mpc5xx/status_led.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002 Wolfgang Denk, DENX Software Engineering, wd@denx.de
|
||||
* (C) Copyright 2003 Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: status_led.c
|
||||
*
|
||||
* Discription: Blink a board led to show boot progress. Led's
|
||||
* are connected via the MIOS module.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xx.h>
|
||||
#include <status_led.h>
|
||||
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
|
||||
typedef struct {
|
||||
ulong mask;
|
||||
int state;
|
||||
int period;
|
||||
int cnt;
|
||||
} led_dev_t;
|
||||
|
||||
led_dev_t led_dev[] = {
|
||||
{ STATUS_LED_BIT,
|
||||
STATUS_LED_STATE,
|
||||
STATUS_LED_PERIOD,
|
||||
0,
|
||||
},
|
||||
#if defined(STATUS_LED_BIT1)
|
||||
{ STATUS_LED_BIT1,
|
||||
STATUS_LED_STATE1,
|
||||
STATUS_LED_PERIOD1,
|
||||
0,
|
||||
},
|
||||
#endif
|
||||
#if defined(STATUS_LED_BIT2)
|
||||
{ STATUS_LED_BIT2,
|
||||
STATUS_LED_STATE2,
|
||||
STATUS_LED_PERIOD2,
|
||||
0,
|
||||
},
|
||||
#endif
|
||||
#if defined(STATUS_LED_BIT3)
|
||||
{ STATUS_LED_BIT3,
|
||||
STATUS_LED_STATE3,
|
||||
STATUS_LED_PERIOD3,
|
||||
0,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MAX_LED_DEV (sizeof(led_dev)/sizeof(led_dev_t))
|
||||
|
||||
static int status_led_init_done = 0;
|
||||
|
||||
static void status_led_init (void)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_LED_DEV; ++i) {
|
||||
led_dev_t *ld = &led_dev[i];
|
||||
|
||||
immr->STATUS_LED_DIR = STATUS_LED_BIT;
|
||||
|
||||
#if (STATUS_LED_ACTIVE == 0)
|
||||
if (ld->state == STATUS_LED_ON)
|
||||
immr->STATUS_LED_DAT &= ~(ld->mask);
|
||||
else
|
||||
immr->STATUS_LED_DAT |= ld->mask ;
|
||||
#else
|
||||
if (ld->state == STATUS_LED_ON)
|
||||
immr->STATUS_LED_DAT |= ld->mask ;
|
||||
else
|
||||
immr->STATUS_LED_DAT &= ~(ld->mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
status_led_init_done = 1;
|
||||
}
|
||||
|
||||
void status_led_tick (ulong timestamp)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
int i;
|
||||
|
||||
if (!status_led_init_done)
|
||||
status_led_init();
|
||||
|
||||
for (i=0; i<MAX_LED_DEV; ++i) {
|
||||
led_dev_t *ld = &led_dev[i];
|
||||
|
||||
if (ld->state != STATUS_LED_BLINKING)
|
||||
continue;
|
||||
|
||||
if (++(ld->cnt) >= ld->period) {
|
||||
immr->STATUS_LED_DAT ^= ld->mask;
|
||||
ld->cnt -= ld->period;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void status_led_set (int led, int state)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
led_dev_t *ld;
|
||||
|
||||
if (led < 0 || led >= MAX_LED_DEV)
|
||||
return;
|
||||
|
||||
if (!status_led_init_done)
|
||||
status_led_init();
|
||||
|
||||
ld = &led_dev[led];
|
||||
|
||||
switch (state) {
|
||||
default:
|
||||
return;
|
||||
case STATUS_LED_BLINKING:
|
||||
ld->cnt = 0; /* always start with full period */
|
||||
/* fall through */ /* always start with LED _ON_ */
|
||||
case STATUS_LED_ON:
|
||||
#if (STATUS_LED_ACTIVE == 0)
|
||||
immr->STATUS_LED_DAT &= ~(ld->mask);
|
||||
#else
|
||||
immr->STATUS_LED_DAT |= ld->mask ;
|
||||
#endif
|
||||
break;
|
||||
case STATUS_LED_OFF:
|
||||
#if (STATUS_LED_ACTIVE == 0)
|
||||
immr->STATUS_LED_DAT |= ld->mask ;
|
||||
#else
|
||||
immr->STATUS_LED_DAT &= ~(ld->mask);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
ld->state = state;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
231
cpu/mpc5xx/traps.c
Normal file
231
cpu/mpc5xx/traps.c
Normal file
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* linux/arch/ppc/kernel/traps.c
|
||||
*
|
||||
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
|
||||
*
|
||||
* Modified by Cort Dougan (cort@cs.nmt.edu)
|
||||
* and Paul Mackerras (paulus@cs.anu.edu.au)
|
||||
*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file handles the architecture-dependent parts of hardware exceptions
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
int (*debugger_exception_handler)(struct pt_regs *) = 0;
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
|
||||
extern void do_bedbug_breakpoint(struct pt_regs *);
|
||||
#endif
|
||||
|
||||
/* Returns 0 if exception not found and fixup otherwise. */
|
||||
extern unsigned long search_exception_table(unsigned long);
|
||||
|
||||
/* THIS NEEDS CHANGING to use the board info structure.
|
||||
*/
|
||||
#define END_OF_MEM 0x0001000
|
||||
|
||||
|
||||
/*
|
||||
* Print stack backtrace
|
||||
*/
|
||||
void print_backtrace(unsigned long *sp)
|
||||
{
|
||||
int cnt = 0;
|
||||
unsigned long i;
|
||||
|
||||
printf("Call backtrace: ");
|
||||
while (sp) {
|
||||
if ((uint)sp > END_OF_MEM)
|
||||
break;
|
||||
|
||||
i = sp[1];
|
||||
if (cnt++ % 7 == 0)
|
||||
printf("\n");
|
||||
printf("%08lX ", i);
|
||||
if (cnt > 32) break;
|
||||
sp = (unsigned long *)*sp;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Print current registers
|
||||
*/
|
||||
void show_regs(struct pt_regs * regs)
|
||||
{
|
||||
int i;
|
||||
printf("NIP: %08lX XER: %08lX LR: %08lX REGS: %p TRAP: %04lx DAR: %08lX\n",
|
||||
regs->nip, regs->xer, regs->link, regs, regs->trap, regs->dar);
|
||||
printf("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
|
||||
regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
|
||||
regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
|
||||
regs->msr&MSR_IR ? 1 : 0,
|
||||
regs->msr&MSR_DR ? 1 : 0);
|
||||
|
||||
printf("\n");
|
||||
for (i = 0; i < 32; i++) {
|
||||
if ((i % 8) == 0)
|
||||
{
|
||||
printf("GPR%02d: ", i);
|
||||
}
|
||||
|
||||
printf("%08lX ", regs->gpr[i]);
|
||||
if ((i % 8) == 7)
|
||||
{
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* General exception handler routine
|
||||
*/
|
||||
void _exception(int signr, struct pt_regs *regs)
|
||||
{
|
||||
show_regs(regs);
|
||||
print_backtrace((unsigned long *)regs->gpr[1]);
|
||||
panic("Exception in kernel pc %lx signal %d",regs->nip,signr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine check exception handler routine
|
||||
*/
|
||||
void MachineCheckException(struct pt_regs *regs)
|
||||
{
|
||||
unsigned long fixup;
|
||||
|
||||
/* Probing PCI using config cycles cause this exception
|
||||
* when a device is not present. Catch it and return to
|
||||
* the PCI exception handler.
|
||||
*/
|
||||
if ((fixup = search_exception_table(regs->nip)) != 0) {
|
||||
regs->nip = fixup;
|
||||
return;
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
if (debugger_exception_handler && (*debugger_exception_handler)(regs))
|
||||
return;
|
||||
#endif
|
||||
|
||||
printf("Machine check in kernel mode.\n");
|
||||
printf("Caused by (from msr): ");
|
||||
printf("regs %p ",regs);
|
||||
switch( regs->msr & 0x0000F000)
|
||||
{
|
||||
case (1<<12) :
|
||||
printf("Machine check signal\n");
|
||||
break;
|
||||
case (1<<13) :
|
||||
printf("Transfer error ack signal\n");
|
||||
break;
|
||||
case (1<<14) :
|
||||
printf("Data parity signal\n");
|
||||
break;
|
||||
case (1<<15) :
|
||||
printf("Address parity signal\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown values in msr\n");
|
||||
}
|
||||
show_regs(regs);
|
||||
print_backtrace((unsigned long *)regs->gpr[1]);
|
||||
panic("machine check");
|
||||
}
|
||||
|
||||
/*
|
||||
* Alignment exception handler routine
|
||||
*/
|
||||
void AlignmentException(struct pt_regs *regs)
|
||||
{
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
if (debugger_exception_handler && (*debugger_exception_handler)(regs))
|
||||
return;
|
||||
#endif
|
||||
show_regs(regs);
|
||||
print_backtrace((unsigned long *)regs->gpr[1]);
|
||||
panic("Alignment Exception");
|
||||
}
|
||||
|
||||
/*
|
||||
* Program check exception handler routine
|
||||
*/
|
||||
void ProgramCheckException(struct pt_regs *regs)
|
||||
{
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
if (debugger_exception_handler && (*debugger_exception_handler)(regs))
|
||||
return;
|
||||
#endif
|
||||
show_regs(regs);
|
||||
print_backtrace((unsigned long *)regs->gpr[1]);
|
||||
panic("Program Check Exception");
|
||||
}
|
||||
|
||||
/*
|
||||
* Software emulation exception handler routine
|
||||
*/
|
||||
void SoftEmuException(struct pt_regs *regs)
|
||||
{
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
if (debugger_exception_handler && (*debugger_exception_handler)(regs))
|
||||
return;
|
||||
#endif
|
||||
show_regs(regs);
|
||||
print_backtrace((unsigned long *)regs->gpr[1]);
|
||||
panic("Software Emulation Exception");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Unknown exception handler routine
|
||||
*/
|
||||
void UnknownException(struct pt_regs *regs)
|
||||
{
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
if (debugger_exception_handler && (*debugger_exception_handler)(regs))
|
||||
return;
|
||||
#endif
|
||||
printf("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
|
||||
regs->nip, regs->msr, regs->trap);
|
||||
_exception(0, regs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Debug exception handler routine
|
||||
*/
|
||||
void DebugException(struct pt_regs *regs)
|
||||
{
|
||||
printf("Debugger trap at @ %lx\n", regs->nip );
|
||||
show_regs(regs);
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
|
||||
do_bedbug_breakpoint( regs );
|
||||
#endif
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <bedbug/regs.h>
|
||||
#include <bedbug/ppc.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) && defined(CONFIG_MPC860)
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG) && defined(CONFIG_8xx)
|
||||
|
||||
#define MAX_BREAK_POINTS 2
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ static char *cpu_warning = "\n " \
|
||||
|
||||
#if ((defined(CONFIG_MPC860) || defined(CONFIG_MPC855)) && \
|
||||
!defined(CONFIG_MPC862))
|
||||
# ifdef CONFIG_MPC855
|
||||
# ifdef CONFIG_MPC855
|
||||
# define ID_STR "PC855"
|
||||
# else
|
||||
# define ID_STR "PC860"
|
||||
|
||||
@@ -177,6 +177,8 @@ static vidinfo_t panel_info = {
|
||||
/*
|
||||
* Sharp LQ057Q3DC02 display. Active, color, single scan.
|
||||
*/
|
||||
#define LCD_DF 12
|
||||
|
||||
static vidinfo_t panel_info = {
|
||||
320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
|
||||
3, 0, 0, 1, 1, 15, 4, 0, 3
|
||||
@@ -260,11 +262,11 @@ static vidinfo_t panel_info = {
|
||||
* Emerging Display Technologies 320x240. Passive, monochrome, single scan.
|
||||
*/
|
||||
#define LCD_BPP LCD_MONOCHROME
|
||||
#define LCD_DF 20
|
||||
#define LCD_DF 10
|
||||
|
||||
static vidinfo_t panel_info = {
|
||||
320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
|
||||
LCD_BPP, 0, 0, 0, 0, 0, 15, 0, 0
|
||||
LCD_BPP, 0, 0, 0, 0, 33, 0, 0, 0
|
||||
};
|
||||
#endif
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -977,15 +979,18 @@ static void lcd_enable (void)
|
||||
c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
|
||||
pic_write (0x60, c);
|
||||
}
|
||||
#elif defined(CONFIG_R360MPI)
|
||||
{
|
||||
extern void r360_pwm_write (uchar reg, uchar val);
|
||||
|
||||
r360_pwm_write(8, 1);
|
||||
r360_pwm_write(0, 4);
|
||||
r360_pwm_write(1, 6);
|
||||
}
|
||||
#endif /* CONFIG_LWMON */
|
||||
|
||||
#if defined(CONFIG_R360MPI)
|
||||
{
|
||||
extern void r360_i2c_lcd_write (uchar data0, uchar data1);
|
||||
|
||||
r360_i2c_lcd_write(0x10, 0x01);
|
||||
r360_i2c_lcd_write(0x20, 0x01);
|
||||
r360_i2c_lcd_write(0x3F, 0xFF);
|
||||
r360_i2c_lcd_write(0x47, 0xFF);
|
||||
}
|
||||
#endif /* CONFIG_R360MPI */
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -1003,10 +1008,12 @@ static void lcd_disable (void)
|
||||
}
|
||||
#elif defined(CONFIG_R360MPI)
|
||||
{
|
||||
extern void r360_pwm_write (uchar reg, uchar val);
|
||||
extern void r360_i2c_lcd_write (uchar data0, uchar data1);
|
||||
|
||||
r360_pwm_write(0, 0);
|
||||
r360_pwm_write(1, 0);
|
||||
r360_i2c_lcd_write(0x10, 0x00);
|
||||
r360_i2c_lcd_write(0x20, 0x00);
|
||||
r360_i2c_lcd_write(0x30, 0x00);
|
||||
r360_i2c_lcd_write(0x40, 0x00);
|
||||
}
|
||||
#endif /* CONFIG_LWMON */
|
||||
/* Disable the LCD panel */
|
||||
|
||||
@@ -67,7 +67,7 @@ int checkcpu (void)
|
||||
|
||||
#if CONFIG_405GP
|
||||
puts("IBM PowerPC 405GP");
|
||||
if (pvr == PVR_405GPR_RA) {
|
||||
if (pvr == PVR_405GPR_RB) {
|
||||
putc('r');
|
||||
}
|
||||
puts(" Rev. ");
|
||||
@@ -77,6 +77,7 @@ int checkcpu (void)
|
||||
#endif
|
||||
switch (pvr) {
|
||||
case PVR_405GP_RB:
|
||||
case PVR_405GPR_RB:
|
||||
putc('B');
|
||||
break;
|
||||
case PVR_405GP_RC:
|
||||
@@ -94,7 +95,6 @@ int checkcpu (void)
|
||||
break;
|
||||
#endif
|
||||
case PVR_405CR_RA:
|
||||
case PVR_405GPR_RA:
|
||||
putc('A');
|
||||
break;
|
||||
case PVR_405CR_RB:
|
||||
@@ -122,7 +122,7 @@ int checkcpu (void)
|
||||
printf("external PCI arbiter enabled\n");
|
||||
#endif
|
||||
|
||||
if ((pvr | 0x00000001) == PVR_405GPR_RA) {
|
||||
if ((pvr | 0x00000001) == PVR_405GPR_RB) {
|
||||
printf(" 16 kB I-Cache 16 kB D-Cache");
|
||||
} else {
|
||||
printf(" 16 kB I-Cache 8 kB D-Cache");
|
||||
|
||||
@@ -149,7 +149,7 @@ int cpu_init_r (void)
|
||||
* Set edge conditioning circuitry on PPC405GPr
|
||||
* for compatibility to existing PPC405GP designs.
|
||||
*/
|
||||
if ((pvr & 0xfffffff0) == (PVR_405GPR_RA & 0xfffffff0)) {
|
||||
if ((pvr & 0xfffffff0) == (PVR_405GPR_RB & 0xfffffff0)) {
|
||||
mtdcr(ecr, 0x60606000);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ void get_sys_info (PPC405_SYS_INFO * sysInfo)
|
||||
/*
|
||||
* Check if PPC405GPr used (mask minor revision field)
|
||||
*/
|
||||
if ((pvr & 0xfffffff0) == (PVR_405GPR_RA & 0xfffffff0)) {
|
||||
if ((pvr & 0xfffffff0) == (PVR_405GPR_RB & 0xfffffff0)) {
|
||||
/*
|
||||
* Determine FWD_DIV B (only PPC405GPr with new mode strapping).
|
||||
*/
|
||||
|
||||
@@ -67,7 +67,21 @@ void serial_setbrg (void)
|
||||
|
||||
FFIER = IER_UUE; /* Enable FFUART */
|
||||
|
||||
#elif CONFIG_STUART
|
||||
#elif defined(CONFIG_BTUART)
|
||||
CKEN |= CKEN7_BTUART;
|
||||
|
||||
BTIER = 0;
|
||||
BTFCR = 0;
|
||||
|
||||
/* set baud rate */
|
||||
BTLCR = LCR_DLAB;
|
||||
BTDLL = quot & 0xff;
|
||||
BTDLH = quot >> 8;
|
||||
BTLCR = LCR_WLS0 | LCR_WLS1;
|
||||
|
||||
BTIER = IER_UUE; /* Enable BFUART */
|
||||
|
||||
#elif defined(CONFIG_STUART)
|
||||
#error "Bad: not implemented yet!"
|
||||
#else
|
||||
#error "Bad: you didn't configured serial ..."
|
||||
@@ -98,7 +112,10 @@ void serial_putc (const char c)
|
||||
while ((FFLSR & LSR_TEMT) == 0);
|
||||
|
||||
FFTHR = c;
|
||||
#elif CONFIG_STUART
|
||||
#elif defined(CONFIG_BTUART)
|
||||
while ((BTLSR & LSR_TEMT ) == 0 );
|
||||
BTTHR = c;
|
||||
#elif defined(CONFIG_STUART)
|
||||
#endif
|
||||
|
||||
/* If \n, also do \r */
|
||||
@@ -115,7 +132,9 @@ int serial_tstc (void)
|
||||
{
|
||||
#ifdef CONFIG_FFUART
|
||||
return FFLSR & LSR_DR;
|
||||
#elif CONFIG_STUART
|
||||
#elif defined(CONFIG_BTUART)
|
||||
return BTLSR & LSR_DR;
|
||||
#elif defined(CONFIG_STUART)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -130,7 +149,11 @@ int serial_getc (void)
|
||||
while (!(FFLSR & LSR_DR));
|
||||
|
||||
return (char) FFRBR & 0xff;
|
||||
#elif CONFIG_STUART
|
||||
#elif defined(CONFIG_BTUART)
|
||||
while (!(BTLSR & LSR_DR));
|
||||
|
||||
return (char) BTRBR & 0xff;
|
||||
#elif defined(CONFIG_STUART)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,13 @@ Notes
|
||||
!!!THIS IS AN UNDOCUMENTED I2C BUS BUG, NOT A IBM 4xx BUG!!!
|
||||
|
||||
This reset edge condition could possibly be present in every I2C
|
||||
controller and device available. We should probably have a bus reset
|
||||
function for all our target CPUs.
|
||||
controller and device available. For boards where a I2C bus reset
|
||||
function can be implemented a i2c_init_board() function should be
|
||||
provided and enabled by #define'ing CFG_I2C_INIT_BOARD in your
|
||||
board's config file. Note that this is NOT necessary when using the
|
||||
bit-banging I2C driver (common/soft_i2c.c) as this already includes
|
||||
the I2C bus reset sequence.
|
||||
|
||||
|
||||
Many thanks to Bill Hunter for finding this serious BUG.
|
||||
email to: <williamhunter@attbi.com>
|
||||
|
||||
44
doc/README.INCA-IP
Normal file
44
doc/README.INCA-IP
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
Flash programming on the INCA-IP board is complicated because of the
|
||||
EBU swapping unit. A BDI2000 can be used for flash programming only
|
||||
if the EBU swapping unit is enabled; otherwise it will not detect the
|
||||
flash memory. But the EBU swapping unit is disadbled after reset, so
|
||||
if you program some code to flash with the swapping unit on, it will
|
||||
not be runnable with the swapping unit off.
|
||||
|
||||
The consequence is that you have to write a pre-swapped image to
|
||||
flash using the BDI2000. A simple host-side tool "inca-swap-bytes" is
|
||||
provided in the "tools/" directory. Use it as follows:
|
||||
|
||||
bash$ ./inca-swap-bytes <u-boot.bin >u-boot.bin.swp
|
||||
|
||||
Note that the current BDI config file _disables_ the EBU swapping
|
||||
unit for the flash bank 0. To enable it, (this is required for the
|
||||
BDI flash commands to work) uncomment the following line in the
|
||||
config file:
|
||||
|
||||
;WM32 0xb8000260 0x404161ff ; Swapping unit enabled
|
||||
|
||||
and comment out
|
||||
|
||||
WM32 0xb8000260 0x004161ff ; Swapping unit disabled
|
||||
|
||||
Alternatively, you can use "mm 0xb8000260 <value>" commands to
|
||||
enable/disable the swapping unit manually.
|
||||
|
||||
Just for reference, here is the complete sequence of actions we took
|
||||
to install a U-Boot image into flash.
|
||||
|
||||
1. ./inca-swap-bytes <u-boot.bin >u-boot.bin.swp
|
||||
|
||||
2. From BDI:
|
||||
|
||||
mm 0xb8000260 0x404161ff
|
||||
erase 0xb0000000
|
||||
erase 0xb0010000
|
||||
prog 0xb0000000 /tftpboot/INCA/u-boot.bin.swp bin
|
||||
mm 0xb8000260 0x004161ff
|
||||
go 0xb0000000
|
||||
|
||||
|
||||
(C) 2003 Wolfgang Denk
|
||||
52
doc/README.Purple
Normal file
52
doc/README.Purple
Normal file
@@ -0,0 +1,52 @@
|
||||
Installation Instructions:
|
||||
--------------------------
|
||||
|
||||
1. Put the s2 switch into the following position:
|
||||
|
||||
1 0
|
||||
------
|
||||
|x |
|
||||
| x|
|
||||
|x |
|
||||
| X|
|
||||
------
|
||||
|
||||
2. Connect to the serial console and to the BDI. Power on. On the
|
||||
serial line, you should see:
|
||||
|
||||
PURPLE@1.2>
|
||||
|
||||
3. Type '8'. No echo will be displayed. In response, you should get:
|
||||
|
||||
7A(pass)
|
||||
|
||||
4. From BDI, enter command:
|
||||
|
||||
mmw 0xb800d860 0x0042c7ff
|
||||
|
||||
5. Then, from BDI:
|
||||
|
||||
erase 0xB0000000
|
||||
erase 0xB0008000
|
||||
erase 0xB000C000
|
||||
erase 0xB0010000
|
||||
erase 0xB0020000
|
||||
|
||||
prog 0xB0000000 <u-boot.bin> bin
|
||||
|
||||
6. Power off. Restore the original S2 switch position. Power on.
|
||||
U-Boot should come up.
|
||||
|
||||
|
||||
|
||||
Implementation Notes:
|
||||
---------------------
|
||||
|
||||
Due to the RAM/flash bus arbitration problem the suggested workaround
|
||||
had to be implemented. It works okay. On the downside is that you
|
||||
can't really check whether 'erase' is complete by polling flash as it
|
||||
is usually done. Instead, the flash driver simply waits for a given
|
||||
time and assumes that erase then has passed. This behaviour is
|
||||
identical to what the VxWorks driver does; also, the same timeout (6
|
||||
seconds) was chosen. Note that this timeout applies for each errase
|
||||
operation, i. e. per erased sector.
|
||||
84
doc/README.cmi
Normal file
84
doc/README.cmi
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
Summary:
|
||||
========
|
||||
|
||||
This file contains information about the cmi board configuration.
|
||||
Please see cmi_mpc5xx_config for further details. The cmi board is
|
||||
a customer specific board but should work with small modifications
|
||||
on every board which has a MPC5xx and either a 28F128J3A,
|
||||
28F320J3A or 28F640J3A Intel flash mounted.
|
||||
|
||||
Board Discription:
|
||||
==================
|
||||
|
||||
* Motorola MPC555
|
||||
* RS232 connection
|
||||
* Intel flash 28F640J3A
|
||||
* Micron SRAM 1M
|
||||
* Altera PLD
|
||||
|
||||
Bootstrap:
|
||||
==========
|
||||
|
||||
In contrast to the usual boot sequence used in U-Boot, on the
|
||||
cmi board we don't boot from the external flash directly.
|
||||
Because of we use a 16-bit flash and don't sample a RCW
|
||||
from the data bus to set the startup buswidth to 16-bit.
|
||||
Unfortunatly the default width, sampled from the default RCW
|
||||
is 32-bit. For this reason we burn the proper RCW into the
|
||||
internal flash shadow location and boot after power-on or
|
||||
reset from the internal flash and then branch to 0x02000100
|
||||
where the U-Boot reset vector handler is located.
|
||||
|
||||
Memory Map:
|
||||
===========
|
||||
|
||||
Memory Map after relocation:
|
||||
|
||||
0x0000 0000 CFG_SDRAM_BASE
|
||||
:
|
||||
0x000F 9FFF
|
||||
:
|
||||
:
|
||||
0x0100 0000 CFG_IMMR (Internal memory map base adress)
|
||||
:
|
||||
0x0130 7FFF
|
||||
:
|
||||
:
|
||||
0x0200 0000 CFG_FLASH_BASE
|
||||
:
|
||||
0x027C FFFF
|
||||
:
|
||||
:
|
||||
0x0300 0000 PLD_BASE
|
||||
|
||||
Flash Partition:
|
||||
|
||||
0x0200 0000 Block 0 and 1 contain U-Boot except
|
||||
: environment
|
||||
:
|
||||
0x0201 FFFF
|
||||
0x0202 0000 Block 2 contains environment (.ppcenv)
|
||||
:
|
||||
0x0202 FFFF
|
||||
|
||||
See README file for futher information about U-Boot relocation
|
||||
and partitioning.
|
||||
|
||||
Tested Features:
|
||||
================
|
||||
|
||||
* U-Boot commands: go, loads, loadb, all memory features, printenv,
|
||||
setenv, saveenv, protect, erase, fli, bdi, mtest, reset, version,
|
||||
coninfo, help (see configuration file for available commands)
|
||||
|
||||
* Blinking led to indicate boot process
|
||||
|
||||
Added or Changed Files:
|
||||
=======================
|
||||
|
||||
u-boot-0.2.0/board/cmi/*
|
||||
u-boot-0.2.0/include/configs/cmi_mpc5xx.h
|
||||
|
||||
Regards,
|
||||
Martin
|
||||
10
doc/README.idma2intr
Normal file
10
doc/README.idma2intr
Normal file
@@ -0,0 +1,10 @@
|
||||
(C) 2003 Arun Dharankar <ADharankar@ATTBI.Com>
|
||||
|
||||
Attached is an IDMA example code for MPC8260/PPCBoot. I had tried to
|
||||
search around and could not find any for implementing IDMA, so
|
||||
implemented one. Its not coded in the best way, but works.
|
||||
|
||||
Also, I was able to test the IDMA specific code under Linux also
|
||||
(with modifications). My requirement was to implement it for
|
||||
CompactFlash implemented in memory mode, and it works for it under
|
||||
PPCBoot and Linux.
|
||||
48
doc/README.mpc5xx
Normal file
48
doc/README.mpc5xx
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
Summary:
|
||||
========
|
||||
|
||||
This file contains information about the port of U-Boot to the
|
||||
Motorola mpc5xx series of CPUs. Most of this code is taken from
|
||||
existing code mainly from the mpc8xx port. In contrast to mpc8xx,
|
||||
the mpc5xx has no CPM, MMU and cache facilities.
|
||||
|
||||
The implemented features have been tested on the cmi board, a
|
||||
customer specific board (see README.cmi).
|
||||
|
||||
Hence this port is only tested on the cmi board further possible
|
||||
tests on other boards will be very valuable.
|
||||
|
||||
Not Tested Features:
|
||||
====================
|
||||
|
||||
* System calls
|
||||
* Interrupts
|
||||
|
||||
Added or Changed Files:
|
||||
=======================
|
||||
|
||||
u-boot-0.2.0/common/cmd_boot.c
|
||||
u-boot-0.2.0/common/cmd_reginfo.c
|
||||
u-boot-0.2.0/common/environment.c
|
||||
u-boot-0.2.0/cpu/mpc5xx/*
|
||||
u-boot-0.2.0/include/cmd_reginfo.h
|
||||
u-boot-0.2.0/include/common.h
|
||||
u-boot-0.2.0/include/ppc_asm.tmpl
|
||||
u-boot-0.2.0/include/watchdog.h
|
||||
u-boot-0.2.0/include/mpc5xx.h
|
||||
u-boot-0.2.0/include/status_led.h
|
||||
u-boot-0.2.0/include/asm-ppc/u-boot.h
|
||||
u-boot-0.2.0/include/asm-ppc/5xx_immap.h
|
||||
u-boot-0.2.0/lib_ppc/board.c
|
||||
u-boot-0.2.0/lib_ppc/cache.c
|
||||
u-boot-0.2.0/lib_ppc/time.c
|
||||
u-boot-0.2.0/Makefile
|
||||
u-boot-0.2.0/CREDITS
|
||||
u-boot-0.2.0/doc/README.mpc5xx
|
||||
u-boot-0.2.0/doc/README.cmi
|
||||
u-boot-0.2.0/README
|
||||
u-boot-0.2.0/MAKEALL
|
||||
|
||||
Regards,
|
||||
Martin
|
||||
53
doc/README.sched
Normal file
53
doc/README.sched
Normal file
@@ -0,0 +1,53 @@
|
||||
Notes on the scheduler in sched.c:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
'sched.c' provides an very simplistic multi-threading scheduler.
|
||||
See the example, function 'sched(...)', in the same file for its
|
||||
API usage.
|
||||
|
||||
Until an exhaustive testing can be done, the implementation cannot
|
||||
qualify as that of production quality. It works with the example
|
||||
in 'sched.c', it may or may not work in other cases.
|
||||
|
||||
|
||||
Limitations:
|
||||
~~~~~~~~~~~~
|
||||
|
||||
- There are NO primitives for thread synchronization (locking,
|
||||
notify etc).
|
||||
|
||||
- Only the GPRs and FPRs context is saved during a thread context
|
||||
switch. Other registers on the PowerPC processor (60x, 7xx, 7xxx
|
||||
etc) are NOT saved.
|
||||
|
||||
- The scheduler is NOT transparent to the user. The user
|
||||
applications must invoke thread_yield() to allow other threads to
|
||||
scheduler.
|
||||
|
||||
- There are NO priorities, and the scheduling policy is round-robin
|
||||
based.
|
||||
|
||||
- There are NO capabilities to collect thread CPU usage, scheduler
|
||||
stats, thread status etc.
|
||||
|
||||
- The semantics are somewhat based on those of pthreads, but NOT
|
||||
the same.
|
||||
|
||||
- Only seven threads are allowed. These can be easily increased by
|
||||
changing "#define MAX_THREADS" depending on the available memory.
|
||||
|
||||
- The stack size of each thread is 8KBytes. This can be easily
|
||||
increased depending on the requirement and the available memory,
|
||||
by increasing "#define STK_SIZE".
|
||||
|
||||
- Only one master/parent thread is allowed, and it cannot be
|
||||
stopped or deleted. Any given thread is NOT allowed to stop or
|
||||
delete itself.
|
||||
|
||||
- There NOT enough safety checks as are probably in the other
|
||||
threads implementations.
|
||||
|
||||
- There is no parent-child relationship between threads. Only one
|
||||
thread may thread_join, preferably the master/parent thread.
|
||||
|
||||
(C) 2003 Arun Dharankar <ADharankar@ATTBI.Com>
|
||||
@@ -33,7 +33,8 @@ OBJS = 3c589.o 5701rls.o at91rm9200_ether.o \
|
||||
eepro100.o i8042.o inca-ip_sw.o \
|
||||
natsemi.o ns16550.o ns8382x.o ns87308.o \
|
||||
pci.o pci_auto.o pci_indirect.o \
|
||||
pcnet.o s3c24x0_i2c.o sed13806.o serial.o \
|
||||
pcnet.o plb2800_eth.o \
|
||||
s3c24x0_i2c.o sed13806.o serial.o \
|
||||
smc91111.o smiLynxEM.o sym53c8xx.o \
|
||||
tigon3.o w83c553f.o
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <AT91RM9200.h>
|
||||
#include <asm/io.h>
|
||||
#include <net.h>
|
||||
|
||||
/* ----- Ethernet Buffer definitions ----- */
|
||||
|
||||
@@ -830,6 +830,7 @@ FindAndSetPllParamIntoXrRegs (unsigned int pixelclock,
|
||||
unsigned int m, n, vld, pd, PD, fref, xr_cb;
|
||||
unsigned int fvcomin, fvcomax, pclckmin, pclckmax, pclk;
|
||||
unsigned int pfreq, fvco, new_pixclock;
|
||||
unsigned int D,nback,mback;
|
||||
|
||||
fref = VIDEO_FREF;
|
||||
pd = 1;
|
||||
@@ -850,10 +851,19 @@ FindAndSetPllParamIntoXrRegs (unsigned int pixelclock,
|
||||
PD++;
|
||||
}
|
||||
/* fvco is exactly pd * pixelclock and higher than the ninmal VCO frequency */
|
||||
vld = (param->vld_set > param->vld_not_set) ?
|
||||
param->vld_not_set : param->vld_set;
|
||||
/* start with lower VLD (higher VLD is NOT yet implemented */
|
||||
FindBestPQFittingMN (fvco / vld, fref, param->mn_min, param->mn_max, &m, &n); /* rds = 1 */
|
||||
/* first try */
|
||||
vld = param->vld_set;
|
||||
D=FindBestPQFittingMN (fvco / vld, fref, param->mn_min, param->mn_max, &m, &n); /* rds = 1 */
|
||||
mback=m;
|
||||
nback=n;
|
||||
/* second try */
|
||||
vld = param->vld_not_set;
|
||||
if(D<FindBestPQFittingMN (fvco / vld, fref, param->mn_min, param->mn_max, &m, &n)) { /* rds = 1 */
|
||||
/* first try was better */
|
||||
m=mback;
|
||||
n=nback;
|
||||
vld = param->vld_set;
|
||||
}
|
||||
m += param->mn_diff;
|
||||
n += param->mn_diff;
|
||||
PRINTF ("VCO %d, pd %d, m %d n %d vld %d \n", fvco, pd, m, n, vld);
|
||||
|
||||
396
drivers/plb2800_eth.c
Normal file
396
drivers/plb2800_eth.c
Normal file
@@ -0,0 +1,396 @@
|
||||
/*
|
||||
* PLB2800 internal switch ethernet driver.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) \
|
||||
&& defined(CONFIG_PLB2800_ETHER)
|
||||
|
||||
#include <malloc.h>
|
||||
#include <net.h>
|
||||
#include <asm/addrspace.h>
|
||||
|
||||
|
||||
#define NUM_RX_DESC PKTBUFSRX
|
||||
#define TOUT_LOOP 1000000
|
||||
|
||||
#define LONG_REF(addr) (*((volatile unsigned long*)addr))
|
||||
|
||||
#define CMAC_CRX_CTRL LONG_REF(0xb800c870)
|
||||
#define CMAC_CTX_CTRL LONG_REF(0xb800c874)
|
||||
#define SYS_MAC_ADDR_0 LONG_REF(0xb800c878)
|
||||
#define SYS_MAC_ADDR_1 LONG_REF(0xb800c87c)
|
||||
#define MIPS_H_MASK LONG_REF(0xB800C810)
|
||||
|
||||
#define MA_LEARN LONG_REF(0xb8008004)
|
||||
#define DA_LOOKUP LONG_REF(0xb8008008)
|
||||
|
||||
#define CMAC_CRX_CTRL_PD 0x00000001
|
||||
#define CMAC_CRX_CTRL_CG 0x00000002
|
||||
#define CMAC_CRX_CTRL_PL_SHIFT 2
|
||||
#define CMAC_CRIT 0x0
|
||||
#define CMAC_NON_CRIT 0x1
|
||||
#define MBOX_STAT_ID_SHF 28
|
||||
#define MBOX_STAT_CP 0x80000000
|
||||
#define MBOX_STAT_MB 0x00000001
|
||||
#define EN_MA_LEARN 0x02000000
|
||||
#define EN_DA_LKUP 0x01000000
|
||||
#define MA_DEST_SHF 11
|
||||
#define DA_DEST_SHF 11
|
||||
#define DA_STATE_SHF 19
|
||||
#define TSTAMP_MS 0x00000000
|
||||
#define SW_H_MBOX4_MASK 0x08000000
|
||||
#define SW_H_MBOX3_MASK 0x04000000
|
||||
#define SW_H_MBOX2_MASK 0x02000000
|
||||
#define SW_H_MBOX1_MASK 0x01000000
|
||||
|
||||
typedef volatile struct {
|
||||
unsigned int stat;
|
||||
unsigned int cmd;
|
||||
unsigned int cnt;
|
||||
unsigned int adr;
|
||||
} mailbox_t;
|
||||
|
||||
#define MBOX_REG(mb) ((mailbox_t*)(0xb800c830+(mb<<4)))
|
||||
|
||||
typedef volatile struct {
|
||||
unsigned int word0;
|
||||
unsigned int word1;
|
||||
unsigned int word2;
|
||||
} mbhdr_t;
|
||||
|
||||
#define MBOX_MEM(mb) ((void*)(0xb800a000+((3-mb)<<11)))
|
||||
|
||||
|
||||
static int plb2800_eth_init(struct eth_device *dev, bd_t * bis);
|
||||
static int plb2800_eth_send(struct eth_device *dev, volatile void *packet,
|
||||
int length);
|
||||
static int plb2800_eth_recv(struct eth_device *dev);
|
||||
static void plb2800_eth_halt(struct eth_device *dev);
|
||||
|
||||
static void plb2800_set_mac_addr(struct eth_device *dev, unsigned char * addr);
|
||||
static unsigned char * plb2800_get_mac_addr(void);
|
||||
|
||||
static int rx_new;
|
||||
static int mac_addr_set = 0;
|
||||
|
||||
|
||||
int plb2800_eth_initialize(bd_t * bis)
|
||||
{
|
||||
struct eth_device *dev;
|
||||
ulong temp;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Entered plb2800_eth_initialize()\n");
|
||||
#endif
|
||||
|
||||
if (!(dev = (struct eth_device *) malloc (sizeof *dev)))
|
||||
{
|
||||
printf("Failed to allocate memory\n");
|
||||
return 0;
|
||||
}
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
sprintf(dev->name, "PLB2800 Switch");
|
||||
dev->init = plb2800_eth_init;
|
||||
dev->halt = plb2800_eth_halt;
|
||||
dev->send = plb2800_eth_send;
|
||||
dev->recv = plb2800_eth_recv;
|
||||
|
||||
eth_register(dev);
|
||||
|
||||
/* bug fix */
|
||||
*(ulong *)0xb800e800 = 0x838;
|
||||
|
||||
/* Set MBOX ownership */
|
||||
temp = CMAC_CRIT << MBOX_STAT_ID_SHF;
|
||||
MBOX_REG(0)->stat = temp;
|
||||
MBOX_REG(1)->stat = temp;
|
||||
|
||||
temp = CMAC_NON_CRIT << MBOX_STAT_ID_SHF;
|
||||
MBOX_REG(2)->stat = temp;
|
||||
MBOX_REG(3)->stat = temp;
|
||||
|
||||
plb2800_set_mac_addr(dev, plb2800_get_mac_addr());
|
||||
|
||||
/* Disable all Mbox interrupt */
|
||||
temp = MIPS_H_MASK;
|
||||
temp &= ~ (SW_H_MBOX1_MASK | SW_H_MBOX2_MASK | SW_H_MBOX3_MASK | SW_H_MBOX4_MASK) ;
|
||||
MIPS_H_MASK = temp;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Leaving plb2800_eth_initialize()\n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int plb2800_eth_init(struct eth_device *dev, bd_t * bis)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Entering plb2800_eth_init()\n");
|
||||
#endif
|
||||
|
||||
plb2800_set_mac_addr(dev, dev->enetaddr);
|
||||
|
||||
rx_new = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Leaving plb2800_eth_init()\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int plb2800_eth_send(struct eth_device *dev, volatile void *packet,
|
||||
int length)
|
||||
{
|
||||
int i;
|
||||
int res = -1;
|
||||
u32 temp;
|
||||
mailbox_t * mb = MBOX_REG(0);
|
||||
char * mem = MBOX_MEM(0);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Entered plb2800_eth_send()\n");
|
||||
#endif
|
||||
|
||||
if (length <= 0)
|
||||
{
|
||||
printf ("%s: bad packet size: %d\n", dev->name, length);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (length < 64)
|
||||
{
|
||||
length = 64;
|
||||
}
|
||||
|
||||
temp = CMAC_CRX_CTRL_CG | ((length + 4) << CMAC_CRX_CTRL_PL_SHIFT);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("0 mb->stat = 0x%x\n", mb->stat);
|
||||
#endif
|
||||
|
||||
for(i = 0; mb->stat & (MBOX_STAT_CP | MBOX_STAT_MB); i++)
|
||||
{
|
||||
if (i >= TOUT_LOOP)
|
||||
{
|
||||
printf("%s: tx buffer not ready\n", dev->name);
|
||||
printf("1 mb->stat = 0x%x\n", mb->stat);
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
/* For some strange reason, memcpy doesn't work, here!
|
||||
*/
|
||||
do
|
||||
{
|
||||
int words = (length >> 2) + 1;
|
||||
unsigned int* dst = (unsigned int*)(mem);
|
||||
unsigned int* src = (unsigned int*)(packet);
|
||||
for (i = 0; i < words; i++)
|
||||
{
|
||||
*dst = *src;
|
||||
dst++;
|
||||
src++;
|
||||
};
|
||||
} while(0);
|
||||
|
||||
CMAC_CRX_CTRL = temp;
|
||||
mb->cmd = MBOX_STAT_CP;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("2 mb->stat = 0x%x\n", mb->stat);
|
||||
#endif
|
||||
|
||||
res = length;
|
||||
Done:
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Leaving plb2800_eth_send()\n");
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static int plb2800_eth_recv(struct eth_device *dev)
|
||||
{
|
||||
int length = 0;
|
||||
mailbox_t * mbox = MBOX_REG(3);
|
||||
unsigned char * hdr = MBOX_MEM(3);
|
||||
unsigned int stat;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Entered plb2800_eth_recv()\n");
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
{
|
||||
stat = mbox->stat;
|
||||
|
||||
if (!(stat & MBOX_STAT_CP))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
length = ((*(hdr + 6) & 0x3f) << 8) + *(hdr + 7);
|
||||
memcpy((void *)NetRxPackets[rx_new], hdr + 12, length);
|
||||
|
||||
stat &= ~MBOX_STAT_CP;
|
||||
mbox->stat = stat;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<length - 4;i++)
|
||||
{
|
||||
if (i % 16 == 0) printf("\n%04x: ", i);
|
||||
printf("%02X ", NetRxPackets[rx_new][i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (length)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Received %d bytes\n", length);
|
||||
#endif
|
||||
NetReceive((void*)(NetRxPackets[rx_new]),
|
||||
length - 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
printf("Zero length!!!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
rx_new = (rx_new + 1) % NUM_RX_DESC;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Leaving plb2800_eth_recv()\n");
|
||||
#endif
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
static void plb2800_eth_halt(struct eth_device *dev)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("Entered plb2800_eth_halt()\n");
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Leaving plb2800_eth_halt()\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void plb2800_set_mac_addr(struct eth_device *dev, unsigned char * addr)
|
||||
{
|
||||
char packet[60];
|
||||
ulong temp;
|
||||
int ix;
|
||||
|
||||
if (mac_addr_set ||
|
||||
NULL == addr || memcmp(addr, "\0\0\0\0\0\0", 6) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* send one packet through CPU port
|
||||
* in order to learn system MAC address
|
||||
*/
|
||||
|
||||
/* Set DA_LOOKUP register */
|
||||
temp = EN_MA_LEARN | (0 << DA_STATE_SHF) | (63 << DA_DEST_SHF);
|
||||
DA_LOOKUP = temp;
|
||||
|
||||
/* Set MA_LEARN register */
|
||||
temp = 50 << MA_DEST_SHF; /* static entry */
|
||||
MA_LEARN = temp;
|
||||
|
||||
/* set destination address */
|
||||
for (ix=0;ix<6;ix++)
|
||||
packet[ix] = 0xff;
|
||||
|
||||
/* set source address = system MAC address */
|
||||
for (ix=0;ix<6;ix++)
|
||||
packet[6+ix] = addr[ix];
|
||||
|
||||
/* set type field */
|
||||
packet[12]=0xaa;
|
||||
packet[13]=0x55;
|
||||
|
||||
/* set data field */
|
||||
for(ix=14;ix<60;ix++)
|
||||
packet[ix] = 0x00;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (ix=0;ix<6;ix++)
|
||||
printf("mac_addr[%d]=%02X\n", ix, (unsigned char)packet[6+ix]);
|
||||
#endif
|
||||
|
||||
/* set one packet */
|
||||
plb2800_eth_send(dev, packet, sizeof(packet));
|
||||
|
||||
/* delay for a while */
|
||||
for(ix=0;ix<65535;ix++)
|
||||
temp = ~temp;
|
||||
|
||||
/* Set CMAC_CTX_CTRL register */
|
||||
temp = TSTAMP_MS; /* no autocast */
|
||||
CMAC_CTX_CTRL = temp;
|
||||
|
||||
/* Set DA_LOOKUP register */
|
||||
temp = EN_DA_LKUP;
|
||||
DA_LOOKUP = temp;
|
||||
|
||||
mac_addr_set = 1;
|
||||
}
|
||||
|
||||
static unsigned char * plb2800_get_mac_addr(void)
|
||||
{
|
||||
static unsigned char addr[6];
|
||||
char *tmp, *end;
|
||||
int i;
|
||||
|
||||
tmp = getenv ("ethaddr");
|
||||
if (NULL == tmp) return NULL;
|
||||
|
||||
for (i=0; i<6; i++) {
|
||||
addr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
|
||||
if (tmp)
|
||||
tmp = (*end) ? end+1 : end;
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PLB2800_ETHER */
|
||||
@@ -28,7 +28,12 @@ include $(TOPDIR)/config.mk
|
||||
SREC = hello_world.srec
|
||||
BIN = hello_world.bin
|
||||
|
||||
ifeq ($(CPU),mips)
|
||||
ifeq ($(ARCH),ppc)
|
||||
SREC += sched.srec
|
||||
BIN += sched.bin
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),mips)
|
||||
SREC =
|
||||
BIN =
|
||||
endif
|
||||
@@ -36,6 +41,13 @@ endif
|
||||
# The following example is pretty 8xx specific...
|
||||
ifeq ($(CPU),mpc8xx)
|
||||
SREC += timer.srec
|
||||
BIN += timer.bin
|
||||
endif
|
||||
|
||||
# The following example is 8260 specific...
|
||||
ifeq ($(CPU),mpc8260)
|
||||
SREC += mem_to_mem_idma2intr.srec
|
||||
BIN += mem_to_mem_idma2intr.bin
|
||||
endif
|
||||
|
||||
# Utility for resetting i82559 EEPROM
|
||||
@@ -45,8 +57,11 @@ endif
|
||||
|
||||
OBJS = $(SREC:.srec=.o)
|
||||
|
||||
LIB = libsyscall.a
|
||||
LIB = libsyscall.a
|
||||
LIBAOBJS= syscall.o
|
||||
ifeq ($(ARCH),ppc)
|
||||
LIBAOBJS+= $(ARCH)_longjmp.o $(ARCH)_setjmp.o
|
||||
endif
|
||||
LIBCOBJS=
|
||||
LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
|
||||
|
||||
|
||||
391
examples/mem_to_mem_idma2intr.c
Normal file
391
examples/mem_to_mem_idma2intr.c
Normal file
@@ -0,0 +1,391 @@
|
||||
/* The dpalloc function used and implemented in this file was derieved
|
||||
* from PPCBoot/U-Boot file "cpu/mpc8260/commproc.c".
|
||||
*/
|
||||
|
||||
/* Author: Arun Dharankar <ADharankar@ATTBI.Com>
|
||||
* This example is meant to only demonstrate how the IDMA could be used.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is based on "arch/ppc/8260_io/commproc.c" - here is it's
|
||||
* copyright notice:
|
||||
*
|
||||
* General Purpose functions for the global management of the
|
||||
* 8260 Communication Processor Module.
|
||||
* Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
|
||||
* Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
|
||||
* 2.3.99 Updates
|
||||
*
|
||||
* In addition to the individual control of the communication
|
||||
* channels, there are a few functions that globally affect the
|
||||
* communication processor.
|
||||
*
|
||||
* Buffer descriptors must be allocated from the dual ported memory
|
||||
* space. The allocator for that is here. When the communication
|
||||
* process is reset, we reclaim the memory available. There is
|
||||
* currently no deallocator for this memory.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <syscall.h>
|
||||
|
||||
#define STANDALONE
|
||||
|
||||
#ifndef STANDALONE /* Linked into/Part of PPCBoot */
|
||||
#include <command.h>
|
||||
#include <watchdog.h>
|
||||
#else /* Standalone app of PPCBoot */
|
||||
#include <syscall.h>
|
||||
#define printf mon_printf
|
||||
#define tstc mon_tstc
|
||||
#define getc mon_getc
|
||||
#define putc mon_putc
|
||||
#define udelay mon_udelay
|
||||
#define malloc mon_malloc
|
||||
#define WATCHDOG_RESET() { \
|
||||
*(ushort *)(CFG_IMMR + 0x1000E) = 0x556c; \
|
||||
*(ushort *)(CFG_IMMR + 0x1000E) = 0xaa39; \
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
|
||||
static int debug = 1;
|
||||
|
||||
#define DEBUG(fmt, args...) { \
|
||||
if(debug != 0) { \
|
||||
printf("[%s %d %s]: ",__FILE__,__LINE__,__FUNCTION__); \
|
||||
printf(fmt, ##args); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CPM_CR_IDMA1_SBLOCK (0x14)
|
||||
#define CPM_CR_IDMA2_SBLOCK (0x15)
|
||||
#define CPM_CR_IDMA3_SBLOCK (0x16)
|
||||
#define CPM_CR_IDMA4_SBLOCK (0x17)
|
||||
#define CPM_CR_IDMA1_PAGE (0x07)
|
||||
#define CPM_CR_IDMA2_PAGE (0x08)
|
||||
#define CPM_CR_IDMA3_PAGE (0x09)
|
||||
#define CPM_CR_IDMA4_PAGE (0x0a)
|
||||
#define PROFF_IDMA1_BASE ((uint)0x87fe)
|
||||
#define PROFF_IDMA2_BASE ((uint)0x88fe)
|
||||
#define PROFF_IDMA3_BASE ((uint)0x89fe)
|
||||
#define PROFF_IDMA4_BASE ((uint)0x8afe)
|
||||
|
||||
#define CPM_CR_INIT_TRX ((ushort)0x0000)
|
||||
#define CPM_CR_FLG ((ushort)0x0001)
|
||||
|
||||
#define mk_cr_cmd(PG, SBC, MCN, OP) \
|
||||
((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct ibdbits {
|
||||
unsigned b_valid:1;
|
||||
unsigned b_resv1:1;
|
||||
unsigned b_wrap:1;
|
||||
unsigned b_interrupt:1;
|
||||
unsigned b_last:1;
|
||||
unsigned b_resv2:1;
|
||||
unsigned b_cm:1;
|
||||
unsigned b_resv3:2;
|
||||
unsigned b_sdn:1;
|
||||
unsigned b_ddn:1;
|
||||
unsigned b_dgbl:1;
|
||||
unsigned b_dbo:2;
|
||||
unsigned b_resv4:1;
|
||||
unsigned b_ddtb:1;
|
||||
unsigned b_resv5:2;
|
||||
unsigned b_sgbl:1;
|
||||
unsigned b_sbo:2;
|
||||
unsigned b_resv6:1;
|
||||
unsigned b_sdtb:1;
|
||||
unsigned b_resv7:9;
|
||||
} ibdbits_t;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef union ibdbitsu {
|
||||
ibdbits_t b;
|
||||
uint i;
|
||||
} ibdbitsu_t;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct idma_buf_desc {
|
||||
ibdbitsu_t ibd_bits; /* Status and Control */
|
||||
uint ibd_datlen; /* Data length in buffer */
|
||||
uint ibd_sbuf; /* Source buffer addr in host mem */
|
||||
uint ibd_dbuf; /* Destination buffer addr in host mem */
|
||||
} ibd_t;
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct dcmbits {
|
||||
unsigned b_fb:1;
|
||||
unsigned b_lp:1;
|
||||
unsigned b_resv1:3;
|
||||
unsigned b_tc2:1;
|
||||
unsigned b_resv2:1;
|
||||
unsigned b_wrap:3;
|
||||
unsigned b_sinc:1;
|
||||
unsigned b_dinc:1;
|
||||
unsigned b_erm:1;
|
||||
unsigned b_dt:1;
|
||||
unsigned b_sd:2;
|
||||
} dcmbits_t;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef union dcmbitsu {
|
||||
dcmbits_t b;
|
||||
ushort i;
|
||||
} dcmbitsu_t;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct pram_idma {
|
||||
ushort pi_ibase;
|
||||
dcmbitsu_t pi_dcmbits;
|
||||
ushort pi_ibdptr;
|
||||
ushort pi_dprbuf;
|
||||
ushort pi_bufinv; /* internal to CPM */
|
||||
ushort pi_ssmax;
|
||||
ushort pi_dprinptr; /* internal to CPM */
|
||||
ushort pi_sts;
|
||||
ushort pi_dproutptr; /* internal to CPM */
|
||||
ushort pi_seob;
|
||||
ushort pi_deob;
|
||||
ushort pi_dts;
|
||||
ushort pi_retadd;
|
||||
ushort pi_resv1; /* internal to CPM */
|
||||
uint pi_bdcnt;
|
||||
uint pi_sptr;
|
||||
uint pi_dptr;
|
||||
uint pi_istate;
|
||||
} pram_idma_t;
|
||||
|
||||
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile ibd_t *bdf;
|
||||
volatile pram_idma_t *piptr;
|
||||
|
||||
volatile int dmadone;
|
||||
volatile int *dmadonep = &dmadone;
|
||||
void dmadone_handler (void *);
|
||||
|
||||
int idma_init (void);
|
||||
void idma_start (int, int, int, uint, uint, int);
|
||||
uint dpalloc (uint, uint);
|
||||
|
||||
|
||||
uint dpinit_done = 0;
|
||||
|
||||
|
||||
#ifdef STANDALONE
|
||||
int ctrlc (void)
|
||||
{
|
||||
if (mon_tstc()) {
|
||||
switch (mon_getc ()) {
|
||||
case 0x03: /* ^C - Control C */
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void * memset(void * s,int c,size_t count)
|
||||
{
|
||||
char *xs = (char *) s;
|
||||
while (count--)
|
||||
*xs++ = c;
|
||||
return s;
|
||||
}
|
||||
int memcmp(const void * cs,const void * ct,size_t count)
|
||||
{
|
||||
const unsigned char *su1, *su2;
|
||||
int res = 0;
|
||||
for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
|
||||
if ((res = *su1 - *su2) != 0)
|
||||
break;
|
||||
return res;
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
|
||||
#ifdef STANDALONE
|
||||
int mem_to_mem_idma2intr (bd_t * bd, int argc, char *argv[])
|
||||
#else
|
||||
int do_idma (bd_t * bd, int argc, char *argv[])
|
||||
#endif /* STANDALONE */
|
||||
{
|
||||
int i;
|
||||
|
||||
dpinit_done = 0;
|
||||
|
||||
idma_init ();
|
||||
|
||||
DEBUG ("Installing dma handler\n");
|
||||
mon_install_hdlr (7, dmadone_handler, (void *) bdf);
|
||||
|
||||
memset ((void *) 0x100000, 'a', 512);
|
||||
memset ((void *) 0x200000, 'b', 512);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
printf ("Startin IDMA, iteration=%d\n", i);
|
||||
idma_start (1, 1, 512, 0x100000, 0x200000, 3);
|
||||
}
|
||||
|
||||
DEBUG ("Uninstalling dma handler\n");
|
||||
mon_free_hdlr (7);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
idma_start (int sinc, int dinc, int sz, uint sbuf, uint dbuf, int ttype)
|
||||
{
|
||||
/* ttype is for M-M, M-P, P-M or P-P: not used for now */
|
||||
|
||||
piptr->pi_istate = 0; /* manual says: clear it before every START_IDMA */
|
||||
piptr->pi_dcmbits.b.b_resv1 = 0;
|
||||
|
||||
if (sinc == 1)
|
||||
piptr->pi_dcmbits.b.b_sinc = 1;
|
||||
else
|
||||
piptr->pi_dcmbits.b.b_sinc = 0;
|
||||
|
||||
if (dinc == 1)
|
||||
piptr->pi_dcmbits.b.b_dinc = 1;
|
||||
else
|
||||
piptr->pi_dcmbits.b.b_dinc = 0;
|
||||
|
||||
piptr->pi_dcmbits.b.b_erm = 0;
|
||||
piptr->pi_dcmbits.b.b_sd = 0x00; /* M-M */
|
||||
|
||||
bdf->ibd_sbuf = sbuf;
|
||||
bdf->ibd_dbuf = dbuf;
|
||||
bdf->ibd_bits.b.b_cm = 0;
|
||||
bdf->ibd_bits.b.b_interrupt = 1;
|
||||
bdf->ibd_bits.b.b_wrap = 1;
|
||||
bdf->ibd_bits.b.b_last = 1;
|
||||
bdf->ibd_bits.b.b_sdn = 0;
|
||||
bdf->ibd_bits.b.b_ddn = 0;
|
||||
bdf->ibd_bits.b.b_dgbl = 0;
|
||||
bdf->ibd_bits.b.b_ddtb = 0;
|
||||
bdf->ibd_bits.b.b_sgbl = 0;
|
||||
bdf->ibd_bits.b.b_sdtb = 0;
|
||||
bdf->ibd_bits.b.b_dbo = 1;
|
||||
bdf->ibd_bits.b.b_sbo = 1;
|
||||
bdf->ibd_bits.b.b_valid = 1;
|
||||
bdf->ibd_datlen = 512;
|
||||
|
||||
*dmadonep = 0;
|
||||
|
||||
immap->im_sdma.sdma_idmr2 = (uchar) 0xf;
|
||||
|
||||
immap->im_cpm.cp_cpcr = mk_cr_cmd (CPM_CR_IDMA2_PAGE,
|
||||
CPM_CR_IDMA2_SBLOCK, 0x0,
|
||||
0x9) | 0x00010000;
|
||||
|
||||
while (*dmadonep != 1) {
|
||||
if (ctrlc ()) {
|
||||
DEBUG ("\nInterrupted waiting for DMA interrupt.\n");
|
||||
goto done;
|
||||
}
|
||||
printf ("Waiting for DMA interrupt (dmadone=%d b_valid = %d)...\n",
|
||||
dmadone, bdf->ibd_bits.b.b_valid);
|
||||
udelay (1000000);
|
||||
}
|
||||
printf ("DMA complete notification received!\n");
|
||||
|
||||
done:
|
||||
DEBUG ("memcmp(0x%08x, 0x%08x, 512) = %d\n",
|
||||
sbuf, dbuf, memcmp ((void *) sbuf, (void *) dbuf, 512));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#define MAX_INT_BUFSZ 64
|
||||
#define DCM_WRAP 0 /* MUST be consistant with MAX_INT_BUFSZ */
|
||||
|
||||
int idma_init (void)
|
||||
{
|
||||
uint memaddr;
|
||||
|
||||
immap->im_cpm.cp_rccr &= ~0x00F3FFFF;
|
||||
immap->im_cpm.cp_rccr |= 0x00A00A00;
|
||||
|
||||
memaddr = dpalloc (sizeof (pram_idma_t), 64);
|
||||
|
||||
*(volatile ushort *) &immap->im_dprambase[PROFF_IDMA2_BASE] = memaddr;
|
||||
piptr = (volatile pram_idma_t *) ((uint) (immap) + memaddr);
|
||||
|
||||
piptr->pi_resv1 = 0; /* manual says: clear it */
|
||||
piptr->pi_dcmbits.b.b_fb = 0;
|
||||
piptr->pi_dcmbits.b.b_lp = 1;
|
||||
piptr->pi_dcmbits.b.b_erm = 0;
|
||||
piptr->pi_dcmbits.b.b_dt = 0;
|
||||
|
||||
memaddr = (uint) dpalloc (sizeof (ibd_t), 64);
|
||||
piptr->pi_ibase = piptr->pi_ibdptr = (volatile short) memaddr;
|
||||
bdf = (volatile ibd_t *) ((uint) (immap) + memaddr);
|
||||
bdf->ibd_bits.b.b_valid = 0;
|
||||
|
||||
memaddr = (uint) dpalloc (64, 64);
|
||||
piptr->pi_dprbuf = (volatile ushort) memaddr;
|
||||
piptr->pi_dcmbits.b.b_wrap = 4;
|
||||
piptr->pi_ssmax = 32;
|
||||
|
||||
piptr->pi_sts = piptr->pi_ssmax;
|
||||
piptr->pi_dts = piptr->pi_ssmax;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void dmadone_handler (void *arg)
|
||||
{
|
||||
immap->im_sdma.sdma_idmr2 = (uchar) 0x0;
|
||||
|
||||
*dmadonep = 1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static uint dpbase = 0;
|
||||
|
||||
uint dpalloc (uint size, uint align)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
uint retloc;
|
||||
uint align_mask, off;
|
||||
uint savebase;
|
||||
|
||||
/* Pointer to initial global data area */
|
||||
|
||||
if (dpinit_done == 0) {
|
||||
dpbase = gd->dp_alloc_base;
|
||||
dpinit_done = 1;
|
||||
}
|
||||
|
||||
align_mask = align - 1;
|
||||
savebase = dpbase;
|
||||
|
||||
if ((off = (dpbase & align_mask)) != 0)
|
||||
dpbase += (align - off);
|
||||
|
||||
if ((off = size & align_mask) != 0)
|
||||
size += align - off;
|
||||
|
||||
if ((dpbase + size) >= gd->dp_alloc_top) {
|
||||
dpbase = savebase;
|
||||
printf ("dpalloc: ran out of dual port ram!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
retloc = dpbase;
|
||||
dpbase += size;
|
||||
|
||||
memset ((void *) &immr->im_dprambase[retloc], 0, size);
|
||||
|
||||
return (retloc);
|
||||
}
|
||||
79
examples/ppc_longjmp.S
Normal file
79
examples/ppc_longjmp.S
Normal file
@@ -0,0 +1,79 @@
|
||||
/* longjmp for PowerPC.
|
||||
Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
|
||||
# define JB_GPR1 0 /* Also known as the stack pointer */
|
||||
# define JB_GPR2 1
|
||||
# define JB_LR 2 /* The address we will return to */
|
||||
# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */
|
||||
# define JB_CR 21 /* Condition code registers. */
|
||||
# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */
|
||||
# define JB_SIZE (58*4)
|
||||
|
||||
#define FP(x...) x
|
||||
#define FP(x...) x
|
||||
|
||||
.globl ppc_longjmp;
|
||||
|
||||
ppc_longjmp:
|
||||
lwz r1,(JB_GPR1*4)(r3)
|
||||
lwz r2,(JB_GPR2*4)(r3)
|
||||
lwz r0,(JB_LR*4)(r3)
|
||||
lwz r14,((JB_GPRS+0)*4)(r3)
|
||||
FP( lfd 14,((JB_FPRS+0*2)*4)(r3))
|
||||
lwz r15,((JB_GPRS+1)*4)(r3)
|
||||
FP( lfd 15,((JB_FPRS+1*2)*4)(r3))
|
||||
lwz r16,((JB_GPRS+2)*4)(r3)
|
||||
FP( lfd 16,((JB_FPRS+2*2)*4)(r3))
|
||||
lwz r17,((JB_GPRS+3)*4)(r3)
|
||||
FP( lfd 17,((JB_FPRS+3*2)*4)(r3))
|
||||
lwz r18,((JB_GPRS+4)*4)(r3)
|
||||
FP( lfd 18,((JB_FPRS+4*2)*4)(r3))
|
||||
lwz r19,((JB_GPRS+5)*4)(r3)
|
||||
FP( lfd 19,((JB_FPRS+5*2)*4)(r3))
|
||||
lwz r20,((JB_GPRS+6)*4)(r3)
|
||||
FP( lfd 20,((JB_FPRS+6*2)*4)(r3))
|
||||
mtlr r0
|
||||
lwz r21,((JB_GPRS+7)*4)(r3)
|
||||
FP( lfd 21,((JB_FPRS+7*2)*4)(r3))
|
||||
lwz r22,((JB_GPRS+8)*4)(r3)
|
||||
FP( lfd 22,((JB_FPRS+8*2)*4)(r3))
|
||||
lwz r0,(JB_CR*4)(r3)
|
||||
lwz r23,((JB_GPRS+9)*4)(r3)
|
||||
FP( lfd 23,((JB_FPRS+9*2)*4)(r3))
|
||||
lwz r24,((JB_GPRS+10)*4)(r3)
|
||||
FP( lfd 24,((JB_FPRS+10*2)*4)(r3))
|
||||
lwz r25,((JB_GPRS+11)*4)(r3)
|
||||
FP( lfd 25,((JB_FPRS+11*2)*4)(r3))
|
||||
mtcrf 0xFF,r0
|
||||
lwz r26,((JB_GPRS+12)*4)(r3)
|
||||
FP( lfd 26,((JB_FPRS+12*2)*4)(r3))
|
||||
lwz r27,((JB_GPRS+13)*4)(r3)
|
||||
FP( lfd 27,((JB_FPRS+13*2)*4)(r3))
|
||||
lwz r28,((JB_GPRS+14)*4)(r3)
|
||||
FP( lfd 28,((JB_FPRS+14*2)*4)(r3))
|
||||
lwz r29,((JB_GPRS+15)*4)(r3)
|
||||
FP( lfd 29,((JB_FPRS+15*2)*4)(r3))
|
||||
lwz r30,((JB_GPRS+16)*4)(r3)
|
||||
FP( lfd 30,((JB_FPRS+16*2)*4)(r3))
|
||||
lwz r31,((JB_GPRS+17)*4)(r3)
|
||||
FP( lfd 31,((JB_FPRS+17*2)*4)(r3))
|
||||
mr r3,r4
|
||||
blr
|
||||
83
examples/ppc_setjmp.S
Normal file
83
examples/ppc_setjmp.S
Normal file
@@ -0,0 +1,83 @@
|
||||
/* setjmp for PowerPC.
|
||||
Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
|
||||
# define JB_GPR1 0 /* Also known as the stack pointer */
|
||||
# define JB_GPR2 1
|
||||
# define JB_LR 2 /* The address we will return to */
|
||||
# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */
|
||||
# define JB_CR 21 /* Condition code registers. */
|
||||
# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */
|
||||
# define JB_SIZE (58*4)
|
||||
|
||||
#define FP(x...) x
|
||||
|
||||
.globl setctxsp;
|
||||
setctxsp:
|
||||
mr r1, r3
|
||||
blr
|
||||
|
||||
.globl ppc_setjmp;
|
||||
ppc_setjmp:
|
||||
stw r1,(JB_GPR1*4)(3)
|
||||
mflr r0
|
||||
stw r2,(JB_GPR2*4)(3)
|
||||
stw r14,((JB_GPRS+0)*4)(3)
|
||||
FP( stfd 14,((JB_FPRS+0*2)*4)(3))
|
||||
stw r0,(JB_LR*4)(3)
|
||||
stw r15,((JB_GPRS+1)*4)(3)
|
||||
FP( stfd 15,((JB_FPRS+1*2)*4)(3))
|
||||
mfcr r0
|
||||
stw r16,((JB_GPRS+2)*4)(3)
|
||||
FP( stfd 16,((JB_FPRS+2*2)*4)(3))
|
||||
stw r0,(JB_CR*4)(3)
|
||||
stw r17,((JB_GPRS+3)*4)(3)
|
||||
FP( stfd 17,((JB_FPRS+3*2)*4)(3))
|
||||
stw r18,((JB_GPRS+4)*4)(3)
|
||||
FP( stfd 18,((JB_FPRS+4*2)*4)(3))
|
||||
stw r19,((JB_GPRS+5)*4)(3)
|
||||
FP( stfd 19,((JB_FPRS+5*2)*4)(3))
|
||||
stw r20,((JB_GPRS+6)*4)(3)
|
||||
FP( stfd 20,((JB_FPRS+6*2)*4)(3))
|
||||
stw r21,((JB_GPRS+7)*4)(3)
|
||||
FP( stfd 21,((JB_FPRS+7*2)*4)(3))
|
||||
stw r22,((JB_GPRS+8)*4)(3)
|
||||
FP( stfd 22,((JB_FPRS+8*2)*4)(3))
|
||||
stw r23,((JB_GPRS+9)*4)(3)
|
||||
FP( stfd 23,((JB_FPRS+9*2)*4)(3))
|
||||
stw r24,((JB_GPRS+10)*4)(3)
|
||||
FP( stfd 24,((JB_FPRS+10*2)*4)(3))
|
||||
stw r25,((JB_GPRS+11)*4)(3)
|
||||
FP( stfd 25,((JB_FPRS+11*2)*4)(3))
|
||||
stw r26,((JB_GPRS+12)*4)(3)
|
||||
FP( stfd 26,((JB_FPRS+12*2)*4)(3))
|
||||
stw r27,((JB_GPRS+13)*4)(3)
|
||||
FP( stfd 27,((JB_FPRS+13*2)*4)(3))
|
||||
stw r28,((JB_GPRS+14)*4)(3)
|
||||
FP( stfd 28,((JB_FPRS+14*2)*4)(3))
|
||||
stw r29,((JB_GPRS+15)*4)(3)
|
||||
FP( stfd 29,((JB_FPRS+15*2)*4)(3))
|
||||
stw r30,((JB_GPRS+16)*4)(3)
|
||||
FP( stfd 30,((JB_FPRS+16*2)*4)(3))
|
||||
stw r31,((JB_GPRS+17)*4)(3)
|
||||
FP( stfd 31,((JB_FPRS+17*2)*4)(3))
|
||||
|
||||
li 3, 0
|
||||
blr
|
||||
365
examples/sched.c
Normal file
365
examples/sched.c
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <syscall.h>
|
||||
|
||||
/*
|
||||
* Author: Arun Dharankar <ADharankar@ATTBI.Com>
|
||||
*
|
||||
* A very simple thread/schedular model:
|
||||
* - only one master thread, and no parent child relation maintained
|
||||
* - parent thread cannot be stopped or deleted
|
||||
* - no permissions or credentials
|
||||
* - no elaborate safety checks
|
||||
* - cooperative multi threading
|
||||
* - Simple round-robin scheduleing with no priorities
|
||||
* - no metering/statistics collection
|
||||
*
|
||||
* Basic idea of implementing this is to allow more than one tests to
|
||||
* execute "simultaneously".
|
||||
*
|
||||
* This may be modified such thread_yield may be called in syscalls, and
|
||||
* timer interrupts.
|
||||
*/
|
||||
|
||||
|
||||
#define MAX_THREADS 8
|
||||
|
||||
#define CTX_SIZE 512
|
||||
#define STK_SIZE 8*1024
|
||||
|
||||
#define STATE_EMPTY 0
|
||||
#define STATE_RUNNABLE 1
|
||||
#define STATE_STOPPED 2
|
||||
#define STATE_TERMINATED 2
|
||||
|
||||
#define MASTER_THREAD 0
|
||||
|
||||
#define RC_FAILURE (-1)
|
||||
#define RC_SUCCESS (0)
|
||||
|
||||
typedef vu_char *jmp_ctx;
|
||||
unsigned long setctxsp (vu_char *sp);
|
||||
int ppc_setjmp(jmp_ctx env);
|
||||
void ppc_longjmp(jmp_ctx env, int val);
|
||||
#define setjmp ppc_setjmp
|
||||
#define longjmp ppc_longjmp
|
||||
|
||||
struct lthread {
|
||||
int state;
|
||||
int retval;
|
||||
char stack[STK_SIZE];
|
||||
uchar context[CTX_SIZE];
|
||||
int (*func) (void *);
|
||||
void *arg;
|
||||
};
|
||||
static volatile struct lthread lthreads[MAX_THREADS];
|
||||
static volatile int current_tid = MASTER_THREAD;
|
||||
|
||||
|
||||
static uchar dbg = 0;
|
||||
|
||||
#define PDEBUG(fmt, args...) { \
|
||||
if(dbg != 0) { \
|
||||
mon_printf("[%s %d %s]: ",__FILE__,__LINE__,__FUNCTION__);\
|
||||
mon_printf(fmt, ##args); \
|
||||
mon_printf("\n"); \
|
||||
} \
|
||||
}
|
||||
|
||||
static int testthread (void *);
|
||||
static void sched_init (void);
|
||||
static int thread_create (int (*func) (void *), void *arg);
|
||||
static int thread_start (int id);
|
||||
static void thread_yield (void);
|
||||
static int thread_delete (int id);
|
||||
static int thread_join (int *ret);
|
||||
|
||||
#if 0 /* not used yet */
|
||||
static int thread_stop (int id);
|
||||
#endif /* not used yet */
|
||||
|
||||
/* An example of schedular test */
|
||||
|
||||
#define NUMTHREADS 7
|
||||
int sched (bd_t * bd, int ac, char *av[])
|
||||
{
|
||||
int i, j;
|
||||
int tid[NUMTHREADS];
|
||||
int names[NUMTHREADS];
|
||||
|
||||
sched_init ();
|
||||
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
names[i] = i;
|
||||
j = thread_create (testthread, (void *) &names[i]);
|
||||
if (j == RC_FAILURE)
|
||||
mon_printf ("schedtest: Failed to create thread %d\n", i);
|
||||
if (j > 0) {
|
||||
mon_printf ("schedtest: Created thread with id %d, name %d\n",
|
||||
j, i);
|
||||
tid[i] = j;
|
||||
}
|
||||
}
|
||||
mon_printf ("schedtest: Threads created\n");
|
||||
|
||||
mon_printf ("sched_test: function=0x%08x\n", testthread);
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
mon_printf ("schedtest: Setting thread %d runnable\n", tid[i]);
|
||||
thread_start (tid[i]);
|
||||
thread_yield ();
|
||||
}
|
||||
mon_printf ("schedtest: Started %d threads\n", NUMTHREADS);
|
||||
|
||||
while (1) {
|
||||
mon_printf ("schedtest: Waiting for threads to complete\n");
|
||||
if (mon_tstc () && mon_getc () == 0x3) {
|
||||
mon_printf ("schedtest: Aborting threads...\n");
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
mon_printf ("schedtest: Deleting thread %d\n", tid[i]);
|
||||
thread_delete (tid[i]);
|
||||
}
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
j = -1;
|
||||
i = thread_join (&j);
|
||||
if (i == RC_FAILURE) {
|
||||
mon_printf ("schedtest: No threads pending, "
|
||||
"exiting schedular test\n");
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
mon_printf ("schedtest: thread is %d returned %d\n", i, j);
|
||||
thread_yield ();
|
||||
}
|
||||
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
|
||||
static int testthread (void *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
mon_printf ("testthread: Begin executing thread, myname %d, &i=0x%08x\n",
|
||||
*(int *) name, &i);
|
||||
|
||||
mon_printf ("Thread %02d, i=%d\n", *(int *) name);
|
||||
|
||||
for (i = 0; i < 0xffff * (*(int *) name + 1); i++) {
|
||||
if (mon_tstc () && mon_getc () == 0x3) {
|
||||
mon_printf ("testthread: myname %d terminating.\n",
|
||||
*(int *) name);
|
||||
return *(int *) name + 1;
|
||||
}
|
||||
|
||||
if (i % 100 == 0)
|
||||
thread_yield ();
|
||||
}
|
||||
|
||||
mon_printf ("testthread: returning %d, i=0x%x\n",
|
||||
*(int *) name + 1, i);
|
||||
|
||||
return *(int *) name + 1;
|
||||
}
|
||||
|
||||
|
||||
static void sched_init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = MASTER_THREAD + 1; i < MAX_THREADS; i++)
|
||||
lthreads[i].state = STATE_EMPTY;
|
||||
|
||||
current_tid = MASTER_THREAD;
|
||||
lthreads[current_tid].state = STATE_RUNNABLE;
|
||||
PDEBUG ("sched_init: master context = 0x%08x",
|
||||
lthreads[current_tid].context);
|
||||
return;
|
||||
}
|
||||
|
||||
static void thread_yield (void)
|
||||
{
|
||||
static int i;
|
||||
|
||||
PDEBUG ("thread_yield: current tid=%d", current_tid);
|
||||
|
||||
#define SWITCH(new) \
|
||||
if(lthreads[new].state == STATE_RUNNABLE) { \
|
||||
PDEBUG("thread_yield: %d match, ctx=0x%08x", \
|
||||
new, lthreads[current_tid].context); \
|
||||
if(setjmp(lthreads[current_tid].context) == 0) { \
|
||||
current_tid = new; \
|
||||
PDEBUG("thread_yield: tid %d returns 0", \
|
||||
new); \
|
||||
longjmp(lthreads[new].context, 1); \
|
||||
} else { \
|
||||
PDEBUG("thread_yield: tid %d returns 1", \
|
||||
new); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
for (i = current_tid + 1; i < MAX_THREADS; i++) {
|
||||
SWITCH (i);
|
||||
}
|
||||
|
||||
if (current_tid != 0) {
|
||||
for (i = 0; i <= current_tid; i++) {
|
||||
SWITCH (i);
|
||||
}
|
||||
}
|
||||
|
||||
PDEBUG ("thread_yield: returning from thread_yield");
|
||||
return;
|
||||
}
|
||||
|
||||
static int thread_create (int (*func) (void *), void *arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = MASTER_THREAD + 1; i < MAX_THREADS; i++) {
|
||||
if (lthreads[i].state == STATE_EMPTY) {
|
||||
lthreads[i].state = STATE_STOPPED;
|
||||
lthreads[i].func = func;
|
||||
lthreads[i].arg = arg;
|
||||
PDEBUG ("thread_create: returns new tid %d", i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
PDEBUG ("thread_create: returns failure");
|
||||
return RC_FAILURE;
|
||||
}
|
||||
|
||||
static int thread_delete (int id)
|
||||
{
|
||||
if (id <= MASTER_THREAD || id > MAX_THREADS)
|
||||
return RC_FAILURE;
|
||||
|
||||
if (current_tid == id)
|
||||
return RC_FAILURE;
|
||||
|
||||
lthreads[id].state = STATE_EMPTY;
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
|
||||
static void thread_launcher (void)
|
||||
{
|
||||
PDEBUG ("thread_launcher: invoking func=0x%08x",
|
||||
lthreads[current_tid].func);
|
||||
|
||||
lthreads[current_tid].retval =
|
||||
lthreads[current_tid].func (lthreads[current_tid].arg);
|
||||
|
||||
PDEBUG ("thread_launcher: tid %d terminated", current_tid);
|
||||
|
||||
lthreads[current_tid].state = STATE_TERMINATED;
|
||||
thread_yield ();
|
||||
mon_printf ("thread_launcher: should NEVER get here!\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int thread_start (int id)
|
||||
{
|
||||
PDEBUG ("thread_start: id=%d", id);
|
||||
if (id <= MASTER_THREAD || id > MAX_THREADS) {
|
||||
return RC_FAILURE;
|
||||
}
|
||||
|
||||
if (lthreads[id].state != STATE_STOPPED)
|
||||
return RC_FAILURE;
|
||||
|
||||
if (setjmp (lthreads[current_tid].context) == 0) {
|
||||
lthreads[id].state = STATE_RUNNABLE;
|
||||
current_tid = id;
|
||||
PDEBUG ("thread_start: to be stack=0%08x", lthreads[id].stack);
|
||||
setctxsp (<hreads[id].stack[STK_SIZE]);
|
||||
thread_launcher ();
|
||||
}
|
||||
|
||||
PDEBUG ("thread_start: Thread id=%d started, parent returns", id);
|
||||
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0 /* not used so far */
|
||||
static int thread_stop (int id)
|
||||
{
|
||||
if (id <= MASTER_THREAD || id >= MAX_THREADS)
|
||||
return RC_FAILURE;
|
||||
|
||||
if (current_tid == id)
|
||||
return RC_FAILURE;
|
||||
|
||||
lthreads[id].state = STATE_STOPPED;
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
#endif /* not used so far */
|
||||
|
||||
static int thread_join (int *ret)
|
||||
{
|
||||
int i, j = 0;
|
||||
|
||||
PDEBUG ("thread_join: *ret = %d", *ret);
|
||||
|
||||
if (!(*ret == -1 || *ret > MASTER_THREAD || *ret < MAX_THREADS)) {
|
||||
PDEBUG ("thread_join: invalid tid %d", *ret);
|
||||
return RC_FAILURE;
|
||||
}
|
||||
|
||||
if (*ret == -1) {
|
||||
PDEBUG ("Checking for tid = -1");
|
||||
while (1) {
|
||||
/* PDEBUG("thread_join: start while-loopn"); */
|
||||
j = 0;
|
||||
for (i = MASTER_THREAD + 1; i < MAX_THREADS; i++) {
|
||||
if (lthreads[i].state == STATE_TERMINATED) {
|
||||
*ret = lthreads[i].retval;
|
||||
lthreads[i].state = STATE_EMPTY;
|
||||
/* PDEBUG("thread_join: returning retval %d of tid %d",
|
||||
ret, i); */
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
|
||||
if (lthreads[i].state != STATE_EMPTY) {
|
||||
PDEBUG ("thread_join: %d used slots tid %d state=%d",
|
||||
j, i, lthreads[i].state);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
if (j == 0) {
|
||||
PDEBUG ("thread_join: all slots empty!");
|
||||
return RC_FAILURE;
|
||||
}
|
||||
/* PDEBUG("thread_join: yielding"); */
|
||||
thread_yield ();
|
||||
/* PDEBUG("thread_join: back from yield"); */
|
||||
}
|
||||
}
|
||||
|
||||
if (lthreads[*ret].state == STATE_TERMINATED) {
|
||||
i = *ret;
|
||||
*ret = lthreads[*ret].retval;
|
||||
lthreads[*ret].state = STATE_EMPTY;
|
||||
PDEBUG ("thread_join: returing %d for tid %d", *ret, i);
|
||||
return RC_SUCCESS;
|
||||
}
|
||||
|
||||
PDEBUG ("thread_join: thread %d is not terminated!", *ret);
|
||||
return RC_FAILURE;
|
||||
}
|
||||
@@ -1,349 +0,0 @@
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* ATMEL Microcontroller Software Support - ROUSSET - */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* The software is delivered "AS IS" without warranty or condition of any */
|
||||
/* kind, either express, implied or statutory. This includes without */
|
||||
/* limitation any warranty or condition with respect to merchantability or */
|
||||
/* fitness for any particular purpose, or against the infringements of */
|
||||
/* intellectual property rights of others. */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* File Name : AT91RM9200.h */
|
||||
/* Object : AT91RM9200 definitions */
|
||||
/* Generated : AT91 SW Application Group 10/29/2002 (16:10:51) */
|
||||
#ifndef AT91RM9200_H
|
||||
#define AT91RM9200_H
|
||||
|
||||
typedef volatile unsigned int AT91_REG;/* Hardware register definition */
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Timer Counter Channel Interface */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_TC {
|
||||
AT91_REG TC_CCR; /* Channel Control Register */
|
||||
AT91_REG TC_CMR; /* Channel Mode Register */
|
||||
AT91_REG Reserved0[2]; /* */
|
||||
AT91_REG TC_CV; /* Counter Value */
|
||||
AT91_REG TC_RA; /* Register A */
|
||||
AT91_REG TC_RB; /* Register B */
|
||||
AT91_REG TC_RC; /* Register C */
|
||||
AT91_REG TC_SR; /* Status Register */
|
||||
AT91_REG TC_IER; /* Interrupt Enable Register */
|
||||
AT91_REG TC_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG TC_IMR; /* Interrupt Mask Register */
|
||||
} AT91S_TC, *AT91PS_TC;
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Usart */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_USART {
|
||||
AT91_REG US_CR; /* Control Register */
|
||||
AT91_REG US_MR; /* Mode Register */
|
||||
AT91_REG US_IER; /* Interrupt Enable Register */
|
||||
AT91_REG US_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG US_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG US_CSR; /* Channel Status Register */
|
||||
AT91_REG US_RHR; /* Receiver Holding Register */
|
||||
AT91_REG US_THR; /* Transmitter Holding Register */
|
||||
AT91_REG US_BRGR; /* Baud Rate Generator Register */
|
||||
AT91_REG US_RTOR; /* Receiver Time-out Register */
|
||||
AT91_REG US_TTGR; /* Transmitter Time-guard Register */
|
||||
AT91_REG Reserved0[5]; /* */
|
||||
AT91_REG US_FIDI; /* FI_DI_Ratio Register */
|
||||
AT91_REG US_NER; /* Nb Errors Register */
|
||||
AT91_REG US_XXR; /* XON_XOFF Register */
|
||||
AT91_REG US_IF; /* IRDA_FILTER Register */
|
||||
AT91_REG Reserved1[44]; /* */
|
||||
AT91_REG US_RPR; /* Receive Pointer Register */
|
||||
AT91_REG US_RCR; /* Receive Counter Register */
|
||||
AT91_REG US_TPR; /* Transmit Pointer Register */
|
||||
AT91_REG US_TCR; /* Transmit Counter Register */
|
||||
AT91_REG US_RNPR; /* Receive Next Pointer Register */
|
||||
AT91_REG US_RNCR; /* Receive Next Counter Register */
|
||||
AT91_REG US_TNPR; /* Transmit Next Pointer Register */
|
||||
AT91_REG US_TNCR; /* Transmit Next Counter Register */
|
||||
AT91_REG US_PTCR; /* PDC Transfer Control Register */
|
||||
AT91_REG US_PTSR; /* PDC Transfer Status Register */
|
||||
} AT91S_USART, *AT91PS_USART;
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Parallel Input Output Controler */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_PIO {
|
||||
AT91_REG PIO_PER; /* PIO Enable Register */
|
||||
AT91_REG PIO_PDR; /* PIO Disable Register */
|
||||
AT91_REG PIO_PSR; /* PIO Status Register */
|
||||
AT91_REG Reserved0[1]; /* */
|
||||
AT91_REG PIO_OER; /* Output Enable Register */
|
||||
AT91_REG PIO_ODR; /* Output Disable Registerr */
|
||||
AT91_REG PIO_OSR; /* Output Status Register */
|
||||
AT91_REG Reserved1[1]; /* */
|
||||
AT91_REG PIO_IFER; /* Input Filter Enable Register */
|
||||
AT91_REG PIO_IFDR; /* Input Filter Disable Register */
|
||||
AT91_REG PIO_IFSR; /* Input Filter Status Register */
|
||||
AT91_REG Reserved2[1]; /* */
|
||||
AT91_REG PIO_SODR; /* Set Output Data Register */
|
||||
AT91_REG PIO_CODR; /* Clear Output Data Register */
|
||||
AT91_REG PIO_ODSR; /* Output Data Status Register */
|
||||
AT91_REG PIO_PDSR; /* Pin Data Status Register */
|
||||
AT91_REG PIO_IER; /* Interrupt Enable Register */
|
||||
AT91_REG PIO_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG PIO_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG PIO_ISR; /* Interrupt Status Register */
|
||||
AT91_REG PIO_MDER; /* Multi-driver Enable Register */
|
||||
AT91_REG PIO_MDDR; /* Multi-driver Disable Register */
|
||||
AT91_REG PIO_MDSR; /* Multi-driver Status Register */
|
||||
AT91_REG Reserved3[1]; /* */
|
||||
AT91_REG PIO_PPUDR; /* Pull-up Disable Register */
|
||||
AT91_REG PIO_PPUER; /* Pull-up Enable Register */
|
||||
AT91_REG PIO_PPUSR; /* Pad Pull-up Status Register */
|
||||
AT91_REG Reserved4[1]; /* */
|
||||
AT91_REG PIO_ASR; /* Select A Register */
|
||||
AT91_REG PIO_BSR; /* Select B Register */
|
||||
AT91_REG PIO_ABSR; /* AB Select Status Register */
|
||||
AT91_REG Reserved5[9]; /* */
|
||||
AT91_REG PIO_OWER; /* Output Write Enable Register */
|
||||
AT91_REG PIO_OWDR; /* Output Write Disable Register */
|
||||
AT91_REG PIO_OWSR; /* Output Write Status Register */
|
||||
} AT91S_PIO, *AT91PS_PIO;
|
||||
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Debug Unit */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_DBGU {
|
||||
AT91_REG DBGU_CR; /* Control Register */
|
||||
AT91_REG DBGU_MR; /* Mode Register */
|
||||
AT91_REG DBGU_IER; /* Interrupt Enable Register */
|
||||
AT91_REG DBGU_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG DBGU_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG DBGU_CSR; /* Channel Status Register */
|
||||
AT91_REG DBGU_RHR; /* Receiver Holding Register */
|
||||
AT91_REG DBGU_THR; /* Transmitter Holding Register */
|
||||
AT91_REG DBGU_BRGR; /* Baud Rate Generator Register */
|
||||
AT91_REG Reserved0[7]; /* */
|
||||
AT91_REG DBGU_C1R; /* Chip ID1 Register */
|
||||
AT91_REG DBGU_C2R; /* Chip ID2 Register */
|
||||
AT91_REG DBGU_FNTR; /* Force NTRST Register */
|
||||
AT91_REG Reserved1[45]; /* */
|
||||
AT91_REG DBGU_RPR; /* Receive Pointer Register */
|
||||
AT91_REG DBGU_RCR; /* Receive Counter Register */
|
||||
AT91_REG DBGU_TPR; /* Transmit Pointer Register */
|
||||
AT91_REG DBGU_TCR; /* Transmit Counter Register */
|
||||
AT91_REG DBGU_RNPR; /* Receive Next Pointer Register */
|
||||
AT91_REG DBGU_RNCR; /* Receive Next Counter Register */
|
||||
AT91_REG DBGU_TNPR; /* Transmit Next Pointer Register */
|
||||
AT91_REG DBGU_TNCR; /* Transmit Next Counter Register */
|
||||
AT91_REG DBGU_PTCR; /* PDC Transfer Control Register */
|
||||
AT91_REG DBGU_PTSR; /* PDC Transfer Status Register */
|
||||
} AT91S_DBGU, *AT91PS_DBGU;
|
||||
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Static Memory Controller 2 Interface */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_SMC2 {
|
||||
AT91_REG SMC2_CSR[8]; /* SMC2 Chip Select Register */
|
||||
} AT91S_SMC2, *AT91PS_SMC2;
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Ethernet MAC */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_EMAC {
|
||||
AT91_REG EMAC_CTL; /* Network Control Register */
|
||||
AT91_REG EMAC_CFG; /* Network Configuration Register */
|
||||
AT91_REG EMAC_SR; /* Network Status Register */
|
||||
AT91_REG EMAC_TAR; /* Transmit Address Register */
|
||||
AT91_REG EMAC_TCR; /* Transmit Control Register */
|
||||
AT91_REG EMAC_TSR; /* Transmit Status Register */
|
||||
AT91_REG EMAC_RBQP; /* Receive Buffer Queue Pointer */
|
||||
AT91_REG Reserved0[1]; /* */
|
||||
AT91_REG EMAC_RSR; /* Receive Status Register */
|
||||
AT91_REG EMAC_ISR; /* Interrupt Status Register */
|
||||
AT91_REG EMAC_IER; /* Interrupt Enable Register */
|
||||
AT91_REG EMAC_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG EMAC_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG EMAC_MAN; /* PHY Maintenance Register */
|
||||
AT91_REG Reserved1[2]; /* */
|
||||
AT91_REG EMAC_FRA; /* Frames Transmitted OK Register */
|
||||
AT91_REG EMAC_SCOL; /* Single Collision Frame Register */
|
||||
AT91_REG EMAC_MCOL; /* Multiple Collision Frame Register */
|
||||
AT91_REG EMAC_OK; /* Frames Received OK Register */
|
||||
AT91_REG EMAC_SEQE; /* Frame Check Sequence Error Register */
|
||||
AT91_REG EMAC_ALE; /* Alignment Error Register */
|
||||
AT91_REG EMAC_DTE; /* Deferred Transmission Frame Register */
|
||||
AT91_REG EMAC_LCOL; /* Late Collision Register */
|
||||
AT91_REG EMAC_ECOL; /* Excessive Collision Register */
|
||||
AT91_REG EMAC_CSE; /* Carrier Sense Error Register */
|
||||
AT91_REG EMAC_TUE; /* Transmit Underrun Error Register */
|
||||
AT91_REG EMAC_CDE; /* Code Error Register */
|
||||
AT91_REG EMAC_ELR; /* Excessive Length Error Register */
|
||||
AT91_REG EMAC_RJB; /* Receive Jabber Register */
|
||||
AT91_REG EMAC_USF; /* Undersize Frame Register */
|
||||
AT91_REG EMAC_SQEE; /* SQE Test Error Register */
|
||||
AT91_REG EMAC_DRFC; /* Discarded RX Frame Register */
|
||||
AT91_REG Reserved2[3]; /* */
|
||||
AT91_REG EMAC_HSH; /* Hash Address High[63:32] */
|
||||
AT91_REG EMAC_HSL; /* Hash Address Low[31:0] */
|
||||
AT91_REG EMAC_SA1L; /* Specific Address 1 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA1H; /* Specific Address 1 High, Last 2 bytes */
|
||||
AT91_REG EMAC_SA2L; /* Specific Address 2 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA2H; /* Specific Address 2 High, Last 2 bytes */
|
||||
AT91_REG EMAC_SA3L; /* Specific Address 3 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA3H; /* Specific Address 3 High, Last 2 bytes */
|
||||
AT91_REG EMAC_SA4L; /* Specific Address 4 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA4H; /* Specific Address 4 High, Last 2 bytesr */
|
||||
} AT91S_EMAC, *AT91PS_EMAC;
|
||||
|
||||
/* -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- */
|
||||
#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) /* (DBGU) RXRDY Interrupt */
|
||||
#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) /* (DBGU) TXRDY Interrupt */
|
||||
#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) /* (DBGU) End of Receive Transfer Interrupt */
|
||||
#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) /* (DBGU) End of Transmit Interrupt */
|
||||
#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) /* (DBGU) Overrun Interrupt */
|
||||
#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) /* (DBGU) Framing Error Interrupt */
|
||||
#define AT91C_US_PARE ((unsigned int) 0x1 << 7) /* (DBGU) Parity Error Interrupt */
|
||||
#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) /* (DBGU) TXEMPTY Interrupt */
|
||||
#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) /* (DBGU) TXBUFE Interrupt */
|
||||
#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) /* (DBGU) RXBUFF Interrupt */
|
||||
#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) /* (DBGU) COMM_TX Interrupt */
|
||||
#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) /* (DBGU) COMM_RX Interrupt */
|
||||
|
||||
/* -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- */
|
||||
#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) /* (DBGU) Reset Receiver */
|
||||
#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) /* (DBGU) Reset Transmitter */
|
||||
#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) /* (DBGU) Receiver Enable */
|
||||
#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) /* (DBGU) Receiver Disable */
|
||||
#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) /* (DBGU) Transmitter Enable */
|
||||
#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) /* (DBGU) Transmitter Disable */
|
||||
|
||||
#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) /* (USART) Clock */
|
||||
#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) /* (USART) Character Length: 8 bits */
|
||||
#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) /* (DBGU) No Parity */
|
||||
#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) /* (USART) 1 stop bit */
|
||||
|
||||
#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) /* (PMC) Peripheral Clock Enable Register */
|
||||
#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) /* (PIOA) PIO Disable Register */
|
||||
#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) /* Pin Controlled by PA30 */
|
||||
#define AT91C_PIO_PC0 ((unsigned int) 1 << 0) /* Pin Controlled by PC0 */
|
||||
#define AT91C_PC0_BFCK ((unsigned int) AT91C_PIO_PC0) /* Burst Flash Clock */
|
||||
#define AT91C_PA30_DRXD ((unsigned int) AT91C_PIO_PA30) /* DBGU Debug Receive Data */
|
||||
#define AT91C_PIO_PA31 ((unsigned int) 1 << 31) /* Pin Controlled by PA31 */
|
||||
#define AT91C_PA31_DTXD ((unsigned int) AT91C_PIO_PA31) /* DBGU Debug Transmit Data */
|
||||
|
||||
#define AT91C_ID_SYS ((unsigned int) 1) /* System Peripheral */
|
||||
#define AT91C_ID_TC0 ((unsigned int) 17) /* Timer Counter 0 */
|
||||
#define AT91C_ID_EMAC ((unsigned int) 24) /* Ethernet MAC */
|
||||
|
||||
#define AT91C_PIO_PC1 ((unsigned int) 1 << 1) /* Pin Controlled by PC1 */
|
||||
#define AT91C_PC1_BFRDY_SMOE ((unsigned int) AT91C_PIO_PC1) /* Burst Flash Ready */
|
||||
#define AT91C_PIO_PC3 ((unsigned int) 1 << 3) /* Pin Controlled by PC3 */
|
||||
#define AT91C_PC3_BFBAA_SMWE ((unsigned int) AT91C_PIO_PC3) /* Burst Flash Address Advance / SmartMedia Write Enable */
|
||||
#define AT91C_PIO_PC2 ((unsigned int) 1 << 2) /* Pin Controlled by PC2 */
|
||||
#define AT91C_PC2_BFAVD ((unsigned int) AT91C_PIO_PC2) /* Burst Flash Address Valid */
|
||||
#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) /* Pin Controlled by PB1 */
|
||||
|
||||
#define AT91C_TC_TIMER_DIV1_CLOCK ((unsigned int) 0x0 << 0) /* (TC) MCK/2 */
|
||||
#define AT91C_TC_TIMER_DIV2_CLOCK ((unsigned int) 0x1 << 0) /* (TC) MCK/8 */
|
||||
#define AT91C_TC_TIMER_DIV3_CLOCK ((unsigned int) 0x2 << 0) /* (TC) MCK/32 */
|
||||
#define AT91C_TC_TIMER_DIV4_CLOCK ((unsigned int) 0x3 << 0) /* (TC) MCK/128 */
|
||||
#define AT91C_TC_SLOW_CLOCK ((unsigned int) 0x4 << 0) /* (TC) SLOW CLK */
|
||||
#define AT91C_TC_XC0_CLOCK ((unsigned int) 0x5 << 0) /* (TC) XC0 */
|
||||
#define AT91C_TC_XC1_CLOCK ((unsigned int) 0x6 << 0) /* (TC) XC1 */
|
||||
#define AT91C_TC_XC2_CLOCK ((unsigned int) 0x7 << 0) /* (TC) XC2 */
|
||||
#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) /* (TCB) None signal connected to XC0 */
|
||||
#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) /* (TCB) None signal connected to XC1 */
|
||||
#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) /* (TCB) None signal connected to XC2 */
|
||||
#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) /* (TC) Counter Clock Disable Command */
|
||||
#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) /* (TC) Software Trigger Command */
|
||||
#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) /* (TC) Counter Clock Enable Command */
|
||||
|
||||
#define AT91C_EMAC_BNQ ((unsigned int) 0x1 << 4) /* (EMAC) */
|
||||
#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) /* (EMAC) */
|
||||
#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) /* (EMAC) */
|
||||
#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) /* (EMAC) Receive enable. */
|
||||
#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) /* (EMAC) Transmit enable. */
|
||||
#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) /* (EMAC) */
|
||||
#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 13) /* (EMAC) */
|
||||
#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) /* (EMAC) No broadcast. */
|
||||
#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) /* (EMAC) Copy all frames. */
|
||||
#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) /* (EMAC) */
|
||||
#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) /* (EMAC) */
|
||||
#define AT91C_EMAC_RSR_OVR ((unsigned int) 0x1 << 2) /* (EMAC) */
|
||||
#define AT91C_EMAC_CSR ((unsigned int) 0x1 << 5) /* (EMAC) Clear statistics registers. */
|
||||
#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) /* (EMAC) Speed. */
|
||||
#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) /* (EMAC) Full duplex. */
|
||||
#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 0) /* (EMAC) */
|
||||
#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) /* (EMAC) Management port enable. */
|
||||
#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) /* Pin Controlled by PA16 */
|
||||
#define AT91C_PA16_EMDIO ((unsigned int) AT91C_PIO_PA16) /* Ethernet MAC Management Data Input/Output */
|
||||
#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) /* Pin Controlled by PA15 */
|
||||
#define AT91C_PA15_EMDC ((unsigned int) AT91C_PIO_PA15) /* Ethernet MAC Management Data Clock */
|
||||
#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) /* Pin Controlled by PA14 */
|
||||
#define AT91C_PA14_ERXER ((unsigned int) AT91C_PIO_PA14) /* Ethernet MAC Receive Error */
|
||||
#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) /* Pin Controlled by PA13 */
|
||||
#define AT91C_PA13_ERX1 ((unsigned int) AT91C_PIO_PA13) /* Ethernet MAC Receive Data 1 */
|
||||
#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) /* Pin Controlled by PA12 */
|
||||
#define AT91C_PA12_ERX0 ((unsigned int) AT91C_PIO_PA12) /* Ethernet MAC Receive Data 0 */
|
||||
#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) /* Pin Controlled by PA11 */
|
||||
#define AT91C_PA11_ECRS_ECRSDV ((unsigned int) AT91C_PIO_PA11) /* Ethernet MAC Carrier Sense/Carrier Sense and Data Valid */
|
||||
#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) /* Pin Controlled by PA10 */
|
||||
#define AT91C_PA10_ETX1 ((unsigned int) AT91C_PIO_PA10) /* Ethernet MAC Transmit Data 1 */
|
||||
#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) /* Pin Controlled by PA9 */
|
||||
#define AT91C_PA9_ETX0 ((unsigned int) AT91C_PIO_PA9) /* Ethernet MAC Transmit Data 0 */
|
||||
#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) /* Pin Controlled by PA8 */
|
||||
#define AT91C_PA8_ETXEN ((unsigned int) AT91C_PIO_PA8) /* Ethernet MAC Transmit Enable */
|
||||
#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) /* Pin Controlled by PA7 */
|
||||
#define AT91C_PA7_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PA7) /* Ethernet MAC Transmit Clock/Reference Clock */
|
||||
#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) /* Pin Controlled by PB25 */
|
||||
#define AT91C_PB25_DSR1 ((unsigned int) AT91C_PIO_PB25) /* USART 1 Data Set ready */
|
||||
#define AT91C_PB25_EF100 ((unsigned int) AT91C_PIO_PB25) /* Ethernet MAC Force 100 Mbits */
|
||||
#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) /* Pin Controlled by PB19 */
|
||||
#define AT91C_PB19_DTR1 ((unsigned int) AT91C_PIO_PB19) /* USART 1 Data Terminal ready */
|
||||
#define AT91C_PB19_ERXCK ((unsigned int) AT91C_PIO_PB19) /* Ethernet MAC Receive Clock */
|
||||
#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) /* Pin Controlled by PB18 */
|
||||
#define AT91C_PB18_RI1 ((unsigned int) AT91C_PIO_PB18) /* USART 1 Ring Indicator */
|
||||
#define AT91C_PB18_ECOL ((unsigned int) AT91C_PIO_PB18) /* Ethernet MAC Collision Detected */
|
||||
#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) /* Pin Controlled by PB17 */
|
||||
#define AT91C_PB17_RF2 ((unsigned int) AT91C_PIO_PB17) /* SSC Receive Frame Sync 2 */
|
||||
#define AT91C_PB17_ERXDV ((unsigned int) AT91C_PIO_PB17) /* Ethernet MAC Receive Data Valid */
|
||||
#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) /* Pin Controlled by PB16 */
|
||||
#define AT91C_PB16_RK2 ((unsigned int) AT91C_PIO_PB16) /* SSC Receive Clock 2 */
|
||||
#define AT91C_PB16_ERX3 ((unsigned int) AT91C_PIO_PB16) /* Ethernet MAC Receive Data 3 */
|
||||
#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) /* Pin Controlled by PB15 */
|
||||
#define AT91C_PB15_RD2 ((unsigned int) AT91C_PIO_PB15) /* SSC Receive Data 2 */
|
||||
#define AT91C_PB15_ERX2 ((unsigned int) AT91C_PIO_PB15) /* Ethernet MAC Receive Data 2 */
|
||||
#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) /* Pin Controlled by PB14 */
|
||||
#define AT91C_PB14_TD2 ((unsigned int) AT91C_PIO_PB14) /* SSC Transmit Data 2 */
|
||||
#define AT91C_PB14_ETXER ((unsigned int) AT91C_PIO_PB14) /* Ethernet MAC Transmikt Coding Error */
|
||||
#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) /* Pin Controlled by PB13 */
|
||||
#define AT91C_PB13_TK2 ((unsigned int) AT91C_PIO_PB13) /* SSC Transmit Clock 2 */
|
||||
#define AT91C_PB13_ETX3 ((unsigned int) AT91C_PIO_PB13) /* Ethernet MAC Transmit Data 3 */
|
||||
#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) /* Pin Controlled by PB12 */
|
||||
#define AT91C_PB12_TF2 ((unsigned int) AT91C_PIO_PB12) /* SSC Transmit Frame Sync 2 */
|
||||
#define AT91C_PB12_ETX2 ((unsigned int) AT91C_PIO_PB12) /* Ethernet MAC Transmit Data 2 */
|
||||
|
||||
#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) /* (PIOB) Select B Register */
|
||||
#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFBC000) /* (EMAC) Base Address */
|
||||
#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) /* (PIOB) PIO Disable Register */
|
||||
|
||||
#define AT91C_EBI_CS3A_SMC_SmartMedia ((unsigned int) 0x1 << 3) /* (EBI) Chip Select 3 is assigned to the Static Memory Controller and the SmartMedia Logic is activated. */
|
||||
#define AT91C_SMC2_ACSS_STANDARD ((unsigned int) 0x0 << 16) /* (SMC2) Standard, asserted at the beginning of the access and deasserted at the end. */
|
||||
#define AT91C_SMC2_DBW_8 ((unsigned int) 0x2 << 13) /* (SMC2) 8-bit. */
|
||||
#define AT91C_SMC2_WSEN ((unsigned int) 0x1 << 7) /* (SMC2) Wait State Enable */
|
||||
#define AT91C_PIOC_ASR ((AT91_REG *) 0xFFFFF870) /* (PIOC) Select A Register */
|
||||
|
||||
#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) /* (TC0) Base Address */
|
||||
#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) /* (DBGU) Base Address */
|
||||
#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) /* (PIOA) Base Address */
|
||||
#define AT91C_EBI_CSA ((AT91_REG *) 0xFFFFFF60) /* (EBI) Chip Select Assignment Register */
|
||||
#define AT91C_BASE_SMC2 ((AT91PS_SMC2) 0xFFFFFF70) /* (SMC2) Base Address */
|
||||
#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) /* (US1) Base Address */
|
||||
#define AT91C_TCB0_BMR ((AT91_REG *) 0xFFFA00C4) /* (TCB0) TC Block Mode Register */
|
||||
#define AT91C_TCB0_BCR ((AT91_REG *) 0xFFFA00C0) /* (TCB0) TC Block Control Register */
|
||||
#define AT91C_PIOC_PDR ((AT91_REG *) 0xFFFFF804) /* (PIOC) PIO Disable Register */
|
||||
#define AT91C_PIOC_PER ((AT91_REG *) 0xFFFFF800) /* (PIOC) PIO Enable Register */
|
||||
#define AT91C_PIOC_ODR ((AT91_REG *) 0xFFFFF814) /* (PIOC) Output Disable Registerr */
|
||||
#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) /* (PIOB) PIO Enable Register */
|
||||
#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) /* (PIOB) Output Disable Registerr */
|
||||
#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) /* (PIOB) Pin Data Status Register */
|
||||
#endif
|
||||
352
include/asm-arm/arch-at91rm9200/AT91RM9200.h
Normal file
352
include/asm-arm/arch-at91rm9200/AT91RM9200.h
Normal file
@@ -0,0 +1,352 @@
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* ATMEL Microcontroller Software Support - ROUSSET - */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* The software is delivered "AS IS" without warranty or condition of any */
|
||||
/* kind, either express, implied or statutory. This includes without */
|
||||
/* limitation any warranty or condition with respect to merchantability or */
|
||||
/* fitness for any particular purpose, or against the infringements of */
|
||||
/* intellectual property rights of others. */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* File Name : AT91RM9200.h */
|
||||
/* Object : AT91RM9200 definitions */
|
||||
/* Generated : AT91 SW Application Group 10/29/2002 (16:10:51) */
|
||||
#ifndef AT91RM9200_H
|
||||
#define AT91RM9200_H
|
||||
|
||||
typedef volatile unsigned int AT91_REG;/* Hardware register definition */
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Timer Counter Channel Interface */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_TC {
|
||||
AT91_REG TC_CCR; /* Channel Control Register */
|
||||
AT91_REG TC_CMR; /* Channel Mode Register */
|
||||
AT91_REG Reserved0[2]; /* */
|
||||
AT91_REG TC_CV; /* Counter Value */
|
||||
AT91_REG TC_RA; /* Register A */
|
||||
AT91_REG TC_RB; /* Register B */
|
||||
AT91_REG TC_RC; /* Register C */
|
||||
AT91_REG TC_SR; /* Status Register */
|
||||
AT91_REG TC_IER; /* Interrupt Enable Register */
|
||||
AT91_REG TC_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG TC_IMR; /* Interrupt Mask Register */
|
||||
} AT91S_TC, *AT91PS_TC;
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Usart */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_USART {
|
||||
AT91_REG US_CR; /* Control Register */
|
||||
AT91_REG US_MR; /* Mode Register */
|
||||
AT91_REG US_IER; /* Interrupt Enable Register */
|
||||
AT91_REG US_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG US_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG US_CSR; /* Channel Status Register */
|
||||
AT91_REG US_RHR; /* Receiver Holding Register */
|
||||
AT91_REG US_THR; /* Transmitter Holding Register */
|
||||
AT91_REG US_BRGR; /* Baud Rate Generator Register */
|
||||
AT91_REG US_RTOR; /* Receiver Time-out Register */
|
||||
AT91_REG US_TTGR; /* Transmitter Time-guard Register */
|
||||
AT91_REG Reserved0[5]; /* */
|
||||
AT91_REG US_FIDI; /* FI_DI_Ratio Register */
|
||||
AT91_REG US_NER; /* Nb Errors Register */
|
||||
AT91_REG US_XXR; /* XON_XOFF Register */
|
||||
AT91_REG US_IF; /* IRDA_FILTER Register */
|
||||
AT91_REG Reserved1[44]; /* */
|
||||
AT91_REG US_RPR; /* Receive Pointer Register */
|
||||
AT91_REG US_RCR; /* Receive Counter Register */
|
||||
AT91_REG US_TPR; /* Transmit Pointer Register */
|
||||
AT91_REG US_TCR; /* Transmit Counter Register */
|
||||
AT91_REG US_RNPR; /* Receive Next Pointer Register */
|
||||
AT91_REG US_RNCR; /* Receive Next Counter Register */
|
||||
AT91_REG US_TNPR; /* Transmit Next Pointer Register */
|
||||
AT91_REG US_TNCR; /* Transmit Next Counter Register */
|
||||
AT91_REG US_PTCR; /* PDC Transfer Control Register */
|
||||
AT91_REG US_PTSR; /* PDC Transfer Status Register */
|
||||
} AT91S_USART, *AT91PS_USART;
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Parallel Input Output Controler */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_PIO {
|
||||
AT91_REG PIO_PER; /* PIO Enable Register */
|
||||
AT91_REG PIO_PDR; /* PIO Disable Register */
|
||||
AT91_REG PIO_PSR; /* PIO Status Register */
|
||||
AT91_REG Reserved0[1]; /* */
|
||||
AT91_REG PIO_OER; /* Output Enable Register */
|
||||
AT91_REG PIO_ODR; /* Output Disable Registerr */
|
||||
AT91_REG PIO_OSR; /* Output Status Register */
|
||||
AT91_REG Reserved1[1]; /* */
|
||||
AT91_REG PIO_IFER; /* Input Filter Enable Register */
|
||||
AT91_REG PIO_IFDR; /* Input Filter Disable Register */
|
||||
AT91_REG PIO_IFSR; /* Input Filter Status Register */
|
||||
AT91_REG Reserved2[1]; /* */
|
||||
AT91_REG PIO_SODR; /* Set Output Data Register */
|
||||
AT91_REG PIO_CODR; /* Clear Output Data Register */
|
||||
AT91_REG PIO_ODSR; /* Output Data Status Register */
|
||||
AT91_REG PIO_PDSR; /* Pin Data Status Register */
|
||||
AT91_REG PIO_IER; /* Interrupt Enable Register */
|
||||
AT91_REG PIO_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG PIO_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG PIO_ISR; /* Interrupt Status Register */
|
||||
AT91_REG PIO_MDER; /* Multi-driver Enable Register */
|
||||
AT91_REG PIO_MDDR; /* Multi-driver Disable Register */
|
||||
AT91_REG PIO_MDSR; /* Multi-driver Status Register */
|
||||
AT91_REG Reserved3[1]; /* */
|
||||
AT91_REG PIO_PPUDR; /* Pull-up Disable Register */
|
||||
AT91_REG PIO_PPUER; /* Pull-up Enable Register */
|
||||
AT91_REG PIO_PPUSR; /* Pad Pull-up Status Register */
|
||||
AT91_REG Reserved4[1]; /* */
|
||||
AT91_REG PIO_ASR; /* Select A Register */
|
||||
AT91_REG PIO_BSR; /* Select B Register */
|
||||
AT91_REG PIO_ABSR; /* AB Select Status Register */
|
||||
AT91_REG Reserved5[9]; /* */
|
||||
AT91_REG PIO_OWER; /* Output Write Enable Register */
|
||||
AT91_REG PIO_OWDR; /* Output Write Disable Register */
|
||||
AT91_REG PIO_OWSR; /* Output Write Status Register */
|
||||
} AT91S_PIO, *AT91PS_PIO;
|
||||
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Debug Unit */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_DBGU {
|
||||
AT91_REG DBGU_CR; /* Control Register */
|
||||
AT91_REG DBGU_MR; /* Mode Register */
|
||||
AT91_REG DBGU_IER; /* Interrupt Enable Register */
|
||||
AT91_REG DBGU_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG DBGU_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG DBGU_CSR; /* Channel Status Register */
|
||||
AT91_REG DBGU_RHR; /* Receiver Holding Register */
|
||||
AT91_REG DBGU_THR; /* Transmitter Holding Register */
|
||||
AT91_REG DBGU_BRGR; /* Baud Rate Generator Register */
|
||||
AT91_REG Reserved0[7]; /* */
|
||||
AT91_REG DBGU_C1R; /* Chip ID1 Register */
|
||||
AT91_REG DBGU_C2R; /* Chip ID2 Register */
|
||||
AT91_REG DBGU_FNTR; /* Force NTRST Register */
|
||||
AT91_REG Reserved1[45]; /* */
|
||||
AT91_REG DBGU_RPR; /* Receive Pointer Register */
|
||||
AT91_REG DBGU_RCR; /* Receive Counter Register */
|
||||
AT91_REG DBGU_TPR; /* Transmit Pointer Register */
|
||||
AT91_REG DBGU_TCR; /* Transmit Counter Register */
|
||||
AT91_REG DBGU_RNPR; /* Receive Next Pointer Register */
|
||||
AT91_REG DBGU_RNCR; /* Receive Next Counter Register */
|
||||
AT91_REG DBGU_TNPR; /* Transmit Next Pointer Register */
|
||||
AT91_REG DBGU_TNCR; /* Transmit Next Counter Register */
|
||||
AT91_REG DBGU_PTCR; /* PDC Transfer Control Register */
|
||||
AT91_REG DBGU_PTSR; /* PDC Transfer Status Register */
|
||||
} AT91S_DBGU, *AT91PS_DBGU;
|
||||
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Static Memory Controller 2 Interface */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_SMC2 {
|
||||
AT91_REG SMC2_CSR[8]; /* SMC2 Chip Select Register */
|
||||
} AT91S_SMC2, *AT91PS_SMC2;
|
||||
|
||||
/* ***************************************************************************** */
|
||||
/* SOFTWARE API DEFINITION FOR Ethernet MAC */
|
||||
/* ***************************************************************************** */
|
||||
typedef struct _AT91S_EMAC {
|
||||
AT91_REG EMAC_CTL; /* Network Control Register */
|
||||
AT91_REG EMAC_CFG; /* Network Configuration Register */
|
||||
AT91_REG EMAC_SR; /* Network Status Register */
|
||||
AT91_REG EMAC_TAR; /* Transmit Address Register */
|
||||
AT91_REG EMAC_TCR; /* Transmit Control Register */
|
||||
AT91_REG EMAC_TSR; /* Transmit Status Register */
|
||||
AT91_REG EMAC_RBQP; /* Receive Buffer Queue Pointer */
|
||||
AT91_REG Reserved0[1]; /* */
|
||||
AT91_REG EMAC_RSR; /* Receive Status Register */
|
||||
AT91_REG EMAC_ISR; /* Interrupt Status Register */
|
||||
AT91_REG EMAC_IER; /* Interrupt Enable Register */
|
||||
AT91_REG EMAC_IDR; /* Interrupt Disable Register */
|
||||
AT91_REG EMAC_IMR; /* Interrupt Mask Register */
|
||||
AT91_REG EMAC_MAN; /* PHY Maintenance Register */
|
||||
AT91_REG Reserved1[2]; /* */
|
||||
AT91_REG EMAC_FRA; /* Frames Transmitted OK Register */
|
||||
AT91_REG EMAC_SCOL; /* Single Collision Frame Register */
|
||||
AT91_REG EMAC_MCOL; /* Multiple Collision Frame Register */
|
||||
AT91_REG EMAC_OK; /* Frames Received OK Register */
|
||||
AT91_REG EMAC_SEQE; /* Frame Check Sequence Error Register */
|
||||
AT91_REG EMAC_ALE; /* Alignment Error Register */
|
||||
AT91_REG EMAC_DTE; /* Deferred Transmission Frame Register */
|
||||
AT91_REG EMAC_LCOL; /* Late Collision Register */
|
||||
AT91_REG EMAC_ECOL; /* Excessive Collision Register */
|
||||
AT91_REG EMAC_CSE; /* Carrier Sense Error Register */
|
||||
AT91_REG EMAC_TUE; /* Transmit Underrun Error Register */
|
||||
AT91_REG EMAC_CDE; /* Code Error Register */
|
||||
AT91_REG EMAC_ELR; /* Excessive Length Error Register */
|
||||
AT91_REG EMAC_RJB; /* Receive Jabber Register */
|
||||
AT91_REG EMAC_USF; /* Undersize Frame Register */
|
||||
AT91_REG EMAC_SQEE; /* SQE Test Error Register */
|
||||
AT91_REG EMAC_DRFC; /* Discarded RX Frame Register */
|
||||
AT91_REG Reserved2[3]; /* */
|
||||
AT91_REG EMAC_HSH; /* Hash Address High[63:32] */
|
||||
AT91_REG EMAC_HSL; /* Hash Address Low[31:0] */
|
||||
AT91_REG EMAC_SA1L; /* Specific Address 1 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA1H; /* Specific Address 1 High, Last 2 bytes */
|
||||
AT91_REG EMAC_SA2L; /* Specific Address 2 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA2H; /* Specific Address 2 High, Last 2 bytes */
|
||||
AT91_REG EMAC_SA3L; /* Specific Address 3 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA3H; /* Specific Address 3 High, Last 2 bytes */
|
||||
AT91_REG EMAC_SA4L; /* Specific Address 4 Low, First 4 bytes */
|
||||
AT91_REG EMAC_SA4H; /* Specific Address 4 High, Last 2 bytesr */
|
||||
} AT91S_EMAC, *AT91PS_EMAC;
|
||||
|
||||
/* -------- DBGU_IER : (DBGU Offset: 0x8) Debug Unit Interrupt Enable Register -------- */
|
||||
#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) /* (DBGU) RXRDY Interrupt */
|
||||
#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) /* (DBGU) TXRDY Interrupt */
|
||||
#define AT91C_US_ENDRX ((unsigned int) 0x1 << 3) /* (DBGU) End of Receive Transfer Interrupt */
|
||||
#define AT91C_US_ENDTX ((unsigned int) 0x1 << 4) /* (DBGU) End of Transmit Interrupt */
|
||||
#define AT91C_US_OVRE ((unsigned int) 0x1 << 5) /* (DBGU) Overrun Interrupt */
|
||||
#define AT91C_US_FRAME ((unsigned int) 0x1 << 6) /* (DBGU) Framing Error Interrupt */
|
||||
#define AT91C_US_PARE ((unsigned int) 0x1 << 7) /* (DBGU) Parity Error Interrupt */
|
||||
#define AT91C_US_TXEMPTY ((unsigned int) 0x1 << 9) /* (DBGU) TXEMPTY Interrupt */
|
||||
#define AT91C_US_TXBUFE ((unsigned int) 0x1 << 11) /* (DBGU) TXBUFE Interrupt */
|
||||
#define AT91C_US_RXBUFF ((unsigned int) 0x1 << 12) /* (DBGU) RXBUFF Interrupt */
|
||||
#define AT91C_US_COMM_TX ((unsigned int) 0x1 << 30) /* (DBGU) COMM_TX Interrupt */
|
||||
#define AT91C_US_COMM_RX ((unsigned int) 0x1 << 31) /* (DBGU) COMM_RX Interrupt */
|
||||
|
||||
/* -------- DBGU_CR : (DBGU Offset: 0x0) Debug Unit Control Register -------- */
|
||||
#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) /* (DBGU) Reset Receiver */
|
||||
#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) /* (DBGU) Reset Transmitter */
|
||||
#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) /* (DBGU) Receiver Enable */
|
||||
#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) /* (DBGU) Receiver Disable */
|
||||
#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) /* (DBGU) Transmitter Enable */
|
||||
#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) /* (DBGU) Transmitter Disable */
|
||||
|
||||
#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) /* (USART) Clock */
|
||||
#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) /* (USART) Character Length: 8 bits */
|
||||
#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) /* (DBGU) No Parity */
|
||||
#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) /* (USART) 1 stop bit */
|
||||
|
||||
#define AT91C_PMC_PCER ((AT91_REG *) 0xFFFFFC10) /* (PMC) Peripheral Clock Enable Register */
|
||||
#define AT91C_PIOA_PDR ((AT91_REG *) 0xFFFFF404) /* (PIOA) PIO Disable Register */
|
||||
#define AT91C_PIO_PA30 ((unsigned int) 1 << 30) /* Pin Controlled by PA30 */
|
||||
#define AT91C_PIO_PC0 ((unsigned int) 1 << 0) /* Pin Controlled by PC0 */
|
||||
#define AT91C_PC0_BFCK ((unsigned int) AT91C_PIO_PC0) /* Burst Flash Clock */
|
||||
#define AT91C_PA30_DRXD ((unsigned int) AT91C_PIO_PA30) /* DBGU Debug Receive Data */
|
||||
#define AT91C_PIO_PA31 ((unsigned int) 1 << 31) /* Pin Controlled by PA31 */
|
||||
#define AT91C_PA31_DTXD ((unsigned int) AT91C_PIO_PA31) /* DBGU Debug Transmit Data */
|
||||
|
||||
#define AT91C_ID_SYS ((unsigned int) 1) /* System Peripheral */
|
||||
#define AT91C_ID_TC0 ((unsigned int) 17) /* Timer Counter 0 */
|
||||
#define AT91C_ID_EMAC ((unsigned int) 24) /* Ethernet MAC */
|
||||
|
||||
#define AT91C_PIO_PC1 ((unsigned int) 1 << 1) /* Pin Controlled by PC1 */
|
||||
#define AT91C_PC1_BFRDY_SMOE ((unsigned int) AT91C_PIO_PC1) /* Burst Flash Ready */
|
||||
#define AT91C_PIO_PC3 ((unsigned int) 1 << 3) /* Pin Controlled by PC3 */
|
||||
#define AT91C_PC3_BFBAA_SMWE ((unsigned int) AT91C_PIO_PC3) /* Burst Flash Address Advance / SmartMedia Write Enable */
|
||||
#define AT91C_PIO_PC2 ((unsigned int) 1 << 2) /* Pin Controlled by PC2 */
|
||||
#define AT91C_PC2_BFAVD ((unsigned int) AT91C_PIO_PC2) /* Burst Flash Address Valid */
|
||||
#define AT91C_PIO_PB1 ((unsigned int) 1 << 1) /* Pin Controlled by PB1 */
|
||||
|
||||
#define AT91C_TC_TIMER_DIV1_CLOCK ((unsigned int) 0x0 << 0) /* (TC) MCK/2 */
|
||||
#define AT91C_TC_TIMER_DIV2_CLOCK ((unsigned int) 0x1 << 0) /* (TC) MCK/8 */
|
||||
#define AT91C_TC_TIMER_DIV3_CLOCK ((unsigned int) 0x2 << 0) /* (TC) MCK/32 */
|
||||
#define AT91C_TC_TIMER_DIV4_CLOCK ((unsigned int) 0x3 << 0) /* (TC) MCK/128 */
|
||||
#define AT91C_TC_SLOW_CLOCK ((unsigned int) 0x4 << 0) /* (TC) SLOW CLK */
|
||||
#define AT91C_TC_XC0_CLOCK ((unsigned int) 0x5 << 0) /* (TC) XC0 */
|
||||
#define AT91C_TC_XC1_CLOCK ((unsigned int) 0x6 << 0) /* (TC) XC1 */
|
||||
#define AT91C_TC_XC2_CLOCK ((unsigned int) 0x7 << 0) /* (TC) XC2 */
|
||||
#define AT91C_TCB_TC0XC0S_NONE ((unsigned int) 0x1) /* (TCB) None signal connected to XC0 */
|
||||
#define AT91C_TCB_TC1XC1S_NONE ((unsigned int) 0x1 << 2) /* (TCB) None signal connected to XC1 */
|
||||
#define AT91C_TCB_TC2XC2S_NONE ((unsigned int) 0x1 << 4) /* (TCB) None signal connected to XC2 */
|
||||
#define AT91C_TC_CLKDIS ((unsigned int) 0x1 << 1) /* (TC) Counter Clock Disable Command */
|
||||
#define AT91C_TC_SWTRG ((unsigned int) 0x1 << 2) /* (TC) Software Trigger Command */
|
||||
#define AT91C_TC_CLKEN ((unsigned int) 0x1 << 0) /* (TC) Counter Clock Enable Command */
|
||||
|
||||
#define AT91C_EMAC_BNQ ((unsigned int) 0x1 << 4) /* (EMAC) */
|
||||
#define AT91C_EMAC_COMP ((unsigned int) 0x1 << 5) /* (EMAC) */
|
||||
#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) /* (EMAC) */
|
||||
#define AT91C_EMAC_RE ((unsigned int) 0x1 << 2) /* (EMAC) Receive enable. */
|
||||
#define AT91C_EMAC_TE ((unsigned int) 0x1 << 3) /* (EMAC) Transmit enable. */
|
||||
#define AT91C_EMAC_CLK ((unsigned int) 0x3 << 10) /* (EMAC) */
|
||||
#define AT91C_EMAC_RMII ((unsigned int) 0x1 << 13) /* (EMAC) */
|
||||
#define AT91C_EMAC_NBC ((unsigned int) 0x1 << 5) /* (EMAC) No broadcast. */
|
||||
#define AT91C_EMAC_CAF ((unsigned int) 0x1 << 4) /* (EMAC) Copy all frames. */
|
||||
#define AT91C_EMAC_BNA ((unsigned int) 0x1 << 0) /* (EMAC) */
|
||||
#define AT91C_EMAC_REC ((unsigned int) 0x1 << 1) /* (EMAC) */
|
||||
#define AT91C_EMAC_RSR_OVR ((unsigned int) 0x1 << 2) /* (EMAC) */
|
||||
#define AT91C_EMAC_CSR ((unsigned int) 0x1 << 5) /* (EMAC) Clear statistics registers. */
|
||||
#define AT91C_EMAC_SPD ((unsigned int) 0x1 << 0) /* (EMAC) Speed. */
|
||||
#define AT91C_EMAC_FD ((unsigned int) 0x1 << 1) /* (EMAC) Full duplex. */
|
||||
#define AT91C_EMAC_LINK ((unsigned int) 0x1 << 0) /* (EMAC) */
|
||||
#define AT91C_EMAC_MPE ((unsigned int) 0x1 << 4) /* (EMAC) Management port enable. */
|
||||
#define AT91C_PIO_PA16 ((unsigned int) 1 << 16) /* Pin Controlled by PA16 */
|
||||
#define AT91C_PA16_EMDIO ((unsigned int) AT91C_PIO_PA16) /* Ethernet MAC Management Data Input/Output */
|
||||
#define AT91C_PIO_PA15 ((unsigned int) 1 << 15) /* Pin Controlled by PA15 */
|
||||
#define AT91C_PA15_EMDC ((unsigned int) AT91C_PIO_PA15) /* Ethernet MAC Management Data Clock */
|
||||
#define AT91C_PIO_PA14 ((unsigned int) 1 << 14) /* Pin Controlled by PA14 */
|
||||
#define AT91C_PA14_ERXER ((unsigned int) AT91C_PIO_PA14) /* Ethernet MAC Receive Error */
|
||||
#define AT91C_PIO_PA13 ((unsigned int) 1 << 13) /* Pin Controlled by PA13 */
|
||||
#define AT91C_PA13_ERX1 ((unsigned int) AT91C_PIO_PA13) /* Ethernet MAC Receive Data 1 */
|
||||
#define AT91C_PIO_PA12 ((unsigned int) 1 << 12) /* Pin Controlled by PA12 */
|
||||
#define AT91C_PA12_ERX0 ((unsigned int) AT91C_PIO_PA12) /* Ethernet MAC Receive Data 0 */
|
||||
#define AT91C_PIO_PA11 ((unsigned int) 1 << 11) /* Pin Controlled by PA11 */
|
||||
#define AT91C_PA11_ECRS_ECRSDV ((unsigned int) AT91C_PIO_PA11) /* Ethernet MAC Carrier Sense/Carrier Sense and Data Valid */
|
||||
#define AT91C_PIO_PA10 ((unsigned int) 1 << 10) /* Pin Controlled by PA10 */
|
||||
#define AT91C_PA10_ETX1 ((unsigned int) AT91C_PIO_PA10) /* Ethernet MAC Transmit Data 1 */
|
||||
#define AT91C_PIO_PA9 ((unsigned int) 1 << 9) /* Pin Controlled by PA9 */
|
||||
#define AT91C_PA9_ETX0 ((unsigned int) AT91C_PIO_PA9) /* Ethernet MAC Transmit Data 0 */
|
||||
#define AT91C_PIO_PA8 ((unsigned int) 1 << 8) /* Pin Controlled by PA8 */
|
||||
#define AT91C_PA8_ETXEN ((unsigned int) AT91C_PIO_PA8) /* Ethernet MAC Transmit Enable */
|
||||
#define AT91C_PIO_PA7 ((unsigned int) 1 << 7) /* Pin Controlled by PA7 */
|
||||
#define AT91C_PA7_ETXCK_EREFCK ((unsigned int) AT91C_PIO_PA7) /* Ethernet MAC Transmit Clock/Reference Clock */
|
||||
#define AT91C_PIO_PB25 ((unsigned int) 1 << 25) /* Pin Controlled by PB25 */
|
||||
#define AT91C_PB25_DSR1 ((unsigned int) AT91C_PIO_PB25) /* USART 1 Data Set ready */
|
||||
#define AT91C_PB25_EF100 ((unsigned int) AT91C_PIO_PB25) /* Ethernet MAC Force 100 Mbits */
|
||||
#define AT91C_PIO_PB19 ((unsigned int) 1 << 19) /* Pin Controlled by PB19 */
|
||||
#define AT91C_PB19_DTR1 ((unsigned int) AT91C_PIO_PB19) /* USART 1 Data Terminal ready */
|
||||
#define AT91C_PB19_ERXCK ((unsigned int) AT91C_PIO_PB19) /* Ethernet MAC Receive Clock */
|
||||
#define AT91C_PIO_PB18 ((unsigned int) 1 << 18) /* Pin Controlled by PB18 */
|
||||
#define AT91C_PB18_RI1 ((unsigned int) AT91C_PIO_PB18) /* USART 1 Ring Indicator */
|
||||
#define AT91C_PB18_ECOL ((unsigned int) AT91C_PIO_PB18) /* Ethernet MAC Collision Detected */
|
||||
#define AT91C_PIO_PB17 ((unsigned int) 1 << 17) /* Pin Controlled by PB17 */
|
||||
#define AT91C_PB17_RF2 ((unsigned int) AT91C_PIO_PB17) /* SSC Receive Frame Sync 2 */
|
||||
#define AT91C_PB17_ERXDV ((unsigned int) AT91C_PIO_PB17) /* Ethernet MAC Receive Data Valid */
|
||||
#define AT91C_PIO_PB16 ((unsigned int) 1 << 16) /* Pin Controlled by PB16 */
|
||||
#define AT91C_PB16_RK2 ((unsigned int) AT91C_PIO_PB16) /* SSC Receive Clock 2 */
|
||||
#define AT91C_PB16_ERX3 ((unsigned int) AT91C_PIO_PB16) /* Ethernet MAC Receive Data 3 */
|
||||
#define AT91C_PIO_PB15 ((unsigned int) 1 << 15) /* Pin Controlled by PB15 */
|
||||
#define AT91C_PB15_RD2 ((unsigned int) AT91C_PIO_PB15) /* SSC Receive Data 2 */
|
||||
#define AT91C_PB15_ERX2 ((unsigned int) AT91C_PIO_PB15) /* Ethernet MAC Receive Data 2 */
|
||||
#define AT91C_PIO_PB14 ((unsigned int) 1 << 14) /* Pin Controlled by PB14 */
|
||||
#define AT91C_PB14_TD2 ((unsigned int) AT91C_PIO_PB14) /* SSC Transmit Data 2 */
|
||||
#define AT91C_PB14_ETXER ((unsigned int) AT91C_PIO_PB14) /* Ethernet MAC Transmikt Coding Error */
|
||||
#define AT91C_PIO_PB13 ((unsigned int) 1 << 13) /* Pin Controlled by PB13 */
|
||||
#define AT91C_PB13_TK2 ((unsigned int) AT91C_PIO_PB13) /* SSC Transmit Clock 2 */
|
||||
#define AT91C_PB13_ETX3 ((unsigned int) AT91C_PIO_PB13) /* Ethernet MAC Transmit Data 3 */
|
||||
#define AT91C_PIO_PB12 ((unsigned int) 1 << 12) /* Pin Controlled by PB12 */
|
||||
#define AT91C_PB12_TF2 ((unsigned int) AT91C_PIO_PB12) /* SSC Transmit Frame Sync 2 */
|
||||
#define AT91C_PB12_ETX2 ((unsigned int) AT91C_PIO_PB12) /* Ethernet MAC Transmit Data 2 */
|
||||
|
||||
#define AT91C_PIOB_BSR ((AT91_REG *) 0xFFFFF674) /* (PIOB) Select B Register */
|
||||
#define AT91C_BASE_EMAC ((AT91PS_EMAC) 0xFFFBC000) /* (EMAC) Base Address */
|
||||
#define AT91C_PIOB_PDR ((AT91_REG *) 0xFFFFF604) /* (PIOB) PIO Disable Register */
|
||||
|
||||
#define AT91C_EBI_CS3A_SMC_SmartMedia ((unsigned int) 0x1 << 3) /* (EBI) Chip Select 3 is assigned to the Static Memory Controller and the SmartMedia Logic is activated. */
|
||||
#define AT91C_SMC2_ACSS_STANDARD ((unsigned int) 0x0 << 16) /* (SMC2) Standard, asserted at the beginning of the access and deasserted at the end. */
|
||||
#define AT91C_SMC2_DBW_8 ((unsigned int) 0x2 << 13) /* (SMC2) 8-bit. */
|
||||
#define AT91C_SMC2_WSEN ((unsigned int) 0x1 << 7) /* (SMC2) Wait State Enable */
|
||||
#define AT91C_PIOC_ASR ((AT91_REG *) 0xFFFFF870) /* (PIOC) Select A Register */
|
||||
#define AT91C_PIOC_SODR ((AT91_REG *) 0xFFFFF830) /* (PIOC) Set Output Data Register */
|
||||
#define AT91C_PIOC_CODR ((AT91_REG *) 0xFFFFF834) /* (PIOC) Clear Output Data Register */
|
||||
#define AT91C_PIOC_PDSR ((AT91_REG *) 0xFFFFF83C) /* (PIOC) Pin Data Status Register */
|
||||
|
||||
#define AT91C_BASE_TC0 ((AT91PS_TC) 0xFFFA0000) /* (TC0) Base Address */
|
||||
#define AT91C_BASE_DBGU ((AT91PS_DBGU) 0xFFFFF200) /* (DBGU) Base Address */
|
||||
#define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF400) /* (PIOA) Base Address */
|
||||
#define AT91C_EBI_CSA ((AT91_REG *) 0xFFFFFF60) /* (EBI) Chip Select Assignment Register */
|
||||
#define AT91C_BASE_SMC2 ((AT91PS_SMC2) 0xFFFFFF70) /* (SMC2) Base Address */
|
||||
#define AT91C_BASE_US1 ((AT91PS_USART) 0xFFFC4000) /* (US1) Base Address */
|
||||
#define AT91C_TCB0_BMR ((AT91_REG *) 0xFFFA00C4) /* (TCB0) TC Block Mode Register */
|
||||
#define AT91C_TCB0_BCR ((AT91_REG *) 0xFFFA00C0) /* (TCB0) TC Block Control Register */
|
||||
#define AT91C_PIOC_PDR ((AT91_REG *) 0xFFFFF804) /* (PIOC) PIO Disable Register */
|
||||
#define AT91C_PIOC_PER ((AT91_REG *) 0xFFFFF800) /* (PIOC) PIO Enable Register */
|
||||
#define AT91C_PIOC_ODR ((AT91_REG *) 0xFFFFF814) /* (PIOC) Output Disable Registerr */
|
||||
#define AT91C_PIOB_PER ((AT91_REG *) 0xFFFFF600) /* (PIOB) PIO Enable Register */
|
||||
#define AT91C_PIOB_ODR ((AT91_REG *) 0xFFFFF614) /* (PIOB) Output Disable Registerr */
|
||||
#define AT91C_PIOB_PDSR ((AT91_REG *) 0xFFFFF63C) /* (PIOB) Pin Data Status Register */
|
||||
#endif
|
||||
80
include/asm-arm/arch-at91rm9200/hardware.h
Normal file
80
include/asm-arm/arch-at91rm9200/hardware.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* linux/include/asm-arm/arch-at91/hardware.h
|
||||
*
|
||||
* Copyright (C) 2003 SAN People
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __ASM_ARCH_HARDWARE_H
|
||||
#define __ASM_ARCH_HARDWARE_H
|
||||
|
||||
#include <asm/sizes.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include "AT91RM9200.h"
|
||||
#else
|
||||
#include "AT91RM9200_inc.h"
|
||||
#endif
|
||||
|
||||
/* AT91RM92000 clocks */
|
||||
#define AT91_MAIN_CLOCK 179712000 /* from 18.432 MHz crystal (18432000 / 4 * 39) */
|
||||
#define AT91_MASTER_CLOCK 59904000 /* peripheral clock (AT91C_MASTER_CLOCK / 3) */
|
||||
#define AT91_SLOW_CLOCK 32768 /* slow clock */
|
||||
|
||||
/* Virtual and Physical base address for system peripherals */
|
||||
#define AT91_SYS_BASE 0xFFFFF000 /*4K */
|
||||
|
||||
/* Virtual and Physical base addresses of user peripherals */
|
||||
#define AT91_SPI_BASE 0xFFFE0000 /*16K */
|
||||
#define AT91_SSC2_BASE 0xFFFD8000 /*16K */
|
||||
#define AT91_SSC1_BASE 0xFFFD4000 /*16K */
|
||||
#define AT91_SSC0_BASE 0xFFFD0000 /*16K */
|
||||
#define AT91_USART3_BASE 0xFFFCC000 /*16K */
|
||||
#define AT91_USART2_BASE 0xFFFC8000 /*16K */
|
||||
#define AT91_USART1_BASE 0xFFFC4000 /*16K */
|
||||
#define AT91_USART0_BASE 0xFFFC0000 /*16K */
|
||||
#define AT91_EMAC_BASE 0xFFFBC000 /*16K */
|
||||
#define AT91_TWI_BASE 0xFFFB8000 /*16K */
|
||||
#define AT91_MCI_BASE 0xFFFB4000 /*16K */
|
||||
#define AT91_UDP_BASE 0xFFFB0000 /*16K */
|
||||
#define AT91_TCB1_BASE 0xFFFA4000 /*16K */
|
||||
#define AT91_TCB0_BASE 0xFFFA0000 /*16K */
|
||||
|
||||
/*
|
||||
* Where in virtual memory the IO devices (timers, system controllers
|
||||
* and so on)
|
||||
*/
|
||||
#define AT91_IO_BASE 0xF0000000 /* Virt/Phys Address of IO */
|
||||
|
||||
/* FLASH */
|
||||
#define AT91_FLASH_BASE 0x10000000 /* NCS0 */
|
||||
|
||||
/* SDRAM */
|
||||
#define AT91_SDRAM_BASE 0x20000000 /* NCS1 */
|
||||
|
||||
/* SmartMedia */
|
||||
#define AT91_SMARTMEDIA_BASE 0x40000000 /* NCS3 */
|
||||
|
||||
/* Definition of interrupt priority levels */
|
||||
#define AT91C_AIC_PRIOR_0 AT91C_AIC_PRIOR_LOWEST
|
||||
#define AT91C_AIC_PRIOR_1 ((unsigned int) 0x1)
|
||||
#define AT91C_AIC_PRIOR_2 ((unsigned int) 0x2)
|
||||
#define AT91C_AIC_PRIOR_3 ((unsigned int) 0x3)
|
||||
#define AT91C_AIC_PRIOR_4 ((unsigned int) 0x4)
|
||||
#define AT91C_AIC_PRIOR_5 ((unsigned int) 0x5)
|
||||
#define AT91C_AIC_PRIOR_6 ((unsigned int) 0x6)
|
||||
#define AT91C_AIC_PRIOR_7 AT91C_AIC_PRIOR_HIGEST
|
||||
|
||||
#endif
|
||||
@@ -894,7 +894,12 @@
|
||||
/* Module : EBU register address and bits */
|
||||
/***********************************************************************/
|
||||
|
||||
#if defined(CONFIG_INCA_IP)
|
||||
#define INCA_IP_EBU (0xB8000200)
|
||||
#elif defined(CONFIG_PURPLE)
|
||||
#define INCA_IP_EBU (0xB800D800)
|
||||
#endif
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
@@ -1490,7 +1495,12 @@ If set and clear bit are written concurrently with 1, the associated bit is not
|
||||
/* Module : ASC register address and bits */
|
||||
/***********************************************************************/
|
||||
|
||||
#if defined(CONFIG_INCA_IP)
|
||||
#define INCA_IP_ASC (0xB8000400)
|
||||
#elif defined(CONFIG_PURPLE)
|
||||
#define INCA_IP_ASC (0xBE500000)
|
||||
#endif
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
|
||||
440
include/asm-ppc/5xx_immap.h
Normal file
440
include/asm-ppc/5xx_immap.h
Normal file
@@ -0,0 +1,440 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Martin Winistoerfer, martinwinistoerfer@gmx.ch.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation,
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: 5xx_immap.h
|
||||
*
|
||||
* Discription: MPC555 Internal Memory Map
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __IMMAP_5XX__
|
||||
#define __IMMAP_5XX__
|
||||
|
||||
/* System Configuration Registers.
|
||||
*/
|
||||
typedef struct sys_conf {
|
||||
uint sc_siumcr;
|
||||
uint sc_sypcr;
|
||||
char res1[6];
|
||||
ushort sc_swsr;
|
||||
uint sc_sipend;
|
||||
uint sc_simask;
|
||||
uint sc_siel;
|
||||
uint sc_sivec;
|
||||
uint sc_tesr;
|
||||
uint sc_sgpiodt1;
|
||||
uint sc_sgpiodt2;
|
||||
uint sc_sgpiocr;
|
||||
uint sc_emcr;
|
||||
uint sc_res1aa;
|
||||
uint sc_res1ab;
|
||||
uint sc_pdmcr;
|
||||
char res3[192];
|
||||
} sysconf5xx_t;
|
||||
|
||||
|
||||
/* Memory Controller Registers.
|
||||
*/
|
||||
typedef struct mem_ctlr {
|
||||
uint memc_br0;
|
||||
uint memc_or0;
|
||||
uint memc_br1;
|
||||
uint memc_or1;
|
||||
uint memc_br2;
|
||||
uint memc_or2;
|
||||
uint memc_br3;
|
||||
uint memc_or3;
|
||||
char res1[32];
|
||||
uint memc_dmbr;
|
||||
uint memc_dmor;
|
||||
char res2[48];
|
||||
ushort memc_mstat;
|
||||
ushort memc_res4a;
|
||||
char res3[132];
|
||||
} memctl5xx_t;
|
||||
|
||||
/* System Integration Timers.
|
||||
*/
|
||||
typedef struct sys_int_timers {
|
||||
ushort sit_tbscr;
|
||||
char res1[2];
|
||||
uint sit_tbref0;
|
||||
uint sit_tbref1;
|
||||
char res2[20];
|
||||
ushort sit_rtcsc;
|
||||
char res3[2];
|
||||
uint sit_rtc;
|
||||
uint sit_rtsec;
|
||||
uint sit_rtcal;
|
||||
char res4[16];
|
||||
ushort sit_piscr;
|
||||
char res5[2];
|
||||
uint sit_pitc;
|
||||
uint sit_pitr;
|
||||
char res6[52];
|
||||
} sit5xx_t;
|
||||
|
||||
/* Clocks and Reset
|
||||
*/
|
||||
typedef struct clk_and_reset {
|
||||
uint car_sccr;
|
||||
uint car_plprcr;
|
||||
ushort car_rsr;
|
||||
ushort car_res7a;
|
||||
ushort car_colir;
|
||||
ushort car_res7b;
|
||||
ushort car_vsrmcr;
|
||||
ushort car_res7c;
|
||||
char res1[108];
|
||||
|
||||
} car5xx_t;
|
||||
|
||||
#define TBSCR_TBE ((ushort)0x0001)
|
||||
|
||||
/* System Integration Timer Keys
|
||||
*/
|
||||
typedef struct sitk {
|
||||
uint sitk_tbscrk;
|
||||
uint sitk_tbref0k;
|
||||
uint sitk_tbref1k;
|
||||
uint sitk_tbk;
|
||||
char res1[16];
|
||||
uint sitk_rtcsck;
|
||||
uint sitk_rtck;
|
||||
uint sitk_rtseck;
|
||||
uint sitk_rtcalk;
|
||||
char res2[16];
|
||||
uint sitk_piscrk;
|
||||
uint sitk_pitck;
|
||||
char res3[56];
|
||||
} sitk5xx_t;
|
||||
|
||||
/* Clocks and Reset Keys.
|
||||
*/
|
||||
typedef struct cark {
|
||||
uint cark_sccrk;
|
||||
uint cark_plprcrk;
|
||||
uint cark_rsrk;
|
||||
char res1[1140];
|
||||
} cark8xx_t;
|
||||
|
||||
/* The key to unlock registers maintained by keep-alive power.
|
||||
*/
|
||||
#define KAPWR_KEY ((unsigned int)0x55ccaa33)
|
||||
|
||||
/* Flash Configuration
|
||||
*/
|
||||
typedef struct fl {
|
||||
uint fl_cmfmcr;
|
||||
uint fl_cmftst;
|
||||
uint fl_cmfctl;
|
||||
char res1[52];
|
||||
} fl5xx_t;
|
||||
|
||||
/* Dpram Control
|
||||
*/
|
||||
typedef struct dprc {
|
||||
ushort dprc_dptmcr;
|
||||
ushort dprc_ramtst;
|
||||
ushort dprc_rambar;
|
||||
ushort dprc_misrh;
|
||||
ushort dprc_misrl;
|
||||
ushort dprc_miscnt;
|
||||
} dprc5xx_t;
|
||||
|
||||
/* Time Processor Unit
|
||||
*/
|
||||
typedef struct tpu {
|
||||
ushort tpu_tpumcr;
|
||||
ushort tpu_tcr;
|
||||
ushort tpu_dscr;
|
||||
ushort tpu_dssr;
|
||||
ushort tpu_ticr;
|
||||
ushort tpu_cier;
|
||||
ushort tpu_cfsr0;
|
||||
ushort tpu_cfsr1;
|
||||
ushort tpu_cfsr2;
|
||||
ushort tpu_cfsr3;
|
||||
ushort tpu_hsqr0;
|
||||
ushort tpu_hsqr1;
|
||||
ushort tpu_hsrr0;
|
||||
ushort tpu_hsrr1;
|
||||
ushort tpu_cpr0;
|
||||
ushort tpu_cpr1;
|
||||
ushort tpu_cisr;
|
||||
ushort tpu_lr;
|
||||
ushort tpu_sglr;
|
||||
ushort tpu_dcnr;
|
||||
ushort tpu_tpumcr2;
|
||||
ushort tpu_tpumcr3;
|
||||
ushort tpu_isdr;
|
||||
ushort tpu_iscr;
|
||||
char res1[208];
|
||||
char tpu[16][16];
|
||||
char res2[512];
|
||||
} tpu5xx_t;
|
||||
|
||||
/* QADC
|
||||
*/
|
||||
typedef struct qadc {
|
||||
ushort qadc_64mcr;
|
||||
ushort qadc_64test;
|
||||
ushort qadc_64int;
|
||||
u_char qadc_portqa;
|
||||
u_char qadc_portqb;
|
||||
ushort qadc_ddrqa;
|
||||
ushort qadc_qacr0;
|
||||
ushort qadc_qacr1;
|
||||
ushort qadc_qacr2;
|
||||
ushort qadc_qasr0;
|
||||
ushort qadc_qasr1;
|
||||
char res1[492];
|
||||
/* command convertion word table */
|
||||
ushort qadc_ccw[64];
|
||||
/* result word table, unsigned right justified */
|
||||
ushort qadc_rjurr[64];
|
||||
/* result word table, signed left justified */
|
||||
ushort qadc_ljsrr[64];
|
||||
/* result word table, unsigned left justified */
|
||||
ushort qadc_ljurr[64];
|
||||
} qadc5xx_t;
|
||||
|
||||
/* QSMCM
|
||||
*/
|
||||
typedef struct qsmcm {
|
||||
ushort qsmcm_qsmcr;
|
||||
ushort qsmcm_qtest;
|
||||
ushort qsmcm_qdsci_il;
|
||||
ushort qsmcm_qspi_il;
|
||||
ushort qsmcm_scc1r0;
|
||||
ushort qsmcm_scc1r1;
|
||||
ushort qsmcm_sc1sr;
|
||||
ushort qsmcm_sc1dr;
|
||||
char res1[2];
|
||||
char res2[2];
|
||||
ushort qsmcm_portqs;
|
||||
u_char qsmcm_pqspar;
|
||||
u_char qsmcm_ddrqs;
|
||||
ushort qsmcm_spcr0;
|
||||
ushort qsmcm_spcr1;
|
||||
ushort qsmcm_spcr2;
|
||||
u_char qsmcm_spcr3;
|
||||
u_char qsmcm_spsr;
|
||||
ushort qsmcm_scc2r0;
|
||||
ushort qsmcm_scc2r1;
|
||||
ushort qsmcm_sc2sr;
|
||||
ushort qsmcm_sc2dr;
|
||||
ushort qsmcm_qsci1cr;
|
||||
ushort qsmcm_qsci1sr;
|
||||
ushort qsmcm_sctq[16];
|
||||
ushort qsmcm_scrq[16];
|
||||
char res3[212];
|
||||
ushort qsmcm_recram[32];
|
||||
ushort qsmcm_tranram[32];
|
||||
u_char qsmcm_comdram[32];
|
||||
char res[3616];
|
||||
} qsmcm5xx_t;
|
||||
|
||||
|
||||
/* MIOS
|
||||
*/
|
||||
|
||||
typedef struct mios {
|
||||
ushort mios_mpwmsm0perr; /* mpwmsm0 */
|
||||
ushort mios_mpwmsm0pulr;
|
||||
ushort mios_mpwmsm0cntr;
|
||||
ushort mios_mpwmsm0scr;
|
||||
ushort mios_mpwmsm1perr; /* mpwmsm1 */
|
||||
ushort mios_mpwmsm1pulr;
|
||||
ushort mios_mpwmsm1cntr;
|
||||
ushort mios_mpwmsm1scr;
|
||||
ushort mios_mpwmsm2perr; /* mpwmsm2 */
|
||||
ushort mios_mpwmsm2pulr;
|
||||
ushort mios_mpwmsm2cntr;
|
||||
ushort mios_mpwmsm2scr;
|
||||
ushort mios_mpwmsm3perr; /* mpwmsm3 */
|
||||
ushort mios_mpwmsm3pulr;
|
||||
ushort mios_mpwmsm3cntr;
|
||||
ushort mios_mpwmsm3scr;
|
||||
char res1[16];
|
||||
ushort mios_mmcsm6cnt; /* mmcsm6 */
|
||||
ushort mios_mmcsm6mlr;
|
||||
ushort mios_mmcsm6scrd, mmcsm6scr;
|
||||
char res2[32];
|
||||
ushort mios_mdasm11ar; /* mdasm11 */
|
||||
ushort mios_mdasm11br;
|
||||
ushort mios_mdasm11scrd, mdasm11scr;
|
||||
ushort mios_mdasm12ar; /* mdasm12 */
|
||||
ushort mios_mdasm12br;
|
||||
ushort mios_mdasm12scrd, mdasm12scr;
|
||||
ushort mios_mdasm13ar; /* mdasm13 */
|
||||
ushort mios_mdasm13br;
|
||||
ushort mios_mdasm13scrd, mdasm13scr;
|
||||
ushort mios_mdasm14ar; /* mdasm14 */
|
||||
ushort mios_mdasm14br;
|
||||
ushort mios_mdasm14scrd, mdasm14scr;
|
||||
ushort mios_mdasm15ar; /* mdasm15 */
|
||||
ushort mios_mdasm15br;
|
||||
ushort mios_mdasm15scrd, mdasm15scr;
|
||||
ushort mios_mpwmsm16perr; /* mpwmsm16 */
|
||||
ushort mios_mpwmsm16pulr;
|
||||
ushort mios_mpwmsm16cntr;
|
||||
ushort mios_mpwmsm16scr;
|
||||
ushort mios_mpwmsm17perr; /* mpwmsm17 */
|
||||
ushort mios_mpwmsm17pulr;
|
||||
ushort mios_mpwmsm17cntr;
|
||||
ushort mios_mpwmsm17scr;
|
||||
ushort mios_mpwmsm18perr; /* mpwmsm18 */
|
||||
ushort mios_mpwmsm18pulr;
|
||||
ushort mios_mpwmsm18cntr;
|
||||
ushort mios_mpwmsm18scr;
|
||||
ushort mios_mpwmsm19perr; /* mpwmsm19 */
|
||||
ushort mios_mpwmsm19pulr;
|
||||
ushort mios_mpwmsm19cntr;
|
||||
ushort mios_mpwmsm19scr;
|
||||
char res3[16];
|
||||
ushort mios_mmcsm22cnt; /* mmcsm22 */
|
||||
ushort mios_mmcsm22mlr;
|
||||
ushort mios_mmcsm22scrd, mmcsm22scr;
|
||||
char res4[32];
|
||||
ushort mios_mdasm27ar; /* mdasm27 */
|
||||
ushort mios_mdasm27br;
|
||||
ushort mios_mdasm27scrd, mdasm27scr;
|
||||
ushort mios_mdasm28ar; /*mdasm28 */
|
||||
ushort mios_mdasm28br;
|
||||
ushort mios_mdasm28scrd, mdasm28scr;
|
||||
ushort mios_mdasm29ar; /* mdasm29 */
|
||||
ushort mios_mdasm29br;
|
||||
ushort mios_mdasm29scrd, mdasm29scr;
|
||||
ushort mios_mdasm30ar; /* mdasm30 */
|
||||
ushort mios_mdasm30br;
|
||||
ushort mios_mdasm30scrd, mdasm30scr;
|
||||
ushort mios_mdasm31ar; /* mdasm31 */
|
||||
ushort mios_mdasm31br;
|
||||
ushort mios_mdasm31scrd, mdasm31scr;
|
||||
ushort mios_mpiosm32dr;
|
||||
ushort mios_mpiosm32ddr;
|
||||
char res5[1788];
|
||||
ushort mios_mios1tpcr;
|
||||
char mios_res13[2];
|
||||
ushort mios_mios1vnr;
|
||||
ushort mios_mios1mcr;
|
||||
char res6[12];
|
||||
ushort mios_res42z;
|
||||
ushort mios_mcpsmscr;
|
||||
char res7[1000];
|
||||
ushort mios_mios1sr0;
|
||||
char res12[2];
|
||||
ushort mios_mios1er0;
|
||||
ushort mios_mios1rpr0;
|
||||
char res8[40];
|
||||
ushort mios_mios1lvl0;
|
||||
char res9[14];
|
||||
ushort mios_mios1sr1;
|
||||
char res10[2];
|
||||
ushort mios_mios1er1;
|
||||
ushort mios_mios1rpr1;
|
||||
char res11[40];
|
||||
ushort mios_mios1lvl1;
|
||||
char res13[1038];
|
||||
} mios5xx_t;
|
||||
|
||||
/* Toucan Module
|
||||
*/
|
||||
typedef struct tcan {
|
||||
ushort tcan_tcnmcr;
|
||||
ushort tcan_cantcr;
|
||||
ushort tcan_canicr;
|
||||
u_char tcan_canctrl0;
|
||||
u_char tcan_canctrl1;
|
||||
u_char tcan_presdiv;
|
||||
u_char tcan_canctrl2;
|
||||
ushort tcan_timer;
|
||||
char res1[4];
|
||||
ushort tcan_rxgmskhi;
|
||||
ushort tcan_rxgmsklo;
|
||||
ushort tcan_rx14mskhi;
|
||||
ushort tcan_rx14msklo;
|
||||
ushort tcan_rx15mskhi;
|
||||
ushort tcan_rx15msklo;
|
||||
char res2[4];
|
||||
ushort tcan_estat;
|
||||
ushort tcan_imask;
|
||||
ushort tcan_iflag;
|
||||
u_char tcan_rxectr;
|
||||
u_char tcan_txectr;
|
||||
char res3[88];
|
||||
struct {
|
||||
ushort scr;
|
||||
ushort id_high;
|
||||
ushort id_low;
|
||||
u_char data[8];
|
||||
char res4[2];
|
||||
} tcan_mbuff[16];
|
||||
char res5[640];
|
||||
} tcan5xx_t;
|
||||
|
||||
/* UIMB
|
||||
*/
|
||||
typedef struct uimb {
|
||||
uint uimb_umcr;
|
||||
char res1[12];
|
||||
uint uimb_utstcreg;
|
||||
char res2[12];
|
||||
uint uimb_uipend;
|
||||
} uimb5xx_t;
|
||||
|
||||
|
||||
|
||||
/* Internal Memory Map MPC555
|
||||
*/
|
||||
typedef struct immap {
|
||||
char res1[262144]; /* CMF Flash A 256 Kbytes */
|
||||
char res2[196608]; /* CMF Flash B 192 Kbytes */
|
||||
char res3[2670592]; /* Reserved for Flash */
|
||||
sysconf5xx_t im_siu_conf; /* SIU Configuration */
|
||||
memctl5xx_t im_memctl; /* Memory Controller */
|
||||
sit5xx_t im_sit; /* System Integration Timers */
|
||||
car5xx_t im_clkrst; /* Clocks and Reset */
|
||||
sitk5xx_t im_sitk; /* System Integration Timer Keys*/
|
||||
cark8xx_t im_clkrstk; /* Clocks and Resert Keys */
|
||||
fl5xx_t im_fla; /* Flash Module A */
|
||||
fl5xx_t im_flb; /* Flash Module B */
|
||||
char res4[14208]; /* Reserved for SIU */
|
||||
dprc5xx_t im_dprc; /* Dpram Control Register */
|
||||
char res5[8180]; /* Reserved */
|
||||
char dptram[6144]; /* Dptram */
|
||||
char res6[2048]; /* Reserved */
|
||||
tpu5xx_t im_tpua; /* Time Proessing Unit A */
|
||||
tpu5xx_t im_tpub; /* Time Processing Unit B */
|
||||
qadc5xx_t im_qadca; /* QADC A */
|
||||
qadc5xx_t im_qadcb; /* QADC B */
|
||||
qsmcm5xx_t im_qsmcm; /* SCI and SPI */
|
||||
mios5xx_t im_mios; /* MIOS */
|
||||
tcan5xx_t im_tcana; /* Toucan A */
|
||||
tcan5xx_t im_tcanb; /* Toucan B */
|
||||
char res7[1792]; /* Reserved */
|
||||
uimb5xx_t im_uimb; /* UIMB */
|
||||
} immap_t;
|
||||
|
||||
#endif /* __IMMAP_5XX__ */
|
||||
@@ -462,7 +462,7 @@
|
||||
#define PVR_405CR_RA 0x40110041
|
||||
#define PVR_405CR_RB 0x401100C5
|
||||
#define PVR_405CR_RC 0x40110145 /* same as pc405gp rev e */
|
||||
#define PVR_405GPR_RA 0x50910951
|
||||
#define PVR_405GPR_RB 0x50910951
|
||||
#define PVR_440GP_RB 0x40120440
|
||||
#define PVR_440GP_RC 0x40120481
|
||||
#define PVR_601 0x00010000
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct bd_info {
|
||||
unsigned long bi_flashoffset; /* reserved area for startup monitor */
|
||||
unsigned long bi_sramstart; /* start of SRAM memory */
|
||||
unsigned long bi_sramsize; /* size of SRAM memory */
|
||||
#if defined(CONFIG_8xx) || defined(CONFIG_8260)
|
||||
#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_8260)
|
||||
unsigned long bi_immr_base; /* base of IMMR register */
|
||||
#endif
|
||||
unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */
|
||||
@@ -68,7 +68,10 @@ typedef struct bd_info {
|
||||
#if defined(CONFIG_HYMOD)
|
||||
hymod_conf_t bi_hymod_conf; /* hymod configuration information */
|
||||
#endif
|
||||
#if defined(CONFIG_EVB64260) || defined(CONFIG_PN62) || defined(CONFIG_SVM_SC8xx)
|
||||
#if defined(CONFIG_EVB64260) || \
|
||||
defined(CONFIG_PN62) || \
|
||||
defined(CONFIG_SXNI855T) || \
|
||||
defined(CONFIG_SVM_SC8xx)
|
||||
/* second onboard ethernet port */
|
||||
unsigned char bi_enet1addr[6];
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,7 @@ int do_rarpb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
|
||||
#define CMD_TBL_DHCP MK_CMD_TBL_ENTRY( \
|
||||
"dhcp", 4, 3, 1, do_dhcp, \
|
||||
"dhcp - invoke DHCP client to obtain IP/boot params\n", \
|
||||
"\n" \
|
||||
"[loadAddress] [bootfilename]\n" \
|
||||
),
|
||||
|
||||
int do_dhcp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user