Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b79a11cc2b | ||
|
|
518e2e1ae3 | ||
|
|
6fb6af6dc9 | ||
|
|
eeb1b77b7d | ||
|
|
27aa818670 | ||
|
|
4b9206ed51 | ||
|
|
109c0e3ad3 | ||
|
|
efa329cb89 | ||
|
|
7d7ce4125f | ||
|
|
d9df1f4e66 | ||
|
|
42dfe7a184 | ||
|
|
855a496fe9 | ||
|
|
4b248f3f71 | ||
|
|
aaf224ab4e | ||
|
|
3d3befa754 | ||
|
|
4d13cbad1c | ||
|
|
c3f9d4939a | ||
|
|
0e6d798cb3 | ||
|
|
c40b295682 | ||
|
|
6629d2f22b | ||
|
|
bdda519d3c |
No files matched your search
@@ -2,6 +2,215 @@
|
||||
Changes for U-Boot 1.0.2:
|
||||
======================================================================
|
||||
|
||||
* Patch by Pavel Bartusek, 21 Mar 2004
|
||||
Add Reiserfs support
|
||||
|
||||
* Patch by Hinko Kocevar, 20 Mar 2004
|
||||
- Add auto-release for SMSC LAN91c111 driver
|
||||
- Add save/restore of PTR and PNR regs as suggested in datasheet
|
||||
|
||||
* Patch by Stephen Williams, 19 March 2004
|
||||
Increase speed of sector reads from SystemACE,
|
||||
shorten poll timeout and remove a useless reset
|
||||
|
||||
* Patch by Tolunay Orkun, 19 Mar 2004:
|
||||
Make GigE PHY 1000Mbps Speed/Duplex detection conditional
|
||||
(CONFIG_PHY_GIGE)
|
||||
|
||||
* Patch by Brad Kemp, 18 Mar 2004:
|
||||
prevent machine checks during a PCI scan
|
||||
|
||||
* Patch by Pierre Aubert, 18 Mar 2004:
|
||||
Fix string cleaning in IDE identification
|
||||
|
||||
* Patch by Pierre Aubert, 18 Mar 2004:
|
||||
- Unify video mode handling for Chips & Technologies 69000 Video
|
||||
chip and Silicon Motion SMI 712/710/810 Video chip
|
||||
- Add selection of the video output (CRT or LCD) via 'videoout'
|
||||
environment variable for the Silicon Motion
|
||||
- README update
|
||||
|
||||
* Patch by Pierre Aubert, 18 Mar 2004:
|
||||
include/common.h typo fix
|
||||
|
||||
* Patches by Tolunay Orkun, 17 Mar 2004:
|
||||
- Add support for bd->bi_iic_fast[] initialization via environment
|
||||
variable "i2cfast" (CONFIG_I2CFAST)
|
||||
- Add "i2cfast" u-boot environment variable support for csb272
|
||||
|
||||
* Patch by Carl Riechers, 17 Mar 2004:
|
||||
Ignore '\0' characters in console input for use with telnet and
|
||||
telco pads.
|
||||
|
||||
* Patch by Leon Kukovec, 17 Mar 2004:
|
||||
typo fix for strswab prototype #ifdef
|
||||
|
||||
* Patches by Thomas Viehweger, 16 Mar 2004:
|
||||
- show PCI clock frequency on MPC8260 systems
|
||||
- add FCC_PSMR_RMII flag for HiP7 processors
|
||||
- in do_jffs2_fsload(), take load address from load_addr if not set
|
||||
explicit, update load_addr otherwise
|
||||
- replaced printf by putc/puts when no formatting is needed
|
||||
(smaller code size, faster execution)
|
||||
|
||||
* Patch by Phillippe Robin, 16 Mar 2004:
|
||||
avoid dereferencing NULL pointer in lib_arm/armlinux.c
|
||||
|
||||
* Patch by Stephen Williams, 15 Mar 2004:
|
||||
Fix CONFIG_SERIAL_SOFTWARE_FIFO documentation
|
||||
|
||||
* Patch by Tolunay Orkun, 15 Mar 2004:
|
||||
Initialize bi_opbfreq to real OPB frequency via get_OPB_freq()
|
||||
|
||||
* Patch by Travis Sawyer, 15 Mar 2004:
|
||||
Update CREDITS & MAINTAINERS files for PPC440GX & Ocotea port
|
||||
|
||||
* Add start-up delay to make sure power has stabilized before
|
||||
attempting to switch on USB on SX1 board.
|
||||
|
||||
* Patch by Josef Wagner, 18 Mar 2004:
|
||||
- Add support for MicroSys XM250 board (PXA255)
|
||||
- Add support for MicroSys PM828 board (MPC8280)
|
||||
- Add support for 32 MB Flash on PM825/826
|
||||
- new SDRAM refresh rate for PM825/PM826
|
||||
- added support for MicroSys PM520 (MPC5200)
|
||||
- replaced Query by Identify command in CPU86/flash.c
|
||||
to support 28F160F3B
|
||||
|
||||
* Fix wrap around problem with udelay() on ARM920T
|
||||
|
||||
* Add support for Macronix flash on TRAB board
|
||||
|
||||
* Patch by Pierre Aubert, 15 Mar 2004:
|
||||
Fix buffer overflow in IDE identification
|
||||
|
||||
* Fix power-off of LCD for out-of-band temperatures on LWMON board
|
||||
|
||||
* Remove redundand #define in IceCube.h
|
||||
|
||||
* Patch by Steven Scholz, 27 Feb 2004:
|
||||
- Adding get_ticks() and get_tbclk() for AT91RM9200
|
||||
- Many white space fixes in cpu/at91rm9200/interrupts.c
|
||||
|
||||
* Patches by Steven Scholz, 20 Feb 2004:
|
||||
some cleanup in AT91RM9200 related code
|
||||
|
||||
* Patches by Travis Sawyer, 12 Mar 2004:
|
||||
- Fix Gigabit Ethernet support for 440GX
|
||||
- Add Gigabit Ethernet Support to MII PHY utilities
|
||||
|
||||
* Patch by Brad Kemp, 12 Mar 2004:
|
||||
Fixes for drivers/cfi_flash.c:
|
||||
- Better support for x8/x16 implementations
|
||||
- Added failure for AMD chips attempting to use CFG_FLASH_USE_BUFFER_WRITE
|
||||
- Added defines for AMD command and address constants
|
||||
|
||||
* Patch by Leon Kukovec, 12 Mar 2004:
|
||||
Fix get_dentfromdir() to correctly handle deleted dentries
|
||||
|
||||
* Patch by George G. Davis, 11 Mar 2004:
|
||||
Remove hard coded network settings in TI OMAP1610 H2
|
||||
default board config
|
||||
|
||||
* Patch by George G. Davis, 11 Mar 2004:
|
||||
add support for ADS GraphicsClient+ board.
|
||||
|
||||
* Patch by Pierre Aubert, 11 Mar 2004:
|
||||
- add bitmap command and splash screen support in cfb console
|
||||
- add [optional] origin in the bitmap display command
|
||||
|
||||
* Patch by Travis Sawyer, 11 Mar 2004:
|
||||
Fix ocotea board early init interrupt setup.
|
||||
|
||||
* Patch by Thomas Viehweger, 11 Mar 2004:
|
||||
Remove redundand code; add PCI-specific bits to include/mpc8260.h
|
||||
|
||||
* Patch by Stephan Linz, 09 Mar 2004
|
||||
- Add support for the SSV ADNP/ESC1 (Nios Softcore)
|
||||
|
||||
* Patch by George G. Davis, 9 Mar 2004:
|
||||
fix recent build failure for SA1100 target
|
||||
|
||||
* Patch by Travis Sawyer, 09 Mar 2004:
|
||||
Support native interrupt mode for the IBM440GX.
|
||||
Previously it was running in 440GP compatibility mode.
|
||||
|
||||
* Patch by Philippe Robin, 09 Mar 2004:
|
||||
Added ARM Integrator AP, CP and Versatile PB926EJ-S Reference
|
||||
Platform support.
|
||||
|
||||
* Patch by Masami Komiya, 08 Mar 2004:
|
||||
Don't overwrite server IP address or boot file name
|
||||
when the boot server does not return values
|
||||
|
||||
* Patch by Tolunay Orkun, 5 Mar 2004:
|
||||
Removed compile time restriction on CFG_I2C_SPEED for DS1338 RTC
|
||||
|
||||
* Patch by Tolunay Orkun, 5 Mar 2004:
|
||||
Fix early board initialization for Cogent CSB272 board
|
||||
|
||||
* Patch by Ed Okerson, 3 Mar 2004:
|
||||
fix CFI flash writes for little endian systems
|
||||
|
||||
* Patch by Reinhard Meyer, 01 Mar 2004:
|
||||
generalize USB and IDE support for MPC5200 with according
|
||||
changes to IceCube.h and TOP5200.h
|
||||
add Am29LV256 256 MBit FLASH support for TOP5200 boards
|
||||
add info about USB and IDE to README
|
||||
|
||||
* Patch by Yuli Barcohen, 4 Mar 2004:
|
||||
Fix problems with GCC 3.3.x which changed handling of global
|
||||
variables explicitly initialized to zero (now in .bss instead of
|
||||
.data as before).
|
||||
|
||||
* Patch by Leon Kukovec, 02 Mar 2004:
|
||||
add strswab() to fix IDE LBA capacity, firmware and model numbers
|
||||
on little endian machines
|
||||
|
||||
* Patch by Masami Komiya, 02 Mar 2004:
|
||||
- Remove get_ticks() from NFS code
|
||||
- Add verification of RPC transaction ID
|
||||
|
||||
* Patch by Pierre Aubert, 02 Mar 2004:
|
||||
cleanup for IDE and USB drivers for MPC5200
|
||||
|
||||
* Patch by Travis Sawyer, 01 Mar 2004:
|
||||
Ocotea:
|
||||
- Add IBM PPC440GX Ref Platform support (Ocotea)
|
||||
Original code by Paul Reynolds <PaulReynolds@lhsolutions.com>
|
||||
Adapted to U-Boot and 440GX port
|
||||
440gx_enet.c:
|
||||
- Add gracious handling of all Ethernet Pin Selections for 440GX
|
||||
- Add RGMII selection for Cicada CIS8201 Gigabit PHY
|
||||
ppc440.h:
|
||||
- Add needed bit definitions
|
||||
- Fix formatting
|
||||
|
||||
* Patch by Carl Riechers, 1 Mar 2004:
|
||||
Add PPC440GX prbdv0 divider to fix memory clock calculation.
|
||||
|
||||
* Patch by Stephan Linz, 27 Feb 2004
|
||||
- avoid problems for targets without NFS download support
|
||||
|
||||
* Patch by Rune Torgersen, 27 Feb 2004:
|
||||
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
|
||||
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
|
||||
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)
|
||||
|
||||
* Patch by Masami Komiya, 27 Feb 2004:
|
||||
Fix rarpboot: add autoload by NFS
|
||||
|
||||
* Patch by Dan Eisenhut, 26 Feb 2004:
|
||||
fix flash_write return value in saveenv
|
||||
|
||||
* Patch by Stephan Linz, 11 Dec 2003
|
||||
expand config.mk to avoid trigraph warnings on NIOS
|
||||
|
||||
* Rename "BMS2003" board into "HMI10"
|
||||
|
||||
* SX1 patches: use "serial#" for USB serial #; use redundand environment
|
||||
storage; auto-set console on USB port (using preboot command)
|
||||
|
||||
* Add support for SX1 mobile phone; add support for USB-based console
|
||||
(enable with "setenv stdout usbtty; setenv stdin usbtty")
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@ N: Jerry van Baren
|
||||
E: <vanbaren@cideas.com>
|
||||
D: BedBug port to 603e core (MPC82xx). Code for enhanced memory test.
|
||||
|
||||
N: Pavel Bartusek
|
||||
E: <pba@sysgo.com>
|
||||
D: Reiserfs support
|
||||
W: http://www.elinos.com
|
||||
|
||||
N: Andre Beaudin
|
||||
E: <andre.beaudin@colubris.com>
|
||||
D: PCMCIA, Ethernet, TFTP
|
||||
@@ -216,6 +221,7 @@ W: http://www.leox.org
|
||||
N: Stephan Linz
|
||||
E: linz@li-pro.net
|
||||
D: Support for Nios Stratix Development Kit (DK-1S10)
|
||||
D: Support for SSV ADNP/ESC1 (Nios Cyclone)
|
||||
W: http://www.li-pro.net
|
||||
|
||||
N: Raymond Lo
|
||||
@@ -251,6 +257,10 @@ E: rof@sysgo.de
|
||||
D: Initial support for SSV-DNP1110, SMC91111 driver
|
||||
W: www.elinos.com
|
||||
|
||||
N: Tolunay Orkun
|
||||
E: torkun@nextio.com
|
||||
D: Support for Cogent CSB272 board
|
||||
|
||||
N: Keith Outwater
|
||||
E: keith_outwater@mvis.com
|
||||
D: Support for generic/custom MPC860T boards (GEN860T, GEN860T_SC)
|
||||
@@ -283,7 +293,7 @@ D: Author of LiMon-1.4.2, which contributed some ideas
|
||||
|
||||
N: Travis B. Sawyer
|
||||
E: travis.sawyer@sandburst.com
|
||||
D: Support for IBM PPC440GX, XES XPedite1000 440GX PrPMC board.
|
||||
D: Support for IBM PPC440GX, XES XPedite1000 440GX PrPMC board. IBM 440gx Ref Platform (Ocotea)
|
||||
|
||||
N: Paolo Scaffardi
|
||||
E: arsenio@tin.it
|
||||
|
||||
@@ -230,6 +230,11 @@ Stefan Roese <stefan.roese@esd-electronics.com>
|
||||
PMC405 PPC405GP
|
||||
VOH405 PPC405EP
|
||||
|
||||
Travis Sawyer (travis.sawyer@sandburst.com>
|
||||
|
||||
XPEDITE1K PPC440GX
|
||||
OCOTEA PPC440GX
|
||||
|
||||
Peter De Schrijver <p2@mind.be>
|
||||
|
||||
ML2 PPC4xx
|
||||
@@ -381,6 +386,7 @@ Thomas Lange <thomas@corelatus.se>
|
||||
Stephan Linz <linz@li-pro.net>
|
||||
|
||||
DK1S10 Nios-32
|
||||
ADNPESC1 Nios-32
|
||||
|
||||
Scott McNutt <smcnutt@psyent.com>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ LIST_5xx=" \
|
||||
#########################################################################
|
||||
|
||||
LIST_5xxx=" \
|
||||
IceCube_5100 IceCube_5200 EVAL5200 \
|
||||
IceCube_5100 IceCube_5200 EVAL5200 PM520 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -61,10 +61,10 @@ LIST_4xx=" \
|
||||
CPCI440 CPCIISER4 CRAYL1 csb272 \
|
||||
DASA_SIM DP405 DU405 EBONY \
|
||||
ERIC EXBITGEN HUB405 MIP405 \
|
||||
MIP405T ML2 ml300 OCRTC \
|
||||
ORSG PCI405 PIP405 PLU405 \
|
||||
PMC405 PPChameleonEVB VOH405 W7OLMC \
|
||||
W7OLMG WALNUT405 XPEDITE1K \
|
||||
MIP405T ML2 ml300 OCOTEA \
|
||||
OCRTC ORSG PCI405 PIP405 \
|
||||
PLU405 PMC405 PPChameleonEVB VOH405 \
|
||||
W7OLMC W7OLMG WALNUT405 XPEDITE1K \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -85,9 +85,10 @@ LIST_824x=" \
|
||||
LIST_8260=" \
|
||||
atc cogent_mpc8260 CPU86 ep8260 \
|
||||
gw8260 hymod IPHASE4539 MPC8260ADS \
|
||||
MPC8266ADS PM826 ppmc8260 RPXsuper \
|
||||
rsdproto sacsng sbc8260 SCM \
|
||||
TQM8260_AC TQM8260_AD TQM8260_AE ZPC1900 \
|
||||
MPC8266ADS PM826 PM828 ppmc8260 \
|
||||
RPXsuper rsdproto sacsng sbc8260 \
|
||||
SCM TQM8260_AC TQM8260_AD TQM8260_AE \
|
||||
ZPC1900 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -122,7 +123,7 @@ LIST_ppc="${LIST_5xx} ${LIST_5xxx} \
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_SA="dnp1110 lart shannon"
|
||||
LIST_SA="dnp1110 gcplus lart shannon"
|
||||
|
||||
#########################################################################
|
||||
## ARM7 Systems
|
||||
@@ -135,16 +136,17 @@ LIST_ARM7="B2 ep7312 impa7"
|
||||
#########################################################################
|
||||
|
||||
LIST_ARM9=" \
|
||||
at91rm9200dk omap1510inn omap1610h2 omap1610inn \
|
||||
at91rm9200dk integratorcp integratorap \
|
||||
omap1510inn omap1610h2 omap1610inn \
|
||||
smdk2400 smdk2410 trab \
|
||||
VCMA9 \
|
||||
VCMA9 versatile \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## Xscale Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_pxa="cradle csb226 innokom lubbock wepep250"
|
||||
LIST_pxa="cradle csb226 innokom lubbock wepep250 xm250"
|
||||
|
||||
LIST_ixp="ixdp425"
|
||||
|
||||
@@ -176,6 +178,8 @@ LIST_x86="${LIST_I486}"
|
||||
#########################################################################
|
||||
|
||||
LIST_nios=" \
|
||||
ADNPESC1 ADNPESC1_base_32 \
|
||||
ADNPESC1_DNPEVA2_base_32 \
|
||||
DK1C20 DK1C20_standard_32 \
|
||||
DK1S10 DK1S10_standard_32 DK1S10_mtx_ldk_20 \
|
||||
"
|
||||
|
||||
@@ -99,7 +99,8 @@ LIBS = lib_generic/libgeneric.a
|
||||
LIBS += board/$(BOARDDIR)/lib$(BOARD).a
|
||||
LIBS += cpu/$(CPU)/lib$(CPU).a
|
||||
LIBS += lib_$(ARCH)/lib$(ARCH).a
|
||||
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a
|
||||
LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
|
||||
fs/reiserfs/libreiserfs.a
|
||||
LIBS += net/libnet.a
|
||||
LIBS += disk/libdisk.a
|
||||
LIBS += rtc/librtc.a
|
||||
@@ -111,7 +112,8 @@ LIBS += common/libcommon.a
|
||||
.PHONY : $(LIBS)
|
||||
|
||||
# Add GCC lib
|
||||
PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
||||
PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
||||
|
||||
|
||||
# The "tools" are needed early, so put this first
|
||||
# Don't include stuff already done in $(LIBS)
|
||||
@@ -243,6 +245,9 @@ TOP5200_config: unconfig
|
||||
@ echo "#define CONFIG_$(@:_config=) 1" >include/config.h
|
||||
@./mkconfig -a TOP5200 ppc mpc5xxx top5200 emk
|
||||
|
||||
PM520_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc5xxx pm520
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
@@ -261,9 +266,6 @@ FADS860T_config: unconfig
|
||||
AMX860_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx amx860 westel
|
||||
|
||||
bms2003_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
|
||||
|
||||
c2mon_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx c2mon
|
||||
|
||||
@@ -305,6 +307,9 @@ GTH_config: unconfig
|
||||
hermes_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx hermes
|
||||
|
||||
HMI10_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
|
||||
|
||||
IAD210_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx IAD210 siemens
|
||||
|
||||
@@ -597,6 +602,9 @@ ML2_config:unconfig
|
||||
ml300_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ml300 xilinx
|
||||
|
||||
OCOTEA_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ocotea
|
||||
|
||||
OCRTC_config \
|
||||
ORSG_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ocrtc esd
|
||||
@@ -648,7 +656,7 @@ XPEDITE1K_config:unconfig
|
||||
#########################################################################
|
||||
## MPC824x Systems
|
||||
#########################################################################
|
||||
xtract_82xx = $(subst _ROMBOOT,,$(subst _L2,,$(subst _266MHz,,$(subst _300MHz,,$(subst _config,,$1)))))
|
||||
xtract_82xx = $(subst _BIGFLASH,,$(subst _ROMBOOT,,$(subst _L2,,$(subst _266MHz,,$(subst _300MHz,,$(subst _config,,$1))))))
|
||||
|
||||
A3000_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x a3000
|
||||
@@ -743,32 +751,56 @@ MPC8260ADS_config: unconfig
|
||||
MPC8266ADS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 mpc8266ads
|
||||
|
||||
# PM825/PM826 default configuration: small (= 8 MB) Flash / boot from 64-bit flash
|
||||
PM825_config \
|
||||
PM825_ROMBOOT_config: unconfig
|
||||
@echo "#define CONFIG_PCI" >include/config.h
|
||||
@./mkconfig -a PM826 ppc mpc8260 pm826
|
||||
@cd ./include ; \
|
||||
if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
|
||||
echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
|
||||
echo "... booting from 8-bit flash" ; \
|
||||
else \
|
||||
echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
|
||||
echo "... booting from 64-bit flash" ; \
|
||||
fi; \
|
||||
echo "export CONFIG_BOOT_ROM" >> config.mk; \
|
||||
|
||||
PM825_ROMBOOT_config \
|
||||
PM825_BIGFLASH_config \
|
||||
PM825_ROMBOOT_BIGFLASH_config \
|
||||
PM826_config \
|
||||
PM826_ROMBOOT_config: unconfig
|
||||
@./mkconfig $(call xtract_82xx,$@) ppc mpc8260 pm826
|
||||
@cd ./include ; \
|
||||
if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
|
||||
echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
|
||||
echo "... booting from 8-bit flash" ; \
|
||||
PM826_ROMBOOT_config \
|
||||
PM826_BIGFLASH_config \
|
||||
PM826_ROMBOOT_BIGFLASH_config: unconfig
|
||||
@if [ "$(findstring PM825_,$@)" ] ; then \
|
||||
echo "#define CONFIG_PCI" >include/config.h ; \
|
||||
else \
|
||||
>include/config.h ; \
|
||||
fi
|
||||
@if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
|
||||
echo "... booting from 8-bit flash" ; \
|
||||
echo "#define CONFIG_BOOT_ROM" >>include/config.h ; \
|
||||
echo "TEXT_BASE = 0xFF800000" >board/pm826/config.tmp ; \
|
||||
if [ "$(findstring _BIGFLASH_,$@)" ] ; then \
|
||||
echo "... with 32 MB Flash" ; \
|
||||
echo "#define CONFIG_FLASH_32MB" >>include/config.h ; \
|
||||
fi; \
|
||||
else \
|
||||
echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
|
||||
echo "... booting from 64-bit flash" ; \
|
||||
fi; \
|
||||
echo "export CONFIG_BOOT_ROM" >> config.mk; \
|
||||
if [ "$(findstring _BIGFLASH_,$@)" ] ; then \
|
||||
echo "... with 32 MB Flash" ; \
|
||||
echo "#define CONFIG_FLASH_32MB" >>include/config.h ; \
|
||||
echo "TEXT_BASE = 0x40000000" >board/pm826/config.tmp ; \
|
||||
else \
|
||||
echo "TEXT_BASE = 0xFF000000" >board/pm826/config.tmp ; \
|
||||
fi; \
|
||||
fi
|
||||
@./mkconfig -a PM826 ppc mpc8260 pm826
|
||||
|
||||
PM828_config \
|
||||
PM828_PCI_config \
|
||||
PM828_ROMBOOT_config \
|
||||
PM828_ROMBOOT_PCI_config: unconfig
|
||||
@if [ -z "$(findstring _PCI_,$@)" ] ; then \
|
||||
echo "#define CONFIG_PCI" >>include/config.h ; \
|
||||
echo "... with PCI enabled" ; \
|
||||
else \
|
||||
>include/config.h ; \
|
||||
fi
|
||||
@if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
|
||||
echo "... booting from 8-bit flash" ; \
|
||||
echo "#define CONFIG_BOOT_ROM" >>include/config.h ; \
|
||||
echo "TEXT_BASE = 0xFF800000" >board/pm826/config.tmp ; \
|
||||
fi
|
||||
@./mkconfig -a PM828 ppc mpc8260 pm828
|
||||
|
||||
ppmc8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 ppmc8260
|
||||
@@ -901,15 +933,15 @@ ZUMA_config: unconfig
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
at91rm9200dk_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm at91rm9200 at91rm9200dk
|
||||
dnp1110_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 dnp1110
|
||||
|
||||
gcplus_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 gcplus
|
||||
|
||||
lart_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 lart
|
||||
|
||||
dnp1110_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 dnp1110
|
||||
|
||||
shannon_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 shannon
|
||||
|
||||
@@ -924,6 +956,15 @@ xtract_omap1610xxx = $(subst _cs0boot,,$(subst _cs3boot,, $(subst _config,,$1)))
|
||||
SX1_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm925t sx1
|
||||
|
||||
integratorcp_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm926ejs integratorcp
|
||||
|
||||
integratorap_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm926ejs integratorap
|
||||
|
||||
versatile_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm926ejs versatile
|
||||
|
||||
omap1510inn_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm925t omap1510inn
|
||||
|
||||
@@ -935,10 +976,10 @@ omap1610h2_cs0boot_config \
|
||||
omap1610h2_cs3boot_config : unconfig
|
||||
@if [ "$(findstring _cs0boot_, $@)" ] ; then \
|
||||
echo "#define CONFIG_CS0_BOOT" >> ./include/config.h ; \
|
||||
echo "Configured for CS0 boot"; \
|
||||
echo "... configured for CS0 boot"; \
|
||||
else \
|
||||
echo "#define CONFIG_CS3_BOOT" >> ./include/config.h ; \
|
||||
echo "Configured for CS3 boot"; \
|
||||
echo "... configured for CS3 boot"; \
|
||||
fi;
|
||||
@./mkconfig -a $(call xtract_omap1610xxx,$@) arm arm926ejs omap1610inn
|
||||
|
||||
@@ -997,6 +1038,13 @@ ep7312_config : unconfig
|
||||
modnet50_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm720t modnet50
|
||||
|
||||
#########################################################################
|
||||
## AT91RM9200 Systems
|
||||
#########################################################################
|
||||
|
||||
at91rm9200dk_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm at91rm9200 at91rm9200dk
|
||||
|
||||
#########################################################################
|
||||
## XScale Systems
|
||||
#########################################################################
|
||||
@@ -1022,6 +1070,9 @@ logodl_config : unconfig
|
||||
wepep250_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa wepep250
|
||||
|
||||
xm250_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa xm250
|
||||
|
||||
#========================================================================
|
||||
# i386
|
||||
#========================================================================
|
||||
@@ -1123,6 +1174,24 @@ DK1S10_config: unconfig
|
||||
}
|
||||
@./mkconfig -a DK1S10 nios nios dk1s10 altera
|
||||
|
||||
ADNPESC1_DNPEVA2_base_32_config \
|
||||
ADNPESC1_base_32_config \
|
||||
ADNPESC1_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _DNPEVA2,$@)" ] || \
|
||||
{ echo "#define CONFIG_DNPEVA2 1" >>include/config.h ; \
|
||||
echo "... DNP/EVA2 configuration" ; \
|
||||
}
|
||||
@[ -z "$(findstring _base_32,$@)" ] || \
|
||||
{ echo "#define CONFIG_NIOS_BASE_32 1" >>include/config.h ; \
|
||||
echo "... NIOS 'base_32' configuration" ; \
|
||||
}
|
||||
@[ -z "$(findstring ADNPESC1_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NIOS_BASE_32 1" >>include/config.h ; \
|
||||
echo "... NIOS 'base_32' configuration (DEFAULT)" ; \
|
||||
}
|
||||
@./mkconfig -a ADNPESC1 nios nios adnpesc1 ssv
|
||||
|
||||
|
||||
#########################################################################
|
||||
## MIPS32 AU1X00
|
||||
|
||||
@@ -441,8 +441,8 @@ The following options need to be configured:
|
||||
(RTS/CTS) and UART's built-in FIFO. Set the number of
|
||||
bytes the interrupt driven input buffer should have.
|
||||
|
||||
Set to 0 to disable this feature (this is the default).
|
||||
This will also disable hardware handshake.
|
||||
Leave undefined to disable this feature, including
|
||||
disable the buffer and hardware handshake.
|
||||
|
||||
- Console UART Number:
|
||||
CONFIG_UART1_CONSOLE
|
||||
@@ -660,16 +660,31 @@ The following options need to be configured:
|
||||
one partition type as well.
|
||||
|
||||
- IDE Reset method:
|
||||
CONFIG_IDE_RESET_ROUTINE
|
||||
CONFIG_IDE_RESET_ROUTINE - this is defined in several
|
||||
board configurations files but used nowhere!
|
||||
|
||||
Set this to define that instead of a reset Pin, the
|
||||
routine ide_set_reset(int idereset) will be used.
|
||||
CONFIG_IDE_RESET - is this is defined, IDE Reset will
|
||||
be performed by calling the function
|
||||
ide_set_reset(int reset)
|
||||
which has to be defined in a board specific file
|
||||
|
||||
- ATAPI Support:
|
||||
CONFIG_ATAPI
|
||||
|
||||
Set this to enable ATAPI support.
|
||||
|
||||
- LBA48 Support
|
||||
CONFIG_LBA48
|
||||
|
||||
Set this to enable support for disks larger than 137GB
|
||||
Also look at CFG_64BIT_LBA ,CFG_64BIT_VSPRINTF and CFG_64BIT_STRTOUL
|
||||
Whithout these , LBA48 support uses 32bit variables and will 'only'
|
||||
support disks up to 2.1TB.
|
||||
|
||||
CFG_64BIT_LBA:
|
||||
When enabled, makes the IDE subsystem use 64bit sector addresses.
|
||||
Default is 32bit.
|
||||
|
||||
- SCSI Support:
|
||||
At the moment only there is only support for the
|
||||
SYM53C8XX SCSI controller; define
|
||||
@@ -716,7 +731,7 @@ The following options need to be configured:
|
||||
|
||||
- USB Support:
|
||||
At the moment only the UHCI host controller is
|
||||
supported (PIP405, MIP405); define
|
||||
supported (PIP405, MIP405, MPC5200); define
|
||||
CONFIG_USB_UHCI to enable it.
|
||||
define CONFIG_USB_KEYBOARD to enable the USB Keyboard
|
||||
end define CONFIG_USB_STORAGE to enable the USB
|
||||
@@ -724,6 +739,13 @@ The following options need to be configured:
|
||||
Note:
|
||||
Supported are USB Keyboards and USB Floppy drives
|
||||
(TEAC FD-05PUB).
|
||||
MPC5200 USB requires additional defines:
|
||||
CONFIG_USB_CLOCK
|
||||
for 528 MHz Clock: 0x0001bbbb
|
||||
CONFIG_USB_CONFIG
|
||||
for differential drivers: 0x00001000
|
||||
for single ended drivers: 0x00005000
|
||||
|
||||
|
||||
- MMC Support:
|
||||
The MMC controller on the Intel PXA is supported. To
|
||||
@@ -756,17 +778,30 @@ The following options need to be configured:
|
||||
Enable Chips & Technologies 69000 Video chip
|
||||
|
||||
CONFIG_VIDEO_SMI_LYNXEM
|
||||
Enable Silicon Motion SMI 712/710/810 Video chip
|
||||
Videomode are selected via environment 'videomode' with
|
||||
standard LiLo mode numbers.
|
||||
Following modes are supported (* is default):
|
||||
Enable Silicon Motion SMI 712/710/810 Video chip. The
|
||||
video output is selected via environment 'videoout'
|
||||
(1 = LCD and 2 = CRT). If videoout is undefined, CRT is
|
||||
assumed.
|
||||
|
||||
800x600 1024x768 1280x1024
|
||||
256 (8bit) 303* 305 307
|
||||
65536 (16bit) 314 317 31a
|
||||
16,7 Mill (24bit) 315 318 31b
|
||||
For the CT69000 and SMI_LYNXEM drivers, videomode is
|
||||
selected via environment 'videomode'. Two diferent ways
|
||||
are possible:
|
||||
- "videomode=num" 'num' is a standard LiLo mode numbers.
|
||||
Following standard modes are supported (* is default):
|
||||
|
||||
Colors 640x480 800x600 1024x768 1152x864 1280x1024
|
||||
-------------+---------------------------------------------
|
||||
8 bits | 0x301* 0x303 0x305 0x161 0x307
|
||||
15 bits | 0x310 0x313 0x316 0x162 0x319
|
||||
16 bits | 0x311 0x314 0x317 0x163 0x31A
|
||||
24 bits | 0x312 0x315 0x318 ? 0x31B
|
||||
-------------+---------------------------------------------
|
||||
(i.e. setenv videomode 317; saveenv; reset;)
|
||||
|
||||
- "videomode=bootargs" all the video parameters are parsed
|
||||
from the bootargs. (See drivers/videomodes.c)
|
||||
|
||||
|
||||
CONFIG_VIDEO_SED13806
|
||||
Enable Epson SED13806 driver. This driver supports 8bpp
|
||||
and 16bpp modes defined by CONFIG_VIDEO_SED13806_8BPP
|
||||
@@ -1713,6 +1748,13 @@ use the "saveenv" command to store a valid environment.
|
||||
- CFG_FAULT_MII_ADDR:
|
||||
MII address of the PHY to check for the Ethernet link state.
|
||||
|
||||
- CFG_64BIT_VSPRINTF:
|
||||
Makes vsprintf (and all *printf functions) support printing
|
||||
of 64bit values by using the L quantifier
|
||||
|
||||
- CFG_64BIT_STRTOUL:
|
||||
Adds simple_strtoull that returns a 64bit value
|
||||
|
||||
Low Level (hardware related) configuration options:
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ int misc_init_f (void)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
#if CONFIG_CMA111
|
||||
#ifdef CONFIG_CMA111
|
||||
return (32L * 1024L * 1024L);
|
||||
#else
|
||||
unsigned char dipsw_val;
|
||||
|
||||
+3
-3
@@ -41,10 +41,10 @@ ulong flash_int_get_size (volatile unsigned long *baseaddr,
|
||||
info->sector_count = info->size = 0;
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* Write query command sequence and test FLASH answer
|
||||
/* Write identify command sequence and test FLASH answer
|
||||
*/
|
||||
baseaddr[0] = 0x00980098;
|
||||
baseaddr[1] = 0x00980098;
|
||||
baseaddr[0] = 0x00900090;
|
||||
baseaddr[1] = 0x00900090;
|
||||
|
||||
flashtest_h = baseaddr[0]; /* manufacturer ID */
|
||||
flashtest_l = baseaddr[1];
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <asm/u-boot.h>
|
||||
#include <asm/processor.h>
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <i2c.h>
|
||||
#include <miiphy.h>
|
||||
#include <405gp_enet.h>
|
||||
@@ -57,10 +56,10 @@ int pll_init(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* board_pre_init: do any preliminary board initialization
|
||||
* board_early_init_f: do early board initialization
|
||||
*
|
||||
*/
|
||||
int board_pre_init(void)
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
/* initialize PLL so UART, LCD, Ethernet clocked at correctly */
|
||||
(void) get_clocks();
|
||||
|
||||
@@ -45,9 +45,6 @@ unsigned long flash_init (void)
|
||||
#else
|
||||
unsigned long size_b0;
|
||||
int i;
|
||||
uint pbcr;
|
||||
unsigned long base_b0;
|
||||
int size_val = 0;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
|
||||
@@ -51,7 +51,7 @@ SECTIONS
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
|
||||
armboot_end = .;
|
||||
_end = .;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ OBJS = $(BOARD).o
|
||||
SOBJS =
|
||||
|
||||
$(LIB): .depend $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
$(AR) crv $@ $(OBJS) $(SOBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
|
||||
+81
-15
@@ -40,9 +40,11 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
#define FLASH_CYCLE2 0x02aa
|
||||
#define FLASH_ID1 0
|
||||
#define FLASH_ID2 1
|
||||
#define FLASH_ID3 0x0e
|
||||
#define FLASH_ID4 0x0F
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_TOP5200)
|
||||
#if defined (CONFIG_TOP5200) && !defined (CONFIG_LITE5200)
|
||||
typedef unsigned char FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned char FLASH_PORT_WIDTHV;
|
||||
#define FLASH_ID_MASK 0xFF
|
||||
@@ -54,6 +56,24 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
#define FLASH_CYCLE2 0x0555
|
||||
#define FLASH_ID1 0
|
||||
#define FLASH_ID2 2
|
||||
#define FLASH_ID3 0x1c
|
||||
#define FLASH_ID4 0x1E
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_TOP5200) && defined (CONFIG_LITE5200)
|
||||
typedef unsigned char FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned char FLASH_PORT_WIDTHV;
|
||||
#define FLASH_ID_MASK 0xFF
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define FLASH_CYCLE1 0x0555
|
||||
#define FLASH_CYCLE2 0x02aa
|
||||
#define FLASH_ID1 0
|
||||
#define FLASH_ID2 1
|
||||
#define FLASH_ID3 0x0E
|
||||
#define FLASH_ID4 0x0F
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
@@ -183,6 +203,15 @@ void flash_print_info (flash_info_t *info)
|
||||
case FLASH_AM160B:
|
||||
fmt = "29LV160%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_AMLV640U:
|
||||
fmt = "29LV640M (64 Mbit)\n";
|
||||
break;
|
||||
case FLASH_AMDLV065D:
|
||||
fmt = "29LV065D (64 Mbit)\n";
|
||||
break;
|
||||
case FLASH_AMLV256U:
|
||||
fmt = "29LV256M (256 Mbit)\n";
|
||||
break;
|
||||
default:
|
||||
fmt = "Unknown Chip Type\n";
|
||||
break;
|
||||
@@ -239,7 +268,6 @@ void flash_print_info (flash_info_t *info)
|
||||
ulong flash_get_size (FPWV *addr, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
ulong offset;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
/* Write auto select command sequence and test FLASH answer */
|
||||
@@ -278,27 +306,64 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info)
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
#ifdef CFG_LOWBOOT
|
||||
offset = 0;
|
||||
#else
|
||||
offset = 0x00e00000;
|
||||
#endif
|
||||
info->start[0] = (ulong)addr + offset;
|
||||
info->start[1] = (ulong)addr + offset + 0x4000;
|
||||
info->start[2] = (ulong)addr + offset + 0x6000;
|
||||
info->start[3] = (ulong)addr + offset + 0x8000;
|
||||
info->start[0] = (ulong)addr;
|
||||
info->start[1] = (ulong)addr + 0x4000;
|
||||
info->start[2] = (ulong)addr + 0x6000;
|
||||
info->start[3] = (ulong)addr + 0x8000;
|
||||
for (i = 4; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + offset + 0x10000 * (i-3);
|
||||
info->start[i] = (ulong)addr + 0x10000 * (i-3);
|
||||
}
|
||||
break;
|
||||
|
||||
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 + 0x10000 * i;
|
||||
}
|
||||
break;
|
||||
|
||||
case (FPW)AMD_ID_MIRROR:
|
||||
/* MIRROR BIT FLASH, read more ID bytes */
|
||||
if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV640U_2 &&
|
||||
(FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV640U_3)
|
||||
{
|
||||
info->flash_id += FLASH_AMLV640U;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x00800000;
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + 0x10000 * i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV256U_2 &&
|
||||
(FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV256U_3)
|
||||
{
|
||||
/* attention: only the first 16 MB will be used in u-boot */
|
||||
info->flash_id += FLASH_AMLV256U;
|
||||
info->sector_count = 256;
|
||||
info->size = 0x01000000;
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + 0x10000 * i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* fall thru to here ! */
|
||||
default:
|
||||
printf ("unknown AMD device=%x ", (FPW)addr[FLASH_ID2]);
|
||||
printf ("unknown AMD device=%x %x %x",
|
||||
(FPW)addr[FLASH_ID2],
|
||||
(FPW)addr[FLASH_ID3],
|
||||
(FPW)addr[FLASH_ID4]);
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* => no or unknown flash */
|
||||
info->size = 0x800000;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
@@ -329,6 +394,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM160B:
|
||||
case FLASH_AMLV640U:
|
||||
break;
|
||||
case FLASH_UNKNOWN:
|
||||
default:
|
||||
|
||||
@@ -57,7 +57,7 @@ long int initdram (int board_type)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = CFG_DRAM_CONTROL | MODE_EN;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = CFG_DRAM_CONTROL | MODE_EN | SOFT_PRE;
|
||||
#if CFG_DRAM_DDR
|
||||
#ifdef CFG_DRAM_DDR
|
||||
/* set extended mode register */
|
||||
*(vu_short *)MPC5XXX_SDRAM_MODE = CFG_DRAM_EMODE;
|
||||
#endif
|
||||
@@ -113,11 +113,15 @@ int checkboard (void)
|
||||
#if defined (CONFIG_EVAL5200)
|
||||
puts ("Board: EMK TOP5200 on EVAL5200\n");
|
||||
#else
|
||||
#if defined (CONFIG_LITE5200)
|
||||
puts ("Board: LITE5200\n");
|
||||
#else
|
||||
#if defined (CONFIG_MINI5200)
|
||||
puts ("Board: EMK TOP5200 on MINI5200\n");
|
||||
#else
|
||||
puts ("Board: EMK TOP5200\n");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -155,10 +159,11 @@ void flash_afterinit(uint bank, ulong start, ulong size)
|
||||
*****************************************************************************/
|
||||
int misc_init_r (void)
|
||||
{
|
||||
#if !defined (CONFIG_LITE5200)
|
||||
/* read 'factory' part of EEPROM */
|
||||
extern void read_factory_r (void);
|
||||
read_factory_r ();
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -175,3 +180,23 @@ void pci_init_board(void)
|
||||
pci_mpc5xxx_init(&hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* provide the PCI Reset Function
|
||||
*****************************************************************************/
|
||||
#ifdef CFG_CMD_IDE
|
||||
#define GPIO_PSC1_4 0x01000000ul
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
/* (it does not matter we do this every time) */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# 2003 (c) MontaVista Software, 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := gcplus.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS) $(SOBJS)
|
||||
|
||||
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
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# ADS GCPlus board with SA1110 cpu
|
||||
#
|
||||
# The ADS GCPlus has 2 banks of 16 MiB SDRAM
|
||||
#
|
||||
# We use the ADS GCPlus Linux boot ROM to load U-Boot into SDRAM
|
||||
# at c020'0000 and then move ourself to c8f0'0000. Basically, just
|
||||
# install the U-Boot binary as you would the Linux zImage and then
|
||||
# reap the benfits of more convenient Linux development cycles, i.e.
|
||||
# bootp;tftp;bootm, repeat, etc.,.
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xc8f00000
|
||||
@@ -0,0 +1,440 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* 2003 (c) MontaVista Software, 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
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <linux/byteorder/swab.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#define FLASH_PORT_WIDTH32
|
||||
#undef FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(FPW * addr, flash_info_t * info);
|
||||
static int write_data(flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets(ulong base, flash_info_t * info);
|
||||
void inline spin_wheel(void);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
flash_init(void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets(PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
flash_get_offsets(ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
flash_print_info(flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F128J3A:
|
||||
printf("28F128J3A\n");
|
||||
break;
|
||||
case FLASH_28F640J5:
|
||||
printf("28F640J5\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong
|
||||
flash_get_size(FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
case (FPW) INTEL_ID_28F128J3A:
|
||||
info->flash_id += FLASH_28F128J3A;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 16 MB */
|
||||
case (FPW) INTEL_ID_28F640J5:
|
||||
info->flash_id += FLASH_28F640J5;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, 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;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
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");
|
||||
}
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
*addr = (FPW) 0x00200020; /* erase setup */
|
||||
*addr = (FPW) 0x00D000D0; /* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
*addr = (FPW) 0x00B000B0; /* suspend erase */
|
||||
*addr = (FPW) 0x00FF00FF; /* reset to read mode */
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register cmd. */
|
||||
*addr = (FPW) 0x00FF00FF; /* resest to read mode */
|
||||
|
||||
printf(" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int
|
||||
write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data(info, wp, SWAP(data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data(info, wp, SWAP(data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data(info, wp, SWAP(data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int
|
||||
write_data(flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf("not erased at %08lX (%lX)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline
|
||||
spin_wheel(void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* 2003-2004 (c) MontaVista Software, 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
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <SA-1100.h>
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int
|
||||
board_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_arch_number = 29; /* ADS GraphicsClientPlus Board */
|
||||
|
||||
gd->bd->bi_boot_params = 0xc000003c; /* Weird address? */
|
||||
|
||||
/* Most of the ADS GCPlus I/O is connected to Static nCS2.
|
||||
* So I'm brute forcing nCS2 timiming here for worst case.
|
||||
*/
|
||||
MSC1 &= ~0xFFFF;
|
||||
MSC1 |= 0x8649;
|
||||
|
||||
/* Nothing is connected to Static nCS4 or nCS5. But I'm using
|
||||
* nCS4 as a paranoia safe guard to force nCS2, nOE; nWE high
|
||||
* after accessing I/O via (non-VLIO) nCS2. What can I say, I'm
|
||||
* paranoid and lack decent tools to alleviate my fear. I sure
|
||||
* do wish I had a logic analyzer. : (
|
||||
*/
|
||||
|
||||
MSC2 = 0xfff9fff9;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dram_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Memory Setup stuff - taken from blob memsetup.S
|
||||
*
|
||||
* Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
|
||||
* Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
|
||||
* 2003-2004 (c) MontaVista Software, 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
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
/* The ADS GC+ for Linux Boot Rom Ver. 1.73 does memory init for us.
|
||||
* However the darn thing leaves the MMU enabled before handing control
|
||||
* over to us. So we need to disable the MMU and we use memsetup
|
||||
* to do it.
|
||||
*/
|
||||
|
||||
@ The following code segment was borrowed with gratitude from:
|
||||
@ linux-2.4.19-rmk7/arch/arm/boot/compressed/head-sa1100.S
|
||||
|
||||
@ Data cache might be active.
|
||||
@ Be sure to flush kernel binary out of the cache,
|
||||
@ whatever state it is, before it is turned off.
|
||||
@ This is done by fetching through currently executed
|
||||
@ memory to be sure we hit the same cache.
|
||||
bic r2, pc, #0x1f
|
||||
add r3, r2, #0x4000 @ 16 kb is quite enough...
|
||||
1: ldr r0, [r2], #32
|
||||
teq r2, r3
|
||||
bne 1b
|
||||
mcr p15, 0, r0, c7, c10, 4 @ drain WB
|
||||
mcr p15, 0, r0, c7, c7, 0 @ flush I & D caches
|
||||
|
||||
@ disabling MMU and caches
|
||||
mrc p15, 0, r0, c1, c0, 0 @ read control reg
|
||||
bic r0, r0, #0x0d @ clear WB, DC, MMU
|
||||
bic r0, r0, #0x1000 @ clear Icache
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
b 2f
|
||||
2:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* 2003 (c) MontaVista Software, 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
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/sa1100/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -207,3 +207,28 @@ void pci_init_board(void)
|
||||
pci_mpc5xxx_init(&hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
|
||||
|
||||
#define GPIO_PSC1_4 0x01000000UL
|
||||
|
||||
void init_ide_reset (void)
|
||||
{
|
||||
debug ("init_ide_reset\n");
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
debug ("ide_reset(%d)\n", idereset);
|
||||
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
}
|
||||
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
|
||||
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# (C) Copyright 2004
|
||||
# ARM Ltd.
|
||||
# Philippe Robin, <philippe.robin@arm.com>
|
||||
#
|
||||
# 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 := integratorap.o flash.o
|
||||
SOBJS := platform.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# image should be loaded at 0x01000000
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x01000000
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* 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 <linux/byteorder/swab.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#undef FLASH_PORT_WIDTH32
|
||||
#define FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef {
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgIntel_28F256L18T[] = {
|
||||
{4, 32 * 1024}, /* 4 * 32kBytes sectors */
|
||||
{255, 128 * 1024}, /* 255 * 128kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
unsigned long flash_init (void);
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info);
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
void inline spin_wheel (void);
|
||||
void flash_print_info (flash_info_t * info);
|
||||
void flash_unprotect_sectors (FPWV * addr);
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last);
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
pOrgDef = OrgIntel_28F256L18T;
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (i > 255) {
|
||||
info->start[i] = base + (i * 0x8000);
|
||||
info->protect[i] = 0;
|
||||
} else {
|
||||
info->start[i] = base +
|
||||
(i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F256L18T:
|
||||
printf ("FLASH 28F256L18T\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
|
||||
case (FPW) (INTEL_ID_28F256L18T):
|
||||
info->flash_id += FLASH_28F256L18T;
|
||||
info->sector_count = 259;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/* unprotects a sector for write and erase
|
||||
* on some intel parts, this unprotects the entire chip, but it
|
||||
* wont hurt to call this additional times per sector...
|
||||
*/
|
||||
void flash_unprotect_sectors (FPWV * addr)
|
||||
{
|
||||
#define PD_FINTEL_WSMS_READY_MASK 0x0080
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
|
||||
/* this sends the clear lock bit command */
|
||||
*addr = (FPW) 0x00600060;
|
||||
*addr = (FPW) 0x00D000D0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, 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;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
flash_unprotect_sectors (addr);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050;/* clear status register */
|
||||
*addr = (FPW) 0x00200020;/* erase setup */
|
||||
*addr = (FPW) 0x00D000D0;/* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked () >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
/* suspend erase */
|
||||
*addr = (FPW) 0x00B000B0;
|
||||
/* reset to read mode */
|
||||
*addr = (FPW) 0x00FF00FF;
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register cmd. */
|
||||
*addr = (FPW) 0x00500050;
|
||||
*addr = (FPW) 0x00FF00FF;/* resest to read mode */
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
flash_unprotect_sectors (addr);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,477 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.com>
|
||||
*
|
||||
* 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>
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
# include <pci.h>
|
||||
#endif
|
||||
|
||||
void flash__init (void);
|
||||
void ether__init (void);
|
||||
void peripheral_power_enable (void);
|
||||
|
||||
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
|
||||
void show_boot_progress(int progress)
|
||||
{
|
||||
printf("Boot reached stage %d\n", progress);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
|
||||
|
||||
static inline void delay (unsigned long loops)
|
||||
{
|
||||
__asm__ volatile ("1:\n"
|
||||
"subs %0, %1, #1\n"
|
||||
"bne 1b":"=r" (loops):"0" (loops));
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* arch number of Integrator Board */
|
||||
gd->bd->bi_arch_number = 21;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0x00000100;
|
||||
|
||||
icache_enable ();
|
||||
|
||||
flash__init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
#ifdef CONFIG_PCI
|
||||
pci_init();
|
||||
#endif
|
||||
setenv("verify", "n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize PCI Devices, report devices found.
|
||||
*/
|
||||
#ifdef CONFIG_PCI
|
||||
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
|
||||
static struct pci_config_table pci_integrator_config_table[] = {
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
|
||||
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
|
||||
PCI_ENET0_MEMADDR,
|
||||
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* V3 access routines */
|
||||
#define _V3Write16(o,v) (*(volatile unsigned short *)(PCI_V3_BASE + (unsigned int)(o)) = (unsigned short)(v))
|
||||
#define _V3Read16(o) (*(volatile unsigned short *)(PCI_V3_BASE + (unsigned int)(o)))
|
||||
|
||||
#define _V3Write32(o,v) (*(volatile unsigned int *)(PCI_V3_BASE + (unsigned int)(o)) = (unsigned int)(v))
|
||||
#define _V3Read32(o) (*(volatile unsigned int *)(PCI_V3_BASE + (unsigned int)(o)))
|
||||
|
||||
/* Compute address necessary to access PCI config space for the given */
|
||||
/* bus and device. */
|
||||
#define PCI_CONFIG_ADDRESS( __bus, __devfn, __offset ) ({ \
|
||||
unsigned int __address, __devicebit; \
|
||||
unsigned short __mapaddress; \
|
||||
unsigned int __dev = PCI_DEV (__devfn); /* FIXME to check!! (slot?) */ \
|
||||
\
|
||||
if (__bus == 0) { \
|
||||
/* local bus segment so need a type 0 config cycle */ \
|
||||
/* build the PCI configuration "address" with one-hot in A31-A11 */ \
|
||||
__address = PCI_CONFIG_BASE; \
|
||||
__address |= ((__devfn & 0x07) << 8); \
|
||||
__address |= __offset & 0xFF; \
|
||||
__mapaddress = 0x000A; /* 101=>config cycle, 0=>A1=A0=0 */ \
|
||||
__devicebit = (1 << (__dev + 11)); \
|
||||
\
|
||||
if ((__devicebit & 0xFF000000) != 0) { \
|
||||
/* high order bits are handled by the MAP register */ \
|
||||
__mapaddress |= (__devicebit >> 16); \
|
||||
} else { \
|
||||
/* low order bits handled directly in the address */ \
|
||||
__address |= __devicebit; \
|
||||
} \
|
||||
} else { /* bus !=0 */ \
|
||||
/* not the local bus segment so need a type 1 config cycle */ \
|
||||
/* A31-A24 are don't care (so clear to 0) */ \
|
||||
__mapaddress = 0x000B; /* 101=>config cycle, 1=>A1&A0 from PCI_CFG */ \
|
||||
__address = PCI_CONFIG_BASE; \
|
||||
__address |= ((__bus & 0xFF) << 16); /* bits 23..16 = bus number */ \
|
||||
__address |= ((__dev & 0x1F) << 11); /* bits 15..11 = device number */ \
|
||||
__address |= ((__devfn & 0x07) << 8); /* bits 10..8 = function number */ \
|
||||
__address |= __offset & 0xFF; /* bits 7..0 = register number */ \
|
||||
} \
|
||||
_V3Write16 (V3_LB_MAP1, __mapaddress); \
|
||||
__address; \
|
||||
})
|
||||
|
||||
/* _V3OpenConfigWindow - open V3 configuration window */
|
||||
#define _V3OpenConfigWindow() { \
|
||||
/* Set up base0 to see all 512Mbytes of memory space (not */ \
|
||||
/* prefetchable), this frees up base1 for re-use by configuration*/ \
|
||||
/* memory */ \
|
||||
\
|
||||
_V3Write32 (V3_LB_BASE0, ((INTEGRATOR_PCI_BASE & 0xFFF00000) | \
|
||||
0x90 | V3_LB_BASE_M_ENABLE)); \
|
||||
/* Set up base1 to point into configuration space, note that MAP1 */ \
|
||||
/* register is set up by pciMakeConfigAddress(). */ \
|
||||
\
|
||||
_V3Write32 (V3_LB_BASE1, ((CPU_PCI_CNFG_ADRS & 0xFFF00000) | \
|
||||
0x40 | V3_LB_BASE_M_ENABLE)); \
|
||||
}
|
||||
|
||||
/* _V3CloseConfigWindow - close V3 configuration window */
|
||||
#define _V3CloseConfigWindow() { \
|
||||
/* Reassign base1 for use by prefetchable PCI memory */ \
|
||||
_V3Write32 (V3_LB_BASE1, (((INTEGRATOR_PCI_BASE + 0x10000000) & 0xFFF00000) \
|
||||
| 0x84 | V3_LB_BASE_M_ENABLE)); \
|
||||
_V3Write16 (V3_LB_MAP1, \
|
||||
(((INTEGRATOR_PCI_BASE + 0x10000000) & 0xFFF00000) >> 16) | 0x0006); \
|
||||
\
|
||||
/* And shrink base0 back to a 256M window (NOTE: MAP0 already correct) */ \
|
||||
\
|
||||
_V3Write32 (V3_LB_BASE0, ((INTEGRATOR_PCI_BASE & 0xFFF00000) | \
|
||||
0x80 | V3_LB_BASE_M_ENABLE)); \
|
||||
}
|
||||
|
||||
static int pci_integrator_read_byte (struct pci_controller *hose, pci_dev_t dev,
|
||||
int offset, unsigned char *val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*val = *(volatile unsigned char *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset);
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_read__word (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned short *val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*val = *(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset);
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_read_dword (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned int *val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*val = *(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset);
|
||||
*val |= (*(volatile unsigned int *)
|
||||
PCI_CONFIG_ADDRESS (PCI_BUS (dev), PCI_FUNC (dev),
|
||||
(offset + 2))) << 16;
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_write_byte (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned char val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*(volatile unsigned char *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset) = val;
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_write_word (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned short val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset) = val;
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_write_dword (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned int val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset) = (val & 0xFFFF);
|
||||
*(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
(offset + 2)) = ((val >> 16) & 0xFFFF);
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/******************************
|
||||
* PCI initialisation
|
||||
******************************/
|
||||
|
||||
struct pci_controller integrator_hose = {
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
config_table: pci_integrator_config_table,
|
||||
#endif
|
||||
};
|
||||
|
||||
void pci_init_board (void)
|
||||
{
|
||||
volatile int i, j;
|
||||
struct pci_controller *hose = &integrator_hose;
|
||||
|
||||
/* setting this register will take the V3 out of reset */
|
||||
|
||||
*(volatile unsigned int *) (INTEGRATOR_SC_PCIENABLE) = 1;
|
||||
|
||||
/* wait a few usecs to settle the device and the PCI bus */
|
||||
|
||||
for (i = 0; i < 100; i++)
|
||||
j = i + 1;
|
||||
|
||||
/* Now write the Base I/O Address Word to V3_BASE + 0x6C */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_IO_BASE) =
|
||||
(unsigned short) (V3_BASE >> 16);
|
||||
|
||||
do {
|
||||
*(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA) = 0xAA;
|
||||
*(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA + 4) =
|
||||
0x55;
|
||||
} while (*(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA) != 0xAA
|
||||
|| *(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA +
|
||||
4) != 0x55);
|
||||
|
||||
/* Make sure that V3 register access is not locked, if it is, unlock it */
|
||||
|
||||
if ((*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) &
|
||||
V3_SYSTEM_M_LOCK)
|
||||
== V3_SYSTEM_M_LOCK)
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) = 0xA05F;
|
||||
|
||||
/* Ensure that the slave accesses from PCI are disabled while we */
|
||||
/* setup windows */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD) &=
|
||||
~(V3_COMMAND_M_MEM_EN | V3_COMMAND_M_IO_EN);
|
||||
|
||||
/* Clear RST_OUT to 0; keep the PCI bus in reset until we've finished */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) &=
|
||||
~V3_SYSTEM_M_RST_OUT;
|
||||
|
||||
/* Make all accesses from PCI space retry until we're ready for them */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CFG) |=
|
||||
V3_PCI_CFG_M_RETRY_EN;
|
||||
|
||||
/* Set up any V3 PCI Configuration Registers that we absolutely have to */
|
||||
/* LB_CFG controls Local Bus protocol. */
|
||||
/* Enable LocalBus byte strobes for READ accesses too. */
|
||||
/* set bit 7 BE_IMODE and bit 6 BE_OMODE */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_CFG) |= 0x0C0;
|
||||
|
||||
/* PCI_CMD controls overall PCI operation. */
|
||||
/* Enable PCI bus master. */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD) |= 0x04;
|
||||
|
||||
/* PCI_MAP0 controls where the PCI to CPU memory window is on Local Bus */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_MAP0) =
|
||||
(INTEGRATOR_BOOT_ROM_BASE) | (V3_PCI_MAP_M_ADR_SIZE_512M |
|
||||
V3_PCI_MAP_M_REG_EN |
|
||||
V3_PCI_MAP_M_ENABLE);
|
||||
|
||||
/* PCI_BASE0 is the PCI address of the start of the window */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_BASE0) =
|
||||
INTEGRATOR_BOOT_ROM_BASE;
|
||||
|
||||
/* PCI_MAP1 is LOCAL address of the start of the window */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_MAP1) =
|
||||
(INTEGRATOR_HDR0_SDRAM_BASE) | (V3_PCI_MAP_M_ADR_SIZE_1024M |
|
||||
V3_PCI_MAP_M_REG_EN |
|
||||
V3_PCI_MAP_M_ENABLE);
|
||||
|
||||
/* PCI_BASE1 is the PCI address of the start of the window */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_BASE1) =
|
||||
INTEGRATOR_HDR0_SDRAM_BASE;
|
||||
|
||||
/* Set up the windows from local bus memory into PCI configuration, */
|
||||
/* I/O and Memory. */
|
||||
/* PCI I/O, LB_BASE2 and LB_MAP2 are used exclusively for this. */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_BASE2) =
|
||||
((CPU_PCI_IO_ADRS >> 24) << 8) | V3_LB_BASE_M_ENABLE;
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_MAP2) = 0;
|
||||
|
||||
/* PCI Configuration, use LB_BASE1/LB_MAP1. */
|
||||
|
||||
/* PCI Memory use LB_BASE0/LB_MAP0 and LB_BASE1/LB_MAP1 */
|
||||
/* Map first 256Mbytes as non-prefetchable via BASE0/MAP0 */
|
||||
/* (INTEGRATOR_PCI_BASE == PCI_MEM_BASE) */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_LB_BASE0) =
|
||||
INTEGRATOR_PCI_BASE | (0x80 | V3_LB_BASE_M_ENABLE);
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_MAP0) =
|
||||
((INTEGRATOR_PCI_BASE >> 20) << 0x4) | 0x0006;
|
||||
|
||||
/* Map second 256 Mbytes as prefetchable via BASE1/MAP1 */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_LB_BASE1) =
|
||||
INTEGRATOR_PCI_BASE | (0x84 | V3_LB_BASE_M_ENABLE);
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_MAP1) =
|
||||
(((INTEGRATOR_PCI_BASE + 0x10000000) >> 20) << 4) | 0x0006;
|
||||
|
||||
/* Allow accesses to PCI Configuration space */
|
||||
/* and set up A1, A0 for type 1 config cycles */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CFG) =
|
||||
((*(volatile unsigned short *) (V3_BASE + V3_PCI_CFG)) &
|
||||
~(V3_PCI_CFG_M_RETRY_EN | V3_PCI_CFG_M_AD_LOW1)) |
|
||||
V3_PCI_CFG_M_AD_LOW0;
|
||||
|
||||
/* now we can allow in PCI MEMORY accesses */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD) =
|
||||
(*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD)) |
|
||||
V3_COMMAND_M_MEM_EN;
|
||||
|
||||
/* Set RST_OUT to take the PCI bus is out of reset, PCI devices can */
|
||||
/* initialise and lock the V3 system register so that no one else */
|
||||
/* can play with it */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) =
|
||||
(*(volatile unsigned short *) (V3_BASE + V3_SYSTEM)) |
|
||||
V3_SYSTEM_M_RST_OUT;
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) =
|
||||
(*(volatile unsigned short *) (V3_BASE + V3_SYSTEM)) |
|
||||
V3_SYSTEM_M_LOCK;
|
||||
|
||||
/*
|
||||
* Register the hose
|
||||
*/
|
||||
hose->first_busno = 0;
|
||||
hose->last_busno = 0xff;
|
||||
|
||||
/* System memory space */
|
||||
pci_set_region (hose->regions + 0,
|
||||
0x00000000, 0x40000000, 0x01000000,
|
||||
PCI_REGION_MEM | PCI_REGION_MEMORY);
|
||||
|
||||
/* PCI Memory - config space */
|
||||
pci_set_region (hose->regions + 1,
|
||||
0x00000000, 0x62000000, 0x01000000, PCI_REGION_MEM);
|
||||
|
||||
/* PCI V3 regs */
|
||||
pci_set_region (hose->regions + 2,
|
||||
0x00000000, 0x61000000, 0x00080000, PCI_REGION_MEM);
|
||||
|
||||
/* PCI I/O space */
|
||||
pci_set_region (hose->regions + 3,
|
||||
0x00000000, 0x60000000, 0x00010000, PCI_REGION_IO);
|
||||
|
||||
pci_set_ops (hose,
|
||||
pci_integrator_read_byte,
|
||||
pci_integrator_read__word,
|
||||
pci_integrator_read_dword,
|
||||
pci_integrator_write_byte,
|
||||
pci_integrator_write_word, pci_integrator_write_dword);
|
||||
|
||||
hose->region_count = 4;
|
||||
|
||||
pci_register_hose (hose);
|
||||
|
||||
pciauto_config_init (hose);
|
||||
pciauto_config_device (hose, 0);
|
||||
|
||||
hose->last_busno = pci_hose_scan (hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
void flash__init (void)
|
||||
{
|
||||
}
|
||||
/*************************************************************
|
||||
Routine:ether__init
|
||||
Description: take the Ethernet controller out of reset and wait
|
||||
for the EEPROM load to complete.
|
||||
*************************************************************/
|
||||
void ether__init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
int dram_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Board specific setup info
|
||||
*
|
||||
* (C) Copyright 2004, ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/* All done by Integrator's boot monitor! */
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm926ejs/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# 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 := integratorcp.o flash.o
|
||||
SOBJS := platform.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# image should be loaded at 0x01000000
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x01000000
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* 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 <linux/byteorder/swab.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#undef FLASH_PORT_WIDTH32
|
||||
#define FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef {
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgIntel_28F256L18T[] = {
|
||||
{4, 32 * 1024}, /* 4 * 32kBytes sectors */
|
||||
{255, 128 * 1024}, /* 255 * 128kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
unsigned long flash_init (void);
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info);
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
void inline spin_wheel (void);
|
||||
void flash_print_info (flash_info_t * info);
|
||||
void flash_unprotect_sectors (FPWV * addr);
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last);
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
pOrgDef = OrgIntel_28F256L18T;
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (i > 255) {
|
||||
info->start[i] = base + (i * 0x8000);
|
||||
info->protect[i] = 0;
|
||||
} else {
|
||||
info->start[i] = base +
|
||||
(i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F256L18T:
|
||||
printf ("FLASH 28F256L18T\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
|
||||
case (FPW) (INTEL_ID_28F256L18T):
|
||||
info->flash_id += FLASH_28F256L18T;
|
||||
info->sector_count = 259;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/* unprotects a sector for write and erase
|
||||
* on some intel parts, this unprotects the entire chip, but it
|
||||
* wont hurt to call this additional times per sector...
|
||||
*/
|
||||
void flash_unprotect_sectors (FPWV * addr)
|
||||
{
|
||||
#define PD_FINTEL_WSMS_READY_MASK 0x0080
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
|
||||
/* this sends the clear lock bit command */
|
||||
*addr = (FPW) 0x00600060;
|
||||
*addr = (FPW) 0x00D000D0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, 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;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
flash_unprotect_sectors (addr);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050;/* clear status register */
|
||||
*addr = (FPW) 0x00200020;/* erase setup */
|
||||
*addr = (FPW) 0x00D000D0;/* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked () >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
/* suspend erase */
|
||||
*addr = (FPW) 0x00B000B0;
|
||||
/* reset to read mode */
|
||||
*addr = (FPW) 0x00FF00FF;
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register cmd. */
|
||||
*addr = (FPW) 0x00500050;
|
||||
*addr = (FPW) 0x00FF00FF;/* resest to read mode */
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
flash_unprotect_sectors (addr);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.com>
|
||||
*
|
||||
* 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>
|
||||
|
||||
void flash__init (void);
|
||||
void ether__init (void);
|
||||
void peripheral_power_enable (void);
|
||||
|
||||
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
|
||||
void show_boot_progress(int progress)
|
||||
{
|
||||
printf("Boot reached stage %d\n", progress);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
|
||||
|
||||
static inline void delay (unsigned long loops)
|
||||
{
|
||||
__asm__ volatile ("1:\n"
|
||||
"subs %0, %1, #1\n"
|
||||
"bne 1b":"=r" (loops):"0" (loops));
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* arch number of Integrator Board */
|
||||
gd->bd->bi_arch_number = 275;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0x00000100;
|
||||
|
||||
icache_enable ();
|
||||
|
||||
flash__init ();
|
||||
ether__init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
setenv("verify", "n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
void flash__init (void)
|
||||
{
|
||||
}
|
||||
/*************************************************************
|
||||
Routine:ether__init
|
||||
Description: take the Ethernet controller out of reset and wait
|
||||
for the EEPROM load to complete.
|
||||
*************************************************************/
|
||||
void ether__init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
int dram_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Board specific setup info
|
||||
*
|
||||
* (C) Copyright 2003, ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/* All done by IntegratorCP's boot monitor! */
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm926ejs/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ mpl_prg_image(uchar *ld_addr)
|
||||
}
|
||||
puts("OK\n");
|
||||
break;
|
||||
#if CONFIG_BZIP2
|
||||
#ifdef CONFIG_BZIP2
|
||||
case IH_COMP_BZIP2:
|
||||
puts("Uncompressing (BZIP2) ... ");
|
||||
{
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
SOBJS = init.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 $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# (C) Copyright 2004
|
||||
# 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
|
||||
#
|
||||
|
||||
#
|
||||
# IBM 440GX Reference Platform (Ocotea) board
|
||||
#
|
||||
|
||||
#TEXT_BASE = 0xFFFE0000
|
||||
|
||||
ifeq ($(ramsym),1)
|
||||
TEXT_BASE = 0x07FD0000
|
||||
else
|
||||
TEXT_BASE = 0xFFF80000
|
||||
endif
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_440=1
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(dbcr),1)
|
||||
PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8cff0000
|
||||
endif
|
||||
@@ -0,0 +1,595 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2002 Jun Gu <jung@artesyncp.com>
|
||||
* Add support for Am29F016D and dynamic switch setting.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 4/5/2001
|
||||
* Wait for completion of each sector erase command issued
|
||||
* 4/5/2001
|
||||
* Chris Hallinan - DS4.COM, Inc. - clh@net1plus.com
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ppc4xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUGF(x...) printf(x)
|
||||
#else
|
||||
#define DEBUGF(x...)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#define BOOT_SMALL_FLASH 32 /* 00100000 */
|
||||
#define FLASH_ONBD_N 2 /* 00000010 */
|
||||
#define FLASH_SRAM_SEL 1 /* 00000001 */
|
||||
|
||||
#define BOOT_SMALL_FLASH_VAL 4
|
||||
#define FLASH_ONBD_N_VAL 2
|
||||
#define FLASH_SRAM_SEL_VAL 1
|
||||
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
static unsigned long flash_addr_table[8][CFG_MAX_FLASH_BANKS] = {
|
||||
{0xFF800000, 0xFF900000, 0xFFC00000}, /* 0:000: configuraton 4 */
|
||||
{0xFF900000, 0xFF800000, 0xFFC00000}, /* 1:001: configuraton 3 */
|
||||
{0x00000000, 0x00000000, 0x00000000}, /* 2:010: configuraton 8 */
|
||||
{0x00000000, 0x00000000, 0x00000000}, /* 3:011: configuraton 7 */
|
||||
{0xFFE00000, 0xFFF00000, 0xFF800000}, /* 4:100: configuraton 2 */
|
||||
{0xFFF00000, 0xFFF80000, 0xFF800000}, /* 5:101: configuraton 1 */
|
||||
{0x00000000, 0x00000000, 0x00000000}, /* 6:110: configuraton 6 */
|
||||
{0x00000000, 0x00000000, 0x00000000} /* 7:111: configuraton 5 */
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info);
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data);
|
||||
|
||||
|
||||
#ifdef CONFIG_OCOTEA
|
||||
#define ADDR0 0x5555
|
||||
#define ADDR1 0x2aaa
|
||||
#define FLASH_WORD_SIZE unsigned char
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
unsigned long total_b = 0;
|
||||
unsigned long size_b[CFG_MAX_FLASH_BANKS];
|
||||
unsigned char *fpga_base = (unsigned char *) CFG_FPGA_BASE;
|
||||
unsigned char switch_status;
|
||||
unsigned short index = 0;
|
||||
int i;
|
||||
|
||||
/* read FPGA base register FPGA_REG0 */
|
||||
switch_status = *fpga_base;
|
||||
|
||||
/* check the bitmap of switch status */
|
||||
if (switch_status & BOOT_SMALL_FLASH) {
|
||||
index += BOOT_SMALL_FLASH_VAL;
|
||||
}
|
||||
if (switch_status & FLASH_ONBD_N) {
|
||||
index += FLASH_ONBD_N_VAL;
|
||||
}
|
||||
if (switch_status & FLASH_SRAM_SEL) {
|
||||
index += FLASH_SRAM_SEL_VAL;
|
||||
}
|
||||
|
||||
DEBUGF("\n");
|
||||
DEBUGF("FLASH: Index: %d\n", index);
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
flash_info[i].sector_count = -1;
|
||||
flash_info[i].size = 0;
|
||||
|
||||
/* check whether the address is 0 */
|
||||
if (flash_addr_table[index][i] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* call flash_get_size() to initialize sector address */
|
||||
size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i], &flash_info[i]);
|
||||
flash_info[i].size = size_b[i];
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
|
||||
i, size_b[i], size_b[i] << 20);
|
||||
flash_info[i].sector_count = -1;
|
||||
flash_info[i].size = 0;
|
||||
}
|
||||
|
||||
total_b += flash_info[i].size;
|
||||
}
|
||||
|
||||
return total_b;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info(flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
int k;
|
||||
int size;
|
||||
int erased;
|
||||
volatile unsigned long *flash;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD:
|
||||
printf("AMD ");
|
||||
break;
|
||||
case FLASH_MAN_FUJ:
|
||||
printf("FUJITSU ");
|
||||
break;
|
||||
case FLASH_MAN_SST:
|
||||
printf("SST ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM040:
|
||||
printf("AM29F040 (512 Kbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_AM400B:
|
||||
printf("AM29LV400B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400T:
|
||||
printf("AM29LV400T (4 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM800B:
|
||||
printf("AM29LV800B (8 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM800T:
|
||||
printf("AM29LV800T (8 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM160B:
|
||||
printf("AM29LV160B (16 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM160T:
|
||||
printf("AM29LV160T (16 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM320B:
|
||||
printf("AM29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T:
|
||||
printf("AM29LV320T (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AMDLV033C:
|
||||
printf("AM29LV033C (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_SST800A:
|
||||
printf("SST39LF/VF800 (8 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_SST160A:
|
||||
printf("SST39LF/VF160 (16 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
/*
|
||||
* Check if whole sector is erased
|
||||
*/
|
||||
if (i != (info->sector_count - 1))
|
||||
size = info->start[i + 1] - info->start[i];
|
||||
else
|
||||
size = info->start[0] + info->size - info->start[i];
|
||||
erased = 1;
|
||||
flash = (volatile unsigned long *) info->start[i];
|
||||
size = size >> 2; /* divide by 4 for longword access */
|
||||
for (k = 0; k < size; k++) {
|
||||
if (*flash++ != 0xffffffff) {
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
printf(" %08lX%s%s",
|
||||
info->start[i],
|
||||
erased ? " E" : " ", info->protect[i] ? "RO " : " ");
|
||||
}
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
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;
|
||||
|
||||
DEBUGF("FLASH ADDR: %08x\n", (unsigned) addr);
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
udelay(10000);
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
udelay(1000);
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
udelay(1000);
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00900090;
|
||||
udelay(1000);
|
||||
|
||||
value = addr2[0];
|
||||
DEBUGF("FLASH MANUFACT: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) SST_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_SST;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) STM_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_STM;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr2[1]; /* device ID */
|
||||
|
||||
DEBUGF("\nFLASH DEVICEID: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) AMD_ID_F040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV033C:
|
||||
info->flash_id += FLASH_AMDLV033C;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) ||
|
||||
(info->flash_id == FLASH_AM040) ||
|
||||
(info->flash_id == FLASH_AMD016)) {
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
} else {
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile FLASH_WORD_SIZE *) (info->start[i]);
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
|
||||
info->protect[i] = 0;
|
||||
else
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
int wait_for_DQ7(flash_info_t * info, int sect)
|
||||
{
|
||||
ulong start, now, last;
|
||||
volatile FLASH_WORD_SIZE *addr =
|
||||
(FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
while ((addr[0] & (FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(FLASH_WORD_SIZE) 0x00800080) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
return -1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *addr2;
|
||||
int flag, prot, sect, l_sect;
|
||||
int i;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("- missing\n");
|
||||
} else {
|
||||
printf("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("Can't erase unknown flash type - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
l_sect = -1;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
printf("Erasing sector %p\n", addr2);
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) {
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE) 0x00500050; /* block erase */
|
||||
for (i = 0; i < 50; i++)
|
||||
udelay(1000); /* wait 1 ms */
|
||||
} else {
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE) 0x00300030; /* sector erase */
|
||||
}
|
||||
l_sect = sect;
|
||||
/*
|
||||
* Wait for each sector to complete, it's more
|
||||
* reliable. According to AMD Spec, you must
|
||||
* issue all erase commands within a specified
|
||||
* timeout. This has been seen to fail, especially
|
||||
* if printf()s are included (for debug)!!
|
||||
*/
|
||||
wait_for_DQ7(info, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay(1000);
|
||||
|
||||
/* reset to read mode */
|
||||
addr = (FLASH_WORD_SIZE *) info->start[0];
|
||||
addr[0] = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
|
||||
printf(" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* 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)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < 4 && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < 4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < 4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_word(info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
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;
|
||||
ulong start;
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((volatile FLASH_WORD_SIZE *) dest) &
|
||||
(FLASH_WORD_SIZE) data) != (FLASH_WORD_SIZE) data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4 / sizeof(FLASH_WORD_SIZE); i++) {
|
||||
int flag;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00A000A0;
|
||||
|
||||
dest2[i] = data2[i];
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer(0);
|
||||
while ((dest2[i] & (FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(data2[i] & (FLASH_WORD_SIZE) 0x00800080)) {
|
||||
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
|
||||
*
|
||||
* 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 <ppc_asm.tmpl>
|
||||
#include <config.h>
|
||||
|
||||
/* General */
|
||||
#define TLB_VALID 0x00000200
|
||||
|
||||
/* Supported page sizes */
|
||||
|
||||
#define SZ_1K 0x00000000
|
||||
#define SZ_4K 0x00000010
|
||||
#define SZ_16K 0x00000020
|
||||
#define SZ_64K 0x00000030
|
||||
#define SZ_256K 0x00000040
|
||||
#define SZ_1M 0x00000050
|
||||
#define SZ_16M 0x00000070
|
||||
#define SZ_256M 0x00000090
|
||||
|
||||
/* Storage attributes */
|
||||
#define SA_W 0x00000800 /* Write-through */
|
||||
#define SA_I 0x00000400 /* Caching inhibited */
|
||||
#define SA_M 0x00000200 /* Memory coherence */
|
||||
#define SA_G 0x00000100 /* Guarded */
|
||||
#define SA_E 0x00000080 /* Endian */
|
||||
|
||||
/* Access control */
|
||||
#define AC_X 0x00000024 /* Execute */
|
||||
#define AC_W 0x00000012 /* Write */
|
||||
#define AC_R 0x00000009 /* Read */
|
||||
|
||||
/* Some handy macros */
|
||||
|
||||
#define EPN(e) ((e) & 0xfffffc00)
|
||||
#define TLB0(epn,sz) ( (EPN((epn)) | (sz) | TLB_VALID ) )
|
||||
#define TLB1(rpn,erpn) ( ((rpn)&0xfffffc00) | (erpn) )
|
||||
#define TLB2(a) ( (a)&0x00000fbf )
|
||||
|
||||
#define tlbtab_start\
|
||||
mflr r1 ;\
|
||||
bl 0f ;
|
||||
|
||||
#define tlbtab_end\
|
||||
.long 0, 0, 0 ; \
|
||||
0: mflr r0 ; \
|
||||
mtlr r1 ; \
|
||||
blr ;
|
||||
|
||||
#define tlbentry(epn,sz,rpn,erpn,attr)\
|
||||
.long TLB0(epn,sz),TLB1(rpn,erpn),TLB2(attr)
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* TLB TABLE
|
||||
*
|
||||
* This table is used by the cpu boot code to setup the initial tlb
|
||||
* entries. Rather than make broad assumptions in the cpu source tree,
|
||||
* this table lets each board set things up however they like.
|
||||
*
|
||||
* Pointer to the table is returned in r1
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
.section .bootpg,"ax"
|
||||
.globl tlbtab
|
||||
|
||||
tlbtab:
|
||||
tlbtab_start
|
||||
tlbentry( 0xf0000000, SZ_256M, 0xf0000000, 1, AC_R|AC_W|AC_X|SA_G|SA_I)
|
||||
tlbentry( CFG_PERIPHERAL_BASE, SZ_256M, 0x40000000, 1, AC_R|AC_W|SA_G|SA_I)
|
||||
tlbentry( CFG_ISRAM_BASE, SZ_4K, 0x80000000, 0, AC_R|AC_W|AC_X )
|
||||
tlbentry( CFG_ISRAM_BASE + 0x1000, SZ_4K, 0x80001000, 0, AC_R|AC_W|AC_X )
|
||||
tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_BASE, SZ_256M, 0x00000000, 2, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_MEMBASE, SZ_256M, 0x00000000, 3, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbtab_end
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* Copyright (C) 2004 PaulReynolds@lhsolutions.com
|
||||
*
|
||||
* 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 "ocotea.h"
|
||||
#include <asm/processor.h>
|
||||
#include <spd_sdram.h>
|
||||
#include <440gx_enet.h>
|
||||
|
||||
#define BOOT_SMALL_FLASH 32 /* 00100000 */
|
||||
#define FLASH_ONBD_N 2 /* 00000010 */
|
||||
#define FLASH_SRAM_SEL 1 /* 00000001 */
|
||||
|
||||
long int fixed_sdram (void);
|
||||
void fpga_init (void);
|
||||
|
||||
int board_early_init_f (void)
|
||||
{
|
||||
unsigned long mfr;
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Initialize EBC CONFIG
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(xbcfg, EBC_CFG_LE_UNLOCK |
|
||||
EBC_CFG_PTD_ENABLE | EBC_CFG_RTC_64PERCLK |
|
||||
EBC_CFG_ATC_PREVIOUS | EBC_CFG_DTC_PREVIOUS |
|
||||
EBC_CFG_CTC_PREVIOUS | EBC_CFG_EMC_NONDEFAULT |
|
||||
EBC_CFG_PME_DISABLE | EBC_CFG_PR_32);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| 1 MB FLASH / 1 MB SRAM. Initialize bank 0 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb0ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(8)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb0cr, EBC_BXCR_BAS_ENCODE(0xFFE00000)|
|
||||
EBC_BXCR_BS_2MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| 8KB NVRAM/RTC. Initialize bank 1 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb1ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(10)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb1cr, EBC_BXCR_BAS_ENCODE(0x48000000)|
|
||||
EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| 4 MB FLASH. Initialize bank 2 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb2ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(10)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb2cr, EBC_BXCR_BAS_ENCODE(0xFF800000)|
|
||||
EBC_BXCR_BS_4MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| FPGA. Initialize bank 7 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb7ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(7)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb7cr, EBC_BXCR_BAS_ENCODE(0x48300000)|
|
||||
EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup the interrupt controller polarities, triggers, etc.
|
||||
*-------------------------------------------------------------------*/
|
||||
mtdcr (uic0sr, 0xffffffff); /* clear all */
|
||||
mtdcr (uic0er, 0x00000000); /* disable all */
|
||||
mtdcr (uic0cr, 0x00000009); /* SMI & UIC1 crit are critical */
|
||||
mtdcr (uic0pr, 0xfffffe13); /* per ref-board manual */
|
||||
mtdcr (uic0tr, 0x01c00008); /* per ref-board manual */
|
||||
mtdcr (uic0vr, 0x00000001); /* int31 highest, base=0x000 */
|
||||
mtdcr (uic0sr, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr (uic1sr, 0xffffffff); /* clear all */
|
||||
mtdcr (uic1er, 0x00000000); /* disable all */
|
||||
mtdcr (uic1cr, 0x00000000); /* all non-critical */
|
||||
mtdcr (uic1pr, 0xffffe0ff); /* per ref-board manual */
|
||||
mtdcr (uic1tr, 0x00ffc000); /* per ref-board manual */
|
||||
mtdcr (uic1vr, 0x00000001); /* int31 highest, base=0x000 */
|
||||
mtdcr (uic1sr, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr (uic2sr, 0xffffffff); /* clear all */
|
||||
mtdcr (uic2er, 0x00000000); /* disable all */
|
||||
mtdcr (uic2cr, 0x00000000); /* all non-critical */
|
||||
mtdcr (uic2pr, 0xffffffff); /* per ref-board manual */
|
||||
mtdcr (uic2tr, 0x00ff8c0f); /* per ref-board manual */
|
||||
mtdcr (uic2vr, 0x00000001); /* int31 highest, base=0x000 */
|
||||
mtdcr (uic2sr, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr (uicb0sr, 0xfc000000); /* clear all */
|
||||
mtdcr (uicb0er, 0x00000000); /* disable all */
|
||||
mtdcr (uicb0cr, 0x00000000); /* all non-critical */
|
||||
mtdcr (uicb0pr, 0xfc000000); /* */
|
||||
mtdcr (uicb0tr, 0x00000000); /* */
|
||||
mtdcr (uicb0vr, 0x00000001); /* */
|
||||
mfsdr (sdr_mfr, mfr);
|
||||
mfr &= ~SDR0_MFR_ECS_MASK;
|
||||
/* mtsdr(sdr_mfr, mfr); */
|
||||
fpga_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
sys_info_t sysinfo;
|
||||
|
||||
get_sys_info (&sysinfo);
|
||||
|
||||
printf ("Board: IBM 440GX Evaluation Board\n");
|
||||
printf ("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz / 1000000);
|
||||
printf ("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
|
||||
printf ("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000);
|
||||
printf ("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000);
|
||||
printf ("\tEPB: %lu MHz\n", sysinfo.freqEPB / 1000000);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
long dram_size = 0;
|
||||
|
||||
#if defined(CONFIG_SPD_EEPROM)
|
||||
dram_size = spd_sdram (0);
|
||||
#else
|
||||
dram_size = fixed_sdram ();
|
||||
#endif
|
||||
return dram_size;
|
||||
}
|
||||
|
||||
|
||||
#if defined(CFG_DRAM_TEST)
|
||||
int testdram (void)
|
||||
{
|
||||
uint *pstart = (uint *) 0x00000000;
|
||||
uint *pend = (uint *) 0x08000000;
|
||||
uint *p;
|
||||
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0xaaaaaaaa;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0xaaaaaaaa) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0x55555555;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0x55555555) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPD_EEPROM)
|
||||
/*************************************************************************
|
||||
* fixed sdram init -- doesn't use serial presence detect.
|
||||
*
|
||||
* Assumes: 128 MB, non-ECC, non-registered
|
||||
* PLB @ 133 MHz
|
||||
*
|
||||
************************************************************************/
|
||||
long int fixed_sdram (void)
|
||||
{
|
||||
uint reg;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup some default
|
||||
*------------------------------------------------------------------*/
|
||||
mtsdram (mem_uabba, 0x00000000); /* ubba=0 (default) */
|
||||
mtsdram (mem_slio, 0x00000000); /* rdre=0 wrre=0 rarw=0 */
|
||||
mtsdram (mem_devopt, 0x00000000); /* dll=0 ds=0 (normal) */
|
||||
mtsdram (mem_wddctr, 0x00000000); /* wrcp=0 dcd=0 */
|
||||
mtsdram (mem_clktr, 0x40000000); /* clkp=1 (90 deg wr) dcdt=0 */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup for board-specific specific mem
|
||||
*------------------------------------------------------------------*/
|
||||
/*
|
||||
* Following for CAS Latency = 2.5 @ 133 MHz PLB
|
||||
*/
|
||||
mtsdram (mem_b0cr, 0x000a4001); /* SDBA=0x000 128MB, Mode 3, enabled */
|
||||
mtsdram (mem_tr0, 0x410a4012); /* WR=2 WD=1 CL=2.5 PA=3 CP=4 LD=2 */
|
||||
/* RA=10 RD=3 */
|
||||
mtsdram (mem_tr1, 0x8080082f); /* SS=T2 SL=STAGE 3 CD=1 CT=0x02f */
|
||||
mtsdram (mem_rtr, 0x08200000); /* Rate 15.625 ns @ 133 MHz PLB */
|
||||
mtsdram (mem_cfg1, 0x00000000); /* Self-refresh exit, disable PM */
|
||||
udelay (400); /* Delay 200 usecs (min) */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Enable the controller, then wait for DCEN to complete
|
||||
*------------------------------------------------------------------*/
|
||||
mtsdram (mem_cfg0, 0x86000000); /* DCEN=1, PMUD=1, 64-bit */
|
||||
for (;;) {
|
||||
mfsdram (mem_mcsts, reg);
|
||||
if (reg & 0x80000000)
|
||||
break;
|
||||
}
|
||||
|
||||
return (128 * 1024 * 1024); /* 128 MB */
|
||||
}
|
||||
#endif /* !defined(CONFIG_SPD_EEPROM) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* pci_pre_init
|
||||
*
|
||||
* This routine is called just prior to registering the hose and gives
|
||||
* the board the opportunity to check things. Returning a value of zero
|
||||
* indicates that things are bad & PCI initialization should be aborted.
|
||||
*
|
||||
* Different boards may wish to customize the pci controller structure
|
||||
* (add regions, override default access routines, etc) or perform
|
||||
* certain pre-initialization actions.
|
||||
*
|
||||
************************************************************************/
|
||||
#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
|
||||
int pci_pre_init(struct pci_controller * hose )
|
||||
{
|
||||
unsigned long strap;
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* The ocotea board is always configured as the host & requires the
|
||||
* PCI arbiter to be enabled.
|
||||
*--------------------------------------------------------------------------*/
|
||||
mfsdr(sdr_sdstp1, strap);
|
||||
if( (strap & SDR0_SDSTP1_PAE_MASK) == 0 ){
|
||||
printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
|
||||
|
||||
/*************************************************************************
|
||||
* pci_target_init
|
||||
*
|
||||
* The bootstrap configuration provides default settings for the pci
|
||||
* inbound map (PIM). But the bootstrap config choices are limited and
|
||||
* may not be sufficient for a given board.
|
||||
*
|
||||
************************************************************************/
|
||||
#if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
|
||||
void pci_target_init(struct pci_controller * hose )
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* Disable everything
|
||||
*--------------------------------------------------------------------------*/
|
||||
out32r( PCIX0_PIM0SA, 0 ); /* disable */
|
||||
out32r( PCIX0_PIM1SA, 0 ); /* disable */
|
||||
out32r( PCIX0_PIM2SA, 0 ); /* disable */
|
||||
out32r( PCIX0_EROMBA, 0 ); /* disable expansion rom */
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* Map all of SDRAM to PCI address 0x0000_0000. Note that the 440 strapping
|
||||
* options to not support sizes such as 128/256 MB.
|
||||
*--------------------------------------------------------------------------*/
|
||||
out32r( PCIX0_PIM0LAL, CFG_SDRAM_BASE );
|
||||
out32r( PCIX0_PIM0LAH, 0 );
|
||||
out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
|
||||
|
||||
out32r( PCIX0_BAR0, 0 );
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* Program the board's subsystem id/vendor id
|
||||
*--------------------------------------------------------------------------*/
|
||||
out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
|
||||
out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID );
|
||||
|
||||
out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
|
||||
}
|
||||
#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* is_pci_host
|
||||
*
|
||||
* This routine is called to determine if a pci scan should be
|
||||
* performed. With various hardware environments (especially cPCI and
|
||||
* PPMC) it's insufficient to depend on the state of the arbiter enable
|
||||
* bit in the strap register, or generic host/adapter assumptions.
|
||||
*
|
||||
* Rather than hard-code a bad assumption in the general 440 code, the
|
||||
* 440 pci code requires the board to decide at runtime.
|
||||
*
|
||||
* Return 0 for adapter mode, non-zero for host (monarch) mode.
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
#if defined(CONFIG_PCI)
|
||||
int is_pci_host(struct pci_controller *hose)
|
||||
{
|
||||
/* The ocotea board is always configured as host. */
|
||||
return(1);
|
||||
}
|
||||
#endif /* defined(CONFIG_PCI) */
|
||||
|
||||
|
||||
void fpga_init(void)
|
||||
{
|
||||
unsigned long group;
|
||||
unsigned long sdr0_pfc0;
|
||||
unsigned long sdr0_pfc1;
|
||||
unsigned long sdr0_cust0;
|
||||
unsigned long pvr;
|
||||
|
||||
mfsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mfsdr (sdr_pfc1, sdr0_pfc1);
|
||||
group = SDR0_PFC1_EPS_DECODE(sdr0_pfc1);
|
||||
pvr = get_pvr ();
|
||||
|
||||
sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_GEIE_MASK) | SDR0_PFC0_GEIE_TRE;
|
||||
if ( ((pvr == PVR_440GX_RA) || (pvr == PVR_440GX_RB)) && ((group == 4) || (group == 5))) {
|
||||
sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_DISABLE;
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
|
||||
out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
|
||||
FPGA_REG2_EXT_INTFACE_ENABLE);
|
||||
mtsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mtsdr (sdr_pfc1, sdr0_pfc1);
|
||||
} else {
|
||||
sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_ENABLE;
|
||||
switch (group)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
/* CPU trace A */
|
||||
out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
|
||||
FPGA_REG2_EXT_INTFACE_ENABLE);
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
|
||||
mtsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mtsdr (sdr_pfc1, sdr0_pfc1);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
/* CPU trace B - Over EBMI */
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_CPUTRACE;
|
||||
mtsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mtsdr (sdr_pfc1, sdr0_pfc1);
|
||||
out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
|
||||
FPGA_REG2_EXT_INTFACE_DISABLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the ethernet specific functions in the fpga */
|
||||
mfsdr(sdr_pfc1, sdr0_pfc1);
|
||||
mfsdr(sdr_cust0, sdr0_cust0);
|
||||
if ( (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) == 4) &&
|
||||
((SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII) ||
|
||||
(SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_TBI)))
|
||||
{
|
||||
if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
|
||||
FPGA_REG3_ENET_GROUP7);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII)
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
|
||||
FPGA_REG3_ENET_GROUP7);
|
||||
}
|
||||
else
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
|
||||
FPGA_REG3_ENET_GROUP8);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
|
||||
FPGA_REG3_ENET_ENCODE1(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
|
||||
FPGA_REG3_ENET_ENCODE2(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
|
||||
}
|
||||
}
|
||||
out8(FPGA_REG4, FPGA_REG4_GPHY_MODE10 |
|
||||
FPGA_REG4_GPHY_MODE100 | FPGA_REG4_GPHY_MODE1000 |
|
||||
FPGA_REG4_GPHY_FRC_DPLX | FPGA_REG4_CONNECT_PHYS);
|
||||
|
||||
/* reset the gigabyte phy if necessary */
|
||||
if (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) >= 3)
|
||||
{
|
||||
if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
|
||||
{
|
||||
out8(FPGA_REG3, in8(FPGA_REG3) & ~FPGA_REG3_GIGABIT_RESET_DISABLE);
|
||||
udelay(10000);
|
||||
out8(FPGA_REG3, in8(FPGA_REG3) | FPGA_REG3_GIGABIT_RESET_DISABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
out8(FPGA_REG2, in8(FPGA_REG2) & ~FPGA_REG2_GIGABIT_RESET_DISABLE);
|
||||
udelay(10000);
|
||||
out8(FPGA_REG2, in8(FPGA_REG2) | FPGA_REG2_GIGABIT_RESET_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn off the LED's */
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_STAT_MASK) |
|
||||
FPGA_REG3_STAT_LED8_DISAB | FPGA_REG3_STAT_LED4_DISAB |
|
||||
FPGA_REG3_STAT_LED2_DISAB | FPGA_REG3_STAT_LED1_DISAB);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#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(void)
|
||||
{
|
||||
|
||||
return (ctrlc());
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* Board specific FPGA stuff ... */
|
||||
#define FPGA_REG0 (CFG_FPGA_BASE + 0x00)
|
||||
#define FPGA_REG0_SSCG_MASK 0x80
|
||||
#define FPGA_REG0_SSCG_DISABLE 0x00
|
||||
#define FPGA_REG0_SSCG_ENABLE 0x80
|
||||
#define FPGA_REG0_BOOT_MASK 0x40
|
||||
#define FPGA_REG0_BOOT_LARGE_FLASH 0x00
|
||||
#define FPGA_REG0_BOOT_SMALL_FLASH 0x40
|
||||
#define FPGA_REG0_ECLS_MASK 0x38 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_0 0x20 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_1 0x10 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_2 0x08 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER1 0x00 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER3 0x08 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER4 0x10 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER5 0x18 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER2 0x20 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER6 0x28 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER7 0x30 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER8 0x38 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ARBITER_MASK 0x04
|
||||
#define FPGA_REG0_ARBITER_EXT 0x00
|
||||
#define FPGA_REG0_ARBITER_INT 0x04
|
||||
#define FPGA_REG0_ONBOARD_FLASH_MASK 0x02
|
||||
#define FPGA_REG0_ONBOARD_FLASH_ENABLE 0x00
|
||||
#define FPGA_REG0_ONBOARD_FLASH_DISABLE 0x02
|
||||
#define FPGA_REG0_FLASH 0x01
|
||||
#define FPGA_REG1 (CFG_FPGA_BASE + 0x01)
|
||||
#define FPGA_REG1_9772_FSELFBX_MASK 0x80
|
||||
#define FPGA_REG1_9772_FSELFBX_6 0x00
|
||||
#define FPGA_REG1_9772_FSELFBX_10 0x80
|
||||
#define FPGA_REG1_9531_SX_MASK 0x60
|
||||
#define FPGA_REG1_9531_SX_33MHZ 0x00
|
||||
#define FPGA_REG1_9531_SX_100MHZ 0x20
|
||||
#define FPGA_REG1_9531_SX_66MHZ 0x40
|
||||
#define FPGA_REG1_9531_SX_133MHZ 0x60
|
||||
#define FPGA_REG1_9772_FSELBX_MASK 0x18
|
||||
#define FPGA_REG1_9772_FSELBX_4 0x00
|
||||
#define FPGA_REG1_9772_FSELBX_6 0x08
|
||||
#define FPGA_REG1_9772_FSELBX_8 0x10
|
||||
#define FPGA_REG1_9772_FSELBX_10 0x18
|
||||
#define FPGA_REG1_SOURCE_MASK 0x07
|
||||
#define FPGA_REG1_SOURCE_TC 0x00
|
||||
#define FPGA_REG1_SOURCE_66MHZ 0x01
|
||||
#define FPGA_REG1_SOURCE_50MHZ 0x02
|
||||
#define FPGA_REG1_SOURCE_33MHZ 0x03
|
||||
#define FPGA_REG1_SOURCE_25MHZ 0x04
|
||||
#define FPGA_REG1_SOURCE_SSDIV1 0x05
|
||||
#define FPGA_REG1_SOURCE_SSDIV2 0x06
|
||||
#define FPGA_REG1_SOURCE_SSDIV4 0x07
|
||||
#define FPGA_REG2 (CFG_FPGA_BASE + 0x02)
|
||||
#define FPGA_REG2_TC0 0x80
|
||||
#define FPGA_REG2_TC1 0x40
|
||||
#define FPGA_REG2_TC2 0x20
|
||||
#define FPGA_REG2_TC3 0x10
|
||||
#define FPGA_REG2_GIGABIT_RESET_DISABLE 0x08 /*Use on Ocotea pass 2 boards*/
|
||||
#define FPGA_REG2_EXT_INTFACE_MASK 0x04
|
||||
#define FPGA_REG2_EXT_INTFACE_ENABLE 0x00
|
||||
#define FPGA_REG2_EXT_INTFACE_DISABLE 0x04
|
||||
#define FPGA_REG2_DEFAULT_UART1_N 0x01
|
||||
#define FPGA_REG3 (CFG_FPGA_BASE + 0x03)
|
||||
#define FPGA_REG3_GIGABIT_RESET_DISABLE 0x80 /*Use on Ocotea pass 1 boards*/
|
||||
#define FPGA_REG3_ENET_MASK1 0x70 /*Use on Ocotea pass 1 boards*/
|
||||
#define FPGA_REG3_ENET_MASK2 0xF0 /*Use on Ocotea pass 2 boards*/
|
||||
#define FPGA_REG3_ENET_GROUP0 0x00
|
||||
#define FPGA_REG3_ENET_GROUP1 0x10
|
||||
#define FPGA_REG3_ENET_GROUP2 0x20
|
||||
#define FPGA_REG3_ENET_GROUP3 0x30
|
||||
#define FPGA_REG3_ENET_GROUP4 0x40
|
||||
#define FPGA_REG3_ENET_GROUP5 0x50
|
||||
#define FPGA_REG3_ENET_GROUP6 0x60
|
||||
#define FPGA_REG3_ENET_GROUP7 0x70
|
||||
#define FPGA_REG3_ENET_GROUP8 0x80 /*Use on Ocotea pass 2 boards*/
|
||||
#define FPGA_REG3_ENET_ENCODE1(n) ((((unsigned long)(n))&0x07)<<4) /*pass1*/
|
||||
#define FPGA_REG3_ENET_DECODE1(n) ((((unsigned long)(n))>>4)&0x07) /*pass1*/
|
||||
#define FPGA_REG3_ENET_ENCODE2(n) ((((unsigned long)(n))&0x0F)<<4) /*pass2*/
|
||||
#define FPGA_REG3_ENET_DECODE2(n) ((((unsigned long)(n))>>4)&0x0F) /*pass2*/
|
||||
#define FPGA_REG3_STAT_MASK 0x0F
|
||||
#define FPGA_REG3_STAT_LED8_ENAB 0x08
|
||||
#define FPGA_REG3_STAT_LED4_ENAB 0x04
|
||||
#define FPGA_REG3_STAT_LED2_ENAB 0x02
|
||||
#define FPGA_REG3_STAT_LED1_ENAB 0x01
|
||||
#define FPGA_REG3_STAT_LED8_DISAB 0x00
|
||||
#define FPGA_REG3_STAT_LED4_DISAB 0x00
|
||||
#define FPGA_REG3_STAT_LED2_DISAB 0x00
|
||||
#define FPGA_REG3_STAT_LED1_DISAB 0x00
|
||||
#define FPGA_REG4 (CFG_FPGA_BASE + 0x04)
|
||||
#define FPGA_REG4_GPHY_MODE10 0x80
|
||||
#define FPGA_REG4_GPHY_MODE100 0x40
|
||||
#define FPGA_REG4_GPHY_MODE1000 0x20
|
||||
#define FPGA_REG4_GPHY_FRC_DPLX 0x10
|
||||
#define FPGA_REG4_GPHY_ANEG_DIS 0x08
|
||||
#define FPGA_REG4_CONNECT_PHYS 0x04
|
||||
|
||||
|
||||
#define SDR0_CUST0_ENET3_MASK 0x00000080
|
||||
#define SDR0_CUST0_ENET3_COPPER 0x00000000
|
||||
#define SDR0_CUST0_ENET3_FIBER 0x00000080
|
||||
#define SDR0_CUST0_RGMII3_MASK 0x00000070
|
||||
#define SDR0_CUST0_RGMII3_ENCODE(n) ((((unsigned long)(n))&0x7)<<4)
|
||||
#define SDR0_CUST0_RGMII3_DECODE(n) ((((unsigned long)(n))>>4)&0x07)
|
||||
#define SDR0_CUST0_RGMII3_DISAB 0x00000000
|
||||
#define SDR0_CUST0_RGMII3_RTBI 0x00000040
|
||||
#define SDR0_CUST0_RGMII3_RGMII 0x00000050
|
||||
#define SDR0_CUST0_RGMII3_TBI 0x00000060
|
||||
#define SDR0_CUST0_RGMII3_GMII 0x00000070
|
||||
#define SDR0_CUST0_ENET2_MASK 0x00000008
|
||||
#define SDR0_CUST0_ENET2_COPPER 0x00000000
|
||||
#define SDR0_CUST0_ENET2_FIBER 0x00000008
|
||||
#define SDR0_CUST0_RGMII2_MASK 0x00000007
|
||||
#define SDR0_CUST0_RGMII2_ENCODE(n) ((((unsigned long)(n))&0x7)<<0)
|
||||
#define SDR0_CUST0_RGMII2_DECODE(n) ((((unsigned long)(n))>>0)&0x07)
|
||||
#define SDR0_CUST0_RGMII2_DISAB 0x00000000
|
||||
#define SDR0_CUST0_RGMII2_RTBI 0x00000004
|
||||
#define SDR0_CUST0_RGMII2_RGMII 0x00000005
|
||||
#define SDR0_CUST0_RGMII2_TBI 0x00000006
|
||||
#define SDR0_CUST0_RGMII2_GMII 0x00000007
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* 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
|
||||
{
|
||||
.resetvec 0xFFFFFFFC :
|
||||
{
|
||||
*(.resetvec)
|
||||
} = 0xffff
|
||||
|
||||
.bootpg 0xFFFFF000 :
|
||||
{
|
||||
cpu/ppc4xx/start.o (.bootpg)
|
||||
} = 0xffff
|
||||
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/ppc4xx/start.o (.text)
|
||||
board/ocotea/init.o (.text)
|
||||
cpu/ppc4xx/kgdb.o (.text)
|
||||
cpu/ppc4xx/traps.o (.text)
|
||||
cpu/ppc4xx/interrupts.o (.text)
|
||||
cpu/ppc4xx/serial.o (.text)
|
||||
cpu/ppc4xx/cpu_init.o (.text)
|
||||
cpu/ppc4xx/speed.o (.text)
|
||||
cpu/ppc4xx/440gx_enet.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
/* . = env_offset;*/
|
||||
/* common/environment.o(.text)*/
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_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(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* (C) Copyright 2002-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/ppc4xx/start.o (.text)
|
||||
board/ocotea/init.o (.text)
|
||||
cpu/ppc4xx/kgdb.o (.text)
|
||||
cpu/ppc4xx/traps.o (.text)
|
||||
cpu/ppc4xx/interrupts.o (.text)
|
||||
cpu/ppc4xx/serial.o (.text)
|
||||
cpu/ppc4xx/cpu_init.o (.text)
|
||||
cpu/ppc4xx/speed.o (.text)
|
||||
cpu/ppc4xx/440gx_enet.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
/* common/environment.o(.text) */
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.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(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
#
|
||||
# (C) Copyright 2003-2004
|
||||
# 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
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# (C) Copyright 2003-2004
|
||||
# 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
|
||||
#
|
||||
|
||||
#
|
||||
# PM520 board
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xfff00000
|
||||
# TEXT_BASE = 0x00100000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
|
||||
@@ -0,0 +1,545 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* 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 <linux/byteorder/swab.h>
|
||||
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#define FLASH_PORT_WIDTH32
|
||||
#undef FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) (x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) (x)
|
||||
#endif
|
||||
|
||||
/* Intel-compatible flash ID */
|
||||
#define INTEL_COMPAT 0x00890089
|
||||
#define INTEL_ALT 0x00B000B0
|
||||
|
||||
/* Intel-compatible flash commands */
|
||||
#define INTEL_PROGRAM 0x00100010
|
||||
#define INTEL_ERASE 0x00200020
|
||||
#define INTEL_CLEAR 0x00500050
|
||||
#define INTEL_LOCKBIT 0x00600060
|
||||
#define INTEL_PROTECT 0x00010001
|
||||
#define INTEL_STATUS 0x00700070
|
||||
#define INTEL_READID 0x00900090
|
||||
#define INTEL_CONFIRM 0x00D000D0
|
||||
#define INTEL_RESET 0xFFFFFFFF
|
||||
|
||||
/* Intel-compatible flash status bits */
|
||||
#define INTEL_FINISHED 0x00800080
|
||||
#define INTEL_OK 0x00800080
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size (FPW *addr, flash_info_t *info);
|
||||
static int write_data (flash_info_t *info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
void inline spin_wheel (void);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) CFG_FLASH_BASE, &flash_info[i]);
|
||||
flash_get_offsets (CFG_FLASH_BASE, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured to many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + monitor_flash_len - 1,
|
||||
&flash_info[0] );
|
||||
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0] );
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F128J3A:
|
||||
printf ("28F128J3A\n");
|
||||
break;
|
||||
|
||||
case FLASH_28F640J3A:
|
||||
printf ("28F640J3A\n");
|
||||
break;
|
||||
|
||||
case FLASH_28F320J3A:
|
||||
printf ("28F320J3A\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW *addr, flash_info_t *info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_ID_28F128J3A:
|
||||
info->flash_id += FLASH_28F128J3A;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
case (FPW) INTEL_ID_28F640J3A:
|
||||
info->flash_id += FLASH_28F640J3A;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 16 MB */
|
||||
|
||||
case (FPW) INTEL_ID_28F320J3A:
|
||||
info->flash_id += FLASH_28F320J3A;
|
||||
info->sector_count = 32;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, 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;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
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");
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
start = get_timer(0);
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
*addr = (FPW) 0x00200020; /* erase setup */
|
||||
*addr = (FPW) 0x00D000D0; /* erase confirm */
|
||||
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer(start) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
*addr = (FPW) 0x00B000B0; /* suspend erase */
|
||||
*addr = (FPW) 0x00FF00FF; /* reset to read mode */
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*addr = 0x00500050; /* clear status register cmd. */
|
||||
*addr = 0x00FF00FF; /* resest to read mode */
|
||||
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t *info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%lx)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
start = get_timer(0);
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Set/Clear sector's lock bit, returns:
|
||||
* 0 - OK
|
||||
* 1 - Error (timeout, voltage problems, etc.)
|
||||
*/
|
||||
int flash_real_protect(flash_info_t *info, long sector, int prot)
|
||||
{
|
||||
ulong start;
|
||||
int i;
|
||||
int rc = 0;
|
||||
vu_long *addr = (vu_long *)(info->start[sector]);
|
||||
int flag = disable_interrupts();
|
||||
|
||||
*addr = INTEL_CLEAR; /* Clear status register */
|
||||
if (prot) { /* Set sector lock bit */
|
||||
*addr = INTEL_LOCKBIT; /* Sector lock bit */
|
||||
*addr = INTEL_PROTECT; /* set */
|
||||
}
|
||||
else { /* Clear sector lock bit */
|
||||
*addr = INTEL_LOCKBIT; /* All sectors lock bits */
|
||||
*addr = INTEL_CONFIRM; /* clear */
|
||||
}
|
||||
|
||||
start = get_timer(0);
|
||||
|
||||
while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
|
||||
if (get_timer(start) > CFG_FLASH_UNLOCK_TOUT) {
|
||||
printf("Flash lock bit operation timed out\n");
|
||||
rc = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*addr != INTEL_OK) {
|
||||
printf("Flash lock bit operation failed at %08X, CSR=%08X\n",
|
||||
(uint)addr, (uint)*addr);
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
info->protect[sector] = prot;
|
||||
|
||||
/*
|
||||
* Clear lock bit command clears all sectors lock bits, so
|
||||
* we have to restore lock bits of protected sectors.
|
||||
*/
|
||||
if (!prot)
|
||||
{
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
if (info->protect[i])
|
||||
{
|
||||
start = get_timer(0);
|
||||
addr = (vu_long *)(info->start[i]);
|
||||
*addr = INTEL_LOCKBIT; /* Sector lock bit */
|
||||
*addr = INTEL_PROTECT; /* set */
|
||||
while ((*addr & INTEL_FINISHED) != INTEL_FINISHED)
|
||||
{
|
||||
if (get_timer(start) > CFG_FLASH_UNLOCK_TOUT)
|
||||
{
|
||||
printf("Flash lock bit operation timed out\n");
|
||||
rc = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
*addr = INTEL_RESET; /* Reset to read array mode */
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* (C) Copyright 2003-2004
|
||||
* 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>
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
static long int dram_size(long int *base, long int maxsize)
|
||||
{
|
||||
volatile long int *addr;
|
||||
ulong cnt, val;
|
||||
ulong save[32]; /* to make test non-destructive */
|
||||
unsigned char i = 0;
|
||||
|
||||
for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) {
|
||||
addr = base + cnt; /* pointer arith! */
|
||||
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
/* write 0 to base address */
|
||||
addr = base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
/* check at base address */
|
||||
if ((val = *addr) != 0) {
|
||||
*addr = save[i];
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
|
||||
addr = base + cnt; /* pointer arith! */
|
||||
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
|
||||
if (val != (~cnt)) {
|
||||
return (cnt * sizeof (long));
|
||||
}
|
||||
}
|
||||
return (maxsize);
|
||||
}
|
||||
|
||||
static void sdram_start (int hi_addr)
|
||||
{
|
||||
long hi_addr_bit = hi_addr ? 0x01000000 : 0;
|
||||
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0000 | hi_addr_bit;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0002 | hi_addr_bit;
|
||||
/* set mode register */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x408d0000;
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
#endif
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0002 | hi_addr_bit;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0004 | hi_addr_bit;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x504f0000 | hi_addr_bit;
|
||||
}
|
||||
#endif
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
ulong dramsize = 0;
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong test1, test2;
|
||||
|
||||
/* configure SDRAM start/end */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e;/* 2G at 0x0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;/* disabled */
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xc2233a00;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x88b70004;
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = 0x0000ffff;/* 2G */
|
||||
*(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;
|
||||
#endif
|
||||
sdram_start(0);
|
||||
test1 = dram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
sdram_start(1);
|
||||
test2 = dram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
if (test1 > test2) {
|
||||
sdram_start(0);
|
||||
dramsize = test1;
|
||||
} else {
|
||||
dramsize = test2;
|
||||
}
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG =
|
||||
(0x13 + __builtin_ffs(dramsize >> 20) - 1);
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = ((dramsize - 1) >> 15);
|
||||
#endif
|
||||
|
||||
#else
|
||||
#ifdef CONFIG_MGT5100
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
dramsize = ((*(vu_long *)MPC5XXX_SDRAM_STOP + 1) << 15);
|
||||
#else
|
||||
dramsize = ((1 << (*(vu_long *)MPC5XXX_SDRAM_CS0CFG - 0x13)) << 20);
|
||||
#endif
|
||||
#endif /* CFG_RAMBOOT */
|
||||
/* return total ram size */
|
||||
return dramsize;
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
#if defined(CONFIG_MPC5200)
|
||||
puts ("Board: MicroSys PM520 \n");
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
puts ("Board: MicroSys PM510 \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 */
|
||||
}
|
||||
|
||||
void flash_afterinit(ulong size)
|
||||
{
|
||||
if (size == 0x800000) { /* adjust mapping */
|
||||
*(vu_long *)MPC5XXX_BOOTCS_START = *(vu_long *)MPC5XXX_CS0_START =
|
||||
START_REG(CFG_BOOTCS_START | size);
|
||||
*(vu_long *)MPC5XXX_BOOTCS_STOP = *(vu_long *)MPC5XXX_CS0_STOP =
|
||||
STOP_REG(CFG_BOOTCS_START | size, size);
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* (C) Copyright 2003-2004
|
||||
* 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 = .);
|
||||
}
|
||||
+8
-13
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# (C) Copyright 2001, 2002
|
||||
# (C) Copyright 2001-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
@@ -22,21 +22,16 @@
|
||||
#
|
||||
|
||||
#
|
||||
# PM826 boards
|
||||
# MicroSys PM826 board:
|
||||
#
|
||||
|
||||
# This should be equal to the CFG_FLASH_BASE or
|
||||
# CFG_BOOTROM_BASE define in config_PM826.h
|
||||
# for the "final" configuration, with U-Boot
|
||||
# in flash, or the address in RAM where
|
||||
# U-Boot is loaded at for debugging.
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_BOOT_ROM),y)
|
||||
TEXT_BASE := 0xFF800000
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_BOOT_ROM
|
||||
else
|
||||
TEXT_BASE := 0xFF000000
|
||||
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
|
||||
|
||||
ifndef TEXT_BASE
|
||||
## Standard: boot 64-bit flash
|
||||
TEXT_BASE = 0xFF000000
|
||||
|
||||
endif
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
|
||||
+11
-2
@@ -69,6 +69,11 @@ ulong flash_get_size (volatile unsigned long *baseaddr,
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00800000; /* 4 * 2 MB = 8 MB */
|
||||
break;
|
||||
case INTEL_ID_28F640C3B:
|
||||
info->flash_id = FLASH_28F640C3B;
|
||||
info->sector_count = 135;
|
||||
info->size = 0x02000000; /* 16 * 2 MB = 32 MB */
|
||||
break;
|
||||
default:
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
@@ -79,10 +84,11 @@ ulong flash_get_size (volatile unsigned long *baseaddr,
|
||||
volatile unsigned long *tmp = baseaddr;
|
||||
|
||||
/* set up sector start adress table (bottom sector type)
|
||||
* AND unlock the sectors (if our chip is 160C3)
|
||||
* AND unlock the sectors (if our chip is 160C3 or 640C3)
|
||||
*/
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_28F160C3B) {
|
||||
if (((info->flash_id & FLASH_TYPEMASK) == FLASH_28F160C3B) ||
|
||||
((info->flash_id & FLASH_TYPEMASK) == FLASH_28F640C3B)) {
|
||||
tmp[0] = 0x00600060;
|
||||
tmp[1] = 0x00600060;
|
||||
tmp[0] = 0x00D000D0;
|
||||
@@ -177,6 +183,9 @@ void flash_print_info (flash_info_t * info)
|
||||
case FLASH_28F160F3B:
|
||||
printf ("28F160F3B (16 M, bottom sector)\n");
|
||||
break;
|
||||
case FLASH_28F640C3B:
|
||||
printf ("28F640C3B (64 M, bottom sector)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2001-2004
|
||||
# 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): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# (C) Copyright 2003-2004
|
||||
# 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
|
||||
#
|
||||
|
||||
#
|
||||
# MicroSys PM828 board:
|
||||
#
|
||||
|
||||
|
||||
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
|
||||
|
||||
ifndef TEXT_BASE
|
||||
## Standard: boot 64-bit flash
|
||||
TEXT_BASE = 0x40000000
|
||||
|
||||
endif
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
|
||||
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* Flash Routines for Intel devices
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
* 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 <mpc8xx.h>
|
||||
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
ulong flash_get_size (volatile unsigned long *baseaddr,
|
||||
flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
unsigned long flashtest_h, flashtest_l;
|
||||
|
||||
info->sector_count = info->size = 0;
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* Write query command sequence and test FLASH answer
|
||||
*/
|
||||
baseaddr[0] = 0x00980098;
|
||||
baseaddr[1] = 0x00980098;
|
||||
|
||||
flashtest_h = baseaddr[0]; /* manufacturer ID */
|
||||
flashtest_l = baseaddr[1];
|
||||
|
||||
if (flashtest_h != INTEL_MANUFACT || flashtest_l != INTEL_MANUFACT)
|
||||
return (0); /* no or unknown flash */
|
||||
|
||||
flashtest_h = baseaddr[2]; /* device ID */
|
||||
flashtest_l = baseaddr[3];
|
||||
|
||||
if (flashtest_h != flashtest_l)
|
||||
return (0);
|
||||
|
||||
switch (flashtest_h) {
|
||||
case INTEL_ID_28F160C3B:
|
||||
info->flash_id = FLASH_28F160C3B;
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00800000; /* 4 * 2 MB = 8 MB */
|
||||
break;
|
||||
case INTEL_ID_28F160F3B:
|
||||
info->flash_id = FLASH_28F160F3B;
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00800000; /* 4 * 2 MB = 8 MB */
|
||||
break;
|
||||
case INTEL_ID_28F640C3B:
|
||||
info->flash_id = FLASH_28F640C3B;
|
||||
info->sector_count = 135;
|
||||
info->size = 0x02000000; /* 16 * 2 MB = 32 MB */
|
||||
break;
|
||||
default:
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
info->flash_id |= INTEL_MANUFACT << 16; /* set manufacturer offset */
|
||||
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
volatile unsigned long *tmp = baseaddr;
|
||||
|
||||
/* set up sector start adress table (bottom sector type)
|
||||
* AND unlock the sectors (if our chip is 160C3 or 640c3)
|
||||
*/
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (((info->flash_id & FLASH_TYPEMASK) == FLASH_28F160C3B) ||
|
||||
((info->flash_id & FLASH_TYPEMASK) == FLASH_28F640C3B)) {
|
||||
tmp[0] = 0x00600060;
|
||||
tmp[1] = 0x00600060;
|
||||
tmp[0] = 0x00D000D0;
|
||||
tmp[1] = 0x00D000D0;
|
||||
}
|
||||
info->start[i] = (uint) tmp;
|
||||
tmp += i < 8 ? 0x2000 : 0x10000; /* pointer arith */
|
||||
}
|
||||
}
|
||||
|
||||
memset (info->protect, 0, info->sector_count);
|
||||
|
||||
baseaddr[0] = 0x00FF00FF;
|
||||
baseaddr[1] = 0x00FF00FF;
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0 = 0;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known
|
||||
*/
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here (only one bank) */
|
||||
|
||||
size_b0 = flash_get_size ((ulong *) CFG_FLASH0_BASE, &flash_info[0]);
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN || size_b0 == 0) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
|
||||
size_b0, size_b0 >> 20);
|
||||
}
|
||||
|
||||
/* protect monitor and environment sectors
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_BOOT_ROM
|
||||
/* If U-Boot is booted from ROM the CFG_MONITOR_BASE > CFG_FLASH0_BASE
|
||||
* but we shouldn't protect it.
|
||||
*/
|
||||
|
||||
# if CFG_MONITOR_BASE >= CFG_FLASH0_BASE
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + monitor_flash_len - 1, &flash_info[0]
|
||||
);
|
||||
# endif
|
||||
#endif /* CONFIG_BOOT_ROM */
|
||||
|
||||
#if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
|
||||
#endif
|
||||
|
||||
return (size_b0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((info->flash_id >> 16) & 0xff) {
|
||||
case 0x89:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F160C3B:
|
||||
printf ("28F160C3B (16 M, bottom sector)\n");
|
||||
break;
|
||||
case FLASH_28F160F3B:
|
||||
printf ("28F160F3B (16 M, bottom sector)\n");
|
||||
break;
|
||||
case FLASH_28F640C3B:
|
||||
printf ("28F640C3B (64 M, bottom sector)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect])
|
||||
prot++;
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/* Start erase on unprotected sectors
|
||||
*/
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
volatile ulong *addr =
|
||||
(volatile unsigned long *) info->start[sect];
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
if (info->protect[sect] == 0) {
|
||||
/* Disable interrupts which might cause a timeout here
|
||||
*/
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Erase the block
|
||||
*/
|
||||
addr[0] = 0x00200020;
|
||||
addr[1] = 0x00200020;
|
||||
addr[0] = 0x00D000D0;
|
||||
addr[1] = 0x00D000D0;
|
||||
|
||||
/* re-enable interrupts if necessary
|
||||
*/
|
||||
if (flag)
|
||||
enable_interrupts ();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms
|
||||
*/
|
||||
udelay (1000);
|
||||
|
||||
last = start;
|
||||
while ((addr[0] & 0x00800080) != 0x00800080 ||
|
||||
(addr[1] & 0x00800080) != 0x00800080) {
|
||||
if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout (erase suspended!)\n");
|
||||
/* Suspend erase
|
||||
*/
|
||||
addr[0] = 0x00B000B0;
|
||||
addr[1] = 0x00B000B0;
|
||||
goto DONE;
|
||||
}
|
||||
/* show that we're waiting
|
||||
*/
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
serial_putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
if (addr[0] & 0x00220022 || addr[1] & 0x00220022) {
|
||||
printf ("*** ERROR: erase failed!\n");
|
||||
goto DONE;
|
||||
}
|
||||
}
|
||||
/* Clear status register and reset to read mode
|
||||
*/
|
||||
addr[0] = 0x00500050;
|
||||
addr[1] = 0x00500050;
|
||||
addr[0] = 0x00FF00FF;
|
||||
addr[1] = 0x00FF00FF;
|
||||
}
|
||||
|
||||
printf (" done\n");
|
||||
|
||||
DONE:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_word (flash_info_t *, volatile unsigned long *, ulong);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* 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)
|
||||
{
|
||||
ulong v;
|
||||
int i, l, cc = cnt, res = 0;
|
||||
|
||||
|
||||
for (v=0; cc > 0; addr += 4, cc -= 4 - l) {
|
||||
l = (addr & 3);
|
||||
addr &= ~3;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
v = (v << 8) + (i < l || i - l >= cc ?
|
||||
*((unsigned char *) addr + i) : *src++);
|
||||
}
|
||||
|
||||
if ((res = write_word (info, (volatile unsigned long *) addr, v)) != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word (flash_info_t * info, volatile unsigned long *addr,
|
||||
ulong data)
|
||||
{
|
||||
int flag, res = 0;
|
||||
ulong start;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased
|
||||
*/
|
||||
if ((*addr & data) != data)
|
||||
return (2);
|
||||
|
||||
/* Disable interrupts which might cause a timeout here
|
||||
*/
|
||||
flag = disable_interrupts ();
|
||||
|
||||
*addr = 0x00400040;
|
||||
*addr = data;
|
||||
|
||||
/* re-enable interrupts if necessary
|
||||
*/
|
||||
if (flag)
|
||||
enable_interrupts ();
|
||||
|
||||
start = get_timer (0);
|
||||
while ((*addr & 0x00800080) != 0x00800080) {
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
/* Suspend program
|
||||
*/
|
||||
*addr = 0x00B000B0;
|
||||
res = 1;
|
||||
goto OUT;
|
||||
}
|
||||
}
|
||||
|
||||
if (*addr & 0x00220022) {
|
||||
printf ("*** ERROR: program failed!\n");
|
||||
res = 1;
|
||||
}
|
||||
|
||||
OUT:
|
||||
/* Clear status register and reset to read mode
|
||||
*/
|
||||
*addr = 0x00500050;
|
||||
*addr = 0x00FF00FF;
|
||||
|
||||
return (res);
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* (C) Copyright 2001-2004
|
||||
* 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 <ioports.h>
|
||||
#include <mpc8260.h>
|
||||
#include <pci.h>
|
||||
|
||||
/*
|
||||
* I/O Port configuration table
|
||||
*
|
||||
* if conf is 1, then that port pin will be configured at boot time
|
||||
* according to the five values podr/pdir/ppar/psor/pdat for that entry
|
||||
*/
|
||||
|
||||
const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port A configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 COL */
|
||||
/* PA30 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 CRS */
|
||||
/* PA29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 TXER */
|
||||
/* PA28 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 TXEN */
|
||||
/* PA27 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 RXDV */
|
||||
/* PA26 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 RXER */
|
||||
/* PA25 */ { 0, 0, 0, 1, 0, 0 }, /* PA25 */
|
||||
/* PA24 */ { 0, 0, 0, 1, 0, 0 }, /* PA24 */
|
||||
/* PA23 */ { 0, 0, 0, 1, 0, 0 }, /* PA23 */
|
||||
/* PA22 */ { 0, 0, 0, 1, 0, 0 }, /* PA22 */
|
||||
/* PA21 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD3 */
|
||||
/* PA20 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD2 */
|
||||
/* PA19 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD1 */
|
||||
/* PA18 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 TXD0 */
|
||||
/* PA17 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD0 */
|
||||
/* PA16 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD1*/
|
||||
/* PA15 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD2 */
|
||||
/* PA14 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXD3 */
|
||||
/* PA13 */ { 0, 0, 0, 1, 0, 0 }, /* PA13 */
|
||||
/* PA12 */ { 0, 0, 0, 1, 0, 0 }, /* PA12 */
|
||||
/* PA11 */ { 0, 0, 0, 1, 0, 0 }, /* PA11 */
|
||||
/* PA10 */ { 0, 0, 0, 1, 0, 0 }, /* PA10 */
|
||||
/* PA9 */ { 0, 1, 0, 1, 0, 0 }, /* PA9 */
|
||||
/* PA8 */ { 0, 1, 0, 0, 0, 0 }, /* PA8 */
|
||||
/* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 0, 0, 0, 1, 0, 0 }, /* PA6 */
|
||||
/* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
|
||||
/* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
|
||||
/* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
|
||||
/* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 0, 0, 0, 1, 0, 0 }, /* PA1 */
|
||||
/* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
|
||||
},
|
||||
|
||||
/* Port B configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 TX_ER */
|
||||
/* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RX_DV */
|
||||
/* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 TX_EN */
|
||||
#if defined(CONFIG_ETHER_ON_SCC) && (CONFIG_ETHER_INDEX == 1)
|
||||
#ifdef CONFIG_ETHER_ON_FCC2
|
||||
#error "SCC1 conflicts with FCC2"
|
||||
#endif
|
||||
/* PB28 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 TXD */
|
||||
#else
|
||||
/* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RX_ER */
|
||||
#endif
|
||||
/* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 COL */
|
||||
/* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 CRS */
|
||||
/* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 TxD[3] */
|
||||
/* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 TxD[2] */
|
||||
/* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 TxD[1] */
|
||||
/* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 TxD[0] */
|
||||
/* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RxD[0] */
|
||||
/* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RxD[1] */
|
||||
/* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RxD[2] */
|
||||
/* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RxD[3] */
|
||||
/* PB17 */ { 0, 0, 0, 0, 0, 0 }, /* PB17 */
|
||||
/* PB16 */ { 0, 0, 0, 0, 0, 0 }, /* PB16 */
|
||||
/* PB15 */ { 1, 1, 0, 0, 0, 0 }, /* SCC2 RXD */
|
||||
/* PB14 */ { 1, 1, 0, 0, 0, 0 }, /* SCC3 RXD */
|
||||
/* PB13 */ { 0, 0, 0, 0, 0, 0 }, /* PB13 */
|
||||
/* PB12 */ { 0, 0, 0, 0, 0, 0 }, /* PB12 */
|
||||
/* PB11 */ { 0, 0, 0, 0, 0, 0 }, /* PB11 */
|
||||
/* PB10 */ { 0, 0, 0, 0, 0, 0 }, /* PB10 */
|
||||
/* PB9 */ { 0, 0, 0, 0, 0, 0 }, /* PB9 */
|
||||
/* PB8 */ { 1, 1, 1, 1, 0, 0 }, /* SCC3 TXD */
|
||||
/* PB7 */ { 0, 0, 0, 0, 0, 0 }, /* PB7 */
|
||||
/* PB6 */ { 0, 0, 0, 0, 0, 0 }, /* PB6 */
|
||||
/* PB5 */ { 0, 0, 0, 0, 0, 0 }, /* PB5 */
|
||||
/* PB4 */ { 0, 0, 0, 0, 0, 0 }, /* PB4 */
|
||||
/* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
},
|
||||
|
||||
/* Port C */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 CTS */
|
||||
/* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* SCC2 CTS */
|
||||
/* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* PC27 */
|
||||
/* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
|
||||
/* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
|
||||
/* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
|
||||
/* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* PC23 */
|
||||
/* PC22 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 TXCK */
|
||||
/* PC21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 RXCK */
|
||||
/* PC20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 TXCK(2) */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 RXCK */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 TXCK */
|
||||
/* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 0, 0, 1, 0, 0 }, /* PC16 */
|
||||
/* PC15 */ { 1, 1, 0, 1, 0, 0 }, /* SMC2 TXD */
|
||||
/* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 DCD */
|
||||
/* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
|
||||
/* PC12 */ { 0, 0, 0, 1, 0, 0 }, /* SCC2 DCD */
|
||||
/* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* SCC3 CTS */
|
||||
/* PC10 */ { 0, 0, 0, 1, 0, 0 }, /* SCC3 DCD */
|
||||
/* PC9 */ { 0, 0, 0, 1, 0, 0 }, /* SCC4 CTS */
|
||||
/* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* SCC4 DCD */
|
||||
/* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
|
||||
/* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
|
||||
/* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
|
||||
/* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
|
||||
/* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
|
||||
/* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* PC2 */
|
||||
/* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* PC1 */
|
||||
/* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* PC0 */
|
||||
},
|
||||
|
||||
/* Port D */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 RXD */
|
||||
/* PD30 */ { 0, 1, 1, 1, 0, 0 }, /* PD30 */
|
||||
/* PD29 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 RTS */
|
||||
/* PD28 */ { 0, 0, 0, 1, 0, 0 }, /* PD28 */
|
||||
/* PD27 */ { 0, 1, 0, 1, 0, 0 }, /* SCC2 RTS */
|
||||
/* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
|
||||
/* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
|
||||
/* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
|
||||
/* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* SCC3 RTS */
|
||||
/* PD22 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4 RXD */
|
||||
/* PD21 */ { 1, 1, 0, 1, 0, 0 }, /* SCC4 TXD */
|
||||
/* PD20 */ { 0, 0, 1, 1, 0, 0 }, /* SCC4 RTS */
|
||||
/* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
|
||||
/* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
|
||||
/* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* PD17 */
|
||||
/* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* PD16 */
|
||||
#if defined(CONFIG_SOFT_I2C)
|
||||
/* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */
|
||||
#else
|
||||
#if defined(CONFIG_HARD_I2C)
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
|
||||
#else /* normal I/O port pins */
|
||||
/* PD15 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SCL */
|
||||
#endif
|
||||
#endif
|
||||
/* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
|
||||
/* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
|
||||
/* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
|
||||
/* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
|
||||
/* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* PD9 */
|
||||
/* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* PD8 */
|
||||
/* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
|
||||
/* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
|
||||
/* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
|
||||
/* PD4 */ { 1, 1, 1, 0, 0, 0 }, /* SMC2 RXD */
|
||||
/* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Check Board Identity:
|
||||
*/
|
||||
int checkboard (void)
|
||||
{
|
||||
puts ("Board: PM828\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
|
||||
*
|
||||
* This routine performs standard 8260 initialization sequence
|
||||
* and calculates the available memory size. It may be called
|
||||
* several times to try different SDRAM configurations on both
|
||||
* 60x and local buses.
|
||||
*/
|
||||
static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
|
||||
ulong orx, volatile uchar * base)
|
||||
{
|
||||
volatile uchar c = 0xff;
|
||||
volatile ulong cnt, val;
|
||||
volatile ulong *addr;
|
||||
volatile uint *sdmr_ptr;
|
||||
volatile uint *orx_ptr;
|
||||
int i;
|
||||
ulong save[32]; /* to make test non-destructive */
|
||||
ulong maxsize;
|
||||
|
||||
/* We must be able to test a location outsize the maximum legal size
|
||||
* to find out THAT we are outside; but this address still has to be
|
||||
* mapped by the controller. That means, that the initial mapping has
|
||||
* to be (at least) twice as large as the maximum expected size.
|
||||
*/
|
||||
maxsize = (1 + (~orx | 0x7fff)) / 2;
|
||||
|
||||
sdmr_ptr = &memctl->memc_psdmr;
|
||||
orx_ptr = &memctl->memc_or2;
|
||||
|
||||
*orx_ptr = orx;
|
||||
|
||||
/*
|
||||
* Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
|
||||
*
|
||||
* "At system reset, initialization software must set up the
|
||||
* programmable parameters in the memory controller banks registers
|
||||
* (ORx, BRx, P/LSDMR). After all memory parameters are configured,
|
||||
* system software should execute the following initialization sequence
|
||||
* for each SDRAM device.
|
||||
*
|
||||
* 1. Issue a PRECHARGE-ALL-BANKS command
|
||||
* 2. Issue eight CBR REFRESH commands
|
||||
* 3. Issue a MODE-SET command to initialize the mode register
|
||||
*
|
||||
* The initial commands are executed by setting P/LSDMR[OP] and
|
||||
* accessing the SDRAM with a single-byte transaction."
|
||||
*
|
||||
* The appropriate BRx/ORx registers have already been set when we
|
||||
* get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
|
||||
*/
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_PREA;
|
||||
*base = c;
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_CBRR;
|
||||
for (i = 0; i < 8; i++)
|
||||
*base = c;
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_MRW;
|
||||
*(base + CFG_MRS_OFFS) = c; /* setting MR on address lines */
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
|
||||
*base = c;
|
||||
|
||||
/*
|
||||
* Check memory range for valid RAM. A simple memory test determines
|
||||
* the actually available RAM size between addresses `base' and
|
||||
* `base + maxsize'. Some (not all) hardware errors are detected:
|
||||
* - short between address lines
|
||||
* - short between data lines
|
||||
*/
|
||||
i = 0;
|
||||
for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
|
||||
addr = (volatile ulong *) base + cnt; /* pointer arith! */
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
addr = (volatile ulong *) base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
if ((val = *addr) != 0) {
|
||||
*addr = save[i];
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
|
||||
addr = (volatile ulong *) base + cnt; /* pointer arith! */
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
if (val != ~cnt) {
|
||||
/* Write the actual size to ORx
|
||||
*/
|
||||
*orx_ptr = orx | ~(cnt * sizeof (long) - 1);
|
||||
return (cnt * sizeof (long));
|
||||
}
|
||||
}
|
||||
return (maxsize);
|
||||
}
|
||||
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong size8, size9;
|
||||
#endif
|
||||
ulong psize = 32 * 1024 * 1024;
|
||||
|
||||
memctl->memc_psrt = CFG_PSRT;
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
size8 = try_init (memctl, CFG_PSDMR_8COL, CFG_OR2_8COL,
|
||||
(uchar *) CFG_SDRAM_BASE);
|
||||
size9 = try_init (memctl, CFG_PSDMR_9COL, CFG_OR2_9COL,
|
||||
(uchar *) CFG_SDRAM_BASE);
|
||||
|
||||
if (size8 < size9) {
|
||||
psize = size9;
|
||||
printf ("(60x:9COL) ");
|
||||
} else {
|
||||
psize = try_init (memctl, CFG_PSDMR_8COL, CFG_OR2_8COL,
|
||||
(uchar *) CFG_SDRAM_BASE);
|
||||
printf ("(60x:8COL) ");
|
||||
}
|
||||
#endif
|
||||
return (psize);
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_DOC)
|
||||
extern void doc_probe (ulong physadr);
|
||||
void doc_init (void)
|
||||
{
|
||||
doc_probe (CFG_DOC_BASE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
struct pci_controller hose;
|
||||
|
||||
extern void pci_mpc8250_init(struct pci_controller *);
|
||||
|
||||
void pci_init_board(void)
|
||||
{
|
||||
pci_mpc8250_init(&hose);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* (C) Copyright 2001-2004
|
||||
* 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/mpc8260/start.o (.text)
|
||||
*(.text)
|
||||
common/environment.o(.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 = .);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ void reset_phy(void)
|
||||
ulong value;
|
||||
|
||||
/* Configure all needed port pins for GPIO */
|
||||
#if CFG_ETH_MDDIS_VALUE
|
||||
#ifdef CFG_ETH_MDDIS_VALUE
|
||||
immr->im_ioport.iop_padat |= CFG_PA_ETH_MDDIS;
|
||||
#else
|
||||
immr->im_ioport.iop_padat &= ~(CFG_PA_ETH_MDDIS | CFG_PA_ETH_RESET); /* Set low */
|
||||
@@ -369,17 +369,17 @@ void reset_phy(void)
|
||||
value |= CFG_PB_ETH_POWERDOWN;
|
||||
|
||||
/* PHY configuration includes MDDIS and CFG1 ... CFG3 */
|
||||
#if CFG_ETH_CFG1_VALUE
|
||||
#ifdef CFG_ETH_CFG1_VALUE
|
||||
value |= CFG_PB_ETH_CFG1;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG1);
|
||||
#endif
|
||||
#if CFG_ETH_CFG2_VALUE
|
||||
#ifdef CFG_ETH_CFG2_VALUE
|
||||
value |= CFG_PB_ETH_CFG2;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG2);
|
||||
#endif
|
||||
#if CFG_ETH_CFG3_VALUE
|
||||
#ifdef CFG_ETH_CFG3_VALUE
|
||||
value |= CFG_PB_ETH_CFG3;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG3);
|
||||
|
||||
@@ -309,7 +309,7 @@ void reset_phy (void)
|
||||
|
||||
/* Configure all needed port pins for GPIO */
|
||||
#if PCU_E_WITH_SWAPPED_CS /* XXX */
|
||||
# if CFG_ETH_MDDIS_VALUE
|
||||
# ifdef CFG_ETH_MDDIS_VALUE
|
||||
immr->im_ioport.iop_padat |= CFG_PA_ETH_MDDIS;
|
||||
# else
|
||||
immr->im_ioport.iop_padat &= ~(CFG_PA_ETH_MDDIS); /* Set low */
|
||||
@@ -329,23 +329,23 @@ void reset_phy (void)
|
||||
|
||||
/* PHY configuration includes MDDIS and CFG1 ... CFG3 */
|
||||
#if !PCU_E_WITH_SWAPPED_CS
|
||||
# if CFG_ETH_MDDIS_VALUE
|
||||
# ifdef CFG_ETH_MDDIS_VALUE
|
||||
value |= CFG_PB_ETH_MDDIS;
|
||||
# else
|
||||
value &= ~(CFG_PB_ETH_MDDIS);
|
||||
# endif
|
||||
#endif
|
||||
#if CFG_ETH_CFG1_VALUE
|
||||
#ifdef CFG_ETH_CFG1_VALUE
|
||||
value |= CFG_PB_ETH_CFG1;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG1);
|
||||
#endif
|
||||
#if CFG_ETH_CFG2_VALUE
|
||||
#ifdef CFG_ETH_CFG2_VALUE
|
||||
value |= CFG_PB_ETH_CFG2;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG2);
|
||||
#endif
|
||||
#if CFG_ETH_CFG3_VALUE
|
||||
#ifdef CFG_ETH_CFG3_VALUE
|
||||
value |= CFG_PB_ETH_CFG3;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG3);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# (C) Copyright 2001-2004
|
||||
# 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 misc.o
|
||||
|
||||
SOBJS = vectors.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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 <nios-io.h>
|
||||
#include <spi.h>
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
extern void ssv_wd_pio_init(void); /* comes from ../common/wd_pio.c
|
||||
included by ./misc.c */
|
||||
#endif
|
||||
|
||||
void _default_hdlr (void)
|
||||
{
|
||||
printf ("default_hdlr\n");
|
||||
}
|
||||
|
||||
int board_early_init_f (void)
|
||||
{
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
ssv_wd_pio_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
puts ( "Board: SSV DilNetPC ADNP/ESC1"
|
||||
#if defined(CONFIG_DNPEVA2)
|
||||
" on DNP/EVA2"
|
||||
#endif
|
||||
"\n");
|
||||
#if defined(CONFIG_NIOS_BASE_32)
|
||||
puts ("Conf.: SSV Base 32 (nios_32)\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The following are used to control the SPI chip selects for the SPI command.
|
||||
*/
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_SPI) && CONFIG_NIOS_SPI
|
||||
|
||||
#define SPI_RTC_CS_MASK 0x00000001
|
||||
|
||||
void spi_rtc_chipsel(int cs)
|
||||
{
|
||||
nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE;
|
||||
|
||||
if (cs)
|
||||
spi->slaveselect = SPI_RTC_CS_MASK; /* activate (1) */
|
||||
else
|
||||
spi->slaveselect = 0; /* deactivate (0) */
|
||||
}
|
||||
|
||||
/*
|
||||
* The SPI command uses this table of functions for controlling the SPI
|
||||
* chip selects: it calls the appropriate function to control the SPI
|
||||
* chip selects.
|
||||
*/
|
||||
spi_chipsel_type spi_chipsel[] = {
|
||||
spi_rtc_chipsel
|
||||
};
|
||||
int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
|
||||
|
||||
#endif /* CFG_CMD_SPI */
|
||||
|
||||
#if defined(CONFIG_POST)
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
return 0; /* No hotkeys supported */
|
||||
}
|
||||
#endif /* CONFIG_POST */
|
||||
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# (C) Copyright 2004
|
||||
# Li-Pro.Net <www.li-pro.net>
|
||||
# Stephan Linz <linz@li-pro.net>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x02fc0000 # ATTENTION: notice your CFG_MONITOR_LEN setting
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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 <nios.h>
|
||||
|
||||
/*
|
||||
* include common flash code (for ssv boards)
|
||||
*/
|
||||
#include "../common/flash.c"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define BANKSZ (8 * 1024 * 1024)
|
||||
#define SECTSZ (64 * 1024)
|
||||
#define UBOOTSECS ((CFG_MONITOR_LEN + CFG_ENV_SIZE) / SECTSZ)
|
||||
#define UBOOTAREA (UBOOTSECS * 64 * 1024) /* monitor / env area */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
unsigned long addr;
|
||||
flash_info_t *fli = &flash_info[0];
|
||||
|
||||
fli->size = BANKSZ;
|
||||
fli->sector_count = CFG_MAX_FLASH_SECT;
|
||||
fli->flash_id = FLASH_MAN_AMD + FLASH_AMLV640U;
|
||||
|
||||
addr = CFG_FLASH_BASE;
|
||||
for (i = 0; i < fli->sector_count; ++i) {
|
||||
fli->start[i] = addr;
|
||||
addr += SECTSZ;
|
||||
|
||||
/* Protect monitor / environment area */
|
||||
if (addr <= (CFG_FLASH_BASE + UBOOTAREA))
|
||||
fli->protect[i] = 1;
|
||||
else
|
||||
fli->protect[i] = 0;
|
||||
}
|
||||
|
||||
return (BANKSZ);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* board/ssv/adnpesc1/misc.c
|
||||
*
|
||||
* miscellaneous board interfaces / drivers
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
#include "../common/cmd_sled.c"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
#include "../common/wd_pio.c"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
|
||||
#include "../common/post.c"
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
OUTPUT_FORMAT("elf32-nios")
|
||||
OUTPUT_ARCH(nios)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
cpu/nios/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
__text_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
__rodata_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__data_end = .;
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd :
|
||||
{
|
||||
*(.u_boot_cmd)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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>
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Exception Vector Table
|
||||
*
|
||||
* This could have gone in the cpu soure tree, but the whole point of
|
||||
* Nios is customization -- and polluting the cpu source tree with
|
||||
* board-specific ifdef's really defeats the purpose, no? With this in
|
||||
* the board-specific tree, each board has the freedom to organize
|
||||
* vectors/traps, etc anyway it wants. The init code copies this table
|
||||
* to the proper location.
|
||||
*
|
||||
* Each board can do what it likes here. But there are four "standard"
|
||||
* handlers availble:
|
||||
*
|
||||
* _cwp_lolimit -Handles register window underflows.
|
||||
* _cwp_hilimit -Handles register window overflows.
|
||||
* _timebase_int -Increments the timebase.
|
||||
* _def_xhandler -Default exception handler.
|
||||
*
|
||||
* _timebase_int handles a Nios Timer interrupt and increments the
|
||||
* timestamp used for the get_timer(), reset_timer(), etc. routines. It
|
||||
* expects the timer to be configured like the standard-32 low priority
|
||||
* timer.
|
||||
*
|
||||
* _def_xhandler dispatches exceptions/traps via the external_interrupt()
|
||||
* routine. This lets you use the irq_install_handler() and handle your
|
||||
* interrupts/traps with code written in C.
|
||||
************************************************************************/
|
||||
|
||||
.data
|
||||
.global _vectors
|
||||
.align 4
|
||||
_vectors:
|
||||
|
||||
#if defined(CFG_NIOS_CPU_OCI_BASE)
|
||||
/* OCI does the reset job */
|
||||
.long _def_xhandler@h /* Vector 0 - NMI / Reset */
|
||||
#else
|
||||
/* there is no OCI, so we have to do a direct reset jump here */
|
||||
.long CFG_NIOS_CPU_RST_VECT /* Vector 0 - Reset to GERMS */
|
||||
#endif
|
||||
.long _cwp_lolimit@h /* Vector 1 - underflow */
|
||||
.long _cwp_hilimit@h /* Vector 2 - overflow */
|
||||
|
||||
.long _def_xhandler@h /* Vector 3 - GNUPro debug */
|
||||
.long _def_xhandler@h /* Vector 4 - GNUPro debug */
|
||||
.long _def_xhandler@h /* Vector 5 - GNUPro debug */
|
||||
.long _def_xhandler@h /* Vector 6 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 7 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 8 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 9 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 10 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 11 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 12 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 13 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 14 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 15 - future reserved */
|
||||
#if (CFG_NIOS_TMRIRQ == 16)
|
||||
.long _timebase_int@h /* Vector 16 - lopri timer*/
|
||||
#else
|
||||
.long _def_xhandler@h /* Vector 16 */
|
||||
#endif
|
||||
.long _def_xhandler@h /* Vector 17 */
|
||||
.long _def_xhandler@h /* Vector 18 */
|
||||
.long _def_xhandler@h /* Vector 19 */
|
||||
.long _def_xhandler@h /* Vector 20 */
|
||||
.long _def_xhandler@h /* Vector 21 */
|
||||
.long _def_xhandler@h /* Vector 22 */
|
||||
.long _def_xhandler@h /* Vector 23 */
|
||||
.long _def_xhandler@h /* Vector 24 */
|
||||
.long _def_xhandler@h /* Vector 25 */
|
||||
.long _def_xhandler@h /* Vector 26 */
|
||||
.long _def_xhandler@h /* Vector 27 */
|
||||
.long _def_xhandler@h /* Vector 28 */
|
||||
.long _def_xhandler@h /* Vector 29 */
|
||||
.long _def_xhandler@h /* Vector 30 */
|
||||
.long _def_xhandler@h /* Vector 31 */
|
||||
.long _def_xhandler@h /* Vector 32 */
|
||||
.long _def_xhandler@h /* Vector 33 */
|
||||
.long _def_xhandler@h /* Vector 34 */
|
||||
.long _def_xhandler@h /* Vector 35 */
|
||||
.long _def_xhandler@h /* Vector 36 */
|
||||
.long _def_xhandler@h /* Vector 37 */
|
||||
.long _def_xhandler@h /* Vector 38 */
|
||||
.long _def_xhandler@h /* Vector 39 */
|
||||
.long _def_xhandler@h /* Vector 40 */
|
||||
.long _def_xhandler@h /* Vector 41 */
|
||||
.long _def_xhandler@h /* Vector 42 */
|
||||
.long _def_xhandler@h /* Vector 43 */
|
||||
.long _def_xhandler@h /* Vector 44 */
|
||||
.long _def_xhandler@h /* Vector 45 */
|
||||
.long _def_xhandler@h /* Vector 46 */
|
||||
.long _def_xhandler@h /* Vector 47 */
|
||||
.long _def_xhandler@h /* Vector 48 */
|
||||
.long _def_xhandler@h /* Vector 49 */
|
||||
#if (CFG_NIOS_TMRIRQ == 50)
|
||||
.long _timebase_int@h /* Vector 50 - lopri timer*/
|
||||
#else
|
||||
.long _def_xhandler@h /* Vector 50 */
|
||||
#endif
|
||||
.long _def_xhandler@h /* Vector 51 */
|
||||
.long _def_xhandler@h /* Vector 52 */
|
||||
.long _def_xhandler@h /* Vector 53 */
|
||||
.long _def_xhandler@h /* Vector 54 */
|
||||
.long _def_xhandler@h /* Vector 55 */
|
||||
.long _def_xhandler@h /* Vector 56 */
|
||||
.long _def_xhandler@h /* Vector 57 */
|
||||
.long _def_xhandler@h /* Vector 58 */
|
||||
.long _def_xhandler@h /* Vector 59 */
|
||||
.long _def_xhandler@h /* Vector 60 */
|
||||
.long _def_xhandler@h /* Vector 61 */
|
||||
.long _def_xhandler@h /* Vector 62 */
|
||||
.long _def_xhandler@h /* Vector 63 */
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <status_led.h>
|
||||
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* !!!!! Q u i c k & D i r t y H a c k !!!!!
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* !!!!! !!!!!
|
||||
* !!!!! Next type definition was coming from original !!!!!
|
||||
* !!!!! status LED driver drivers/status_led.c and !!!!!
|
||||
* !!!!! should exported for using here. !!!!!
|
||||
* !!!!! !!!!!
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
|
||||
|
||||
typedef struct {
|
||||
led_id_t mask;
|
||||
int state;
|
||||
int period;
|
||||
int cnt;
|
||||
} led_dev_t;
|
||||
|
||||
extern led_dev_t led_dev[];
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BSP)
|
||||
int do_sled (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
int led_id = 0;
|
||||
|
||||
if (argc > 1) {
|
||||
#ifdef STATUS_LED_BOOT
|
||||
if (!strcmp (argv[1], "boot")) {
|
||||
led_id = STATUS_LED_BOOT + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_RED
|
||||
if (!strcmp (argv[1], "red")) {
|
||||
led_id = STATUS_LED_RED + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_YELLOW
|
||||
if (!strcmp (argv[1], "yellow")) {
|
||||
led_id = STATUS_LED_YELLOW + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_GREEN
|
||||
if (!strcmp (argv[1], "green")) {
|
||||
led_id = STATUS_LED_GREEN + 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
#if (STATUS_LED_BITS > 3)
|
||||
for (; led_id < 4; led_id++)
|
||||
#elif (STATUS_LED_BITS > 2)
|
||||
for (; led_id < 3; led_id++)
|
||||
#elif (STATUS_LED_BITS > 1)
|
||||
for (; led_id < 2; led_id++)
|
||||
#elif (STATUS_LED_BITS > 0)
|
||||
for (; led_id < 1; led_id++)
|
||||
#else
|
||||
#error "*** STATUS_LED_BITS not correct defined ***"
|
||||
#endif
|
||||
{
|
||||
printf ("Status LED '%s' is %s\n",
|
||||
led_id == STATUS_LED_BOOT ? "boot"
|
||||
: led_id == STATUS_LED_RED ? "red"
|
||||
: led_id == STATUS_LED_YELLOW ? "yellow"
|
||||
: led_id ==
|
||||
STATUS_LED_GREEN ? "green" : "unknown",
|
||||
led_dev[led_id].state ==
|
||||
STATUS_LED_ON ? "on" : led_dev[led_id].
|
||||
state ==
|
||||
STATUS_LED_OFF ? "off" : led_dev[led_id].
|
||||
state ==
|
||||
STATUS_LED_BLINKING ? "blinking" : "unknown");
|
||||
}
|
||||
return 0;
|
||||
case 2:
|
||||
if (led_id) {
|
||||
printf ("Status LED '%s' is %s\n", argv[1],
|
||||
led_dev[led_id - 1].state ==
|
||||
STATUS_LED_ON ? "on" : led_dev[led_id -
|
||||
1].state ==
|
||||
STATUS_LED_OFF ? "off" : led_dev[led_id -
|
||||
1].state ==
|
||||
STATUS_LED_BLINKING ? "blinking" : "unknown");
|
||||
return 0;
|
||||
} else
|
||||
break;
|
||||
case 3:
|
||||
if (led_id) {
|
||||
if (!strcmp (argv[2], "on")) {
|
||||
status_led_set (led_id - 1, STATUS_LED_ON);
|
||||
return 0;
|
||||
} else if (!strcmp (argv[2], "off")) {
|
||||
status_led_set (led_id - 1, STATUS_LED_OFF);
|
||||
return 0;
|
||||
} else if (!strcmp (argv[2], "blink")) {
|
||||
status_led_set (led_id - 1,
|
||||
STATUS_LED_BLINKING);
|
||||
return 0;
|
||||
} else
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef STATUS_LED_BOOT
|
||||
#ifdef STATUS_LED_RED
|
||||
#ifdef STATUS_LED_YELLOW
|
||||
#ifdef STATUS_LED_GREEN
|
||||
#define __NAME_STR " - name: boot|red|yellow|green\n"
|
||||
#else
|
||||
#define __NAME_STR " - name: boot|red|yellow\n"
|
||||
#endif
|
||||
#else
|
||||
#define __NAME_STR " - name: boot|red\n"
|
||||
#endif
|
||||
#else
|
||||
#define __NAME_STR " - name: boot\n"
|
||||
#endif
|
||||
#else
|
||||
#define __NAME_STR " - name: (no such defined)\n"
|
||||
#endif
|
||||
|
||||
U_BOOT_CMD (sled, 3, 0, do_sled,
|
||||
"sled - check and set status led\n",
|
||||
"sled [name [state]]\n" __NAME_STR " - state: on|off|blink\n");
|
||||
#endif /* CFG_CMD_BSP */
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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 <watchdog.h>
|
||||
#include <nios.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i, k;
|
||||
unsigned long size;
|
||||
int erased;
|
||||
volatile unsigned char *flash;
|
||||
|
||||
printf (" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
|
||||
/* Check if whole sector is erased */
|
||||
if (i != (info->sector_count - 1))
|
||||
size = info->start[i + 1] - info->start[i];
|
||||
else
|
||||
size = info->start[0] + info->size - info->start[i];
|
||||
erased = 1;
|
||||
flash = (volatile unsigned char *) info->start[i];
|
||||
for (k = 0; k < size; k++) {
|
||||
if (*flash++ != 0xff) {
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the info */
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s%s", info->start[i], erased ? " E" : " ",
|
||||
info->protect[i] ? "RO " : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
volatile CFG_FLASH_WORD_SIZE *addr = (CFG_FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile CFG_FLASH_WORD_SIZE *addr2;
|
||||
int prot, sect, wait;
|
||||
unsigned oldpri;
|
||||
ulong start;
|
||||
|
||||
/* Some sanity checking */
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
printf ("- no sectors to erase\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
printf("- Erase: Sect: %i @ 0x%08x\n", sect, info->start[sect]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NOTE: disabling interrupts on Nios can be very bad since it
|
||||
* also disables the LO_LIMIT exception. It's better here to
|
||||
* set the interrupt priority to 3 & restore it when we're done.
|
||||
*/
|
||||
oldpri = ipri (3);
|
||||
|
||||
/* It's ok to erase multiple sectors provided we don't delay more
|
||||
* than 50 usec between cmds ... at which point the erase time-out
|
||||
* occurs. So don't go and put printf() calls in the loop ... it
|
||||
* won't be very helpful ;-)
|
||||
*/
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (CFG_FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
*addr = 0xf0;
|
||||
*(addr+0xAAA/2) = 0xaa;
|
||||
*(addr+0x554/2) = 0x55;
|
||||
*(addr+0xAAA/2) = 0x80;
|
||||
*(addr+0xAAA/2) = 0xaa;
|
||||
*(addr+0x554/2) = 0x55;
|
||||
*addr2 = 0x30;
|
||||
/* Now just wait for 0xffff & provide some user
|
||||
* feedback while we wait. Here we have to grant
|
||||
* timer interrupts. Otherwise get_timer() can't
|
||||
* work right. */
|
||||
ipri(oldpri);
|
||||
start = get_timer (0);
|
||||
while (*addr2 != 0xffff) {
|
||||
for (wait = 8; wait; wait--) {
|
||||
udelay (125 * 1000);
|
||||
}
|
||||
putc ('.');
|
||||
if (get_timer (start) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("timeout\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
oldpri = ipri (3); /* disallow non important irqs again */
|
||||
}
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
*addr = 0xf0;
|
||||
|
||||
/* Restore interrupt priority */
|
||||
ipri (oldpri);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * srcbuffer, ulong addr, ulong cnt)
|
||||
{
|
||||
|
||||
volatile CFG_FLASH_WORD_SIZE *cmd = (vu_short *) info->start[0];
|
||||
volatile CFG_FLASH_WORD_SIZE *dst = (vu_short *) addr;
|
||||
CFG_FLASH_WORD_SIZE *src = (void *) srcbuffer;
|
||||
CFG_FLASH_WORD_SIZE b;
|
||||
unsigned oldpri;
|
||||
ulong start;
|
||||
|
||||
cnt /= sizeof(CFG_FLASH_WORD_SIZE);
|
||||
while (cnt) {
|
||||
/* Check for sufficient erase */
|
||||
b = *src;
|
||||
if ((*dst & b) != b) {
|
||||
printf ("%02x : %02x\n", *dst, b);
|
||||
return (2);
|
||||
}
|
||||
|
||||
/* Disable interrupts other than window underflow
|
||||
* (interrupt priority 2)
|
||||
*/
|
||||
oldpri = ipri (3);
|
||||
*(cmd+0xAAA/2) = 0xaa;
|
||||
*(cmd+0x554/2) = 0x55;
|
||||
*(cmd+0xAAA/2) = 0xa0;
|
||||
ipri (oldpri);
|
||||
*dst = b;
|
||||
|
||||
/* Verify write */
|
||||
start = get_timer (0);
|
||||
while (*dst != b) {
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*cmd = 0xf0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
cnt--;
|
||||
}
|
||||
|
||||
*cmd = 0xf0;
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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_POST) || defined(CONFIG_LOGBUFFER)
|
||||
|
||||
#if !defined(CFG_NIOS_POST_WORD_ADDR)
|
||||
#error "*** CFG_NIOS_POST_WORD_ADDR not defined ***"
|
||||
#endif
|
||||
|
||||
void post_word_store (ulong a)
|
||||
{
|
||||
volatile void *save_addr = (void *)(CFG_NIOS_POST_WORD_ADDR);
|
||||
*(volatile ulong *) save_addr = a;
|
||||
}
|
||||
|
||||
ulong post_word_load (void)
|
||||
{
|
||||
volatile void *save_addr = (void *)(CFG_NIOS_POST_WORD_ADDR);
|
||||
return *(volatile ulong *) save_addr;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <nios.h>
|
||||
#include <nios-io.h>
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
|
||||
#if !defined(CONFIG_HW_WDENA_BASE)
|
||||
#error "*** CONFIG_HW_WDENA_BASE not defined ***"
|
||||
#if !defined(CONFIG_HW_WDENA_BIT)
|
||||
#error "*** CONFIG_HW_WDENA_BIT not defined ***"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_HW_WDTOG_BASE)
|
||||
#error "*** CONFIG_HW_WDTOG_BASE not defined ***"
|
||||
#if !defined(CONFIG_HW_WDTOG_BIT)
|
||||
#error "*** CONFIG_HW_WDTOG_BIT not defined ***"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY /* emulate read access */
|
||||
static unsigned __wd_ena_pio_portval = 0;
|
||||
#endif
|
||||
|
||||
#define WD_PIO_INIT_DONE(V) ((V) & (1 << CONFIG_HW_WDENA_BIT))
|
||||
|
||||
void ssv_wd_pio_init(void)
|
||||
{
|
||||
nios_pio_t *ena_piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
nios_pio_t *trg_piop = (nios_pio_t*)CONFIG_HW_WDTOG_BASE;
|
||||
|
||||
trg_piop->data &= ~(1 << CONFIG_HW_WDTOG_BIT);
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY /* emulate read access */
|
||||
|
||||
__wd_ena_pio_portval |= (1 << CONFIG_HW_WDENA_BIT);
|
||||
ena_piop->data = __wd_ena_pio_portval;
|
||||
|
||||
#else /* !CONFIG_HW_WDPORT_WRONLY */
|
||||
|
||||
trg_piop->direction |= (1 << CONFIG_HW_WDTOG_BIT);
|
||||
|
||||
ena_piop->data |= (1 << CONFIG_HW_WDENA_BIT);
|
||||
ena_piop->direction |= (1 << CONFIG_HW_WDENA_BIT);
|
||||
|
||||
#endif /* CONFIG_HW_WDPORT_WRONLY */
|
||||
}
|
||||
|
||||
void ssv_wd_pio_done(void)
|
||||
{
|
||||
nios_pio_t *piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY /* emulate read access */
|
||||
|
||||
__wd_ena_pio_portval &= ~(1 << CONFIG_HW_WDENA_BIT);
|
||||
piop->data = __wd_ena_pio_portval;
|
||||
|
||||
#else /* !CONFIG_HW_WDPORT_WRONLY */
|
||||
|
||||
piop->data &= ~(1 << CONFIG_HW_WDENA_BIT);
|
||||
|
||||
#endif /* CONFIG_HW_WDPORT_WRONLY */
|
||||
}
|
||||
|
||||
void ssv_wd_pio_reset(void)
|
||||
{
|
||||
nios_pio_t *trg_piop = (nios_pio_t*)CONFIG_HW_WDTOG_BASE;
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY
|
||||
if (WD_PIO_INIT_DONE(__wd_ena_pio_portval))
|
||||
#else
|
||||
nios_pio_t *ena_piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
|
||||
if (WD_PIO_INIT_DONE(ena_piop->data))
|
||||
#endif
|
||||
{
|
||||
trg_piop->data |= (1 << CONFIG_HW_WDTOG_BIT);
|
||||
trg_piop->data &= ~(1 << CONFIG_HW_WDTOG_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
void hw_watchdog_reset(void)
|
||||
{
|
||||
int re_enable = disable_interrupts ();
|
||||
|
||||
ssv_wd_pio_reset();
|
||||
if (re_enable)
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BSP)
|
||||
int do_wd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
nios_pio_t *ena_piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
printf ("Watchdog timer status is %s\n",
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY
|
||||
WD_PIO_INIT_DONE(__wd_ena_pio_portval)
|
||||
#else
|
||||
WD_PIO_INIT_DONE(ena_piop->data)
|
||||
#endif
|
||||
? "on" : "off");
|
||||
return 0;
|
||||
case 2:
|
||||
if (!strcmp(argv[1],"on"))
|
||||
{
|
||||
ssv_wd_pio_init();
|
||||
printf("Watchdog timer now is on\n");
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp(argv[1],"off"))
|
||||
{
|
||||
ssv_wd_pio_done();
|
||||
printf("Watchdog timer now is off\n");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
wd, 2, 1, do_wd,
|
||||
"wd - check and set watchdog\n",
|
||||
"on - switch watchDog on\n"
|
||||
"wd off - switch watchdog off\n"
|
||||
"wd - print current status\n"
|
||||
);
|
||||
#endif /* CFG_CMD_BSP */
|
||||
#endif /* CONFIG_HW_WATCHDOG */
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <linux/byteorder/swab.h>
|
||||
#include <environment.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
@@ -94,6 +95,13 @@ unsigned long flash_init (void)
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
#ifdef CFG_ENV_ADDR_REDUND
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR_REDUND,
|
||||
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
+3
-12
@@ -118,30 +118,21 @@ platformsetup:
|
||||
str r1, [r0] /* EMIFS GlB Configuration. (value 0x12 most likely) */
|
||||
|
||||
ldr r0, _GPIO_PIN_CONTROL_REG
|
||||
ldrh r1,[r0]
|
||||
mov r1,#0
|
||||
orr r1, r1, #0x0001 /* M_PCM_SYNC */
|
||||
orr r1, r1, #0x4000 /* IPC_ACTIVE */
|
||||
orr r1, r1, #0x0002 /* A_IRDA_OFF */
|
||||
orr r1, r1, #0x0800 /* A_SWITCH */
|
||||
orr r1, r1, #0x8000 /* A_USB_ON */
|
||||
strh r1,[r0]
|
||||
|
||||
ldr r0, _GPIO_DIR_CONTROL_REG
|
||||
ldrh r1,[r0]
|
||||
mov r1,#0
|
||||
bic r1, r1, #0x0001 /* M_PCM_SYNC */
|
||||
bic r1, r1, #0x4000 /* IPC_ACTIVE */
|
||||
bic r1, r1, #0x0002 /* A_IRDA_OFF */
|
||||
bic r1, r1, #0x0800 /* A_SWITCH */
|
||||
bic r1, r1, #0x8000 /* A_USB_ON */
|
||||
strh r1,[r0]
|
||||
|
||||
ldr r0, _GPIO_DATA_OUTPUT_REG
|
||||
ldrh r1,[r0]
|
||||
mov r1,#0
|
||||
bic r1, r1, #0x0001 /* M_PCM_SYNC */
|
||||
orr r1, r1, #0x4000 /* IPC_ACTIVE */
|
||||
orr r1, r1, #0x0002 /* A_IRDA_OFF */
|
||||
bic r1, r1, #0x0800 /* A_SWITCH */
|
||||
bic r1, r1, #0x8000 /* A_USB_ON */
|
||||
strh r1,[r0]
|
||||
|
||||
/* Setup some clock domains */
|
||||
|
||||
@@ -425,7 +425,7 @@ static long int dram_size (long int mamr_value, long int *base, long int maxsize
|
||||
|
||||
#ifdef CONFIG_PS2MULT
|
||||
|
||||
#ifdef CONFIG_BMS2003
|
||||
#ifdef CONFIG_HMI10
|
||||
#define BASE_BAUD ( 1843200 / 16 )
|
||||
struct serial_state rs_table[] = {
|
||||
{ BASE_BAUD, 4, (void*)0xec140000 },
|
||||
@@ -441,12 +441,12 @@ int board_early_init_r (void)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
#endif /* CONFIG_PS2MULT */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#ifdef CONFIG_BMS2003
|
||||
#ifdef CONFIG_HMI10
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
@@ -476,5 +476,5 @@ void ide_led (uchar led, uchar status)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -83,6 +83,7 @@ ulong flash_init (void)
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case (FLASH_AM320B & FLASH_TYPEMASK):
|
||||
case (FLASH_MXLV320B & FLASH_TYPEMASK):
|
||||
/* Boot sector type: 8 x 8 + N x 128 kB */
|
||||
flashbase += (j < 8) ? 0x4000 : 0x20000;
|
||||
break;
|
||||
@@ -130,6 +131,8 @@ void flash_print_info (flash_info_t * info)
|
||||
printf ("AMD "); break;
|
||||
case (FLASH_MAN_FUJ & FLASH_VENDMASK):
|
||||
printf ("FUJITSU "); break;
|
||||
case (FLASH_MAN_MX & FLASH_VENDMASK):
|
||||
printf ("MACRONIX "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
@@ -137,6 +140,9 @@ void flash_print_info (flash_info_t * info)
|
||||
case (FLASH_AM320B & FLASH_TYPEMASK):
|
||||
printf ("2x Am29LV320DB (32Mbit)\n");
|
||||
break;
|
||||
case (FLASH_MXLV320B & FLASH_TYPEMASK):
|
||||
printf ("2x MX29LV320DB (32Mbit)\n");
|
||||
break;
|
||||
case (FLASH_AM640U & FLASH_TYPEMASK):
|
||||
printf ("2x Am29LV640D (64Mbit)\n");
|
||||
break;
|
||||
@@ -191,6 +197,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case (FLASH_MAN_AMD & FLASH_VENDMASK): break; /* OK */
|
||||
case (FLASH_MAN_FUJ & FLASH_VENDMASK): break; /* OK */
|
||||
case (FLASH_MAN_MX & FLASH_VENDMASK): break; /* OK */
|
||||
default:
|
||||
debug ("## flash_erase: unknown manufacturer\n");
|
||||
return (ERR_UNKNOWN_FLASH_VENDOR);
|
||||
@@ -502,6 +509,9 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
case FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case MX_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_MX;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
@@ -532,6 +542,14 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
addr[0] = 0x00F000F0; /* restore read mode */
|
||||
break; /* => 16 MB */
|
||||
|
||||
case MX_ID_LV320B:
|
||||
info->flash_id += FLASH_MXLV320B;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00800000;
|
||||
|
||||
addr[0] = 0x00FF00FF; /* restore read mode */
|
||||
break; /* => 8 MB */
|
||||
|
||||
default:
|
||||
debug ("## flash_init: unknown flash chip\n");
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
|
||||
@@ -890,7 +890,7 @@ int do_touch (char **argv)
|
||||
int x, y;
|
||||
|
||||
if (strcmp (argv[2], "tl") == 0) {
|
||||
#if CONFIG_TOUCH_WAIT_PRESSED
|
||||
#ifdef CONFIG_TOUCH_WAIT_PRESSED
|
||||
touch_wait_pressed();
|
||||
#else
|
||||
{
|
||||
@@ -915,7 +915,7 @@ int do_touch (char **argv)
|
||||
return touch_write_clibration_values (CALIB_TL, x, y);
|
||||
}
|
||||
else if (strcmp (argv[2], "dr") == 0) {
|
||||
#if CONFIG_TOUCH_WAIT_PRESSED
|
||||
#ifdef CONFIG_TOUCH_WAIT_PRESSED
|
||||
touch_wait_pressed();
|
||||
#else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# 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 := versatile.o flash.o
|
||||
SOBJS := platform.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,5 @@
|
||||
#
|
||||
# image should be loaded at 0x01000000
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x01000000
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* 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 <linux/byteorder/swab.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#undef FLASH_PORT_WIDTH32
|
||||
#define FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef {
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgIntel_28F256L18T[] = {
|
||||
{4, 32 * 1024}, /* 4 * 32kBytes sectors */
|
||||
{255, 128 * 1024}, /* 255 * 128kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
unsigned long flash_init (void);
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info);
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
void inline spin_wheel (void);
|
||||
void flash_print_info (flash_info_t * info);
|
||||
void flash_unprotect_sectors (FPWV * addr);
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last);
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
pOrgDef = OrgIntel_28F256L18T;
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (i > 255) {
|
||||
info->start[i] = base + (i * 0x8000);
|
||||
info->protect[i] = 0;
|
||||
} else {
|
||||
info->start[i] = base +
|
||||
(i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F256L18T:
|
||||
printf ("FLASH 28F256L18T\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
|
||||
case (FPW) (INTEL_ID_28F256L18T):
|
||||
info->flash_id += FLASH_28F256L18T;
|
||||
info->sector_count = 259;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/* unprotects a sector for write and erase
|
||||
* on some intel parts, this unprotects the entire chip, but it
|
||||
* wont hurt to call this additional times per sector...
|
||||
*/
|
||||
void flash_unprotect_sectors (FPWV * addr)
|
||||
{
|
||||
#define PD_FINTEL_WSMS_READY_MASK 0x0080
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
|
||||
/* this sends the clear lock bit command */
|
||||
*addr = (FPW) 0x00600060;
|
||||
*addr = (FPW) 0x00D000D0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, 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;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
flash_unprotect_sectors (addr);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050;/* clear status register */
|
||||
*addr = (FPW) 0x00200020;/* erase setup */
|
||||
*addr = (FPW) 0x00D000D0;/* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked () >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
/* suspend erase */
|
||||
*addr = (FPW) 0x00B000B0;
|
||||
/* reset to read mode */
|
||||
*addr = (FPW) 0x00FF00FF;
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register cmd. */
|
||||
*addr = (FPW) 0x00500050;
|
||||
*addr = (FPW) 0x00FF00FF;/* resest to read mode */
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
flash_unprotect_sectors (addr);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Board specific setup info
|
||||
*
|
||||
* (C) Copyright 2003, ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/* All done by Versatile's boot monitor! */
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm926ejs/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.com>
|
||||
*
|
||||
* 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>
|
||||
|
||||
void flash__init (void);
|
||||
void ether__init (void);
|
||||
void peripheral_power_enable (void);
|
||||
|
||||
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
|
||||
void show_boot_progress(int progress)
|
||||
{
|
||||
printf("Boot reached stage %d\n", progress);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
|
||||
|
||||
static inline void delay (unsigned long loops)
|
||||
{
|
||||
__asm__ volatile ("1:\n"
|
||||
"subs %0, %1, #1\n"
|
||||
"bne 1b":"=r" (loops):"0" (loops));
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
||||
/*
|
||||
* set clock frequency:
|
||||
* VERSATILE_REFCLK is 32KHz
|
||||
* VERSATILE_TIMCLK is 1MHz
|
||||
*/
|
||||
*(volatile unsigned int *)(VERSATILE_SCTL_BASE) |=
|
||||
((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
|
||||
(VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel));
|
||||
|
||||
/* arch number of Versatile Board */
|
||||
gd->bd->bi_arch_number = 387;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0x00000100;
|
||||
|
||||
icache_enable ();
|
||||
|
||||
flash__init ();
|
||||
ether__init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
setenv("verify", "n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
void flash__init (void)
|
||||
{
|
||||
}
|
||||
/*************************************************************
|
||||
Routine:ether__init
|
||||
Description: take the Ethernet controller out of reset and wait
|
||||
for the EEPROM load to complete.
|
||||
*************************************************************/
|
||||
void ether__init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
int dram_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# 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 := xm250.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# (C) Copyright 2003-2004
|
||||
# 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
|
||||
#
|
||||
|
||||
#
|
||||
# MicroSys XM250 board:
|
||||
#
|
||||
|
||||
|
||||
# This is the address where U-Boot lives in flash:
|
||||
#TEXT_BASE = 0
|
||||
|
||||
# FIXME: armboot does only work correctly when being compiled
|
||||
# for the addresses _after_ relocation to RAM!! Otherwhise the
|
||||
# .bss segment is assumed in flash...
|
||||
TEXT_BASE = 0xA3F80000
|
||||
@@ -0,0 +1,536 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* 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 <linux/byteorder/swab.h>
|
||||
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#define FLASH_PORT_WIDTH32
|
||||
#undef FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
/* Intel-compatible flash ID */
|
||||
#define INTEL_COMPAT 0x00890089
|
||||
#define INTEL_ALT 0x00B000B0
|
||||
|
||||
/* Intel-compatible flash commands */
|
||||
#define INTEL_PROGRAM 0x00100010
|
||||
#define INTEL_ERASE 0x00200020
|
||||
#define INTEL_CLEAR 0x00500050
|
||||
#define INTEL_LOCKBIT 0x00600060
|
||||
#define INTEL_PROTECT 0x00010001
|
||||
#define INTEL_STATUS 0x00700070
|
||||
#define INTEL_READID 0x00900090
|
||||
#define INTEL_CONFIRM 0x00D000D0
|
||||
#define INTEL_RESET 0xFFFFFFFF
|
||||
|
||||
/* Intel-compatible flash status bits */
|
||||
#define INTEL_FINISHED 0x00800080
|
||||
#define INTEL_OK 0x00800080
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size (FPW *addr, flash_info_t *info);
|
||||
static int write_data (flash_info_t *info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
void inline spin_wheel (void);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
case 1:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_2, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_2, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured to many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1,
|
||||
&flash_info[0] );
|
||||
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0] );
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F128J3A:
|
||||
printf ("28F128J3A\n");
|
||||
break;
|
||||
|
||||
case FLASH_28F640J3A:
|
||||
printf ("28F640J3A\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW *addr, flash_info_t *info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_ID_28F128J3A:
|
||||
info->flash_id += FLASH_28F128J3A;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
case (FPW) INTEL_ID_28F640J3A:
|
||||
info->flash_id += FLASH_28F640J3A;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, 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;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
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");
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
*addr = (FPW) 0x00200020; /* erase setup */
|
||||
*addr = (FPW) 0x00D000D0; /* erase confirm */
|
||||
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
*addr = (FPW) 0x00B000B0; /* suspend erase */
|
||||
*addr = (FPW) 0x00FF00FF; /* reset to read mode */
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*addr = 0x00500050; /* clear status register cmd. */
|
||||
*addr = 0x00FF00FF; /* resest to read mode */
|
||||
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t *info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%lx)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Set/Clear sector's lock bit, returns:
|
||||
* 0 - OK
|
||||
* 1 - Error (timeout, voltage problems, etc.)
|
||||
*/
|
||||
int flash_real_protect(flash_info_t *info, long sector, int prot)
|
||||
{
|
||||
int i;
|
||||
int rc = 0;
|
||||
vu_long *addr = (vu_long *)(info->start[sector]);
|
||||
int flag = disable_interrupts();
|
||||
|
||||
*addr = INTEL_CLEAR; /* Clear status register */
|
||||
if (prot) { /* Set sector lock bit */
|
||||
*addr = INTEL_LOCKBIT; /* Sector lock bit */
|
||||
*addr = INTEL_PROTECT; /* set */
|
||||
}
|
||||
else { /* Clear sector lock bit */
|
||||
*addr = INTEL_LOCKBIT; /* All sectors lock bits */
|
||||
*addr = INTEL_CONFIRM; /* clear */
|
||||
}
|
||||
|
||||
reset_timer_masked ();
|
||||
|
||||
while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
|
||||
if (get_timer_masked () > CFG_FLASH_UNLOCK_TOUT) {
|
||||
printf("Flash lock bit operation timed out\n");
|
||||
rc = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*addr != INTEL_OK) {
|
||||
printf("Flash lock bit operation failed at %08X, CSR=%08X\n",
|
||||
(uint)addr, (uint)*addr);
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
if (!rc)
|
||||
info->protect[sector] = prot;
|
||||
|
||||
/*
|
||||
* Clear lock bit command clears all sectors lock bits, so
|
||||
* we have to restore lock bits of protected sectors.
|
||||
*/
|
||||
if (!prot)
|
||||
{
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
if (info->protect[i])
|
||||
{
|
||||
reset_timer_masked ();
|
||||
addr = (vu_long *)(info->start[i]);
|
||||
*addr = INTEL_LOCKBIT; /* Sector lock bit */
|
||||
*addr = INTEL_PROTECT; /* set */
|
||||
while ((*addr & INTEL_FINISHED) != INTEL_FINISHED)
|
||||
{
|
||||
if (get_timer_masked () > CFG_FLASH_UNLOCK_TOUT)
|
||||
{
|
||||
printf("Flash lock bit operation timed out\n");
|
||||
rc = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
*addr = INTEL_RESET; /* Reset to read array mode */
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -0,0 +1,519 @@
|
||||
/*
|
||||
* Most of this taken from Redboot hal_platform_setup.h with cleanup
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
DRAM_SIZE: .long CFG_DRAM_SIZE
|
||||
|
||||
/* wait for coprocessor write complete */
|
||||
.macro CPWAIT reg
|
||||
mrc p15,0,\reg,c2,c0,0
|
||||
mov \reg,\reg
|
||||
sub pc,pc,#4
|
||||
.endm
|
||||
/*
|
||||
.macro SET_LED val
|
||||
ldr r6, =CRADLE_LED_CLR_REG
|
||||
ldr r7, =0
|
||||
str r7, [r6]
|
||||
ldr r6, =CRADLE_LED_SET_REG
|
||||
ldr r7, =\val
|
||||
str r7, [r6]
|
||||
.endm
|
||||
*/
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
|
||||
mov r10, lr
|
||||
|
||||
/* Set up GPIO pins first */
|
||||
|
||||
ldr r0, =GPSR0
|
||||
ldr r1, =CFG_GPSR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPSR1
|
||||
ldr r1, =CFG_GPSR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPSR2
|
||||
ldr r1, =CFG_GPSR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR0
|
||||
ldr r1, =CFG_GPCR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR1
|
||||
ldr r1, =CFG_GPCR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR2
|
||||
ldr r1, =CFG_GPCR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GRER0
|
||||
ldr r1, =CFG_GRER0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GRER1
|
||||
ldr r1, =CFG_GRER1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GRER2
|
||||
ldr r1, =CFG_GRER2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GFER0
|
||||
ldr r1, =CFG_GFER0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GFER1
|
||||
ldr r1, =CFG_GFER1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GFER2
|
||||
ldr r1, =CFG_GFER2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR0
|
||||
ldr r1, =CFG_GPDR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR1
|
||||
ldr r1, =CFG_GPDR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR2
|
||||
ldr r1, =CFG_GPDR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR0_L
|
||||
ldr r1, =CFG_GAFR0_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR0_U
|
||||
ldr r1, =CFG_GAFR0_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR1_L
|
||||
ldr r1, =CFG_GAFR1_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR1_U
|
||||
ldr r1, =CFG_GAFR1_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR2_L
|
||||
ldr r1, =CFG_GAFR2_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR2_U
|
||||
ldr r1, =CFG_GAFR2_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
/* enable GPIO pins */
|
||||
ldr r0, =PSSR
|
||||
ldr r1, =CFG_PSSR_VAL
|
||||
str r1, [r0]
|
||||
|
||||
/* SET_LED 1 */
|
||||
|
||||
ldr r3, =MSC1 /* low - bank 2 Lubbock Registers / SRAM */
|
||||
ldr r2, =CFG_MSC1_VAL /* high - bank 3 Ethernet Controller */
|
||||
str r2, [r3] /* need to set MSC1 before trying to write to the HEX LEDs */
|
||||
ldr r2, [r3] /* need to read it back to make sure the value latches (see MSC section of manual) */
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Initlialize Memory Controller
|
||||
*
|
||||
* See PXA250 Operating System Developer's Guide
|
||||
*
|
||||
* pause for 200 uSecs- allow internal clocks to settle
|
||||
* *Note: only need this if hard reset... doing it anyway for now
|
||||
*/
|
||||
|
||||
@ Step 1
|
||||
@ ---- Wait 200 usec
|
||||
ldr r3, =OSCR @ reset the OS Timer Count to zero
|
||||
mov r2, #0
|
||||
str r2, [r3]
|
||||
ldr r4, =0x300 @ really 0x2E1 is about 200usec, so 0x300 should be plenty
|
||||
1:
|
||||
ldr r2, [r3]
|
||||
cmp r4, r2
|
||||
bgt 1b
|
||||
|
||||
/* SET_LED 2 */
|
||||
|
||||
mem_init:
|
||||
@ get memory controller base address
|
||||
ldr r1, =MEMC_BASE
|
||||
|
||||
|
||||
@****************************************************************************
|
||||
@ Step 2
|
||||
@
|
||||
|
||||
@ Step 2a
|
||||
@ write msc0, read back to ensure data latches
|
||||
@
|
||||
ldr r2, =CFG_MSC0_VAL
|
||||
str r2, [r1, #MSC0_OFFSET]
|
||||
ldr r2, [r1, #MSC0_OFFSET]
|
||||
|
||||
@ write msc1
|
||||
ldr r2, =CFG_MSC1_VAL
|
||||
str r2, [r1, #MSC1_OFFSET]
|
||||
ldr r2, [r1, #MSC1_OFFSET]
|
||||
|
||||
@ write msc2
|
||||
ldr r2, =CFG_MSC2_VAL
|
||||
str r2, [r1, #MSC2_OFFSET]
|
||||
ldr r2, [r1, #MSC2_OFFSET]
|
||||
|
||||
@ Step 2b
|
||||
@ write mecr
|
||||
ldr r2, =CFG_MECR_VAL
|
||||
str r2, [r1, #MECR_OFFSET]
|
||||
|
||||
@ write mcmem0
|
||||
ldr r2, =CFG_MCMEM0_VAL
|
||||
str r2, [r1, #MCMEM0_OFFSET]
|
||||
|
||||
@ write mcmem1
|
||||
ldr r2, =CFG_MCMEM1_VAL
|
||||
str r2, [r1, #MCMEM1_OFFSET]
|
||||
|
||||
@ write mcatt0
|
||||
ldr r2, =CFG_MCATT0_VAL
|
||||
str r2, [r1, #MCATT0_OFFSET]
|
||||
|
||||
@ write mcatt1
|
||||
ldr r2, =CFG_MCATT1_VAL
|
||||
str r2, [r1, #MCATT1_OFFSET]
|
||||
|
||||
@ write mcio0
|
||||
ldr r2, =CFG_MCIO0_VAL
|
||||
str r2, [r1, #MCIO0_OFFSET]
|
||||
|
||||
@ write mcio1
|
||||
ldr r2, =CFG_MCIO1_VAL
|
||||
str r2, [r1, #MCIO1_OFFSET]
|
||||
|
||||
/*SET_LED 3 */
|
||||
|
||||
@ Step 2c
|
||||
@ fly-by-dma is defeatured on this part
|
||||
@ write flycnfg
|
||||
@ldr r2, =CFG_FLYCNFG_VAL
|
||||
@str r2, [r1, #FLYCNFG_OFFSET]
|
||||
|
||||
/* FIXME Does this sequence really make sense */
|
||||
#ifdef REDBOOT_WAY
|
||||
@ Step 2d
|
||||
@ get the mdrefr settings
|
||||
ldr r3, =CFG_MDREFR_VAL
|
||||
|
||||
@ extract DRI field (we need a valid DRI field)
|
||||
@
|
||||
ldr r2, =0xFFF
|
||||
|
||||
@ valid DRI field in r3
|
||||
@
|
||||
and r3, r3, r2
|
||||
|
||||
@ get the reset state of MDREFR
|
||||
@
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ clear the DRI field
|
||||
@
|
||||
bic r4, r4, r2
|
||||
|
||||
@ insert the valid DRI field loaded above
|
||||
@
|
||||
orr r4, r4, r3
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ *Note: preserve the mdrefr value in r4 *
|
||||
|
||||
/*SET_LED 4 */
|
||||
|
||||
@****************************************************************************
|
||||
@ Step 3
|
||||
@
|
||||
@ NO SRAM
|
||||
|
||||
mov pc, r10
|
||||
|
||||
|
||||
@****************************************************************************
|
||||
@ Step 4
|
||||
@
|
||||
|
||||
@ Assumes previous mdrefr value in r4, if not then read current mdrefr
|
||||
|
||||
@ clear the free-running clock bits
|
||||
@ (clear K0Free, K1Free, K2Free
|
||||
@
|
||||
bic r4, r4, #(0x00800000 | 0x01000000 | 0x02000000)
|
||||
|
||||
@ set K0RUN for CPLD clock
|
||||
@
|
||||
orr r4, r4, #0x00002000
|
||||
|
||||
@ set K1RUN if bank 0 installed
|
||||
@
|
||||
orr r4, r4, #0x00010000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ deassert SLFRSH
|
||||
@
|
||||
bic r4, r4, #0x00400000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ assert E1PIN
|
||||
@
|
||||
orr r4, r4, #0x00008000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
nop
|
||||
nop
|
||||
#else
|
||||
@ Step 2d
|
||||
@ get the mdrefr settings
|
||||
ldr r4, =CFG_MDREFR_VAL
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ Step 4
|
||||
|
||||
@ set K0RUN for FLASH clock
|
||||
@
|
||||
orr r4, r4, #0x00002000
|
||||
|
||||
@ set K1RUN for bank DRAM 0
|
||||
@
|
||||
orr r4, r4, #0x00010000
|
||||
|
||||
@ set K2RUN for bank PLD
|
||||
@
|
||||
orr r4, r4, #0x00040000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ deassert SLFRSH
|
||||
@
|
||||
bic r4, r4, #0x00400000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ assert E1PIN
|
||||
@
|
||||
orr r4, r4, #0x00008000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
nop
|
||||
nop
|
||||
#endif
|
||||
|
||||
@ Step 4d
|
||||
@ fetch platform value of mdcnfg
|
||||
@
|
||||
ldr r2, =CFG_MDCNFG_VAL
|
||||
|
||||
@ disable all sdram banks
|
||||
@
|
||||
bic r2, r2, #(MDCNFG_DE0 | MDCNFG_DE1)
|
||||
bic r2, r2, #(MDCNFG_DE2 | MDCNFG_DE3)
|
||||
|
||||
@ program banks 0/1 for bus width
|
||||
@
|
||||
bic r2, r2, #MDCNFG_DWID0 @0=32-bit
|
||||
|
||||
@ write initial value of mdcnfg, w/o enabling sdram banks
|
||||
@
|
||||
str r2, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
@ Step 4e
|
||||
@ pause for 200 uSecs
|
||||
@
|
||||
ldr r3, =OSCR @ reset the OS Timer Count to zero
|
||||
mov r2, #0
|
||||
str r2, [r3]
|
||||
ldr r4, =0x300 @ really 0x2E1 is about 200usec, so 0x300 should be plenty
|
||||
1:
|
||||
ldr r2, [r3]
|
||||
cmp r4, r2
|
||||
bgt 1b
|
||||
|
||||
/*SET_LED 5 */
|
||||
|
||||
/* Why is this here??? */
|
||||
mov r0, #0x78 @turn everything off
|
||||
mcr p15, 0, r0, c1, c0, 0 @(caches off, MMU off, etc.)
|
||||
|
||||
@ Step 4f
|
||||
@ Access memory *not yet enabled* for CBR refresh cycles (8)
|
||||
@ - CBR is generated for all banks
|
||||
|
||||
ldr r2, =CFG_DRAM_BASE
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
|
||||
@ Step 4g
|
||||
@get memory controller base address
|
||||
@
|
||||
ldr r1, =MEMC_BASE
|
||||
|
||||
@fetch current mdcnfg value
|
||||
@
|
||||
ldr r3, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
@enable sdram bank 0 if installed (must do for any populated bank)
|
||||
@
|
||||
orr r3, r3, #MDCNFG_DE0
|
||||
|
||||
@write back mdcnfg, enabling the sdram bank(s)
|
||||
@
|
||||
str r3, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
@ Step 4h
|
||||
@ write mdmrs
|
||||
@
|
||||
ldr r2, =CFG_MDMRS_VAL
|
||||
str r2, [r1, #MDMRS_OFFSET]
|
||||
|
||||
@ Done Memory Init
|
||||
|
||||
/*SET_LED 6 */
|
||||
|
||||
@********************************************************************
|
||||
@ Disable (mask) all interrupts at the interrupt controller
|
||||
@
|
||||
|
||||
@ clear the interrupt level register (use IRQ, not FIQ)
|
||||
@
|
||||
mov r1, #0
|
||||
ldr r2, =ICLR
|
||||
str r1, [r2]
|
||||
|
||||
@ Set interrupt mask register
|
||||
@
|
||||
ldr r1, =CFG_ICMR_VAL
|
||||
ldr r2, =ICMR
|
||||
str r1, [r2]
|
||||
|
||||
@ ********************************************************************
|
||||
@ Disable the peripheral clocks, and set the core clock
|
||||
@
|
||||
|
||||
@ Turn Off ALL on-chip peripheral clocks for re-configuration
|
||||
@
|
||||
ldr r1, =CKEN
|
||||
mov r2, #0
|
||||
str r2, [r1]
|
||||
|
||||
@ set core clocks
|
||||
@
|
||||
ldr r2, =CFG_CCCR_VAL
|
||||
ldr r1, =CCCR
|
||||
str r2, [r1]
|
||||
|
||||
#ifdef ENABLE32KHZ
|
||||
@ enable the 32Khz oscillator for RTC and PowerManager
|
||||
@
|
||||
ldr r1, =OSCC
|
||||
mov r2, #OSCC_OON
|
||||
str r2, [r1]
|
||||
|
||||
@ NOTE: spin here until OSCC.OOK get set,
|
||||
@ meaning the PLL has settled.
|
||||
@
|
||||
60:
|
||||
ldr r2, [r1]
|
||||
ands r2, r2, #1
|
||||
beq 60b
|
||||
#endif
|
||||
|
||||
@ Turn on needed clocks
|
||||
@
|
||||
ldr r1, =CKEN
|
||||
ldr r2, =CFG_CKEN_VAL
|
||||
str r2, [r1]
|
||||
|
||||
/*SET_LED 7 */
|
||||
|
||||
/* Is this needed???? */
|
||||
#define NODEBUG
|
||||
#ifdef NODEBUG
|
||||
/*Disable software and data breakpoints */
|
||||
mov r0,#0
|
||||
mcr p15,0,r0,c14,c8,0 /* ibcr0 */
|
||||
mcr p15,0,r0,c14,c9,0 /* ibcr1 */
|
||||
mcr p15,0,r0,c14,c4,0 /* dbcon */
|
||||
|
||||
/*Enable all debug functionality */
|
||||
mov r0,#0x80000000
|
||||
mcr p14,0,r0,c10,c0,0 /* dcsr */
|
||||
|
||||
#endif
|
||||
|
||||
/*SET_LED 8 */
|
||||
|
||||
mov pc, r10
|
||||
|
||||
@ End memsetup
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/pxa/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.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 <asm/arch/pxa-regs.h>
|
||||
#include <common.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* local prototypes */
|
||||
|
||||
inline void sleep (int i);
|
||||
|
||||
inline void
|
||||
/**********************************************************/
|
||||
sleep (int i)
|
||||
/**********************************************************/
|
||||
{
|
||||
while (i--) {
|
||||
udelay (1000000);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
board_post_init (void)
|
||||
/**********************************************************/
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
board_init (void)
|
||||
/**********************************************************/
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
/* arch number of MicroSys XM250 */
|
||||
gd->bd->bi_arch_number = 444;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0xa0000100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
dram_init (void)
|
||||
/**********************************************************/
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
|
||||
gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
|
||||
gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
|
||||
gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
+1
-1
@@ -39,7 +39,7 @@ COBJS = main.o ACEX1K.o altera.o bedbug.o \
|
||||
cmd_mem.o cmd_mii.o cmd_misc.o cmd_mmc.o \
|
||||
cmd_nand.o cmd_net.o cmd_nvedit.o \
|
||||
cmd_pci.o cmd_pcmcia.o cmd_portio.o \
|
||||
cmd_reginfo.o cmd_scsi.o cmd_spi.o cmd_usb.o cmd_vfd.o \
|
||||
cmd_reginfo.o cmd_reiser.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_dataflash.o env_flash.o env_eeprom.o env_nvram.o env_nowhere.o exports.o \
|
||||
|
||||
+1
-4
@@ -190,16 +190,13 @@ static unsigned long systemace_read(int dev,
|
||||
/* Write sector count | ReadMemCardData. */
|
||||
ace_writew((trans&0xff) | 0x0300, 0x14);
|
||||
|
||||
/* CONTROLREG = CFGRESET|LOCKREQ */
|
||||
ace_writew(0x0082, 0x18);
|
||||
|
||||
retry = trans * 16;
|
||||
while (retry > 0) {
|
||||
int idx;
|
||||
|
||||
/* Wait for buffer to become ready. */
|
||||
while (! (ace_readw(0x04) & 0x0020)) {
|
||||
udelay(1000);
|
||||
udelay(100);
|
||||
}
|
||||
|
||||
/* Read 16 words of 2bytes from the sector buffer. */
|
||||
|
||||
@@ -68,7 +68,7 @@ autoscript (ulong addr)
|
||||
memmove (hdr, (char *)addr, sizeof(image_header_t));
|
||||
|
||||
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
|
||||
printf ("Bad magic number\n");
|
||||
puts ("Bad magic number\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ autoscript (ulong addr)
|
||||
len = sizeof (image_header_t);
|
||||
data = (ulong)hdr;
|
||||
if (crc32(0, (char *)data, len) != crc) {
|
||||
printf ("Bad header crc\n");
|
||||
puts ("Bad header crc\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -86,13 +86,13 @@ autoscript (ulong addr)
|
||||
|
||||
if (verify) {
|
||||
if (crc32(0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
|
||||
printf ("Bad data crc\n");
|
||||
puts ("Bad data crc\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (hdr->ih_type != IH_TYPE_SCRIPT) {
|
||||
printf ("Bad image type\n");
|
||||
puts ("Bad image type\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ autoscript (ulong addr)
|
||||
len_ptr = (ulong *)data;
|
||||
|
||||
if ((len = ntohl(*len_ptr)) == 0) {
|
||||
printf ("Empty Script\n");
|
||||
puts ("Empty Script\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -77,19 +77,19 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
#endif
|
||||
print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
|
||||
#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_ML300 */
|
||||
printf ("ethaddr =");
|
||||
puts ("ethaddr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
|
||||
}
|
||||
#if (defined CONFIG_PN62) || (defined CONFIG_PPCHAMELEONEVB) \
|
||||
|| (defined CONFIG_MPC8540ADS) || (defined CONFIG_MPC8560ADS)
|
||||
printf ("\neth1addr =");
|
||||
puts ("\neth1addr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]);
|
||||
}
|
||||
#endif /* CONFIG_PN62 */
|
||||
#if defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8560ADS)
|
||||
printf ("\neth2addr =");
|
||||
puts ("\neth2addr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
#ifdef CONFIG_HERMES
|
||||
print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
|
||||
#endif
|
||||
printf ("\nIP addr = "); print_IPaddr (bd->bi_ip_addr);
|
||||
puts ("\nIP addr = "); print_IPaddr (bd->bi_ip_addr);
|
||||
printf ("\nbaudrate = %6ld bps\n", bd->bi_baudrate );
|
||||
return 0;
|
||||
}
|
||||
@@ -117,11 +117,11 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
print_num ("flashsize", (ulong)bd->bi_flashsize);
|
||||
print_num ("flashoffset", (ulong)bd->bi_flashoffset);
|
||||
|
||||
printf ("ethaddr =");
|
||||
puts ("ethaddr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
|
||||
}
|
||||
printf ("\nip_addr = ");
|
||||
puts ("\nip_addr = ");
|
||||
print_IPaddr (bd->bi_ip_addr);
|
||||
printf ("\nbaudrate = %ld bps\n", bd->bi_baudrate);
|
||||
|
||||
@@ -145,11 +145,11 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
print_num ("flashsize", (ulong)bd->bi_flashsize);
|
||||
print_num ("flashoffset", (ulong)bd->bi_flashoffset);
|
||||
|
||||
printf ("ethaddr =");
|
||||
puts ("ethaddr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
|
||||
}
|
||||
printf ("\nip_addr = ");
|
||||
puts ("\nip_addr = ");
|
||||
print_IPaddr (bd->bi_ip_addr);
|
||||
printf ("\nbaudrate = %d bps\n", bd->bi_baudrate);
|
||||
|
||||
@@ -176,11 +176,11 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
print_num("-> size", bd->bi_dram[i].size);
|
||||
}
|
||||
|
||||
printf ("ethaddr =");
|
||||
puts ("ethaddr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
|
||||
}
|
||||
printf ("\n"
|
||||
puts ( "\n"
|
||||
"ip_addr = ");
|
||||
print_IPaddr (bd->bi_ip_addr);
|
||||
printf ("\n"
|
||||
|
||||
+20
-8
@@ -32,7 +32,7 @@
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BMP)
|
||||
|
||||
static int bmp_info (ulong addr);
|
||||
static int bmp_display (ulong addr);
|
||||
static int bmp_display (ulong addr, int x, int y);
|
||||
|
||||
/*
|
||||
* Subroutine: do_bmp
|
||||
@@ -47,6 +47,7 @@ static int bmp_display (ulong addr);
|
||||
int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr;
|
||||
int x = 0, y = 0;
|
||||
|
||||
switch (argc) {
|
||||
case 2: /* use load_addr as default address */
|
||||
@@ -55,6 +56,11 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
case 3: /* use argument */
|
||||
addr = simple_strtoul(argv[2], NULL, 16);
|
||||
break;
|
||||
case 5:
|
||||
addr = simple_strtoul(argv[2], NULL, 16);
|
||||
x = simple_strtoul(argv[3], NULL, 10);
|
||||
y = simple_strtoul(argv[4], NULL, 10);
|
||||
break;
|
||||
default:
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
@@ -66,7 +72,7 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (strncmp(argv[1],"info",1) == 0) {
|
||||
return (bmp_info(addr));
|
||||
} else if (strncmp(argv[1],"display",1) == 0) {
|
||||
return (bmp_display(addr));
|
||||
return (bmp_display(addr, x, y));
|
||||
} else {
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
@@ -74,10 +80,10 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
bmp, 3, 1, do_bmp,
|
||||
bmp, 5, 1, do_bmp,
|
||||
"bmp - manipulate BMP image data\n",
|
||||
"info <imageAddr> - display image info\n"
|
||||
"bmp display <imageAddr> - display image\n"
|
||||
"info <imageAddr> - display image info\n"
|
||||
"bmp display <imageAddr> [x y] - display image at x,y\n"
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -115,11 +121,17 @@ static int bmp_info(ulong addr)
|
||||
* Return: None
|
||||
*
|
||||
*/
|
||||
static int bmp_display(ulong addr)
|
||||
static int bmp_display(ulong addr, int x, int y)
|
||||
{
|
||||
extern int lcd_display_bitmap (ulong);
|
||||
#ifdef CONFIG_LCD
|
||||
extern int lcd_display_bitmap (ulong, int, int);
|
||||
|
||||
return (lcd_display_bitmap (addr));
|
||||
return (lcd_display_bitmap (addr, x, y));
|
||||
#endif
|
||||
#ifdef CONFIG_VIDEO
|
||||
extern int video_display_bitmap (ulong, int, int);
|
||||
return (video_display_bitmap (addr, x, y));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
|
||||
+30
-29
@@ -184,7 +184,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
} else
|
||||
#endif /* __I386__ */
|
||||
{
|
||||
printf ("Bad Magic Number\n");
|
||||
puts ("Bad Magic Number\n");
|
||||
SHOW_BOOT_PROGRESS (-1);
|
||||
return 1;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
hdr->ih_hcrc = 0;
|
||||
|
||||
if (crc32 (0, (char *)data, len) != checksum) {
|
||||
printf ("Bad Header Checksum\n");
|
||||
puts ("Bad Header Checksum\n");
|
||||
SHOW_BOOT_PROGRESS (-2);
|
||||
return 1;
|
||||
}
|
||||
@@ -218,13 +218,13 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
if (verify) {
|
||||
printf (" Verifying Checksum ... ");
|
||||
puts (" Verifying Checksum ... ");
|
||||
if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
|
||||
printf ("Bad Data CRC\n");
|
||||
SHOW_BOOT_PROGRESS (-3);
|
||||
return 1;
|
||||
}
|
||||
printf ("OK\n");
|
||||
puts ("OK\n");
|
||||
}
|
||||
SHOW_BOOT_PROGRESS (4);
|
||||
|
||||
@@ -325,7 +325,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf (" Uncompressing %s ... ", name);
|
||||
if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
|
||||
(uchar *)data, (int *)&len) != 0) {
|
||||
printf ("GUNZIP ERROR - must RESET board to recover\n");
|
||||
puts ("GUNZIP ERROR - must RESET board to recover\n");
|
||||
SHOW_BOOT_PROGRESS (-6);
|
||||
do_reset (cmdtp, flag, argc, argv);
|
||||
}
|
||||
@@ -356,7 +356,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
SHOW_BOOT_PROGRESS (-7);
|
||||
return 1;
|
||||
}
|
||||
printf ("OK\n");
|
||||
puts ("OK\n");
|
||||
SHOW_BOOT_PROGRESS (7);
|
||||
|
||||
switch (hdr->ih_type) {
|
||||
@@ -435,7 +435,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
SHOW_BOOT_PROGRESS (-9);
|
||||
#ifdef DEBUG
|
||||
printf ("\n## Control returned to monitor - resetting...\n");
|
||||
puts ("\n## Control returned to monitor - resetting...\n");
|
||||
do_reset (cmdtp, flag, argc, argv);
|
||||
#endif
|
||||
return 1;
|
||||
@@ -597,7 +597,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
memmove (&header, (char *)addr, sizeof(image_header_t));
|
||||
|
||||
if (hdr->ih_magic != IH_MAGIC) {
|
||||
printf ("Bad Magic Number\n");
|
||||
puts ("Bad Magic Number\n");
|
||||
SHOW_BOOT_PROGRESS (-10);
|
||||
do_reset (cmdtp, flag, argc, argv);
|
||||
}
|
||||
@@ -609,7 +609,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
hdr->ih_hcrc = 0;
|
||||
|
||||
if (crc32 (0, (char *)data, len) != checksum) {
|
||||
printf ("Bad Header Checksum\n");
|
||||
puts ("Bad Header Checksum\n");
|
||||
SHOW_BOOT_PROGRESS (-11);
|
||||
do_reset (cmdtp, flag, argc, argv);
|
||||
}
|
||||
@@ -627,7 +627,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
ulong cdata = data, edata = cdata + len;
|
||||
#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
|
||||
|
||||
printf (" Verifying Checksum ... ");
|
||||
puts (" Verifying Checksum ... ");
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
|
||||
|
||||
@@ -646,11 +646,11 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
|
||||
|
||||
if (csum != hdr->ih_dcrc) {
|
||||
printf ("Bad Data CRC\n");
|
||||
puts ("Bad Data CRC\n");
|
||||
SHOW_BOOT_PROGRESS (-12);
|
||||
do_reset (cmdtp, flag, argc, argv);
|
||||
}
|
||||
printf ("OK\n");
|
||||
puts ("OK\n");
|
||||
}
|
||||
|
||||
SHOW_BOOT_PROGRESS (11);
|
||||
@@ -658,7 +658,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
if ((hdr->ih_os != IH_OS_LINUX) ||
|
||||
(hdr->ih_arch != IH_CPU_PPC) ||
|
||||
(hdr->ih_type != IH_TYPE_RAMDISK) ) {
|
||||
printf ("No Linux PPC Ramdisk Image\n");
|
||||
puts ("No Linux PPC Ramdisk Image\n");
|
||||
SHOW_BOOT_PROGRESS (-13);
|
||||
do_reset (cmdtp, flag, argc, argv);
|
||||
}
|
||||
@@ -756,7 +756,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
|
||||
#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
|
||||
memmove ((void *)initrd_start, (void *)data, len);
|
||||
#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
|
||||
printf ("OK\n");
|
||||
puts ("OK\n");
|
||||
}
|
||||
} else {
|
||||
initrd_start = 0;
|
||||
@@ -1014,7 +1014,7 @@ static int image_info (ulong addr)
|
||||
memmove (&header, (char *)addr, sizeof(image_header_t));
|
||||
|
||||
if (ntohl(hdr->ih_magic) != IH_MAGIC) {
|
||||
printf (" Bad Magic Number\n");
|
||||
puts (" Bad Magic Number\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ static int image_info (ulong addr)
|
||||
hdr->ih_hcrc = 0;
|
||||
|
||||
if (crc32 (0, (char *)data, len) != checksum) {
|
||||
printf (" Bad Header Checksum\n");
|
||||
puts (" Bad Header Checksum\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1035,12 +1035,12 @@ static int image_info (ulong addr)
|
||||
data = addr + sizeof(image_header_t);
|
||||
len = ntohl(hdr->ih_size);
|
||||
|
||||
printf (" Verifying Checksum ... ");
|
||||
puts (" Verifying Checksum ... ");
|
||||
if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
|
||||
printf (" Bad Data CRC\n");
|
||||
puts (" Bad Data CRC\n");
|
||||
return 1;
|
||||
}
|
||||
printf ("OK\n");
|
||||
puts ("OK\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1091,11 +1091,11 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
data = (ulong)hdr + sizeof(image_header_t);
|
||||
len = ntohl(hdr->ih_size);
|
||||
|
||||
printf (" Verifying Checksum ... ");
|
||||
puts (" Verifying Checksum ... ");
|
||||
if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) {
|
||||
printf (" Bad Data CRC\n");
|
||||
puts (" Bad Data CRC\n");
|
||||
}
|
||||
printf ("OK\n");
|
||||
puts ("OK\n");
|
||||
next_sector: ;
|
||||
}
|
||||
next_bank: ;
|
||||
@@ -1128,18 +1128,19 @@ print_image_hdr (image_header_t *hdr)
|
||||
tm.tm_year, tm.tm_mon, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
#endif /* CFG_CMD_DATE, CONFIG_TIMESTAMP */
|
||||
printf (" Image Type: "); print_type(hdr); printf ("\n");
|
||||
printf (" Data Size: %d Bytes = ", ntohl(hdr->ih_size));
|
||||
puts (" Image Type: "); print_type(hdr);
|
||||
printf ("\n Data Size: %d Bytes = ", ntohl(hdr->ih_size));
|
||||
print_size (ntohl(hdr->ih_size), "\n");
|
||||
printf (" Load Address: %08x\n", ntohl(hdr->ih_load));
|
||||
printf (" Entry Point: %08x\n", ntohl(hdr->ih_ep));
|
||||
printf (" Load Address: %08x\n"
|
||||
" Entry Point: %08x\n",
|
||||
ntohl(hdr->ih_load), ntohl(hdr->ih_ep));
|
||||
|
||||
if (hdr->ih_type == IH_TYPE_MULTI) {
|
||||
int i;
|
||||
ulong len;
|
||||
ulong *len_ptr = (ulong *)((ulong)hdr + sizeof(image_header_t));
|
||||
|
||||
printf (" Contents:\n");
|
||||
puts (" Contents:\n");
|
||||
for (i=0; (len = ntohl(*len_ptr)); ++i, ++len_ptr) {
|
||||
printf (" Image %d: %8ld Bytes = ", i, len);
|
||||
print_size (len, "\n");
|
||||
@@ -1244,7 +1245,7 @@ int gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
|
||||
i = 10;
|
||||
flags = src[3];
|
||||
if (src[2] != DEFLATED || (flags & RESERVED) != 0) {
|
||||
printf ("Error: Bad gzipped data\n");
|
||||
puts ("Error: Bad gzipped data\n");
|
||||
return (-1);
|
||||
}
|
||||
if ((flags & EXTRA_FIELD) != 0)
|
||||
@@ -1258,7 +1259,7 @@ int gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
|
||||
if ((flags & HEAD_CRC) != 0)
|
||||
i += 2;
|
||||
if (i >= *lenp) {
|
||||
printf ("Error: gunzip out of data in header\n");
|
||||
puts ("Error: gunzip out of data in header\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -47,14 +47,14 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
switch (argc) {
|
||||
case 2: /* set date & time */
|
||||
if (strcmp(argv[1],"reset") == 0) {
|
||||
printf ("Reset RTC...\n");
|
||||
puts ("Reset RTC...\n");
|
||||
rtc_reset ();
|
||||
} else {
|
||||
/* initialize tm with current time */
|
||||
rtc_get (&tm);
|
||||
/* insert new date & time */
|
||||
if (mk_date (argv[1], &tm) != 0) {
|
||||
printf ("## Bad date format\n");
|
||||
puts ("## Bad date format\n");
|
||||
return 1;
|
||||
}
|
||||
/* and write to RTC */
|
||||
|
||||
+3
-3
@@ -37,11 +37,11 @@ int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
if (argc == 1 || strcmp (argv[1], "run") != 0) {
|
||||
/* List test info */
|
||||
if (argc == 1) {
|
||||
printf ("Available hardware tests:\n");
|
||||
puts ("Available hardware tests:\n");
|
||||
post_info (NULL);
|
||||
printf ("Use 'diag [<test1> [<test2> ...]]'"
|
||||
puts ("Use 'diag [<test1> [<test2> ...]]'"
|
||||
" to get more info.\n");
|
||||
printf ("Use 'diag run [<test1> [<test2> ...]]'"
|
||||
puts ("Use 'diag run [<test1> [<test2> ...]]'"
|
||||
" to run tests.\n");
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
+3
-3
@@ -75,7 +75,7 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
rcode = eeprom_read (dev_addr, off, (uchar *) addr, cnt);
|
||||
|
||||
printf ("done\n");
|
||||
puts ("done\n");
|
||||
return rcode;
|
||||
} else if (strcmp (argv[1], "write") == 0) {
|
||||
int rcode;
|
||||
@@ -84,7 +84,7 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
rcode = eeprom_write (dev_addr, off, (uchar *) addr, cnt);
|
||||
|
||||
printf ("done\n");
|
||||
puts ("done\n");
|
||||
return rcode;
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
|
||||
#endif
|
||||
}
|
||||
if (i == MAX_ACKNOWLEDGE_POLLS) {
|
||||
printf("EEPROM poll acknowledge failed\n");
|
||||
puts ("EEPROM poll acknowledge failed\n");
|
||||
rcode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -103,7 +103,7 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if ((tmp = getenv ("loadaddr")) != NULL) {
|
||||
addr = simple_strtoul (tmp, NULL, 16);
|
||||
} else {
|
||||
printf ("No load address provided\n");
|
||||
puts ("No load address provided\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
tmp = (char *) CFG_ETHERNET_MAC_ADDR;
|
||||
memcpy ((char *) tmp, (char *) &gd->bd->bi_enetaddr[0], 6);
|
||||
#else
|
||||
printf ("## Ethernet MAC address not copied to NV RAM\n");
|
||||
puts ("## Ethernet MAC address not copied to NV RAM\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -200,7 +200,7 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
* to just copy
|
||||
*/
|
||||
|
||||
printf ("No bootargs defined\n");
|
||||
puts ("No bootargs defined\n");
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
@@ -214,7 +214,7 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (valid_elf_image (addr)) {
|
||||
addr = load_elf_image (addr);
|
||||
} else {
|
||||
printf ("## Not an ELF image, assuming binary\n");
|
||||
puts ("## Not an ELF image, assuming binary\n");
|
||||
/* leave addr as load_addr */
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
((void (*)(void)) addr) ();
|
||||
|
||||
printf ("## vxWorks terminated\n");
|
||||
puts ("## vxWorks terminated\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -149,14 +149,14 @@ flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
|
||||
if (addr_last > b_end) {
|
||||
s_last[bank] = s_end;
|
||||
} else {
|
||||
printf ("Error: end address"
|
||||
puts ("Error: end address"
|
||||
" not on sector boundary\n");
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s_last[bank] < s_first[bank]) {
|
||||
printf ("Error: end sector"
|
||||
puts ("Error: end sector"
|
||||
" precedes start sector\n");
|
||||
rcode = 1;
|
||||
break;
|
||||
@@ -165,7 +165,7 @@ flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
|
||||
addr_first = (sect == s_end) ? b_end + 1: info->start[sect + 1];
|
||||
(*s_count) += s_last[bank] - s_first[bank] + 1;
|
||||
} else if (s_last[bank] >= 0) {
|
||||
printf("Error: cannot span across banks when they are"
|
||||
puts ("Error: cannot span across banks when they are"
|
||||
" mapped in reverse order\n");
|
||||
rcode = 1;
|
||||
break;
|
||||
@@ -225,7 +225,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
if ((n = abbrev_spec(argv[1], &info, §_first, §_last)) != 0) {
|
||||
if (n < 0) {
|
||||
printf("Bad sector specification\n");
|
||||
puts ("Bad sector specification\n");
|
||||
return 1;
|
||||
}
|
||||
printf ("Erase Flash Sectors %d-%d in Bank # %d ",
|
||||
@@ -294,7 +294,7 @@ int flash_sect_erase (ulong addr_first, ulong addr_last)
|
||||
}
|
||||
printf ("Erased %d sectors\n", erased);
|
||||
} else if (rcode == 0) {
|
||||
printf ("Error: start and/or end address"
|
||||
puts ("Error: start and/or end address"
|
||||
" not on sector boundary\n");
|
||||
rcode = 1;
|
||||
}
|
||||
@@ -332,7 +332,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (addr_dataflash(addr_first) && addr_dataflash(addr_last)) {
|
||||
status = dataflash_real_protect(p,addr_first,addr_last);
|
||||
if (status < 0){
|
||||
printf("Bad DataFlash sector specification\n");
|
||||
puts ("Bad DataFlash sector specification\n");
|
||||
return 1;
|
||||
}
|
||||
printf("%sProtect %d DataFlash Sectors\n",
|
||||
@@ -371,7 +371,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
if ((n = abbrev_spec(argv[2], &info, §_first, §_last)) != 0) {
|
||||
if (n < 0) {
|
||||
printf("Bad sector specification\n");
|
||||
puts ("Bad sector specification\n");
|
||||
return 1;
|
||||
}
|
||||
printf("%sProtect Flash Sectors %d-%d in Bank # %d\n",
|
||||
@@ -411,7 +411,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
info = &flash_info[bank-1];
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
puts ("missing or unknown FLASH type\n");
|
||||
return 1;
|
||||
}
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
@@ -485,7 +485,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
|
||||
printf ("%sProtected %d sectors\n",
|
||||
p ? "" : "Un-", protected);
|
||||
} else if (rcode == 0) {
|
||||
printf ("Error: start and/or end address"
|
||||
puts ("Error: start and/or end address"
|
||||
" not on sector boundary\n");
|
||||
rcode = 1;
|
||||
}
|
||||
|
||||
+114
-114
@@ -186,7 +186,7 @@ int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
|
||||
|
||||
if(i2c_read(chip, addr, alen, linebuf, linebytes) != 0) {
|
||||
printf("Error reading the chip.\n");
|
||||
puts ("Error reading the chip.\n");
|
||||
} else {
|
||||
printf("%04x:", addr);
|
||||
cp = linebuf;
|
||||
@@ -194,16 +194,16 @@ int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf(" %02x", *cp++);
|
||||
addr++;
|
||||
}
|
||||
printf(" ");
|
||||
puts (" ");
|
||||
cp = linebuf;
|
||||
for (j=0; j<linebytes; j++) {
|
||||
if ((*cp < 0x20) || (*cp > 0x7e))
|
||||
printf(".");
|
||||
puts (".");
|
||||
else
|
||||
printf("%c", *cp);
|
||||
cp++;
|
||||
}
|
||||
printf("\n");
|
||||
putc ('\n');
|
||||
}
|
||||
nbytes -= linebytes;
|
||||
} while (nbytes > 0);
|
||||
@@ -285,7 +285,7 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
while (count-- > 0) {
|
||||
if(i2c_write(chip, addr++, alen, &byte, 1) != 0) {
|
||||
printf("Error writing the chip.\n");
|
||||
puts ("Error writing the chip.\n");
|
||||
}
|
||||
/*
|
||||
* Wait for the write to complete. The write can take
|
||||
@@ -374,7 +374,7 @@ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
if(err > 0)
|
||||
{
|
||||
printf("Error reading the chip,\n");
|
||||
puts ("Error reading the chip,\n");
|
||||
} else {
|
||||
printf ("%08lx\n", crc);
|
||||
}
|
||||
@@ -456,7 +456,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
do {
|
||||
printf("%08lx:", addr);
|
||||
if(i2c_read(chip, addr, alen, (char *)&data, size) != 0) {
|
||||
printf("\nError reading the chip,\n");
|
||||
puts ("\nError reading the chip,\n");
|
||||
} else {
|
||||
data = cpu_to_be32(data);
|
||||
if(size == 1) {
|
||||
@@ -505,7 +505,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
reset_cmd_timeout();
|
||||
#endif
|
||||
if(i2c_write(chip, addr, alen, (char *)&data, size) != 0) {
|
||||
printf("Error writing the chip.\n");
|
||||
puts ("Error writing the chip.\n");
|
||||
}
|
||||
#ifdef CFG_EEPROM_PAGE_WRITE_DELAY_MS
|
||||
udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
|
||||
@@ -534,7 +534,7 @@ int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
int k, skip;
|
||||
#endif
|
||||
|
||||
printf("Valid chip addresses:");
|
||||
puts ("Valid chip addresses:");
|
||||
for(j = 0; j < 128; j++) {
|
||||
#if defined(CFG_I2C_NOPROBES)
|
||||
skip = 0;
|
||||
@@ -551,13 +551,13 @@ int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf(" %02X", j);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
putc ('\n');
|
||||
|
||||
#if defined(CFG_I2C_NOPROBES)
|
||||
puts ("Excluded chip addresses:");
|
||||
for( k = 0; k < sizeof(i2c_no_probes); k++ )
|
||||
printf(" %02X", i2c_no_probes[k] );
|
||||
puts ("\n");
|
||||
putc ('\n');
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
@@ -629,7 +629,7 @@ int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
*/
|
||||
while(1) {
|
||||
if(i2c_read(chip, addr, alen, bytes, length) != 0) {
|
||||
printf("Error reading the chip.\n");
|
||||
puts ("Error reading the chip.\n");
|
||||
}
|
||||
udelay(delay);
|
||||
}
|
||||
@@ -666,7 +666,7 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
chip = simple_strtoul(argv[1], NULL, 16);
|
||||
|
||||
if(i2c_read(chip, 0, 1, data, sizeof(data)) != 0) {
|
||||
printf("No SDRAM Serial Presence Detect found.\n");
|
||||
puts ("No SDRAM Serial Presence Detect found.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -683,19 +683,19 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
(data[62] >> 4) & 0x0F, data[62] & 0x0F);
|
||||
printf("Bytes used 0x%02X\n", data[0]);
|
||||
printf("Serial memory size 0x%02X\n", 1 << data[1]);
|
||||
printf("Memory type ");
|
||||
puts ("Memory type ");
|
||||
switch(data[2]) {
|
||||
case 2: printf("EDO\n"); break;
|
||||
case 4: printf("SDRAM\n"); break;
|
||||
default: printf("unknown\n"); break;
|
||||
case 2: puts ("EDO\n"); break;
|
||||
case 4: puts ("SDRAM\n"); break;
|
||||
default: puts ("unknown\n"); break;
|
||||
}
|
||||
printf("Row address bits ");
|
||||
puts ("Row address bits ");
|
||||
if((data[3] & 0x00F0) == 0) {
|
||||
printf("%d\n", data[3] & 0x0F);
|
||||
} else {
|
||||
printf("%d/%d\n", data[3] & 0x0F, (data[3] >> 4) & 0x0F);
|
||||
}
|
||||
printf("Column address bits ");
|
||||
puts ("Column address bits ");
|
||||
if((data[4] & 0x00F0) == 0) {
|
||||
printf("%d\n", data[4] & 0x0F);
|
||||
} else {
|
||||
@@ -703,39 +703,39 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
printf("Module rows %d\n", data[5]);
|
||||
printf("Module data width %d bits\n", (data[7] << 8) | data[6]);
|
||||
printf("Interface signal levels ");
|
||||
puts ("Interface signal levels ");
|
||||
switch(data[8]) {
|
||||
case 0: printf("5.0v/TTL\n"); break;
|
||||
case 1: printf("LVTTL\n"); break;
|
||||
case 2: printf("HSTL 1.5\n"); break;
|
||||
case 3: printf("SSTL 3.3\n"); break;
|
||||
case 4: printf("SSTL 2.5\n"); break;
|
||||
default: printf("unknown\n"); break;
|
||||
case 0: puts ("5.0v/TTL\n"); break;
|
||||
case 1: puts ("LVTTL\n"); break;
|
||||
case 2: puts ("HSTL 1.5\n"); break;
|
||||
case 3: puts ("SSTL 3.3\n"); break;
|
||||
case 4: puts ("SSTL 2.5\n"); break;
|
||||
default: puts ("unknown\n"); break;
|
||||
}
|
||||
printf("SDRAM cycle time %d.%d nS\n",
|
||||
(data[9] >> 4) & 0x0F, data[9] & 0x0F);
|
||||
printf("SDRAM access time %d.%d nS\n",
|
||||
(data[10] >> 4) & 0x0F, data[10] & 0x0F);
|
||||
printf("EDC configuration ");
|
||||
puts ("EDC configuration ");
|
||||
switch(data[11]) {
|
||||
case 0: printf("None\n"); break;
|
||||
case 1: printf("Parity\n"); break;
|
||||
case 2: printf("ECC\n"); break;
|
||||
default: printf("unknown\n"); break;
|
||||
case 0: puts ("None\n"); break;
|
||||
case 1: puts ("Parity\n"); break;
|
||||
case 2: puts ("ECC\n"); break;
|
||||
default: puts ("unknown\n"); break;
|
||||
}
|
||||
if((data[12] & 0x80) == 0) {
|
||||
printf("No self refresh, rate ");
|
||||
puts ("No self refresh, rate ");
|
||||
} else {
|
||||
printf("Self refresh, rate ");
|
||||
puts ("Self refresh, rate ");
|
||||
}
|
||||
switch(data[12] & 0x7F) {
|
||||
case 0: printf("15.625uS\n"); break;
|
||||
case 1: printf("3.9uS\n"); break;
|
||||
case 2: printf("7.8uS\n"); break;
|
||||
case 3: printf("31.3uS\n"); break;
|
||||
case 4: printf("62.5uS\n"); break;
|
||||
case 5: printf("125uS\n"); break;
|
||||
default: printf("unknown\n"); break;
|
||||
case 0: puts ("15.625uS\n"); break;
|
||||
case 1: puts ("3.9uS\n"); break;
|
||||
case 2: puts ("7.8uS\n"); break;
|
||||
case 3: puts ("31.3uS\n"); break;
|
||||
case 4: puts ("62.5uS\n"); break;
|
||||
case 5: puts ("125uS\n"); break;
|
||||
default: puts ("unknown\n"); break;
|
||||
}
|
||||
printf("SDRAM width (primary) %d\n", data[13] & 0x7F);
|
||||
if((data[13] & 0x80) != 0) {
|
||||
@@ -752,65 +752,65 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
printf("Min clock delay, back-to-back random column addresses %d\n",
|
||||
data[15]);
|
||||
printf("Burst length(s) ");
|
||||
if(data[16] & 0x80) printf(" Page");
|
||||
if(data[16] & 0x08) printf(" 8");
|
||||
if(data[16] & 0x04) printf(" 4");
|
||||
if(data[16] & 0x02) printf(" 2");
|
||||
if(data[16] & 0x01) printf(" 1");
|
||||
printf("\n");
|
||||
puts ("Burst length(s) ");
|
||||
if (data[16] & 0x80) puts (" Page");
|
||||
if (data[16] & 0x08) puts (" 8");
|
||||
if (data[16] & 0x04) puts (" 4");
|
||||
if (data[16] & 0x02) puts (" 2");
|
||||
if (data[16] & 0x01) puts (" 1");
|
||||
putc ('\n');
|
||||
printf("Number of banks %d\n", data[17]);
|
||||
printf("CAS latency(s) ");
|
||||
if(data[18] & 0x80) printf(" TBD");
|
||||
if(data[18] & 0x40) printf(" 7");
|
||||
if(data[18] & 0x20) printf(" 6");
|
||||
if(data[18] & 0x10) printf(" 5");
|
||||
if(data[18] & 0x08) printf(" 4");
|
||||
if(data[18] & 0x04) printf(" 3");
|
||||
if(data[18] & 0x02) printf(" 2");
|
||||
if(data[18] & 0x01) printf(" 1");
|
||||
printf("\n");
|
||||
printf("CS latency(s) ");
|
||||
if(data[19] & 0x80) printf(" TBD");
|
||||
if(data[19] & 0x40) printf(" 6");
|
||||
if(data[19] & 0x20) printf(" 5");
|
||||
if(data[19] & 0x10) printf(" 4");
|
||||
if(data[19] & 0x08) printf(" 3");
|
||||
if(data[19] & 0x04) printf(" 2");
|
||||
if(data[19] & 0x02) printf(" 1");
|
||||
if(data[19] & 0x01) printf(" 0");
|
||||
printf("\n");
|
||||
printf("WE latency(s) ");
|
||||
if(data[20] & 0x80) printf(" TBD");
|
||||
if(data[20] & 0x40) printf(" 6");
|
||||
if(data[20] & 0x20) printf(" 5");
|
||||
if(data[20] & 0x10) printf(" 4");
|
||||
if(data[20] & 0x08) printf(" 3");
|
||||
if(data[20] & 0x04) printf(" 2");
|
||||
if(data[20] & 0x02) printf(" 1");
|
||||
if(data[20] & 0x01) printf(" 0");
|
||||
printf("\n");
|
||||
printf("Module attributes:\n");
|
||||
if(!data[21]) printf(" (none)\n");
|
||||
if(data[21] & 0x80) printf(" TBD (bit 7)\n");
|
||||
if(data[21] & 0x40) printf(" Redundant row address\n");
|
||||
if(data[21] & 0x20) printf(" Differential clock input\n");
|
||||
if(data[21] & 0x10) printf(" Registerd DQMB inputs\n");
|
||||
if(data[21] & 0x08) printf(" Buffered DQMB inputs\n");
|
||||
if(data[21] & 0x04) printf(" On-card PLL\n");
|
||||
if(data[21] & 0x02) printf(" Registered address/control lines\n");
|
||||
if(data[21] & 0x01) printf(" Buffered address/control lines\n");
|
||||
printf("Device attributes:\n");
|
||||
if(data[22] & 0x80) printf(" TBD (bit 7)\n");
|
||||
if(data[22] & 0x40) printf(" TBD (bit 6)\n");
|
||||
if(data[22] & 0x20) printf(" Upper Vcc tolerance 5%%\n");
|
||||
else printf(" Upper Vcc tolerance 10%%\n");
|
||||
if(data[22] & 0x10) printf(" Lower Vcc tolerance 5%%\n");
|
||||
else printf(" Lower Vcc tolerance 10%%\n");
|
||||
if(data[22] & 0x08) printf(" Supports write1/read burst\n");
|
||||
if(data[22] & 0x04) printf(" Supports precharge all\n");
|
||||
if(data[22] & 0x02) printf(" Supports auto precharge\n");
|
||||
if(data[22] & 0x01) printf(" Supports early RAS# precharge\n");
|
||||
puts ("CAS latency(s) ");
|
||||
if (data[18] & 0x80) puts (" TBD");
|
||||
if (data[18] & 0x40) puts (" 7");
|
||||
if (data[18] & 0x20) puts (" 6");
|
||||
if (data[18] & 0x10) puts (" 5");
|
||||
if (data[18] & 0x08) puts (" 4");
|
||||
if (data[18] & 0x04) puts (" 3");
|
||||
if (data[18] & 0x02) puts (" 2");
|
||||
if (data[18] & 0x01) puts (" 1");
|
||||
putc ('\n');
|
||||
puts ("CS latency(s) ");
|
||||
if (data[19] & 0x80) puts (" TBD");
|
||||
if (data[19] & 0x40) puts (" 6");
|
||||
if (data[19] & 0x20) puts (" 5");
|
||||
if (data[19] & 0x10) puts (" 4");
|
||||
if (data[19] & 0x08) puts (" 3");
|
||||
if (data[19] & 0x04) puts (" 2");
|
||||
if (data[19] & 0x02) puts (" 1");
|
||||
if (data[19] & 0x01) puts (" 0");
|
||||
putc ('\n');
|
||||
puts ("WE latency(s) ");
|
||||
if (data[20] & 0x80) puts (" TBD");
|
||||
if (data[20] & 0x40) puts (" 6");
|
||||
if (data[20] & 0x20) puts (" 5");
|
||||
if (data[20] & 0x10) puts (" 4");
|
||||
if (data[20] & 0x08) puts (" 3");
|
||||
if (data[20] & 0x04) puts (" 2");
|
||||
if (data[20] & 0x02) puts (" 1");
|
||||
if (data[20] & 0x01) puts (" 0");
|
||||
putc ('\n');
|
||||
puts ("Module attributes:\n");
|
||||
if (!data[21]) puts (" (none)\n");
|
||||
if (data[21] & 0x80) puts (" TBD (bit 7)\n");
|
||||
if (data[21] & 0x40) puts (" Redundant row address\n");
|
||||
if (data[21] & 0x20) puts (" Differential clock input\n");
|
||||
if (data[21] & 0x10) puts (" Registerd DQMB inputs\n");
|
||||
if (data[21] & 0x08) puts (" Buffered DQMB inputs\n");
|
||||
if (data[21] & 0x04) puts (" On-card PLL\n");
|
||||
if (data[21] & 0x02) puts (" Registered address/control lines\n");
|
||||
if (data[21] & 0x01) puts (" Buffered address/control lines\n");
|
||||
puts ("Device attributes:\n");
|
||||
if (data[22] & 0x80) puts (" TBD (bit 7)\n");
|
||||
if (data[22] & 0x40) puts (" TBD (bit 6)\n");
|
||||
if (data[22] & 0x20) puts (" Upper Vcc tolerance 5%\n");
|
||||
else puts (" Upper Vcc tolerance 10%\n");
|
||||
if (data[22] & 0x10) puts (" Lower Vcc tolerance 5%\n");
|
||||
else puts (" Lower Vcc tolerance 10%\n");
|
||||
if (data[22] & 0x08) puts (" Supports write1/read burst\n");
|
||||
if (data[22] & 0x04) puts (" Supports precharge all\n");
|
||||
if (data[22] & 0x02) puts (" Supports auto precharge\n");
|
||||
if (data[22] & 0x01) puts (" Supports early RAS# precharge\n");
|
||||
printf("SDRAM cycle time (2nd highest CAS latency) %d.%d nS\n",
|
||||
(data[23] >> 4) & 0x0F, data[23] & 0x0F);
|
||||
printf("SDRAM access from clock (2nd highest CAS latency) %d.%d nS\n",
|
||||
@@ -823,16 +823,16 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf("Row active to row active min %d nS\n", data[28]);
|
||||
printf("RAS to CAS delay min %d nS\n", data[29]);
|
||||
printf("Minimum RAS pulse width %d nS\n", data[30]);
|
||||
printf("Density of each row ");
|
||||
if(data[31] & 0x80) printf(" 512MByte");
|
||||
if(data[31] & 0x40) printf(" 256MByte");
|
||||
if(data[31] & 0x20) printf(" 128MByte");
|
||||
if(data[31] & 0x10) printf(" 64MByte");
|
||||
if(data[31] & 0x08) printf(" 32MByte");
|
||||
if(data[31] & 0x04) printf(" 16MByte");
|
||||
if(data[31] & 0x02) printf(" 8MByte");
|
||||
if(data[31] & 0x01) printf(" 4MByte");
|
||||
printf("\n");
|
||||
puts ("Density of each row ");
|
||||
if (data[31] & 0x80) puts (" 512");
|
||||
if (data[31] & 0x40) puts (" 256");
|
||||
if (data[31] & 0x20) puts (" 128");
|
||||
if (data[31] & 0x10) puts (" 64");
|
||||
if (data[31] & 0x08) puts (" 32");
|
||||
if (data[31] & 0x04) puts (" 16");
|
||||
if (data[31] & 0x02) puts (" 8");
|
||||
if (data[31] & 0x01) puts (" 4");
|
||||
puts ("MByte\n");
|
||||
printf("Command and Address setup %c%d.%d nS\n",
|
||||
(data[32] & 0x80) ? '-' : '+',
|
||||
(data[32] >> 4) & 0x07, data[32] & 0x0F);
|
||||
@@ -845,21 +845,21 @@ int do_sdram ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf("Data signal input hold %c%d.%d nS\n",
|
||||
(data[35] & 0x80) ? '-' : '+',
|
||||
(data[35] >> 4) & 0x07, data[35] & 0x0F);
|
||||
printf("Manufacturer's JEDEC ID ");
|
||||
puts ("Manufacturer's JEDEC ID ");
|
||||
for(j = 64; j <= 71; j++)
|
||||
printf("%02X ", data[j]);
|
||||
printf("\n");
|
||||
putc ('\n');
|
||||
printf("Manufacturing Location %02X\n", data[72]);
|
||||
printf("Manufacturer's Part Number ");
|
||||
puts ("Manufacturer's Part Number ");
|
||||
for(j = 73; j <= 90; j++)
|
||||
printf("%02X ", data[j]);
|
||||
printf("\n");
|
||||
putc ('\n');
|
||||
printf("Revision Code %02X %02X\n", data[91], data[92]);
|
||||
printf("Manufacturing Date %02X %02X\n", data[93], data[94]);
|
||||
printf("Assembly Serial Number ");
|
||||
puts ("Assembly Serial Number ");
|
||||
for(j = 95; j <= 98; j++)
|
||||
printf("%02X ", data[j]);
|
||||
printf("\n");
|
||||
putc ('\n');
|
||||
printf("Speed rating PC%d\n",
|
||||
data[126] == 0x66 ? 66 : data[126]);
|
||||
|
||||
|
||||
+175
-61
@@ -139,7 +139,7 @@ static block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_LED
|
||||
#if !defined(CONFIG_KUP4K) && !defined(CONFIG_BMS2003)
|
||||
#if !defined(CONFIG_KUP4K) && !defined(CONFIG_HMI10)
|
||||
static void ide_led (uchar led, uchar status);
|
||||
#else
|
||||
extern void ide_led (uchar led, uchar status);
|
||||
@@ -180,7 +180,7 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len
|
||||
|
||||
#ifdef CONFIG_ATAPI
|
||||
static void atapi_inquiry(block_dev_desc_t *dev_desc);
|
||||
ulong atapi_read (int device, ulong blknr, ulong blkcnt, ulong *buffer);
|
||||
ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -303,12 +303,19 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
if (strcmp(argv[1],"read") == 0) {
|
||||
ulong addr = simple_strtoul(argv[2], NULL, 16);
|
||||
ulong blk = simple_strtoul(argv[3], NULL, 16);
|
||||
ulong cnt = simple_strtoul(argv[4], NULL, 16);
|
||||
ulong n;
|
||||
#ifdef CFG_64BIT_STRTOUL
|
||||
lbaint_t blk = simple_strtoull(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE read: device %d block # %qd, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#else
|
||||
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE read: device %d block # %ld, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#endif
|
||||
|
||||
n = ide_dev_desc[curr_device].block_read (curr_device,
|
||||
blk, cnt,
|
||||
@@ -325,12 +332,19 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
} else if (strcmp(argv[1],"write") == 0) {
|
||||
ulong addr = simple_strtoul(argv[2], NULL, 16);
|
||||
ulong blk = simple_strtoul(argv[3], NULL, 16);
|
||||
ulong cnt = simple_strtoul(argv[4], NULL, 16);
|
||||
ulong n;
|
||||
#ifdef CFG_64BIT_STRTOUL
|
||||
lbaint_t blk = simple_strtoull(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE write: device %d block # %qd, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#else
|
||||
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE write: device %d block # %ld, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#endif
|
||||
|
||||
n = ide_write (curr_device, blk, cnt, (ulong *)addr);
|
||||
|
||||
@@ -495,6 +509,7 @@ void ide_init (void)
|
||||
#endif /* CONFIG_IDE_8xx_PCCARD */
|
||||
|
||||
#ifdef CONFIG_IDE_PREINIT
|
||||
extern int ide_preinit (void);
|
||||
WATCHDOG_RESET();
|
||||
|
||||
if (ide_preinit ()) {
|
||||
@@ -607,8 +622,7 @@ void ide_init (void)
|
||||
ide_led ((LED_IDE1 | LED_IDE2), 0); /* LED's off */
|
||||
#ifdef CONFIG_AMIGAONEG3SE
|
||||
/* If this is the second bus, the first one was OK */
|
||||
if (bus != 0)
|
||||
{
|
||||
if (bus != 0) {
|
||||
ide_bus_ok[bus] = 0;
|
||||
goto skip_bus;
|
||||
}
|
||||
@@ -838,7 +852,7 @@ output_data_short(int dev, ulong *sect_buf, int words)
|
||||
static void
|
||||
input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
volatile ushort *pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
ushort *dbuf = (ushort *)sect_buf;
|
||||
|
||||
@@ -846,7 +860,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
*dbuf++ = ld_le16(pbuf);
|
||||
*dbuf++ = ld_le16(pbuf);
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar i;
|
||||
volatile uchar *pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
|
||||
volatile uchar *pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
@@ -859,7 +873,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
dbuf+=1;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
|
||||
|
||||
@@ -868,7 +882,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
static void
|
||||
output_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -880,7 +894,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -898,7 +912,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
static void
|
||||
@@ -912,7 +926,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
static void
|
||||
input_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -924,7 +938,7 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -942,7 +956,7 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
static void
|
||||
@@ -968,8 +982,7 @@ input_data_short(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
}
|
||||
|
||||
if (words&1)
|
||||
{
|
||||
if (words&1) {
|
||||
ushort dummy;
|
||||
dummy = *pbuf;
|
||||
}
|
||||
@@ -1023,8 +1036,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
retries = 0;
|
||||
|
||||
/* Warning: This will be tricky to read */
|
||||
while (retries <= 1)
|
||||
{
|
||||
while (retries <= 1) {
|
||||
#endif /* CONFIG_AMIGAONEG3SE */
|
||||
|
||||
/* check signature */
|
||||
@@ -1042,8 +1054,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
* to become ready
|
||||
*/
|
||||
c = ide_wait (device, ATAPI_TIME_OUT);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Start Ident Command
|
||||
@@ -1090,6 +1101,18 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
ident_cpy (dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision));
|
||||
ident_cpy (dev_desc->vendor, iop->model, sizeof(dev_desc->vendor));
|
||||
ident_cpy (dev_desc->product, iop->serial_no, sizeof(dev_desc->product));
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
/*
|
||||
* firmware revision and model number have Big Endian Byte
|
||||
* order in Word. Convert both to little endian.
|
||||
*
|
||||
* See CF+ and CompactFlash Specification Revision 2.0:
|
||||
* 6.2.1.6: Identfy Drive, Table 39 for more details
|
||||
*/
|
||||
|
||||
strswab (dev_desc->revision);
|
||||
strswab (dev_desc->vendor);
|
||||
#endif /* __LITTLE_ENDIAN */
|
||||
|
||||
if ((iop->config & 0x0080)==0x0080)
|
||||
dev_desc->removable = 1;
|
||||
@@ -1131,8 +1154,31 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
}
|
||||
#endif /* CONFIG_ATAPI */
|
||||
|
||||
#ifdef __BIG_ENDIAN
|
||||
/* swap shorts */
|
||||
dev_desc->lba = (iop->lba_capacity << 16) | (iop->lba_capacity >> 16);
|
||||
#else /* ! __BIG_ENDIAN */
|
||||
/*
|
||||
* do not swap shorts on little endian
|
||||
*
|
||||
* See CF+ and CompactFlash Specification Revision 2.0:
|
||||
* 6.2.1.6: Identfy Drive, Table 39, Word Address 57-58 for details.
|
||||
*/
|
||||
dev_desc->lba = iop->lba_capacity;
|
||||
#endif /* __BIG_ENDIAN */
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (iop->command_set_2 & 0x0400) { /* LBA 48 support */
|
||||
dev_desc->lba48support = 1;
|
||||
dev_desc->lba48 = (unsigned long long)iop->lba48_capacity[0] |
|
||||
((unsigned long long)iop->lba48_capacity[1] << 16) |
|
||||
((unsigned long long)iop->lba48_capacity[2] << 32) |
|
||||
((unsigned long long)iop->lba48_capacity[3] << 48);
|
||||
} else {
|
||||
dev_desc->lba48support = 0;
|
||||
dev_desc->lba48 = 0;
|
||||
}
|
||||
#endif /* CONFIG_LBA48 */
|
||||
/* assuming HD */
|
||||
dev_desc->type=DEV_TYPE_HARDDISK;
|
||||
dev_desc->blksz=ATA_BLOCKSIZE;
|
||||
@@ -1158,13 +1204,20 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
|
||||
{
|
||||
ulong n = 0;
|
||||
unsigned char c;
|
||||
unsigned char pwrsave=0; /* power save */
|
||||
#ifdef CONFIG_LBA48
|
||||
unsigned char lba48 = 0;
|
||||
|
||||
PRINTF ("ide_read dev %d start %lX, blocks %lX buffer at %lX\n",
|
||||
if (blknr & 0x0000fffff0000000) {
|
||||
/* more than 28 bits used, use 48bit mode */
|
||||
lba48 = 1;
|
||||
}
|
||||
#endif
|
||||
PRINTF ("ide_read dev %d start %qX, blocks %lX buffer at %lX\n",
|
||||
device, blknr, blkcnt, (ulong)buffer);
|
||||
|
||||
ide_led (DEVICE_LED(device), 1); /* LED on */
|
||||
@@ -1208,15 +1261,33 @@ ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
printf ("IDE read: device %d not ready\n", device);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
/* write high bits */
|
||||
ide_outb (device, ATA_SECT_CNT, 0);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
|
||||
}
|
||||
#endif
|
||||
ide_outb (device, ATA_SECT_CNT, 1);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_READ);
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_READ_EXT);
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_READ);
|
||||
}
|
||||
|
||||
udelay (50);
|
||||
|
||||
@@ -1228,8 +1299,13 @@ ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
}
|
||||
|
||||
if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) {
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
|
||||
printf ("Error (no IRQ) dev %d blk %qd: status 0x%02x\n",
|
||||
device, blknr, c);
|
||||
#else
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
device, (ulong)blknr, c);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1248,10 +1324,18 @@ IDE_READ_E:
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
ulong ide_write (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
|
||||
{
|
||||
ulong n = 0;
|
||||
unsigned char c;
|
||||
#ifdef CONFIG_LBA48
|
||||
unsigned char lba48 = 0;
|
||||
|
||||
if (blknr & 0x0000fffff0000000) {
|
||||
/* more than 28 bits used, use 48bit mode */
|
||||
lba48 = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
ide_led (DEVICE_LED(device), 1); /* LED on */
|
||||
|
||||
@@ -1267,23 +1351,46 @@ ulong ide_write (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
printf ("IDE read: device %d not ready\n", device);
|
||||
goto WR_OUT;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
/* write high bits */
|
||||
ide_outb (device, ATA_SECT_CNT, 0);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
|
||||
}
|
||||
#endif
|
||||
ide_outb (device, ATA_SECT_CNT, 1);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_WRITE);
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_WRITE_EXT);
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_WRITE);
|
||||
}
|
||||
|
||||
udelay (50);
|
||||
|
||||
c = ide_wait (device, IDE_TIME_OUT); /* can't take over 500 ms */
|
||||
|
||||
if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) {
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
|
||||
printf ("Error (no IRQ) dev %d blk %qd: status 0x%02x\n",
|
||||
device, blknr, c);
|
||||
#else
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
device, (ulong)blknr, c);
|
||||
#endif
|
||||
goto WR_OUT;
|
||||
}
|
||||
|
||||
@@ -1303,27 +1410,31 @@ WR_OUT:
|
||||
/*
|
||||
* copy src to dest, skipping leading and trailing blanks and null
|
||||
* terminate the string
|
||||
* "len" is the size of available memory including the terminating '\0'
|
||||
*/
|
||||
static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len)
|
||||
static void ident_cpy (unsigned char *dst, unsigned char *src, unsigned int len)
|
||||
{
|
||||
int start,end;
|
||||
unsigned char *end, *last;
|
||||
|
||||
start=0;
|
||||
while (start<len) {
|
||||
if (src[start]!=' ')
|
||||
break;
|
||||
start++;
|
||||
last = dst;
|
||||
end = src + len - 1;
|
||||
|
||||
/* reserve space for '\0' */
|
||||
if (len < 2)
|
||||
goto OUT;
|
||||
|
||||
/* skip leading white space */
|
||||
while ((*src) && (src<end) && (*src==' '))
|
||||
++src;
|
||||
|
||||
/* copy string, omitting trailing white space */
|
||||
while ((*src) && (src<end)) {
|
||||
*dst++ = *src;
|
||||
if (*src++ != ' ')
|
||||
last = dst;
|
||||
}
|
||||
end=len-1;
|
||||
while (end>start) {
|
||||
if (src[end]!=' ')
|
||||
break;
|
||||
end--;
|
||||
}
|
||||
for ( ; start<=end; start++) {
|
||||
*dest++=src[start];
|
||||
}
|
||||
*dest='\0';
|
||||
OUT:
|
||||
*last = '\0';
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -1426,7 +1537,7 @@ static void ide_reset (void)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE) && !defined(CONFIG_KUP4K) && !defined(CONFIG_BMS2003)
|
||||
#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE) && !defined(CONFIG_KUP4K) && !defined(CONFIG_HMI10)
|
||||
|
||||
static uchar led_buffer = 0; /* Buffer for current LED status */
|
||||
|
||||
@@ -1467,7 +1578,7 @@ static void ide_led (uchar led, uchar status)
|
||||
static void
|
||||
output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -1477,7 +1588,7 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -1490,13 +1601,13 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
|
||||
static void
|
||||
input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -1506,7 +1617,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -1519,7 +1630,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
|
||||
#else /* ! __PPC__ */
|
||||
@@ -1858,6 +1969,9 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc)
|
||||
((unsigned long)iobuf[5]<<16) +
|
||||
((unsigned long)iobuf[6]<< 8) +
|
||||
((unsigned long)iobuf[7]);
|
||||
#ifdef CONFIG_LBA48
|
||||
dev_desc->lba48 = 0; /* ATAPI devices cannot use 48bit addressing (ATA/ATAPI v7) */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1871,7 +1985,7 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc)
|
||||
#define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
|
||||
#define ATAPI_READ_MAX_BLOCK ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE /* max blocks */
|
||||
|
||||
ulong atapi_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
|
||||
{
|
||||
ulong n = 0;
|
||||
unsigned char ccb[12]; /* Command descriptor block */
|
||||
|
||||
+3
-3
@@ -107,7 +107,7 @@ do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
#if defined(CONFIG_8xx)
|
||||
printf (" MCR = %08x\n", memctl->memc_mcr);
|
||||
#elif defined(CONFIG_8260)
|
||||
printf ("\n");
|
||||
putc ('\n');
|
||||
#endif
|
||||
printf ("MAMR = %08x MBMR = %08x",
|
||||
memctl->memc_mamr, memctl->memc_mbmr);
|
||||
@@ -325,7 +325,7 @@ do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
iopin_t iopin;
|
||||
|
||||
if (argc != 5) {
|
||||
printf ("iopset PORT PIN CMD VALUE\n");
|
||||
puts ("iopset PORT PIN CMD VALUE\n");
|
||||
return 1;
|
||||
}
|
||||
port = argv[1][0] - 'A';
|
||||
@@ -529,7 +529,7 @@ do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
printf ("I2CER = %02x I2CMR = %02x\n", i2c->i2c_i2cer, i2c->i2c_i2cmr);
|
||||
|
||||
if (iip == NULL)
|
||||
printf ("i2c parameter ram not allocated\n");
|
||||
puts ("i2c parameter ram not allocated\n");
|
||||
else {
|
||||
printf ("RBASE = %08x TBASE = %08x\n",
|
||||
iip->iic_rbase, iip->iic_tbase);
|
||||
|
||||
+6
-5
@@ -98,7 +98,7 @@ do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
char *fsname;
|
||||
|
||||
char *filename = "uImage";
|
||||
ulong offset = CFG_LOAD_ADDR;
|
||||
ulong offset = load_addr;
|
||||
int size;
|
||||
struct part_info *part;
|
||||
|
||||
@@ -107,6 +107,7 @@ do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
if (argc == 3) {
|
||||
offset = simple_strtoul(argv[1], NULL, 16);
|
||||
load_addr = offset;
|
||||
filename = argv[2];
|
||||
}
|
||||
|
||||
@@ -135,7 +136,7 @@ do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
return !(size > 0);
|
||||
}
|
||||
printf("Active partition not valid\n");
|
||||
puts ("Active partition not valid\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
return (ret == 1);
|
||||
}
|
||||
printf("Active partition not valid\n");
|
||||
puts ("Active partition not valid\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -192,7 +193,7 @@ do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
return (ret == 1);
|
||||
}
|
||||
printf("Active partition not valid\n");
|
||||
puts ("Active partition not valid\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -206,7 +207,7 @@ do_jffs2_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (argc >= 2) {
|
||||
tmp_part = simple_strtoul(argv[1], NULL, 16);
|
||||
}else{
|
||||
printf("Need partition number in argument list\n");
|
||||
puts ("Need partition number in argument list\n");
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
+15
-15
@@ -178,16 +178,16 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
#ifdef CONFIG_HAS_DATAFLASH
|
||||
}
|
||||
#endif
|
||||
printf(" ");
|
||||
puts (" ");
|
||||
cp = linebuf;
|
||||
for (i=0; i<linebytes; i++) {
|
||||
if ((*cp < 0x20) || (*cp > 0x7e))
|
||||
printf(".");
|
||||
putc ('.');
|
||||
else
|
||||
printf("%c", *cp);
|
||||
cp++;
|
||||
}
|
||||
printf("\n");
|
||||
putc ('\n');
|
||||
nbytes -= linebytes;
|
||||
if (ctrlc()) {
|
||||
rc = 1;
|
||||
@@ -279,7 +279,7 @@ int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
#ifdef CONFIG_HAS_DATAFLASH
|
||||
if (addr_dataflash(addr1) | addr_dataflash(addr2)){
|
||||
printf("Comparison with DataFlash space not supported.\n\r");
|
||||
puts ("Comparison with DataFlash space not supported.\n\r");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -368,7 +368,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
) {
|
||||
int rc;
|
||||
|
||||
printf ("Copy to Flash... ");
|
||||
puts ("Copy to Flash... ");
|
||||
|
||||
rc = flash_write ((uchar *)addr, dest, count*size);
|
||||
if (rc != 0) {
|
||||
@@ -384,13 +384,13 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (mmc2info(dest)) {
|
||||
int rc;
|
||||
|
||||
printf ("Copy to MMC... ");
|
||||
puts ("Copy to MMC... ");
|
||||
switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
|
||||
case 0:
|
||||
printf ("\n");
|
||||
putc ('\n');
|
||||
return 1;
|
||||
case -1:
|
||||
printf("failed\n");
|
||||
puts ("failed\n");
|
||||
return 1;
|
||||
default:
|
||||
printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
|
||||
@@ -403,13 +403,13 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (mmc2info(addr)) {
|
||||
int rc;
|
||||
|
||||
printf ("Copy from MMC... ");
|
||||
puts ("Copy from MMC... ");
|
||||
switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
|
||||
case 0:
|
||||
printf ("\n");
|
||||
putc ('\n');
|
||||
return 1;
|
||||
case -1:
|
||||
printf("failed\n");
|
||||
puts ("failed\n");
|
||||
return 1;
|
||||
default:
|
||||
printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
|
||||
@@ -425,7 +425,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (addr_dataflash(dest) && !addr_dataflash(addr)){
|
||||
int rc;
|
||||
|
||||
printf ("Copy to DataFlash... ");
|
||||
puts ("Copy to DataFlash... ");
|
||||
|
||||
rc = write_dataflash (dest, addr, count*size);
|
||||
|
||||
@@ -449,7 +449,7 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (addr_dataflash(addr) && addr_dataflash(dest)){
|
||||
printf("Unsupported combination of source/destination.\n\r");
|
||||
puts ("Unsupported combination of source/destination.\n\r");
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -828,7 +828,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
val += incr;
|
||||
}
|
||||
|
||||
printf("Reading...");
|
||||
puts ("Reading...");
|
||||
|
||||
for (addr=start,val=pattern; addr<end; addr++) {
|
||||
readback = *addr;
|
||||
@@ -902,7 +902,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
|
||||
#ifdef CONFIG_HAS_DATAFLASH
|
||||
if (addr_dataflash(addr)){
|
||||
printf("Can't modify DataFlash in place. Use cp instead.\n\r");
|
||||
puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Loaded 100 of 227 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user