mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Compare commits
14 Commits
U-Boot-0_4
...
U-Boot-0_4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae3af05ec9 | ||
|
|
9374fa287b | ||
|
|
013dc8d9b9 | ||
|
|
d41e5e6994 | ||
|
|
8f713fdfeb | ||
|
|
96e48cf6c1 | ||
|
|
bdccc4fedc | ||
|
|
96dd9af4c7 | ||
|
|
1f4bb37d6b | ||
|
|
7784674852 | ||
|
|
27b207fd0a | ||
|
|
2535d60277 | ||
|
|
945af8d723 | ||
|
|
cb4dbb7bbc |
119
CHANGELOG
119
CHANGELOG
@@ -1,9 +1,124 @@
|
||||
======================================================================
|
||||
Changes for U-Boot 0.4.5:
|
||||
======================================================================
|
||||
|
||||
* Update for TQM board defaults:
|
||||
disable clocks_in_mhz, enable boot count limit
|
||||
|
||||
* Removed tools/gdb from "make all" target. Added make target "gdbtools"
|
||||
in toplevel directory instead. Removed astest.c from tools/gdb because
|
||||
it is no longer relevant.
|
||||
|
||||
* Fix PCI support for MPC5200 / IceCube Board
|
||||
|
||||
* Map ISP1362 USB OTG controller for NSCU board
|
||||
|
||||
* Patch by Brad Parker, 02 Aug 2003:
|
||||
fix sc520_cdp problems
|
||||
|
||||
* Implement Boot Cycle Detection (Req. 2.3 of OSDL CGL Reqirements)
|
||||
|
||||
* Allow erase command to cross flash bank boundaries
|
||||
|
||||
* Patch by Scott McNutt, 21 Jul 2003:
|
||||
Add support for LynuxWorks Kernel Downloadable Images (KDIs).
|
||||
Both LynxOS and BlueCat linux KDIs are supported.
|
||||
|
||||
* Patch by Richard Woodruff, 25 Jul 2003:
|
||||
use more reliable reset for OMAP/925T
|
||||
|
||||
* Patch by Nye Liu, 25 Jul 2003:
|
||||
fix typo in mpc8xx.h
|
||||
|
||||
* Patch by Richard Woodruff, 24 Jul 2003:
|
||||
Fixes for cmd_nand.c:
|
||||
- Fixed null dereferece which could result in incorrect ECC values.
|
||||
- Added support for devices with no Ready/Busy signal hooked up.
|
||||
- Added OMAP1510 read/write protect handling.
|
||||
- Fixed nand.h's ECCPOS. A conflict existed with POS5 and badblock
|
||||
for non-JFFS2.
|
||||
- Switched default ECC to be JFFS2.
|
||||
|
||||
* Allow crc32 to be used at address 0x000
|
||||
|
||||
* Provide consistent interface to standalone applications to access
|
||||
the 'global_data' structure
|
||||
Provide a doc/README.standalone more useful to users/developers.
|
||||
|
||||
* Make IceCube MGT5100 FEC driver work
|
||||
|
||||
* Implement new mechanism to export U-Boot's functions to standalone
|
||||
applications: instead of using (PPC-specific) system calls we now
|
||||
use a jump table; please see doc/README.standalone for details
|
||||
|
||||
* Patch by Dave Westwood, 24 Jul 2003:
|
||||
added support for Unity OS (a proprietary OS)
|
||||
|
||||
* Patch by Detlev Zundel, 23 Jul 2003:
|
||||
add "imls" command to print flash table of contents
|
||||
|
||||
* Fix cold boot detection for log buffer reset
|
||||
|
||||
* Return error for invalid length specifiers with "cp.X" etc.
|
||||
|
||||
* Fix startup problem on MIPS
|
||||
|
||||
* Allow for CONFIG_SPLASH_SCREEN even when no explicit
|
||||
bitmap support is configured
|
||||
|
||||
* Patch by Bill Hargen, 18 Jul 2003:
|
||||
- fix endinaness problem in cpu/mpc824x/drivers/i2c/i2c1.c
|
||||
|
||||
* Patch by Denis Peter, 18 Jul 2003:
|
||||
- fix memory configuration for MIP405T
|
||||
- fix printout of baudrate for "loadb <loadaddr> <baudrate>"
|
||||
|
||||
* Cleanup of TQM82xx configurations; use "official" board types
|
||||
to make selection easier.
|
||||
|
||||
* Patch by Martin Krause, 17 Jul 2003:
|
||||
add delay to get I2C working with "imm" command and s3c24x0_i2c.c
|
||||
|
||||
* Patch by Richard Woodruff, 17 July 03:
|
||||
- Fixed bug in OMAP1510 baud rate divisor settings.
|
||||
|
||||
* Patch by Nye Liu, 16 July 2003:
|
||||
MPC860FADS fixes:
|
||||
- add MPC86xADS support (uses MPC86xADS.h)
|
||||
- add 866P/T core support (also MPC859T/MPC859DSL/MPC852T)
|
||||
o PLPRCR changes
|
||||
o BRG changes (EXTAL/XTAL restricted to 10MHz)
|
||||
o don't trust gclk() software measurement by default, depend on
|
||||
CONFIG_8xx_GCLK_FREQ
|
||||
- add DRAM SIMM not installed detection
|
||||
- use more "correct" SDRAM initialization sequence
|
||||
- allow different SDRAM sizes (8xxADS has 8M)
|
||||
- default DER is 0
|
||||
- remove unused MAMR defines from FADS860T.h (all done in fads.c)
|
||||
- rename MAMR/MBMR defines to be more consistent. Should eventually
|
||||
be merged into MxMR to better reflect the PowerQUICC datasheet.
|
||||
|
||||
* Patch by Yuli Barcohen, 16 Jul 2003:
|
||||
support new Motorola PQ2FADS-ZU evaluation board which replaced
|
||||
MPC8260ADS and MPC8266ADS
|
||||
|
||||
======================================================================
|
||||
Changes for U-Boot 0.4.4:
|
||||
======================================================================
|
||||
|
||||
* Add support for IceCube board (with MGT5100 and MPC5200 CPUs)
|
||||
|
||||
* Add support for MGT5100 and MPC5200 processors
|
||||
|
||||
* Patch by Lutz Dennig, 15 Jul 2003:
|
||||
update for R360MPI board
|
||||
|
||||
======================================================================
|
||||
Changes for U-Boot 0.4.3:
|
||||
======================================================================
|
||||
|
||||
* Patches by Kshitij, 04 Jul 2003
|
||||
- added support for arm925t cpu core
|
||||
- added support for arm925t cpu core
|
||||
- added support for TI OMAP 1510 Innovator Board
|
||||
|
||||
* Patches by Martin Krause, 14 Jul 2003:
|
||||
@@ -24,7 +139,7 @@ Changes for U-Boot 0.4.3:
|
||||
- Fix PCI config table for A3000
|
||||
- Fix iobase for natsemi.c
|
||||
(PCI_BASE_ADDRESS_0 is the IO base register for DP83815)
|
||||
|
||||
|
||||
* Allow to enable "slow" POST routines by key press on power-on
|
||||
* Fix temperature dependend switching of LCD backlight on LWMON
|
||||
* Tweak output format for LWMON
|
||||
|
||||
@@ -52,6 +52,8 @@ Wolfgang Denk <wd@denx.de>
|
||||
FPS850L MPC850
|
||||
FPS860L MPC860
|
||||
ICU862 MPC862
|
||||
IceCube_5100 MGT5100
|
||||
IceCube_5200 MPC5200
|
||||
IP860 MPC860
|
||||
IVML24 MPC860
|
||||
IVML24_128 MPC860
|
||||
|
||||
31
MAKEALL
31
MAKEALL
@@ -18,6 +18,14 @@ LIST_5xx=" \
|
||||
cmi_mpc5xx \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MPC5xxx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_5xxx=" \
|
||||
IceCube_5100 IceCube_5200 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
@@ -31,12 +39,12 @@ LIST_8xx=" \
|
||||
IP860 IVML24 IVML24_128 IVML24_256 \
|
||||
IVMS8 IVMS8_128 IVMS8_256 KUP4K \
|
||||
LANTEC lwmon MBX MBX860T \
|
||||
MHPC MVS1 NETVIA NETVIA_V2 \
|
||||
NX823 pcu_e R360MPI RBC823 \
|
||||
rmu RPXClassic RPXlite RRvision \
|
||||
SM850 SPD823TS svm_sc8xx SXNI855T \
|
||||
TOP860 TQM823L TQM823L_LCD TQM850L \
|
||||
TQM855L TQM860L v37 \
|
||||
MHPC MPC86xADS MVS1 NETVIA \
|
||||
NETVIA_V2 NX823 pcu_e R360MPI \
|
||||
RBC823 rmu RPXClassic RPXlite \
|
||||
RRvision SM850 SPD823TS svm_sc8xx \
|
||||
SXNI855T TOP860 TQM823L TQM823L_LCD \
|
||||
TQM850L TQM855L TQM860L v37 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -45,9 +53,9 @@ LIST_8xx=" \
|
||||
|
||||
LIST_4xx=" \
|
||||
ADCIOP AR405 ASH405 BUBINGA405EP \
|
||||
CANBT CPCI405 CPCI4052 CPCI405AB \
|
||||
CANBT CPCI405 CPCI4052 CPCI405AB \
|
||||
CPCI440 CPCIISER4 CRAYL1 DASA_SIM \
|
||||
DU405 EBONY ERIC EXBITGEN \
|
||||
DU405 EBONY ERIC EXBITGEN \
|
||||
MIP405 MIP405T ML2 OCRTC \
|
||||
ORSG PCI405 PIP405 PMC405 \
|
||||
W7OLMC W7OLMG WALNUT405 \
|
||||
@@ -72,7 +80,7 @@ LIST_8260=" \
|
||||
gw8260 hymod IPHASE4539 MPC8260ADS \
|
||||
MPC8266ADS PM826 ppmc8260 RPXsuper \
|
||||
rsdproto sacsng sbc8260 SCM \
|
||||
TQM8260 \
|
||||
TQM8260_AC TQM8260_AD TQM8260_AE \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -87,7 +95,8 @@ LIST_7xx=" \
|
||||
BAB7xx ELPPC \
|
||||
"
|
||||
|
||||
LIST_ppc="${LIST_5xx} ${LIST_8xx} \
|
||||
LIST_ppc="${LIST_5xx} ${LIST_5xxx} \
|
||||
${LIST_8xx} \
|
||||
${LIST_824x} ${LIST_8260} \
|
||||
${LIST_4xx} \
|
||||
${LIST_74xx} ${LIST_7xx}"
|
||||
@@ -159,7 +168,7 @@ build_target() {
|
||||
for arg in $@
|
||||
do
|
||||
case "$arg" in
|
||||
5xx|8xx|824x|8260|4xx|7xx|74xx|SA|ARM7|ARM9|ppc|arm|pxa|mips|I486|x86)
|
||||
5xx|5xxx|8xx|824x|8260|4xx|7xx|74xx|SA|ARM7|ARM9|ppc|arm|pxa|mips|I486|x86)
|
||||
for target in `eval echo '$LIST_'${arg}`
|
||||
do
|
||||
build_target ${target}
|
||||
|
||||
100
Makefile
100
Makefile
@@ -116,13 +116,12 @@ LIBS += post/libpost.a post/cpu/libcpu.a
|
||||
LIBS += common/libcommon.a
|
||||
LIBS += lib_generic/libgeneric.a
|
||||
|
||||
#########################################################################
|
||||
#########################################################################
|
||||
|
||||
all: u-boot.srec u-boot.bin System.map
|
||||
ALL = u-boot.srec u-boot.bin System.map
|
||||
|
||||
install: all
|
||||
-cp u-boot.bin /tftpboot/u-boot.bin
|
||||
-cp u-boot.bin /net/denx/tftpboot/u-boot.bin
|
||||
all: $(ALL)
|
||||
|
||||
u-boot.srec: u-boot
|
||||
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
|
||||
@@ -130,6 +129,13 @@ u-boot.srec: u-boot
|
||||
u-boot.bin: u-boot
|
||||
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
|
||||
|
||||
u-boot.img: u-boot.bin
|
||||
./tools/mkimage -A $(ARCH) -T firmware -C none \
|
||||
-a $(TEXT_BASE) -e 0 \
|
||||
-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' include/version.h | \
|
||||
sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
|
||||
-d $< $@
|
||||
|
||||
u-boot.dis: u-boot
|
||||
$(OBJDUMP) -d $< > $@
|
||||
|
||||
@@ -142,6 +148,9 @@ u-boot: depend subdirs $(OBJS) $(LIBS) $(LDSCRIPT)
|
||||
subdirs:
|
||||
@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit 1 ; done
|
||||
|
||||
gdbtools:
|
||||
$(MAKE) -C tools/gdb || exit 1
|
||||
|
||||
depend dep:
|
||||
@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
|
||||
|
||||
@@ -181,6 +190,22 @@ unconfig:
|
||||
cmi_mpc5xx_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc5xx cmi
|
||||
|
||||
#########################################################################
|
||||
## MPC5xxx Systems
|
||||
#########################################################################
|
||||
IceCube_5200_config \
|
||||
IceCube_5100_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _5200,$@)" ] || \
|
||||
{ echo "#define CONFIG_MPC5200" >>include/config.h ; \
|
||||
echo "... with MPC5200 processor" ; \
|
||||
}
|
||||
@[ -z "$(findstring _5100,$@)" ] || \
|
||||
{ echo "#define CONFIG_MGT5100" >>include/config.h ; \
|
||||
echo "... with MGT5100 processor" ; \
|
||||
}
|
||||
@./mkconfig -a IceCube ppc mpc5xxx icecube
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
@@ -211,6 +236,7 @@ ETX094_config : unconfig
|
||||
|
||||
FADS823_config \
|
||||
FADS850SAR_config \
|
||||
MPC86xADS_config \
|
||||
FADS860T_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx fads
|
||||
|
||||
@@ -391,6 +417,12 @@ TQM860L_80MHz_config \
|
||||
TQM862L_config \
|
||||
TQM862L_66MHz_config \
|
||||
TQM862L_80MHz_config \
|
||||
TQM823M_config \
|
||||
TQM823M_66MHz_config \
|
||||
TQM823M_80MHz_config \
|
||||
TQM850M_config \
|
||||
TQM850M_66MHz_config \
|
||||
TQM850M_80MHz_config \
|
||||
TQM855M_config \
|
||||
TQM855M_66MHz_config \
|
||||
TQM855M_80MHz_config \
|
||||
@@ -645,32 +677,48 @@ sbc8260_config: unconfig
|
||||
SCM_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 SCM siemens
|
||||
|
||||
TQM8255_config \
|
||||
TQM8260_config \
|
||||
TQM8260_L2_config \
|
||||
TQM8255_266MHz_config \
|
||||
TQM8260_266MHz_config \
|
||||
TQM8260_L2_266MHz_config \
|
||||
TQM8255_300MHz_config \
|
||||
TQM8260_300MHz_config: unconfig
|
||||
@ >include/config.h
|
||||
@if [ "$(findstring _L2_,$@)" ] ; then \
|
||||
TQM8255_AA_config \
|
||||
TQM8260_AA_config \
|
||||
TQM8260_AB_config \
|
||||
TQM8260_AC_config \
|
||||
TQM8260_AD_config \
|
||||
TQM8260_AE_config \
|
||||
TQM8260_AF_config \
|
||||
TQM8260_AG_config \
|
||||
TQM8260_AH_config \
|
||||
TQM8265_AA_config: unconfig
|
||||
@case "$@" in \
|
||||
TQM8255_AA_config) CTYPE=MPC8255; CFREQ=300; CACHE=no; BMODE=8260;; \
|
||||
TQM8260_AA_config) CTYPE=MPC8260; CFREQ=200; CACHE=no; BMODE=8260;; \
|
||||
TQM8260_AB_config) CTYPE=MPC8260; CFREQ=200; CACHE=yes; BMODE=60x;; \
|
||||
TQM8260_AC_config) CTYPE=MPC8260; CFREQ=200; CACHE=yes; BMODE=60x;; \
|
||||
TQM8260_AD_config) CTYPE=MPC8260; CFREQ=300; CACHE=no; BMODE=60x;; \
|
||||
TQM8260_AE_config) CTYPE=MPC8260; CFREQ=266; CACHE=no; BMODE=8260;; \
|
||||
TQM8260_AF_config) CTYPE=MPC8260; CFREQ=300; CACHE=no; BMODE=60x;; \
|
||||
TQM8260_AG_config) CTYPE=MPC8260; CFREQ=300; CACHE=no; BMODE=8260;; \
|
||||
TQM8260_AH_config) CTYPE=MPC8260; CFREQ=300; CACHE=yes; BMODE=60x;; \
|
||||
TQM8265_AA_config) CTYPE=MPC8265; CFREQ=300; CACHE=no; BMODE=60x;; \
|
||||
esac; \
|
||||
>include/config.h ; \
|
||||
if [ "$${CTYPE}" != "MPC8260" ] ; then \
|
||||
echo "#define CONFIG_$${CTYPE}" >>include/config.h ; \
|
||||
fi; \
|
||||
echo "#define CONFIG_$${CFREQ}MHz" >>include/config.h ; \
|
||||
echo "... with $${CFREQ}MHz system clock" ; \
|
||||
if [ "$${CACHE}" == "yes" ] ; then \
|
||||
echo "#define CONFIG_L2_CACHE" >>include/config.h ; \
|
||||
echo "... with L2 Cache support (60x Bus Mode)" ; \
|
||||
echo "... with L2 Cache support" ; \
|
||||
else \
|
||||
echo "#undef CONFIG_L2_CACHE" >>include/config.h ; \
|
||||
echo "... without L2 Cache support" ; \
|
||||
fi; \
|
||||
if [ "$${BMODE}" == "60x" ] ; then \
|
||||
echo "#define CONFIG_BUSMODE_60x" >>include/config.h ; \
|
||||
echo "... with 60x Bus Mode" ; \
|
||||
else \
|
||||
echo "#undef CONFIG_BUSMODE_60x" >>include/config.h ; \
|
||||
echo "... without 60x Bus Mode" ; \
|
||||
fi
|
||||
@[ -z "$(findstring _266MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_266MHz" >>include/config.h ; \
|
||||
echo "... with 266MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _300MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_300MHz" >>include/config.h ; \
|
||||
echo "... with 300MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring TQM8255_,$@)" ] || \
|
||||
{ echo "#define CONFIG_MPC8255" >>include/config.h ; }
|
||||
@./mkconfig -a TQM8260 ppc mpc8260 tqm8260
|
||||
|
||||
atc_config: unconfig
|
||||
@@ -831,7 +879,7 @@ clobber: clean
|
||||
| xargs rm -f
|
||||
rm -f $(OBJS) *.bak tags TAGS
|
||||
rm -fr *.*~
|
||||
rm -f u-boot u-boot.bin u-boot.srec u-boot.map System.map
|
||||
rm -f u-boot u-boot.map $(ALL)
|
||||
rm -f tools/crc32.c tools/environment.c tools/env/crc32.c
|
||||
rm -f tools/inca-swap-bytes cpu/mpc824x/bedbug_603e.c
|
||||
rm -f include/asm/proc include/asm/arch include/asm
|
||||
|
||||
61
README
61
README
@@ -197,7 +197,7 @@ Directory Hierarchy:
|
||||
- board/lwmon Files specific to LWMON boards
|
||||
- board/mbx8xx Files specific to MBX boards
|
||||
- board/mpc8260ads
|
||||
Files specific to MMPC8260ADS boards
|
||||
Files specific to MPC8260ADS and PQ2FADS-ZU boards
|
||||
- board/mpl/ Files specific to boards manufactured by MPL
|
||||
- board/mpl/common Common files for MPL boards
|
||||
- board/mpl/pip405 Files specific to PIP405 boards
|
||||
@@ -206,7 +206,7 @@ Directory Hierarchy:
|
||||
- board/mvs1 Files specific to MVS1 boards
|
||||
- board/nx823 Files specific to NX823 boards
|
||||
- board/oxc Files specific to OXC boards
|
||||
- board/omap1510inn
|
||||
- board/omap1510inn
|
||||
Files specific to OMAP 1510 Innovator boards
|
||||
- board/pcippc2 Files specific to PCIPPC2/PCIPPC6 boards
|
||||
- board/pm826 Files specific to PM826 boards
|
||||
@@ -383,6 +383,14 @@ The following options need to be configured:
|
||||
the lcd display every second with
|
||||
a "rotator" |\-/|\-/
|
||||
|
||||
- Board flavour: (if CONFIG_MPC8260ADS is defined)
|
||||
CONFIG_ADSTYPE
|
||||
Possible values are:
|
||||
CFG_8260ADS - original MPC8260ADS
|
||||
CFG_8266ADS - MPC8266ADS (untested)
|
||||
CFG_PQ2FADS - PQ2FADS-ZU
|
||||
|
||||
|
||||
- MPC824X Family Member (if CONFIG_MPC824X is defined)
|
||||
Define exactly one of
|
||||
CONFIG_MPC8240, CONFIG_MPC8245
|
||||
@@ -913,35 +921,35 @@ The following options need to be configured:
|
||||
- I2C Support: CONFIG_HARD_I2C | CONFIG_SOFT_I2C
|
||||
|
||||
These enable I2C serial bus commands. Defining either of
|
||||
(but not both of) CONFIG_HARD_I2C or CONFIG_SOFT_I2C will
|
||||
include the appropriate I2C driver for the selected cpu.
|
||||
(but not both of) CONFIG_HARD_I2C or CONFIG_SOFT_I2C will
|
||||
include the appropriate I2C driver for the selected cpu.
|
||||
|
||||
This will allow you to use i2c commands at the u-boot
|
||||
command line (as long as you set CFG_CMD_I2C in
|
||||
This will allow you to use i2c commands at the u-boot
|
||||
command line (as long as you set CFG_CMD_I2C in
|
||||
CONFIG_COMMANDS) and communicate with i2c based realtime
|
||||
clock chips. See common/cmd_i2c.c for a description of the
|
||||
command line interface.
|
||||
|
||||
CONFIG_HARD_I2C selects the CPM hardware driver for I2C.
|
||||
CONFIG_HARD_I2C selects the CPM hardware driver for I2C.
|
||||
|
||||
CONFIG_SOFT_I2C configures u-boot to use a software (aka
|
||||
CONFIG_SOFT_I2C configures u-boot to use a software (aka
|
||||
bit-banging) driver instead of CPM or similar hardware
|
||||
support for I2C.
|
||||
|
||||
There are several other quantities that must also be
|
||||
There are several other quantities that must also be
|
||||
defined when you define CONFIG_HARD_I2C or CONFIG_SOFT_I2C.
|
||||
|
||||
In both cases you will need to define CFG_I2C_SPEED
|
||||
to be the frequency (in Hz) at which you wish your i2c bus
|
||||
to run and CFG_I2C_SLAVE to be the address of this node (ie
|
||||
the cpu's i2c node address).
|
||||
|
||||
to be the frequency (in Hz) at which you wish your i2c bus
|
||||
to run and CFG_I2C_SLAVE to be the address of this node (ie
|
||||
the cpu's i2c node address).
|
||||
|
||||
Now, the u-boot i2c code for the mpc8xx (cpu/mpc8xx/i2c.c)
|
||||
sets the cpu up as a master node and so its address should
|
||||
therefore be cleared to 0 (See, eg, MPC823e User's Manual
|
||||
p.16-473). So, set CFG_I2C_SLAVE to 0.
|
||||
p.16-473). So, set CFG_I2C_SLAVE to 0.
|
||||
|
||||
That's all that's required for CONFIG_HARD_I2C.
|
||||
That's all that's required for CONFIG_HARD_I2C.
|
||||
|
||||
If you use the software i2c interface (CONFIG_SOFT_I2C)
|
||||
then the following macros need to be defined (examples are
|
||||
@@ -989,8 +997,8 @@ The following options need to be configured:
|
||||
is FALSE, it clears it (low).
|
||||
|
||||
eg: #define I2C_SDA(bit) \
|
||||
if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \
|
||||
else immr->im_cpm.cp_pbdat &= ~PB_SDA
|
||||
if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \
|
||||
else immr->im_cpm.cp_pbdat &= ~PB_SDA
|
||||
|
||||
I2C_SCL(bit)
|
||||
|
||||
@@ -998,16 +1006,16 @@ The following options need to be configured:
|
||||
is FALSE, it clears it (low).
|
||||
|
||||
eg: #define I2C_SCL(bit) \
|
||||
if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \
|
||||
else immr->im_cpm.cp_pbdat &= ~PB_SCL
|
||||
if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \
|
||||
else immr->im_cpm.cp_pbdat &= ~PB_SCL
|
||||
|
||||
I2C_DELAY
|
||||
|
||||
This delay is invoked four times per clock cycle so this
|
||||
controls the rate of data transfer. The data rate thus
|
||||
is 1 / (I2C_DELAY * 4). Often defined to be something
|
||||
like:
|
||||
|
||||
like:
|
||||
|
||||
#define I2C_DELAY udelay(2)
|
||||
|
||||
CFG_I2C_INIT_BOARD
|
||||
@@ -1687,9 +1695,10 @@ Low Level (hardware related) configuration options:
|
||||
|
||||
- CFG_DEFAULT_IMMR:
|
||||
Default address of the IMMR after system reset.
|
||||
Needed on some 8260 systems (MPC8260ADS and RPXsuper)
|
||||
to be able to adjust the position of the IMMR
|
||||
register after a reset.
|
||||
|
||||
Needed on some 8260 systems (MPC8260ADS, PQ2FADS-ZU,
|
||||
and RPXsuper) to be able to adjust the position of
|
||||
the IMMR register after a reset.
|
||||
|
||||
- Floppy Disk Support:
|
||||
CFG_FDC_DRIVE_NUMBER
|
||||
@@ -1862,7 +1871,7 @@ configurations; the following names are supported:
|
||||
GENIETV_config TQM823L_config PIP405_config
|
||||
GEN860T_config EBONY_config FPS860L_config
|
||||
ELPT860_config cmi_mpc5xx_config NETVIA_config
|
||||
at91rm9200dk_config omap1510inn_config
|
||||
at91rm9200dk_config omap1510inn_config MPC8260ADS_config
|
||||
|
||||
Note: for some board special configuration names may exist; check if
|
||||
additional information is available from the board vendor; for
|
||||
@@ -2226,7 +2235,7 @@ defines the following image properties:
|
||||
* Target Operating System (Provisions for OpenBSD, NetBSD, FreeBSD,
|
||||
4.4BSD, Linux, SVR4, Esix, Solaris, Irix, SCO, Dell, NCR, VxWorks,
|
||||
LynxOS, pSOS, QNX, RTEMS, ARTOS;
|
||||
Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, ARTOS).
|
||||
Currently supported: Linux, NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS).
|
||||
* Target CPU Architecture (Provisions for Alpha, ARM, Intel x86,
|
||||
IA64, MIPS, MIPS, PowerPC, IBM S390, SuperH, Sparc, Sparc 64 Bit;
|
||||
Currently supported: PowerPC).
|
||||
|
||||
@@ -91,31 +91,31 @@ Done:
|
||||
*/
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
static struct pci_config_table pci_a3000_config_table[] = {
|
||||
/* vendor, device, class */
|
||||
/* bus, dev, func */
|
||||
/* vendor, device, class */
|
||||
/* bus, dev, func */
|
||||
{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_83815, PCI_ANY_ID,
|
||||
PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, /* dp83815 eth0 divice */
|
||||
PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, /* dp83815 eth0 divice */
|
||||
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
|
||||
PCI_ENET0_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER }},
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0x14, PCI_ANY_ID, /* PCI slot1 */
|
||||
PCI_ANY_ID, 0x14, PCI_ANY_ID, /* PCI slot1 */
|
||||
pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
|
||||
PCI_ENET1_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER }},
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0x15, PCI_ANY_ID, /* PCI slot2 */
|
||||
PCI_ANY_ID, 0x15, PCI_ANY_ID, /* PCI slot2 */
|
||||
pci_cfgfunc_config_device, { PCI_ENET2_IOADDR,
|
||||
PCI_ENET2_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER }},
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
PCI_ANY_ID, 0x16, PCI_ANY_ID, /* PCI slot3 */
|
||||
PCI_ANY_ID, 0x16, PCI_ANY_ID, /* PCI slot3 */
|
||||
pci_cfgfunc_config_device, { PCI_ENET3_IOADDR,
|
||||
PCI_ENET3_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <devices.h>
|
||||
#include <syscall.h>
|
||||
#include <net.h>
|
||||
#include <version.h>
|
||||
#include <dtt.h>
|
||||
|
||||
@@ -173,7 +173,7 @@ void after_reloc (ulong dest_addr)
|
||||
/*
|
||||
* Jump to the main U-Boot board init code
|
||||
*/
|
||||
board_init_r(gd, dest_addr);
|
||||
board_init_r((gd_t *)gd, dest_addr);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -142,7 +142,7 @@ void after_reloc (ulong dest_addr)
|
||||
/*
|
||||
* Jump to the main U-Boot board init code
|
||||
*/
|
||||
board_init_r (gd, dest_addr);
|
||||
board_init_r ((gd_t *)gd, dest_addr);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -254,7 +254,7 @@ long int initdram (int board_type)
|
||||
upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
memctl->memc_mbmr = MAMR_GPL_B4DIS;
|
||||
memctl->memc_mbmr = MBMR_GPL_B4DIS; /* should this be mamr? - NTL */
|
||||
memctl->memc_mptpr = MPTPR_PTP_DIV64;
|
||||
memctl->memc_mar = 0x00008800;
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ after_reloc(ulong dest_addr)
|
||||
}
|
||||
|
||||
/* now, jump to the main U-Boot board init code */
|
||||
board_init_r (gd, dest_addr);
|
||||
board_init_r ((gd_t *)gd, dest_addr);
|
||||
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
short i;
|
||||
FLASH_WORD_SIZE value;
|
||||
ulong base = (ulong)addr;
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)addr;
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
@@ -247,7 +247,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE)AMD_ID_F040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
@@ -335,14 +335,14 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) ||
|
||||
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) ||
|
||||
(info->flash_id == FLASH_AM040) ||
|
||||
(info->flash_id == FLASH_AMDLV033C) ||
|
||||
(info->flash_id == FLASH_AMDLV065D)) {
|
||||
ulong sectsize = info->size / info->sector_count;
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * sectsize);
|
||||
} else {
|
||||
} else {
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
@@ -370,9 +370,9 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
/* D0 = 1 if protected */
|
||||
|
||||
addr2 = (volatile FLASH_WORD_SIZE *)(info->start[i]);
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
|
||||
info->protect[i] = 0;
|
||||
else
|
||||
else
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
while ((addr2[0] & 0x00800080) !=
|
||||
(FLASH_WORD_SIZE) 0x00800080) {
|
||||
if ((now=get_timer(start)) >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
addr[0] = (FLASH_WORD_SIZE)0x00F000F0;
|
||||
return 1;
|
||||
@@ -551,12 +551,12 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
*/
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
|
||||
volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
|
||||
volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
|
||||
ulong start;
|
||||
int flag;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((volatile ulong *)dest) & data) != data) {
|
||||
@@ -565,7 +565,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (i=0; i < 4/sizeof(FLASH_WORD_SIZE); i++) {
|
||||
for (i=0; i < 4/sizeof(FLASH_WORD_SIZE); i++) {
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <asm/mmu.h>
|
||||
|
||||
#include "exbitgen.h"
|
||||
|
||||
|
||||
/* IIC declarations (This is an extract from 405gp_i2c.h, which also contains some */
|
||||
/* c-code declarations and consequently can't be included here). */
|
||||
/* (Possibly to be solved somehow else). */
|
||||
@@ -100,25 +100,25 @@
|
||||
#define TIMEBASE_10PS (1000000000 / CONFIG_SYS_CLK_FREQ) * 100
|
||||
|
||||
#define FLASH_8bit_AP 0x9B015480
|
||||
#define FLASH_8bit_CR 0xFFF18000 /* 1MB(min), 8bit, R/W */
|
||||
#define FLASH_8bit_CR 0xFFF18000 /* 1MB(min), 8bit, R/W */
|
||||
|
||||
#define FLASH_32bit_AP 0x9B015480
|
||||
#define FLASH_32bit_CR 0xFFE3C000 /* 2MB, 32bit, R/W */
|
||||
|
||||
|
||||
#define WDCR_EBC(reg,val) addi r4,0,reg;\
|
||||
mtdcr ebccfga,r4;\
|
||||
addis r4,0,val@h;\
|
||||
ori r4,r4,val@l;\
|
||||
mtdcr ebccfgd,r4
|
||||
mtdcr ebccfga,r4;\
|
||||
addis r4,0,val@h;\
|
||||
ori r4,r4,val@l;\
|
||||
mtdcr ebccfgd,r4
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
* Function: ext_bus_cntlr_init
|
||||
* Description: Initializes the External Bus Controller for the external
|
||||
* peripherals. IMPORTANT: For pass1 this code must run from
|
||||
* Description: Initializes the External Bus Controller for the external
|
||||
* peripherals. IMPORTANT: For pass1 this code must run from
|
||||
* cache since you can not reliably change a peripheral banks
|
||||
* timing register (pbxap) while running code from that bank.
|
||||
* For ex., since we are running from ROM on bank 0, we can NOT
|
||||
* For ex., since we are running from ROM on bank 0, we can NOT
|
||||
* execute the code that modifies bank 0 timings from ROM, so
|
||||
* we run it from cache.
|
||||
* Bank 0 - Boot flash
|
||||
@@ -126,63 +126,63 @@
|
||||
* Bank 5 - CPLD
|
||||
* Bank 6 - not used
|
||||
* Bank 7 - Heathrow chip
|
||||
*---------------------------------------------------------------------
|
||||
*---------------------------------------------------------------------
|
||||
*/
|
||||
.globl ext_bus_cntlr_init
|
||||
.globl ext_bus_cntlr_init
|
||||
ext_bus_cntlr_init:
|
||||
mflr r4 /* save link register */
|
||||
bl ..getAddr
|
||||
mflr r4 /* save link register */
|
||||
bl ..getAddr
|
||||
..getAddr:
|
||||
mflr r3 /* get address of ..getAddr */
|
||||
mtlr r4 /* restore link register */
|
||||
addi r4,0,14 /* set ctr to 10; used to prefetch */
|
||||
mtctr r4 /* 10 cache lines to fit this function */
|
||||
/* in cache (gives us 8x10=80 instrctns) */
|
||||
mflr r3 /* get address of ..getAddr */
|
||||
mtlr r4 /* restore link register */
|
||||
addi r4,0,14 /* set ctr to 10; used to prefetch */
|
||||
mtctr r4 /* 10 cache lines to fit this function */
|
||||
/* in cache (gives us 8x10=80 instrctns) */
|
||||
..ebcloop:
|
||||
icbt r0,r3 /* prefetch cache line for addr in r3 */
|
||||
addi r3,r3,32 /* move to next cache line */
|
||||
bdnz ..ebcloop /* continue for 10 cache lines */
|
||||
icbt r0,r3 /* prefetch cache line for addr in r3 */
|
||||
addi r3,r3,32 /* move to next cache line */
|
||||
bdnz ..ebcloop /* continue for 10 cache lines */
|
||||
|
||||
mflr r31 /* save link register */
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Delay to ensure all accesses to ROM are complete before changing
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Delay to ensure all accesses to ROM are complete before changing
|
||||
* bank 0 timings. 200usec should be enough.
|
||||
* 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles
|
||||
*-----------------------------------------------------------
|
||||
* 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles
|
||||
*-----------------------------------------------------------
|
||||
*/
|
||||
|
||||
addis r3,0,0x0
|
||||
ori r3,r3,0xA000 /* ensure 200usec have passed since reset */
|
||||
mtctr r3
|
||||
ori r3,r3,0xA000 /* ensure 200usec have passed since reset */
|
||||
mtctr r3
|
||||
..spinlp:
|
||||
bdnz ..spinlp /* spin loop */
|
||||
bdnz ..spinlp /* spin loop */
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
* Memory Bank 0 (Boot Flash) initialization
|
||||
*---------------------------------------------------------------
|
||||
/*---------------------------------------------------------------
|
||||
* Memory Bank 0 (Boot Flash) initialization
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
WDCR_EBC(pb0ap, FLASH_32bit_AP)
|
||||
WDCR_EBC(pb0cr, 0xffe38000)
|
||||
/*pnc WDCR_EBC(pb0cr, FLASH_32bit_CR) */
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
* Memory Bank 5 (CPLD) initialization
|
||||
*---------------------------------------------------------------
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
* Memory Bank 5 (CPLD) initialization
|
||||
*---------------------------------------------------------------
|
||||
*/
|
||||
WDCR_EBC(pb5ap, 0x01010040)
|
||||
/*jsa recommendation: WDCR_EBC(pb5ap, 0x00010040) */
|
||||
WDCR_EBC(pb5cr, 0x10038000)
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 6 (not used) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 6 (not used) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb6cr, 0x00000000)
|
||||
|
||||
/* Read HW ID to determine whether old H2 board or new generic CPU board */
|
||||
addis r3, 0, HW_ID_ADDR@h
|
||||
ori r3, r3, HW_ID_ADDR@l
|
||||
lbz r3,0x0000(r3)
|
||||
lbz r3,0x0000(r3)
|
||||
cmpi 0, r3, 1 /* if (HW_ID==1) */
|
||||
beq setup_h2evalboard /* then jump */
|
||||
cmpi 0, r3, 2 /* if (HW_ID==2) */
|
||||
@@ -191,9 +191,9 @@ ext_bus_cntlr_init:
|
||||
beq setup_genieboard /* then jump */
|
||||
|
||||
setup_genieboard:
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 1 (Application Flash) initialization for generic CPU board */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 1 (Application Flash) initialization for generic CPU board */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* WDCR_EBC(pb1ap, 0x7b015480) /###* T.B.M. */
|
||||
/* WDCR_EBC(pb1ap, 0x7F8FFE80) /###* T.B.M. */
|
||||
WDCR_EBC(pb1ap, 0x9b015480) /* hlb-20020207: burst 8 bit 6 cycles */
|
||||
@@ -201,68 +201,68 @@ setup_genieboard:
|
||||
/* WDCR_EBC(pb1cr, 0x20098000) /###* 16 MB */
|
||||
WDCR_EBC(pb1cr, 0x200B8000) /* 32 MB */
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 4 (Onboard FPGA) initialization for generic CPU board */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 4 (Onboard FPGA) initialization for generic CPU board */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb4ap, 0x01010000) /* */
|
||||
WDCR_EBC(pb4cr, 0x1021c000) /* */
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 7 (Heathrow chip on Reference board) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 7 (Heathrow chip on Reference board) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb7ap, 0x200ffe80) /* No Ready, many wait states (let reflections die out) */
|
||||
WDCR_EBC(pb7cr, 0X4001A000)
|
||||
|
||||
bl setup_continue
|
||||
|
||||
|
||||
|
||||
setup_h2evalboard:
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 1 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 1 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb1ap, 0x7b015480) /* T.B.M. */
|
||||
/*3010 WDCR_EBC(pb1ap, 0x7F8FFE80) /###* T.B.M. */
|
||||
WDCR_EBC(pb1cr, 0x20058000)
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 2 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb2ap, 0x7b015480) /* T.B.M. */
|
||||
/*3010 WDCR_EBC(pb2ap, 0x7F8FFE80) /###* T.B.M. */
|
||||
WDCR_EBC(pb2cr, 0x20458000)
|
||||
WDCR_EBC(pb1cr, 0x20058000)
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 3 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 2 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb2ap, 0x7b015480) /* T.B.M. */
|
||||
/*3010 WDCR_EBC(pb2ap, 0x7F8FFE80) /###* T.B.M. */
|
||||
WDCR_EBC(pb2cr, 0x20458000)
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 3 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb3ap, 0x7b015480) /* T.B.M. */
|
||||
/*3010 WDCR_EBC(pb3ap, 0x7F8FFE80) /###* T.B.M. */
|
||||
WDCR_EBC(pb3cr, 0x20858000)
|
||||
WDCR_EBC(pb3cr, 0x20858000)
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 4 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 4 (Application Flash) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb4ap, 0x7b015480) /* T.B.M. */
|
||||
/*3010 WDCR_EBC(pb4ap, 0x7F8FFE80) /###* T.B.M. */
|
||||
WDCR_EBC(pb4cr, 0x20C58000)
|
||||
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 7 (Heathrow chip) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
/*--------------------------------------------------------------- */
|
||||
/* Memory Bank 7 (Heathrow chip) initialization */
|
||||
/*--------------------------------------------------------------- */
|
||||
WDCR_EBC(pb7ap, 0x02000280) /* No Ready, 4 wait states */
|
||||
WDCR_EBC(pb7cr, 0X4001A000)
|
||||
|
||||
setup_continue:
|
||||
|
||||
|
||||
mtlr r31 /* restore lr */
|
||||
|
||||
mtlr r31 /* restore lr */
|
||||
nop /* pass2 DCR errata #8 */
|
||||
blr
|
||||
blr
|
||||
|
||||
/*--------------------------------------------------------------------- */
|
||||
/* Function: sdram_init */
|
||||
/* Description: Configures SDRAM memory banks. */
|
||||
/*--------------------------------------------------------------------- */
|
||||
.globl sdram_init
|
||||
.globl sdram_init
|
||||
|
||||
sdram_init:
|
||||
#if CFG_MONITOR_BASE < CFG_FLASH_BASE
|
||||
@@ -377,12 +377,12 @@ sdram_init:
|
||||
subf r5, r6, r17
|
||||
or r4, r4, r5
|
||||
|
||||
/*----------------------------------------------------------- */
|
||||
/* Set SDTR1 */
|
||||
/*----------------------------------------------------------- */
|
||||
addi r5,0,mem_sdtr1
|
||||
mtdcr memcfga,r5
|
||||
mtdcr memcfgd,r4
|
||||
/*----------------------------------------------------------- */
|
||||
/* Set SDTR1 */
|
||||
/*----------------------------------------------------------- */
|
||||
addi r5,0,mem_sdtr1
|
||||
mtdcr memcfga,r5
|
||||
mtdcr memcfgd,r4
|
||||
|
||||
/*----------------------------------------------------------- */
|
||||
/* */
|
||||
@@ -444,36 +444,36 @@ b1skip: addi r7,0,mem_mb2cf
|
||||
addi r7,0,mem_mb3cf
|
||||
mtdcr memcfga,r7
|
||||
mtdcr memcfgd,r6
|
||||
b3skip:
|
||||
b3skip:
|
||||
|
||||
/*----------------------------------------------------------- */
|
||||
/* Set RTR */
|
||||
/*----------------------------------------------------------- */
|
||||
/*----------------------------------------------------------- */
|
||||
/* Set RTR */
|
||||
/*----------------------------------------------------------- */
|
||||
cmpi 0, r30, 1600
|
||||
bge rtr_1
|
||||
addis r7, 0, 0x05F0 /* RTR value for 100Mhz */
|
||||
addis r7, 0, 0x05F0 /* RTR value for 100Mhz */
|
||||
bl rtr_2
|
||||
rtr_1: addis r7, 0, 0x03F8
|
||||
rtr_2: addi r4,0,mem_rtr
|
||||
mtdcr memcfga,r4
|
||||
mtdcr memcfgd,r7
|
||||
|
||||
/*----------------------------------------------------------- */
|
||||
/* Delay to ensure 200usec have elapsed since reset. Assume worst */
|
||||
/* case that the core is running 200Mhz: */
|
||||
/* 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles */
|
||||
/*----------------------------------------------------------- */
|
||||
addis r3,0,0x0000
|
||||
ori r3,r3,0xA000 /* ensure 200usec have passed since reset */
|
||||
mtctr r3
|
||||
/*----------------------------------------------------------- */
|
||||
/* Delay to ensure 200usec have elapsed since reset. Assume worst */
|
||||
/* case that the core is running 200Mhz: */
|
||||
/* 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles */
|
||||
/*----------------------------------------------------------- */
|
||||
addis r3,0,0x0000
|
||||
ori r3,r3,0xA000 /* ensure 200usec have passed since reset */
|
||||
mtctr r3
|
||||
..spinlp2:
|
||||
bdnz ..spinlp2 /* spin loop */
|
||||
bdnz ..spinlp2 /* spin loop */
|
||||
|
||||
/*----------------------------------------------------------- */
|
||||
/* Set memory controller options reg, MCOPT1. */
|
||||
/*----------------------------------------------------------- */
|
||||
/* Set memory controller options reg, MCOPT1. */
|
||||
/* Set DC_EN to '1' and BRD_PRF to '01' for 16 byte PLB Burst */
|
||||
/* read/prefetch. */
|
||||
/*----------------------------------------------------------- */
|
||||
/*----------------------------------------------------------- */
|
||||
addi r4,0,mem_mcopt1
|
||||
mtdcr memcfga,r4
|
||||
addis r4,0,0x80C0 /* set DC_EN=1 */
|
||||
@@ -481,13 +481,13 @@ rtr_2: addi r4,0,mem_rtr
|
||||
mtdcr memcfgd,r4
|
||||
|
||||
|
||||
/*----------------------------------------------------------- */
|
||||
/* Delay to ensure 10msec have elapsed since reset. This is */
|
||||
/* required for the MPC952 to stabalize. Assume worst */
|
||||
/* case that the core is running 200Mhz: */
|
||||
/* 200,000,000 (cycles/sec) X .010 (sec) = 0x1E8480 cycles */
|
||||
/* This delay should occur before accessing SDRAM. */
|
||||
/*----------------------------------------------------------- */
|
||||
/*----------------------------------------------------------- */
|
||||
/* Delay to ensure 10msec have elapsed since reset. This is */
|
||||
/* required for the MPC952 to stabalize. Assume worst */
|
||||
/* case that the core is running 200Mhz: */
|
||||
/* 200,000,000 (cycles/sec) X .010 (sec) = 0x1E8480 cycles */
|
||||
/* This delay should occur before accessing SDRAM. */
|
||||
/*----------------------------------------------------------- */
|
||||
addis r3,0,0x001E
|
||||
ori r3,r3,0x8480 /* ensure 10msec have passed since reset */
|
||||
mtctr r3
|
||||
@@ -501,8 +501,8 @@ rtr_2: addi r4,0,mem_rtr
|
||||
stb r4,0(r5)
|
||||
eieio
|
||||
|
||||
mtlr r31 /* restore lr */
|
||||
blr
|
||||
mtlr r31 /* restore lr */
|
||||
blr
|
||||
|
||||
/*--------------------------------------------------------------------- */
|
||||
/* Function: read_spd */
|
||||
@@ -512,21 +512,21 @@ rtr_2: addi r4,0,mem_rtr
|
||||
|
||||
#define WRITE_I2C(reg,val) \
|
||||
addi r3,0,val;\
|
||||
addis r4, 0, 0xef60;\
|
||||
ori r4, r4, 0x0500 + reg;\
|
||||
stb r3, 0(r4);\
|
||||
eieio
|
||||
addis r4, 0, 0xef60;\
|
||||
ori r4, r4, 0x0500 + reg;\
|
||||
stb r3, 0(r4);\
|
||||
eieio
|
||||
|
||||
#define READ_I2C(reg) \
|
||||
addis r3, 0, 0xef60;\
|
||||
ori r3, r3, 0x0500 + reg;\
|
||||
lbz r3, 0x0000(r3);\
|
||||
eieio
|
||||
addis r3, 0, 0xef60;\
|
||||
ori r3, r3, 0x0500 + reg;\
|
||||
lbz r3, 0x0000(r3);\
|
||||
eieio
|
||||
|
||||
read_spd:
|
||||
|
||||
mflr r5
|
||||
|
||||
|
||||
/* Initialize i2c */
|
||||
/*--------------- */
|
||||
WRITE_I2C(IICLMADR, 0x00) /* clear lo master address */
|
||||
@@ -558,9 +558,9 @@ read_spd:
|
||||
|
||||
/* Wait a little */
|
||||
/*-------------- */
|
||||
addis r3,0,0x0000
|
||||
ori r3,r3,0xA000
|
||||
mtctr r3
|
||||
addis r3,0,0x0000
|
||||
ori r3,r3,0xA000
|
||||
mtctr r3
|
||||
in02: bdnz in02
|
||||
|
||||
/* Issue write command */
|
||||
@@ -572,12 +572,12 @@ in02: bdnz in02
|
||||
/*--------------- */
|
||||
addi r7, 0, 0 /* byte counter in r7 */
|
||||
addi r8, 0, 0 /* checksum in r8 */
|
||||
rdlp:
|
||||
rdlp:
|
||||
/* issue read command */
|
||||
/*------------------- */
|
||||
cmpi 0, r7, 127
|
||||
blt rd01
|
||||
WRITE_I2C(IICCNTL, IIC_CNTL_READ | IIC_CNTL_PT)
|
||||
WRITE_I2C(IICCNTL, IIC_CNTL_READ | IIC_CNTL_PT)
|
||||
bl rd02
|
||||
rd01: WRITE_I2C(IICCNTL, IIC_CNTL_READ | IIC_CNTL_CHT | IIC_CNTL_PT)
|
||||
rd02: bl wait_i2c_transfer_done
|
||||
@@ -585,46 +585,46 @@ rd02: bl wait_i2c_transfer_done
|
||||
/* Fetch byte from buffer */
|
||||
/*----------------------- */
|
||||
READ_I2C(IICMDBUF)
|
||||
|
||||
|
||||
/* Retrieve parameters that are going to be used during configuration. */
|
||||
/* Save them in dedicated registers. */
|
||||
/*------------------------------------------------------------ */
|
||||
cmpi 0, r7, 3 /* Save byte 3 in r10 */
|
||||
bne rd10
|
||||
addi r10, r3, 0
|
||||
addi r10, r3, 0
|
||||
rd10: cmpi 0, r7, 4 /* Save byte 4 in r11 */
|
||||
bne rd11
|
||||
addi r11, r3, 0
|
||||
addi r11, r3, 0
|
||||
rd11: cmpi 0, r7, 5 /* Save byte 5 in r12 */
|
||||
bne rd12
|
||||
addi r12, r3, 0
|
||||
addi r12, r3, 0
|
||||
rd12: cmpi 0, r7, 17 /* Save byte 17 in r13 */
|
||||
bne rd13
|
||||
addi r13, r3, 0
|
||||
addi r13, r3, 0
|
||||
rd13: cmpi 0, r7, 18 /* Save byte 18 in r14 */
|
||||
bne rd14
|
||||
addi r14, r3, 0
|
||||
addi r14, r3, 0
|
||||
rd14: cmpi 0, r7, 31 /* Save byte 31 in r15 */
|
||||
bne rd15
|
||||
addi r15, r3, 0
|
||||
addi r15, r3, 0
|
||||
rd15: cmpi 0, r7, 27 /* Save byte 27 in r16 */
|
||||
bne rd16
|
||||
addi r16, r3, 0
|
||||
addi r16, r3, 0
|
||||
rd16: cmpi 0, r7, 29 /* Save byte 29 in r17 */
|
||||
bne rd17
|
||||
addi r17, r3, 0
|
||||
addi r17, r3, 0
|
||||
rd17: cmpi 0, r7, 30 /* Save byte 30 in r18 */
|
||||
bne rd18
|
||||
addi r18, r3, 0
|
||||
addi r18, r3, 0
|
||||
rd18: cmpi 0, r7, 9 /* Save byte 9 in r19 */
|
||||
bne rd19
|
||||
addi r19, r3, 0
|
||||
addi r19, r3, 0
|
||||
rd19: cmpi 0, r7, 23 /* Save byte 23 in r20 */
|
||||
bne rd20
|
||||
addi r20, r3, 0
|
||||
addi r20, r3, 0
|
||||
rd20: cmpi 0, r7, 25 /* Save byte 25 in r21 */
|
||||
bne rd21
|
||||
addi r21, r3, 0
|
||||
addi r21, r3, 0
|
||||
rd21:
|
||||
|
||||
/* Calculate checksum of the first 63 bytes */
|
||||
@@ -647,16 +647,16 @@ rd30: andi. r8, r8, 0xff /* use only 8 bits */
|
||||
eieio
|
||||
rderr: bl rderr
|
||||
|
||||
rd31:
|
||||
|
||||
rd31:
|
||||
|
||||
/* Increment byte counter and check whether all bytes have been read. */
|
||||
/*------------------------------------------------------------------- */
|
||||
addi r7, r7, 1
|
||||
cmpi 0, r7, 127
|
||||
bgt rd05
|
||||
bl rdlp
|
||||
rd05:
|
||||
mtlr r5 /* restore lr */
|
||||
rd05:
|
||||
mtlr r5 /* restore lr */
|
||||
blr
|
||||
|
||||
wait_i2c_transfer_done:
|
||||
@@ -664,8 +664,8 @@ wait_i2c_transfer_done:
|
||||
wt01: READ_I2C(IICSTS)
|
||||
andi. r4, r3, IIC_STS_PT
|
||||
cmpi 0, r4, IIC_STS_PT
|
||||
beq wt01
|
||||
mtlr r6 /* restore lr */
|
||||
beq wt01
|
||||
mtlr r6 /* restore lr */
|
||||
blr
|
||||
|
||||
/*--------------------------------------------------------------------- */
|
||||
@@ -696,7 +696,7 @@ fm01: cmpi 0, r10, 11
|
||||
cmpi 0, r13, 2
|
||||
bne fm02
|
||||
addi r3, 0, 1
|
||||
bl fmfound
|
||||
bl fmfound
|
||||
|
||||
fm02: cmpi 0, r10, 12
|
||||
bne fm03
|
||||
@@ -815,7 +815,7 @@ fm14: cmpi 0, r10, 13
|
||||
addi r3, 0, 7
|
||||
bl fmfound
|
||||
|
||||
fm15:
|
||||
fm15:
|
||||
/* not found, error code to be issued on LEDs */
|
||||
addi r7, 0, LED_SDRAM_CODE_2
|
||||
addis r6, 0, 0x1000
|
||||
@@ -827,7 +827,7 @@ fmerr: bl fmerr
|
||||
fmfound:addi r6, 0, 1
|
||||
subf r3, r6, r3
|
||||
|
||||
mtlr r5 /* restore lr */
|
||||
mtlr r5 /* restore lr */
|
||||
blr
|
||||
|
||||
/*--------------------------------------------------------------------- */
|
||||
@@ -838,13 +838,13 @@ fmfound:addi r6, 0, 1
|
||||
find_size_code:
|
||||
|
||||
mflr r5
|
||||
|
||||
|
||||
addi r3, r15, 0 /* density */
|
||||
addi r7, 0, 0
|
||||
fs01: andi. r6, r3, 0x01
|
||||
cmpi 0, r6, 1
|
||||
beq fs04
|
||||
|
||||
|
||||
addi r7, r7, 1
|
||||
cmpi 0, r7, 7
|
||||
bge fs02
|
||||
@@ -866,7 +866,7 @@ fs04: addi r3, r7, 0
|
||||
addi r6, 0, 1
|
||||
subf r3, r6, r3
|
||||
fs05:
|
||||
mtlr r5 /* restore lr */
|
||||
mtlr r5 /* restore lr */
|
||||
blr
|
||||
|
||||
/*--------------------------------------------------------------------- */
|
||||
@@ -895,9 +895,9 @@ fc01: srw r6, r14, r4 /* */
|
||||
addi r7, r19, 0 /* SDRAM cycle time for highest CAS latenty */
|
||||
|
||||
bl fc03
|
||||
fc02:
|
||||
fc02:
|
||||
addi r7, r20, 0 /* SDRAM cycle time for next-highest CAS latenty */
|
||||
fc03:
|
||||
fc03:
|
||||
addi r8, r7, 0
|
||||
addi r9, 0, 4
|
||||
srw r7, r7, r9
|
||||
@@ -910,7 +910,7 @@ fc03:
|
||||
bgt fc05
|
||||
addi r3, r2, 0
|
||||
bl fc05
|
||||
fc04:
|
||||
fc04:
|
||||
addi r7, r21, 0 /* SDRAM cycle time for third-highest CAS latenty */
|
||||
addi r8, r7, 0
|
||||
addi r9, 0, 2
|
||||
@@ -933,9 +933,9 @@ fc06: addi r6, 0, 1
|
||||
cmpi 0, r4, 0
|
||||
bne fc01
|
||||
|
||||
fc07:
|
||||
fc07:
|
||||
|
||||
mtlr r5 /* restore lr */
|
||||
mtlr r5 /* restore lr */
|
||||
blr
|
||||
#endif
|
||||
|
||||
@@ -1000,7 +1000,7 @@ fc07:
|
||||
/* Size: 2 MB */
|
||||
/* Usage: read/write */
|
||||
/* Width: 32 bit */
|
||||
|
||||
|
||||
/* Walnut fpga pb7ap */
|
||||
/* 0 1 8 1 5 2 8 0 */
|
||||
/* 0 + 00000 + 011 + 000 + 00 + 01 + 01 + 01 + 001 + 0 + 1 + 0 + 0 + 00000 */
|
||||
|
||||
@@ -98,7 +98,7 @@ SECTIONS
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -128,7 +128,7 @@ long int initdram (int board_type)
|
||||
|
||||
/* That should do it, just enable the periodic refresh in burst of 4*/
|
||||
memctl->memc_mamr = CFG_MAMR_48_SDR | MAMR_TLFA_4X;
|
||||
memctl->memc_mamr |= (MAMR_PTAE | MAMR_GPL_B4DIS);
|
||||
memctl->memc_mamr |= (MAMR_PTAE | MAMR_GPL_A4DIS);
|
||||
|
||||
size_b0 = 16*1024*1024;
|
||||
|
||||
@@ -141,7 +141,7 @@ long int initdram (int board_type)
|
||||
|
||||
upmconfig(UPMB, (uint *)dsp_disp_table, sizeof(dsp_disp_table)/sizeof(uint));
|
||||
|
||||
memctl->memc_mbmr = MAMR_GPL_B4DIS;
|
||||
memctl->memc_mbmr = MBMR_GPL_B4DIS;
|
||||
|
||||
memctl->memc_or4 = CFG_OR4;
|
||||
memctl->memc_br4 = CFG_BR4;
|
||||
|
||||
@@ -303,7 +303,7 @@ board_poweroff(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
|
||||
@@ -163,7 +163,7 @@ long int initdram (int board_type)
|
||||
memctl->memc_mcr = 0x80804105; /* SDRAM bank 1 */
|
||||
|
||||
/* Execute refresh 8 times */
|
||||
memctl->memc_mbmr = (CFG_MBMR_8COL & ~MAMR_TLFB_MSK) | MAMR_TLFB_8X ;
|
||||
memctl->memc_mbmr = (CFG_MBMR_8COL & ~MBMR_TLFB_MSK) | MBMR_TLFB_8X ;
|
||||
|
||||
memctl->memc_mcr = 0x80802130; /* SDRAM bank 0 - execute twice */
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ int _initsdram (uint base, uint * noMbytes)
|
||||
sizeof (fpga_table) / sizeof (uint));
|
||||
|
||||
/* Enable UPWAITB */
|
||||
mc->memc_mbmr = MAMR_GPL_B4DIS; /* (16-13) */
|
||||
mc->memc_mbmr = MBMR_GPL_B4DIS; /* (16-13) */
|
||||
|
||||
/* CS2, base FPGA_2_BASE - 4 MByte, use UPM B 32 Bit */
|
||||
mc->memc_or2 = 0xffc00000 | OR_BI;
|
||||
|
||||
47
board/icecube/Makefile
Normal file
47
board/icecube/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
#
|
||||
# (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
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
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
|
||||
|
||||
#########################################################################
|
||||
31
board/icecube/config.mk
Normal file
31
board/icecube/config.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# (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
|
||||
#
|
||||
|
||||
#
|
||||
# IceCube board
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xfff00000
|
||||
# TEXT_BASE = 0x00100000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
|
||||
480
board/icecube/flash.c
Normal file
480
board/icecube/flash.c
Normal file
@@ -0,0 +1,480 @@
|
||||
/*
|
||||
* (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>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* NOTE - CONFIG_FLASH_16BIT means the CPU interface is 16-bit, it
|
||||
* has nothing to do with the flash chip being 8-bit or 16-bit.
|
||||
*/
|
||||
#ifdef CONFIG_FLASH_16BIT
|
||||
typedef unsigned short FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned short FLASH_PORT_WIDTHV;
|
||||
#define FLASH_ID_MASK 0xFFFF
|
||||
#else
|
||||
typedef unsigned char FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned char FLASH_PORT_WIDTHV;
|
||||
#define FLASH_ID_MASK 0xFF
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define ORMASK(size) ((-size) & OR_AM_MSK)
|
||||
|
||||
#define FLASH_CYCLE1 0x0555
|
||||
#define FLASH_CYCLE2 0x02aa
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(FPWV *addr, flash_info_t *info);
|
||||
static void flash_reset(flash_info_t *info);
|
||||
static int write_word_amd(flash_info_t *info, FPWV *dest, FPW data);
|
||||
static flash_info_t *flash_get_info(ulong base);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* flash_init()
|
||||
*
|
||||
* sets up flash_info and returns size of FLASH (bytes)
|
||||
*/
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size = 0;
|
||||
int i;
|
||||
extern void flash_preinit(void);
|
||||
|
||||
flash_preinit();
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i < CFG_MAX_FLASH_BANKS; ++i) {
|
||||
ulong flashbase = CFG_FLASH_BASE;
|
||||
|
||||
memset(&flash_info[i], 0, sizeof(flash_info_t));
|
||||
|
||||
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+monitor_flash_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 ? size : 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_reset(flash_info_t *info)
|
||||
{
|
||||
FPWV *base = (FPWV *)(info->start[0]);
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL)
|
||||
*base = (FPW)0x00FF00FF; /* Intel Read Mode */
|
||||
else if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD)
|
||||
*base = (FPW)0x00F000F0; /* AMD Read Mode */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
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 - 1)
|
||||
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_AMDLV065D:
|
||||
fmt = "29LV065 (64 Mbit, uniform sectors)\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)
|
||||
{
|
||||
int i;
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
/* Write auto select command sequence and test FLASH answer */
|
||||
addr[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* for AMD, Intel ignores this */
|
||||
addr[FLASH_CYCLE2] = (FPW)0x00550055; /* for AMD, Intel ignores this */
|
||||
addr[FLASH_CYCLE1] = (FPW)0x00900090; /* selects Intel or AMD */
|
||||
|
||||
/* The manufacturer codes are only 1 byte, so just use 1 byte.
|
||||
* This works for any bus width and any FLASH device width.
|
||||
*/
|
||||
udelay(100);
|
||||
switch (addr[0] & 0xff) {
|
||||
|
||||
case (uchar)AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
|
||||
case (uchar)INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check 16 bits or 32 bits of ID so work on 32 or 16 bit bus. */
|
||||
if (info->flash_id != FLASH_UNKNOWN) switch ((FPW)addr[1]) {
|
||||
|
||||
case (FPW)AMD_ID_LV065D:
|
||||
info->flash_id += FLASH_AMDLV065D;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x00800000;
|
||||
for( i = 0; i < info->sector_count; i++ )
|
||||
info->start[i] = (ulong)addr + (i * 0x10000);
|
||||
break; /* => 8 or 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
flash_reset(info);
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
FPWV *addr;
|
||||
int flag, prot, sect;
|
||||
int intel = (info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL;
|
||||
ulong start, now, last;
|
||||
int rcode = 0;
|
||||
|
||||
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_AMDLV065D:
|
||||
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]);
|
||||
if (intel) {
|
||||
*addr = (FPW)0x00500050; /* clear status register */
|
||||
*addr = (FPW)0x00200020; /* erase setup */
|
||||
*addr = (FPW)0x00D000D0; /* erase confirm */
|
||||
}
|
||||
else {
|
||||
/* must be AMD style if not Intel */
|
||||
FPWV *base; /* first address in bank */
|
||||
|
||||
base = (FPWV *)(info->start[0]);
|
||||
base[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* unlock */
|
||||
base[FLASH_CYCLE2] = (FPW)0x00550055; /* unlock */
|
||||
base[FLASH_CYCLE1] = (FPW)0x00800080; /* erase mode */
|
||||
base[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* unlock */
|
||||
base[FLASH_CYCLE2] = (FPW)0x00550055; /* unlock */
|
||||
*addr = (FPW)0x00300030; /* erase sector */
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
start = get_timer(0);
|
||||
|
||||
/* wait at least 50us for AMD, 80us for Intel.
|
||||
* Let's wait 1 ms.
|
||||
*/
|
||||
udelay (1000);
|
||||
|
||||
while ((*addr & (FPW)0x00800080) != (FPW)0x00800080) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
|
||||
if (intel) {
|
||||
/* suspend erase */
|
||||
*addr = (FPW)0x00B000B0;
|
||||
}
|
||||
|
||||
flash_reset(info); /* reset to read mode */
|
||||
rcode = 1; /* failed */
|
||||
break;
|
||||
}
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((get_timer(last)) > CFG_HZ) {/* every second */
|
||||
putc ('.');
|
||||
last = get_timer(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((get_timer(last)) > CFG_HZ) { /* every second */
|
||||
putc ('.');
|
||||
last = get_timer(0);
|
||||
}
|
||||
|
||||
flash_reset(info); /* reset to read mode */
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
/* write one word to the flash */
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD:
|
||||
res = write_word_amd(info, (FPWV *)addr, data);
|
||||
break;
|
||||
default:
|
||||
/* unknown flash type, error! */
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
res = 1; /* not really a timeout, but gives error */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash for AMD FLASH
|
||||
* A word is 16 or 32 bits, whichever the bus width of the flash bank
|
||||
* (not an individual chip) is.
|
||||
*
|
||||
* returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)
|
||||
{
|
||||
ulong start;
|
||||
int flag;
|
||||
int res = 0; /* result, assume success */
|
||||
FPWV *base; /* first address in flash bank */
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*dest & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
|
||||
base = (FPWV *)(info->start[0]);
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
base[FLASH_CYCLE1] = (FPW)0x00AA00AA; /* unlock */
|
||||
base[FLASH_CYCLE2] = (FPW)0x00550055; /* unlock */
|
||||
base[FLASH_CYCLE1] = (FPW)0x00A000A0; /* selects program mode */
|
||||
|
||||
*dest = data; /* start programming the data */
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
start = get_timer (0);
|
||||
|
||||
/* data polling for D7 */
|
||||
while (res == 0 && (*dest & (FPW)0x00800080) != (data & (FPW)0x00800080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*dest = (FPW)0x00F000F0; /* reset bank */
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
128
board/icecube/icecube.c
Normal file
128
board/icecube/icecube.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* (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 <mpc5xxx.h>
|
||||
#include <pci.h>
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
#ifndef CFG_RAMBOOT
|
||||
/* configure SDRAM start/end */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x00000018;/* 32M at 0x0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x02000000;/* disabled */
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xc2233a00;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x88b70004;
|
||||
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0000;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0002;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x408d0000;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0002;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0004;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x504f0000;
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = 0x000007ff;/* 64M */
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xc2222600;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x88b70004;
|
||||
|
||||
/* address select register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_XLBSEL = 0x03000000;
|
||||
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd14f0000;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd14f0002;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd14f0002;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd14f0004;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x514f0000;
|
||||
#endif
|
||||
#else
|
||||
#ifdef CONFIG_MGT5100
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
#endif
|
||||
#endif
|
||||
/* return total ram size */
|
||||
#if defined(CONFIG_MGT5100)
|
||||
return (64 * 1024 * 1024);
|
||||
#elif defined(CONFIG_MPC5200)
|
||||
return (32 * 1024 * 1024);
|
||||
#endif
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
#if defined(CONFIG_MPC5200)
|
||||
puts ("Board: Motorola MPC5200 (IceCube)\n");
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
puts ("Board: Motorola MGT5100 (IceCube)\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void flash_preinit(void)
|
||||
{
|
||||
/*
|
||||
* Now, when we are in RAM, enable flash write
|
||||
* access for detection process.
|
||||
* Note that CS_BOOT cannot be cleared when
|
||||
* executing in flash.
|
||||
*/
|
||||
#if defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_ADDECR &= ~(1 << 25); /* disable CS_BOOT */
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 16); /* enable CS0 */
|
||||
#endif
|
||||
*(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
static struct pci_controller hose;
|
||||
|
||||
extern void pci_mpc5xxx_init(struct pci_controller *);
|
||||
|
||||
void pci_init_board(void)
|
||||
{
|
||||
pci_mpc5xxx_init(&hose);
|
||||
}
|
||||
#endif
|
||||
122
board/icecube/u-boot.lds
Normal file
122
board/icecube/u-boot.lds
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* (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
|
||||
*/
|
||||
|
||||
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 :
|
||||
{
|
||||
cpu/mpc5xxx/start.o (.text)
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.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 = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
@@ -246,14 +246,14 @@ initdram (int board_type)
|
||||
udelay(1);
|
||||
memctl->memc_mcr = 0x80806130; /* autorefresh */
|
||||
|
||||
memctl->memc_mbmr |= MAMR_PTBE; /* refresh enabled */
|
||||
memctl->memc_mbmr |= MBMR_PTBE; /* refresh enabled */
|
||||
|
||||
/*
|
||||
* Check Bank 0 Memory Size for re-configuration
|
||||
*/
|
||||
size_b0 = dram_size (CFG_MBMR_8COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
|
||||
|
||||
memctl->memc_mbmr = CFG_MBMR_8COL | MAMR_PTBE;
|
||||
memctl->memc_mbmr = CFG_MBMR_8COL | MBMR_PTBE;
|
||||
|
||||
return (size_b0);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ long int initdram (int board_type)
|
||||
udelay(1); /* 0x80006106 */
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_MB_CS3 | MCR_MLCF(1) | MCR_MAD(0x06);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTBE; /* refresh enabled */
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* refresh enabled */
|
||||
|
||||
udelay(200);
|
||||
|
||||
@@ -170,7 +170,7 @@ long int initdram (int board_type)
|
||||
(ulong *)SDRAM_BASE3_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTBE;
|
||||
memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTAE;
|
||||
|
||||
/*
|
||||
* Final mapping:
|
||||
|
||||
@@ -246,7 +246,7 @@ long int initdram (int board_type)
|
||||
udelay (1); /* 0x80006106 */
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_MB_CS3 | MCR_MLCF (1) | MCR_MAD (0x06);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTBE; /* refresh enabled */
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* refresh enabled */
|
||||
|
||||
udelay (200);
|
||||
|
||||
@@ -276,11 +276,11 @@ long int initdram (int board_type)
|
||||
|
||||
if (size8 < size9) { /* leave configuration at 9 columns */
|
||||
size_b0 = size9;
|
||||
memctl->memc_mamr = CFG_MAMR_9COL | MAMR_PTBE;
|
||||
memctl->memc_mamr = CFG_MAMR_9COL | MAMR_PTAE;
|
||||
udelay (500);
|
||||
} else { /* back to 8 columns */
|
||||
size_b0 = size8;
|
||||
memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTBE;
|
||||
memctl->memc_mamr = CFG_MAMR_8COL | MAMR_PTAE;
|
||||
udelay (500);
|
||||
}
|
||||
|
||||
@@ -1073,11 +1073,11 @@ static int key_pressed(void)
|
||||
#endif /* CONFIG_MODEM_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed(gd_t *gd)
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
uchar kbd_data[KEYBD_DATALEN];
|
||||
uchar val;
|
||||
|
||||
@@ -198,11 +198,19 @@ void reset_phy (void)
|
||||
vu_long *bcsr = (vu_long *)CFG_BCSR;
|
||||
|
||||
/* reset the FEC port */
|
||||
bcsr[1] &= ~FETH_RST;
|
||||
bcsr[1] &= ~FETH1_RST;
|
||||
udelay(2);
|
||||
bcsr[1] |= FETH_RST;
|
||||
bcsr[1] |= FETH1_RST;
|
||||
udelay(1000);
|
||||
#ifdef CONFIG_MII
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
/*
|
||||
* Do not bypass Rx/Tx (de)scrambler (fix configuration error)
|
||||
* Enable autonegotiation.
|
||||
*/
|
||||
miiphy_write(0, 16, 0x610);
|
||||
miiphy_write(0, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#else
|
||||
/*
|
||||
* Ethernet PHY is configured (by means of configuration pins)
|
||||
* to work at 10Mb/s only. We reconfigure it using MII
|
||||
@@ -212,6 +220,7 @@ void reset_phy (void)
|
||||
miiphy_write(0, PHY_ANAR, 0x01E1); /* Advertise all capabilities */
|
||||
miiphy_write(0, PHY_DCR, 0x0000); /* Do not bypass Rx/Tx (de)scrambler */
|
||||
miiphy_write(0, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#endif /* CONFIG_ADSTYPE == CFG_PQ2FADS */
|
||||
#endif /* CONFIG_MII */
|
||||
}
|
||||
|
||||
@@ -219,7 +228,7 @@ int board_pre_init (void)
|
||||
{
|
||||
vu_long *bcsr = (vu_long *)CFG_BCSR;
|
||||
|
||||
bcsr[1] = ~FETHIEN & ~RS232EN_1;
|
||||
bcsr[1] = ~FETHIEN1 & ~RS232EN_1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -231,12 +240,10 @@ long int initdram (int board_type)
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
volatile uchar *ramaddr, c = 0xff;
|
||||
|
||||
/* Initialisation is for 16MB DIMM the board is shipped with */
|
||||
long int msize = 16;
|
||||
uint or = 0xFF000CA0;
|
||||
uint psdmr = CFG_PSDMR;
|
||||
uint psrt = CFG_PSRT;
|
||||
long int msize;
|
||||
uint or;
|
||||
uint psdmr;
|
||||
uint psrt;
|
||||
|
||||
int i;
|
||||
|
||||
@@ -246,22 +253,29 @@ long int initdram (int board_type)
|
||||
immap->im_siu_conf.sc_tescr1 = 0x00004000;
|
||||
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
/* init local sdram, bank 4 */
|
||||
memctl->memc_lsrt = 0x00000010;
|
||||
#ifdef CFG_LSDRAM_BASE
|
||||
/* Init local bus SDRAM */
|
||||
memctl->memc_lsrt = CFG_LSRT;
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS /* CS3 */
|
||||
memctl->memc_or3 = 0xFF803280;
|
||||
memctl->memc_br3 = CFG_LSDRAM_BASE | 0x00001861;
|
||||
#else /* CS4 */
|
||||
memctl->memc_or4 = 0xFFC01480;
|
||||
memctl->memc_br4 = 0x04001861;
|
||||
memctl->memc_lsdmr = 0x2886A522;
|
||||
memctl->memc_br4 = CFG_LSDRAM_BASE | 0x00001861;
|
||||
#endif /* CONFIG_ADSTYPE == CFG_PQ2FADS */
|
||||
memctl->memc_lsdmr = CFG_LSDMR | 0x28000000;
|
||||
ramaddr = (uchar *) CFG_LSDRAM_BASE;
|
||||
*ramaddr = c;
|
||||
memctl->memc_lsdmr = 0x0886A522;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | 0x08000000;
|
||||
for (i = 0; i < 8; i++) {
|
||||
*ramaddr = c;
|
||||
}
|
||||
memctl->memc_lsdmr = 0x1886A522;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | 0x18000000;
|
||||
*ramaddr = c;
|
||||
memctl->memc_lsdmr = 0x4086A522;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | 0x40000000;
|
||||
#endif /* CFG_LSDRAM_BASE */
|
||||
|
||||
/* init sdram dimm */
|
||||
/* Init 60x bus SDRAM */
|
||||
#ifdef CONFIG_SPD_EEPROM
|
||||
{
|
||||
spd_eeprom_t spd;
|
||||
@@ -398,6 +412,16 @@ long int initdram (int board_type)
|
||||
printf ("OR=%X, PSDMR=%08X, PSRT=%0X\n", or, psdmr, psrt);
|
||||
#endif /* SPD_DEBUG */
|
||||
}
|
||||
#else /* !CONFIG_SPD_EEPROM */
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
msize = 32;
|
||||
or = 0xFE002EC0;
|
||||
#else
|
||||
msize = 16;
|
||||
or = 0xFF000CA0;
|
||||
#endif /* CONFIG_ADSTYPE == CFG_PQ2FADS */
|
||||
psdmr = CFG_PSDMR;
|
||||
psrt = CFG_PSRT;
|
||||
#endif /* CONFIG_SPD_EEPROM */
|
||||
memctl->memc_psrt = psrt;
|
||||
memctl->memc_or2 = or;
|
||||
@@ -415,12 +439,20 @@ long int initdram (int board_type)
|
||||
*ramaddr = c;
|
||||
#endif
|
||||
|
||||
/* return total ram size of DIMM */
|
||||
/* return total 60x bus SDRAM size */
|
||||
return (msize * 1024 * 1024);
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
#if CONFIG_ADSTYPE == CFG_8260ADS
|
||||
puts ("Board: Motorola MPC8260ADS\n");
|
||||
#elif CONFIG_ADSTYPE == CFG_8266ADS
|
||||
puts ("Board: Motorola MPC8266ADS\n");
|
||||
#elif CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
puts ("Board: Motorola PQ2FADS-ZU\n");
|
||||
#else
|
||||
puts ("Board: unknown\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,8 @@ unsigned long flash_init (void)
|
||||
CFG_MONITOR_BASE+monitor_flash_len-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
/* protect reset vector */
|
||||
flash_info[0].protect[flash_info[0].sector_count-1] = 1;
|
||||
size_b1 = 0 ;
|
||||
flash_info[0].size = size_b0;
|
||||
#if 0
|
||||
|
||||
@@ -494,7 +494,7 @@ void mem_test_reloc(void)
|
||||
}
|
||||
|
||||
|
||||
int mem_test (unsigned long start, unsigned long ramsize, int quiet, int reloc)
|
||||
int mem_test (unsigned long start, unsigned long ramsize, int quiet)
|
||||
{
|
||||
unsigned long errors, stage;
|
||||
unsigned long startaddr, size, i;
|
||||
|
||||
@@ -110,7 +110,7 @@ static struct pci_pip405_config_entry piix4_ide_cntrl_f1[] = {
|
||||
#if !defined(CONFIG_MIP405T)
|
||||
{PCI_CFG_PIIX4_IDETIM, 0x80008000, 4}, /* enable Both IDE channels */
|
||||
#else
|
||||
{PCI_CFG_PIIX4_IDETIM, 0x80000000, 4}, /* enable IDE channel0 */
|
||||
{PCI_CFG_PIIX4_IDETIM, 0x00008000, 4}, /* enable IDE channel0 */
|
||||
#endif
|
||||
{ } /* end of device table */
|
||||
};
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include <miiphy.h>
|
||||
#include "../common/common_util.h"
|
||||
#include <i2c.h>
|
||||
#include <rtc.h>
|
||||
extern block_dev_desc_t * scsi_get_dev(int dev);
|
||||
extern block_dev_desc_t * ide_get_dev(int dev);
|
||||
|
||||
@@ -110,14 +111,14 @@ typedef struct {
|
||||
} sdram_t;
|
||||
#if defined(CONFIG_MIP405T)
|
||||
const sdram_t sdram_table[] = {
|
||||
{ 0x01, /* MIP405T Rev A, 64MByte -1 Board */
|
||||
{ 0x0F, /* MIP405T Rev A, 64MByte -1 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 (13x9x4) */
|
||||
4, /* size value (64MByte) */
|
||||
2, /* Address Mode = 2 (12x9x4) */
|
||||
3, /* size value (32MByte) */
|
||||
0}, /* ECC disabled */
|
||||
{ 0xff, /* terminator */
|
||||
0xff,
|
||||
@@ -281,11 +282,6 @@ int init_sdram (void)
|
||||
if((bc & 0x80)==0x80)
|
||||
SDRAM_err ("U-Boot configured for a MIP405 not for a MIP405T!!!\n");
|
||||
#endif
|
||||
#if !defined(CONFIG_MIP405T)
|
||||
/* since the ECC initialisation needs some time,
|
||||
* we show that we're alive
|
||||
*/
|
||||
serial_puts ("\nInitializing SDRAM, Please stand by");
|
||||
/* set-up the chipselect machine */
|
||||
mtdcr (ebccfga, pb0cr); /* get cs0 config reg */
|
||||
tmp = mfdcr (ebccfgd);
|
||||
@@ -311,7 +307,6 @@ int init_sdram (void)
|
||||
mtdcr (ebccfgd, UART1_AP);
|
||||
mtdcr (ebccfga, pb3cr);
|
||||
mtdcr (ebccfgd, UART1_CR);
|
||||
#endif
|
||||
bc = in8 (PLD_BOARD_CFG_REG);
|
||||
#ifdef SDRAM_DEBUG
|
||||
serial_puts ("\nstart SDRAM Setup\n");
|
||||
@@ -333,6 +328,11 @@ int init_sdram (void)
|
||||
write_hex (i);
|
||||
serial_puts (" \n");
|
||||
#endif
|
||||
/* since the ECC initialisation needs some time,
|
||||
* we show that we're alive
|
||||
*/
|
||||
if (sdram_table[i].ecc)
|
||||
serial_puts ("\nInitializing SDRAM, Please stand by");
|
||||
cal_val = sdram_table[i].cal - 1; /* Cas Latency */
|
||||
trp_clocks = sdram_table[i].trp; /* 20ns / 7.5 ns datain[27] */
|
||||
trcd_clocks = sdram_table[i].trcd; /* 20ns /7.5 ns (datain[29]) */
|
||||
@@ -559,7 +559,7 @@ void get_pcbrev_var(unsigned char *pcbrev, unsigned char *var)
|
||||
unsigned char bc;
|
||||
bc = in8 (PLD_BOARD_CFG_REG);
|
||||
*pcbrev=(bc >> 4) & 0xf;
|
||||
*var=bc & 0xf ;
|
||||
*var=16-(bc & 0xf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -654,8 +654,6 @@ long int initdram (int board_type)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
extern int mem_test (unsigned long start, unsigned long ramsize,
|
||||
int quiet);
|
||||
|
||||
static int test_dram (unsigned long ramsize)
|
||||
{
|
||||
@@ -666,8 +664,15 @@ static int test_dram (unsigned long ramsize)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* used to check if the time in RTC is valid */
|
||||
static unsigned long start;
|
||||
static struct rtc_time tm;
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
/* check, if RTC is running */
|
||||
rtc_get (&tm);
|
||||
start=get_timer(0);
|
||||
/* if MIP405 has booted from PCI, reset CCR0[24] as described in errata PCI_18 */
|
||||
if (mfdcr(strap) & PSR_ROM_LOC)
|
||||
mtspr(ccr0, (mfspr(ccr0) & ~0x80));
|
||||
@@ -688,9 +693,13 @@ void print_mip405_rev (void)
|
||||
}
|
||||
|
||||
extern void mem_test_reloc(void);
|
||||
extern int mk_date (char *, struct rtc_time *);
|
||||
|
||||
int last_stage_init (void)
|
||||
{
|
||||
unsigned long stop;
|
||||
struct rtc_time newtm;
|
||||
unsigned char *s;
|
||||
mem_test_reloc();
|
||||
/* write correct LED configuration */
|
||||
if (miiphy_write (0x1, 0x14, 0x2402) != 0) {
|
||||
@@ -704,6 +713,25 @@ int last_stage_init (void)
|
||||
print_mip405_rev ();
|
||||
show_stdio_dev ();
|
||||
check_env ();
|
||||
/* check if RTC time is valid */
|
||||
stop=get_timer(start);
|
||||
while(stop<1200) { /* we wait 1.2 sec to check if the RTC is running */
|
||||
udelay(1000);
|
||||
stop=get_timer(start);
|
||||
}
|
||||
rtc_get (&newtm);
|
||||
if(tm.tm_sec==newtm.tm_sec) {
|
||||
s=getenv("defaultdate");
|
||||
if(!s)
|
||||
mk_date ("010112001970", &newtm);
|
||||
else
|
||||
if(mk_date (s, &newtm)!=0) {
|
||||
printf("RTC: Bad date format in defaultdate\n");
|
||||
return 0;
|
||||
}
|
||||
rtc_reset ();
|
||||
rtc_set(&newtm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -745,10 +773,10 @@ void print_mip405_info (void)
|
||||
printf ("SER1 uses handshakes %s\n",
|
||||
(ext & 0x80) ? "DTR/DSR" : "RTS/CTS");
|
||||
#else
|
||||
printf ("User Config Switch %d %d %d %d %d %d %d %d %d\n",
|
||||
printf ("User Config Switch %d %d %d %d %d %d %d %d\n",
|
||||
(ext) & 0x1, (ext >> 1) & 0x1, (ext >> 2) & 0x1,
|
||||
(ext >> 3) & 0x1, (ext >> 4) & 0x1, (ext >> 5) & 0x1,
|
||||
(ext >> 6) & 0x1,(ext >> 7) & 0x1,(ext >> 8) & 0x1);
|
||||
(ext >> 6) & 0x1,(ext >> 7) & 0x1);
|
||||
#endif
|
||||
printf ("IDE Reset %s\n", (ext & 0x01) ? "asserted" : "not asserted");
|
||||
printf ("IRQs:\n");
|
||||
|
||||
@@ -57,7 +57,6 @@ SECTIONS
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
cpu/mpc8xx/speed.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
@@ -67,7 +66,6 @@ SECTIONS
|
||||
lib_generic/string.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_ppc/kgdb.o (.text)
|
||||
/* lib_ppc/ticks.o (.text) */
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
|
||||
@@ -42,171 +42,171 @@ _TEXT_BASE:
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/*
|
||||
* Configure 1510 pins functions to match our board.
|
||||
*/
|
||||
ldr r0, REG_PULL_DWN_CTRL_0
|
||||
ldr r1, VAL_PULL_DWN_CTRL_0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_PULL_DWN_CTRL_1
|
||||
ldr r1, VAL_PULL_DWN_CTRL_1
|
||||
str r1, [r0]
|
||||
ldr r0, REG_PULL_DWN_CTRL_2
|
||||
ldr r1, VAL_PULL_DWN_CTRL_2
|
||||
str r1, [r0]
|
||||
ldr r0, REG_PULL_DWN_CTRL_3
|
||||
ldr r1, VAL_PULL_DWN_CTRL_3
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_4
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_4
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_5
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_5
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_6
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_6
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_7
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_7
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_8
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_8
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_9
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_9
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_A
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_A
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_B
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_B
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_C
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_C
|
||||
str r1, [r0]
|
||||
ldr r0, REG_VOLTAGE_CTRL_0
|
||||
ldr r1, VAL_VOLTAGE_CTRL_0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_TEST_DBG_CTRL_0
|
||||
ldr r1, VAL_TEST_DBG_CTRL_0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_MOD_CONF_CTRL_0
|
||||
ldr r1, VAL_MOD_CONF_CTRL_0
|
||||
str r1, [r0]
|
||||
/*
|
||||
* Configure 1510 pins functions to match our board.
|
||||
*/
|
||||
ldr r0, REG_PULL_DWN_CTRL_0
|
||||
ldr r1, VAL_PULL_DWN_CTRL_0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_PULL_DWN_CTRL_1
|
||||
ldr r1, VAL_PULL_DWN_CTRL_1
|
||||
str r1, [r0]
|
||||
ldr r0, REG_PULL_DWN_CTRL_2
|
||||
ldr r1, VAL_PULL_DWN_CTRL_2
|
||||
str r1, [r0]
|
||||
ldr r0, REG_PULL_DWN_CTRL_3
|
||||
ldr r1, VAL_PULL_DWN_CTRL_3
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_4
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_4
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_5
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_5
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_6
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_6
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_7
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_7
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_8
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_8
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_9
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_9
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_A
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_A
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_B
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_B
|
||||
str r1, [r0]
|
||||
ldr r0, REG_FUNC_MUX_CTRL_C
|
||||
ldr r1, VAL_FUNC_MUX_CTRL_C
|
||||
str r1, [r0]
|
||||
ldr r0, REG_VOLTAGE_CTRL_0
|
||||
ldr r1, VAL_VOLTAGE_CTRL_0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_TEST_DBG_CTRL_0
|
||||
ldr r1, VAL_TEST_DBG_CTRL_0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_MOD_CONF_CTRL_0
|
||||
ldr r1, VAL_MOD_CONF_CTRL_0
|
||||
str r1, [r0]
|
||||
|
||||
/* Move to 1510 mode */
|
||||
ldr r0, REG_COMP_MODE_CTRL_0
|
||||
ldr r1, VAL_COMP_MODE_CTRL_0
|
||||
str r1, [r0]
|
||||
/* Move to 1510 mode */
|
||||
ldr r0, REG_COMP_MODE_CTRL_0
|
||||
ldr r1, VAL_COMP_MODE_CTRL_0
|
||||
str r1, [r0]
|
||||
|
||||
/* Set up Traffic Ctlr*/
|
||||
ldr r0, REG_TC_IMIF_PRIO
|
||||
mov r1, #0x0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_TC_EMIFS_PRIO
|
||||
str r1, [r0]
|
||||
ldr r0, REG_TC_EMIFF_PRIO
|
||||
str r1, [r0]
|
||||
/* Set up Traffic Ctlr*/
|
||||
ldr r0, REG_TC_IMIF_PRIO
|
||||
mov r1, #0x0
|
||||
str r1, [r0]
|
||||
ldr r0, REG_TC_EMIFS_PRIO
|
||||
str r1, [r0]
|
||||
ldr r0, REG_TC_EMIFF_PRIO
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, REG_TC_EMIFS_CONFIG
|
||||
ldr r1, [r0]
|
||||
bic r1, r1, #0x08 /* clear the global power-down enable PDE bit */
|
||||
bic r1, r1, #0x01 /* write protect flash by clearing the WP bit */
|
||||
str r1, [r0] /* EMIFS GlB Configuration. (value 0x12 most likely) */
|
||||
ldr r0, REG_TC_EMIFS_CONFIG
|
||||
ldr r1, [r0]
|
||||
bic r1, r1, #0x08 /* clear the global power-down enable PDE bit */
|
||||
bic r1, r1, #0x01 /* write protect flash by clearing the WP bit */
|
||||
str r1, [r0] /* EMIFS GlB Configuration. (value 0x12 most likely) */
|
||||
|
||||
/* Setup some clock domains */
|
||||
ldr r1, =OMAP1510_CLKS
|
||||
ldr r0, REG_ARM_IDLECT2
|
||||
strh r1, [r0] /* CLKM, Clock domain control. */
|
||||
/* Setup some clock domains */
|
||||
ldr r1, =OMAP1510_CLKS
|
||||
ldr r0, REG_ARM_IDLECT2
|
||||
strh r1, [r0] /* CLKM, Clock domain control. */
|
||||
|
||||
mov r1, #0x01 /* PER_EN bit */
|
||||
ldr r0, REG_ARM_RSTCT2
|
||||
strh r1, [r0] /* CLKM; Peripheral reset. */
|
||||
mov r1, #0x01 /* PER_EN bit */
|
||||
ldr r0, REG_ARM_RSTCT2
|
||||
strh r1, [r0] /* CLKM; Peripheral reset. */
|
||||
|
||||
/* Set CLKM to Sync-Scalable */
|
||||
/* I supposidly need to enable the dsp clock before switching */
|
||||
mov r1, #0x1000
|
||||
ldr r0, REG_ARM_SYSST
|
||||
strh r1, [r0]
|
||||
mov r0, #0x400
|
||||
/* Set CLKM to Sync-Scalable */
|
||||
/* I supposidly need to enable the dsp clock before switching */
|
||||
mov r1, #0x1000
|
||||
ldr r0, REG_ARM_SYSST
|
||||
strh r1, [r0]
|
||||
mov r0, #0x400
|
||||
1:
|
||||
subs r0, r0, #0x1 /* wait for any bubbles to finish */
|
||||
bne 1b
|
||||
subs r0, r0, #0x1 /* wait for any bubbles to finish */
|
||||
bne 1b
|
||||
|
||||
ldr r1, VAL_ARM_CKCTL /* use 12Mhz ref, PER must be <= 50Mhz so /2 */
|
||||
ldr r0, REG_ARM_CKCTL
|
||||
strh r1, [r0]
|
||||
ldr r1, VAL_ARM_CKCTL /* use 12Mhz ref, PER must be <= 50Mhz so /2 */
|
||||
ldr r0, REG_ARM_CKCTL
|
||||
strh r1, [r0]
|
||||
|
||||
/* setup DPLL 1 */
|
||||
ldr r1, VAL_DPLL1_CTL
|
||||
ldr r0, REG_DPLL1_CTL
|
||||
strh r1, [r0]
|
||||
ands r1, r1, #0x10 /* Check if PLL is enabled. */
|
||||
beq lock_end /* Do not look for lock if BYPASS selected */
|
||||
/* setup DPLL 1 */
|
||||
ldr r1, VAL_DPLL1_CTL
|
||||
ldr r0, REG_DPLL1_CTL
|
||||
strh r1, [r0]
|
||||
ands r1, r1, #0x10 /* Check if PLL is enabled. */
|
||||
beq lock_end /* Do not look for lock if BYPASS selected */
|
||||
2:
|
||||
ldrh r1, [r0]
|
||||
ands r1, r1, #0x01 /* Check the LOCK bit. */
|
||||
beq 2b /* ...loop until bit goes hi. */
|
||||
ldrh r1, [r0]
|
||||
ands r1, r1, #0x01 /* Check the LOCK bit. */
|
||||
beq 2b /* ...loop until bit goes hi. */
|
||||
lock_end:
|
||||
|
||||
/* Set memory timings corresponding to the new clock speed */
|
||||
/* Set memory timings corresponding to the new clock speed */
|
||||
|
||||
/* Check execution location to determine current execution location
|
||||
* and branch to appropriate initialization code.
|
||||
*/
|
||||
mov r0, #0x10000000 /* Load physical SDRAM base. */
|
||||
mov r1, pc /* Get current execution location. */
|
||||
cmp r1, r0 /* Compare. */
|
||||
bge skip_sdram /* Skip over EMIF-fast initialization if running from SDRAM. */
|
||||
/* Check execution location to determine current execution location
|
||||
* and branch to appropriate initialization code.
|
||||
*/
|
||||
mov r0, #0x10000000 /* Load physical SDRAM base. */
|
||||
mov r1, pc /* Get current execution location. */
|
||||
cmp r1, r0 /* Compare. */
|
||||
bge skip_sdram /* Skip over EMIF-fast initialization if running from SDRAM. */
|
||||
|
||||
/*
|
||||
* Delay for SDRAM initialization.
|
||||
*/
|
||||
mov r3, #0x1800 /* value should be checked */
|
||||
/*
|
||||
* Delay for SDRAM initialization.
|
||||
*/
|
||||
mov r3, #0x1800 /* value should be checked */
|
||||
3:
|
||||
subs r3, r3, #0x1 /* Decrement count */
|
||||
bne 3b
|
||||
subs r3, r3, #0x1 /* Decrement count */
|
||||
bne 3b
|
||||
|
||||
/*
|
||||
* Set SDRAM control values. Disable refresh before MRS command.
|
||||
*/
|
||||
ldr r0, VAL_TC_EMIFF_SDRAM_CONFIG /* get good value */
|
||||
bic r3, r0, #0xC /* (BIT3|BIT2) ulConfig with auto-refresh disabled. */
|
||||
orr r3, r3, #0x8000000 /* (BIT27) Disable CLK when Power down or Self-Refresh */
|
||||
orr r3, r3, #0x4000000 /* BIT26 Power Down Enable */
|
||||
ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
|
||||
str r3, [r2] /* Store the passed value with AR disabled. */
|
||||
/*
|
||||
* Set SDRAM control values. Disable refresh before MRS command.
|
||||
*/
|
||||
ldr r0, VAL_TC_EMIFF_SDRAM_CONFIG /* get good value */
|
||||
bic r3, r0, #0xC /* (BIT3|BIT2) ulConfig with auto-refresh disabled. */
|
||||
orr r3, r3, #0x8000000 /* (BIT27) Disable CLK when Power down or Self-Refresh */
|
||||
orr r3, r3, #0x4000000 /* BIT26 Power Down Enable */
|
||||
ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
|
||||
str r3, [r2] /* Store the passed value with AR disabled. */
|
||||
|
||||
ldr r1, VAL_TC_EMIFF_MRS /* get MRS value */
|
||||
ldr r2, REG_TC_EMIFF_MRS /* Point to MRS register. */
|
||||
str r1, [r2] /* Store the passed value.*/
|
||||
ldr r1, VAL_TC_EMIFF_MRS /* get MRS value */
|
||||
ldr r2, REG_TC_EMIFF_MRS /* Point to MRS register. */
|
||||
str r1, [r2] /* Store the passed value.*/
|
||||
|
||||
ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
|
||||
str r0, [r2] /* Store the passed value. */
|
||||
ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
|
||||
str r0, [r2] /* Store the passed value. */
|
||||
|
||||
/*
|
||||
* Delay for SDRAM initialization.
|
||||
*/
|
||||
mov r3, #0x1800
|
||||
/*
|
||||
* Delay for SDRAM initialization.
|
||||
*/
|
||||
mov r3, #0x1800
|
||||
4:
|
||||
subs r3, r3, #1 /* Decrement count. */
|
||||
bne 4b
|
||||
subs r3, r3, #1 /* Decrement count. */
|
||||
bne 4b
|
||||
|
||||
skip_sdram:
|
||||
|
||||
/* slow interface */
|
||||
ldr r1, VAL_TC_EMIFS_CS0_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS0_CONFIG
|
||||
str r1, [r0] /* Chip Select 0 */
|
||||
ldr r1, VAL_TC_EMIFS_CS1_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS1_CONFIG
|
||||
str r1, [r0] /* Chip Select 1 */
|
||||
ldr r1, VAL_TC_EMIFS_CS2_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS2_CONFIG
|
||||
str r1, [r0] /* Chip Select 2 */
|
||||
ldr r1, VAL_TC_EMIFS_CS3_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS3_CONFIG
|
||||
str r1, [r0] /* Chip Select 3 */
|
||||
/* slow interface */
|
||||
ldr r1, VAL_TC_EMIFS_CS0_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS0_CONFIG
|
||||
str r1, [r0] /* Chip Select 0 */
|
||||
ldr r1, VAL_TC_EMIFS_CS1_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS1_CONFIG
|
||||
str r1, [r0] /* Chip Select 1 */
|
||||
ldr r1, VAL_TC_EMIFS_CS2_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS2_CONFIG
|
||||
str r1, [r0] /* Chip Select 2 */
|
||||
ldr r1, VAL_TC_EMIFS_CS3_CONFIG
|
||||
ldr r0, REG_TC_EMIFS_CS3_CONFIG
|
||||
str r1, [r0] /* Chip Select 3 */
|
||||
|
||||
/* Next, Enable the RS232 Line Drivers in the FPGA. */
|
||||
/* Also, power on the audio CODEC's amplifier here, */
|
||||
@@ -217,22 +217,22 @@ skip_sdram:
|
||||
/* Also, disable the CODEC's clocks. */
|
||||
/* omap1510-HelenP1 [specific] */
|
||||
|
||||
ldr r0, REG_FPGA_POWER
|
||||
mov r1, #0
|
||||
ldr r2, REG_FPGA_DIP_SWITCH
|
||||
ldrb r3, [r2]
|
||||
cmp r3, #0x8
|
||||
movne r1, #0x62 /* Enable the RS232 Line Drivers in the EPLD */
|
||||
strb r1, [r0]
|
||||
ldr r0, REG_FPGA_AUDIO
|
||||
mov r1, #0x0 /* Disable sound driver (CODEC clocks) */
|
||||
strb r1, [r0]
|
||||
ldr r0, REG_FPGA_POWER
|
||||
mov r1, #0
|
||||
ldr r2, REG_FPGA_DIP_SWITCH
|
||||
ldrb r3, [r2]
|
||||
cmp r3, #0x8
|
||||
movne r1, #0x62 /* Enable the RS232 Line Drivers in the EPLD */
|
||||
strb r1, [r0]
|
||||
ldr r0, REG_FPGA_AUDIO
|
||||
mov r1, #0x0 /* Disable sound driver (CODEC clocks) */
|
||||
strb r1, [r0]
|
||||
|
||||
/* back to arch calling code */
|
||||
/* back to arch calling code */
|
||||
mov pc, lr
|
||||
|
||||
/* the literal pools origin */
|
||||
.ltorg
|
||||
.ltorg
|
||||
|
||||
/* OMAP configuration registers */
|
||||
REG_FUNC_MUX_CTRL_0: /* 32 bits */
|
||||
@@ -288,13 +288,13 @@ REG_TC_EMIFF_PRIO: /* 32 bits */
|
||||
REG_TC_EMIFS_CONFIG: /* 32 bits */
|
||||
.word 0xfffecc0c
|
||||
REG_TC_EMIFS_CS0_CONFIG: /* 32 bits */
|
||||
.word 0xfffecc10
|
||||
.word 0xfffecc10
|
||||
REG_TC_EMIFS_CS1_CONFIG: /* 32 bits */
|
||||
.word 0xfffecc14
|
||||
.word 0xfffecc14
|
||||
REG_TC_EMIFS_CS2_CONFIG: /* 32 bits */
|
||||
.word 0xfffecc18
|
||||
.word 0xfffecc18
|
||||
REG_TC_EMIFS_CS3_CONFIG: /* 32 bits */
|
||||
.word 0xfffecc1c
|
||||
.word 0xfffecc1c
|
||||
REG_TC_EMIFF_SDRAM_CONFIG: /* 32 bits */
|
||||
.word 0xfffecc20
|
||||
REG_TC_EMIFF_MRS: /* 32 bits */
|
||||
@@ -303,27 +303,27 @@ REG_TC_EMIFF_MRS: /* 32 bits */
|
||||
REG_ARM_CKCTL: /* 16 bits */
|
||||
.word 0xfffece00
|
||||
REG_ARM_IDLECT2: /* 16 bits */
|
||||
.word 0xfffece08
|
||||
.word 0xfffece08
|
||||
REG_ARM_RSTCT2: /* 16 bits */
|
||||
.word 0xfffece14
|
||||
.word 0xfffece14
|
||||
REG_ARM_SYSST: /* 16 bits */
|
||||
.word 0xfffece18
|
||||
.word 0xfffece18
|
||||
/* DPLL control registers */
|
||||
REG_DPLL1_CTL: /* 16 bits */
|
||||
.word 0xfffecf00
|
||||
/* identification code register */
|
||||
REG_IDCODE: /* 32 bits */
|
||||
.word 0xfffed404
|
||||
.word 0xfffed404
|
||||
|
||||
/* Innovator specific */
|
||||
REG_FPGA_LED_DIGIT: /* 8 bits (not used on Innovator) */
|
||||
.word 0x08000003
|
||||
.word 0x08000003
|
||||
REG_FPGA_POWER: /* 8 bits */
|
||||
.word 0x08000005
|
||||
.word 0x08000005
|
||||
REG_FPGA_AUDIO: /* 8 bits (not used on Innovator) */
|
||||
.word 0x0800000c
|
||||
REG_FPGA_DIP_SWITCH: /* 8 bits (not used on Innovator) */
|
||||
.word 0x0800000e
|
||||
.word 0x0800000e
|
||||
|
||||
VAL_COMP_MODE_CTRL_0:
|
||||
.word 0x0000eaef
|
||||
@@ -359,8 +359,8 @@ VAL_VOLTAGE_CTRL_0:
|
||||
.word 0x00000007
|
||||
VAL_TEST_DBG_CTRL_0:
|
||||
/* See Errata 4.13, This works around a SRAM bug, for chips below ES2.5 .
|
||||
* This slows down internal SRAM accesses.
|
||||
*/
|
||||
* This slows down internal SRAM accesses.
|
||||
*/
|
||||
.word 0x00000007
|
||||
VAL_MOD_CONF_CTRL_0:
|
||||
.word 0x0b000008
|
||||
|
||||
@@ -27,23 +27,23 @@ OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm925t/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
@@ -51,8 +51,8 @@ SECTIONS
|
||||
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.bss : { *(.bss) }
|
||||
. = ALIGN(4);
|
||||
.bss : { *(.bss) }
|
||||
|
||||
armboot_end = .;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void after_reloc (ulong dest_addr)
|
||||
|
||||
/* Jump to the main U-Boot board init code
|
||||
*/
|
||||
board_init_r (gd, dest_addr);
|
||||
board_init_r ((gd_t *)gd, dest_addr);
|
||||
}
|
||||
|
||||
int misc_init_r (void)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* (C) Copyright 2001-2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -37,9 +37,9 @@
|
||||
/*
|
||||
* Memory Controller Using
|
||||
*
|
||||
* CS0 - Flash memory (0x40000000)
|
||||
* CS1 - SDRAM (0x00000000}
|
||||
* CS2 -
|
||||
* CS0 - Flash memory (0x40000000)
|
||||
* CS1 - FLASH memory (0x????????)
|
||||
* CS2 - SDRAM (0x00000000)
|
||||
* CS3 -
|
||||
* CS4 -
|
||||
* CS5 -
|
||||
@@ -148,7 +148,7 @@ long int initdram (int board_type)
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Check Bank 0 Memory Size for re-configuration
|
||||
* Check Bank 2 Memory Size for re-configuration
|
||||
*
|
||||
* try 8 column mode
|
||||
*/
|
||||
@@ -205,7 +205,7 @@ long int initdram (int board_type)
|
||||
memctl->memc_br3 = CFG_BR3_CAN;
|
||||
|
||||
/* Initialize MBMR */
|
||||
memctl->memc_mbmr = MAMR_GPL_B4DIS; /* GPL_B4 works as UPWAITB */
|
||||
memctl->memc_mbmr = MBMR_GPL_B4DIS; /* GPL_B4 works as UPWAITB */
|
||||
|
||||
/* Initialize UPMB for CAN: single read */
|
||||
memctl->memc_mdr = 0xFFFFC004;
|
||||
|
||||
@@ -818,7 +818,7 @@ int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
|
||||
#endif /* CONFIG_MISC_INIT_R */
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ OBJS := sc520_cdp.o flash.o
|
||||
SOBJS := sc520_cdp_asm.o sc520_cdp_asm16.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
$(AR) crv $@ $(OBJS) $(SOBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
@@ -325,7 +325,7 @@ void flash_print_info(flash_info_t *info)
|
||||
}
|
||||
printf ("\n");
|
||||
|
||||
done:
|
||||
done: ;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <asm/pci.h>
|
||||
#include <asm/ic/sc520.h>
|
||||
#include <asm/ic/ali512x.h>
|
||||
#include <ssi.h>
|
||||
#include <spi.h>
|
||||
|
||||
#undef SC520_CDP_DEBUG
|
||||
|
||||
@@ -557,6 +557,19 @@ void ssi_chip_select(int dev)
|
||||
}
|
||||
}
|
||||
|
||||
void spi_eeprom_probe(int x)
|
||||
{
|
||||
}
|
||||
|
||||
int spi_eeprom_read(int x, int offset, char *buffer, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int spi_eeprom_write(int x, int offset, char *buffer, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void spi_init_f(void)
|
||||
{
|
||||
@@ -585,6 +598,9 @@ ssize_t spi_read(uchar *addr, int alen, uchar *buffer, int len)
|
||||
#endif
|
||||
#ifdef CONFIG_SC520_CDP_USE_MW
|
||||
res = mw_eeprom_read(2, offset, buffer, len);
|
||||
#endif
|
||||
#if !defined(CONFIG_SC520_CDP_USE_SPI) && !defined(CONFIG_SC520_CDP_USE_MW)
|
||||
res = 0;
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
@@ -606,6 +622,9 @@ ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len)
|
||||
#endif
|
||||
#ifdef CONFIG_SC520_CDP_USE_MW
|
||||
res = mw_eeprom_write(2, offset, buffer, len);
|
||||
#endif
|
||||
#if !defined(CONFIG_SC520_CDP_USE_SPI) && !defined(CONFIG_SC520_CDP_USE_MW)
|
||||
res = 0;
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ SECTIONS
|
||||
.text : { *(.text); }
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
.rodata : { *(.rodata) *(.rodata.str1.1) *(.rodata.str1.32) }
|
||||
|
||||
. = 0x400000; /* Ram data segment to use */
|
||||
_i386boot_romdata_dest = ABSOLUTE(.);
|
||||
|
||||
@@ -267,7 +267,7 @@ void can_driver_enable (void)
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
|
||||
/* Initialize MBMR */
|
||||
memctl->memc_mbmr = MAMR_GPL_B4DIS; /* GPL_B4 ouput line Disable */
|
||||
memctl->memc_mbmr = MBMR_GPL_B4DIS; /* GPL_B4 ouput line Disable */
|
||||
|
||||
/* Initialize UPMB for CAN: single read */
|
||||
memctl->memc_mdr = 0xFFFFC004;
|
||||
|
||||
@@ -217,9 +217,9 @@ initdram (int board_type)
|
||||
#endif /* XXX */
|
||||
|
||||
reg = memctl->memc_mamr;
|
||||
reg &= ~MAMR_TLFB_MSK; /* switch timer loop ... */
|
||||
reg |= MAMR_TLFB_4X; /* ... to 4x */
|
||||
reg |= MAMR_PTBE; /* enable refresh */
|
||||
reg &= ~MAMR_TLFA_MSK; /* switch timer loop ... */
|
||||
reg |= MAMR_TLFA_4X; /* ... to 4x */
|
||||
reg |= MAMR_PTAE; /* enable refresh */
|
||||
memctl->memc_mamr = reg;
|
||||
|
||||
udelay(200);
|
||||
@@ -246,7 +246,7 @@ initdram (int board_type)
|
||||
size_b0 = dram_size (CFG_MAMR, (ulong *)SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
|
||||
#endif /* XXX */
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR | MAMR_PTBE;
|
||||
memctl->memc_mamr = CFG_MAMR | MAMR_PTAE;
|
||||
|
||||
/*
|
||||
* Final mapping:
|
||||
|
||||
@@ -129,4 +129,3 @@ SECTIONS
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
|
||||
@@ -200,14 +200,14 @@ initdram (int board_type)
|
||||
udelay(1);
|
||||
memctl->memc_mcr = 0x80806106;
|
||||
|
||||
memctl->memc_mbmr |= MAMR_PTBE; /* refresh enabled */
|
||||
memctl->memc_mbmr |= MBMR_PTBE; /* refresh enabled */
|
||||
|
||||
/*
|
||||
* Check Bank 0 Memory Size for re-configuration
|
||||
*/
|
||||
size_b0 = dram_size (CFG_MBMR_8COL, (ulong *)SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE);
|
||||
|
||||
memctl->memc_mbmr = CFG_MBMR_8COL | MAMR_PTBE;
|
||||
memctl->memc_mbmr = CFG_MBMR_8COL | MBMR_PTBE;
|
||||
|
||||
return (size_b0);
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
info->sector_count = 64;
|
||||
info->size = 0x00800000; /* => 8 MB */
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(addr[14]) {
|
||||
case AMD_ID_LV128U_2:
|
||||
if (addr[15] != AMD_ID_LV128U_3) {
|
||||
|
||||
@@ -363,7 +363,13 @@ long int initdram (int board_type)
|
||||
memctl->memc_mcr = 0x011C | UPMB;
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
|
||||
#ifdef CONFIG_ISP1362_USB
|
||||
/* Initialize OR5 / BR5 */
|
||||
memctl->memc_or5 = CFG_OR5_ISP1362;
|
||||
memctl->memc_br5 = CFG_BR5_ISP1362;
|
||||
#endif /* CONFIG_ISP1362_USB */
|
||||
|
||||
|
||||
return (size_b0 + size_b1);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ long int initdram (int board_type)
|
||||
memctl->memc_br3 = CFG_BR3_CAN;
|
||||
|
||||
/* Initialize MBMR */
|
||||
memctl->memc_mamr = MAMR_GPL_B4DIS; /* GPL_B4 ouput line Disable */
|
||||
memctl->memc_mamr = MAMR_GPL_A4DIS; /* GPL_A4 ouput line Disable */
|
||||
|
||||
/* Initialize UPMB for CAN: single read */
|
||||
memctl->memc_mdr = 0xFFFFC004;
|
||||
|
||||
@@ -42,9 +42,9 @@ COBJS = main.o altera.o bedbug.o \
|
||||
cmd_reginfo.o cmd_scsi.o cmd_spi.o cmd_usb.o cmd_vfd.o \
|
||||
command.o console.o devices.o dlmalloc.o docecc.o \
|
||||
environment.o env_common.o \
|
||||
env_flash.o env_eeprom.o env_nvram.o env_nowhere.o \
|
||||
env_flash.o env_eeprom.o env_nvram.o env_nowhere.o exports.o \
|
||||
flash.o fpga.o \
|
||||
hush.o kgdb.o lists.o miiphybb.o miiphyutil.o \
|
||||
hush.o kgdb.o lists.o lynxkdi.o miiphybb.o miiphyutil.o \
|
||||
s_record.o soft_i2c.o soft_spi.o spartan2.o \
|
||||
usb.o usb_kbd.o usb_storage.o \
|
||||
virtex2.o xilinx.o
|
||||
|
||||
@@ -178,4 +178,3 @@ U_BOOT_CMD(
|
||||
NULL
|
||||
);
|
||||
#endif /* CFG_CMD_BDI */
|
||||
|
||||
|
||||
@@ -27,13 +27,15 @@
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <net.h>
|
||||
#include <syscall.h>
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
#if defined(CONFIG_I386)
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
#endif
|
||||
ulong addr, rc;
|
||||
int rcode = 0;
|
||||
|
||||
@@ -50,6 +52,13 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
* pass address parameter as argv[0] (aka command name),
|
||||
* and all remaining args
|
||||
*/
|
||||
#if defined(CONFIG_I386)
|
||||
/*
|
||||
* x86 does not use a dedicated register to pass the pointer
|
||||
* to the global_data
|
||||
*/
|
||||
argv[0] = (char *)gd;
|
||||
#endif
|
||||
rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
|
||||
if (rc != 0) rcode = 1;
|
||||
|
||||
|
||||
@@ -80,6 +80,13 @@ static void zfree(void *, void *, unsigned);
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_IMI)
|
||||
static int image_info (unsigned long addr);
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
|
||||
#include <flash.h>
|
||||
extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
|
||||
#endif
|
||||
|
||||
static void print_type (image_header_t *hdr);
|
||||
|
||||
#ifdef __I386__
|
||||
@@ -120,6 +127,10 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
|
||||
#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
|
||||
static boot_os_Fcn do_bootm_artos;
|
||||
#endif
|
||||
#ifdef CONFIG_LYNXKDI
|
||||
static boot_os_Fcn do_bootm_lynxkdi;
|
||||
extern void lynxkdi_boot( image_header_t * );
|
||||
#endif
|
||||
|
||||
image_header_t header;
|
||||
|
||||
@@ -350,6 +361,13 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
addr, len_ptr, verify);
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_LYNXKDI
|
||||
case IH_OS_LYNXOS:
|
||||
do_bootm_lynxkdi (cmdtp, flag, argc, argv,
|
||||
addr, len_ptr, verify);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IH_OS_RTEMS:
|
||||
do_bootm_rtems (cmdtp, flag, argc, argv,
|
||||
addr, len_ptr, verify);
|
||||
@@ -481,6 +499,10 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
kbd->bi_sccfreq /= 1000000L;
|
||||
kbd->bi_vco /= 1000000L;
|
||||
#endif /* CONFIG_8260 */
|
||||
#if defined(CONFIG_MPC5XXXX)
|
||||
kbd->bi_ipbfreq /= 1000000L;
|
||||
kbd->bi_pcifreq /= 1000000L;
|
||||
#endif /* CONFIG_MPC5XXXX */
|
||||
}
|
||||
|
||||
kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))hdr->ih_ep;
|
||||
@@ -957,6 +979,56 @@ U_BOOT_CMD(
|
||||
|
||||
#endif /* CFG_CMD_IMI */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
|
||||
/*-----------------------------------------------------------------------
|
||||
* List all images found in flash.
|
||||
*/
|
||||
int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
flash_info_t *info;
|
||||
int i, j;
|
||||
image_header_t *hdr;
|
||||
ulong checksum;
|
||||
|
||||
for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
goto next_bank;
|
||||
for (j=0; j<CFG_MAX_FLASH_SECT; ++j) {
|
||||
|
||||
if (!(hdr=(image_header_t *)info->start[j]) ||
|
||||
(ntohl(hdr->ih_magic) != IH_MAGIC))
|
||||
goto next_sector;
|
||||
|
||||
/* Copy header so we can blank CRC field for re-calculation */
|
||||
memmove (&header, (char *)hdr, sizeof(image_header_t));
|
||||
|
||||
checksum = ntohl(header.ih_hcrc);
|
||||
header.ih_hcrc = 0;
|
||||
|
||||
if (crc32 (0, (char *)&header, sizeof(image_header_t))
|
||||
!= checksum)
|
||||
goto next_sector;
|
||||
|
||||
printf ("Image at %08lX:\n", (ulong)hdr);
|
||||
print_image_hdr( hdr );
|
||||
putc ('\n');
|
||||
next_sector: ;
|
||||
}
|
||||
next_bank: ;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
imls, 1, 1, do_imls,
|
||||
"imls - list all images found in flash\n",
|
||||
"\n"
|
||||
" - Prints information about all images found at sector\n"
|
||||
" boundaries in flash.\n"
|
||||
);
|
||||
#endif /* CFG_CMD_IMLS */
|
||||
|
||||
void
|
||||
print_image_hdr (image_header_t *hdr)
|
||||
{
|
||||
@@ -1007,6 +1079,9 @@ print_type (image_header_t *hdr)
|
||||
case IH_OS_RTEMS: os = "RTEMS"; break;
|
||||
#ifdef CONFIG_ARTOS
|
||||
case IH_OS_ARTOS: os = "ARTOS"; break;
|
||||
#endif
|
||||
#ifdef CONFIG_LYNXKDI
|
||||
case IH_OS_LYNXOS: os = "LynxOS"; break;
|
||||
#endif
|
||||
default: os = "Unknown OS"; break;
|
||||
}
|
||||
@@ -1181,3 +1256,17 @@ do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
|
||||
do_bootelf(cmdtp, 0, 2, local_args);
|
||||
}
|
||||
#endif /* CFG_CMD_ELF */
|
||||
|
||||
#ifdef CONFIG_LYNXKDI
|
||||
static void
|
||||
do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
|
||||
int argc, char *argv[],
|
||||
ulong addr,
|
||||
ulong *len_ptr,
|
||||
int verify)
|
||||
{
|
||||
lynxkdi_boot( &header );
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LYNXKDI */
|
||||
|
||||
|
||||
@@ -56,45 +56,120 @@ extern flash_info_t flash_info[]; /* info for FLASH chips */
|
||||
* or an invalid flash bank.
|
||||
*/
|
||||
static int
|
||||
abbrev_spec(char *str, flash_info_t **pinfo, int *psf, int *psl)
|
||||
abbrev_spec (char *str, flash_info_t ** pinfo, int *psf, int *psl)
|
||||
{
|
||||
flash_info_t *fp;
|
||||
int bank, first, last;
|
||||
char *p, *ep;
|
||||
flash_info_t *fp;
|
||||
int bank, first, last;
|
||||
char *p, *ep;
|
||||
|
||||
if ((p = strchr(str, ':')) == NULL)
|
||||
return 0;
|
||||
*p++ = '\0';
|
||||
|
||||
bank = simple_strtoul(str, &ep, 10);
|
||||
if (ep == str || *ep != '\0' ||
|
||||
bank < 1 || bank > CFG_MAX_FLASH_BANKS ||
|
||||
(fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
|
||||
return -1;
|
||||
|
||||
str = p;
|
||||
if ((p = strchr(str, '-')) != NULL)
|
||||
if ((p = strchr (str, ':')) == NULL)
|
||||
return 0;
|
||||
*p++ = '\0';
|
||||
|
||||
first = simple_strtoul(str, &ep, 10);
|
||||
if (ep == str || *ep != '\0' || first >= fp->sector_count)
|
||||
return -1;
|
||||
bank = simple_strtoul (str, &ep, 10);
|
||||
if (ep == str || *ep != '\0' ||
|
||||
bank < 1 || bank > CFG_MAX_FLASH_BANKS ||
|
||||
(fp = &flash_info[bank - 1])->flash_id == FLASH_UNKNOWN)
|
||||
return -1;
|
||||
|
||||
if (p != NULL) {
|
||||
last = simple_strtoul(p, &ep, 10);
|
||||
if (ep == p || *ep != '\0' ||
|
||||
last < first || last >= fp->sector_count)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
last = first;
|
||||
str = p;
|
||||
if ((p = strchr (str, '-')) != NULL)
|
||||
*p++ = '\0';
|
||||
|
||||
*pinfo = fp;
|
||||
*psf = first;
|
||||
*psl = last;
|
||||
first = simple_strtoul (str, &ep, 10);
|
||||
if (ep == str || *ep != '\0' || first >= fp->sector_count)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
if (p != NULL) {
|
||||
last = simple_strtoul (p, &ep, 10);
|
||||
if (ep == p || *ep != '\0' ||
|
||||
last < first || last >= fp->sector_count)
|
||||
return -1;
|
||||
} else {
|
||||
last = first;
|
||||
}
|
||||
|
||||
*pinfo = fp;
|
||||
*psf = first;
|
||||
*psl = last;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
|
||||
int *s_first, int *s_last,
|
||||
int *s_count )
|
||||
{
|
||||
flash_info_t *info;
|
||||
ulong bank;
|
||||
int rcode = 0;
|
||||
|
||||
*s_count = 0;
|
||||
|
||||
for (bank=0; bank < CFG_MAX_FLASH_BANKS; ++bank) {
|
||||
s_first[bank] = -1; /* first sector to erase */
|
||||
s_last [bank] = -1; /* last sector to erase */
|
||||
}
|
||||
|
||||
for (bank=0,info=&flash_info[0];
|
||||
(bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
|
||||
++bank, ++info) {
|
||||
ulong b_end;
|
||||
int sect;
|
||||
short s_end;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
b_end = info->start[0] + info->size - 1; /* bank end addr */
|
||||
s_end = info->sector_count - 1; /* last sector */
|
||||
|
||||
|
||||
for (sect=0; sect < info->sector_count; ++sect) {
|
||||
ulong end; /* last address in current sect */
|
||||
|
||||
end = (sect == s_end) ? b_end : info->start[sect + 1] - 1;
|
||||
|
||||
if (addr_first > end)
|
||||
continue;
|
||||
if (addr_last < info->start[sect])
|
||||
continue;
|
||||
|
||||
if (addr_first == info->start[sect]) {
|
||||
s_first[bank] = sect;
|
||||
}
|
||||
if (addr_last == end) {
|
||||
s_last[bank] = sect;
|
||||
}
|
||||
}
|
||||
if (s_first[bank] >= 0) {
|
||||
if (s_last[bank] < 0) {
|
||||
if (addr_last > b_end) {
|
||||
s_last[bank] = s_end;
|
||||
} else {
|
||||
printf ("Error: end address"
|
||||
" not on sector boundary\n");
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s_last[bank] < s_first[bank]) {
|
||||
printf ("Error: end sector"
|
||||
" precedes start sector\n");
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
sect = s_last[bank];
|
||||
addr_first = (sect == s_end) ? b_end + 1: info->start[sect + 1];
|
||||
(*s_count) += s_last[bank] - s_first[bank] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return rcode;
|
||||
}
|
||||
|
||||
int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong bank;
|
||||
@@ -180,7 +255,6 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("Erase Flash from 0x%08lx to 0x%08lx ", addr_first, addr_last);
|
||||
rcode = flash_sect_erase(addr_first, addr_last);
|
||||
return rcode;
|
||||
}
|
||||
@@ -189,53 +263,32 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
|
||||
{
|
||||
flash_info_t *info;
|
||||
ulong bank;
|
||||
int s_first, s_last;
|
||||
int erased;
|
||||
int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
|
||||
int erased = 0;
|
||||
int planned;
|
||||
int rcode = 0;
|
||||
|
||||
erased = 0;
|
||||
rcode = flash_fill_sect_ranges (addr_first, addr_last,
|
||||
s_first, s_last, &planned );
|
||||
|
||||
for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
|
||||
ulong b_end;
|
||||
int sect;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
b_end = info->start[0] + info->size - 1; /* bank end addr */
|
||||
|
||||
s_first = -1; /* first sector to erase */
|
||||
s_last = -1; /* last sector to erase */
|
||||
|
||||
for (sect=0; sect < info->sector_count; ++sect) {
|
||||
ulong end; /* last address in current sect */
|
||||
short s_end;
|
||||
|
||||
s_end = info->sector_count - 1;
|
||||
|
||||
end = (sect == s_end) ? b_end : info->start[sect + 1] - 1;
|
||||
|
||||
if (addr_first > end)
|
||||
continue;
|
||||
if (addr_last < info->start[sect])
|
||||
continue;
|
||||
|
||||
if (addr_first == info->start[sect]) {
|
||||
s_first = sect;
|
||||
}
|
||||
if (addr_last == end) {
|
||||
s_last = sect;
|
||||
if (planned && (rcode == 0)) {
|
||||
for (bank=0,info=&flash_info[0];
|
||||
(bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
|
||||
++bank, ++info) {
|
||||
if (s_first[bank]>=0) {
|
||||
erased += s_last[bank] - s_first[bank] + 1;
|
||||
debug ("Erase Flash from 0x%08lx to 0x%08lx "
|
||||
"in Bank # %ld ",
|
||||
info->start[s_first[bank]],
|
||||
(s_last[bank] == info->sector_count) ?
|
||||
info->start[0] + info->size - 1:
|
||||
info->start[s_last[bank]+1] - 1,
|
||||
bank+1);
|
||||
rcode = flash_erase (info, s_first[bank], s_last[bank]);
|
||||
}
|
||||
}
|
||||
if (s_first>=0 && s_first<=s_last) {
|
||||
erased += s_last - s_first + 1;
|
||||
rcode = flash_erase (info, s_first, s_last);
|
||||
}
|
||||
}
|
||||
if (erased) {
|
||||
printf ("Erased %d sectors\n", erased);
|
||||
} else {
|
||||
} else if (rcode == 0) {
|
||||
printf ("Error: start and/or end address"
|
||||
" not on sector boundary\n");
|
||||
rcode = 1;
|
||||
@@ -243,7 +296,6 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
|
||||
return rcode;
|
||||
}
|
||||
|
||||
|
||||
int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
flash_info_t *info;
|
||||
@@ -256,11 +308,11 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "off") == 0)
|
||||
if (strcmp(argv[1], "off") == 0) {
|
||||
p = 0;
|
||||
else if (strcmp(argv[1], "on") == 0)
|
||||
} else if (strcmp(argv[1], "on") == 0) {
|
||||
p = 1;
|
||||
else {
|
||||
} else {
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
@@ -370,66 +422,43 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
|
||||
{
|
||||
flash_info_t *info;
|
||||
ulong bank;
|
||||
int s_first, s_last;
|
||||
int s_first[CFG_MAX_FLASH_BANKS], s_last[CFG_MAX_FLASH_BANKS];
|
||||
int protected, i;
|
||||
int rcode = 0;
|
||||
int planned;
|
||||
int rcode;
|
||||
|
||||
rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
|
||||
|
||||
protected = 0;
|
||||
|
||||
for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
|
||||
ulong b_end;
|
||||
int sect;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
b_end = info->start[0] + info->size - 1; /* bank end addr */
|
||||
|
||||
s_first = -1; /* first sector to erase */
|
||||
s_last = -1; /* last sector to erase */
|
||||
|
||||
for (sect=0; sect < info->sector_count; ++sect) {
|
||||
ulong end; /* last address in current sect */
|
||||
short s_end;
|
||||
|
||||
s_end = info->sector_count - 1;
|
||||
|
||||
end = (sect == s_end) ? b_end : info->start[sect + 1] - 1;
|
||||
|
||||
if (addr_first > end)
|
||||
continue;
|
||||
if (addr_last < info->start[sect])
|
||||
if (planned && (rcode == 0)) {
|
||||
for (bank=0,info=&flash_info[0]; bank < CFG_MAX_FLASH_BANKS; ++bank, ++info) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (addr_first == info->start[sect]) {
|
||||
s_first = sect;
|
||||
}
|
||||
if (addr_last == end) {
|
||||
s_last = sect;
|
||||
}
|
||||
}
|
||||
if (s_first>=0 && s_first<=s_last) {
|
||||
protected += s_last - s_first + 1;
|
||||
for (i=s_first; i<=s_last; ++i) {
|
||||
if (s_first[bank]>=0 && s_first[bank]<=s_last[bank]) {
|
||||
debug ("Protecting sectors %d..%d in bank %ld\n",
|
||||
s_first[bank], s_last[bank], bank+1);
|
||||
protected += s_last[bank] - s_first[bank] + 1;
|
||||
for (i=s_first[bank]; i<=s_last[bank]; ++i) {
|
||||
#if defined(CFG_FLASH_PROTECTION)
|
||||
if (flash_real_protect(info, i, p))
|
||||
rcode = 1;
|
||||
putc ('.');
|
||||
if (flash_real_protect(info, i, p))
|
||||
rcode = 1;
|
||||
putc ('.');
|
||||
#else
|
||||
info->protect[i] = p;
|
||||
info->protect[i] = p;
|
||||
#endif /* CFG_FLASH_PROTECTION */
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(CFG_FLASH_PROTECTION)
|
||||
if (!rcode) putc ('\n');
|
||||
if (!rcode) putc ('\n');
|
||||
#endif /* CFG_FLASH_PROTECTION */
|
||||
}
|
||||
|
||||
}
|
||||
if (protected) {
|
||||
printf ("%sProtected %d sectors\n",
|
||||
p ? "" : "Un-", protected);
|
||||
} else {
|
||||
} else if (rcode == 0) {
|
||||
printf ("Error: start and/or end address"
|
||||
" not on sector boundary\n");
|
||||
rcode = 1;
|
||||
|
||||
@@ -507,6 +507,9 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
if(i2c_write(chip, addr, alen, (char *)&data, size) != 0) {
|
||||
printf("Error writing the chip.\n");
|
||||
}
|
||||
#ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS
|
||||
udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
|
||||
#endif
|
||||
if (incrflag)
|
||||
addr += size;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <command.h>
|
||||
#include <s_record.h>
|
||||
#include <net.h>
|
||||
#include <syscall.h>
|
||||
#include <exports.h>
|
||||
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_LOADS)
|
||||
@@ -213,6 +213,7 @@ load_serial (ulong offset)
|
||||
static int
|
||||
read_record (char *buf, ulong len)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
char *p;
|
||||
char c;
|
||||
|
||||
@@ -236,13 +237,11 @@ read_record (char *buf, ulong len)
|
||||
}
|
||||
|
||||
/* Check for the console hangup (if any different from serial) */
|
||||
#ifdef CONFIG_PPC /* we don't have syscall_tbl anywhere else */
|
||||
if (syscall_tbl[SYSCALL_GETC] != serial_getc) {
|
||||
if (gd->jt[XF_getc] != serial_getc) {
|
||||
if (ctrlc()) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* line too long - truncate */
|
||||
@@ -479,7 +478,7 @@ int do_load_serial_bin (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf ("## Ready for binary (kermit) download "
|
||||
"to 0x%08lX at %d bps...\n",
|
||||
offset,
|
||||
current_baudrate);
|
||||
load_baudrate);
|
||||
addr = load_serial_bin (offset);
|
||||
|
||||
if (addr == ~0) {
|
||||
|
||||
@@ -86,8 +86,7 @@ void logbuff_init_ptrs (void)
|
||||
post_word = post_word_load();
|
||||
#ifdef CONFIG_POST
|
||||
/* The post routines have setup the word so we can simply test it */
|
||||
if (((post_word & 0xffff) == POST_POWERON) ||
|
||||
((post_word & 0xffff) == POST_SLOWTEST)) {
|
||||
if (post_word_load () & POST_COLDBOOT) {
|
||||
logged_chars = log_size = log_start = 0;
|
||||
*ext_tag = LOGBUFF_MAGIC;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ int cmd_get_data_size(char* arg, int default_size)
|
||||
return 2;
|
||||
case 'l':
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return default_size;
|
||||
@@ -86,9 +88,10 @@ static ulong base_address = 0;
|
||||
#define DISP_LINE_LEN 16
|
||||
int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, size, length;
|
||||
ulong addr, length;
|
||||
ulong i, nbytes, linebytes;
|
||||
u_char *cp;
|
||||
int size;
|
||||
int rc = 0;
|
||||
|
||||
/* We use the last specified parameters, unless new ones are
|
||||
@@ -107,7 +110,8 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
/* New command specified. Check for a size specification.
|
||||
* Defaults to long if no or incorrect specification.
|
||||
*/
|
||||
size = cmd_get_data_size(argv[0], 4);
|
||||
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
|
||||
return 1;
|
||||
|
||||
/* Address is specified since argc > 1
|
||||
*/
|
||||
@@ -199,7 +203,8 @@ int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, size, writeval, count;
|
||||
ulong addr, writeval, count;
|
||||
int size;
|
||||
|
||||
if ((argc < 3) || (argc > 4)) {
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
@@ -208,7 +213,8 @@ int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
/* Check for size specification.
|
||||
*/
|
||||
size = cmd_get_data_size(argv[0], 4);
|
||||
if ((size = cmd_get_data_size(argv[0], 4)) < 1)
|
||||
return 1;
|
||||
|
||||
/* Address is specified since argc > 1
|
||||
*/
|
||||
@@ -240,7 +246,8 @@ int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong size, addr1, addr2, count, ngood;
|
||||
ulong addr1, addr2, count, ngood;
|
||||
int size;
|
||||
int rcode = 0;
|
||||
|
||||
if (argc != 4) {
|
||||
@@ -250,7 +257,8 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
/* Check for size specification.
|
||||
*/
|
||||
size = cmd_get_data_size(argv[0], 4);
|
||||
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
|
||||
return 1;
|
||||
|
||||
addr1 = simple_strtoul(argv[1], NULL, 16);
|
||||
addr1 += base_address;
|
||||
@@ -316,7 +324,8 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, size, dest, count;
|
||||
ulong addr, dest, count;
|
||||
int size;
|
||||
|
||||
if (argc != 4) {
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
@@ -325,7 +334,8 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
/* Check for size specification.
|
||||
*/
|
||||
size = cmd_get_data_size(argv[0], 4);
|
||||
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
|
||||
return 1;
|
||||
|
||||
addr = simple_strtoul(argv[1], NULL, 16);
|
||||
addr += base_address;
|
||||
@@ -458,7 +468,8 @@ int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, size, length, i, junk;
|
||||
ulong addr, length, i, junk;
|
||||
int size;
|
||||
volatile uint *longp;
|
||||
volatile ushort *shortp;
|
||||
volatile u_char *cp;
|
||||
@@ -471,7 +482,8 @@ int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
/* Check for a size spefication.
|
||||
* Defaults to long if no or incorrect specification.
|
||||
*/
|
||||
size = cmd_get_data_size(argv[0], 4);
|
||||
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
|
||||
return 1;
|
||||
|
||||
/* Address is always specified.
|
||||
*/
|
||||
@@ -839,8 +851,8 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
static int
|
||||
mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, size, i;
|
||||
int nbytes;
|
||||
ulong addr, i;
|
||||
int nbytes, size;
|
||||
extern char console_buffer[];
|
||||
|
||||
if (argc != 2) {
|
||||
@@ -861,7 +873,8 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
/* New command specified. Check for a size specification.
|
||||
* Defaults to long if no or incorrect specification.
|
||||
*/
|
||||
size = cmd_get_data_size(argv[0], 4);
|
||||
if ((size = cmd_get_data_size(argv[0], 4)) < 0)
|
||||
return 1;
|
||||
|
||||
/* Address is specified since argc > 1
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* borrowed heavily from:
|
||||
* (c) 1999 Machine Vision Holdings, Inc.
|
||||
* (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -24,6 +23,12 @@
|
||||
#include <linux/mtd/nand_ids.h>
|
||||
#include <jffs2/jffs2.h>
|
||||
|
||||
#ifdef CONFIG_OMAP1510
|
||||
void archflashwp(void *archdata, int wp);
|
||||
#endif
|
||||
|
||||
#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
|
||||
|
||||
/*
|
||||
* Definition of the out of band configuration structure
|
||||
*/
|
||||
@@ -52,7 +57,7 @@ struct nand_oob_config {
|
||||
#define ALLOW_ERASE_BAD_DEBUG 0
|
||||
|
||||
#define CONFIG_MTD_NAND_ECC /* enable ECC */
|
||||
/* #define CONFIG_MTD_NAND_ECC_JFFS2 */
|
||||
#define CONFIG_MTD_NAND_ECC_JFFS2
|
||||
|
||||
/* bits for nand_rw() `cmd'; or together as needed */
|
||||
#define NANDRW_READ 0x01
|
||||
@@ -76,6 +81,7 @@ static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
|
||||
size_t * retlen, u_char * buf);
|
||||
static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
|
||||
size_t * retlen, const u_char * buf);
|
||||
static int NanD_WaitReady(struct nand_chip *nand, int ale_wait);
|
||||
#ifdef CONFIG_MTD_NAND_ECC
|
||||
static int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc);
|
||||
static void nand_calculate_ecc (const u_char *dat, u_char *ecc_code);
|
||||
@@ -218,7 +224,7 @@ int do_nand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
ret = nand_rw(nand_dev_desc + curr_device, cmd, off, size,
|
||||
&total, (u_char*)addr);
|
||||
|
||||
printf ("%d bytes %s: %s\n", total,
|
||||
printf (" %d bytes %s: %s\n", total,
|
||||
(cmd & NANDRW_READ) ? "read" : "write",
|
||||
ret ? "ERROR" : "OK");
|
||||
|
||||
@@ -419,7 +425,7 @@ static int nand_rw (struct nand_chip* nand, int cmd,
|
||||
size_t start, size_t len,
|
||||
size_t * retlen, u_char * buf)
|
||||
{
|
||||
int noecc, ret = 0, n, total = 0;
|
||||
int ret = 0, n, total = 0;
|
||||
char eccbuf[6];
|
||||
/* eblk (once set) is the start of the erase block containing the
|
||||
* data being processed.
|
||||
@@ -457,17 +463,18 @@ static int nand_rw (struct nand_chip* nand, int cmd,
|
||||
}
|
||||
/* The ECC will not be calculated correctly if
|
||||
less than 512 is written or read */
|
||||
noecc = (start != (start | 0x1ff) + 1) || (len < 0x200);
|
||||
/* Is request at least 512 bytes AND it starts on a proper boundry */
|
||||
if((start != ROUND_DOWN(start, 0x200)) || (len < 0x200))
|
||||
printf("Warning block writes should be at least 512 bytes and start on a 512 byte boundry\n");
|
||||
|
||||
if (cmd & NANDRW_READ)
|
||||
ret = nand_read_ecc(nand, start,
|
||||
min(len, eblk + erasesize - start),
|
||||
&n, (u_char*)buf,
|
||||
noecc ? NULL : eccbuf);
|
||||
&n, (u_char*)buf, eccbuf);
|
||||
else
|
||||
ret = nand_write_ecc(nand, start,
|
||||
min(len, eblk + erasesize - start),
|
||||
&n, (u_char*)buf,
|
||||
noecc ? NULL : eccbuf);
|
||||
&n, (u_char*)buf, eccbuf);
|
||||
|
||||
if (ret)
|
||||
break;
|
||||
@@ -502,19 +509,19 @@ 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)
|
||||
static int NanD_WaitReady(struct nand_chip *nand, int ale_wait)
|
||||
{
|
||||
/* This is inline, to optimise the common case, where it's ready instantly */
|
||||
int ret = 0;
|
||||
NAND_WAIT_READY(nand);
|
||||
|
||||
#ifdef NAND_NO_RB /* in config file, shorter delays currently wrap accesses */
|
||||
if(ale_wait)
|
||||
NAND_WAIT_READY(nand); /* do the worst case 25us wait */
|
||||
else
|
||||
udelay(10);
|
||||
#else /* has functional r/b signal */
|
||||
NAND_WAIT_READY(nand);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -533,7 +540,16 @@ static inline int NanD_Command(struct nand_chip *nand, unsigned char command)
|
||||
/* Lower the CLE line */
|
||||
NAND_CTL_CLRCLE(nandptr);
|
||||
|
||||
return NanD_WaitReady(nand);
|
||||
#ifdef NAND_NO_RB
|
||||
if(command == NAND_CMD_RESET){
|
||||
u_char ret_val;
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
do{
|
||||
ret_val = READ_NAND(nandptr);/* wait till ready */
|
||||
} while((ret_val & 0x40) != 0x40);
|
||||
}
|
||||
#endif
|
||||
return NanD_WaitReady(nand, 0);
|
||||
}
|
||||
|
||||
/* NanD_Address: Set the current address for the flash chip */
|
||||
@@ -573,7 +589,7 @@ static int NanD_Address(struct nand_chip *nand, int numbytes, unsigned long ofs)
|
||||
NAND_CTL_CLRALE(nandptr);
|
||||
|
||||
/* Wait for the chip to respond */
|
||||
return NanD_WaitReady(nand);
|
||||
return NanD_WaitReady(nand, 1);
|
||||
}
|
||||
|
||||
/* NanD_SelectChip: Select a given flash chip within the current floor */
|
||||
@@ -581,7 +597,7 @@ static int NanD_Address(struct nand_chip *nand, int numbytes, unsigned long ofs)
|
||||
static inline int NanD_SelectChip(struct nand_chip *nand, int chip)
|
||||
{
|
||||
/* Wait for it to be ready */
|
||||
return NanD_WaitReady(nand);
|
||||
return NanD_WaitReady(nand, 0);
|
||||
}
|
||||
|
||||
/* NanD_IdentChip: Identify a given NAND chip given {floor,chip} */
|
||||
@@ -931,8 +947,8 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
{
|
||||
|
||||
int i;
|
||||
#ifdef CONFIG_MTD_NAND_ECC
|
||||
unsigned long nandptr = nand->IO_ADDR;
|
||||
#ifdef CONFIG_MTD_NAND_ECC
|
||||
#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
|
||||
int ecc_bytes = (nand->oobblock == 512) ? 6 : 3;
|
||||
#endif
|
||||
@@ -992,12 +1008,20 @@ static int nand_write_page (struct nand_chip *nand,
|
||||
/* Send command to actually program the data */
|
||||
NanD_Command(nand, NAND_CMD_PAGEPROG);
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
#ifdef NAND_NO_RB
|
||||
{ u_char ret_val;
|
||||
|
||||
do{
|
||||
ret_val = READ_NAND(nandptr); /* wait till ready */
|
||||
} while((ret_val & 0x40) != 0x40);
|
||||
}
|
||||
#endif
|
||||
/* See if device thinks it succeeded */
|
||||
if (READ_NAND(nand->IO_ADDR) & 0x01) {
|
||||
printf ("%s: Failed write, page 0x%08x, ", __FUNCTION__, page);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MTD_NAND_VERIFY_WRITE
|
||||
/*
|
||||
* The NAND device assumes that it is always writing to
|
||||
@@ -1069,7 +1093,10 @@ 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 */
|
||||
#ifdef CONFIG_OMAP1510
|
||||
archflashwp(0,0);
|
||||
#endif
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
|
||||
/* Check the WP bit */
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
@@ -1113,7 +1140,9 @@ 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 */
|
||||
|
||||
#ifdef CONFIG_OMAP1510
|
||||
archflashwp(0,1);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1160,7 +1189,7 @@ static int nand_read_oob(struct nand_chip* nand, size_t ofs, size_t len,
|
||||
* causing the flash device to go into busy mode, so we need
|
||||
* to wait until ready 11.4.1 and Toshiba TC58256FT nands */
|
||||
|
||||
ret = NanD_WaitReady(nand);
|
||||
ret = NanD_WaitReady(nand, 1);
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
|
||||
return ret;
|
||||
@@ -1215,8 +1244,13 @@ static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
|
||||
|
||||
NanD_Command(nand, NAND_CMD_PAGEPROG);
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
/* NanD_WaitReady() is implicit in NanD_Command */
|
||||
|
||||
#ifdef NAND_NO_RB
|
||||
{ u_char ret_val;
|
||||
do{
|
||||
ret_val = READ_NAND(nandptr); /* wait till ready */
|
||||
}while((ret_val & 0x40) != 0x40);
|
||||
}
|
||||
#endif
|
||||
if (READ_NAND(nandptr) & 1) {
|
||||
puts ("Error programming oob data\n");
|
||||
/* There was an error */
|
||||
@@ -1233,8 +1267,13 @@ static int nand_write_oob(struct nand_chip* nand, size_t ofs, size_t len,
|
||||
|
||||
NanD_Command(nand, NAND_CMD_PAGEPROG);
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
/* NanD_WaitReady() is implicit in NanD_Command */
|
||||
|
||||
#ifdef NAND_NO_RB
|
||||
{ u_char ret_val;
|
||||
do{
|
||||
ret_val = READ_NAND(nandptr); /* wait till ready */
|
||||
} while((ret_val & 0x40) != 0x40);
|
||||
}
|
||||
#endif
|
||||
if (READ_NAND(nandptr) & 1) {
|
||||
puts ("Error programming oob data\n");
|
||||
/* There was an error */
|
||||
@@ -1272,7 +1311,10 @@ static int nand_erase(struct nand_chip* nand, size_t ofs, size_t len, int clean)
|
||||
nandptr = nand->IO_ADDR;
|
||||
|
||||
/* Select the NAND device */
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
#ifdef CONFIG_OMAP1510
|
||||
archflashwp(0,0);
|
||||
#endif
|
||||
NAND_ENABLE_CE(nand); /* set pin low */
|
||||
|
||||
/* Check the WP bit */
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
@@ -1308,6 +1350,13 @@ static int nand_erase(struct nand_chip* nand, size_t ofs, size_t len, int clean)
|
||||
|
||||
NanD_Command(nand, NAND_CMD_STATUS);
|
||||
|
||||
#ifdef NAND_NO_RB
|
||||
{ u_char ret_val;
|
||||
do{
|
||||
ret_val = READ_NAND(nandptr); /* wait till ready */
|
||||
} while((ret_val & 0x40) != 0x40);
|
||||
}
|
||||
#endif
|
||||
if (READ_NAND(nandptr) & 1) {
|
||||
printf ("%s: Error erasing at 0x%lx\n",
|
||||
__FUNCTION__, (long)ofs);
|
||||
@@ -1346,7 +1395,9 @@ static int nand_erase(struct nand_chip* nand, size_t ofs, size_t len, int clean)
|
||||
out:
|
||||
/* De-select the NAND device */
|
||||
NAND_DISABLE_CE(nand); /* set pin high */
|
||||
|
||||
#ifdef CONFIG_OMAP1510
|
||||
archflashwp(0,1);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1596,5 +1647,6 @@ static int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc)
|
||||
/* Should never happen */
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <malloc.h>
|
||||
#include <console.h>
|
||||
#include <syscall.h>
|
||||
|
||||
void **syscall_tbl;
|
||||
#include <exports.h>
|
||||
|
||||
#ifdef CONFIG_AMIGAONEG3SE
|
||||
int console_changed = 0;
|
||||
@@ -52,6 +50,7 @@ int overwrite_console (void)
|
||||
|
||||
static int console_setfile (int file, device_t * dev)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
int error = 0;
|
||||
|
||||
if (dev == NULL)
|
||||
@@ -78,13 +77,13 @@ static int console_setfile (int file, device_t * dev)
|
||||
*/
|
||||
switch (file) {
|
||||
case stdin:
|
||||
syscall_tbl[SYSCALL_GETC] = dev->getc;
|
||||
syscall_tbl[SYSCALL_TSTC] = dev->tstc;
|
||||
gd->jt[XF_getc] = dev->getc;
|
||||
gd->jt[XF_tstc] = dev->tstc;
|
||||
break;
|
||||
case stdout:
|
||||
syscall_tbl[SYSCALL_PUTC] = dev->putc;
|
||||
syscall_tbl[SYSCALL_PUTS] = dev->puts;
|
||||
syscall_tbl[SYSCALL_PRINTF] = printf;
|
||||
gd->jt[XF_putc] = dev->putc;
|
||||
gd->jt[XF_puts] = dev->puts;
|
||||
gd->jt[XF_printf] = printf;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -394,15 +393,16 @@ device_t *search_device (int flags, char *name)
|
||||
/* Called after the relocation - use desired console functions */
|
||||
int console_init_r (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
char *stdinname, *stdoutname, *stderrname;
|
||||
device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
|
||||
|
||||
/* set default handlers at first */
|
||||
syscall_tbl[SYSCALL_GETC] = serial_getc;
|
||||
syscall_tbl[SYSCALL_TSTC] = serial_tstc;
|
||||
syscall_tbl[SYSCALL_PUTC] = serial_putc;
|
||||
syscall_tbl[SYSCALL_PUTS] = serial_puts;
|
||||
syscall_tbl[SYSCALL_PRINTF] = serial_printf;
|
||||
gd->jt[XF_getc] = serial_getc;
|
||||
gd->jt[XF_tstc] = serial_tstc;
|
||||
gd->jt[XF_putc] = serial_putc;
|
||||
gd->jt[XF_puts] = serial_puts;
|
||||
gd->jt[XF_printf] = serial_printf;
|
||||
|
||||
/* stdin stdout and stderr are in environment */
|
||||
/* scan for it */
|
||||
|
||||
31
common/exports.c
Normal file
31
common/exports.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <common.h>
|
||||
#include <exports.h>
|
||||
|
||||
static void dummy(void)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned long get_version(void)
|
||||
{
|
||||
return XF_VERSION;
|
||||
}
|
||||
|
||||
void jumptable_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
int i;
|
||||
|
||||
gd->jt = (void **) malloc (XF_MAX * sizeof (void *));
|
||||
for (i = 0; i < XF_MAX; i++)
|
||||
gd->jt[i] = (void *) dummy;
|
||||
|
||||
gd->jt[XF_get_version] = (void *) get_version;
|
||||
gd->jt[XF_malloc] = (void *) malloc;
|
||||
gd->jt[XF_free] = (void *) free;
|
||||
gd->jt[XF_get_timer] = (void *)get_timer;
|
||||
gd->jt[XF_udelay] = (void *)udelay;
|
||||
#if defined(CONFIG_I386) || defined(CONFIG_PPC)
|
||||
gd->jt[XF_install_hdlr] = (void *) irq_install_handler;
|
||||
gd->jt[XF_free_hdlr] = (void *) irq_free_handler;
|
||||
#endif
|
||||
}
|
||||
70
common/lynxkdi.c
Normal file
70
common/lynxkdi.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) Orbacom Systems, Inc <www.orbacom.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are freely
|
||||
* permitted provided that the above copyright notice and this
|
||||
* paragraph and the following disclaimer are duplicated in all
|
||||
* such forms.
|
||||
*
|
||||
* This software is provided "AS IS" and without any express or
|
||||
* implied warranties, including, without limitation, the implied
|
||||
* warranties of merchantability and fitness for a particular
|
||||
* purpose.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <image.h>
|
||||
|
||||
#if defined(CONFIG_LYNXKDI)
|
||||
#include <lynxkdi.h>
|
||||
|
||||
#if defined(CONFIG_MPC8260)
|
||||
void lynxkdi_boot ( image_header_t *hdr )
|
||||
{
|
||||
void (*lynxkdi)(void) = (void(*)(void))hdr->ih_ep;
|
||||
lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020;
|
||||
bd_t *kbd;
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
u32 *psz = (u32 *)(hdr->ih_load + 0x0204);
|
||||
|
||||
memset( parms, 0, sizeof(*parms));
|
||||
kbd = gd->bd;
|
||||
parms->clock_ref = kbd->bi_busfreq;
|
||||
parms->dramsz = kbd->bi_memsize;
|
||||
memcpy(parms->ethaddr, kbd->bi_enetaddr, 6);
|
||||
mtspr(SPRN_SPRG2, 0x0020);
|
||||
|
||||
/* Do a simple check for Bluecat so we can pass the
|
||||
* kernel command line parameters.
|
||||
*/
|
||||
if( le32_to_cpu(*psz) == hdr->ih_size ){
|
||||
char *args;
|
||||
char *cmdline = (char *)(hdr->ih_load + 0x020c);
|
||||
int len;
|
||||
|
||||
printf("Booting Bluecat KDI ...\n");
|
||||
udelay(200*1000); /* Allow serial port to flush */
|
||||
if ((args = getenv("bootargs")) == NULL)
|
||||
args = "";
|
||||
/* Prepend the cmdline */
|
||||
len = strlen(args);
|
||||
if( len && (len + strlen(cmdline) + 2 < (0x0400 - 0x020c))) {
|
||||
memmove( cmdline + strlen(args) + 1, cmdline, strlen(cmdline) );
|
||||
strcpy( cmdline, args );
|
||||
cmdline[len] = ' ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("Booting LynxOS KDI ...\n");
|
||||
}
|
||||
|
||||
lynxkdi();
|
||||
}
|
||||
#else
|
||||
#error "Lynx KDI support not implemented for configured CPU"
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_LYNXKDI */
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <hush.h>
|
||||
#endif
|
||||
|
||||
#include <post.h>
|
||||
|
||||
#if defined(CONFIG_BOOT_RETRY_TIME) && defined(CONFIG_RESET_TO_RETRY)
|
||||
extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* for do_reset() prototype */
|
||||
#endif
|
||||
@@ -258,6 +260,12 @@ void main_loop (void)
|
||||
#ifdef CONFIG_PREBOOT
|
||||
char *p;
|
||||
#endif
|
||||
#ifdef CONFIG_BOOTCOUNT_LIMIT
|
||||
unsigned long bootcount = 0;
|
||||
unsigned long bootlimit = 0;
|
||||
char *bcs;
|
||||
char bcs_set[16];
|
||||
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
||||
|
||||
#if defined(CONFIG_VFD) && defined(VFD_TEST_LOGO)
|
||||
ulong bmp = 0; /* default bitmap */
|
||||
@@ -270,6 +278,16 @@ void main_loop (void)
|
||||
trab_vfd (bmp);
|
||||
#endif /* CONFIG_VFD && VFD_TEST_LOGO */
|
||||
|
||||
#ifdef CONFIG_BOOTCOUNT_LIMIT
|
||||
bootcount = bootcount_load();
|
||||
bootcount++;
|
||||
bootcount_store (bootcount);
|
||||
sprintf (bcs_set, "%lu", bootcount);
|
||||
setenv ("bootcount", bcs_set);
|
||||
bcs = getenv ("bootlimit");
|
||||
bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0;
|
||||
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
||||
|
||||
#ifdef CONFIG_MODEM_SUPPORT
|
||||
debug ("DEBUG: main_loop: do_mdm_init=%d\n", do_mdm_init);
|
||||
if (do_mdm_init) {
|
||||
@@ -322,7 +340,15 @@ void main_loop (void)
|
||||
init_cmd_timeout ();
|
||||
# endif /* CONFIG_BOOT_RETRY_TIME */
|
||||
|
||||
s = getenv ("bootcmd");
|
||||
#ifdef CONFIG_BOOTCOUNT_LIMIT
|
||||
if (bootlimit && (bootcount > bootlimit)) {
|
||||
printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
|
||||
(unsigned)bootlimit);
|
||||
s = getenv ("altbootcmd");
|
||||
}
|
||||
else
|
||||
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
||||
s = getenv ("bootcmd");
|
||||
|
||||
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ gccincdir := $(shell $(CC) -print-file-name=include)
|
||||
CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
|
||||
-D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
|
||||
-I$(TOPDIR)/include \
|
||||
-fno-builtin -nostdinc -isystem $(gccincdir) \
|
||||
-pipe $(PLATFORM_CPPFLAGS)
|
||||
-fno-builtin -ffreestanding -nostdinc -isystem \
|
||||
$(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
|
||||
|
||||
ifdef BUILD_TAG
|
||||
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \
|
||||
|
||||
@@ -159,75 +159,7 @@ ProgramCheck:
|
||||
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(0xc00, SystemCall, UnknownException)
|
||||
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
|
||||
|
||||
@@ -85,7 +85,6 @@ int disable_interrupts (void)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void bad_mode (void)
|
||||
{
|
||||
panic ("Resetting CPU ...\n");
|
||||
|
||||
@@ -41,14 +41,14 @@ void gpiosetdir(ushort mask, ushort in)
|
||||
void gpiosetout(ushort mask, ushort out)
|
||||
{
|
||||
ushort *r_ptr, r_val;
|
||||
|
||||
|
||||
r_ptr = (ushort *)GPIO_DATA_OUTPUT_REG; /* set pointer */
|
||||
r_val = *r_ptr & ~mask; /* get previous val, clear bits we want to change */
|
||||
r_val |= (out & mask); /* set specified bits in value + plus origional ones */
|
||||
*r_ptr = r_val; /* write it out */
|
||||
/*
|
||||
*r_ptr = r_val; /* write it out */
|
||||
/*
|
||||
* gcc screwed this one up :(.
|
||||
*
|
||||
*
|
||||
* *(ushort *)GPIO_DATA_OUTPUT_REG = (*(ushort *)GPIO_DATA_OUTPUT_REG & ~mask) | (out & mask);
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
|
||||
@@ -137,14 +136,14 @@ reset:
|
||||
bic r0,r0,#0x1f
|
||||
orr r0,r0,#0xd3
|
||||
msr cpsr,r0
|
||||
|
||||
|
||||
/*
|
||||
* Set up 925T mode
|
||||
*/
|
||||
mov r1, #0x81 /* Set ARM925T configuration. */
|
||||
mcr p15, 0, r1, c15, c1, 0 /* Write ARM925T configuration register. */
|
||||
|
||||
/*
|
||||
/*
|
||||
* turn off the watchdog, unlock/diable sequence
|
||||
*/
|
||||
mov r1, #0xF5
|
||||
@@ -162,9 +161,9 @@ reset:
|
||||
ldr r0, =REG_IHL2_MIR
|
||||
str r1, [r0]
|
||||
|
||||
/*
|
||||
/*
|
||||
* wait for dpll to lock
|
||||
*/
|
||||
*/
|
||||
ldr r0, =CK_DPLL1
|
||||
mov r1, #0x10
|
||||
strh r1, [r0]
|
||||
@@ -414,10 +413,9 @@ fiq:
|
||||
.globl reset_cpu
|
||||
reset_cpu:
|
||||
ldr r1, rstctl1 /* get clkm1 reset ctl */
|
||||
mov r3, #0x0
|
||||
strh r3, [r1] /* clear it */
|
||||
mov r3, #0x8
|
||||
strh r3, [r1] /* force dsp+arm reset */
|
||||
mov r3, #0x3 /* dsp_en + arm_rst = global reset */
|
||||
strh r3, [r1] /* force reset */
|
||||
mov r0, r0
|
||||
_loop_forever:
|
||||
b _loop_forever
|
||||
rstctl1:
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <syscall.h>
|
||||
#include <malloc.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/i8259.h>
|
||||
@@ -58,31 +57,6 @@ typedef struct {
|
||||
|
||||
static irq_desc_t irq_table[MAX_IRQ];
|
||||
|
||||
|
||||
asm(".globl syscall_entry\n" \
|
||||
"syscall_entry:\n" \
|
||||
"popl %ebx\n" /* throw away the return address, flags */ \
|
||||
"popl %ebx\n" /* and segment that the INT instruction pushed */ \
|
||||
"popl %ebx\n" /* on to the stack */ \
|
||||
"movl %eax, %ecx\n" /* load the syscall nr argument*/ \
|
||||
"movl syscall_tbl, %eax\n" /* load start of syscall table */ \
|
||||
"cmpl $(11-1), %ecx\n" /* FixMe: find a way to use NR_SYSCALLS macro here */ \
|
||||
"ja bad_syscall\n" \
|
||||
"movl (%eax, %ecx, 4), %eax\n" /* load the handler of the syscall*/ \
|
||||
"test %eax, %eax\n" /* test for null */ \
|
||||
"je bad_syscall\n" \
|
||||
"popl %ecx\n" \
|
||||
"popl %ebx\n" \
|
||||
"sti \n" \
|
||||
"jmp *%eax\n" \
|
||||
"bad_syscall: movl $0xffffffff, %eax\n" \
|
||||
"popl %ecx\n" \
|
||||
"popl %ebx\n" \
|
||||
"ret");
|
||||
|
||||
void __attribute__ ((regparm(0))) syscall_entry(void);
|
||||
|
||||
|
||||
asm ("irq_return:\n"
|
||||
" addl $4, %esp\n"
|
||||
" popa\n"
|
||||
@@ -483,7 +457,6 @@ int interrupt_init(void)
|
||||
set_vector(0x2e, irq_14);
|
||||
set_vector(0x2f, irq_15);
|
||||
/* vectors 0x30-0x3f are reserved for irq 16-31 */
|
||||
set_vector(0x40, syscall_entry);
|
||||
|
||||
|
||||
/* Mask all interrupts */
|
||||
|
||||
@@ -291,6 +291,11 @@ reset:
|
||||
relocate_code:
|
||||
move sp, a0 /* Set new stack pointer */
|
||||
|
||||
li t0, CFG_MONITOR_BASE
|
||||
la t3, in_ram
|
||||
lw t2, -12(t3) /* t2 <-- uboot_end_data */
|
||||
move t1, a2
|
||||
|
||||
/*
|
||||
* Fix GOT pointer:
|
||||
*
|
||||
@@ -301,11 +306,6 @@ relocate_code:
|
||||
add gp, a2 /* gp now adjusted */
|
||||
sub t6, gp, t6 /* t6 <-- relocation offset */
|
||||
|
||||
li t0, CFG_MONITOR_BASE
|
||||
la t3, in_ram
|
||||
lw t2, -12(t3) /* t2 <-- uboot_end_data */
|
||||
move t1, a2
|
||||
|
||||
/*
|
||||
* t0 = source address
|
||||
* t1 = target address
|
||||
|
||||
@@ -226,75 +226,7 @@ ProgramCheck:
|
||||
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(0xc00, SystemCall, UnknownException)
|
||||
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
|
||||
|
||||
45
cpu/mpc5xxx/Makefile
Normal file
45
cpu/mpc5xxx/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# (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$(CPU).a
|
||||
|
||||
START = start.o
|
||||
ASOBJS = io.o firmware_sc_task_bestcomm.impl.o firmware_sc_task.impl.o
|
||||
OBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o \
|
||||
loadtask.o fec.o pci_mpc5200.o
|
||||
|
||||
all: .depend $(START) $(ASOBJS) $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) crv $@ $(ASOBJS) $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(START:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(START:.o=.S) $(ASOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
27
cpu/mpc5xxx/config.mk
Normal file
27
cpu/mpc5xxx/config.mk
Normal file
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# (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
|
||||
#
|
||||
|
||||
PLATFORM_RELFLAGS += -mrelocatable -ffixed-r14 -meabi
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_MPC5XXX -ffixed-r2 -ffixed-r29 \
|
||||
-mstring -mcpu=603e -mmultiple
|
||||
103
cpu/mpc5xxx/cpu.c
Normal file
103
cpu/mpc5xxx/cpu.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* (C) Copyright 2000-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
|
||||
*/
|
||||
|
||||
/*
|
||||
* CPU specific code for the MPC5xxx CPUs
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
int checkcpu (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
ulong clock = gd->cpu_clk;
|
||||
char buf[32];
|
||||
|
||||
puts ("CPU: ");
|
||||
|
||||
printf (CPU_ID_STR);
|
||||
|
||||
printf (" (JTAG ID %08lx)", *(vu_long *)MPC5XXX_CDM_JTAGID);
|
||||
|
||||
printf (" at %s MHz\n", strmhz (buf, clock));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong msr, addr;
|
||||
|
||||
*(vu_long *)MPC5XXX_CDM_SRESET &= ~(1 << 16); /* Checkstop Reset enable */
|
||||
|
||||
/* Interrupts and MMU off */
|
||||
__asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
|
||||
|
||||
msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
|
||||
__asm__ __volatile__ ("mtmsr %0"::"r" (msr));
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
addr = CFG_MONITOR_BASE - sizeof (ulong);
|
||||
#endif
|
||||
((void (*)(void)) addr) ();
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Get timebase clock frequency (like cpu_clk in Hz)
|
||||
*
|
||||
*/
|
||||
unsigned long get_tbclk (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
ulong tbclk;
|
||||
|
||||
tbclk = (gd->bus_clk + 3L) / 4L;
|
||||
|
||||
return (tbclk);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
185
cpu/mpc5xxx/cpu_init.c
Normal file
185
cpu/mpc5xxx/cpu_init.c
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* (C) Copyright 2000-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 <mpc5xxx.h>
|
||||
|
||||
#if defined(CONFIG_MGT5100)
|
||||
#define START_REG(start) ((start) >> 15)
|
||||
#define STOP_REG(start, size) (((start) + (size) - 1) >> 15)
|
||||
#elif defined(CONFIG_MPC5200)
|
||||
#define START_REG(start) ((start) >> 16)
|
||||
#define STOP_REG(start, size) (((start) + (size) - 1) >> 16)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Breath some life into the CPU...
|
||||
*
|
||||
* Set up the memory map,
|
||||
* initialize a bunch of registers.
|
||||
*/
|
||||
void cpu_init_f (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
unsigned long addecr = (1 << 25); /* Boot_CS */
|
||||
#if defined(CFG_RAMBOOT) && defined(CONFIG_MGT5100)
|
||||
addecr |= (1 << 22); /* SDRAM enable */
|
||||
#endif
|
||||
/* Pointer is writable since we allocated a register for it */
|
||||
gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
|
||||
|
||||
/* Clear initial global data */
|
||||
memset ((void *) gd, 0, sizeof (gd_t));
|
||||
|
||||
/*
|
||||
* Memory Controller: configure chip selects and enable them
|
||||
*/
|
||||
#if defined(CFG_BOOTCS_START) && defined(CFG_BOOTCS_SIZE)
|
||||
*(vu_long *)MPC5XXX_BOOTCS_START = START_REG(CFG_BOOTCS_START);
|
||||
*(vu_long *)MPC5XXX_BOOTCS_STOP = STOP_REG(CFG_BOOTCS_START,
|
||||
CFG_BOOTCS_SIZE);
|
||||
#endif
|
||||
#if defined(CFG_BOOTCS_CFG)
|
||||
*(vu_long *)MPC5XXX_BOOTCS_CFG = CFG_BOOTCS_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS0_START) && defined(CFG_CS0_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS0_START = START_REG(CFG_CS0_START);
|
||||
*(vu_long *)MPC5XXX_CS0_STOP = STOP_REG(CFG_CS0_START, CFG_CS0_SIZE);
|
||||
/* CS0 and BOOT_CS cannot be enabled at once. */
|
||||
/* addecr |= (1 << 16); */
|
||||
#endif
|
||||
#if defined(CFG_CS0_CFG)
|
||||
*(vu_long *)MPC5XXX_CS0_CFG = CFG_CS0_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS1_START) && defined(CFG_CS1_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS1_START = START_REG(CFG_CS1_START);
|
||||
*(vu_long *)MPC5XXX_CS1_STOP = STOP_REG(CFG_CS1_START, CFG_CS1_SIZE);
|
||||
addecr |= (1 << 17);
|
||||
#endif
|
||||
#if defined(CFG_CS1_CFG)
|
||||
*(vu_long *)MPC5XXX_CS1_CFG = CFG_CS1_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS2_START) && defined(CFG_CS2_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS2_START = START_REG(CFG_CS2_START);
|
||||
*(vu_long *)MPC5XXX_CS2_STOP = STOP_REG(CFG_CS2_START, CFG_CS2_SIZE);
|
||||
addecr |= (1 << 18);
|
||||
#endif
|
||||
#if defined(CFG_CS2_CFG)
|
||||
*(vu_long *)MPC5XXX_CS2_CFG = CFG_CS2_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS3_START) && defined(CFG_CS3_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS3_START = START_REG(CFG_CS3_START);
|
||||
*(vu_long *)MPC5XXX_CS3_STOP = STOP_REG(CFG_CS3_START, CFG_CS3_SIZE);
|
||||
addecr |= (1 << 19);
|
||||
#endif
|
||||
#if defined(CFG_CS3_CFG)
|
||||
*(vu_long *)MPC5XXX_CS3_CFG = CFG_CS3_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS4_START) && defined(CFG_CS4_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS4_START = START_REG(CFG_CS4_START);
|
||||
*(vu_long *)MPC5XXX_CS4_STOP = STOP_REG(CFG_CS4_START, CFG_CS4_SIZE);
|
||||
addecr |= (1 << 20);
|
||||
#endif
|
||||
#if defined(CFG_CS4_CFG)
|
||||
*(vu_long *)MPC5XXX_CS4_CFG = CFG_CS4_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS5_START) && defined(CFG_CS5_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS5_START = START_REG(CFG_CS5_START);
|
||||
*(vu_long *)MPC5XXX_CS5_STOP = STOP_REG(CFG_CS5_START, CFG_CS5_SIZE);
|
||||
addecr |= (1 << 21);
|
||||
#endif
|
||||
#if defined(CFG_CS5_CFG)
|
||||
*(vu_long *)MPC5XXX_CS5_CFG = CFG_CS5_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
addecr |= 1;
|
||||
#if defined(CFG_CS6_START) && defined(CFG_CS6_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS6_START = START_REG(CFG_CS6_START);
|
||||
*(vu_long *)MPC5XXX_CS6_STOP = STOP_REG(CFG_CS6_START, CFG_CS6_SIZE);
|
||||
addecr |= (1 << 26);
|
||||
#endif
|
||||
#if defined(CFG_CS6_CFG)
|
||||
*(vu_long *)MPC5XXX_CS6_CFG = CFG_CS6_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS7_START) && defined(CFG_CS7_SIZE)
|
||||
*(vu_long *)MPC5XXX_CS7_START = START_REG(CFG_CS5_START);
|
||||
*(vu_long *)MPC5XXX_CS7_STOP = STOP_REG(CFG_CS7_START, CFG_CS7_SIZE);
|
||||
addecr |= (1 << 27);
|
||||
#endif
|
||||
#if defined(CFG_CS7_CFG)
|
||||
*(vu_long *)MPC5XXX_CS7_CFG = CFG_CS7_CFG;
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CS_BURST)
|
||||
*(vu_long *)MPC5XXX_CS_BURST = CFG_CS_BURST;
|
||||
#endif
|
||||
#if defined(CFG_CS_DEADCYCLE)
|
||||
*(vu_long *)MPC5XXX_CS_DEADCYCLE = CFG_CS_DEADCYCLE;
|
||||
#endif
|
||||
#endif /* CONFIG_MPC5200 */
|
||||
|
||||
/* Enable chip selects */
|
||||
*(vu_long *)MPC5XXX_ADDECR = addecr;
|
||||
*(vu_long *)MPC5XXX_CS_CTRL = (1 << 24);
|
||||
|
||||
/* Setup pin multiplexing */
|
||||
#if defined(CFG_GPS_PORT_CONFIG)
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG = CFG_GPS_PORT_CONFIG;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* enable timebase */
|
||||
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 13);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize higher level parts of CPU like time base and timers
|
||||
*/
|
||||
int cpu_init_r (void)
|
||||
{
|
||||
/* mask all interrupts */
|
||||
#if defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_ICTL_PER_MASK = 0xfffffc00;
|
||||
#elif defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_ICTL_PER_MASK = 0xffffff00;
|
||||
#endif
|
||||
*(vu_long *)MPC5XXX_ICTL_CRIT |= 0x0001ffff;
|
||||
*(vu_long *)MPC5XXX_ICTL_EXT &= ~0x00000f00;
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_MPC5XXX_FEC)
|
||||
/* load FEC microcode */
|
||||
loadtask(0, 2);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
948
cpu/mpc5xxx/fec.c
Normal file
948
cpu/mpc5xxx/fec.c
Normal file
@@ -0,0 +1,948 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* This file is based on mpc4200fec.c,
|
||||
* (C) Copyright Motorola, Inc., 2000
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include <malloc.h>
|
||||
#include <net.h>
|
||||
#include <miiphy.h>
|
||||
#include "sdma.h"
|
||||
#include "fec.h"
|
||||
|
||||
/* #define DEBUG 0x28 */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
|
||||
defined(CONFIG_MPC5XXX_FEC)
|
||||
|
||||
#if (DEBUG & 0x60)
|
||||
static void tfifo_print(mpc5xxx_fec_priv *fec);
|
||||
static void rfifo_print(mpc5xxx_fec_priv *fec);
|
||||
#endif /* DEBUG */
|
||||
|
||||
#if (DEBUG & 0x40)
|
||||
static uint32 local_crc32(char *string, unsigned int crc_value, int len);
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint8 data[1500]; /* actual data */
|
||||
int length; /* actual length */
|
||||
int used; /* buffer in use or not */
|
||||
uint8 head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */
|
||||
} NBUF;
|
||||
|
||||
/********************************************************************/
|
||||
static int mpc5xxx_fec_rbd_init(mpc5xxx_fec_priv *fec)
|
||||
{
|
||||
int ix;
|
||||
char *data;
|
||||
static int once = 0;
|
||||
|
||||
for (ix = 0; ix < FEC_RBD_NUM; ix++) {
|
||||
if (!once) {
|
||||
data = (char *)malloc(FEC_MAX_PKT_SIZE);
|
||||
if (data == NULL) {
|
||||
printf ("RBD INIT FAILED\n");
|
||||
return -1;
|
||||
}
|
||||
fec->rbdBase[ix].dataPointer = (uint32)data;
|
||||
}
|
||||
fec->rbdBase[ix].status = FEC_RBD_EMPTY;
|
||||
fec->rbdBase[ix].dataLength = 0;
|
||||
}
|
||||
once ++;
|
||||
|
||||
/*
|
||||
* have the last RBD to close the ring
|
||||
*/
|
||||
fec->rbdBase[ix - 1].status |= FEC_RBD_WRAP;
|
||||
fec->rbdIndex = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static void mpc5xxx_fec_tbd_init(mpc5xxx_fec_priv *fec)
|
||||
{
|
||||
int ix;
|
||||
|
||||
for (ix = 0; ix < FEC_TBD_NUM; ix++) {
|
||||
fec->tbdBase[ix].status = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Have the last TBD to close the ring
|
||||
*/
|
||||
fec->tbdBase[ix - 1].status |= FEC_TBD_WRAP;
|
||||
|
||||
/*
|
||||
* Initialize some indices
|
||||
*/
|
||||
fec->tbdIndex = 0;
|
||||
fec->usedTbdIndex = 0;
|
||||
fec->cleanTbdNum = FEC_TBD_NUM;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static void mpc5xxx_fec_rbd_clean(mpc5xxx_fec_priv *fec, FEC_RBD * pRbd)
|
||||
{
|
||||
/*
|
||||
* Reset buffer descriptor as empty
|
||||
*/
|
||||
if ((fec->rbdIndex) == (FEC_RBD_NUM - 1))
|
||||
pRbd->status = (FEC_RBD_WRAP | FEC_RBD_EMPTY);
|
||||
else
|
||||
pRbd->status = FEC_RBD_EMPTY;
|
||||
|
||||
pRbd->dataLength = 0;
|
||||
|
||||
/*
|
||||
* Now, we have an empty RxBD, restart the SmartDMA receive task
|
||||
*/
|
||||
SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
|
||||
|
||||
/*
|
||||
* Increment BD count
|
||||
*/
|
||||
fec->rbdIndex = (fec->rbdIndex + 1) % FEC_RBD_NUM;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static void mpc5xxx_fec_tbd_scrub(mpc5xxx_fec_priv *fec)
|
||||
{
|
||||
FEC_TBD *pUsedTbd;
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf ("tbd_scrub: fec->cleanTbdNum = %d, fec->usedTbdIndex = %d\n",
|
||||
fec->cleanTbdNum, fec->usedTbdIndex);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* process all the consumed TBDs
|
||||
*/
|
||||
while (fec->cleanTbdNum < FEC_TBD_NUM) {
|
||||
pUsedTbd = &fec->tbdBase[fec->usedTbdIndex];
|
||||
if (pUsedTbd->status & FEC_TBD_READY) {
|
||||
#if (DEBUG & 0x20)
|
||||
printf("Cannot clean TBD %d, in use\n", fec->cleanTbdNum);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* clean this buffer descriptor
|
||||
*/
|
||||
if (fec->usedTbdIndex == (FEC_TBD_NUM - 1))
|
||||
pUsedTbd->status = FEC_TBD_WRAP;
|
||||
else
|
||||
pUsedTbd->status = 0;
|
||||
|
||||
/*
|
||||
* update some indeces for a correct handling of the TBD ring
|
||||
*/
|
||||
fec->cleanTbdNum++;
|
||||
fec->usedTbdIndex = (fec->usedTbdIndex + 1) % FEC_TBD_NUM;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static void mpc5xxx_fec_set_hwaddr(mpc5xxx_fec_priv *fec, char *mac)
|
||||
{
|
||||
uint8 currByte; /* byte for which to compute the CRC */
|
||||
int byte; /* loop - counter */
|
||||
int bit; /* loop - counter */
|
||||
uint32 crc = 0xffffffff; /* initial value */
|
||||
|
||||
/*
|
||||
* The algorithm used is the following:
|
||||
* we loop on each of the six bytes of the provided address,
|
||||
* and we compute the CRC by left-shifting the previous
|
||||
* value by one position, so that each bit in the current
|
||||
* byte of the address may contribute the calculation. If
|
||||
* the latter and the MSB in the CRC are different, then
|
||||
* the CRC value so computed is also ex-ored with the
|
||||
* "polynomium generator". The current byte of the address
|
||||
* is also shifted right by one bit at each iteration.
|
||||
* This is because the CRC generatore in hardware is implemented
|
||||
* as a shift-register with as many ex-ores as the radixes
|
||||
* in the polynomium. This suggests that we represent the
|
||||
* polynomiumm itself as a 32-bit constant.
|
||||
*/
|
||||
for (byte = 0; byte < 6; byte++) {
|
||||
currByte = mac[byte];
|
||||
for (bit = 0; bit < 8; bit++) {
|
||||
if ((currByte & 0x01) ^ (crc & 0x01)) {
|
||||
crc >>= 1;
|
||||
crc = crc ^ 0xedb88320;
|
||||
} else {
|
||||
crc >>= 1;
|
||||
}
|
||||
currByte >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
crc = crc >> 26;
|
||||
|
||||
/*
|
||||
* Set individual hash table register
|
||||
*/
|
||||
if (crc >= 32) {
|
||||
fec->eth->iaddr1 = (1 << (crc - 32));
|
||||
fec->eth->iaddr2 = 0;
|
||||
} else {
|
||||
fec->eth->iaddr1 = 0;
|
||||
fec->eth->iaddr2 = (1 << crc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set physical address
|
||||
*/
|
||||
fec->eth->paddr1 = (mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3];
|
||||
fec->eth->paddr2 = (mac[4] << 24) + (mac[5] << 16) + 0x8808;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
{
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
|
||||
const uint8 phyAddr = 0; /* Only one PHY */
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf ("mpc5xxx_fec_init... Begin\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize RxBD/TxBD rings
|
||||
*/
|
||||
mpc5xxx_fec_rbd_init(fec);
|
||||
mpc5xxx_fec_tbd_init(fec);
|
||||
|
||||
/*
|
||||
* Initialize GPIO pins
|
||||
*/
|
||||
if (fec->xcv_type == SEVENWIRE) {
|
||||
/* 10MBit with 7-wire operation */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
|
||||
} else {
|
||||
/* 100MBit with MD operation */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear FEC-Lite interrupt event register(IEVENT)
|
||||
*/
|
||||
fec->eth->ievent = 0xffffffff;
|
||||
|
||||
/*
|
||||
* Set interrupt mask register
|
||||
*/
|
||||
fec->eth->imask = 0x00000000;
|
||||
|
||||
/*
|
||||
* Set FEC-Lite receive control register(R_CNTRL):
|
||||
*/
|
||||
if (fec->xcv_type == SEVENWIRE) {
|
||||
/*
|
||||
* Frame length=1518; 7-wire mode
|
||||
*/
|
||||
fec->eth->r_cntrl = 0x05ee0020; /*0x05ee0000;FIXME */
|
||||
} else {
|
||||
/*
|
||||
* Frame length=1518; MII mode;
|
||||
*/
|
||||
fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */
|
||||
}
|
||||
|
||||
if (fec->xcv_type == SEVENWIRE) {
|
||||
/*
|
||||
* Set FEC-Lite transmit control register(X_CNTRL):
|
||||
*/
|
||||
/*fec->eth->x_cntrl = 0x00000002; */ /* half-duplex, heartbeat */
|
||||
fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
|
||||
} else {
|
||||
/*fec->eth->x_cntrl = 0x00000006; */ /* full-duplex, heartbeat */
|
||||
fec->eth->x_cntrl = 0x00000004; /* full-duplex, heartbeat disabled */
|
||||
|
||||
/*
|
||||
* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock(25Mhz)
|
||||
* and do not drop the Preamble.
|
||||
*/
|
||||
fec->eth->mii_speed = (0x5 << 1); /* No MII for 7-wire mode */
|
||||
}
|
||||
|
||||
/*
|
||||
* Set Opcode/Pause Duration Register
|
||||
*/
|
||||
fec->eth->op_pause = 0x00010020; /*FIXME0xffff0020; */
|
||||
|
||||
/*
|
||||
* Set Rx FIFO alarm and granularity value
|
||||
*/
|
||||
fec->eth->rfifo_cntrl = 0x0c000000;
|
||||
fec->eth->rfifo_alarm = 0x0000030c;
|
||||
#if (DEBUG & 0x22)
|
||||
if (fec->eth->rfifo_status & 0x00700000 ) {
|
||||
printf("mpc5xxx_fec_init() RFIFO error\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set Tx FIFO granularity value
|
||||
*/
|
||||
fec->eth->tfifo_cntrl = 0x0c000000;
|
||||
#if (DEBUG & 0x2)
|
||||
printf("tfifo_status: 0x%08x\n", fec->eth->tfifo_status);
|
||||
printf("tfifo_alarm: 0x%08x\n", fec->eth->tfifo_alarm);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set transmit fifo watermark register(X_WMRK), default = 64
|
||||
*/
|
||||
fec->eth->tfifo_alarm = 0x00000080;
|
||||
fec->eth->x_wmrk = 0x2;
|
||||
|
||||
/*
|
||||
* Set individual address filter for unicast address
|
||||
* and set physical address registers.
|
||||
*/
|
||||
mpc5xxx_fec_set_hwaddr(fec, dev->enetaddr);
|
||||
|
||||
/*
|
||||
* Set multicast address filter
|
||||
*/
|
||||
fec->eth->gaddr1 = 0x00000000;
|
||||
fec->eth->gaddr2 = 0x00000000;
|
||||
|
||||
/*
|
||||
* Turn ON cheater FSM: ????
|
||||
*/
|
||||
fec->eth->xmit_fsm = 0x03000000;
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/*
|
||||
* Turn off COMM bus prefetch in the MGT5200 BestComm. It doesn't
|
||||
* work w/ the current receive task.
|
||||
*/
|
||||
sdma->PtdCntrl |= 0x00000001;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set priority of different initiators
|
||||
*/
|
||||
sdma->IPR0 = 7; /* always */
|
||||
sdma->IPR3 = 6; /* Eth RX */
|
||||
sdma->IPR4 = 5; /* Eth Tx */
|
||||
|
||||
/*
|
||||
* Clear SmartDMA task interrupt pending bits
|
||||
*/
|
||||
SDMA_CLEAR_IEVENT(FEC_RECV_TASK_NO);
|
||||
|
||||
/*
|
||||
* Initialize SmartDMA parameters stored in SRAM
|
||||
*/
|
||||
*(int *)FEC_TBD_BASE = (int)fec->tbdBase;
|
||||
*(int *)FEC_RBD_BASE = (int)fec->rbdBase;
|
||||
*(int *)FEC_TBD_NEXT = (int)fec->tbdBase;
|
||||
*(int *)FEC_RBD_NEXT = (int)fec->rbdBase;
|
||||
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
/*
|
||||
* Initialize PHY(LXT971A):
|
||||
*
|
||||
* Generally, on power up, the LXT971A reads its configuration
|
||||
* pins to check for forced operation, If not cofigured for
|
||||
* forced operation, it uses auto-negotiation/parallel detection
|
||||
* to automatically determine line operating conditions.
|
||||
* If the PHY device on the other side of the link supports
|
||||
* auto-negotiation, the LXT971A auto-negotiates with it
|
||||
* using Fast Link Pulse(FLP) Bursts. If the PHY partner does not
|
||||
* support auto-negotiation, the LXT971A automatically detects
|
||||
* the presence of either link pulses(10Mbps PHY) or Idle
|
||||
* symbols(100Mbps) and sets its operating conditions accordingly.
|
||||
*
|
||||
* When auto-negotiation is controlled by software, the following
|
||||
* steps are recommended.
|
||||
*
|
||||
* Note:
|
||||
* The physical address is dependent on hardware configuration.
|
||||
*
|
||||
*/
|
||||
int timeout = 1;
|
||||
uint16 phyStatus;
|
||||
|
||||
/*
|
||||
* Reset PHY, then delay 300ns
|
||||
*/
|
||||
miiphy_write(phyAddr, 0x0, 0x8000);
|
||||
udelay(1000);
|
||||
|
||||
if (fec->xcv_type == MII10) {
|
||||
/*
|
||||
* Force 10Base-T, FDX operation
|
||||
*/
|
||||
printf("Forcing 10 Mbps ethernet link... ");
|
||||
miiphy_read(phyAddr, 0x1, &phyStatus);
|
||||
/*
|
||||
miiphy_write(fec, phyAddr, 0x0, 0x0100);
|
||||
*/
|
||||
miiphy_write(phyAddr, 0x0, 0x0180);
|
||||
|
||||
timeout = 20;
|
||||
do { /* wait for link status to go down */
|
||||
udelay(10000);
|
||||
if ((timeout--) == 0) {
|
||||
#if (DEBUG & 0x2)
|
||||
printf("hmmm, should not have waited...");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
miiphy_read(phyAddr, 0x1, &phyStatus);
|
||||
#if (DEBUG & 0x2)
|
||||
printf("=");
|
||||
#endif
|
||||
} while ((phyStatus & 0x0004)); /* !link up */
|
||||
|
||||
timeout = 1000;
|
||||
do { /* wait for link status to come back up */
|
||||
udelay(10000);
|
||||
if ((timeout--) == 0) {
|
||||
printf("failed. Link is down.\n");
|
||||
break;
|
||||
}
|
||||
miiphy_read(phyAddr, 0x1, &phyStatus);
|
||||
#if (DEBUG & 0x2)
|
||||
printf("+");
|
||||
#endif
|
||||
} while (!(phyStatus & 0x0004)); /* !link up */
|
||||
|
||||
printf ("done.\n");
|
||||
} else { /* MII100 */
|
||||
/*
|
||||
* Set the auto-negotiation advertisement register bits
|
||||
*/
|
||||
miiphy_write(phyAddr, 0x4, 0x01e1);
|
||||
|
||||
/*
|
||||
* Set MDIO bit 0.12 = 1(&& bit 0.9=1?) to enable auto-negotiation
|
||||
*/
|
||||
miiphy_write(phyAddr, 0x0, 0x1200);
|
||||
|
||||
/*
|
||||
* Wait for AN completion
|
||||
*/
|
||||
timeout = 5000;
|
||||
do {
|
||||
udelay(1000);
|
||||
|
||||
if ((timeout--) == 0) {
|
||||
#if (DEBUG & 0x2)
|
||||
printf("PHY auto neg 0 failed...\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (miiphy_read(phyAddr, 0x1, &phyStatus) != 0) {
|
||||
#if (DEBUG & 0x2)
|
||||
printf("PHY auto neg 1 failed 0x%04x...\n", phyStatus);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
} while ((phyStatus & 0x0020) != 0x0020);
|
||||
|
||||
#if (DEBUG & 0x2)
|
||||
printf("PHY auto neg complete! \n");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable FEC-Lite controller
|
||||
*/
|
||||
fec->eth->ecntrl |= 0x00000006;
|
||||
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
#if (DEBUG & 0x2)
|
||||
uint16 phyStatus, i;
|
||||
uint8 phyAddr = 0;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
miiphy_read(phyAddr, i, &phyStatus);
|
||||
printf("Mii reg %d: 0x%04x\n", i, phyStatus);
|
||||
}
|
||||
for (i = 16; i < 21; i++) {
|
||||
miiphy_read(phyAddr, i, &phyStatus);
|
||||
printf("Mii reg %d: 0x%04x\n", i, phyStatus);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Enable SmartDMA receive task
|
||||
*/
|
||||
SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf("mpc5xxx_fec_init... Done \n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static void mpc5xxx_fec_halt(struct eth_device *dev)
|
||||
{
|
||||
#if defined(CONFIG_MPC5200)
|
||||
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
|
||||
#endif
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
int counter = 0xffff;
|
||||
|
||||
#if (DEBUG & 0x2)
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
uint16 phyStatus, i;
|
||||
uint8 phyAddr = 0;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
miiphy_read(phyAddr, i, &phyStatus);
|
||||
printf("Mii reg %d: 0x%04x\n", i, phyStatus);
|
||||
}
|
||||
for (i = 16; i < 21; i++) {
|
||||
miiphy_read(phyAddr, i, &phyStatus);
|
||||
printf ("Mii reg %d: 0x%04x\n", i, phyStatus);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* mask FEC chip interrupts
|
||||
*/
|
||||
fec->eth->imask = 0;
|
||||
|
||||
/*
|
||||
* issue graceful stop command to the FEC transmitter if necessary
|
||||
*/
|
||||
fec->eth->x_cntrl |= 0x00000001;
|
||||
|
||||
/*
|
||||
* wait for graceful stop to register
|
||||
*/
|
||||
while ((counter--) && (!(fec->eth->ievent & 0x10000000))) ;
|
||||
|
||||
/*
|
||||
* Disable SmartDMA tasks
|
||||
*/
|
||||
SDMA_TASK_DISABLE (FEC_XMIT_TASK_NO);
|
||||
SDMA_TASK_DISABLE (FEC_RECV_TASK_NO);
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/*
|
||||
* Turn on COMM bus prefetch in the MGT5200 BestComm after we're
|
||||
* done. It doesn't work w/ the current receive task.
|
||||
*/
|
||||
sdma->PtdCntrl &= ~0x00000001;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Disable the Ethernet Controller
|
||||
*/
|
||||
fec->eth->ecntrl &= 0xfffffffd;
|
||||
|
||||
/*
|
||||
* Clear FIFO status registers
|
||||
*/
|
||||
fec->eth->rfifo_status &= 0x00700000;
|
||||
fec->eth->tfifo_status &= 0x00700000;
|
||||
|
||||
fec->eth->reset_cntrl = 0x01000000;
|
||||
|
||||
/*
|
||||
* Issue a reset command to the FEC chip
|
||||
*/
|
||||
fec->eth->ecntrl |= 0x1;
|
||||
|
||||
/*
|
||||
* wait at least 16 clock cycles
|
||||
*/
|
||||
udelay(10);
|
||||
|
||||
#if (DEBUG & 0x3)
|
||||
printf("Ethernet task stopped\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (DEBUG & 0x60)
|
||||
/********************************************************************/
|
||||
|
||||
static void tfifo_print(mpc5xxx_fec_priv *fec)
|
||||
{
|
||||
uint16 phyAddr = 0;
|
||||
uint16 phyStatus;
|
||||
|
||||
if ((fec->eth->tfifo_lrf_ptr != fec->eth->tfifo_lwf_ptr)
|
||||
|| (fec->eth->tfifo_rdptr != fec->eth->tfifo_wrptr)) {
|
||||
|
||||
miiphy_read(phyAddr, 0x1, &phyStatus);
|
||||
printf("\nphyStatus: 0x%04x\n", phyStatus);
|
||||
printf("ecntrl: 0x%08x\n", fec->eth->ecntrl);
|
||||
printf("ievent: 0x%08x\n", fec->eth->ievent);
|
||||
printf("x_status: 0x%08x\n", fec->eth->x_status);
|
||||
printf("tfifo: status 0x%08x\n", fec->eth->tfifo_status);
|
||||
|
||||
printf(" control 0x%08x\n", fec->eth->tfifo_cntrl);
|
||||
printf(" lrfp 0x%08x\n", fec->eth->tfifo_lrf_ptr);
|
||||
printf(" lwfp 0x%08x\n", fec->eth->tfifo_lwf_ptr);
|
||||
printf(" alarm 0x%08x\n", fec->eth->tfifo_alarm);
|
||||
printf(" readptr 0x%08x\n", fec->eth->tfifo_rdptr);
|
||||
printf(" writptr 0x%08x\n", fec->eth->tfifo_wrptr);
|
||||
}
|
||||
}
|
||||
|
||||
static void rfifo_print(mpc5xxx_fec_priv *fec)
|
||||
{
|
||||
uint16 phyAddr = 0;
|
||||
uint16 phyStatus;
|
||||
|
||||
if ((fec->eth->rfifo_lrf_ptr != fec->eth->rfifo_lwf_ptr)
|
||||
|| (fec->eth->rfifo_rdptr != fec->eth->rfifo_wrptr)) {
|
||||
|
||||
miiphy_read(phyAddr, 0x1, &phyStatus);
|
||||
printf("\nphyStatus: 0x%04x\n", phyStatus);
|
||||
printf("ecntrl: 0x%08x\n", fec->eth->ecntrl);
|
||||
printf("ievent: 0x%08x\n", fec->eth->ievent);
|
||||
printf("x_status: 0x%08x\n", fec->eth->x_status);
|
||||
printf("rfifo: status 0x%08x\n", fec->eth->rfifo_status);
|
||||
|
||||
printf(" control 0x%08x\n", fec->eth->rfifo_cntrl);
|
||||
printf(" lrfp 0x%08x\n", fec->eth->rfifo_lrf_ptr);
|
||||
printf(" lwfp 0x%08x\n", fec->eth->rfifo_lwf_ptr);
|
||||
printf(" alarm 0x%08x\n", fec->eth->rfifo_alarm);
|
||||
printf(" readptr 0x%08x\n", fec->eth->rfifo_rdptr);
|
||||
printf(" writptr 0x%08x\n", fec->eth->rfifo_wrptr);
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
static int mpc5xxx_fec_send(struct eth_device *dev, volatile void *eth_data,
|
||||
int data_length)
|
||||
{
|
||||
/*
|
||||
* This routine transmits one frame. This routine only accepts
|
||||
* 6-byte Ethernet addresses.
|
||||
*/
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
FEC_TBD *pTbd;
|
||||
|
||||
#if (DEBUG & 0x20)
|
||||
printf("tbd status: 0x%04x\n", fec->tbdBase[0].status);
|
||||
tfifo_print(fec);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Clear Tx BD ring at first
|
||||
*/
|
||||
mpc5xxx_fec_tbd_scrub(fec);
|
||||
|
||||
/*
|
||||
* Check for valid length of data.
|
||||
*/
|
||||
if ((data_length > 1500) || (data_length <= 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the number of vacant TxBDs.
|
||||
*/
|
||||
if (fec->cleanTbdNum < 1) {
|
||||
#if (DEBUG & 0x20)
|
||||
printf("No available TxBDs ...\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the first TxBD to send the mac header
|
||||
*/
|
||||
pTbd = &fec->tbdBase[fec->tbdIndex];
|
||||
pTbd->dataLength = data_length;
|
||||
pTbd->dataPointer = (uint32)eth_data;
|
||||
pTbd->status |= FEC_TBD_LAST | FEC_TBD_TC | FEC_TBD_READY;
|
||||
fec->tbdIndex = (fec->tbdIndex + 1) % FEC_TBD_NUM;
|
||||
|
||||
#if (DEBUG & 0x100)
|
||||
printf("SDMA_TASK_ENABLE, fec->tbdIndex = %d \n", fec->tbdIndex);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Kick the MII i/f
|
||||
*/
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
uint16 phyStatus;
|
||||
miiphy_read(0, 0x1, &phyStatus);
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable SmartDMA transmit task
|
||||
*/
|
||||
|
||||
#if (DEBUG & 0x20)
|
||||
tfifo_print(fec);
|
||||
#endif
|
||||
SDMA_TASK_ENABLE (FEC_XMIT_TASK_NO);
|
||||
#if (DEBUG & 0x20)
|
||||
tfifo_print(fec);
|
||||
#endif
|
||||
#if (DEBUG & 0x8)
|
||||
printf( "+" );
|
||||
#endif
|
||||
|
||||
fec->cleanTbdNum -= 1;
|
||||
|
||||
#if (DEBUG & 0x129) && (DEBUG & 0x80000000)
|
||||
printf ("smartDMA ethernet Tx task enabled\n");
|
||||
#endif
|
||||
/*
|
||||
* wait until frame is sent .
|
||||
*/
|
||||
while (pTbd->status & FEC_TBD_READY) {
|
||||
udelay(10);
|
||||
#if (DEBUG & 0x8)
|
||||
printf ("TDB status = %04x\n", pTbd->status);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
static int mpc5xxx_fec_recv(struct eth_device *dev)
|
||||
{
|
||||
/*
|
||||
* This command pulls one frame from the card
|
||||
*/
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
FEC_RBD *pRbd = &fec->rbdBase[fec->rbdIndex];
|
||||
unsigned long ievent;
|
||||
int frame_length, len = 0;
|
||||
NBUF *frame;
|
||||
char buff[FEC_MAX_PKT_SIZE];
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf ("mpc5xxx_fec_recv %d Start...\n", fec->rbdIndex);
|
||||
#endif
|
||||
#if (DEBUG & 0x8)
|
||||
printf( "-" );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check if any critical events have happened
|
||||
*/
|
||||
ievent = fec->eth->ievent;
|
||||
fec->eth->ievent = ievent;
|
||||
if (ievent & 0x20060000) {
|
||||
/* BABT, Rx/Tx FIFO errors */
|
||||
mpc5xxx_fec_halt(dev);
|
||||
mpc5xxx_fec_init(dev, NULL);
|
||||
return 0;
|
||||
}
|
||||
if (ievent & 0x80000000) {
|
||||
/* Heartbeat error */
|
||||
fec->eth->x_cntrl |= 0x00000001;
|
||||
}
|
||||
if (ievent & 0x10000000) {
|
||||
/* Graceful stop complete */
|
||||
if (fec->eth->x_cntrl & 0x00000001) {
|
||||
mpc5xxx_fec_halt(dev);
|
||||
fec->eth->x_cntrl &= ~0x00000001;
|
||||
mpc5xxx_fec_init(dev, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(pRbd->status & FEC_RBD_EMPTY)) {
|
||||
if ((pRbd->status & FEC_RBD_LAST) && !(pRbd->status & FEC_RBD_ERR) &&
|
||||
((pRbd->dataLength - 4) > 14)) {
|
||||
|
||||
/*
|
||||
* Get buffer address and size
|
||||
*/
|
||||
frame = (NBUF *)pRbd->dataPointer;
|
||||
frame_length = pRbd->dataLength - 4;
|
||||
|
||||
#if (DEBUG & 0x20)
|
||||
{
|
||||
int i;
|
||||
printf("recv data hdr:");
|
||||
for (i = 0; i < 14; i++)
|
||||
printf("%x ", *(frame->head + i));
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Fill the buffer and pass it to upper layers
|
||||
*/
|
||||
memcpy(buff, frame->head, 14);
|
||||
memcpy(buff + 14, frame->data, frame_length);
|
||||
NetReceive(buff, frame_length);
|
||||
len = frame_length;
|
||||
}
|
||||
/*
|
||||
* Reset buffer descriptor as empty
|
||||
*/
|
||||
mpc5xxx_fec_rbd_clean(fec, pRbd);
|
||||
}
|
||||
SDMA_CLEAR_IEVENT (FEC_RECV_TASK_NO);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
int mpc5xxx_fec_initialize(bd_t * bis)
|
||||
{
|
||||
mpc5xxx_fec_priv *fec;
|
||||
struct eth_device *dev;
|
||||
|
||||
fec = (mpc5xxx_fec_priv *)malloc(sizeof(*fec));
|
||||
dev = (struct eth_device *)malloc(sizeof(*dev));
|
||||
|
||||
fec->eth = (ethernet_regs *)MPC5XXX_FEC;
|
||||
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
|
||||
fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));
|
||||
#ifdef CONFIG_ICECUBE
|
||||
fec->xcv_type = MII100;
|
||||
#endif
|
||||
|
||||
dev->priv = (void *)fec;
|
||||
dev->iobase = MPC5XXX_FEC;
|
||||
dev->init = mpc5xxx_fec_init;
|
||||
dev->halt = mpc5xxx_fec_halt;
|
||||
dev->send = mpc5xxx_fec_send;
|
||||
dev->recv = mpc5xxx_fec_recv;
|
||||
|
||||
sprintf(dev->name, "FEC ETHERNET");
|
||||
eth_register(dev);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* MII-interface related functions */
|
||||
/********************************************************************/
|
||||
int miiphy_read(uint8 phyAddr, uint8 regAddr, uint16 * retVal)
|
||||
{
|
||||
ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC;
|
||||
uint32 reg; /* convenient holder for the PHY register */
|
||||
uint32 phy; /* convenient holder for the PHY */
|
||||
int timeout = 0xffff;
|
||||
|
||||
/*
|
||||
* reading from any PHY's register is done by properly
|
||||
* programming the FEC's MII data register.
|
||||
*/
|
||||
reg = regAddr << FEC_MII_DATA_RA_SHIFT;
|
||||
phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
|
||||
|
||||
eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA | phy | reg);
|
||||
|
||||
/*
|
||||
* wait for the related interrupt
|
||||
*/
|
||||
while ((timeout--) && (!(eth->ievent & 0x00800000))) ;
|
||||
|
||||
if (timeout == 0) {
|
||||
#if (DEBUG & 0x2)
|
||||
printf ("Read MDIO failed...\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* clear mii interrupt bit
|
||||
*/
|
||||
eth->ievent = 0x00800000;
|
||||
|
||||
/*
|
||||
* it's now safe to read the PHY's register
|
||||
*/
|
||||
*retVal = (uint16) eth->mii_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
int miiphy_write(uint8 phyAddr, uint8 regAddr, uint16 data)
|
||||
{
|
||||
ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC;
|
||||
uint32 reg; /* convenient holder for the PHY register */
|
||||
uint32 phy; /* convenient holder for the PHY */
|
||||
int timeout = 0xffff;
|
||||
|
||||
reg = regAddr << FEC_MII_DATA_RA_SHIFT;
|
||||
phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
|
||||
|
||||
eth->mii_data = (FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR |
|
||||
FEC_MII_DATA_TA | phy | reg | data);
|
||||
|
||||
/*
|
||||
* wait for the MII interrupt
|
||||
*/
|
||||
while ((timeout--) && (!(eth->ievent & 0x00800000))) ;
|
||||
|
||||
if (timeout == 0) {
|
||||
#if (DEBUG & 0x2)
|
||||
printf ("Write MDIO failed...\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* clear MII interrupt bit
|
||||
*/
|
||||
eth->ievent = 0x00800000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (DEBUG & 0x40)
|
||||
static uint32 local_crc32(char *string, unsigned int crc_value, int len)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
unsigned int crc, count;
|
||||
|
||||
/*
|
||||
* crc32 algorithm
|
||||
*/
|
||||
/*
|
||||
* crc = 0xffffffff; * The initialized value should be 0xffffffff
|
||||
*/
|
||||
crc = crc_value;
|
||||
|
||||
for (i = len; --i >= 0;) {
|
||||
c = *string++;
|
||||
for (count = 0; count < 8; count++) {
|
||||
if ((c & 0x01) ^ (crc & 0x01)) {
|
||||
crc >>= 1;
|
||||
crc = crc ^ 0xedb88320;
|
||||
} else {
|
||||
crc >>= 1;
|
||||
}
|
||||
c >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* In big endian system, do byte swaping for crc value
|
||||
*/
|
||||
/**/ return crc;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
#endif /* CONFIG_MPC5XXX_FEC */
|
||||
286
cpu/mpc5xxx/fec.h
Normal file
286
cpu/mpc5xxx/fec.h
Normal file
@@ -0,0 +1,286 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* This file is based on mpc4200fec.h
|
||||
* (C) Copyright Motorola, Inc., 2000
|
||||
*
|
||||
* odin ethernet header file
|
||||
*/
|
||||
|
||||
#ifndef __MPC5XXX_FEC_H
|
||||
#define __MPC5XXX_FEC_H
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include "sdma.h"
|
||||
|
||||
typedef unsigned long uint32;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned char uint8;
|
||||
|
||||
typedef struct ethernet_register_set {
|
||||
|
||||
/* [10:2]addr = 00 */
|
||||
|
||||
/* Control and status Registers (offset 000-1FF) */
|
||||
|
||||
volatile uint32 fec_id; /* MBAR_ETH + 0x000 */
|
||||
volatile uint32 ievent; /* MBAR_ETH + 0x004 */
|
||||
volatile uint32 imask; /* MBAR_ETH + 0x008 */
|
||||
|
||||
volatile uint32 RES0[1]; /* MBAR_ETH + 0x00C */
|
||||
volatile uint32 r_des_active; /* MBAR_ETH + 0x010 */
|
||||
volatile uint32 x_des_active; /* MBAR_ETH + 0x014 */
|
||||
volatile uint32 r_des_active_cl; /* MBAR_ETH + 0x018 */
|
||||
volatile uint32 x_des_active_cl; /* MBAR_ETH + 0x01C */
|
||||
volatile uint32 ivent_set; /* MBAR_ETH + 0x020 */
|
||||
volatile uint32 ecntrl; /* MBAR_ETH + 0x024 */
|
||||
|
||||
volatile uint32 RES1[6]; /* MBAR_ETH + 0x028-03C */
|
||||
volatile uint32 mii_data; /* MBAR_ETH + 0x040 */
|
||||
volatile uint32 mii_speed; /* MBAR_ETH + 0x044 */
|
||||
volatile uint32 mii_status; /* MBAR_ETH + 0x048 */
|
||||
|
||||
volatile uint32 RES2[5]; /* MBAR_ETH + 0x04C-05C */
|
||||
volatile uint32 mib_data; /* MBAR_ETH + 0x060 */
|
||||
volatile uint32 mib_control; /* MBAR_ETH + 0x064 */
|
||||
|
||||
volatile uint32 RES3[6]; /* MBAR_ETH + 0x068-7C */
|
||||
volatile uint32 r_activate; /* MBAR_ETH + 0x080 */
|
||||
volatile uint32 r_cntrl; /* MBAR_ETH + 0x084 */
|
||||
volatile uint32 r_hash; /* MBAR_ETH + 0x088 */
|
||||
volatile uint32 r_data; /* MBAR_ETH + 0x08C */
|
||||
volatile uint32 ar_done; /* MBAR_ETH + 0x090 */
|
||||
volatile uint32 r_test; /* MBAR_ETH + 0x094 */
|
||||
volatile uint32 r_mib; /* MBAR_ETH + 0x098 */
|
||||
volatile uint32 r_da_low; /* MBAR_ETH + 0x09C */
|
||||
volatile uint32 r_da_high; /* MBAR_ETH + 0x0A0 */
|
||||
|
||||
volatile uint32 RES4[7]; /* MBAR_ETH + 0x0A4-0BC */
|
||||
volatile uint32 x_activate; /* MBAR_ETH + 0x0C0 */
|
||||
volatile uint32 x_cntrl; /* MBAR_ETH + 0x0C4 */
|
||||
volatile uint32 backoff; /* MBAR_ETH + 0x0C8 */
|
||||
volatile uint32 x_data; /* MBAR_ETH + 0x0CC */
|
||||
volatile uint32 x_status; /* MBAR_ETH + 0x0D0 */
|
||||
volatile uint32 x_mib; /* MBAR_ETH + 0x0D4 */
|
||||
volatile uint32 x_test; /* MBAR_ETH + 0x0D8 */
|
||||
volatile uint32 fdxfc_da1; /* MBAR_ETH + 0x0DC */
|
||||
volatile uint32 fdxfc_da2; /* MBAR_ETH + 0x0E0 */
|
||||
volatile uint32 paddr1; /* MBAR_ETH + 0x0E4 */
|
||||
volatile uint32 paddr2; /* MBAR_ETH + 0x0E8 */
|
||||
volatile uint32 op_pause; /* MBAR_ETH + 0x0EC */
|
||||
|
||||
volatile uint32 RES5[4]; /* MBAR_ETH + 0x0F0-0FC */
|
||||
volatile uint32 instr_reg; /* MBAR_ETH + 0x100 */
|
||||
volatile uint32 context_reg; /* MBAR_ETH + 0x104 */
|
||||
volatile uint32 test_cntrl; /* MBAR_ETH + 0x108 */
|
||||
volatile uint32 acc_reg; /* MBAR_ETH + 0x10C */
|
||||
volatile uint32 ones; /* MBAR_ETH + 0x110 */
|
||||
volatile uint32 zeros; /* MBAR_ETH + 0x114 */
|
||||
volatile uint32 iaddr1; /* MBAR_ETH + 0x118 */
|
||||
volatile uint32 iaddr2; /* MBAR_ETH + 0x11C */
|
||||
volatile uint32 gaddr1; /* MBAR_ETH + 0x120 */
|
||||
volatile uint32 gaddr2; /* MBAR_ETH + 0x124 */
|
||||
volatile uint32 random; /* MBAR_ETH + 0x128 */
|
||||
volatile uint32 rand1; /* MBAR_ETH + 0x12C */
|
||||
volatile uint32 tmp; /* MBAR_ETH + 0x130 */
|
||||
|
||||
volatile uint32 RES6[3]; /* MBAR_ETH + 0x134-13C */
|
||||
volatile uint32 fifo_id; /* MBAR_ETH + 0x140 */
|
||||
volatile uint32 x_wmrk; /* MBAR_ETH + 0x144 */
|
||||
volatile uint32 fcntrl; /* MBAR_ETH + 0x148 */
|
||||
volatile uint32 r_bound; /* MBAR_ETH + 0x14C */
|
||||
volatile uint32 r_fstart; /* MBAR_ETH + 0x150 */
|
||||
volatile uint32 r_count; /* MBAR_ETH + 0x154 */
|
||||
volatile uint32 r_lag; /* MBAR_ETH + 0x158 */
|
||||
volatile uint32 r_read; /* MBAR_ETH + 0x15C */
|
||||
volatile uint32 r_write; /* MBAR_ETH + 0x160 */
|
||||
volatile uint32 x_count; /* MBAR_ETH + 0x164 */
|
||||
volatile uint32 x_lag; /* MBAR_ETH + 0x168 */
|
||||
volatile uint32 x_retry; /* MBAR_ETH + 0x16C */
|
||||
volatile uint32 x_write; /* MBAR_ETH + 0x170 */
|
||||
volatile uint32 x_read; /* MBAR_ETH + 0x174 */
|
||||
|
||||
volatile uint32 RES7[2]; /* MBAR_ETH + 0x178-17C */
|
||||
volatile uint32 fm_cntrl; /* MBAR_ETH + 0x180 */
|
||||
volatile uint32 rfifo_data; /* MBAR_ETH + 0x184 */
|
||||
volatile uint32 rfifo_status; /* MBAR_ETH + 0x188 */
|
||||
volatile uint32 rfifo_cntrl; /* MBAR_ETH + 0x18C */
|
||||
volatile uint32 rfifo_lrf_ptr; /* MBAR_ETH + 0x190 */
|
||||
volatile uint32 rfifo_lwf_ptr; /* MBAR_ETH + 0x194 */
|
||||
volatile uint32 rfifo_alarm; /* MBAR_ETH + 0x198 */
|
||||
volatile uint32 rfifo_rdptr; /* MBAR_ETH + 0x19C */
|
||||
volatile uint32 rfifo_wrptr; /* MBAR_ETH + 0x1A0 */
|
||||
volatile uint32 tfifo_data; /* MBAR_ETH + 0x1A4 */
|
||||
volatile uint32 tfifo_status; /* MBAR_ETH + 0x1A8 */
|
||||
volatile uint32 tfifo_cntrl; /* MBAR_ETH + 0x1AC */
|
||||
volatile uint32 tfifo_lrf_ptr; /* MBAR_ETH + 0x1B0 */
|
||||
volatile uint32 tfifo_lwf_ptr; /* MBAR_ETH + 0x1B4 */
|
||||
volatile uint32 tfifo_alarm; /* MBAR_ETH + 0x1B8 */
|
||||
volatile uint32 tfifo_rdptr; /* MBAR_ETH + 0x1BC */
|
||||
volatile uint32 tfifo_wrptr; /* MBAR_ETH + 0x1C0 */
|
||||
|
||||
volatile uint32 reset_cntrl; /* MBAR_ETH + 0x1C4 */
|
||||
volatile uint32 xmit_fsm; /* MBAR_ETH + 0x1C8 */
|
||||
|
||||
volatile uint32 RES8[3]; /* MBAR_ETH + 0x1CC-1D4 */
|
||||
volatile uint32 rdes_data0; /* MBAR_ETH + 0x1D8 */
|
||||
volatile uint32 rdes_data1; /* MBAR_ETH + 0x1DC */
|
||||
volatile uint32 r_length; /* MBAR_ETH + 0x1E0 */
|
||||
volatile uint32 x_length; /* MBAR_ETH + 0x1E4 */
|
||||
volatile uint32 x_addr; /* MBAR_ETH + 0x1E8 */
|
||||
volatile uint32 cdes_data; /* MBAR_ETH + 0x1EC */
|
||||
volatile uint32 status; /* MBAR_ETH + 0x1F0 */
|
||||
volatile uint32 dma_control; /* MBAR_ETH + 0x1F4 */
|
||||
volatile uint32 des_cmnd; /* MBAR_ETH + 0x1F8 */
|
||||
volatile uint32 data; /* MBAR_ETH + 0x1FC */
|
||||
|
||||
/* MIB COUNTERS (Offset 200-2FF) */
|
||||
|
||||
volatile uint32 rmon_t_drop; /* MBAR_ETH + 0x200 */
|
||||
volatile uint32 rmon_t_packets; /* MBAR_ETH + 0x204 */
|
||||
volatile uint32 rmon_t_bc_pkt; /* MBAR_ETH + 0x208 */
|
||||
volatile uint32 rmon_t_mc_pkt; /* MBAR_ETH + 0x20C */
|
||||
volatile uint32 rmon_t_crc_align; /* MBAR_ETH + 0x210 */
|
||||
volatile uint32 rmon_t_undersize; /* MBAR_ETH + 0x214 */
|
||||
volatile uint32 rmon_t_oversize; /* MBAR_ETH + 0x218 */
|
||||
volatile uint32 rmon_t_frag; /* MBAR_ETH + 0x21C */
|
||||
volatile uint32 rmon_t_jab; /* MBAR_ETH + 0x220 */
|
||||
volatile uint32 rmon_t_col; /* MBAR_ETH + 0x224 */
|
||||
volatile uint32 rmon_t_p64; /* MBAR_ETH + 0x228 */
|
||||
volatile uint32 rmon_t_p65to127; /* MBAR_ETH + 0x22C */
|
||||
volatile uint32 rmon_t_p128to255; /* MBAR_ETH + 0x230 */
|
||||
volatile uint32 rmon_t_p256to511; /* MBAR_ETH + 0x234 */
|
||||
volatile uint32 rmon_t_p512to1023; /* MBAR_ETH + 0x238 */
|
||||
volatile uint32 rmon_t_p1024to2047; /* MBAR_ETH + 0x23C */
|
||||
volatile uint32 rmon_t_p_gte2048; /* MBAR_ETH + 0x240 */
|
||||
volatile uint32 rmon_t_octets; /* MBAR_ETH + 0x244 */
|
||||
volatile uint32 ieee_t_drop; /* MBAR_ETH + 0x248 */
|
||||
volatile uint32 ieee_t_frame_ok; /* MBAR_ETH + 0x24C */
|
||||
volatile uint32 ieee_t_1col; /* MBAR_ETH + 0x250 */
|
||||
volatile uint32 ieee_t_mcol; /* MBAR_ETH + 0x254 */
|
||||
volatile uint32 ieee_t_def; /* MBAR_ETH + 0x258 */
|
||||
volatile uint32 ieee_t_lcol; /* MBAR_ETH + 0x25C */
|
||||
volatile uint32 ieee_t_excol; /* MBAR_ETH + 0x260 */
|
||||
volatile uint32 ieee_t_macerr; /* MBAR_ETH + 0x264 */
|
||||
volatile uint32 ieee_t_cserr; /* MBAR_ETH + 0x268 */
|
||||
volatile uint32 ieee_t_sqe; /* MBAR_ETH + 0x26C */
|
||||
volatile uint32 t_fdxfc; /* MBAR_ETH + 0x270 */
|
||||
volatile uint32 ieee_t_octets_ok; /* MBAR_ETH + 0x274 */
|
||||
|
||||
volatile uint32 RES9[2]; /* MBAR_ETH + 0x278-27C */
|
||||
volatile uint32 rmon_r_drop; /* MBAR_ETH + 0x280 */
|
||||
volatile uint32 rmon_r_packets; /* MBAR_ETH + 0x284 */
|
||||
volatile uint32 rmon_r_bc_pkt; /* MBAR_ETH + 0x288 */
|
||||
volatile uint32 rmon_r_mc_pkt; /* MBAR_ETH + 0x28C */
|
||||
volatile uint32 rmon_r_crc_align; /* MBAR_ETH + 0x290 */
|
||||
volatile uint32 rmon_r_undersize; /* MBAR_ETH + 0x294 */
|
||||
volatile uint32 rmon_r_oversize; /* MBAR_ETH + 0x298 */
|
||||
volatile uint32 rmon_r_frag; /* MBAR_ETH + 0x29C */
|
||||
volatile uint32 rmon_r_jab; /* MBAR_ETH + 0x2A0 */
|
||||
|
||||
volatile uint32 rmon_r_resvd_0; /* MBAR_ETH + 0x2A4 */
|
||||
|
||||
volatile uint32 rmon_r_p64; /* MBAR_ETH + 0x2A8 */
|
||||
volatile uint32 rmon_r_p65to127; /* MBAR_ETH + 0x2AC */
|
||||
volatile uint32 rmon_r_p128to255; /* MBAR_ETH + 0x2B0 */
|
||||
volatile uint32 rmon_r_p256to511; /* MBAR_ETH + 0x2B4 */
|
||||
volatile uint32 rmon_r_p512to1023; /* MBAR_ETH + 0x2B8 */
|
||||
volatile uint32 rmon_r_p1024to2047; /* MBAR_ETH + 0x2BC */
|
||||
volatile uint32 rmon_r_p_gte2048; /* MBAR_ETH + 0x2C0 */
|
||||
volatile uint32 rmon_r_octets; /* MBAR_ETH + 0x2C4 */
|
||||
volatile uint32 ieee_r_drop; /* MBAR_ETH + 0x2C8 */
|
||||
volatile uint32 ieee_r_frame_ok; /* MBAR_ETH + 0x2CC */
|
||||
volatile uint32 ieee_r_crc; /* MBAR_ETH + 0x2D0 */
|
||||
volatile uint32 ieee_r_align; /* MBAR_ETH + 0x2D4 */
|
||||
volatile uint32 r_macerr; /* MBAR_ETH + 0x2D8 */
|
||||
volatile uint32 r_fdxfc; /* MBAR_ETH + 0x2DC */
|
||||
volatile uint32 ieee_r_octets_ok; /* MBAR_ETH + 0x2E0 */
|
||||
|
||||
volatile uint32 RES10[6]; /* MBAR_ETH + 0x2E4-2FC */
|
||||
|
||||
volatile uint32 RES11[64]; /* MBAR_ETH + 0x300-3FF */
|
||||
} ethernet_regs;
|
||||
|
||||
/* Receive & Transmit Buffer Descriptor definitions */
|
||||
typedef struct BufferDescriptor {
|
||||
uint16 status;
|
||||
uint16 dataLength;
|
||||
uint32 dataPointer;
|
||||
} FEC_RBD;
|
||||
typedef struct {
|
||||
uint16 status;
|
||||
uint16 dataLength;
|
||||
uint32 dataPointer;
|
||||
} FEC_TBD;
|
||||
|
||||
/* private structure */
|
||||
typedef enum {
|
||||
SEVENWIRE, /* 7-wire */
|
||||
MII10, /* MII 10Mbps */
|
||||
MII100 /* MII 100Mbps */
|
||||
} xceiver_type;
|
||||
|
||||
typedef struct {
|
||||
ethernet_regs *eth;
|
||||
xceiver_type xcv_type; /* transceiver type */
|
||||
FEC_RBD *rbdBase; /* RBD ring */
|
||||
FEC_TBD *tbdBase; /* TBD ring */
|
||||
uint16 rbdIndex; /* next receive BD to read */
|
||||
uint16 tbdIndex; /* next transmit BD to send */
|
||||
uint16 usedTbdIndex; /* next transmit BD to clean */
|
||||
uint16 cleanTbdNum; /* the number of available transmit BDs */
|
||||
} mpc5xxx_fec_priv;
|
||||
|
||||
/* Ethernet parameter area */
|
||||
#define FEC_TBD_BASE (FEC_PARAM_BASE + 0x00)
|
||||
#define FEC_TBD_NEXT (FEC_PARAM_BASE + 0x04)
|
||||
#define FEC_RBD_BASE (FEC_PARAM_BASE + 0x08)
|
||||
#define FEC_RBD_NEXT (FEC_PARAM_BASE + 0x0c)
|
||||
|
||||
/* BD Numer definitions */
|
||||
#define FEC_TBD_NUM 48 /* The user can adjust this value */
|
||||
#define FEC_RBD_NUM 32 /* The user can adjust this value */
|
||||
|
||||
/* packet size limit */
|
||||
#define FEC_MAX_PKT_SIZE 1536
|
||||
|
||||
/* RBD bits definitions */
|
||||
#define FEC_RBD_EMPTY 0x8000 /* Buffer is empty */
|
||||
#define FEC_RBD_WRAP 0x2000 /* Last BD in ring */
|
||||
#define FEC_RBD_INT 0x1000 /* Interrupt */
|
||||
#define FEC_RBD_LAST 0x0800 /* Buffer is last in frame(useless) */
|
||||
#define FEC_RBD_MISS 0x0100 /* Miss bit for prom mode */
|
||||
#define FEC_RBD_BC 0x0080 /* The received frame is broadcast frame */
|
||||
#define FEC_RBD_MC 0x0040 /* The received frame is multicast frame */
|
||||
#define FEC_RBD_LG 0x0020 /* Frame length violation */
|
||||
#define FEC_RBD_NO 0x0010 /* Nonoctet align frame */
|
||||
#define FEC_RBD_SH 0x0008 /* Short frame */
|
||||
#define FEC_RBD_CR 0x0004 /* CRC error */
|
||||
#define FEC_RBD_OV 0x0002 /* Receive FIFO overrun */
|
||||
#define FEC_RBD_TR 0x0001 /* Frame is truncated */
|
||||
#define FEC_RBD_ERR (FEC_RBD_LG | FEC_RBD_NO | FEC_RBD_CR | \
|
||||
FEC_RBD_OV | FEC_RBD_TR)
|
||||
|
||||
/* TBD bits definitions */
|
||||
#define FEC_TBD_READY 0x8000 /* Buffer is ready */
|
||||
#define FEC_TBD_WRAP 0x2000 /* Last BD in ring */
|
||||
#define FEC_TBD_INT 0x1000 /* Interrupt */
|
||||
#define FEC_TBD_LAST 0x0800 /* Buffer is last in frame */
|
||||
#define FEC_TBD_TC 0x0400 /* Transmit the CRC */
|
||||
#define FEC_TBD_ABC 0x0200 /* Append bad CRC */
|
||||
|
||||
/* MII-related definitios */
|
||||
#define FEC_MII_DATA_ST 0x40000000 /* Start of frame delimiter */
|
||||
#define FEC_MII_DATA_OP_RD 0x20000000 /* Perform a read operation */
|
||||
#define FEC_MII_DATA_OP_WR 0x10000000 /* Perform a write operation */
|
||||
#define FEC_MII_DATA_PA_MSK 0x0f800000 /* PHY Address field mask */
|
||||
#define FEC_MII_DATA_RA_MSK 0x007c0000 /* PHY Register field mask */
|
||||
#define FEC_MII_DATA_TA 0x00020000 /* Turnaround */
|
||||
#define FEC_MII_DATA_DATAMSK 0x0000ffff /* PHY data field */
|
||||
|
||||
#define FEC_MII_DATA_RA_SHIFT 18 /* MII Register address bits */
|
||||
#define FEC_MII_DATA_PA_SHIFT 23 /* MII PHY address bits */
|
||||
|
||||
#endif /* __MPC5XXX_FEC_H */
|
||||
364
cpu/mpc5xxx/firmware_sc_task.impl.S
Normal file
364
cpu/mpc5xxx/firmware_sc_task.impl.S
Normal file
@@ -0,0 +1,364 @@
|
||||
/*
|
||||
* Copyright (C) 2001, Software Center, Motorola China.
|
||||
*
|
||||
* This file contains microcode for the FEC controller of the MGT5100 CPU.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined(CONFIG_MGT5100)
|
||||
|
||||
/* sas/sccg, gas target */
|
||||
.section smartdmaInitData,"aw",@progbits /* Initialized data for task variables */
|
||||
.section smartdmaTaskTable,"aw",@progbits /* Task tables */
|
||||
.globl taskTable
|
||||
taskTable:
|
||||
.globl scEthernetRecv_Entry
|
||||
scEthernetRecv_Entry: /* Task 0 */
|
||||
.long scEthernetRecv_TDT - taskTable /* Task 0 Descriptor Table */
|
||||
.long scEthernetRecv_TDT - taskTable + 0x000000a4
|
||||
.long scEthernetRecv_VarTab - taskTable /* Task 0 Variable Table */
|
||||
.long scEthernetRecv_FDT - taskTable + 0x03 /* Task 0 Function Descriptor Table & Flags */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long scEthernetRecv_CSave - taskTable /* Task 0 context save space */
|
||||
.long 0xf0000000
|
||||
.globl scEthernetXmit_Entry
|
||||
scEthernetXmit_Entry: /* Task 1 */
|
||||
.long scEthernetXmit_TDT - taskTable /* Task 1 Descriptor Table */
|
||||
.long scEthernetXmit_TDT - taskTable + 0x000000d0
|
||||
.long scEthernetXmit_VarTab - taskTable /* Task 1 Variable Table */
|
||||
.long scEthernetXmit_FDT - taskTable + 0x03 /* Task 1 Function Descriptor Table & Flags */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long scEthernetXmit_CSave - taskTable /* Task 1 context save space */
|
||||
.long 0xf0000000
|
||||
|
||||
|
||||
.globl scEthernetRecv_TDT
|
||||
scEthernetRecv_TDT: /* Task 0 Descriptor Table */
|
||||
.long 0xc4c50000 /* 0000: LCDEXT: idx0 = var9 + var10; idx0 once var0; idx0 += inc0 */
|
||||
.long 0x84c5e000 /* 0004: LCD: idx1 = var9 + var11; ; idx1 += inc0 */
|
||||
.long 0x10001f08 /* 0008: DRD1A: var7 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x10000380 /* 000C: DRD1A: var0 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000f88 /* 0010: DRD1A: var3 = *idx1; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
|
||||
.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x010c504c /* 0020: DRD2B1: var4 = EU1(); EU1(var1,var12) */
|
||||
.long 0x82180349 /* 0024: LCD: idx0 = var4; idx0 != var13; idx0 += inc1 */
|
||||
.long 0x81c68004 /* 0028: LCD: idx1 = var3 + var13 + 4; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x70000000 /* 002C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x018c504e /* 0030: DRD2B1: var6 = EU1(); EU1(var1,var14) */
|
||||
.long 0x70000000 /* 0034: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x020c504f /* 0038: DRD2B1: var8 = EU1(); EU1(var1,var15) */
|
||||
.long 0x00000b88 /* 003C: DRD1A: var2 = *idx1; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x8000d184 /* 0040: LCDEXT: idx1 = 0xf0003184; ; */
|
||||
.long 0xc6990452 /* 0044: LCDEXT: idx2 = var13; idx2 < var17; idx2 += inc2 */
|
||||
.long 0x81486010 /* 0048: LCD: idx3 = var2 + var16; ; idx3 += inc2 */
|
||||
.long 0x006acf88 /* 004C: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
|
||||
.long 0x8000d184 /* 0050: LCDEXT: idx1 = 0xf0003184; ; */
|
||||
.long 0x86810492 /* 0054: LCD: idx2 = var13, idx3 = var2; idx2 < var18; idx2 += inc2, idx3 += inc2 */
|
||||
.long 0x006acf88 /* 0058: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
|
||||
.long 0x8000d184 /* 005C: LCDEXT: idx1 = 0xf0003184; ; */
|
||||
.long 0x868184d2 /* 0060: LCD: idx2 = var13, idx3 = var3; idx2 < var19; idx2 += inc2, idx3 += inc2 */
|
||||
.long 0x000acf88 /* 0064: DRD1A: *idx3 = *idx1; FN=0 init=0 WS=1 RS=1 */
|
||||
.long 0xc318839b /* 0068: LCDEXT: idx1 = var6; idx1 == var14; idx1 += inc3 */
|
||||
.long 0x80190000 /* 006C: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x04008468 /* 0070: DRD1A: idx1 = var13; FN=0 INT init=0 WS=0 RS=0 */
|
||||
.long 0xc4038358 /* 0074: LCDEXT: idx1 = var8, idx2 = var7; idx1 == var13; idx1 += inc3, idx2 += inc0 */
|
||||
.long 0x81c50000 /* 0078: LCD: idx3 = var3 + var10; idx3 once var0; idx3 += inc0 */
|
||||
.long 0x1000cb18 /* 007C: DRD1A: *idx2 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000f18 /* 0080: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0xc4188364 /* 0084: LCDEXT: idx1 = var8; idx1 > var13; idx1 += inc4 */
|
||||
.long 0x83990000 /* 0088: LCD: idx2 = var7; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x10000c00 /* 008C: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x0000c800 /* 0090: DRD1A: *idx2 = var0; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81988000 /* 0094: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x10000788 /* 0098: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 009C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x080c504c /* 00A0: DRD2B1: idx0 = EU1(); EU1(var1,var12) */
|
||||
.long 0x000001f8 /* 00A4(:0): NOP */
|
||||
|
||||
|
||||
.globl scEthernetXmit_TDT
|
||||
scEthernetXmit_TDT: /* Task 1 Descriptor Table */
|
||||
.long 0x80014800 /* 0000: LCDEXT: idx0 = 0xf0004800; ; */
|
||||
.long 0x85c60004 /* 0004: LCD: idx1 = var11 + var12 + 4; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x10002308 /* 0008: DRD1A: var8 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x10000f88 /* 000C: DRD1A: var3 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000380 /* 0010: DRD1A: var0 = *idx0; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
|
||||
.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x024c504d /* 0020: DRD2B1: var9 = EU1(); EU1(var1,var13) */
|
||||
.long 0x84980309 /* 0024: LCD: idx0 = var9; idx0 != var12; idx0 += inc1 */
|
||||
.long 0xc0004003 /* 0028: LCDEXT: idx1 = 0x00000003; ; */
|
||||
.long 0x81c60004 /* 002C: LCD: idx2 = var3 + var12 + 4; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x70000000 /* 0030: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x010c504e /* 0034: DRD2B1: var4 = EU1(); EU1(var1,var14) */
|
||||
.long 0x70000000 /* 0038: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x014c504f /* 003C: DRD2B1: var5 = EU1(); EU1(var1,var15) */
|
||||
.long 0x70000000 /* 0040: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x028c5050 /* 0044: DRD2B1: var10 = EU1(); EU1(var1,var16) */
|
||||
.long 0x70000000 /* 0048: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x018c5051 /* 004C: DRD2B1: var6 = EU1(); EU1(var1,var17) */
|
||||
.long 0x10000b90 /* 0050: DRD1A: var2 = *idx2; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 0054: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x01cc50a1 /* 0058: DRD2B1: var7 = EU1(); EU1(var2,idx1) */
|
||||
.long 0xc2988312 /* 005C: LCDEXT: idx1 = var5; idx1 > var12; idx1 += inc2 */
|
||||
.long 0x83490000 /* 0060: LCD: idx2 = var6 + var18; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x00001b10 /* 0064: DRD1A: var6 = idx2; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x8000d1a4 /* 0068: LCDEXT: idx1 = 0xf00031a4; ; */
|
||||
.long 0x8301031c /* 006C: LCD: idx2 = var6, idx3 = var2; idx2 > var12; idx2 += inc3, idx3 += inc4 */
|
||||
.long 0x008ac798 /* 0070: DRD1A: *idx1 = *idx3; FN=0 init=4 WS=1 RS=1 */
|
||||
.long 0x8000d1a4 /* 0074: LCDEXT: idx1 = 0xf00031a4; ; */
|
||||
.long 0xc1430000 /* 0078: LCDEXT: idx2 = var2 + var6; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x82998312 /* 007C: LCD: idx3 = var5; idx3 > var12; idx3 += inc2 */
|
||||
.long 0x088ac790 /* 0080: DRD1A: *idx1 = *idx2; FN=0 TFD init=4 WS=1 RS=1 */
|
||||
.long 0x81988000 /* 0084: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x60000100 /* 0088: DRD2A: EU0=0 EU1=1 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x0c4c5c4d /* 008C: DRD2B1: *idx1 = EU1(); EU1(*idx1,var13) */
|
||||
.long 0xc21883ad /* 0090: LCDEXT: idx1 = var4; idx1 == var14; idx1 += inc5 */
|
||||
.long 0x80190000 /* 0094: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x04008460 /* 0098: DRD1A: idx1 = var12; FN=0 INT init=0 WS=0 RS=0 */
|
||||
.long 0xc4052305 /* 009C: LCDEXT: idx1 = var8, idx2 = var10; idx2 == var12; idx1 += inc0, idx2 += inc5 */
|
||||
.long 0x81c98000 /* 00A0: LCD: idx3 = var3 + var19; idx3 once var0; idx3 += inc0 */
|
||||
.long 0x1000c718 /* 00A4: DRD1A: *idx1 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000f18 /* 00A8: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0xc4188000 /* 00AC: LCDEXT: idx1 = var8; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x85190312 /* 00B0: LCD: idx2 = var10; idx2 > var12; idx2 += inc2 */
|
||||
.long 0x10000c00 /* 00B4: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x1000c400 /* 00B8: DRD1A: *idx1 = var0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00008860 /* 00BC: DRD1A: idx2 = var12; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81988000 /* 00C0: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x10000788 /* 00C4: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 00C8: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x080c504d /* 00CC: DRD2B1: idx0 = EU1(); EU1(var1,var13) */
|
||||
.long 0x000001f8 /* 00D0(:0): NOP */
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetRecv_VarTab
|
||||
scEthernetRecv_VarTab: /* Task 0 Variable Table */
|
||||
.long 0x00000000 /* var[0] */
|
||||
.long 0x00000000 /* var[1] */
|
||||
.long 0x00000000 /* var[2] */
|
||||
.long 0x00000000 /* var[3] */
|
||||
.long 0x00000000 /* var[4] */
|
||||
.long 0x00000000 /* var[5] */
|
||||
.long 0x00000000 /* var[6] */
|
||||
.long 0x00000000 /* var[7] */
|
||||
.long 0x00000000 /* var[8] */
|
||||
.long 0xf0004800 /* var[9] */
|
||||
.long 0x00000008 /* var[10] */
|
||||
.long 0x0000000c /* var[11] */
|
||||
.long 0x80000000 /* var[12] */
|
||||
.long 0x00000000 /* var[13] */
|
||||
.long 0x10000000 /* var[14] */
|
||||
.long 0x20000000 /* var[15] */
|
||||
.long 0x000005e4 /* var[16] */
|
||||
.long 0x0000000e /* var[17] */
|
||||
.long 0x000005e0 /* var[18] */
|
||||
.long 0x00000004 /* var[19] */
|
||||
.long 0x00000000 /* var[20] */
|
||||
.long 0x00000000 /* var[21] */
|
||||
.long 0x00000000 /* var[22] */
|
||||
.long 0x00000000 /* var[23] */
|
||||
.long 0x00000000 /* inc[0] */
|
||||
.long 0x60000000 /* inc[1] */
|
||||
.long 0x20000001 /* inc[2] */
|
||||
.long 0x80000000 /* inc[3] */
|
||||
.long 0x40000000 /* inc[4] */
|
||||
.long 0x00000000 /* inc[5] */
|
||||
.long 0x00000000 /* inc[6] */
|
||||
.long 0x00000000 /* inc[7] */
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetXmit_VarTab
|
||||
scEthernetXmit_VarTab: /* Task 1 Variable Table */
|
||||
.long 0x00000000 /* var[0] */
|
||||
.long 0x00000000 /* var[1] */
|
||||
.long 0x00000000 /* var[2] */
|
||||
.long 0x00000000 /* var[3] */
|
||||
.long 0x00000000 /* var[4] */
|
||||
.long 0x00000000 /* var[5] */
|
||||
.long 0x00000000 /* var[6] */
|
||||
.long 0x00000000 /* var[7] */
|
||||
.long 0x00000000 /* var[8] */
|
||||
.long 0x00000000 /* var[9] */
|
||||
.long 0x00000000 /* var[10] */
|
||||
.long 0xf0004800 /* var[11] */
|
||||
.long 0x00000000 /* var[12] */
|
||||
.long 0x80000000 /* var[13] */
|
||||
.long 0x10000000 /* var[14] */
|
||||
.long 0x08000000 /* var[15] */
|
||||
.long 0x20000000 /* var[16] */
|
||||
.long 0x0000ffff /* var[17] */
|
||||
.long 0xffffffff /* var[18] */
|
||||
.long 0x00000008 /* var[19] */
|
||||
.long 0x00000000 /* var[20] */
|
||||
.long 0x00000000 /* var[21] */
|
||||
.long 0x00000000 /* var[22] */
|
||||
.long 0x00000000 /* var[23] */
|
||||
.long 0x00000000 /* inc[0] */
|
||||
.long 0x60000000 /* inc[1] */
|
||||
.long 0x40000000 /* inc[2] */
|
||||
.long 0x4000ffff /* inc[3] */
|
||||
.long 0xe0000001 /* inc[4] */
|
||||
.long 0x80000000 /* inc[5] */
|
||||
.long 0x00000000 /* inc[6] */
|
||||
.long 0x00000000 /* inc[7] */
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetRecv_FDT
|
||||
scEthernetRecv_FDT: /* Task 0 Function Descriptor Table */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x05800000 /* and(), EU# 1 */
|
||||
.long 0x05400000 /* andn(), EU# 1 */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetXmit_FDT
|
||||
scEthernetXmit_FDT: /* Task 1 Function Descriptor Table */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x05800000 /* and(), EU# 1 */
|
||||
.long 0x05400000 /* andn(), EU# 1 */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
|
||||
|
||||
.align 8
|
||||
.globl scEthernetRecv_CSave
|
||||
scEthernetRecv_CSave: /* Task 0 context save space */
|
||||
.space 256, 0x0
|
||||
|
||||
|
||||
.align 8
|
||||
.globl scEthernetXmit_CSave
|
||||
scEthernetXmit_CSave: /* Task 1 context save space */
|
||||
.space 256, 0x0
|
||||
|
||||
#endif /* CONFIG_MGT5100 */
|
||||
363
cpu/mpc5xxx/firmware_sc_task_bestcomm.impl.S
Normal file
363
cpu/mpc5xxx/firmware_sc_task_bestcomm.impl.S
Normal file
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* Copyright (C) 2001, Software Center, Motorola China.
|
||||
*
|
||||
* This file contains microcode for the FEC controller of the MPC5200 CPU.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
|
||||
/* sas/sccg, gas target */
|
||||
.section smartdmaInitData,"aw",@progbits /* Initialized data for task variables */
|
||||
.section smartdmaTaskTable,"aw",@progbits /* Task tables */
|
||||
.align 9
|
||||
.globl taskTable
|
||||
taskTable:
|
||||
.globl scEthernetRecv_Entry
|
||||
scEthernetRecv_Entry: /* Task 0 */
|
||||
.long scEthernetRecv_TDT - taskTable /* Task 0 Descriptor Table */
|
||||
.long scEthernetRecv_TDT - taskTable + 0x000000a4
|
||||
.long scEthernetRecv_VarTab - taskTable /* Task 0 Variable Table */
|
||||
.long scEthernetRecv_FDT - taskTable + 0x03 /* Task 0 Function Descriptor Table & Flags */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long scEthernetRecv_CSave - taskTable /* Task 0 context save space */
|
||||
.long 0xf0000000
|
||||
.globl scEthernetXmit_Entry
|
||||
scEthernetXmit_Entry: /* Task 1 */
|
||||
.long scEthernetXmit_TDT - taskTable /* Task 1 Descriptor Table */
|
||||
.long scEthernetXmit_TDT - taskTable + 0x000000d0
|
||||
.long scEthernetXmit_VarTab - taskTable /* Task 1 Variable Table */
|
||||
.long scEthernetXmit_FDT - taskTable + 0x03 /* Task 1 Function Descriptor Table & Flags */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long scEthernetXmit_CSave - taskTable /* Task 1 context save space */
|
||||
.long 0xf0000000
|
||||
|
||||
|
||||
.globl scEthernetRecv_TDT
|
||||
scEthernetRecv_TDT: /* Task 0 Descriptor Table */
|
||||
.long 0xc4c50000 /* 0000: LCDEXT: idx0 = var9 + var10; idx0 once var0; idx0 += inc0 */
|
||||
.long 0x84c5e000 /* 0004: LCD: idx1 = var9 + var11; ; idx1 += inc0 */
|
||||
.long 0x10001f08 /* 0008: DRD1A: var7 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x10000380 /* 000C: DRD1A: var0 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000f88 /* 0010: DRD1A: var3 = *idx1; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
|
||||
.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x010cf04c /* 0020: DRD2B1: var4 = EU3(); EU3(var1,var12) */
|
||||
.long 0x82180349 /* 0024: LCD: idx0 = var4; idx0 != var13; idx0 += inc1 */
|
||||
.long 0x81c68004 /* 0028: LCD: idx1 = var3 + var13 + 4; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x70000000 /* 002C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x018cf04e /* 0030: DRD2B1: var6 = EU3(); EU3(var1,var14) */
|
||||
.long 0x70000000 /* 0034: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x020cf04f /* 0038: DRD2B1: var8 = EU3(); EU3(var1,var15) */
|
||||
.long 0x00000b88 /* 003C: DRD1A: var2 = *idx1; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x8000d184 /* 0040: LCDEXT: idx1 = 0xf0003184; ; */
|
||||
.long 0xc6990452 /* 0044: LCDEXT: idx2 = var13; idx2 < var17; idx2 += inc2 */
|
||||
.long 0x81486010 /* 0048: LCD: idx3 = var2 + var16; ; idx3 += inc2 */
|
||||
.long 0x006acf88 /* 004C: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
|
||||
.long 0x8000d184 /* 0050: LCDEXT: idx1 = 0xf0003184; ; */
|
||||
.long 0x86810492 /* 0054: LCD: idx2 = var13, idx3 = var2; idx2 < var18; idx2 += inc2, idx3 += inc2 */
|
||||
.long 0x006acf88 /* 0058: DRD1A: *idx3 = *idx1; FN=0 init=3 WS=1 RS=1 */
|
||||
.long 0x8000d184 /* 005C: LCDEXT: idx1 = 0xf0003184; ; */
|
||||
.long 0x868184d2 /* 0060: LCD: idx2 = var13, idx3 = var3; idx2 < var19; idx2 += inc2, idx3 += inc2 */
|
||||
.long 0x000acf88 /* 0064: DRD1A: *idx3 = *idx1; FN=0 init=0 WS=1 RS=1 */
|
||||
.long 0xc318839b /* 0068: LCDEXT: idx1 = var6; idx1 == var14; idx1 += inc3 */
|
||||
.long 0x80190000 /* 006C: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x04008468 /* 0070: DRD1A: idx1 = var13; FN=0 INT init=0 WS=0 RS=0 */
|
||||
.long 0xc4038358 /* 0074: LCDEXT: idx1 = var8, idx2 = var7; idx1 == var13; idx1 += inc3, idx2 += inc0 */
|
||||
.long 0x81c50000 /* 0078: LCD: idx3 = var3 + var10; idx3 once var0; idx3 += inc0 */
|
||||
.long 0x1000cb18 /* 007C: DRD1A: *idx2 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000f18 /* 0080: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0xc4188364 /* 0084: LCDEXT: idx1 = var8; idx1 > var13; idx1 += inc4 */
|
||||
.long 0x83990000 /* 0088: LCD: idx2 = var7; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x10000c00 /* 008C: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x0000c800 /* 0090: DRD1A: *idx2 = var0; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81988000 /* 0094: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x10000788 /* 0098: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 009C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x080cf04c /* 00A0: DRD2B1: idx0 = EU3(); EU3(var1,var12) */
|
||||
.long 0x000001f8 /* 00A4(:0): NOP */
|
||||
|
||||
|
||||
.globl scEthernetXmit_TDT
|
||||
scEthernetXmit_TDT: /* Task 1 Descriptor Table */
|
||||
.long 0x80024800 /* 0000: LCDEXT: idx0 = 0xf0008800; ; */
|
||||
.long 0x85c60004 /* 0004: LCD: idx1 = var11 + var12 + 4; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x10002308 /* 0008: DRD1A: var8 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x10000f88 /* 000C: DRD1A: var3 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000380 /* 0010: DRD1A: var0 = *idx0; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81980000 /* 0014: LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
|
||||
.long 0x10000780 /* 0018: DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 001C: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x024cf04d /* 0020: DRD2B1: var9 = EU3(); EU3(var1,var13) */
|
||||
.long 0x84980309 /* 0024: LCD: idx0 = var9; idx0 != var12; idx0 += inc1 */
|
||||
.long 0xc0004003 /* 0028: LCDEXT: idx1 = 0x00000003; ; */
|
||||
.long 0x81c60004 /* 002C: LCD: idx2 = var3 + var12 + 4; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x70000000 /* 0030: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x010cf04e /* 0034: DRD2B1: var4 = EU3(); EU3(var1,var14) */
|
||||
.long 0x70000000 /* 0038: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x014cf04f /* 003C: DRD2B1: var5 = EU3(); EU3(var1,var15) */
|
||||
.long 0x70000000 /* 0040: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x028cf050 /* 0044: DRD2B1: var10 = EU3(); EU3(var1,var16) */
|
||||
.long 0x70000000 /* 0048: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
|
||||
.long 0x018cf051 /* 004C: DRD2B1: var6 = EU3(); EU3(var1,var17) */
|
||||
.long 0x10000b90 /* 0050: DRD1A: var2 = *idx2; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 0054: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x01ccf0a1 /* 0058: DRD2B1: var7 = EU3(); EU3(var2,idx1) */
|
||||
.long 0xc2988312 /* 005C: LCDEXT: idx1 = var5; idx1 > var12; idx1 += inc2 */
|
||||
.long 0x83490000 /* 0060: LCD: idx2 = var6 + var18; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x00001b10 /* 0064: DRD1A: var6 = idx2; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x8000d1a4 /* 0068: LCDEXT: idx1 = 0xf00031a4; ; */
|
||||
.long 0x8301031c /* 006C: LCD: idx2 = var6, idx3 = var2; idx2 > var12; idx2 += inc3, idx3 += inc4 */
|
||||
.long 0x008ac798 /* 0070: DRD1A: *idx1 = *idx3; FN=0 init=4 WS=1 RS=1 */
|
||||
.long 0x8000d1a4 /* 0074: LCDEXT: idx1 = 0xf00031a4; ; */
|
||||
.long 0xc1430000 /* 0078: LCDEXT: idx2 = var2 + var6; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x82998312 /* 007C: LCD: idx3 = var5; idx3 > var12; idx3 += inc2 */
|
||||
.long 0x088ac790 /* 0080: DRD1A: *idx1 = *idx2; FN=0 TFD init=4 WS=1 RS=1 */
|
||||
.long 0x81988000 /* 0084: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x60000001 /* 0088: DRD2A: EU0=0 EU1=0 EU2=0 EU3=1 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x0c4cfc4d /* 008C: DRD2B1: *idx1 = EU3(); EU3(*idx1,var13) */
|
||||
.long 0xc21883ad /* 0090: LCDEXT: idx1 = var4; idx1 == var14; idx1 += inc5 */
|
||||
.long 0x80190000 /* 0094: LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
|
||||
.long 0x04008460 /* 0098: DRD1A: idx1 = var12; FN=0 INT init=0 WS=0 RS=0 */
|
||||
.long 0xc4052305 /* 009C: LCDEXT: idx1 = var8, idx2 = var10; idx2 == var12; idx1 += inc0, idx2 += inc5 */
|
||||
.long 0x81c98000 /* 00A0: LCD: idx3 = var3 + var19; idx3 once var0; idx3 += inc0 */
|
||||
.long 0x1000c718 /* 00A4: DRD1A: *idx1 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00000f18 /* 00A8: DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0xc4188000 /* 00AC: LCDEXT: idx1 = var8; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x85190312 /* 00B0: LCD: idx2 = var10; idx2 > var12; idx2 += inc2 */
|
||||
.long 0x10000c00 /* 00B4: DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x1000c400 /* 00B8: DRD1A: *idx1 = var0; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x00008860 /* 00BC: DRD1A: idx2 = var12; FN=0 init=0 WS=0 RS=0 */
|
||||
.long 0x81988000 /* 00C0: LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
|
||||
.long 0x10000788 /* 00C4: DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
|
||||
.long 0x60000000 /* 00C8: DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
|
||||
.long 0x080cf04d /* 00CC: DRD2B1: idx0 = EU3(); EU3(var1,var13) */
|
||||
.long 0x000001f8 /* 00D0(:0): NOP */
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetRecv_VarTab
|
||||
scEthernetRecv_VarTab: /* Task 0 Variable Table */
|
||||
.long 0x00000000 /* var[0] */
|
||||
.long 0x00000000 /* var[1] */
|
||||
.long 0x00000000 /* var[2] */
|
||||
.long 0x00000000 /* var[3] */
|
||||
.long 0x00000000 /* var[4] */
|
||||
.long 0x00000000 /* var[5] */
|
||||
.long 0x00000000 /* var[6] */
|
||||
.long 0x00000000 /* var[7] */
|
||||
.long 0x00000000 /* var[8] */
|
||||
.long 0xf0008800 /* var[9] */
|
||||
.long 0x00000008 /* var[10] */
|
||||
.long 0x0000000c /* var[11] */
|
||||
.long 0x80000000 /* var[12] */
|
||||
.long 0x00000000 /* var[13] */
|
||||
.long 0x10000000 /* var[14] */
|
||||
.long 0x20000000 /* var[15] */
|
||||
.long 0x000005e4 /* var[16] */
|
||||
.long 0x0000000e /* var[17] */
|
||||
.long 0x000005e0 /* var[18] */
|
||||
.long 0x00000004 /* var[19] */
|
||||
.long 0x00000000 /* var[20] */
|
||||
.long 0x00000000 /* var[21] */
|
||||
.long 0x00000000 /* var[22] */
|
||||
.long 0x00000000 /* var[23] */
|
||||
.long 0x00000000 /* inc[0] */
|
||||
.long 0x60000000 /* inc[1] */
|
||||
.long 0x20000001 /* inc[2] */
|
||||
.long 0x80000000 /* inc[3] */
|
||||
.long 0x40000000 /* inc[4] */
|
||||
.long 0x00000000 /* inc[5] */
|
||||
.long 0x00000000 /* inc[6] */
|
||||
.long 0x00000000 /* inc[7] */
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetXmit_VarTab
|
||||
scEthernetXmit_VarTab: /* Task 1 Variable Table */
|
||||
.long 0x00000000 /* var[0] */
|
||||
.long 0x00000000 /* var[1] */
|
||||
.long 0x00000000 /* var[2] */
|
||||
.long 0x00000000 /* var[3] */
|
||||
.long 0x00000000 /* var[4] */
|
||||
.long 0x00000000 /* var[5] */
|
||||
.long 0x00000000 /* var[6] */
|
||||
.long 0x00000000 /* var[7] */
|
||||
.long 0x00000000 /* var[8] */
|
||||
.long 0x00000000 /* var[9] */
|
||||
.long 0x00000000 /* var[10] */
|
||||
.long 0xf0008800 /* var[11] */
|
||||
.long 0x00000000 /* var[12] */
|
||||
.long 0x80000000 /* var[13] */
|
||||
.long 0x10000000 /* var[14] */
|
||||
.long 0x08000000 /* var[15] */
|
||||
.long 0x20000000 /* var[16] */
|
||||
.long 0x0000ffff /* var[17] */
|
||||
.long 0xffffffff /* var[18] */
|
||||
.long 0x00000008 /* var[19] */
|
||||
.long 0x00000000 /* var[20] */
|
||||
.long 0x00000000 /* var[21] */
|
||||
.long 0x00000000 /* var[22] */
|
||||
.long 0x00000000 /* var[23] */
|
||||
.long 0x00000000 /* inc[0] */
|
||||
.long 0x60000000 /* inc[1] */
|
||||
.long 0x40000000 /* inc[2] */
|
||||
.long 0x4000ffff /* inc[3] */
|
||||
.long 0xe0000001 /* inc[4] */
|
||||
.long 0x80000000 /* inc[5] */
|
||||
.long 0x00000000 /* inc[6] */
|
||||
.long 0x00000000 /* inc[7] */
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetRecv_FDT
|
||||
scEthernetRecv_FDT: /* Task 0 Function Descriptor Table */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x21800000 /* and(), EU# 3 */
|
||||
.long 0x21400000 /* andn(), EU# 3 */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
|
||||
.align 8
|
||||
|
||||
.globl scEthernetXmit_FDT
|
||||
scEthernetXmit_FDT: /* Task 1 Function Descriptor Table */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x21800000 /* and(), EU# 3 */
|
||||
.long 0x21400000 /* andn(), EU# 3 */
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
.long 0x00000000
|
||||
|
||||
|
||||
.globl scEthernetRecv_CSave
|
||||
scEthernetRecv_CSave: /* Task 0 context save space */
|
||||
.space 128, 0x0
|
||||
|
||||
|
||||
.globl scEthernetXmit_CSave
|
||||
scEthernetXmit_CSave: /* Task 1 context save space */
|
||||
.space 128, 0x0
|
||||
|
||||
#endif /* CONFIG_MPC5200 */
|
||||
180
cpu/mpc5xxx/interrupts.c
Normal file
180
cpu/mpc5xxx/interrupts.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* (C) Copyright -2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2001
|
||||
* Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* interrupts.c - just enough support for the decrementer/timer
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <command.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int interrupt_init(void)
|
||||
{
|
||||
decrementer_count = get_tbclk() / CFG_HZ;
|
||||
|
||||
#ifdef DEBUG
|
||||
puts("interrupt_init: setting actual decremter\n");
|
||||
#endif
|
||||
set_dec (get_tbclk() / CFG_HZ);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("interrupt_init: enabling interrupts (msr = %08lx)\n",
|
||||
get_msr());
|
||||
#endif
|
||||
set_msr (get_msr() | MSR_EE);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("interrupt_init: done. (msr = %08lx)\n", get_msr());
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Handle external interrupts
|
||||
*/
|
||||
void
|
||||
external_interrupt(struct pt_regs *regs)
|
||||
{
|
||||
puts("external_interrupt (oops!)\n");
|
||||
}
|
||||
|
||||
volatile ulong timestamp = 0;
|
||||
|
||||
/*
|
||||
* timer_interrupt - gets called when the decrementer overflows,
|
||||
* with interrupts disabled.
|
||||
* Trivial implementation - no need to be really accurate.
|
||||
*/
|
||||
void
|
||||
timer_interrupt(struct pt_regs *regs)
|
||||
{
|
||||
set_dec(decrementer_count);
|
||||
timestamp++;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
reset_timer(void)
|
||||
{
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
ulong
|
||||
get_timer(ulong base)
|
||||
{
|
||||
return (timestamp - base);
|
||||
}
|
||||
|
||||
void
|
||||
set_timer(ulong t)
|
||||
{
|
||||
timestamp = t;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
* Install and free a interrupt handler.
|
||||
*/
|
||||
|
||||
void
|
||||
irq_install_handler(int vec, interrupt_handler_t *handler, void *arg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
irq_free_handler(int vec)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
do_irqinfo(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
|
||||
{
|
||||
puts("IRQ related functions are unimplemented currently.\n");
|
||||
}
|
||||
128
cpu/mpc5xxx/io.S
Normal file
128
cpu/mpc5xxx/io.S
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
|
||||
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
|
||||
* Copyright (C) 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Andreas Heppel <aheppel@sysgo.de>
|
||||
* 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 <ppc_asm.tmpl>
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: in8 */
|
||||
/* Description: Input 8 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl in8
|
||||
in8:
|
||||
lbz r3,0(r3)
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: in16 */
|
||||
/* Description: Input 16 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl in16
|
||||
in16:
|
||||
lhz r3,0(r3)
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: in16r */
|
||||
/* Description: Input 16 bits and byte reverse */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl in16r
|
||||
in16r:
|
||||
lhbrx r3,0,r3
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: in32 */
|
||||
/* Description: Input 32 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl in32
|
||||
in32:
|
||||
lwz 3,0(3)
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: in32r */
|
||||
/* Description: Input 32 bits and byte reverse */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl in32r
|
||||
in32r:
|
||||
lwbrx r3,0,r3
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: out8 */
|
||||
/* Description: Output 8 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl out8
|
||||
out8:
|
||||
stb r4,0(r3)
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: out16 */
|
||||
/* Description: Output 16 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl out16
|
||||
out16:
|
||||
sth r4,0(r3)
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: out16r */
|
||||
/* Description: Byte reverse and output 16 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl out16r
|
||||
out16r:
|
||||
sthbrx r4,0,r3
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: out32 */
|
||||
/* Description: Output 32 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl out32
|
||||
out32:
|
||||
stw r4,0(r3)
|
||||
sync
|
||||
blr
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
/* Function: out32r */
|
||||
/* Description: Byte reverse and output 32 bits */
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
.globl out32r
|
||||
out32r:
|
||||
stwbrx r4,0,r3
|
||||
sync
|
||||
blr
|
||||
76
cpu/mpc5xxx/loadtask.c
Normal file
76
cpu/mpc5xxx/loadtask.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* This file is based on code
|
||||
* (C) Copyright Motorola, Inc., 2000
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
|
||||
/* BestComm/SmartComm microcode */
|
||||
extern int taskTable;
|
||||
|
||||
void loadtask(int basetask, int tasks)
|
||||
{
|
||||
int *sram = (int *)MPC5XXX_SRAM;
|
||||
int *task_org = &taskTable;
|
||||
unsigned int start, offset, end;
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("basetask = %d, tasks = %d\n", basetask, tasks);
|
||||
printf("task_org = 0x%08x\n", (unsigned int)task_org);
|
||||
#endif
|
||||
|
||||
/* setup TaskBAR register */
|
||||
*(vu_long *)MPC5XXX_SDMA = MPC5XXX_SRAM;
|
||||
|
||||
/* relocate task table entries */
|
||||
offset = (unsigned int)sram;
|
||||
for (i = basetask; i < basetask + tasks; i++) {
|
||||
sram[i * 8 + 0] = task_org[i * 8 + 0] + offset;
|
||||
sram[i * 8 + 1] = task_org[i * 8 + 1] + offset;
|
||||
sram[i * 8 + 2] = task_org[i * 8 + 2] + offset;
|
||||
sram[i * 8 + 3] = task_org[i * 8 + 3] + offset;
|
||||
sram[i * 8 + 4] = task_org[i * 8 + 4];
|
||||
sram[i * 8 + 5] = task_org[i * 8 + 5];
|
||||
sram[i * 8 + 6] = task_org[i * 8 + 6] + offset;
|
||||
sram[i * 8 + 7] = task_org[i * 8 + 7];
|
||||
}
|
||||
|
||||
/* relocate task descriptors */
|
||||
start = (sram[basetask * 8] - (unsigned int)sram);
|
||||
end = (sram[(basetask + tasks - 1) * 8 + 1] - (unsigned int)sram);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("TDT start = 0x%08x, end = 0x%08x\n", start, end);
|
||||
#endif
|
||||
|
||||
start /= 4;
|
||||
end /= 4;
|
||||
for (i = start; i <= end; i++) {
|
||||
sram[i] = task_org[i];
|
||||
}
|
||||
|
||||
/* relocate variables */
|
||||
start = (sram[basetask * 8 + 2] - (unsigned int)sram);
|
||||
end = (sram[(basetask + tasks - 1) * 8 + 2] + 256 - (unsigned int)sram);
|
||||
start /= 4;
|
||||
end /= 4;
|
||||
for (i = start; i < end; i++) {
|
||||
sram[i] = task_org[i];
|
||||
}
|
||||
|
||||
/* relocate function decriptors */
|
||||
start = ((sram[basetask * 8 + 3] & 0xfffffffc) - (unsigned int)sram);
|
||||
end = ((sram[(basetask + tasks - 1) * 8 + 3] & 0xfffffffc) + 256 - (unsigned int)sram);
|
||||
start /= 4;
|
||||
end /= 4;
|
||||
for (i = start; i < end; i++) {
|
||||
sram[i] = task_org[i];
|
||||
}
|
||||
|
||||
asm volatile ("sync");
|
||||
}
|
||||
175
cpu/mpc5xxx/pci_mpc5200.c
Normal file
175
cpu/mpc5xxx/pci_mpc5200.c
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* (C) Copyright 2000-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 defined(CONFIG_PCI) && defined(CONFIG_MPC5200)
|
||||
|
||||
#include <asm/processor.h>
|
||||
#include <asm/io.h>
|
||||
#include <pci.h>
|
||||
#include <mpc5xxx.h>
|
||||
|
||||
/* System RAM mapped over PCI */
|
||||
#define CONFIG_PCI_MEMORY_BUS CFG_SDRAM_BASE
|
||||
#define CONFIG_PCI_MEMORY_PHYS CFG_SDRAM_BASE
|
||||
#define CONFIG_PCI_MEMORY_SIZE (1024 * 1024 * 1024)
|
||||
|
||||
/* PCIIWCR bit fields */
|
||||
#define IWCR_MEM (0 << 3)
|
||||
#define IWCR_IO (1 << 3)
|
||||
#define IWCR_READ (0 << 1)
|
||||
#define IWCR_READLINE (1 << 1)
|
||||
#define IWCR_READMULT (2 << 1)
|
||||
#define IWCR_EN (1 << 0)
|
||||
|
||||
static int mpc5200_read_config_dword(struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset, u32* value)
|
||||
{
|
||||
*(volatile u32 *)MPC5XXX_PCI_CAR = (1 << 31) | dev | offset;
|
||||
eieio();
|
||||
*value = in_le32((volatile u32 *)CONFIG_PCI_IO_PHYS);
|
||||
eieio();
|
||||
*(volatile u32 *)MPC5XXX_PCI_CAR = 0;
|
||||
/* skip MPC5200 */
|
||||
if (offset == 0 && *value == 0x58031057)
|
||||
*value = 0xffffffff;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mpc5200_write_config_dword(struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset, u32 value)
|
||||
{
|
||||
*(volatile u32 *)MPC5XXX_PCI_CAR = (1 << 31) | dev | offset;
|
||||
eieio();
|
||||
out_le32((volatile u32 *)CONFIG_PCI_IO_PHYS, value);
|
||||
eieio();
|
||||
*(volatile u32 *)MPC5XXX_PCI_CAR = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pci_mpc5xxx_init (struct pci_controller *hose)
|
||||
{
|
||||
hose->first_busno = 0;
|
||||
hose->last_busno = 0xff;
|
||||
|
||||
/* System space */
|
||||
pci_set_region(hose->regions + 0,
|
||||
CONFIG_PCI_MEMORY_BUS,
|
||||
CONFIG_PCI_MEMORY_PHYS,
|
||||
CONFIG_PCI_MEMORY_SIZE,
|
||||
PCI_REGION_MEM | PCI_REGION_MEMORY);
|
||||
|
||||
/* PCI memory space */
|
||||
pci_set_region(hose->regions + 1,
|
||||
CONFIG_PCI_MEM_BUS,
|
||||
CONFIG_PCI_MEM_PHYS,
|
||||
CONFIG_PCI_MEM_SIZE,
|
||||
PCI_REGION_MEM);
|
||||
|
||||
/* PCI IO space */
|
||||
pci_set_region(hose->regions + 2,
|
||||
CONFIG_PCI_IO_BUS,
|
||||
CONFIG_PCI_IO_PHYS,
|
||||
CONFIG_PCI_IO_SIZE,
|
||||
PCI_REGION_IO);
|
||||
|
||||
hose->region_count = 3;
|
||||
|
||||
pci_register_hose(hose);
|
||||
|
||||
/* GPIO Multiplexing - enable PCI */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~(1 << 15);
|
||||
|
||||
/* Set host bridge as pci master and enable memory decoding */
|
||||
*(vu_long *)MPC5XXX_PCI_CMD |=
|
||||
PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
|
||||
|
||||
/* Set maximum latency timer */
|
||||
*(vu_long *)MPC5XXX_PCI_CFG |= (0xf800);
|
||||
|
||||
/* Set cache line size */
|
||||
*(vu_long *)MPC5XXX_PCI_CFG = (*(vu_long *)MPC5XXX_PCI_CFG & ~0xff) |
|
||||
(CFG_CACHELINE_SIZE / 4);
|
||||
|
||||
/* Map MBAR to PCI space */
|
||||
*(vu_long *)MPC5XXX_PCI_BAR0 = CFG_MBAR;
|
||||
*(vu_long *)MPC5XXX_PCI_TBATR1 = CFG_MBAR | 1;
|
||||
|
||||
/* Map RAM to PCI space */
|
||||
*(vu_long *)MPC5XXX_PCI_BAR1 = CONFIG_PCI_MEMORY_BUS | (1 << 3);
|
||||
*(vu_long *)MPC5XXX_PCI_TBATR1 = CONFIG_PCI_MEMORY_PHYS | 1;
|
||||
|
||||
/* Enable snooping for RAM */
|
||||
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (1 << 15);
|
||||
*(vu_long *)(MPC5XXX_XLBARB + 0x70) = CONFIG_PCI_MEMORY_PHYS | 0x1d;
|
||||
|
||||
/* Park XLB on PCI */
|
||||
*(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~((7 << 8) | (3 << 5));
|
||||
*(vu_long *)(MPC5XXX_XLBARB + 0x40) |= (3 << 8) | (3 << 5);
|
||||
|
||||
/* Enable piplining */
|
||||
*(vu_long *)(MPC5XXX_XLBARB + 0x40) &= ~(1 << 31);
|
||||
|
||||
/* Disable interrupts from PCI controller */
|
||||
*(vu_long *)MPC5XXX_PCI_GSCR &= ~(7 << 12);
|
||||
*(vu_long *)MPC5XXX_PCI_ICR &= ~(7 << 24);
|
||||
|
||||
/* Disable initiator windows */
|
||||
*(vu_long *)MPC5XXX_PCI_IWCR = 0;
|
||||
|
||||
/* Map PCI memory to physical space */
|
||||
*(vu_long *)MPC5XXX_PCI_IW0BTAR = CONFIG_PCI_MEM_PHYS |
|
||||
(((CONFIG_PCI_MEM_SIZE - 1) >> 8) & 0x00ff0000) |
|
||||
(CONFIG_PCI_MEM_BUS >> 16);
|
||||
*(vu_long *)MPC5XXX_PCI_IWCR |= (IWCR_MEM | IWCR_READ | IWCR_EN) << 24;
|
||||
|
||||
/* Map PCI I/O to physical space */
|
||||
*(vu_long *)MPC5XXX_PCI_IW1BTAR = CONFIG_PCI_IO_PHYS |
|
||||
(((CONFIG_PCI_IO_SIZE - 1) >> 8) & 0x00ff0000) |
|
||||
(CONFIG_PCI_IO_BUS >> 16);
|
||||
*(vu_long *)MPC5XXX_PCI_IWCR |= (IWCR_IO | IWCR_READ | IWCR_EN) << 16;
|
||||
|
||||
/* Reset the PCI bus */
|
||||
*(vu_long *)MPC5XXX_PCI_GSCR |= 1;
|
||||
udelay(1000);
|
||||
*(vu_long *)MPC5XXX_PCI_GSCR &= ~1;
|
||||
udelay(1000);
|
||||
|
||||
pci_set_ops(hose,
|
||||
pci_hose_read_config_byte_via_dword,
|
||||
pci_hose_read_config_word_via_dword,
|
||||
mpc5200_read_config_dword,
|
||||
pci_hose_write_config_byte_via_dword,
|
||||
pci_hose_write_config_word_via_dword,
|
||||
mpc5200_write_config_dword);
|
||||
|
||||
udelay(1000);
|
||||
|
||||
#ifdef CONFIG_PCI_SCAN_SHOW
|
||||
printf("PCI: Bus Dev VenId DevId Class Int\n");
|
||||
#endif
|
||||
|
||||
hose->last_busno = pci_hose_scan(hose);
|
||||
}
|
||||
#endif /* CONFIG_PCI && CONFIG_MPC5200 */
|
||||
93
cpu/mpc5xxx/sdma.h
Normal file
93
cpu/mpc5xxx/sdma.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* This file is based on code
|
||||
* (C) Copyright Motorola, Inc., 2000
|
||||
*
|
||||
* odin smartdma header file
|
||||
*/
|
||||
|
||||
#ifndef __MPC5XXX_SDMA_H
|
||||
#define __MPC5XXX_SDMA_H
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
|
||||
/* Task number assignment */
|
||||
#define FEC_RECV_TASK_NO 0
|
||||
#define FEC_XMIT_TASK_NO 1
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/* Stuff for Ethernet Tx/Rx tasks */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/* Layout of Ethernet controller Parameter SRAM area:
|
||||
----------------------------------------------------------------
|
||||
0x00: TBD_BASE, base address of TX BD ring
|
||||
0x04: TBD_NEXT, address of next TX BD to be processed
|
||||
0x08: RBD_BASE, base address of RX BD ring
|
||||
0x0C: RBD_NEXT, address of next RX BD to be processed
|
||||
---------------------------------------------------------------
|
||||
ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
|
||||
*/
|
||||
|
||||
/* base address of SRAM area to store parameters used by Ethernet tasks */
|
||||
#define FEC_PARAM_BASE (MPC5XXX_SRAM + 0x0800)
|
||||
|
||||
/* base address of SRAM area for buffer descriptors */
|
||||
#define FEC_BD_BASE (MPC5XXX_SRAM + 0x0820)
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/* common shortcuts used by driver C code */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/* Disable SmartDMA task */
|
||||
#define SDMA_TASK_DISABLE(tasknum) \
|
||||
{ \
|
||||
volatile ushort *tcr = (ushort *)(MPC5XXX_SDMA + 0x0000001c + 2 * tasknum); \
|
||||
*tcr = (*tcr) & (~0x8000); \
|
||||
}
|
||||
|
||||
/* Enable SmartDMA task */
|
||||
#define SDMA_TASK_ENABLE(tasknum) \
|
||||
{ \
|
||||
volatile ushort *tcr = (ushort *) (MPC5XXX_SDMA + 0x0000001c + 2 * tasknum); \
|
||||
*tcr = (*tcr) | 0x8000; \
|
||||
}
|
||||
|
||||
/* Enable interrupt */
|
||||
#define SDMA_INT_ENABLE(tasknum) \
|
||||
{ \
|
||||
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
|
||||
sdma->IntMask &= ~(1 << tasknum); \
|
||||
}
|
||||
|
||||
/* Disable interrupt */
|
||||
#define SDMA_INT_DISABLE(tasknum) \
|
||||
{ \
|
||||
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
|
||||
sdma->IntMask |= (1 << tasknum); \
|
||||
}
|
||||
|
||||
|
||||
/* Clear interrupt pending bits */
|
||||
#define SDMA_CLEAR_IEVENT(tasknum) \
|
||||
{ \
|
||||
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
|
||||
sdma->IntPend = (1 << tasknum); \
|
||||
}
|
||||
|
||||
/* get interupt pending bit of a task */
|
||||
#define SDMA_GET_PENDINGBIT(tasknum) \
|
||||
((*(vu_long *)(MPC5XXX_SDMA + 0x14)) & (1<<(tasknum)))
|
||||
|
||||
/* get interupt mask bit of a task */
|
||||
#define SDMA_GET_MASKBIT(tasknum) \
|
||||
((*(vu_long *)(MPC5XXX_SDMA + 0x18)) & (1<<(tasknum)))
|
||||
|
||||
#endif /* __MPC5XXX_SDMA_H */
|
||||
165
cpu/mpc5xxx/serial.c
Normal file
165
cpu/mpc5xxx/serial.c
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* (C) Copyright 2000 - 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
|
||||
*
|
||||
* Hacked for MPC8260 by Murray.Jensen@cmst.csiro.au, 19-Oct-00, with
|
||||
* changes based on the file arch/ppc/mbxboot/m8260_tty.c from the
|
||||
* Linux/PPC sources (m8260_tty.c had no copyright info in it).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Minimal serial functions needed to use one of the PSC ports
|
||||
* as serial console interface.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
|
||||
#if defined(CONFIG_PSC_CONSOLE)
|
||||
|
||||
#if CONFIG_PSC_CONSOLE == 1
|
||||
#define PSC_BASE MPC5XXX_PSC1
|
||||
#elif CONFIG_PSC_CONSOLE == 2
|
||||
#define PSC_BASE MPC5XXX_PSC2
|
||||
#elif CONFIG_PSC_CONSOLE == 3
|
||||
#define PSC_BASE MPC5XXX_PSC3
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
#error CONFIG_PSC_CONSOLE must be in 1, 2 or 3
|
||||
#elif CONFIG_PSC_CONSOLE == 4
|
||||
#define PSC_BASE MPC5XXX_PSC4
|
||||
#elif CONFIG_PSC_CONSOLE == 5
|
||||
#define PSC_BASE MPC5XXX_PSC5
|
||||
#elif CONFIG_PSC_CONSOLE == 6
|
||||
#define PSC_BASE MPC5XXX_PSC6
|
||||
#else
|
||||
#error CONFIG_PSC_CONSOLE must be in 1 ... 6
|
||||
#endif
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
|
||||
unsigned long baseclk;
|
||||
int div;
|
||||
|
||||
/* reset PSC */
|
||||
psc->command = PSC_SEL_MODE_REG_1;
|
||||
|
||||
/* select clock sources */
|
||||
#if defined(CONFIG_MGT5100)
|
||||
psc->psc_clock_select = 0xdd00;
|
||||
baseclk = CFG_MPC5XXX_CLKIN / 32;
|
||||
#elif defined(CONFIG_MPC5200)
|
||||
psc->psc_clock_select = 0;
|
||||
baseclk = gd->ipb_clk / 32;
|
||||
#endif
|
||||
|
||||
/* switch to UART mode */
|
||||
psc->sicr = 0;
|
||||
|
||||
/* configure parity, bit length and so on */
|
||||
#if defined(CONFIG_MGT5100)
|
||||
psc->mode = PSC_MODE_ERR | PSC_MODE_8_BITS | PSC_MODE_PARNONE;
|
||||
#elif defined(CONFIG_MPC5200)
|
||||
psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE;
|
||||
#endif
|
||||
psc->mode = PSC_MODE_ONE_STOP;
|
||||
|
||||
/* set up UART divisor */
|
||||
div = baseclk / gd->baudrate;
|
||||
psc->ctur = div >> 8;
|
||||
psc->ctlr = div & 0xff;
|
||||
|
||||
/* disable all interrupts */
|
||||
psc->psc_imr = 0;
|
||||
|
||||
/* reset and enable Rx/Tx */
|
||||
psc->command = PSC_RST_RX;
|
||||
psc->command = PSC_RST_TX;
|
||||
psc->command = PSC_RX_ENABLE | PSC_TX_ENABLE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
serial_putc(const char c)
|
||||
{
|
||||
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
|
||||
|
||||
if (c == '\n')
|
||||
serial_putc('\r');
|
||||
|
||||
/* Wait for last character to go. */
|
||||
while (!(psc->psc_status & PSC_SR_TXEMP))
|
||||
;
|
||||
|
||||
psc->psc_buffer_8 = c;
|
||||
}
|
||||
|
||||
void
|
||||
serial_puts (const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
serial_getc(void)
|
||||
{
|
||||
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
|
||||
|
||||
/* Wait for a character to arrive. */
|
||||
while (!(psc->psc_status & PSC_SR_RXRDY))
|
||||
;
|
||||
|
||||
return psc->psc_buffer_8;
|
||||
}
|
||||
|
||||
int
|
||||
serial_tstc(void)
|
||||
{
|
||||
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
|
||||
|
||||
return (psc->psc_status & PSC_SR_RXRDY);
|
||||
}
|
||||
|
||||
void
|
||||
serial_setbrg(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
|
||||
unsigned long baseclk, div;
|
||||
|
||||
#if defined(CONFIG_MGT5100)
|
||||
baseclk = CFG_MPC5XXX_CLKIN / 32;
|
||||
#elif defined(CONFIG_MPC5200)
|
||||
baseclk = gd->ipb_clk / 32;
|
||||
#endif
|
||||
|
||||
/* set up UART divisor */
|
||||
div = baseclk / gd->baudrate;
|
||||
psc->ctur = div >> 8;
|
||||
psc->ctlr = div & 0xff;
|
||||
}
|
||||
#endif /* CONFIG_PSC_CONSOLE */
|
||||
93
cpu/mpc5xxx/speed.c
Normal file
93
cpu/mpc5xxx/speed.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* (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 <common.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Bus-to-Core Multipliers */
|
||||
|
||||
static int bus2core[] = {
|
||||
0, 0, 0, 10, 20, 20, 25, 45,
|
||||
30, 55, 40, 50, 0, 60, 35, 0,
|
||||
30, 25, 65, 10, 70, 20, 75, 45,
|
||||
0, 55, 40, 50, 80, 60, 35, 0
|
||||
};
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
int get_clocks (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
ulong val, vco;
|
||||
|
||||
#if !defined(CFG_MPC5XXX_CLKIN)
|
||||
#error clock measuring not implemented yet - define CFG_MPC5XXX_CLKIN
|
||||
#endif
|
||||
|
||||
val = *(vu_long *)MPC5XXX_CDM_PORCFG;
|
||||
if (val & (1 << 6)) {
|
||||
vco = CFG_MPC5XXX_CLKIN * 12;
|
||||
} else {
|
||||
vco = CFG_MPC5XXX_CLKIN * 16;
|
||||
}
|
||||
if (val & (1 << 5)) {
|
||||
gd->bus_clk = vco / 8;
|
||||
} else {
|
||||
gd->bus_clk = vco / 4;
|
||||
}
|
||||
gd->cpu_clk = gd->bus_clk * bus2core[val & 0x1f] / 10;
|
||||
|
||||
val = *(vu_long *)MPC5XXX_CDM_CFG;
|
||||
if (val & (1 << 8)) {
|
||||
gd->ipb_clk = gd->bus_clk / 2;
|
||||
} else {
|
||||
gd->ipb_clk = gd->bus_clk;
|
||||
}
|
||||
switch (val & 3) {
|
||||
case 0: gd->pci_clk = gd->ipb_clk; break;
|
||||
case 1: gd->pci_clk = gd->ipb_clk / 2; break;
|
||||
default: gd->pci_clk = gd->bus_clk / 4; break;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int prt_mpc5xxx_clks (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
printf(" Bus %ld MHz, IPB %ld MHz, PCI %ld MHz\n",
|
||||
gd->bus_clk / 1000000, gd->ipb_clk / 1000000,
|
||||
gd->pci_clk / 1000000);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
749
cpu/mpc5xxx/start.S
Normal file
749
cpu/mpc5xxx/start.S
Normal file
@@ -0,0 +1,749 @@
|
||||
/*
|
||||
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
|
||||
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
|
||||
* Copyright (C) 2000 - 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* U-Boot - Startup Code for MPC5xxx CPUs
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <mpc5xxx.h>
|
||||
#include <version.h>
|
||||
|
||||
#define CONFIG_MPC5XXX 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 <asm/cache.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
#ifndef CONFIG_IDENT_STRING
|
||||
#define CONFIG_IDENT_STRING ""
|
||||
#endif
|
||||
|
||||
/* We don't want the MMU yet.
|
||||
*/
|
||||
#undef MSR_KERNEL
|
||||
/* Floating Point enable, Machine Check and Recoverable Interr. */
|
||||
#ifdef DEBUG
|
||||
#define MSR_KERNEL (MSR_FP|MSR_RI)
|
||||
#else
|
||||
#define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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(__init_end)
|
||||
GOT_ENTRY(_end)
|
||||
GOT_ENTRY(__bss_start)
|
||||
END_GOT
|
||||
|
||||
/*
|
||||
* Version string
|
||||
*/
|
||||
.data
|
||||
.globl version_string
|
||||
version_string:
|
||||
.ascii U_BOOT_VERSION
|
||||
.ascii " (", __DATE__, " - ", __TIME__, ")"
|
||||
.ascii CONFIG_IDENT_STRING, "\0"
|
||||
|
||||
/*
|
||||
* Exception vectors
|
||||
*/
|
||||
.text
|
||||
. = EXC_OFF_SYS_RESET
|
||||
.globl _start
|
||||
_start:
|
||||
li r21, BOOTFLAG_COLD /* Normal Power-On */
|
||||
nop
|
||||
b boot_cold
|
||||
|
||||
. = EXC_OFF_SYS_RESET + 0x10
|
||||
|
||||
.globl _start_warm
|
||||
_start_warm:
|
||||
li r21, BOOTFLAG_WARM /* Software reboot */
|
||||
b boot_warm
|
||||
|
||||
boot_cold:
|
||||
boot_warm:
|
||||
mfmsr r5 /* save msr contents */
|
||||
|
||||
#if defined(CFG_DEFAULT_MBAR)
|
||||
lis r3, CFG_MBAR@h
|
||||
ori r3, r3, CFG_MBAR@l
|
||||
#if defined(CONFIG_MPC5200)
|
||||
rlwinm r3, r3, 16, 16, 31
|
||||
#endif
|
||||
#if defined(CONFIG_MGT5100)
|
||||
rlwinm r3, r3, 17, 15, 31
|
||||
#endif
|
||||
lis r4, CFG_DEFAULT_MBAR@h
|
||||
stw r3, 0(r4)
|
||||
#endif /* CFG_DEFAULT_MBAR */
|
||||
|
||||
/* Initialise the MPC5xxx processor core */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
bl init_5xxx_core
|
||||
|
||||
/* initialize some things that are hard to access from C */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
/* set up stack in on-chip SRAM */
|
||||
lis r3, CFG_INIT_RAM_ADDR@h
|
||||
ori r3, r3, CFG_INIT_RAM_ADDR@l
|
||||
ori r1, r3, CFG_INIT_SP_OFFSET
|
||||
li r0, 0 /* Make room for stack frame header and */
|
||||
stwu r0, -4(r1) /* clear final stack frame so that */
|
||||
stwu r0, -4(r1) /* stack backtraces terminate cleanly */
|
||||
|
||||
/* 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 (in Flash)*/
|
||||
|
||||
mr r3, r21
|
||||
/* r3: BOOTFLAG */
|
||||
bl board_init_f /* run 1st part of board init code (in Flash)*/
|
||||
|
||||
/*
|
||||
* Vector Table
|
||||
*/
|
||||
|
||||
.globl _start_of_vectors
|
||||
_start_of_vectors:
|
||||
|
||||
/* Machine check */
|
||||
STD_EXCEPTION(0x200, MachineCheck, MachineCheckException)
|
||||
|
||||
/* Data Storage exception. */
|
||||
STD_EXCEPTION(0x300, DataStorage, UnknownException)
|
||||
|
||||
/* Instruction Storage exception. */
|
||||
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 */
|
||||
rlwimi r20,r23,0,25,25 /* copy IP 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 */
|
||||
rlwimi r20,r23,0,25,25 /* copy IP 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
|
||||
|
||||
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)
|
||||
STD_EXCEPTION(0xc00, SystemCall, UnknownException)
|
||||
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
|
||||
STD_EXCEPTION(0xf00, Trap_0f, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0x1000, InstructionTLBMiss, UnknownException)
|
||||
STD_EXCEPTION(0x1100, DataLoadTLBMiss, UnknownException)
|
||||
STD_EXCEPTION(0x1200, DataStoreTLBMiss, UnknownException)
|
||||
#ifdef DEBUG
|
||||
. = 0x1300
|
||||
/*
|
||||
* This exception occurs when the program counter matches the
|
||||
* Instruction Address Breakpoint Register (IABR).
|
||||
*
|
||||
* I want the cpu to halt if this occurs so I can hunt around
|
||||
* with the debugger and look at things.
|
||||
*
|
||||
* When DEBUG is defined, both machine check enable (in the MSR)
|
||||
* and checkstop reset enable (in the reset mode register) are
|
||||
* turned off and so a checkstop condition will result in the cpu
|
||||
* halting.
|
||||
*
|
||||
* I force the cpu into a checkstop condition by putting an illegal
|
||||
* instruction here (at least this is the theory).
|
||||
*
|
||||
* well - that didnt work, so just do an infinite loop!
|
||||
*/
|
||||
1: b 1b
|
||||
#else
|
||||
STD_EXCEPTION(0x1300, InstructionBreakpoint, DebugException)
|
||||
#endif
|
||||
STD_EXCEPTION(0x1400, SMI, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0x1500, Trap_15, UnknownException)
|
||||
STD_EXCEPTION(0x1600, Trap_16, UnknownException)
|
||||
STD_EXCEPTION(0x1700, Trap_17, UnknownException)
|
||||
STD_EXCEPTION(0x1800, Trap_18, UnknownException)
|
||||
STD_EXCEPTION(0x1900, Trap_19, UnknownException)
|
||||
STD_EXCEPTION(0x1a00, Trap_1a, UnknownException)
|
||||
STD_EXCEPTION(0x1b00, Trap_1b, UnknownException)
|
||||
STD_EXCEPTION(0x1c00, Trap_1c, UnknownException)
|
||||
STD_EXCEPTION(0x1d00, Trap_1d, UnknownException)
|
||||
STD_EXCEPTION(0x1e00, Trap_1e, UnknownException)
|
||||
STD_EXCEPTION(0x1f00, Trap_1f, UnknownException)
|
||||
STD_EXCEPTION(0x2000, Trap_20, UnknownException)
|
||||
STD_EXCEPTION(0x2100, Trap_21, UnknownException)
|
||||
STD_EXCEPTION(0x2200, Trap_22, UnknownException)
|
||||
STD_EXCEPTION(0x2300, Trap_23, UnknownException)
|
||||
STD_EXCEPTION(0x2400, Trap_24, UnknownException)
|
||||
STD_EXCEPTION(0x2500, Trap_25, UnknownException)
|
||||
STD_EXCEPTION(0x2600, Trap_26, UnknownException)
|
||||
STD_EXCEPTION(0x2700, Trap_27, UnknownException)
|
||||
STD_EXCEPTION(0x2800, Trap_28, UnknownException)
|
||||
STD_EXCEPTION(0x2900, Trap_29, UnknownException)
|
||||
STD_EXCEPTION(0x2a00, Trap_2a, UnknownException)
|
||||
STD_EXCEPTION(0x2b00, Trap_2b, UnknownException)
|
||||
STD_EXCEPTION(0x2c00, Trap_2c, UnknownException)
|
||||
STD_EXCEPTION(0x2d00, Trap_2d, UnknownException)
|
||||
STD_EXCEPTION(0x2e00, Trap_2e, UnknownException)
|
||||
STD_EXCEPTION(0x2f00, Trap_2f, UnknownException)
|
||||
|
||||
|
||||
.globl _end_of_vectors
|
||||
_end_of_vectors:
|
||||
|
||||
. = 0x3000
|
||||
|
||||
/*
|
||||
* 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)
|
||||
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
|
||||
|
||||
/*
|
||||
* This code initialises the MPC5xxx processor core
|
||||
* (conforms to PowerPC 603e spec)
|
||||
* Note: expects original MSR contents to be in r5.
|
||||
*/
|
||||
|
||||
.globl init_5xx_core
|
||||
init_5xxx_core:
|
||||
|
||||
/* Initialize machine status; enable machine check interrupt */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
li r3, MSR_KERNEL /* Set ME and RI flags */
|
||||
rlwimi r3, r5, 0, 25, 25 /* preserve IP bit set by HRCW */
|
||||
#ifdef DEBUG
|
||||
rlwimi r3, r5, 0, 21, 22 /* debugger might set SE & BE bits */
|
||||
#endif
|
||||
SYNC /* Some chip revs need this... */
|
||||
mtmsr r3
|
||||
SYNC
|
||||
mtspr SRR1, r3 /* Make SRR1 match MSR */
|
||||
|
||||
/* Initialize the Hardware Implementation-dependent Registers */
|
||||
/* HID0 also contains cache control */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
lis r3, CFG_HID0_INIT@h
|
||||
ori r3, r3, CFG_HID0_INIT@l
|
||||
SYNC
|
||||
mtspr HID0, r3
|
||||
|
||||
lis r3, CFG_HID0_FINAL@h
|
||||
ori r3, r3, CFG_HID0_FINAL@l
|
||||
SYNC
|
||||
mtspr HID0, r3
|
||||
|
||||
/* clear all BAT's */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
li r0, 0
|
||||
mtspr DBAT0U, r0
|
||||
mtspr DBAT0L, r0
|
||||
mtspr DBAT1U, r0
|
||||
mtspr DBAT1L, r0
|
||||
mtspr DBAT2U, r0
|
||||
mtspr DBAT2L, r0
|
||||
mtspr DBAT3U, r0
|
||||
mtspr DBAT3L, r0
|
||||
mtspr IBAT0U, r0
|
||||
mtspr IBAT0L, r0
|
||||
mtspr IBAT1U, r0
|
||||
mtspr IBAT1L, r0
|
||||
mtspr IBAT2U, r0
|
||||
mtspr IBAT2L, r0
|
||||
mtspr IBAT3U, r0
|
||||
mtspr IBAT3L, r0
|
||||
SYNC
|
||||
|
||||
/* invalidate all tlb's */
|
||||
/* */
|
||||
/* From the 603e User Manual: "The 603e provides the ability to */
|
||||
/* invalidate a TLB entry. The TLB Invalidate Entry (tlbie) */
|
||||
/* instruction invalidates the TLB entry indexed by the EA, and */
|
||||
/* operates on both the instruction and data TLBs simultaneously*/
|
||||
/* invalidating four TLB entries (both sets in each TLB). The */
|
||||
/* index corresponds to bits 15-19 of the EA. To invalidate all */
|
||||
/* entries within both TLBs, 32 tlbie instructions should be */
|
||||
/* issued, incrementing this field by one each time." */
|
||||
/* */
|
||||
/* "Note that the tlbia instruction is not implemented on the */
|
||||
/* 603e." */
|
||||
/* */
|
||||
/* bits 15-19 correspond to addresses 0x00000000 to 0x0001F000 */
|
||||
/* incrementing by 0x1000 each time. The code below is sort of */
|
||||
/* based on code in "flush_tlbs" from arch/ppc/kernel/head.S */
|
||||
/* */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
li r3, 32
|
||||
mtctr r3
|
||||
li r3, 0
|
||||
1: tlbie r3
|
||||
addi r3, r3, 0x1000
|
||||
bdnz 1b
|
||||
SYNC
|
||||
|
||||
/* Done! */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
blr
|
||||
|
||||
/* Cache functions.
|
||||
*
|
||||
* Note: requires that all cache bits in
|
||||
* HID0 are in the low half word.
|
||||
*/
|
||||
.globl icache_enable
|
||||
icache_enable:
|
||||
mfspr r3, HID0
|
||||
ori r3, r3, HID0_ICE
|
||||
lis r4, 0
|
||||
ori r4, r4, HID0_ILOCK
|
||||
andc r3, r3, r4
|
||||
ori r4, r3, HID0_ICFI
|
||||
isync
|
||||
mtspr HID0, r4 /* sets enable and invalidate, clears lock */
|
||||
isync
|
||||
mtspr HID0, r3 /* clears invalidate */
|
||||
blr
|
||||
|
||||
.globl icache_disable
|
||||
icache_disable:
|
||||
mfspr r3, HID0
|
||||
lis r4, 0
|
||||
ori r4, r4, HID0_ICE|HID0_ILOCK
|
||||
andc r3, r3, r4
|
||||
ori r4, r3, HID0_ICFI
|
||||
isync
|
||||
mtspr HID0, r4 /* sets invalidate, clears enable and lock */
|
||||
isync
|
||||
mtspr HID0, r3 /* clears invalidate */
|
||||
blr
|
||||
|
||||
.globl icache_status
|
||||
icache_status:
|
||||
mfspr r3, HID0
|
||||
rlwinm r3, r3, HID0_ICE_BITPOS + 1, 31, 31
|
||||
blr
|
||||
|
||||
.globl dcache_enable
|
||||
dcache_enable:
|
||||
mfspr r3, HID0
|
||||
ori r3, r3, HID0_DCE
|
||||
lis r4, 0
|
||||
ori r4, r4, HID0_DLOCK
|
||||
andc r3, r3, r4
|
||||
ori r4, r3, HID0_DCI
|
||||
sync
|
||||
mtspr HID0, r4 /* sets enable and invalidate, clears lock */
|
||||
sync
|
||||
mtspr HID0, r3 /* clears invalidate */
|
||||
blr
|
||||
|
||||
.globl dcache_disable
|
||||
dcache_disable:
|
||||
mfspr r3, HID0
|
||||
lis r4, 0
|
||||
ori r4, r4, HID0_DCE|HID0_DLOCK
|
||||
andc r3, r3, r4
|
||||
ori r4, r3, HID0_DCI
|
||||
sync
|
||||
mtspr HID0, r4 /* sets invalidate, clears enable and lock */
|
||||
sync
|
||||
mtspr HID0, r3 /* clears invalidate */
|
||||
blr
|
||||
|
||||
.globl dcache_status
|
||||
dcache_status:
|
||||
mfspr r3, HID0
|
||||
rlwinm r3, r3, HID0_DCE_BITPOS + 1, 31, 31
|
||||
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 */
|
||||
mr r9, r4 /* Save copy of Global Data pointer */
|
||||
mr r10, r5 /* Save copy of Destination Address */
|
||||
|
||||
mr r3, r5 /* Destination Address */
|
||||
lis r4, CFG_MONITOR_BASE@h /* Source Address */
|
||||
ori r4, r4, CFG_MONITOR_BASE@l
|
||||
lwz r5, GOT(__init_end)
|
||||
sub r5, r5, r4
|
||||
li r6, CFG_CACHELINE_SIZE /* Cache Line Size */
|
||||
|
||||
/*
|
||||
* 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
|
||||
/* then 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 7f /* 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
|
||||
|
||||
/*
|
||||
* Now flush the cache: note that we must start from a cache aligned
|
||||
* address. Otherwise we might miss one cache line.
|
||||
*/
|
||||
4: cmpwi r6,0
|
||||
add r5,r3,r5
|
||||
beq 7f /* Always flush prefetch queue in any case */
|
||||
subi r0,r6,1
|
||||
andc r3,r3,r0
|
||||
mfspr r7,HID0 /* don't do dcbst if dcache is disabled */
|
||||
rlwinm r7,r7,HID0_DCE_BITPOS+1,31,31
|
||||
cmpwi r7,0
|
||||
beq 9f
|
||||
mr r4,r3
|
||||
5: dcbst 0,r4
|
||||
add r4,r4,r6
|
||||
cmplw r4,r5
|
||||
blt 5b
|
||||
sync /* Wait for all dcbst to complete on bus */
|
||||
9: mfspr r7,HID0 /* don't do icbi if icache is disabled */
|
||||
rlwinm r7,r7,HID0_ICE_BITPOS+1,31,31
|
||||
cmpwi r7,0
|
||||
beq 7f
|
||||
mr r4,r3
|
||||
6: icbi 0,r4
|
||||
add r4,r4,r6
|
||||
cmplw r4,r5
|
||||
blt 6b
|
||||
7: sync /* Wait for all icbi to complete on bus */
|
||||
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_start)
|
||||
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
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
li r9, 0x100 /* reset vector always at 0x100 */
|
||||
|
||||
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
|
||||
|
||||
mfmsr r3 /* now that the vectors have */
|
||||
lis r7, MSR_IP@h /* relocated into low memory */
|
||||
ori r7, r7, MSR_IP@l /* MSR[IP] can be turned off */
|
||||
andc r3, r3, r7 /* (if it was on) */
|
||||
SYNC /* Some chip revs need this... */
|
||||
mtmsr r3
|
||||
SYNC
|
||||
|
||||
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)
|
||||
|
||||
blr
|
||||
246
cpu/mpc5xxx/traps.c
Normal file
246
cpu/mpc5xxx/traps.c
Normal file
@@ -0,0 +1,246 @@
|
||||
/*
|
||||
* 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-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
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
/* 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 0x02000000
|
||||
|
||||
/*
|
||||
* Trap & Exception support
|
||||
*/
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 - probably due to mm fault\n"
|
||||
"with mmu off\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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BEDBUG)
|
||||
extern void do_bedbug_breakpoint(struct pt_regs *);
|
||||
#endif
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
/* Probe an address by reading. If not present, return -1, otherwise
|
||||
* return 0.
|
||||
*/
|
||||
int
|
||||
addr_probe(uint *addr)
|
||||
{
|
||||
#if 0
|
||||
int retval;
|
||||
|
||||
__asm__ __volatile__( \
|
||||
"1: lwz %0,0(%1)\n" \
|
||||
" eieio\n" \
|
||||
" li %0,0\n" \
|
||||
"2:\n" \
|
||||
".section .fixup,\"ax\"\n" \
|
||||
"3: li %0,-1\n" \
|
||||
" b 2b\n" \
|
||||
".section __ex_table,\"a\"\n" \
|
||||
" .align 2\n" \
|
||||
" .long 1b,3b\n" \
|
||||
".text" \
|
||||
: "=r" (retval) : "r"(addr));
|
||||
|
||||
return (retval);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -1197,13 +1197,16 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
|
||||
uchar *p;
|
||||
int i;
|
||||
|
||||
p = dummy_buffer;
|
||||
/* fill in address in big endian order */
|
||||
for (i=0; i<alen; ++i)
|
||||
*p++ = (addr >> (i * 8)) & 0xFF;
|
||||
for (i=alen-1; i>=0; --i) {
|
||||
buffer[i] = addr & 0xFF;
|
||||
addr >>= 8;
|
||||
}
|
||||
/* fill in data */
|
||||
p = dummy_buffer + alen;
|
||||
|
||||
for (i=0; i<len; ++i)
|
||||
*p++ = *buffer;
|
||||
*p++ = *buffer++;
|
||||
|
||||
status = I2C_do_buffer (0, I2C_MASTER_XMIT, chip, alen + len,
|
||||
dummy_buffer, I2C_STOP, 1, I2C_NO_RESTART);
|
||||
|
||||
@@ -259,74 +259,7 @@ ProgramCheck:
|
||||
STD_EXCEPTION(EXC_OFF_DECR, 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(0xc00, SystemCall, UnknownException)
|
||||
|
||||
STD_EXCEPTION(EXC_OFF_TRACE, SingleStep, UnknownException)
|
||||
|
||||
|
||||
@@ -208,3 +208,27 @@ ulong post_word_load (void)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
|
||||
|
||||
#ifdef CONFIG_BOOTCOUNT_LIMIT
|
||||
|
||||
void bootcount_store (ulong a)
|
||||
{
|
||||
volatile ulong *save_addr =
|
||||
(volatile ulong *)(CFG_IMMR + CPM_BOOTCOUNT_ADDR);
|
||||
|
||||
save_addr[0] = a;
|
||||
save_addr[1] = BOOTCOUNT_MAGIC;
|
||||
}
|
||||
|
||||
ulong bootcount_load (void)
|
||||
{
|
||||
volatile ulong *save_addr =
|
||||
(volatile ulong *)(CFG_IMMR + CPM_BOOTCOUNT_ADDR);
|
||||
|
||||
if (save_addr[1] != BOOTCOUNT_MAGIC)
|
||||
return 0;
|
||||
else
|
||||
return save_addr[0];
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
||||
|
||||
@@ -319,75 +319,7 @@ ProgramCheck:
|
||||
|
||||
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(0xc00, SystemCall, UnknownException)
|
||||
STD_EXCEPTION(0xd00, SingleStep, UnknownException)
|
||||
|
||||
STD_EXCEPTION(0xe00, Trap_0e, UnknownException)
|
||||
|
||||
@@ -110,3 +110,29 @@ ulong post_word_load (void)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
|
||||
|
||||
#ifdef CONFIG_BOOTCOUNT_LIMIT
|
||||
|
||||
void bootcount_store (ulong a)
|
||||
{
|
||||
volatile ulong *save_addr =
|
||||
(volatile ulong *)( ((immap_t *) CFG_IMMR)->im_cpm.cp_dpmem +
|
||||
CPM_BOOTCOUNT_ADDR );
|
||||
|
||||
save_addr[0] = a;
|
||||
save_addr[1] = BOOTCOUNT_MAGIC;
|
||||
}
|
||||
|
||||
ulong bootcount_load (void)
|
||||
{
|
||||
volatile ulong *save_addr =
|
||||
(volatile ulong *)( ((immap_t *) CFG_IMMR)->im_cpm.cp_dpmem +
|
||||
CPM_BOOTCOUNT_ADDR );
|
||||
|
||||
if (save_addr[1] != BOOTCOUNT_MAGIC)
|
||||
return 0;
|
||||
else
|
||||
return save_addr[0];
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
||||
|
||||
@@ -42,12 +42,23 @@
|
||||
static char *cpu_warning = "\n " \
|
||||
"*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";
|
||||
|
||||
#if ((defined(CONFIG_MPC860) || defined(CONFIG_MPC855)) && \
|
||||
#if ((defined(CONFIG_MPC86x) || defined(CONFIG_MPC855)) && \
|
||||
!defined(CONFIG_MPC862))
|
||||
# ifdef CONFIG_MPC855
|
||||
|
||||
# if defined(CONFIG_MPC855)
|
||||
# define ID_STR "PC855"
|
||||
# elif defined(CONFIG_MPC852T)
|
||||
# define ID_STR "PC852T"
|
||||
# elif defined(CONFIG_MPC859T)
|
||||
# define ID_STR "PC859T"
|
||||
# elif defined(CONFIG_MPC859DSL)
|
||||
# define ID_STR "PC859DSL"
|
||||
# elif defined(CONFIG_MPC860P)
|
||||
# define ID_STR "PC860P"
|
||||
# elif defined(CONFIG_MPC866T)
|
||||
# define ID_STR "PC866T"
|
||||
# else
|
||||
# define ID_STR "PC860"
|
||||
# define ID_STR "PC86x" /* unknown 86x chip */
|
||||
# endif
|
||||
|
||||
static int check_CPU (long clock, uint pvr, uint immr)
|
||||
@@ -68,6 +79,10 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||
m = 0;
|
||||
|
||||
switch (k) {
|
||||
#ifdef CONFIG_MPC866_et_al
|
||||
/* MPC866P/MPC866T/MPC859T/MPC859DSL/MPC852T */
|
||||
case 0x08000003: pre = 'M'; suf = ""; m = 1; break;
|
||||
#else
|
||||
case 0x00020001: pre = 'p'; suf = ""; break;
|
||||
case 0x00030001: suf = ""; break;
|
||||
case 0x00120003: suf = "A"; break;
|
||||
@@ -76,17 +91,16 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||
case 0x00200004: suf = "B"; break;
|
||||
|
||||
case 0x00300004: suf = "C"; break;
|
||||
case 0x00310004: suf = "C1"; m = 1;
|
||||
break;
|
||||
case 0x00310004: suf = "C1"; m = 1; break;
|
||||
|
||||
case 0x00200064: mid = "SR"; suf = "B"; break;
|
||||
case 0x00300065: mid = "SR"; suf = "C"; break;
|
||||
case 0x00310065: mid = "SR"; suf = "C1"; m = 1; break;
|
||||
case 0x05010000: suf = "D3"; m = 1; break;
|
||||
case 0x05020000: suf = "D4"; m = 1; break;
|
||||
|
||||
/* this value is not documented anywhere */
|
||||
case 0x40000000: pre = 'P'; suf = "D"; m = 1; break;
|
||||
#endif
|
||||
|
||||
default: suf = NULL; break;
|
||||
}
|
||||
@@ -101,7 +115,7 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||
printf (" %u kB I-Cache", checkicache () >> 10);
|
||||
printf (" %u kB D-Cache", checkdcache () >> 10);
|
||||
|
||||
/* lets check and see if we're running on a 860T (or P?) */
|
||||
/* do we have a FEC (860T/P or 852/859/866)? */
|
||||
|
||||
immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
|
||||
if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
|
||||
@@ -114,6 +128,12 @@ static int check_CPU (long clock, uint pvr, uint immr)
|
||||
|
||||
putc ('\n');
|
||||
|
||||
#ifdef DEBUG
|
||||
if(clock != measure_gclk()) {
|
||||
printf ("clock %ldHz != %dHz\n", clock, measure_gclk());
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -316,7 +336,7 @@ int checkicache (void)
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
u32 cacheon = rd_ic_cst () & IDC_ENABLED;
|
||||
|
||||
#ifdef CONFIG_IP860
|
||||
#ifdef CONFIG_IP86x
|
||||
u32 k = memctl->memc_br1 & ~0x00007fff; /* probe in flash memoryarea */
|
||||
#else
|
||||
u32 k = memctl->memc_br0 & ~0x00007fff; /* probe in flash memoryarea */
|
||||
@@ -363,7 +383,7 @@ int checkdcache (void)
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
u32 cacheon = rd_dc_cst () & IDC_ENABLED;
|
||||
|
||||
#ifdef CONFIG_IP860
|
||||
#ifdef CONFIG_IP86x
|
||||
u32 k = memctl->memc_br1 & ~0x00007fff; /* probe in flash memoryarea */
|
||||
#else
|
||||
u32 k = memctl->memc_br0 & ~0x00007fff; /* probe in flash memoryarea */
|
||||
@@ -462,8 +482,20 @@ unsigned long get_tbclk (void)
|
||||
if (immr->im_clkrst.car_sccr & SCCR_TBS) {
|
||||
return (gd->cpu_clk / 16);
|
||||
}
|
||||
#define PLPRCR_val(a) (((CFG_PLPRCR) & PLPRCR_ ## a ## _MSK) >> PLPRCR_ ## a ## _SHIFT)
|
||||
#ifdef CONFIG_MPC866_et_al
|
||||
/* MFN
|
||||
MFI + -------
|
||||
MFD + 1
|
||||
factor = -----------------
|
||||
(PDF + 1) * 2^S
|
||||
*/
|
||||
|
||||
factor = (((CFG_PLPRCR) & PLPRCR_MF_MSK) >> PLPRCR_MF_SHIFT) + 1;
|
||||
factor = (PLPRCR_val(MFI) + PLPRCR_val(MFN)/(PLPRCR_val(MFD)+1))/
|
||||
(PLPRCR_val(PDF)+1) / (1<<PLPRCR_val(S));
|
||||
#else
|
||||
factor = PLPRCR_val(MF)+1;
|
||||
#endif
|
||||
|
||||
oscclk = gd->cpu_clk / factor;
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ void cpu_init_f (volatile immap_t * immr)
|
||||
defined(CONFIG_RPXCLASSIC) || \
|
||||
defined(CONFIG_RPXLITE) || \
|
||||
defined(CONFIG_SPD823TS) || \
|
||||
defined(CONFIG_MPC86xADS) || \
|
||||
(defined(CONFIG_MPC860T) && defined(CONFIG_FADS))
|
||||
|
||||
memctl->memc_br0 = CFG_BR0_PRELIM;
|
||||
|
||||
@@ -217,7 +217,8 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile fec_t *fecp = &(immr->im_cpm.cp_fec);
|
||||
|
||||
#if defined(CONFIG_FADS) && defined(CONFIG_MPC860T)
|
||||
#if defined(CONFIG_FADS) && \
|
||||
( defined(CONFIG_MPC860T) || defined(CONFIG_MPC866_et_al) )
|
||||
/* configure FADS for fast (FEC) ethernet, half-duplex */
|
||||
/* The LXT970 needs about 50ms to recover from reset, so
|
||||
* wait for it by discovering the PHY before leaving eth_init().
|
||||
|
||||
@@ -334,7 +334,11 @@ void timer_interrupt (struct pt_regs *regs)
|
||||
/* Reset Timer Expired and Timers Interrupt Status */
|
||||
immr->im_clkrstk.cark_plprcrk = KAPWR_KEY;
|
||||
__asm__ ("nop");
|
||||
#ifdef CONFIG_MPC866_et_al
|
||||
immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS;
|
||||
#else
|
||||
immr->im_clkrst.car_plprcr |= PLPRCR_TEXPS | PLPRCR_TMIST;
|
||||
#endif
|
||||
/* Restore Decrementer Count */
|
||||
set_dec (decrementer_count);
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@
|
||||
/* ** BITMAP DISPLAY SUPPORT -- should probably be moved elsewhere */
|
||||
/************************************************************************/
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BMP)
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
|
||||
#include <bmp_layout.h>
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
|
||||
|
||||
/************************************************************************/
|
||||
/* ** FONT AND LOGO DATA */
|
||||
@@ -1044,11 +1044,25 @@ static void lcd_enable (void)
|
||||
#if defined(CONFIG_R360MPI)
|
||||
{
|
||||
extern void r360_i2c_lcd_write (uchar data0, uchar data1);
|
||||
unsigned long bgi, ctr;
|
||||
char *p;
|
||||
|
||||
if ((p = getenv("lcdbgi")) != NULL) {
|
||||
bgi = simple_strtoul (p, 0, 10) & 0xFFF;
|
||||
} else {
|
||||
bgi = 0xFFF;
|
||||
}
|
||||
|
||||
if ((p = getenv("lcdctr")) != NULL) {
|
||||
ctr = simple_strtoul (p, 0, 10) & 0xFFF;
|
||||
} else {
|
||||
ctr=0x7FF;
|
||||
}
|
||||
|
||||
r360_i2c_lcd_write(0x10, 0x01);
|
||||
r360_i2c_lcd_write(0x20, 0x01);
|
||||
r360_i2c_lcd_write(0x3F, 0xFF);
|
||||
r360_i2c_lcd_write(0x47, 0xFF);
|
||||
r360_i2c_lcd_write(0x30 | ((bgi>>8) & 0xF), bgi & 0xFF);
|
||||
r360_i2c_lcd_write(0x40 | ((ctr>>8) & 0xF), ctr & 0xFF);
|
||||
}
|
||||
#endif /* CONFIG_R360MPI */
|
||||
#ifdef CONFIG_RBC823
|
||||
@@ -1162,7 +1176,7 @@ static void bitmap_plot (int x, int y)
|
||||
}
|
||||
#endif /* CONFIG_LCD_LOGO */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BMP)
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
|
||||
/*
|
||||
* Display the BMP file located at address bmp_image.
|
||||
* Only uncompressed
|
||||
@@ -1259,7 +1273,7 @@ int lcd_display_bitmap(ulong bmp_image)
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -192,9 +192,9 @@ static int scc_init(struct eth_device* dev, bd_t *bis)
|
||||
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
|
||||
#if defined(CONFIG_FADS)
|
||||
#if defined(CONFIG_MPC860T)
|
||||
/* The FADS860T doesn't use the MODEM_EN or DATA_VOICE signals. */
|
||||
#ifdef CONFIG_FADS
|
||||
#if defined(CONFIG_MPC86xADS) || defined(CONFIG_MPC860T)
|
||||
/* The MPC86xADS/FADS860T don't use the MODEM_EN or DATA_VOICE signals. */
|
||||
*((uint *) BCSR4) &= ~BCSR4_ETHLOOP;
|
||||
*((uint *) BCSR4) |= BCSR4_TFPLDL|BCSR4_TPSQEL;
|
||||
*((uint *) BCSR1) &= ~BCSR1_ETHEN;
|
||||
|
||||
@@ -68,6 +68,23 @@
|
||||
#error "console not correctly defined"
|
||||
#endif
|
||||
|
||||
static void serial_setdivisor(volatile cpm8xx_t *cp)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
int divisor=gd->cpu_clk/16/gd->baudrate;
|
||||
|
||||
if(divisor/16>0x1000) {
|
||||
/* bad divisor, assume 50Mhz clock and 9600 baud */
|
||||
divisor=(50*1000*1000)/16/9600;
|
||||
}
|
||||
|
||||
if(divisor<=0x1000) {
|
||||
cp->cp_brgc1=((divisor-1)<<1) | CPM_BRG_EN;
|
||||
} else {
|
||||
cp->cp_brgc1=((divisor/16-1)<<1) | CPM_BRG_EN | CPM_BRG_DIV16;
|
||||
}
|
||||
}
|
||||
|
||||
#if (defined (CONFIG_8xx_CONS_SMC1) || defined (CONFIG_8xx_CONS_SMC2))
|
||||
|
||||
/*
|
||||
@@ -229,8 +246,6 @@ int serial_init (void)
|
||||
void
|
||||
serial_setbrg (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
volatile immap_t *im = (immap_t *)CFG_IMMR;
|
||||
volatile cpm8xx_t *cp = &(im->im_cpm);
|
||||
|
||||
@@ -242,8 +257,7 @@ serial_setbrg (void)
|
||||
|
||||
cp->cp_simode = 0x00000000;
|
||||
|
||||
cp->cp_brgc1 =
|
||||
(((gd->cpu_clk / 16 / gd->baudrate)-1) << 1) | CPM_BRG_EN;
|
||||
serial_setdivisor(cp);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MODEM_SUPPORT
|
||||
@@ -506,8 +520,6 @@ int serial_init (void)
|
||||
void
|
||||
serial_setbrg (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
volatile immap_t *im = (immap_t *)CFG_IMMR;
|
||||
volatile cpm8xx_t *cp = &(im->im_cpm);
|
||||
|
||||
@@ -518,10 +530,8 @@ serial_setbrg (void)
|
||||
*/
|
||||
|
||||
cp->cp_sicr &= ~(0x000000FF << (8 * SCC_INDEX));
|
||||
/* no |= needed, since BRG1 is 000 */
|
||||
|
||||
cp->cp_brgc1 =
|
||||
(((gd->cpu_clk / 16 / gd->baudrate)-1) << 1) | CPM_BRG_EN;
|
||||
serial_setdivisor(cp);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user