Compare commits
30 Commits
LABEL_2003
...
U-Boot-0_4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
993cad9364 | ||
|
|
b783edaee8 | ||
|
|
a300d83cb8 | ||
|
|
a6457f7971 | ||
|
|
a0e135b493 | ||
|
|
e118e233a8 | ||
|
|
95aeb34580 | ||
|
|
cceb871fff | ||
|
|
3595ac4979 | ||
|
|
9a0e21a3a8 | ||
|
|
592c5cabe7 | ||
|
|
72755c7137 | ||
|
|
0332990b85 | ||
|
|
0b97ab144f | ||
|
|
6dd652fa4d | ||
|
|
52f52c1494 | ||
|
|
48b42616e9 | ||
|
|
15ef8a5d17 | ||
|
|
2abbe07547 | ||
|
|
71f9511803 | ||
|
|
487778b781 | ||
|
|
8b601449e8 | ||
|
|
e58dc13283 | ||
|
|
a3ed3996cd | ||
|
|
73a8b27c57 | ||
|
|
08eaea9c9f | ||
|
|
53cf9435cc | ||
|
|
c602883592 | ||
|
|
3720878599 | ||
|
|
f3e0de60a6 |
165
CHANGELOG
165
CHANGELOG
@@ -2,6 +2,169 @@
|
||||
Changes since U-Boot 0.3.1:
|
||||
======================================================================
|
||||
|
||||
* Patches by Robert Schwebel, 26 Jun 2003:
|
||||
- logdl
|
||||
- csb226
|
||||
- innokom
|
||||
|
||||
* Patch by Pantelis Antoniou, 25 Jun 2003:
|
||||
update NetVia with V2 board support
|
||||
|
||||
* Header file cleanup for ARM
|
||||
|
||||
* Patch by Murray Jensen, 24 Jun 2003:
|
||||
- make sure to use only U-boot provided header files
|
||||
- fix problems with ".rodata.str1.4" section as used by GCC-3.x
|
||||
|
||||
* Patch by Stefan Roese, 24 Jun 2003:
|
||||
- Update esd ASH405 board files.
|
||||
- Update esd DASA_SIM config file.
|
||||
- Add ping command to some esd boards.
|
||||
|
||||
* Patch by Yuli Barcohen, 23 Jun 2003:
|
||||
Update for MPC8260ADS board
|
||||
|
||||
* Patch by Murray Jensen, 23 Jun 2003:
|
||||
- cleanup of GCC 3.x compiler warnings
|
||||
|
||||
* Patch by Rune Torgersen, 4 Jun 2003:
|
||||
add large memory support for MPC8266ADS board
|
||||
|
||||
* Patch by Richard Woodruff, 19 June 03:
|
||||
- Enabled standard u-boot device abstraction for ARM
|
||||
- Enabled console device for ARM
|
||||
- Initilized bi_baudrate for ARM
|
||||
|
||||
* Patch by Bill Hargen, 23 Apr 2003:
|
||||
fix byte order for 824x I2C addresses (write op)
|
||||
|
||||
* Patch by Murray Jensen, 20 Jun 2003:
|
||||
- hymod update
|
||||
- cleanup (especially for gcc-3.x compilers)
|
||||
|
||||
* Patch by Tom Guilliams, 20 Jun 2003:
|
||||
added CONFIG_750FX support for IBM 750FX processors
|
||||
|
||||
* Patch by Devin Crumb, 02 Apr 2003:
|
||||
Fix clock divider rounding problem in drivers/serial.c
|
||||
|
||||
* Patch by Richard Woodruff, 19 June 03:
|
||||
- Fixed smc91c111 driver to sync with the u-boot environment
|
||||
(driver/smc91c111.c).
|
||||
- Added eth_init error return check in NetLoop (net/net.c).
|
||||
|
||||
* Patch by Ken Chou, 19 June 2003:
|
||||
Added support for A3000 SBC board (Artis Microsystems Inc.)
|
||||
|
||||
* Patches by Murray Jensen, 17 Jun 2003:
|
||||
- Hymod board database mods: add "who" field and new xilinx chip types
|
||||
- provide new "init_cmd_timeout()" function so code external to
|
||||
"common/main.c" can use the "reset_cmd_timeout()" function before
|
||||
entering the main loop
|
||||
- add DTT support for adm1021 (new file dtt/adm1021.c; config
|
||||
slightly different. see include/configs/hymod.h for an example
|
||||
(requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and
|
||||
CFG_DTT_ADM1021 defined)
|
||||
- add new "eeprom_probe()" function which has similar args and
|
||||
behaves in a similar way to "eeprom_read()" etc.
|
||||
- add 8260 FCC ethernet loopback code (new "eth_loopback_test()"
|
||||
function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST)
|
||||
- gdbtools copyright update
|
||||
- ensure that set_msr() executes the "sync" and "isync" instructions
|
||||
after the "mtmsr" instruction in cpu/mpc8260/interrupts.c
|
||||
- 8260 I/O ports fix: Open Drain should be set last when configuring
|
||||
- add SIU IRQ defines for 8260
|
||||
- allow LDSCRIPT override and OBJCFLAGS initialization: change to
|
||||
config.mk to allow board configurations to override the GNU
|
||||
linker script, selected via the LDSCRIPT, make variable, and to
|
||||
give an initial value to the OBJCFLAGS make variable
|
||||
- 8260 i2c enhancement:
|
||||
o correctly extends the timeout depending on the size of all
|
||||
queued messages for both transmit and receive
|
||||
o will not continue with receive if transmit times out
|
||||
o ensures that the error callback is done for all queued tx
|
||||
and rx messages
|
||||
o correctly detects both tx and rx timeouts, only delivers one to
|
||||
the callback, and does not overwrite an earlier error
|
||||
o logic in i2c_probe now correct
|
||||
- add "vprintf()" function so that "panic()" function can be
|
||||
technically correct
|
||||
- many Hymod board changes
|
||||
|
||||
* Patches by Robert Schwebel, 14 Jun 2003:
|
||||
- add support for Logotronic DL datalogger board
|
||||
- cleanup serial line after kermit binary download
|
||||
- add debugX macro (debug level support)
|
||||
- update mach-types.h to latest arm.linux.org.uk master list.
|
||||
|
||||
* Patches by David M<>ller, 12 Jun 2003:
|
||||
- rewrite of the S3C24X0 register definitions stuff
|
||||
- "driver" for the built-in S3C24X0 RTC
|
||||
|
||||
* Patches by Yuli Barcohen, 12 Jun 2003:
|
||||
- Add MII support and Ethernet PHY initialization for MPC8260ADS board
|
||||
- Fix incorrect SIUMCR initialisation caused by wrong Hard Reset
|
||||
configuration word supplied by FPGA on some MPC8260ADS boards
|
||||
|
||||
* Patch by Pantelis Antoniou, 10 Jun 2003:
|
||||
Unify status LED interface
|
||||
|
||||
* Add support for DS12887 RTC; add RTC support for ATC board
|
||||
|
||||
* Patch by Nicolas Lacressonniere, 11 Jun 2003:
|
||||
Modifications for Atmel AT91RM9200DK ARM920T based development kit
|
||||
- Add Atmel DataFlash support for reading and writing.
|
||||
- Add possibility to boot a Linux from DataFlash with BOOTM command.
|
||||
- Add Flash detection on Atmel AT91RM9200DK
|
||||
(between Atmel AT49BV1614 and AT49BV1614A flashes)
|
||||
- Replace old Ethernet PHY layer functions
|
||||
- Change link address
|
||||
|
||||
* Patch by Frank Smith, 9 Jun 2003:
|
||||
use CRIT_EXCEPTION for machine check on 4xx
|
||||
|
||||
* Patch by Detlev Zundel, 13 Jun 2003:
|
||||
added implementation of the "carinfo" command in cmd_immap.c
|
||||
|
||||
* Fix CONFIG_NET_MULTI support in include/net.h
|
||||
|
||||
* Patches by Kyle Harris, 13 Mar 2003:
|
||||
- Add FAT partition support
|
||||
- Add command support for FAT
|
||||
- Add command support for MMC
|
||||
----
|
||||
- Add Intel PXA support for video
|
||||
- Add Intel PXA support for MMC
|
||||
----
|
||||
- Enable MMC and FAT for lubbock board
|
||||
- Other misc changes for lubbock board
|
||||
|
||||
* Patch by Robert Schwebel, April 02, 2003:
|
||||
fix for SMSC91111 driver
|
||||
|
||||
* Patch by Vladimir Gurevich, 04 Jun 2003:
|
||||
make ppc405 ethernet driver compatible with CONFIG_NET_MULTI option
|
||||
|
||||
* Patch by Stefan Roese, 05 Jun 2003:
|
||||
- PPC4xx: Fix bug for initial stack in data cache as pointed out by
|
||||
Thomas Schaefer (tschaefer@giga-stream.de). Now inital stack in
|
||||
data cache can be used even if the chip select is in use.
|
||||
- CFG_RX_ETH_BUFFER added to set the ethernet receive buffer count
|
||||
(see README for further description).
|
||||
- Changed config files of CONFIG_EEPRO100 boards to use the
|
||||
CFG_RX_ETH_BUFFER define.
|
||||
|
||||
* Add support for RMU board
|
||||
|
||||
* Add support for TQM862L at 100/50 MHz
|
||||
|
||||
* Patch by Pantelis Antoniou, 02 Jun 2003:
|
||||
major reconstruction of networking code;
|
||||
add "ping" support (outgoing only!)
|
||||
|
||||
* Patch by Denis Peter, 04 June 2003:
|
||||
add support for the MIP405T board
|
||||
|
||||
* Patches by Udi Finkelstein, 2 June 2003:
|
||||
- Added support for custom keyboards, initialized by defining a
|
||||
board-specific drv_keyboard_init as well as defining CONFIG_KEYBOARD .
|
||||
@@ -365,7 +528,7 @@ Changes for U-Boot 0.3.0:
|
||||
|
||||
* TRAB fixes / extensions:
|
||||
- Restore VFD brightness as saved in environment
|
||||
- add support for FGujitsu flashes
|
||||
- add support for Fujitsu flashes
|
||||
- make sure both buzzers are turned off (drive low level)
|
||||
|
||||
* Patches by Robert Schwebel, 06 Mar 2003:
|
||||
|
||||
14
CREDITS
14
CREDITS
@@ -66,6 +66,10 @@ N: Jonathan De Bruyne
|
||||
E: jonathan.debruyne@siemens.atea.be
|
||||
D: Port to Siemens IAD210 board
|
||||
|
||||
N: Ken Chou
|
||||
E: kchou@ieee.org
|
||||
D: Support for A3000 SBC board
|
||||
|
||||
N: Conn Clark
|
||||
E: clark@esteem.com
|
||||
D: ESTEEM192E support
|
||||
@@ -142,6 +146,10 @@ N: Andreas Heppel
|
||||
E: aheppel@sysgo.de
|
||||
D: CPU Support for MPC 75x; board support for Eltec BAB750 [obsolete!]
|
||||
|
||||
N: August Hoeraendl
|
||||
E: august.hoerandl@gmx.at
|
||||
D: Support for the logodl board (PXA2xx)
|
||||
|
||||
N: Josh Huber
|
||||
E: huber@alum.wpi.edu
|
||||
D: Port to the Galileo Evaluation Board, and the MPC74xx cpu series.
|
||||
@@ -252,7 +260,7 @@ D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots mor
|
||||
|
||||
N: Robert Schwebel
|
||||
E: r.schwebel@pengutronix.de
|
||||
D: Support for csb226 and innokom boards (xscale)
|
||||
D: Support for csb226, logodl and innokom boards (PXA2xx)
|
||||
|
||||
N: Rob Taylor
|
||||
E: robt@flyingpig.com
|
||||
@@ -290,3 +298,7 @@ N: Alex Zuepke
|
||||
E: azu@sysgo.de
|
||||
D: Overall improvements on StrongARM, ARM720TDMI; Support for Tuxscreen; initial PCMCIA support for ARM
|
||||
W: www.elinos.com
|
||||
|
||||
N: Pantelis Antoniou
|
||||
E: panto@intracom.gr
|
||||
D: NETVIA board support, ARTOS support.
|
||||
|
||||
@@ -63,6 +63,9 @@ Wolfgang Denk <wd@denx.de>
|
||||
IVMS8_128 MPC860
|
||||
IVMS8_256 MPC860
|
||||
LANTEC MPC850
|
||||
LWMON MPC823
|
||||
R360MPI MPC823
|
||||
RMU MPC850
|
||||
RRvision MPC823
|
||||
SM850 MPC850
|
||||
SPD823TS MPC823
|
||||
@@ -72,6 +75,7 @@ Wolfgang Denk <wd@denx.de>
|
||||
TQM855L MPC855
|
||||
TQM860L MPC860
|
||||
TQM860L_FEC MPC860
|
||||
TTTech MPC823
|
||||
c2mon MPC855
|
||||
hermes MPC860
|
||||
lwmon MPC823
|
||||
|
||||
24
MAKEALL
24
MAKEALL
@@ -31,12 +31,12 @@ LIST_8xx=" \
|
||||
IP860 IVML24 IVML24_128 IVML24_256 \
|
||||
IVMS8 IVMS8_128 IVMS8_256 KUP4K \
|
||||
LANTEC lwmon MBX MBX860T \
|
||||
MHPC MVS1 NETVIA NX823 \
|
||||
pcu_e R360MPI RBC823 RPXClassic \
|
||||
RPXlite RRvision SM850 SPD823TS \
|
||||
svm_sc8xx SXNI855T TOP860 TQM823L \
|
||||
TQM823L_LCD TQM850L TQM855L TQM860L \
|
||||
TTTech v37 \
|
||||
MHPC MVS1 NETVIA NETVIA_V2 \
|
||||
NX823 pcu_e R360MPI RBC823 \
|
||||
rmu RPXClassic RPXlite RRvision \
|
||||
SM850 SPD823TS svm_sc8xx SXNI855T \
|
||||
TOP860 TQM823L TQM823L_LCD TQM850L \
|
||||
TQM855L TQM860L TTTech v37 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -48,9 +48,9 @@ LIST_4xx=" \
|
||||
CANBT CPCI405 CPCI4052 CPCI405AB \
|
||||
CPCI440 CPCIISER4 CRAYL1 DASA_SIM \
|
||||
DU405 EBONY ERIC MIP405 \
|
||||
ML2 OCRTC ORSG PCI405 \
|
||||
PIP405 PMC405 W7OLMC W7OLMG \
|
||||
WALNUT405 \
|
||||
MIP405T ML2 OCRTC ORSG \
|
||||
PCI405 PIP405 PMC405 W7OLMC \
|
||||
W7OLMG WALNUT405 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -58,9 +58,9 @@ LIST_4xx=" \
|
||||
#########################################################################
|
||||
|
||||
LIST_824x=" \
|
||||
BMW CPC45 CU824 MOUSSE \
|
||||
MUSENKI OXC PN62 Sandpoint8240 \
|
||||
Sandpoint8245 utx8245 \
|
||||
A3000 BMW CPC45 CU824 \
|
||||
MOUSSE MUSENKI OXC PN62 \
|
||||
Sandpoint8240 Sandpoint8245 utx8245 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
|
||||
43
Makefile
43
Makefile
@@ -106,7 +106,7 @@ endif
|
||||
LIBS = board/$(BOARDDIR)/lib$(BOARD).a
|
||||
LIBS += cpu/$(CPU)/lib$(CPU).a
|
||||
LIBS += lib_$(ARCH)/lib$(ARCH).a
|
||||
LIBS += fs/jffs2/libjffs2.a fs/fdos/libfdos.a
|
||||
LIBS += fs/jffs2/libjffs2.a fs/fdos/libfdos.a fs/fat/libfat.a
|
||||
LIBS += net/libnet.a
|
||||
LIBS += disk/libdisk.a
|
||||
LIBS += rtc/librtc.a
|
||||
@@ -302,8 +302,20 @@ MHPC_config: unconfig
|
||||
MVS1_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx mvs1
|
||||
|
||||
xtract_NETVIA = $(subst _V2,,$(subst _config,,$1))
|
||||
|
||||
NETVIA_V2_config \
|
||||
NETVIA_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx netvia
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring NETVIA_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NETVIA_VERSION 1" >>include/config.h ; \
|
||||
echo "... Version 1" ; \
|
||||
}
|
||||
@[ -z "$(findstring NETVIA_V2_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NETVIA_VERSION 2" >>include/config.h ; \
|
||||
echo "... Version 2" ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_NETVIA,$@) ppc mpc8xx netvia
|
||||
|
||||
NX823_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx nx823
|
||||
@@ -323,6 +335,9 @@ RPXClassic_config: unconfig
|
||||
RPXlite_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx RPXlite
|
||||
|
||||
rmu_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx rmu
|
||||
|
||||
RRvision_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx RRvision
|
||||
|
||||
@@ -349,10 +364,10 @@ TOP860_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx top860 emk
|
||||
|
||||
# Play some tricks for configuration selection
|
||||
# All boards can come with 50 MHz (default), 66MHz or 80MHz clock,
|
||||
# All boards can come with 50 MHz (default), 66MHz, 80MHz or 100 MHz clock,
|
||||
# but only 855 and 860 boards may come with FEC
|
||||
# and 823 boards may have LCD support
|
||||
xtract_8xx = $(subst _66MHz,,$(subst _80MHz,,$(subst _LCD,,$(subst _config,,$1))))
|
||||
xtract_8xx = $(subst _66MHz,,$(subst _80MHz,,$(subst _100MHz,,$(subst _LCD,,$(subst _config,,$1)))))
|
||||
|
||||
FPS850L_config \
|
||||
FPS860L_config \
|
||||
@@ -373,7 +388,8 @@ TQM860L_66MHz_config \
|
||||
TQM860L_80MHz_config \
|
||||
TQM862L_config \
|
||||
TQM862L_66MHz_config \
|
||||
TQM862L_80MHz_config: unconfig
|
||||
TQM862L_80MHz_config \
|
||||
TQM862M_100MHz_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _66MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_66MHz" >>include/config.h ; \
|
||||
@@ -383,6 +399,10 @@ TQM862L_80MHz_config: unconfig
|
||||
{ echo "#define CONFIG_80MHz" >>include/config.h ; \
|
||||
echo "... with 80MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _100MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_100MHz" >>include/config.h ; \
|
||||
echo "... with 100MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _LCD,$@)" ] || \
|
||||
{ echo "#define CONFIG_LCD" >>include/config.h ; \
|
||||
echo "#define CONFIG_NEC_NL6648BC20" >>include/config.h ; \
|
||||
@@ -449,6 +469,11 @@ ERIC_config:unconfig
|
||||
MIP405_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx mip405 mpl
|
||||
|
||||
MIP405T_config:unconfig
|
||||
@echo "#define CONFIG_MIP405T" >include/config.h
|
||||
@echo "Enable subset config for MIP405T"
|
||||
@./mkconfig -a MIP405 ppc ppc4xx mip405 mpl
|
||||
|
||||
ML2_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ml2
|
||||
|
||||
@@ -477,6 +502,9 @@ WALNUT405_config:unconfig
|
||||
#########################################################################
|
||||
xtract_82xx = $(subst _ROMBOOT,,$(subst _L2,,$(subst _266MHz,,$(subst _300MHz,,$(subst _config,,$1)))))
|
||||
|
||||
A3000_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x a3000
|
||||
|
||||
BMW_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x bmw
|
||||
|
||||
@@ -724,6 +752,9 @@ innokom_config : unconfig
|
||||
lubbock_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa lubbock
|
||||
|
||||
logodl_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa logodl
|
||||
|
||||
wepep250_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm pxa wepep250
|
||||
|
||||
@@ -783,7 +814,7 @@ clobber: clean
|
||||
rm -f u-boot u-boot.bin u-boot.srec u-boot.map System.map
|
||||
rm -f tools/crc32.c tools/environment.c tools/env/crc32.c
|
||||
rm -f tools/inca-swap-bytes cpu/mpc824x/bedbug_603e.c
|
||||
rm -f include/asm/arch include/asm
|
||||
rm -f include/asm/proc include/asm/arch include/asm
|
||||
|
||||
mrproper \
|
||||
distclean: clobber unconfig
|
||||
|
||||
47
README
47
README
@@ -151,6 +151,7 @@ Directory Hierarchy:
|
||||
- board/RPXClassic
|
||||
Files specific to RPXClassic boards
|
||||
- board/RPXlite Files specific to RPXlite boards
|
||||
- board/at91rm9200dk Files specific to AT91RM9200DK boards
|
||||
- board/c2mon Files specific to c2mon boards
|
||||
- board/cmi Files specific to cmi boards
|
||||
- board/cogent Files specific to Cogent boards
|
||||
@@ -300,6 +301,7 @@ The following options need to be configured:
|
||||
or CONFIG_405GP
|
||||
or CONFIG_440
|
||||
or CONFIG_MPC74xx
|
||||
or CONFIG_750FX
|
||||
|
||||
ARM based CPUs:
|
||||
---------------
|
||||
@@ -352,7 +354,7 @@ The following options need to be configured:
|
||||
CONFIG_HHP_CRADLE, CONFIG_DNP1110, CONFIG_EP7312,
|
||||
CONFIG_IMPA7, CONFIG_LART, CONFIG_LUBBOCK,
|
||||
CONFIG_SHANNON, CONFIG_SMDK2400, CONFIG_SMDK2410,
|
||||
CONFIG_TRAB
|
||||
CONFIG_TRAB, CONFIG_AT91RM9200DK
|
||||
|
||||
|
||||
- CPU Module Type: (if CONFIG_COGENT is defined)
|
||||
@@ -565,6 +567,7 @@ The following options need to be configured:
|
||||
CFG_CMD_ELF bootelf, bootvx
|
||||
CFG_CMD_ENV saveenv
|
||||
CFG_CMD_FDC * Floppy Disk Support
|
||||
CFG_CMD_FAT FAT partition support
|
||||
CFG_CMD_FDOS * Dos diskette Support
|
||||
CFG_CMD_FLASH flinfo, erase, protect
|
||||
CFG_CMD_FPGA FPGA device initialization support
|
||||
@@ -578,6 +581,7 @@ The following options need to be configured:
|
||||
CFG_CMD_LOADS loads
|
||||
CFG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base,
|
||||
loop, mtest
|
||||
CFG_CMD_MMC MMC memory mapped support
|
||||
CFG_CMD_MII MII utility commands
|
||||
CFG_CMD_NET bootp, tftpboot, rarpboot
|
||||
CFG_CMD_PCI * pciinfo
|
||||
@@ -690,7 +694,7 @@ The following options need to be configured:
|
||||
- NETWORK Support (PCI):
|
||||
CONFIG_E1000
|
||||
Support for Intel 8254x gigabit chips.
|
||||
|
||||
|
||||
CONFIG_EEPRO100
|
||||
Support for Intel 82557/82559/82559ER chips.
|
||||
Optional CONFIG_EEPRO100_SROM_WRITE enables eeprom
|
||||
@@ -730,6 +734,14 @@ The following options need to be configured:
|
||||
Supported are USB Keyboards and USB Floppy drives
|
||||
(TEAC FD-05PUB).
|
||||
|
||||
- MMC Support:
|
||||
The MMC controller on the Intel PXA is supported. To
|
||||
enable this define CONFIG_MMC. The MMC can be
|
||||
accessed from the boot prompt by mapping the device
|
||||
to physical memory similar to flash. Command line is
|
||||
enabled with CFG_CMD_MMC. The MMC driver also works with
|
||||
the FAT fs. This is enabled with CFG_CMD_FAT.
|
||||
|
||||
- Keyboard Support:
|
||||
CONFIG_ISA_KEYBOARD
|
||||
|
||||
@@ -1238,6 +1250,13 @@ The following options need to be configured:
|
||||
the environment like the autoscript function or the
|
||||
boot command first.
|
||||
|
||||
- DataFlash Support
|
||||
CONFIG_HAS_DATAFLASH
|
||||
|
||||
Defining this option enables DataFlash features and
|
||||
allows to read/write in Dataflash via the standard
|
||||
commands cp, md...
|
||||
|
||||
- Show boot progress
|
||||
CONFIG_SHOW_BOOT_PROGRESS
|
||||
|
||||
@@ -1442,6 +1461,14 @@ Configuration Settings:
|
||||
Define if the flash driver uses extra elements in the
|
||||
common flash structure for storing flash geometry
|
||||
|
||||
- CFG_RX_ETH_BUFFER:
|
||||
Defines the number of ethernet receive buffers. On some
|
||||
ethernet controllers it is recommended to set this value
|
||||
to 8 or even higher (EEPRO100 or 405 EMAC), since all
|
||||
buffers can be full shortly after enabling the interface
|
||||
on high ethernet traffic.
|
||||
Defaults to 4 if not defined.
|
||||
|
||||
The following definitions that deal with the placement and management
|
||||
of environment data (variable area); in general, we support the
|
||||
following configurations:
|
||||
@@ -1783,6 +1810,7 @@ configurations; the following names are supported:
|
||||
GENIETV_config TQM823L_config PIP405_config
|
||||
GEN860T_config EBONY_config FPS860L_config
|
||||
ELPT860_config cmi_mpc5xx_config NETVIA_config
|
||||
at91rm9200dk_config
|
||||
|
||||
Note: for some board special configuration names may exist; check if
|
||||
additional information is available from the board vendor; for
|
||||
@@ -2624,6 +2652,14 @@ Unix, I recommend to use C-Kermit for general purpose use (and
|
||||
especially for kermit binary protocol download ("loadb" command), and
|
||||
use "cu" for S-Record download ("loads" command).
|
||||
|
||||
Nevertheless, if you absolutely want to use it try adding this
|
||||
configuration to your "File transfer protocols" section:
|
||||
|
||||
Name Program Name U/D FullScr IO-Red. Multi
|
||||
X kermit /usr/bin/kermit -i -l %l -s Y U Y N N
|
||||
Y kermit /usr/bin/kermit -i -l %l -r N D Y N N
|
||||
|
||||
|
||||
NetBSD Notes:
|
||||
=============
|
||||
|
||||
@@ -2975,6 +3011,13 @@ it:
|
||||
We accept patches as plain text, MIME attachments or as uuencoded
|
||||
gzipped text.
|
||||
|
||||
* If one logical set of modifications affects or creates several
|
||||
files, all these changes shall be submitted in a SINGLE patch file.
|
||||
|
||||
* Changesets that contain different, unrelated modifications shall be
|
||||
submitted as SEPARATE patches, one patch per changeset.
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
* Before sending the patch, run the MAKEALL script on your patched
|
||||
|
||||
@@ -90,6 +90,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -75,6 +75,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -77,6 +77,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -77,6 +77,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -79,6 +79,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
40
board/a3000/Makefile
Normal file
40
board/a3000/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
18
board/a3000/README
Normal file
18
board/a3000/README
Normal file
@@ -0,0 +1,18 @@
|
||||
U-Boot for Artis SBC-A3000
|
||||
---------------------------
|
||||
|
||||
Artis SBC-A3000 has one flash socket that the user uses Intel 28F128J3A (16MB)
|
||||
or 28F064J3A (8MB) chips.
|
||||
|
||||
In board's notation, bank 0 is the one at the address of 0xFF000000.
|
||||
bank 1 is the one at the address of 0xFF800000
|
||||
|
||||
On power-up the processor jumps to the address of 0xFFF00100, the last
|
||||
megabyte of the bank 0 of flash.
|
||||
|
||||
Thus, U-Boot is configured to reside in flash starting at the address of
|
||||
0xFFF00000. The environment space is located in flash separately from
|
||||
U-Boot, at the address of 0xFFFE0000.
|
||||
|
||||
There is a National ns83815 10/100M ethernet controller on-board.
|
||||
|
||||
144
board/a3000/a3000.c
Normal file
144
board/a3000/a3000.c
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Rob Taylor, Flying Pig Systems. robt@flyingpig.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 <mpc824x.h>
|
||||
#include <pci.h>
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
ulong busfreq = get_bus_freq(0);
|
||||
char buf[32];
|
||||
|
||||
printf("Board: A3000 Local Bus at %s MHz\n", strmhz(buf, busfreq));
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
int i, cnt;
|
||||
volatile uchar * base= CFG_SDRAM_BASE;
|
||||
volatile ulong * addr;
|
||||
ulong save[32];
|
||||
ulong val, ret = 0;
|
||||
|
||||
for (i=0, cnt=(CFG_MAX_RAM_SIZE / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
|
||||
addr = (volatile ulong *)base + cnt;
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
addr = (volatile ulong *)base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
if (*addr != 0) {
|
||||
*addr = save[i];
|
||||
goto Done;
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt <= CFG_MAX_RAM_SIZE / sizeof(long); cnt <<= 1) {
|
||||
addr = (volatile ulong *)base + cnt;
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
if (val != ~cnt) {
|
||||
ulong new_bank0_end = cnt * sizeof(long) - 1;
|
||||
ulong mear1 = mpc824x_mpc107_getreg(MEAR1);
|
||||
ulong emear1 = mpc824x_mpc107_getreg(EMEAR1);
|
||||
mear1 = (mear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
||||
emear1 = (emear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
||||
mpc824x_mpc107_setreg(MEAR1, mear1);
|
||||
mpc824x_mpc107_setreg(EMEAR1, emear1);
|
||||
|
||||
ret = cnt * sizeof(long);
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
ret = CFG_MAX_RAM_SIZE;
|
||||
Done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize PCI Devices
|
||||
*/
|
||||
#if 1
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
static struct pci_config_table pci_a3000_config_table[] = {
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
0x0, 0x0, 0x0, /* unknown eth0 divice */
|
||||
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
|
||||
PCI_ENET0_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER }},
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
0x0, 0x0, 0x0, /* unknown eth1 device */
|
||||
pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
|
||||
PCI_ENET1_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER }},
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
0x0, 0x0, 0x0, /* unknown eth1 device */
|
||||
pci_cfgfunc_config_device, { PCI_ENET2_IOADDR,
|
||||
PCI_ENET2_MEMADDR,
|
||||
PCI_COMMAND_IO |
|
||||
PCI_COMMAND_MEMORY |
|
||||
PCI_COMMAND_MASTER }},
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
static struct pci_config_table pci_a3000_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 }},
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
|
||||
pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
|
||||
PCI_ENET1_MEMADDR,
|
||||
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
struct pci_controller hose = {
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
config_table: pci_a3000_config_table,
|
||||
#endif
|
||||
};
|
||||
|
||||
void pci_init_board(void)
|
||||
{
|
||||
pci_mpc824x_init(&hose);
|
||||
}
|
||||
30
board/a3000/config.mk
Normal file
30
board/a3000/config.mk
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# (C) Copyright 2000, 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# Artis A-3000 boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xFFF00000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
|
||||
454
board/a3000/flash.c
Normal file
454
board/a3000/flash.c
Normal file
@@ -0,0 +1,454 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc824x.h>
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define DEBUG_FLASH
|
||||
|
||||
#ifdef DEBUG_FLASH
|
||||
#define DEBUGF(fmt,args...) printf(fmt ,##args)
|
||||
#else
|
||||
#define DEBUGF(fmt,args...)
|
||||
#endif
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size (vu_char *addr, flash_info_t *info);
|
||||
static int write_data (flash_info_t *info, uchar *dest, uchar data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
|
||||
#define BS(b) (b)
|
||||
#define BYTEME(x) ((x) & 0xFF)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long flash_banks[CFG_MAX_FLASH_BANKS] = CFG_FLASH_BANKS;
|
||||
unsigned long size, size_b[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i)
|
||||
{
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
DEBUGF("Get flash bank %d @ 0x%08lx\n", i, flash_banks[i]);
|
||||
/*
|
||||
size_b[i] = flash_get_size((vu_char *)flash_banks[i], &flash_info[i]);
|
||||
*/
|
||||
size_b[i] = flash_get_size((vu_char *) 0xff800000 , &flash_info[i]);
|
||||
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN)
|
||||
{
|
||||
printf ("## Unknown FLASH on Bank %d: "
|
||||
"ID 0x%lx, Size = 0x%08lx = %ld MB\n",
|
||||
i, flash_info[i].flash_id,
|
||||
size_b[i], size_b[i]<<20);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUGF("## Flash bank %d at 0x%08lx sizes: 0x%08lx \n",
|
||||
i, flash_banks[i], size_b[i]);
|
||||
|
||||
flash_get_offsets (flash_banks[i], &flash_info[i]);
|
||||
flash_info[i].size = size_b[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
DEBUGF("protect monitor %x @ %x\n", CFG_MONITOR_BASE, CFG_MONITOR_LEN);
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
DEBUGF("protect environtment %x @ %x\n", CFG_ENV_ADDR, CFG_ENV_SECT_SIZE);
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SECT_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
size = 0;
|
||||
DEBUGF("## Final Flash bank sizes: ");
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i)
|
||||
{
|
||||
DEBUGF("%08lx ", size_b[i]);
|
||||
size += size_b[i];
|
||||
}
|
||||
DEBUGF("\n");
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base;
|
||||
base += 0x00020000; /* 128k per bank */
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
printf ("Don't know sector ofsets for flash type 0x%lx\n", info->flash_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD: printf ("AMD "); break;
|
||||
case FLASH_MAN_FUJ: printf ("Fujitsu "); break;
|
||||
case FLASH_MAN_SST: printf ("SST "); break;
|
||||
case FLASH_MAN_STM: printf ("STM "); break;
|
||||
case FLASH_MAN_INTEL: printf ("Intel "); break;
|
||||
case FLASH_MAN_MT: printf ("MT "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F320J3A:
|
||||
printf ("28F320J3A (32Mbit = 128K x 32)\n");
|
||||
break;
|
||||
case FLASH_28F640J3A:
|
||||
printf ("28F640J3A (64Mbit = 128K x 64)\n");
|
||||
break;
|
||||
case FLASH_28F128J3A:
|
||||
printf ("28F128J3A (128Mbit = 128K x 128)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
#if 1
|
||||
if (info->size >= (1 << 20)) {
|
||||
i = 20;
|
||||
} else {
|
||||
i = 10;
|
||||
}
|
||||
printf (" Size: %ld %cB in %d Sectors\n",
|
||||
info->size >> i,
|
||||
(i == 20) ? 'M' : 'k',
|
||||
info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (vu_char *addr, flash_info_t *info)
|
||||
{
|
||||
vu_char manuf, device;
|
||||
|
||||
addr[0] = BS(0x90);
|
||||
manuf = BS(addr[0]);
|
||||
DEBUGF("Manuf. ID @ 0x%08lx: 0x%08x\n", (ulong)addr, manuf);
|
||||
|
||||
switch (manuf) {
|
||||
case BYTEME(AMD_MANUFACT):
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case BYTEME(FUJ_MANUFACT):
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case BYTEME(SST_MANUFACT):
|
||||
info->flash_id = FLASH_MAN_SST;
|
||||
break;
|
||||
case BYTEME(STM_MANUFACT):
|
||||
info->flash_id = FLASH_MAN_STM;
|
||||
break;
|
||||
case BYTEME(INTEL_MANUFACT):
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = BS(0xFF); /* restore read mode, (yes, BS is a NOP) */
|
||||
return 0; /* no or unknown flash */
|
||||
}
|
||||
|
||||
device = BS(addr[2]); /* device ID */
|
||||
|
||||
DEBUGF("Device ID @ 0x%08lx: 0x%08x\n", (ulong)(&addr[1]), device);
|
||||
|
||||
switch (device) {
|
||||
case BYTEME(INTEL_ID_28F320J3A):
|
||||
info->flash_id += FLASH_28F320J3A;
|
||||
info->sector_count = 32;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case BYTEME(INTEL_ID_28F640J3A):
|
||||
info->flash_id += FLASH_28F640J3A;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
case BYTEME(INTEL_ID_28F128J3A):
|
||||
info->flash_id += FLASH_28F128J3A;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
addr[0] = BS(0xFF); /* restore read mode (yes, a NOP) */
|
||||
return 0; /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = BS(0xFF); /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL) {
|
||||
printf ("Can erase only Intel flash types - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n", prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
vu_char *addr = (vu_char *)(info->start[sect]);
|
||||
unsigned long status;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
*addr = BS(0x50); /* clear status register */
|
||||
*addr = BS(0x20); /* erase setup */
|
||||
*addr = BS(0xD0); /* erase confirm */
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag) {
|
||||
enable_interrupts();
|
||||
}
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
while (((status = BS(*addr)) & BYTEME(0x00800080)) != BYTEME(0x00800080)) {
|
||||
if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
*addr = BS(0xB0); /* suspend erase */
|
||||
*addr = BS(0xFF); /* reset to read mode */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
*addr = BS(0xFF); /* reset to read mode */
|
||||
}
|
||||
}
|
||||
printf (" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
#define FLASH_WIDTH 1 /* flash bus width in bytes */
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
uchar *wp = (uchar *)addr;
|
||||
int rc;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
while (cnt > 0) {
|
||||
if ((rc = write_data(info, wp, *src)) != 0) {
|
||||
return rc;
|
||||
}
|
||||
wp++;
|
||||
src++;
|
||||
cnt--;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t *info, uchar *dest, uchar data)
|
||||
{
|
||||
vu_char *addr = (vu_char *)dest;
|
||||
ulong status;
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((BS(*addr) & data) != data) {
|
||||
return 2;
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
*addr = BS(0x40); /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag) {
|
||||
enable_interrupts();
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
|
||||
while (((status = BS(*addr)) & BYTEME(0x00800080)) != BYTEME(0x00800080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = BS(0xFF); /* restore read mode */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
*addr = BS(0xFF); /* restore read mode */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
128
board/a3000/u-boot.lds
Normal file
128
board/a3000/u-boot.lds
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
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/mpc824x/start.o (.text)
|
||||
lib_ppc/board.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/environment.o (.text)
|
||||
|
||||
*(.text)
|
||||
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
@@ -30,28 +30,35 @@
|
||||
* Miscelaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* memory and cpu-speed are setup before relocation */
|
||||
/* so we do _nothing_ here */
|
||||
/* Enable Ctrlc */
|
||||
console_init_f ();
|
||||
|
||||
/* arch number of AT91RM9200DK-Board */
|
||||
gd->bd->bi_arch_number = 251;
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
|
||||
/* Correct IRDA resistor problem */
|
||||
/* Set PA23_TXD in Output */
|
||||
(AT91PS_PIO) AT91C_BASE_PIOA->PIO_OER = AT91C_PA23_TXD2;
|
||||
|
||||
return 0;
|
||||
/* memory and cpu-speed are setup before relocation */
|
||||
/* so we do _nothing_ here */
|
||||
|
||||
/* arch number of AT91RM9200DK-Board */
|
||||
gd->bd->bi_arch_number = 251;
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dram_init(void)
|
||||
int dram_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
|
||||
return 0;
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -59,47 +66,47 @@ int dram_init(void)
|
||||
* The NAND lives in the CS2* space
|
||||
*/
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
extern void
|
||||
nand_probe(ulong physadr);
|
||||
extern void nand_probe (ulong physadr);
|
||||
|
||||
#define AT91_SMARTMEDIA_BASE 0x40000000 /* physical address to access memory on NCS3 */
|
||||
void
|
||||
nand_init(void)
|
||||
#define AT91_SMARTMEDIA_BASE 0x40000000 /* physical address to access memory on NCS3 */
|
||||
void nand_init (void)
|
||||
{
|
||||
/* Setup Smart Media, fitst enable the address range of CS3 */
|
||||
*AT91C_EBI_CSA |= AT91C_EBI_CS3A_SMC_SmartMedia;
|
||||
/* set the bus interface characteristics based on
|
||||
tDS Data Set up Time 30 - ns
|
||||
tDH Data Hold Time 20 - ns
|
||||
tALS ALE Set up Time 20 - ns
|
||||
16ns at 60 MHz ~= 3 */
|
||||
*AT91C_EBI_CSA |= AT91C_EBI_CS3A_SMC_SmartMedia;
|
||||
/* set the bus interface characteristics based on
|
||||
tDS Data Set up Time 30 - ns
|
||||
tDH Data Hold Time 20 - ns
|
||||
tALS ALE Set up Time 20 - ns
|
||||
16ns at 60 MHz ~= 3 */
|
||||
/*memory mapping structures */
|
||||
#define SM_ID_RWH (5 << 28)
|
||||
#define SM_RWH (1 << 28)
|
||||
#define SM_RWS (0 << 24)
|
||||
#define SM_TDF (1 << 8)
|
||||
#define SM_NWS (3)
|
||||
AT91C_BASE_SMC2->SMC2_CSR[3] = ( SM_RWH|SM_RWS | AT91C_SMC2_ACSS_STANDARD |
|
||||
AT91C_SMC2_DBW_8 | SM_TDF |
|
||||
AT91C_SMC2_WSEN | SM_NWS);
|
||||
AT91C_BASE_SMC2->SMC2_CSR[3] = (SM_RWH | SM_RWS |
|
||||
AT91C_SMC2_ACSS_STANDARD | AT91C_SMC2_DBW_8 |
|
||||
SM_TDF | AT91C_SMC2_WSEN | SM_NWS);
|
||||
|
||||
/* enable the SMOE line PC0=SMCE, A21=CLE, A22=ALE */
|
||||
*AT91C_PIOC_ASR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
|
||||
*AT91C_PIOC_PDR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
|
||||
/* enable the SMOE line PC0=SMCE, A21=CLE, A22=ALE */
|
||||
*AT91C_PIOC_ASR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE |
|
||||
AT91C_PC3_BFBAA_SMWE;
|
||||
*AT91C_PIOC_PDR = AT91C_PC0_BFCK | AT91C_PC1_BFRDY_SMOE |
|
||||
AT91C_PC3_BFBAA_SMWE;
|
||||
|
||||
/* Configure PC2 as input (signal READY of the SmartMedia) */
|
||||
*AT91C_PIOC_PER = AT91C_PC2_BFAVD; /* enable direct output enable */
|
||||
*AT91C_PIOC_ODR = AT91C_PC2_BFAVD; /* disable output */
|
||||
*AT91C_PIOC_PER = AT91C_PC2_BFAVD; /* enable direct output enable */
|
||||
*AT91C_PIOC_ODR = AT91C_PC2_BFAVD; /* disable output */
|
||||
|
||||
/* Configure PB1 as input (signal Card Detect of the SmartMedia) */
|
||||
*AT91C_PIOB_PER = AT91C_PIO_PB1; /* enable direct output enable */
|
||||
*AT91C_PIOB_ODR = AT91C_PIO_PB1; /* disable output */
|
||||
*AT91C_PIOB_PER = AT91C_PIO_PB1; /* enable direct output enable */
|
||||
*AT91C_PIOB_ODR = AT91C_PIO_PB1; /* disable output */
|
||||
|
||||
if (*AT91C_PIOB_PDSR & AT91C_PIO_PB1)
|
||||
printf ("No ");
|
||||
printf ("SmartMedia card inserted\n");
|
||||
if (*AT91C_PIOB_PDSR & AT91C_PIO_PB1)
|
||||
printf ("No ");
|
||||
printf ("SmartMedia card inserted\n");
|
||||
|
||||
printf("Probing at 0x%.8x\n", AT91_SMARTMEDIA_BASE);
|
||||
nand_probe(AT91_SMARTMEDIA_BASE);
|
||||
printf ("Probing at 0x%.8x\n", AT91_SMARTMEDIA_BASE);
|
||||
nand_probe (AT91_SMARTMEDIA_BASE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
TEXT_BASE = 0x21fa0000
|
||||
TEXT_BASE = 0x21f00000
|
||||
|
||||
|
||||
@@ -31,11 +31,40 @@
|
||||
ulong myflush(void);
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef
|
||||
{
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgAT49BV16x4[] =
|
||||
{
|
||||
{ 8, 8*1024 }, /* 8 * 8kBytes sectors */
|
||||
{ 2, 32*1024 }, /* 2 * 32kBytes sectors */
|
||||
{ 30, 64*1024 } /* 30 * 64kBytes sectors */
|
||||
};
|
||||
|
||||
OrgDef OrgAT49BV16x4A[] =
|
||||
{
|
||||
{ 8, 8*1024 }, /* 8 * 8kBytes sectors */
|
||||
{ 31, 64*1024 } /* 31 * 64kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
#define FLASH_BANK_SIZE 0x200000 /* 2 MB */
|
||||
#define MAIN_SECT_SIZE 0x10000 /* 64 KB */
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/* AT49BV1614A Codes */
|
||||
#define FLASH_CODE1 0xAA
|
||||
#define FLASH_CODE2 0x55
|
||||
#define ID_IN_CODE 0x90
|
||||
#define ID_OUT_CODE 0xF0
|
||||
|
||||
|
||||
#define CMD_READ_ARRAY 0x00F0
|
||||
#define CMD_UNLOCK1 0x00AA
|
||||
@@ -48,6 +77,9 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
#define MEM_FLASH_ADDR1 (*(volatile u16 *)(CFG_FLASH_BASE + (0x00005555<<1)))
|
||||
#define MEM_FLASH_ADDR2 (*(volatile u16 *)(CFG_FLASH_BASE + (0x00002AAA<<1)))
|
||||
|
||||
#define IDENT_FLASH_ADDR1 (*(volatile u16 *)(CFG_FLASH_BASE + (0x0000555<<1)))
|
||||
#define IDENT_FLASH_ADDR2 (*(volatile u16 *)(CFG_FLASH_BASE + (0x0000AAA<<1)))
|
||||
|
||||
#define BIT_ERASE_DONE 0x0080
|
||||
#define BIT_RDY_MASK 0x0080
|
||||
#define BIT_PROGRAM_ERROR 0x0020
|
||||
@@ -59,339 +91,375 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ulong flash_init(void)
|
||||
void flash_identification (flash_info_t * info)
|
||||
{
|
||||
int i, j;
|
||||
ulong size = 0;
|
||||
volatile u16 manuf_code, device_code, add_device_code;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++)
|
||||
{
|
||||
ulong flashbase = 0;
|
||||
flash_info[i].flash_id =
|
||||
(ATM_MANUFACT & FLASH_VENDMASK) |
|
||||
(ATM_ID_BV1614 & FLASH_TYPEMASK);
|
||||
flash_info[i].size = FLASH_BANK_SIZE;
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
|
||||
memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
IDENT_FLASH_ADDR1 = FLASH_CODE1;
|
||||
IDENT_FLASH_ADDR2 = FLASH_CODE2;
|
||||
IDENT_FLASH_ADDR1 = ID_IN_CODE;
|
||||
|
||||
if (j <= 9)
|
||||
{
|
||||
/* 1st to 8th are 8 KB */
|
||||
if (j <= 7)
|
||||
{
|
||||
flash_info[i].start[j] = flashbase + j*0x2000;
|
||||
manuf_code = *(volatile u16 *) CFG_FLASH_BASE;
|
||||
device_code = *(volatile u16 *) (CFG_FLASH_BASE + 2);
|
||||
add_device_code = *(volatile u16 *) (CFG_FLASH_BASE + (3 << 1));
|
||||
|
||||
IDENT_FLASH_ADDR1 = FLASH_CODE1;
|
||||
IDENT_FLASH_ADDR2 = FLASH_CODE2;
|
||||
IDENT_FLASH_ADDR1 = ID_OUT_CODE;
|
||||
|
||||
/* Vendor type */
|
||||
info->flash_id = ATM_MANUFACT & FLASH_VENDMASK;
|
||||
printf ("Atmel: ");
|
||||
|
||||
if ((device_code & FLASH_TYPEMASK) == (ATM_ID_BV1614 & FLASH_TYPEMASK)) {
|
||||
|
||||
if ((add_device_code & FLASH_TYPEMASK) ==
|
||||
(ATM_ID_BV1614A & FLASH_TYPEMASK)) {
|
||||
info->flash_id |= ATM_ID_BV1614A & FLASH_TYPEMASK;
|
||||
printf ("AT49BV1614A (16Mbit)\n");
|
||||
}
|
||||
|
||||
/* 9th and 10th are both 32 KB */
|
||||
if ((j == 8) || (j == 9))
|
||||
{
|
||||
flash_info[i].start[j] = flashbase + 0x10000 + (j-8)*0x8000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flash_info[i].start[j] = flashbase + (j-8)*MAIN_SECT_SIZE;
|
||||
}
|
||||
} else { /* AT49BV1614 Flash */
|
||||
info->flash_id |= ATM_ID_BV1614 & FLASH_TYPEMASK;
|
||||
printf ("AT49BV1614 (16Mbit)\n");
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
}
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_ENV_ADDR - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
ulong flash_init (void)
|
||||
{
|
||||
int i, j, k;
|
||||
unsigned int flash_nb_blocks, sector;
|
||||
unsigned int start_address;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
return size;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
ulong flashbase = 0;
|
||||
|
||||
flash_identification (&flash_info[i]);
|
||||
|
||||
flash_info[i].size = FLASH_BANK_SIZE;
|
||||
|
||||
if ((flash_info[i].flash_id & FLASH_TYPEMASK) ==
|
||||
(ATM_ID_BV1614 & FLASH_TYPEMASK)) {
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
|
||||
memset (flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
|
||||
pOrgDef = OrgAT49BV16x4;
|
||||
flash_nb_blocks = sizeof (OrgAT49BV16x4) / sizeof (OrgDef);
|
||||
} else { /* AT49BV1614A Flash */
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT - 1;
|
||||
memset (flash_info[i].protect, 0, CFG_MAX_FLASH_SECT - 1);
|
||||
|
||||
pOrgDef = OrgAT49BV16x4A;
|
||||
flash_nb_blocks = sizeof (OrgAT49BV16x4A) / sizeof (OrgDef);
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic ("configured to many flash banks!\n");
|
||||
|
||||
sector = 0;
|
||||
start_address = flashbase;
|
||||
|
||||
for (j = 0; j < flash_nb_blocks; j++) {
|
||||
for (k = 0; k < pOrgDef[j].sector_number; k++) {
|
||||
flash_info[i].start[sector++] = start_address;
|
||||
start_address += pOrgDef[j].sector_size;
|
||||
}
|
||||
}
|
||||
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect binary boot image */
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + CFG_BOOT_SIZE - 1, &flash_info[0]);
|
||||
|
||||
/* Protect environment variables */
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
|
||||
|
||||
/* Protect U-Boot gzipped image */
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_U_BOOT_BASE,
|
||||
CFG_U_BOOT_BASE + CFG_U_BOOT_SIZE - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK)
|
||||
{
|
||||
case (ATM_MANUFACT & FLASH_VENDMASK):
|
||||
printf("Atmel: ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK)
|
||||
{
|
||||
case (ATM_ID_BV1614 & FLASH_TYPEMASK):
|
||||
printf("AT49BV1614 (16Mbit)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
goto Done;
|
||||
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 ");
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case (ATM_MANUFACT & FLASH_VENDMASK):
|
||||
printf ("Atmel: ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
|
||||
Done:
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case (ATM_ID_BV1614 & FLASH_TYPEMASK):
|
||||
printf ("AT49BV1614 (16Mbit)\n");
|
||||
break;
|
||||
case (ATM_ID_BV1614A & FLASH_TYPEMASK):
|
||||
printf ("AT49BV1614A (16Mbit)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
goto Done;
|
||||
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");
|
||||
|
||||
Done:
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
ulong result;
|
||||
int iflag, cflag, prot, sect;
|
||||
int rc = ERR_OK;
|
||||
int chip1;
|
||||
ulong result;
|
||||
int iflag, cflag, prot, sect;
|
||||
int rc = ERR_OK;
|
||||
int chip1;
|
||||
|
||||
/* first look for protection bits */
|
||||
/* first look for protection bits */
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
return ERR_UNKNOWN_FLASH_TYPE;
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
return ERR_UNKNOWN_FLASH_TYPE;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
return ERR_INVAL;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) !=
|
||||
(ATM_MANUFACT & FLASH_VENDMASK)) {
|
||||
return ERR_UNKNOWN_FLASH_VENDOR;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
return ERR_INVAL;
|
||||
}
|
||||
}
|
||||
if (prot)
|
||||
return ERR_PROTECTED;
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
cflag = icache_status();
|
||||
icache_disable();
|
||||
iflag = disable_interrupts();
|
||||
if ((info->flash_id & FLASH_VENDMASK) !=
|
||||
(ATM_MANUFACT & FLASH_VENDMASK)) {
|
||||
return ERR_UNKNOWN_FLASH_VENDOR;
|
||||
}
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last && !ctrlc(); sect++)
|
||||
{
|
||||
printf("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
if (info->protect[sect] == 0)
|
||||
{ /* not protected */
|
||||
volatile u16 *addr = (volatile u16 *)(info->start[sect]);
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
|
||||
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
|
||||
MEM_FLASH_ADDR1 = CMD_ERASE_SETUP;
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
|
||||
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
|
||||
*addr = CMD_ERASE_CONFIRM;
|
||||
|
||||
/* wait until flash is ready */
|
||||
chip1 = 0;
|
||||
|
||||
do
|
||||
{
|
||||
result = *addr;
|
||||
|
||||
/* check timeout */
|
||||
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT)
|
||||
{
|
||||
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
|
||||
chip1 = TMO;
|
||||
break;
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
|
||||
if (!chip1 && (result & 0xFFFF) & BIT_ERASE_DONE)
|
||||
chip1 = READY;
|
||||
|
||||
} while (!chip1);
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
|
||||
|
||||
if (chip1 == ERR)
|
||||
{
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
if (chip1 == TMO)
|
||||
{
|
||||
rc = ERR_TIMOUT;
|
||||
goto outahere;
|
||||
}
|
||||
|
||||
printf("ok.\n");
|
||||
}
|
||||
else /* it was protected */
|
||||
{
|
||||
printf("protected!\n");
|
||||
}
|
||||
}
|
||||
if (prot)
|
||||
return ERR_PROTECTED;
|
||||
|
||||
if (ctrlc())
|
||||
printf("User Interrupt!\n");
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
cflag = icache_status ();
|
||||
icache_disable ();
|
||||
iflag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
volatile u16 *addr = (volatile u16 *) (info->start[sect]);
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
|
||||
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
|
||||
MEM_FLASH_ADDR1 = CMD_ERASE_SETUP;
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
|
||||
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
|
||||
*addr = CMD_ERASE_CONFIRM;
|
||||
|
||||
/* wait until flash is ready */
|
||||
chip1 = 0;
|
||||
|
||||
do {
|
||||
result = *addr;
|
||||
|
||||
/* check timeout */
|
||||
if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) {
|
||||
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
|
||||
chip1 = TMO;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!chip1 && (result & 0xFFFF) & BIT_ERASE_DONE)
|
||||
chip1 = READY;
|
||||
|
||||
} while (!chip1);
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
|
||||
|
||||
if (chip1 == ERR) {
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
if (chip1 == TMO) {
|
||||
rc = ERR_TIMOUT;
|
||||
goto outahere;
|
||||
}
|
||||
|
||||
printf ("ok.\n");
|
||||
} else { /* it was protected */
|
||||
printf ("protected!\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (ctrlc ())
|
||||
printf ("User Interrupt!\n");
|
||||
|
||||
outahere:
|
||||
/* allow flash to settle - wait 10 ms */
|
||||
udelay_masked(10000);
|
||||
/* allow flash to settle - wait 10 ms */
|
||||
udelay_masked (10000);
|
||||
|
||||
if (iflag)
|
||||
enable_interrupts();
|
||||
if (iflag)
|
||||
enable_interrupts ();
|
||||
|
||||
if (cflag)
|
||||
icache_enable();
|
||||
if (cflag)
|
||||
icache_enable ();
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash
|
||||
*/
|
||||
|
||||
volatile static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
volatile static int write_word (flash_info_t * info, ulong dest,
|
||||
ulong data)
|
||||
{
|
||||
volatile u16 *addr = (volatile u16 *)dest;
|
||||
ulong result;
|
||||
int rc = ERR_OK;
|
||||
int cflag, iflag;
|
||||
int chip1;
|
||||
volatile u16 *addr = (volatile u16 *) dest;
|
||||
ulong result;
|
||||
int rc = ERR_OK;
|
||||
int cflag, iflag;
|
||||
int chip1;
|
||||
|
||||
/*
|
||||
* Check if Flash is (sufficiently) erased
|
||||
*/
|
||||
result = *addr;
|
||||
if ((result & data) != data)
|
||||
return ERR_NOT_ERASED;
|
||||
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
cflag = icache_status();
|
||||
icache_disable();
|
||||
iflag = disable_interrupts();
|
||||
|
||||
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
|
||||
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
|
||||
MEM_FLASH_ADDR1 = CMD_PROGRAM;
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
/* wait until flash is ready */
|
||||
chip1 = 0;
|
||||
do
|
||||
{
|
||||
/*
|
||||
* Check if Flash is (sufficiently) erased
|
||||
*/
|
||||
result = *addr;
|
||||
if ((result & data) != data)
|
||||
return ERR_NOT_ERASED;
|
||||
|
||||
/* check timeout */
|
||||
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT)
|
||||
{
|
||||
chip1 = ERR | TMO;
|
||||
break;
|
||||
}
|
||||
if (!chip1 && ((result & 0x80) == (data & 0x80)))
|
||||
chip1 = READY;
|
||||
|
||||
} while (!chip1);
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
cflag = icache_status ();
|
||||
icache_disable ();
|
||||
iflag = disable_interrupts ();
|
||||
|
||||
*addr = CMD_READ_ARRAY;
|
||||
MEM_FLASH_ADDR1 = CMD_UNLOCK1;
|
||||
MEM_FLASH_ADDR2 = CMD_UNLOCK2;
|
||||
MEM_FLASH_ADDR1 = CMD_PROGRAM;
|
||||
*addr = data;
|
||||
|
||||
if (chip1 == ERR || *addr != data)
|
||||
rc = ERR_PROG_ERROR;
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
if (iflag)
|
||||
enable_interrupts();
|
||||
/* wait until flash is ready */
|
||||
chip1 = 0;
|
||||
do {
|
||||
result = *addr;
|
||||
|
||||
if (cflag)
|
||||
icache_enable();
|
||||
/* check timeout */
|
||||
if (get_timer_masked () > CFG_FLASH_ERASE_TOUT) {
|
||||
chip1 = ERR | TMO;
|
||||
break;
|
||||
}
|
||||
if (!chip1 && ((result & 0x80) == (data & 0x80)))
|
||||
chip1 = READY;
|
||||
|
||||
return rc;
|
||||
} while (!chip1);
|
||||
|
||||
*addr = CMD_READ_ARRAY;
|
||||
|
||||
if (chip1 == ERR || *addr != data)
|
||||
rc = ERR_PROG_ERROR;
|
||||
|
||||
if (iflag)
|
||||
enable_interrupts ();
|
||||
|
||||
if (cflag)
|
||||
icache_enable ();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash.
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong wp, data;
|
||||
int rc;
|
||||
ulong wp, data;
|
||||
int rc;
|
||||
|
||||
if(addr & 1) {
|
||||
printf("unaligned destination not supported\n");
|
||||
return ERR_ALIGN;
|
||||
};
|
||||
if (addr & 1) {
|
||||
printf ("unaligned destination not supported\n");
|
||||
return ERR_ALIGN;
|
||||
};
|
||||
|
||||
if((int)src & 1) {
|
||||
printf("unaligned source not supported\n");
|
||||
return ERR_ALIGN;
|
||||
};
|
||||
if ((int) src & 1) {
|
||||
printf ("unaligned source not supported\n");
|
||||
return ERR_ALIGN;
|
||||
};
|
||||
|
||||
wp = addr;
|
||||
wp = addr;
|
||||
|
||||
while (cnt >= 2) {
|
||||
data = *((volatile u16*)src);
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
while (cnt >= 2) {
|
||||
data = *((volatile u16 *) src);
|
||||
if ((rc = write_word (info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
src += 2;
|
||||
wp += 2;
|
||||
cnt -= 2;
|
||||
}
|
||||
src += 2;
|
||||
wp += 2;
|
||||
cnt -= 2;
|
||||
}
|
||||
|
||||
if(cnt == 1) {
|
||||
data = (*((volatile u8*)src)) | (*((volatile u8*)(wp+1)) << 8);
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
src += 1;
|
||||
wp += 1;
|
||||
cnt -= 1;
|
||||
};
|
||||
if (cnt == 1) {
|
||||
data = (*((volatile u8 *) src)) | (*((volatile u8 *) (wp + 1)) <<
|
||||
8);
|
||||
if ((rc = write_word (info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
src += 1;
|
||||
wp += 1;
|
||||
cnt -= 1;
|
||||
};
|
||||
|
||||
return ERR_OK;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -203,6 +203,49 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* UPMB initialization table
|
||||
*/
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
static const uint rtc_table[] =
|
||||
{
|
||||
/*
|
||||
* Single Read. (Offset 0 in UPMA RAM)
|
||||
*/
|
||||
0xfffec00, 0xfffac00, 0xfff2d00, 0xfef2800,
|
||||
0xfaf2080, 0xfaf2080, 0xfff2400, 0x1fff6c05, /* last */
|
||||
/*
|
||||
* Burst Read. (Offset 8 in UPMA RAM)
|
||||
*/
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Single Write. (Offset 18 in UPMA RAM)
|
||||
*/
|
||||
0xfffec00, 0xfffac00, 0xfff2d00, 0xfef2800,
|
||||
0xfaf2080, 0xfaf2080, 0xfaf2400, 0x1fbf6c05, /* last */
|
||||
/*
|
||||
* Burst Write. (Offset 20 in UPMA RAM)
|
||||
*/
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Refresh (Offset 30 in UPMA RAM)
|
||||
*/
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
/*
|
||||
* Exception. (Offset 3c in UPMA RAM)
|
||||
*/
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Check Board Identity:
|
||||
@@ -319,6 +362,17 @@ static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
|
||||
return (maxsize);
|
||||
}
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
|
||||
upmconfig(UPMA, (uint *)rtc_table, sizeof(rtc_table) / sizeof(uint));
|
||||
memctl->memc_mamr = MxMR_RLFx_6X | MxMR_WLFx_6X | MxMR_OP_NORM;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
|
||||
@@ -30,12 +30,7 @@
|
||||
# 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
|
||||
endif
|
||||
TEXT_BASE := 0xFF000000
|
||||
|
||||
# RAM version
|
||||
#TEXT_BASE := 0x100000
|
||||
|
||||
@@ -61,6 +61,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -70,6 +70,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -88,6 +88,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -76,6 +76,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -68,6 +68,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -70,6 +70,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -61,6 +61,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -88,6 +88,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -70,6 +70,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -93,6 +93,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -73,6 +73,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -73,6 +73,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -66,6 +66,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -62,6 +62,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -88,6 +88,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -74,6 +74,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -96,6 +96,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -238,10 +238,15 @@ int testdram (void)
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
extern void nand_probe(ulong physadr);
|
||||
#include <linux/mtd/nand.h>
|
||||
extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
|
||||
|
||||
void nand_init(void)
|
||||
{
|
||||
printf("Probing at 0x%.8x\n", CFG_NAND_BASE);
|
||||
nand_probe(CFG_NAND_BASE);
|
||||
if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN) {
|
||||
puts("NAND: ");
|
||||
print_size(nand_dev_desc[0].totlen, "\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -98,6 +98,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -93,6 +93,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -100,6 +100,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -86,6 +86,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -76,6 +76,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -78,6 +78,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -73,6 +73,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -79,6 +79,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -67,6 +67,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -66,6 +66,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -75,6 +75,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -60,6 +60,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -76,6 +76,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o bsp.o eeprom.o fetch.o
|
||||
OBJS = $(BOARD).o flash.o bsp.o eeprom.o fetch.o input.o env.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
@@ -20,13 +20,12 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* hacked for Hymod FPGA support by Murray.Jensen@cmst.csiro.au, 29-Jan-01
|
||||
* hacked for Hymod FPGA support by Murray.Jensen@csiro.au, 29-Jan-01
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <net.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/iopin_8260.h>
|
||||
#include <cmd_bsp.h>
|
||||
|
||||
@@ -74,28 +73,29 @@
|
||||
* has not worked (wait several ms?)
|
||||
*/
|
||||
|
||||
int fpga_load (int mezz, uchar * addr, ulong size)
|
||||
int
|
||||
fpga_load (int mezz, uchar *addr, ulong size)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
|
||||
xlx_info_t *fp;
|
||||
xlx_iopins_t *fpgaio;
|
||||
volatile uchar *fpgabase;
|
||||
volatile uint cnt;
|
||||
uchar *eaddr = addr + size;
|
||||
int result;
|
||||
|
||||
if (mezz) {
|
||||
if (!cp->mezz.mmap[0].prog.exists)
|
||||
return (LOAD_FAIL_NOCONF);
|
||||
fpgabase = (uchar *) cp->mezz.mmap[0].prog.base;
|
||||
fpgaio = &cp->mezz.iopins[0];
|
||||
} else {
|
||||
if (!cp->main.mmap[0].prog.exists)
|
||||
return (LOAD_FAIL_NOCONF);
|
||||
fpgabase = (uchar *) cp->main.mmap[0].prog.base;
|
||||
fpgaio = &cp->main.iopins[0];
|
||||
}
|
||||
if (mezz)
|
||||
fp = &cp->mezz.xlx[0];
|
||||
else
|
||||
fp = &cp->main.xlx[0];
|
||||
|
||||
if (!fp->mmap.prog.exists)
|
||||
return (LOAD_FAIL_NOCONF);
|
||||
|
||||
fpgabase = (uchar *)fp->mmap.prog.base;
|
||||
fpgaio = &fp->iopins;
|
||||
|
||||
/* set enable HIGH if required */
|
||||
if (fpgaio->enable_pin.flag)
|
||||
@@ -106,7 +106,7 @@ int fpga_load (int mezz, uchar * addr, ulong size)
|
||||
|
||||
/* toggle PROG Low then High (will already be Low after Power-On) */
|
||||
iopin_set_low (&fpgaio->prog_pin);
|
||||
udelay (1); /* minimum 300ns - 1usec should do it */
|
||||
udelay (1); /* minimum 300ns - 1usec should do it */
|
||||
iopin_set_high (&fpgaio->prog_pin);
|
||||
|
||||
/* wait for INIT High */
|
||||
@@ -157,15 +157,15 @@ do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
case 2:
|
||||
if (strcmp (argv[1], "info") == 0) {
|
||||
printf ("\nHymod FPGA Info...\n");
|
||||
printf (" Address Size\n");
|
||||
printf (" Main Configuration: 0x%08x %d\n",
|
||||
FPGA_MAIN_CFG_BASE, FPGA_MAIN_CFG_SIZE);
|
||||
printf (" Main Register: 0x%08x %d\n",
|
||||
FPGA_MAIN_REG_BASE, FPGA_MAIN_REG_SIZE);
|
||||
printf (" Main Port: 0x%08x %d\n",
|
||||
FPGA_MAIN_PORT_BASE, FPGA_MAIN_PORT_SIZE);
|
||||
printf (" Mezz Configuration: 0x%08x %d\n",
|
||||
FPGA_MEZZ_CFG_BASE, FPGA_MEZZ_CFG_SIZE);
|
||||
printf ("\t\t\t\tAddress\t\tSize\n");
|
||||
printf ("\tMain Configuration:\t0x%08x\t%d\n",
|
||||
FPGA_MAIN_CFG_BASE, FPGA_MAIN_CFG_SIZE);
|
||||
printf ("\tMain Register:\t\t0x%08x\t%d\n",
|
||||
FPGA_MAIN_REG_BASE, FPGA_MAIN_REG_SIZE);
|
||||
printf ("\tMain Port:\t\t0x%08x\t%d\n",
|
||||
FPGA_MAIN_PORT_BASE, FPGA_MAIN_PORT_SIZE);
|
||||
printf ("\tMezz Configuration:\t0x%08x\t%d\n",
|
||||
FPGA_MEZZ_CFG_BASE, FPGA_MEZZ_CFG_SIZE);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -176,18 +176,21 @@ do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
save_addr = addr;
|
||||
#if 0
|
||||
/* reading config data unimplemented */
|
||||
while VM
|
||||
:more config data * addr++ = *fpga;
|
||||
result = VM:? ? ?
|
||||
/* fpga readback unimplemented */
|
||||
while (more readback data)
|
||||
*addr++ = *fpga;
|
||||
result = error ? STORE_FAIL_XXX : STORE_SUCCESS;
|
||||
#else
|
||||
result = 0;
|
||||
result = STORE_SUCCESS;
|
||||
#endif
|
||||
|
||||
if (result == STORE_SUCCESS) {
|
||||
printf ("SUCCEEDED (%d bytes)\n", addr - save_addr);
|
||||
printf ("SUCCEEDED (%d bytes)\n",
|
||||
addr - save_addr);
|
||||
return 0;
|
||||
} else
|
||||
printf ("FAILED (%d bytes)\n", addr - save_addr);
|
||||
printf ("FAILED (%d bytes)\n",
|
||||
addr - save_addr);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
@@ -196,25 +199,32 @@ do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
if (strcmp (argv[1], "tftp") == 0) {
|
||||
copy_filename (BootFile, argv[2], sizeof (BootFile));
|
||||
load_addr = simple_strtoul (argv[3], NULL, 16);
|
||||
NetBootFileXferSize = 0;
|
||||
|
||||
if (NetLoop (TFTP) <= 0) {
|
||||
printf ("tftp transfer failed - aborting fgpa load\n");
|
||||
printf ("tftp transfer failed - aborting "
|
||||
"fgpa load\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NetBootFileXferSize == 0) {
|
||||
printf ("can't determine file size - aborting fpga load\n");
|
||||
printf ("can't determine file size - "
|
||||
"aborting fpga load\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("File transfer succeeded - beginning fpga load...");
|
||||
printf ("File transfer succeeded - "
|
||||
"beginning fpga load...");
|
||||
|
||||
result = fpga_load (0, (uchar *) load_addr,
|
||||
NetBootFileXferSize);
|
||||
NetBootFileXferSize);
|
||||
|
||||
if (result == LOAD_SUCCESS) {
|
||||
printf ("SUCCEEDED\n");
|
||||
return 0;
|
||||
} else if (result == LOAD_FAIL_NOINIT)
|
||||
} else if (result == LOAD_FAIL_NOCONF)
|
||||
printf ("FAILED (no CONF)\n");
|
||||
else if (result == LOAD_FAIL_NOINIT)
|
||||
printf ("FAILED (no INIT)\n");
|
||||
else
|
||||
printf ("FAILED (no DONE)\n");
|
||||
@@ -231,7 +241,8 @@ do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
else if (strcmp (argv[2], "mezz") == 0)
|
||||
mezz = 1;
|
||||
else {
|
||||
printf ("FPGA type must be either `main' or `mezz'\n");
|
||||
printf ("FPGA type must be either "
|
||||
"`main' or `mezz'\n");
|
||||
return 1;
|
||||
}
|
||||
arg = 3;
|
||||
@@ -239,14 +250,18 @@ do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
mezz = 0;
|
||||
arg = 2;
|
||||
}
|
||||
|
||||
addr = (uchar *) simple_strtoul (argv[arg++], NULL, 16);
|
||||
size = (ulong) simple_strtoul (argv[arg], NULL, 16);
|
||||
|
||||
result = fpga_load (mezz, addr, size);
|
||||
|
||||
if (result == LOAD_SUCCESS) {
|
||||
printf ("SUCCEEDED\n");
|
||||
return 0;
|
||||
} else if (result == LOAD_FAIL_NOINIT)
|
||||
} else if (result == LOAD_FAIL_NOCONF)
|
||||
printf ("FAILED (no CONF)\n");
|
||||
else if (result == LOAD_FAIL_NOINIT)
|
||||
printf ("FAILED (no INIT)\n");
|
||||
else
|
||||
printf ("FAILED (no DONE)\n");
|
||||
@@ -267,22 +282,21 @@ int
|
||||
do_eecl (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
uchar data[HYMOD_EEPROM_SIZE];
|
||||
uint offset;
|
||||
int rcode = 0;
|
||||
uint addr = CFG_I2C_EEPROM_ADDR;
|
||||
|
||||
switch (argc) {
|
||||
|
||||
case 1:
|
||||
offset = HYMOD_EEOFF_MAIN;
|
||||
addr |= HYMOD_EEOFF_MAIN;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (strcmp (argv[1], "main") == 0) {
|
||||
offset = HYMOD_EEOFF_MAIN;
|
||||
addr |= HYMOD_EEOFF_MAIN;
|
||||
break;
|
||||
}
|
||||
if (strcmp (argv[1], "mezz") == 0) {
|
||||
offset = HYMOD_EEOFF_MEZZ;
|
||||
addr |= HYMOD_EEOFF_MEZZ;
|
||||
break;
|
||||
}
|
||||
/* fall through ... */
|
||||
@@ -293,15 +307,77 @@ do_eecl (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
|
||||
memset (data, 0, HYMOD_EEPROM_SIZE);
|
||||
if (i2c_write
|
||||
(CFG_I2C_EEPROM_ADDR | offset, 0, CFG_I2C_EEPROM_ADDR_LEN, data,
|
||||
HYMOD_EEPROM_SIZE)) {
|
||||
rcode = 1;
|
||||
}
|
||||
|
||||
return rcode;
|
||||
eeprom_write (addr, 0, data, HYMOD_EEPROM_SIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CFG_CMD_BSP */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if 0
|
||||
static uchar test_bitfile[] = {
|
||||
/* one day ... */
|
||||
};
|
||||
#endif
|
||||
|
||||
int
|
||||
do_htest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
#if 0
|
||||
int rc;
|
||||
#endif
|
||||
#ifdef CONFIG_ETHER_LOOPBACK_TEST
|
||||
extern void eth_loopback_test (void);
|
||||
#endif /* CONFIG_ETHER_LOOPBACK_TEST */
|
||||
|
||||
printf ("HYMOD tests - ensure loopbacks etc. are connected\n\n");
|
||||
|
||||
#if 0
|
||||
/* Load FPGA with test program */
|
||||
|
||||
printf ("Loading test FPGA program ...");
|
||||
|
||||
rc = fpga_load (0, test_bitfile, sizeof (test_bitfile));
|
||||
|
||||
switch (rc) {
|
||||
|
||||
case LOAD_SUCCESS:
|
||||
printf (" SUCCEEDED\n");
|
||||
break;
|
||||
|
||||
case LOAD_FAIL_NOCONF:
|
||||
printf (" FAILED (no configuration space defined)\n");
|
||||
return 1;
|
||||
|
||||
case LOAD_FAIL_NOINIT:
|
||||
printf (" FAILED (timeout - no INIT signal seen)\n");
|
||||
return 1;
|
||||
|
||||
case LOAD_FAIL_NODONE:
|
||||
printf (" FAILED (timeout - no DONE signal seen)\n");
|
||||
return 1;
|
||||
|
||||
default:
|
||||
printf (" FAILED (unknown return code from fpga_load\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* run Local Bus <=> Xilinx tests */
|
||||
|
||||
/* tell Xilinx to run ZBT Ram, High Speed serial and Mezzanine tests */
|
||||
|
||||
/* run SDRAM test */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ETHER_LOOPBACK_TEST
|
||||
/* run Ethernet test */
|
||||
eth_loopback_test ();
|
||||
#endif /* CONFIG_ETHER_LOOPBACK_TEST */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CFG_CMD_BSP */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
|
||||
TEXT_BASE = 0x40000000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
|
||||
PLATFORM_CPPFLAGS += -I$(TOPDIR)
|
||||
|
||||
OBJCFLAGS = --set-section-flags=.ppcenv=contents,alloc,load,data
|
||||
OBJCFLAGS = --remove-section=.ppcenv
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
236
board/hymod/env.c
Normal file
236
board/hymod/env.c
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
|
||||
*
|
||||
* 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>
|
||||
|
||||
/* imports from fetch.c */
|
||||
extern int fetch_and_parse (char *, ulong, int (*)(uchar *, uchar *));
|
||||
|
||||
/* this is relative to the root of the server's tftp directory */
|
||||
static char *def_global_env_path = "/hymod/global_env";
|
||||
|
||||
static int
|
||||
env_callback (uchar *name, uchar *value)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
|
||||
char ov[CFG_CBSIZE], nv[CFG_CBSIZE], *p, *q, *nn, c, *curver, *newver;
|
||||
int override = 1, append = 0, remove = 0, nnl, ovl, nvl;
|
||||
|
||||
nn = name;
|
||||
|
||||
if (*nn == '-') {
|
||||
override = 0;
|
||||
nn++;
|
||||
}
|
||||
|
||||
while (*nn == ' ' || *nn == '\t')
|
||||
nn++;
|
||||
|
||||
if ((nnl = strlen (nn)) == 0) {
|
||||
printf ("Empty name in global env file\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if ((c = nn[nnl - 1]) == '+' || c == '-') {
|
||||
if (c == '+')
|
||||
append = 1;
|
||||
else
|
||||
remove = 1;
|
||||
nn[--nnl] = '\0';
|
||||
}
|
||||
|
||||
while (nnl > 0 && ((c = nn[nnl - 1]) == ' ' || c == '\t'))
|
||||
nn[--nnl] = '\0';
|
||||
if (nnl == 0) {
|
||||
printf ("Empty name in global env file\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
p = value;
|
||||
q = nv;
|
||||
|
||||
while ((c = *p) == ' ' || c == '\t')
|
||||
p++;
|
||||
|
||||
nvl = strlen (p);
|
||||
while (nvl > 0 && ((c = p[nvl - 1]) == ' ' || c == '\t'))
|
||||
p[--nvl] = '\0';
|
||||
|
||||
while ((*q = *p++) != '\0') {
|
||||
if (*q == '%') {
|
||||
switch (*p++) {
|
||||
|
||||
case '\0': /* whoops - back up */
|
||||
p--;
|
||||
break;
|
||||
|
||||
case '%': /* a single percent character */
|
||||
q++;
|
||||
break;
|
||||
|
||||
case 's': /* main board serial number as string */
|
||||
q += sprintf (q, "%010lu",
|
||||
cp->main.eeprom.serno);
|
||||
break;
|
||||
|
||||
case 'S': /* main board serial number as number */
|
||||
q += sprintf (q, "%lu", cp->main.eeprom.serno);
|
||||
break;
|
||||
|
||||
default: /* ignore any others */
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
q++;
|
||||
}
|
||||
|
||||
if ((nvl = q - nv) == 0) {
|
||||
setenv (nn, NULL);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((curver = getenv ("global_env_version")) == NULL)
|
||||
curver = "unknown";
|
||||
|
||||
if ((newver = getenv ("new_genv_version")) == NULL || \
|
||||
strcmp (curver, newver) == 0) {
|
||||
if (strcmp (nn, "version") == 0)
|
||||
setenv ("new_genv_version", nv);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if ((p = getenv (nn)) != NULL) {
|
||||
|
||||
strcpy (ov, p);
|
||||
ovl = strlen (ov);
|
||||
|
||||
if (append) {
|
||||
|
||||
if (strstr (ov, nv) == NULL) {
|
||||
|
||||
printf ("Appending '%s' to env var '%s'\n",
|
||||
nv, nn);
|
||||
|
||||
while (nvl >= 0) {
|
||||
nv[ovl + 1 + nvl] = nv[nvl];
|
||||
nvl--;
|
||||
}
|
||||
|
||||
nv[ovl] = ' ';
|
||||
|
||||
while (--ovl >= 0)
|
||||
nv[ovl] = ov[ovl];
|
||||
|
||||
setenv (nn, nv);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (remove) {
|
||||
|
||||
if (strstr (ov, nv) != NULL) {
|
||||
|
||||
printf ("Removing '%s' from env var '%s'\n",
|
||||
nv, nn);
|
||||
|
||||
while ((p = strstr (ov, nv)) != NULL) {
|
||||
q = p + nvl;
|
||||
if (*q == ' ')
|
||||
q++;
|
||||
strcpy(p, q);
|
||||
}
|
||||
|
||||
setenv (nn, ov);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (!override || strcmp (ov, nv) == 0)
|
||||
return (1);
|
||||
|
||||
printf ("Re-setting env cmd '%s' from '%s' to '%s'\n",
|
||||
nn, ov, nv);
|
||||
}
|
||||
else
|
||||
printf ("Setting env cmd '%s' to '%s'\n", nn, nv);
|
||||
|
||||
setenv (nn, nv);
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
hymod_check_env (void)
|
||||
{
|
||||
char *p, *path, *curver, *newver;
|
||||
int firsttime = 0, needsave = 0;
|
||||
|
||||
if (getenv ("global_env_loaded") == NULL) {
|
||||
puts ("*** global environment has never been loaded\n");
|
||||
puts ("*** fetching from server");
|
||||
firsttime = 1;
|
||||
}
|
||||
else if ((p = getenv ("always_check_env")) != NULL &&
|
||||
strcmp (p, "yes") == 0)
|
||||
puts ("*** checking for updated global environment");
|
||||
else
|
||||
return;
|
||||
|
||||
puts (" (Control-C to Abort)\n");
|
||||
|
||||
if ((path = getenv ("global_env_path")) == NULL || *path == '\0')
|
||||
path = def_global_env_path;
|
||||
|
||||
if (fetch_and_parse (path, CFG_LOAD_ADDR, env_callback) == 0) {
|
||||
puts ("*** Fetch of global environment failed!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((newver = getenv ("new_genv_version")) == NULL) {
|
||||
puts ("*** Version number not set - contents ignored!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((curver = getenv ("global_env_version")) == NULL || \
|
||||
strcmp (curver, newver) != 0) {
|
||||
setenv ("global_env_version", newver);
|
||||
needsave = 1;
|
||||
}
|
||||
else
|
||||
printf ("*** Global environment up-to-date (ver %s)\n", curver);
|
||||
|
||||
setenv ("new_genv_version", NULL);
|
||||
|
||||
if (firsttime) {
|
||||
setenv ("global_env_loaded", "yes");
|
||||
needsave = 1;
|
||||
}
|
||||
|
||||
if (needsave)
|
||||
puts ("\n*** Remember to run the 'saveenv' "
|
||||
"command to save the changes\n\n");
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Murray Jensen, CSIRO Manufacturing Science and Technology,
|
||||
* <Murray.Jensen@cmst.csiro.au>
|
||||
* Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
@@ -25,118 +24,84 @@
|
||||
#include <common.h>
|
||||
#include <net.h>
|
||||
|
||||
/* imports from common/main.c */
|
||||
extern char console_buffer[CFG_CBSIZE];
|
||||
/* imports from input.c */
|
||||
extern int hymod_get_ethaddr (void);
|
||||
|
||||
int
|
||||
fetch_and_parse(bd_t *bd, char *fn, ulong addr, int (*cback)(uchar *, uchar *))
|
||||
fetch_and_parse (char *fn, ulong addr, int (*cback)(uchar *, uchar *))
|
||||
{
|
||||
char *ethaddr;
|
||||
uchar *fp, *efp;
|
||||
char *ethaddr;
|
||||
uchar *fp, *efp;
|
||||
int rc, count = 0;
|
||||
|
||||
while ((ethaddr = getenv("ethaddr")) == NULL || *ethaddr == '\0') {
|
||||
while ((ethaddr = getenv ("ethaddr")) == NULL || *ethaddr == '\0') {
|
||||
|
||||
puts("*** Ethernet address is not set\n");
|
||||
printf ("*** Ethernet address is%s not set\n",
|
||||
count == 0 ? "" : " STILL");
|
||||
|
||||
for (;;) {
|
||||
int n;
|
||||
if ((rc = hymod_get_ethaddr ()) < 0) {
|
||||
if (rc == -1)
|
||||
puts ("\n*** interrupted!");
|
||||
else
|
||||
puts ("\n*** timeout!");
|
||||
printf (" - fetch of '%s' aborted\n", fn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
n = readline("Enter board ethernet address: ");
|
||||
count++;
|
||||
}
|
||||
|
||||
if (n < 0) {
|
||||
puts("\n");
|
||||
copy_filename (BootFile, fn, sizeof (BootFile));
|
||||
load_addr = addr;
|
||||
NetBootFileXferSize = 0;
|
||||
|
||||
if (NetLoop (TFTP) == 0) {
|
||||
printf ("tftp transfer of file '%s' failed\n", fn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
continue;
|
||||
|
||||
if (n == 17) {
|
||||
int i;
|
||||
char *p, *q;
|
||||
uchar ea[6];
|
||||
|
||||
/* see if it looks like an ethernet address */
|
||||
|
||||
p = console_buffer;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
char term = (i == 5 ? '\0' : ':');
|
||||
|
||||
ea[i] = simple_strtol(p, &q, 16);
|
||||
|
||||
if ((q - p) != 2 || *q++ != term)
|
||||
break;
|
||||
|
||||
p = q;
|
||||
}
|
||||
|
||||
if (i == 6) {
|
||||
/* it looks ok - set it */
|
||||
printf("Setting ethernet address to %s\n", console_buffer);
|
||||
setenv("ethaddr", console_buffer);
|
||||
|
||||
puts("Remember to do a 'saveenv' to make it permanent\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Invalid ethernet address (%s) - please re-enter\n",
|
||||
console_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
copy_filename(BootFile, fn, sizeof (BootFile));
|
||||
load_addr = addr;
|
||||
|
||||
if (NetLoop(TFTP) <= 0) {
|
||||
printf("tftp transfer of file '%s' failed\n", fn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (NetBootFileXferSize == 0) {
|
||||
printf("can't determine size of file '%s'\n", fn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
fp = (uchar *)load_addr;
|
||||
efp = fp + NetBootFileXferSize;
|
||||
|
||||
do {
|
||||
uchar *name, *value;
|
||||
|
||||
if (*fp == '#' || *fp == '\n') {
|
||||
while (fp < efp && *fp++ != '\n')
|
||||
;
|
||||
continue;
|
||||
}
|
||||
|
||||
name = fp;
|
||||
if (NetBootFileXferSize == 0) {
|
||||
printf ("can't determine size of file '%s'\n", fn);
|
||||
return (0);
|
||||
}
|
||||
|
||||
fp = (uchar *)load_addr;
|
||||
efp = fp + NetBootFileXferSize;
|
||||
|
||||
do {
|
||||
uchar *name, *value;
|
||||
|
||||
if (*fp == '#' || *fp == '\n') {
|
||||
/* skip this line */
|
||||
while (fp < efp && *fp++ != '\n')
|
||||
;
|
||||
continue;
|
||||
}
|
||||
|
||||
while (fp < efp && *fp != '=')
|
||||
if (*fp++ == '\n')
|
||||
name = fp;
|
||||
|
||||
if (fp >= efp)
|
||||
break;
|
||||
while (fp < efp && *fp != '=' && *fp != '\n')
|
||||
fp++;
|
||||
if (fp >= efp)
|
||||
break;
|
||||
if (*fp == '\n') {
|
||||
fp++;
|
||||
continue;
|
||||
}
|
||||
*fp++ = '\0';
|
||||
|
||||
*fp++ = '\0';
|
||||
value = fp;
|
||||
|
||||
value = fp;
|
||||
while (fp < efp && *fp != '\n')
|
||||
fp++;
|
||||
if (fp[-1] == '\r')
|
||||
fp[-1] = '\0';
|
||||
*fp++ = '\0'; /* ok if we go off the end here */
|
||||
|
||||
while (fp < efp && *fp != '\n')
|
||||
fp++;
|
||||
if ((*cback)(name, value) == 0)
|
||||
return (0);
|
||||
|
||||
/* ok if we go off the end here */
|
||||
} while (fp < efp);
|
||||
|
||||
if (fp[-1] == '\r')
|
||||
fp[-1] = '\0';
|
||||
*fp++ = '\0';
|
||||
|
||||
if ((*cback)(name, value) == 0)
|
||||
return (0);
|
||||
|
||||
} while (fp < efp);
|
||||
|
||||
return (1);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Hacked for the Hymod board by Murray.Jensen@cmst.csiro.au, 20-Oct-00
|
||||
* Hacked for the Hymod board by Murray.Jensen@csiro.au, 20-Oct-00
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -35,235 +35,155 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
#define FLAG_PROTECT_SET 0x01
|
||||
#define FLAG_PROTECT_CLEAR 0x02
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
#if 0
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info);
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
#endif
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* probe for the existence of flash at bank word address "addr"
|
||||
* 0 = yes, 1 = bad Manufacturer's Id, 2 = bad Device Id
|
||||
* probe for flash bank at address "base" and store info about it
|
||||
* in the flash_info entry "fip". Fatal error if nothing there.
|
||||
*/
|
||||
static int
|
||||
bank_probe_word(bank_addr_t addr)
|
||||
static void
|
||||
bank_probe (flash_info_t *fip, volatile bank_addr_t base)
|
||||
{
|
||||
int retval;
|
||||
volatile bank_addr_t addr;
|
||||
bank_word_t word;
|
||||
int i;
|
||||
|
||||
/* reset the flash */
|
||||
*addr = BANK_CMD_RST;
|
||||
*base = BANK_CMD_RST;
|
||||
|
||||
/* check the manufacturer id */
|
||||
*addr = BANK_CMD_RD_ID;
|
||||
if (*BANK_ADDR_REG_MAN(addr) != BANK_RD_ID_MAN) {
|
||||
retval = -1;
|
||||
goto out;
|
||||
}
|
||||
/* put flash into read id mode */
|
||||
*base = BANK_CMD_RD_ID;
|
||||
|
||||
/* check the manufacturer id - must be intel */
|
||||
word = *BANK_REG_MAN_CODE (base);
|
||||
if (word != BANK_FILL_WORD (INTEL_MANUFACT&0xff))
|
||||
panic ("\nbad manufacturer's code (0x%08lx) at addr 0x%08lx",
|
||||
(unsigned long)word, (unsigned long)base);
|
||||
|
||||
/* check the device id */
|
||||
*addr = BANK_CMD_RD_ID;
|
||||
if (*BANK_ADDR_REG_DEV(addr) != BANK_RD_ID_DEV) {
|
||||
retval = -2;
|
||||
goto out;
|
||||
word = *BANK_REG_DEV_CODE (base);
|
||||
switch (word) {
|
||||
|
||||
case BANK_FILL_WORD (INTEL_ID_28F320J5&0xff):
|
||||
fip->flash_id = FLASH_MAN_INTEL | FLASH_28F320J5;
|
||||
fip->sector_count = 32;
|
||||
break;
|
||||
|
||||
case BANK_FILL_WORD (INTEL_ID_28F640J5&0xff):
|
||||
fip->flash_id = FLASH_MAN_INTEL | FLASH_28F640J5;
|
||||
fip->sector_count = 64;
|
||||
break;
|
||||
|
||||
case BANK_FILL_WORD (INTEL_ID_28F320J3A&0xff):
|
||||
fip->flash_id = FLASH_MAN_INTEL | FLASH_28F320J3A;
|
||||
fip->sector_count = 32;
|
||||
break;
|
||||
|
||||
case BANK_FILL_WORD (INTEL_ID_28F640J3A&0xff):
|
||||
fip->flash_id = FLASH_MAN_INTEL | FLASH_28F640J3A;
|
||||
fip->sector_count = 64;
|
||||
break;
|
||||
|
||||
case BANK_FILL_WORD (INTEL_ID_28F128J3A&0xff):
|
||||
fip->flash_id = FLASH_MAN_INTEL | FLASH_28F128J3A;
|
||||
fip->sector_count = 128;
|
||||
break;
|
||||
|
||||
default:
|
||||
panic ("\nbad device code (0x%08lx) at addr 0x%08lx",
|
||||
(unsigned long)word, (unsigned long)base);
|
||||
}
|
||||
|
||||
retval = CFG_FLASH_TYPE;
|
||||
|
||||
out:
|
||||
/* reset the flash again */
|
||||
*addr = BANK_CMD_RST;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* probe for flash banks at address "base" and store info for any found
|
||||
* into flash_info entry "fip". Must find at least one bank.
|
||||
*/
|
||||
static void
|
||||
bank_probe(flash_info_t *fip, bank_addr_t base)
|
||||
{
|
||||
bank_addr_t addr, eaddr;
|
||||
int nbanks;
|
||||
|
||||
fip->flash_id = FLASH_UNKNOWN;
|
||||
fip->size = 0L;
|
||||
fip->sector_count = 0;
|
||||
if (fip->sector_count >= CFG_MAX_FLASH_SECT)
|
||||
panic ("\ntoo many sectors (%d) in flash at address 0x%08lx",
|
||||
fip->sector_count, (unsigned long)base);
|
||||
|
||||
addr = base;
|
||||
eaddr = BANK_ADDR_BASE(addr, MAX_BANKS);
|
||||
nbanks = 0;
|
||||
|
||||
while (addr < eaddr) {
|
||||
bank_addr_t addrw, eaddrw, addrb;
|
||||
int i, osc, nsc, curtype = -1;
|
||||
|
||||
addrw = addr;
|
||||
eaddrw = BANK_ADDR_NEXT_WORD(addrw);
|
||||
|
||||
while (addrw < eaddrw) {
|
||||
int thistype;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" probing for flash at addr 0x%08lx\n",
|
||||
(unsigned long)addrw);
|
||||
#endif
|
||||
if ((thistype = bank_probe_word(addrw++)) < 0)
|
||||
goto out;
|
||||
|
||||
if (curtype < 0)
|
||||
curtype = thistype;
|
||||
else {
|
||||
if (thistype != curtype) {
|
||||
printf("Differing flash type found!\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (curtype < 0)
|
||||
goto out;
|
||||
|
||||
/* bank exists - append info for this bank to *fip */
|
||||
fip->flash_id = FLASH_MAN_INTEL|curtype;
|
||||
fip->size += BANK_SIZE;
|
||||
osc = fip->sector_count;
|
||||
fip->sector_count += BANK_NBLOCKS;
|
||||
if ((nsc = fip->sector_count) >= CFG_MAX_FLASH_SECT)
|
||||
panic("Too many sectors in flash at address 0x%08lx\n",
|
||||
(unsigned long)base);
|
||||
|
||||
addrb = addr;
|
||||
for (i = osc; i < nsc; i++) {
|
||||
fip->start[i] = (ulong)addrb;
|
||||
fip->protect[i] = 0;
|
||||
addrb = BANK_ADDR_NEXT_BLK(addrb);
|
||||
}
|
||||
|
||||
addr = BANK_ADDR_NEXT_BANK(addr);
|
||||
nbanks++;
|
||||
for (i = 0; i < fip->sector_count; i++) {
|
||||
fip->start[i] = (unsigned long)addr;
|
||||
fip->protect[i] = 0;
|
||||
addr = BANK_ADDR_NEXT_BLK (addr);
|
||||
}
|
||||
|
||||
out:
|
||||
if (nbanks == 0)
|
||||
panic("ERROR: no flash found at address 0x%08lx\n",
|
||||
(unsigned long)base);
|
||||
fip->size = (bank_size_t)addr - (bank_size_t)base;
|
||||
|
||||
/* reset the flash */
|
||||
*base = BANK_CMD_RST;
|
||||
}
|
||||
|
||||
static void
|
||||
bank_reset(flash_info_t *info, int sect)
|
||||
bank_reset (flash_info_t *info, int sect)
|
||||
{
|
||||
bank_addr_t addrw, eaddrw;
|
||||
volatile bank_addr_t addr = (bank_addr_t)info->start[sect];
|
||||
|
||||
addrw = (bank_addr_t)info->start[sect];
|
||||
eaddrw = BANK_ADDR_NEXT_WORD(addrw);
|
||||
|
||||
while (addrw < eaddrw) {
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" writing reset cmd to addr 0x%08lx\n",
|
||||
(unsigned long)addrw);
|
||||
printf ("writing reset cmd to addr 0x%08lx\n", (unsigned long)addr);
|
||||
#endif
|
||||
*addrw = BANK_CMD_RST;
|
||||
addrw++;
|
||||
}
|
||||
|
||||
*addr = BANK_CMD_RST;
|
||||
}
|
||||
|
||||
static void
|
||||
bank_erase_init(flash_info_t *info, int sect)
|
||||
bank_erase_init (flash_info_t *info, int sect)
|
||||
{
|
||||
bank_addr_t addrw, saddrw, eaddrw;
|
||||
volatile bank_addr_t addr = (bank_addr_t)info->start[sect];
|
||||
int flag;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf("0x%08lx BANK_CMD_PROG\n", BANK_CMD_PROG);
|
||||
printf("0x%08lx BANK_CMD_ERASE1\n", BANK_CMD_ERASE1);
|
||||
printf("0x%08lx BANK_CMD_ERASE2\n", BANK_CMD_ERASE2);
|
||||
printf("0x%08lx BANK_CMD_CLR_STAT\n", BANK_CMD_CLR_STAT);
|
||||
printf("0x%08lx BANK_CMD_RST\n", BANK_CMD_RST);
|
||||
printf("0x%08lx BANK_STAT_RDY\n", BANK_STAT_RDY);
|
||||
printf("0x%08lx BANK_STAT_ERR\n", BANK_STAT_ERR);
|
||||
#endif
|
||||
|
||||
saddrw = (bank_addr_t)info->start[sect];
|
||||
eaddrw = BANK_ADDR_NEXT_WORD(saddrw);
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf("erasing sector %d, start addr = 0x%08lx "
|
||||
"(bank next word addr = 0x%08lx)\n", sect,
|
||||
(unsigned long)saddrw, (unsigned long)eaddrw);
|
||||
printf ("erasing sector %d, addr = 0x%08lx\n",
|
||||
sect, (unsigned long)addr);
|
||||
#endif
|
||||
|
||||
/* Disable intrs which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
flag = disable_interrupts ();
|
||||
|
||||
for (addrw = saddrw; addrw < eaddrw; addrw++) {
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" writing erase cmd to addr 0x%08lx\n",
|
||||
(unsigned long)addrw);
|
||||
printf ("writing erase cmd to addr 0x%08lx\n", (unsigned long)addr);
|
||||
#endif
|
||||
*addrw = BANK_CMD_ERASE1;
|
||||
*addrw = BANK_CMD_ERASE2;
|
||||
}
|
||||
*addr = BANK_CMD_ERASE1;
|
||||
*addr = BANK_CMD_ERASE2;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
static int
|
||||
bank_erase_poll(flash_info_t *info, int sect)
|
||||
bank_erase_poll (flash_info_t *info, int sect)
|
||||
{
|
||||
bank_addr_t addrw, saddrw, eaddrw;
|
||||
int sectdone, haderr;
|
||||
|
||||
saddrw = (bank_addr_t)info->start[sect];
|
||||
eaddrw = BANK_ADDR_NEXT_WORD(saddrw);
|
||||
|
||||
sectdone = 1;
|
||||
haderr = 0;
|
||||
|
||||
for (addrw = saddrw; addrw < eaddrw; addrw++) {
|
||||
bank_word_t stat = *addrw;
|
||||
volatile bank_addr_t addr = (bank_addr_t)info->start[sect];
|
||||
bank_word_t stat = *addr;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" checking status at addr "
|
||||
"0x%08lx [0x%08lx]\n",
|
||||
(unsigned long)addrw, stat);
|
||||
printf ("checking status at addr 0x%08lx [0x%08lx]\n",
|
||||
(unsigned long)addr, (unsigned long)stat);
|
||||
#endif
|
||||
if ((stat & BANK_STAT_RDY) != BANK_STAT_RDY)
|
||||
sectdone = 0;
|
||||
else if ((stat & BANK_STAT_ERR) != 0) {
|
||||
printf(" failed on sector %d "
|
||||
"(stat = 0x%08lx) at "
|
||||
"address 0x%08lx\n",
|
||||
sect, stat,
|
||||
(unsigned long)addrw);
|
||||
*addrw = BANK_CMD_CLR_STAT;
|
||||
haderr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (haderr)
|
||||
return (-1);
|
||||
if ((stat & BANK_STAT_RDY) == BANK_STAT_RDY) {
|
||||
if ((stat & BANK_STAT_ERR) != 0) {
|
||||
printf ("failed on sector %d [0x%08lx] at "
|
||||
"address 0x%08lx\n", sect,
|
||||
(unsigned long)stat, (unsigned long)addr);
|
||||
*addr = BANK_CMD_CLR_STAT;
|
||||
return (-1);
|
||||
}
|
||||
else
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
return (sectdone);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
bank_write_word(bank_addr_t addr, bank_word_t value)
|
||||
bank_write_word (volatile bank_addr_t addr, bank_word_t value)
|
||||
{
|
||||
bank_word_t stat;
|
||||
ulong start;
|
||||
int flag, retval;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
flag = disable_interrupts ();
|
||||
|
||||
*addr = BANK_CMD_PROG;
|
||||
|
||||
@@ -271,14 +191,14 @@ bank_write_word(bank_addr_t addr, bank_word_t value)
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
enable_interrupts ();
|
||||
|
||||
retval = 0;
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
do {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
retval = 1;
|
||||
goto done;
|
||||
}
|
||||
@@ -286,8 +206,8 @@ bank_write_word(bank_addr_t addr, bank_word_t value)
|
||||
} while ((stat & BANK_STAT_RDY) != BANK_STAT_RDY);
|
||||
|
||||
if ((stat & BANK_STAT_ERR) != 0) {
|
||||
printf("flash program failed (stat = 0x%08lx) "
|
||||
"at address 0x%08lx\n", (ulong)stat, (ulong)addr);
|
||||
printf ("flash program failed [0x%08lx] at address 0x%08lx\n",
|
||||
(unsigned long)stat, (unsigned long)addr);
|
||||
*addr = BANK_CMD_CLR_STAT;
|
||||
retval = 3;
|
||||
}
|
||||
@@ -303,7 +223,7 @@ done:
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
flash_init(void)
|
||||
flash_init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -312,21 +232,21 @@ flash_init(void)
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
bank_probe(&flash_info[0], (bank_addr_t)CFG_FLASH_BASE);
|
||||
bank_probe (&flash_info[0], (bank_addr_t)CFG_FLASH_BASE);
|
||||
|
||||
/*
|
||||
* protect monitor and environment sectors
|
||||
*/
|
||||
|
||||
#if CFG_MONITOR_BASE == CFG_FLASH_BASE
|
||||
(void)flash_protect(FLAG_PROTECT_SET,
|
||||
(void)flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+monitor_flash_len-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#if defined(CFG_FLASH_ENV_ADDR)
|
||||
(void)flash_protect(FLAG_PROTECT_SET,
|
||||
(void)flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_ENV_ADDR,
|
||||
#if defined(CFG_FLASH_ENV_BUF)
|
||||
CFG_FLASH_ENV_ADDR + CFG_FLASH_ENV_BUF - 1,
|
||||
@@ -339,42 +259,10 @@ flash_init(void)
|
||||
return flash_info[0].size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
#if 0
|
||||
static void
|
||||
flash_get_offsets(ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start adress table */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x0000C000;
|
||||
info->start[3] = base + 0x00010000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00020000) - 0x00060000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
info->start[i--] = base + info->size - 0x0000C000;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00020000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
flash_print_info(flash_info_t *info)
|
||||
flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -391,6 +279,14 @@ flash_print_info(flash_info_t *info)
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F320J5: printf ("28F320J5 (32 Mbit, 2 x 16bit)\n");
|
||||
break;
|
||||
case FLASH_28F640J5: printf ("28F640J5 (64 Mbit, 2 x 16bit)\n");
|
||||
break;
|
||||
case FLASH_28F320J3A: printf ("28F320J3A (32 Mbit, 2 x 16bit)\n");
|
||||
break;
|
||||
case FLASH_28F640J3A: printf ("28F640J3A (64 Mbit, 2 x 16bit)\n");
|
||||
break;
|
||||
case FLASH_28F128J3A: printf ("28F320J3A (128 Mbit, 2 x 16bit)\n");
|
||||
break;
|
||||
default: printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
@@ -411,157 +307,25 @@ flash_print_info(flash_info_t *info)
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
#if 0
|
||||
static ulong
|
||||
flash_get_size(vu_long *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00900090;
|
||||
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
case AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
case AMD_ID_LV400T:
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case AMD_ID_LV400B:
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case AMD_ID_LV800T:
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case AMD_ID_LV800B:
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case AMD_ID_LV160T:
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case AMD_ID_LV160B:
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case AMD_ID_LV320T:
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
case AMD_ID_LV320B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
#endif
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
/* set up sector start adress table */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x0000C000;
|
||||
info->start[3] = base + 0x00010000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00020000) - 0x00060000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
info->start[i--] = base + info->size - 0x0000C000;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00020000;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
addr = (volatile unsigned long *)(info->start[i]);
|
||||
info->protect[i] = addr[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
|
||||
*addr = 0x00F000F0; /* reset bank */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int prot, sect, haderr;
|
||||
ulong start, now, last;
|
||||
int rcode = 0;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf("\nflash_erase: erase %d sectors (%d to %d incl.) from\n"
|
||||
printf ("\nflash_erase: erase %d sectors (%d to %d incl.) from\n"
|
||||
" Bank # %d: ", s_last - s_first + 1, s_first, s_last,
|
||||
(info - flash_info) + 1);
|
||||
flash_print_info(info);
|
||||
flash_print_info (info);
|
||||
#endif
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
@@ -574,14 +338,14 @@ flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf("- Warning: %d protected sector%s will not be erased!\n",
|
||||
printf ("- Warning: %d protected sector%s will not be erased\n",
|
||||
prot, (prot > 1 ? "s" : ""));
|
||||
}
|
||||
|
||||
@@ -594,15 +358,15 @@ flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
ulong estart;
|
||||
int sectdone;
|
||||
|
||||
bank_erase_init(info, sect);
|
||||
bank_erase_init (info, sect);
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
estart = get_timer(start);
|
||||
estart = get_timer (start);
|
||||
|
||||
do {
|
||||
now = get_timer(start);
|
||||
now = get_timer (start);
|
||||
|
||||
if (now - estart > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout (sect %d)\n", sect);
|
||||
@@ -619,7 +383,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
}
|
||||
#endif
|
||||
|
||||
sectdone = bank_erase_poll(info, sect);
|
||||
sectdone = bank_erase_poll (info, sect);
|
||||
|
||||
if (sectdone < 0) {
|
||||
haderr = 1;
|
||||
@@ -642,21 +406,39 @@ flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
/* reset to read mode */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
bank_reset(info, sect);
|
||||
bank_reset (info, sect);
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 3 - Program failed
|
||||
*/
|
||||
static int
|
||||
write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
{
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*(ulong *)dest & data) != data)
|
||||
return (2);
|
||||
|
||||
return (bank_write_word ((bank_addr_t)dest, (bank_word_t)data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 3 - Program failed
|
||||
*/
|
||||
|
||||
int
|
||||
write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
@@ -680,7 +462,7 @@ write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
if ((rc = write_word (info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
@@ -694,7 +476,7 @@ write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
for (i=0; i<4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
if ((rc = write_word (info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
@@ -717,28 +499,7 @@ write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
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)
|
||||
{
|
||||
int retval;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*(ulong *)dest & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
retval = bank_write_word((bank_addr_t)dest, (bank_word_t)data);
|
||||
|
||||
return (retval);
|
||||
return (write_word (info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
|
||||
@@ -1,163 +1,156 @@
|
||||
/*************** DEFINES for Intel StrataFlash FLASH chip ********************/
|
||||
|
||||
/*
|
||||
* acceptable chips types are:
|
||||
* (C) Copyright 2000
|
||||
* Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
|
||||
*
|
||||
* 28F320J5, 28F640J5, 28F320J3A, 28F640J3A and 28F128J3A
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* register addresses, valid only following an CHIP_CMD_RD_ID command */
|
||||
#define CHIP_ADDR_REG_MAN 0x000000 /* manufacturer's id */
|
||||
#define CHIP_ADDR_REG_DEV 0x000001 /* device id */
|
||||
#define CHIP_ADDR_REG_CFGM 0x000003 /* master lock config */
|
||||
#define CHIP_ADDR_REG_CFG(b) (((b)<<16)|2) /* lock config for block b */
|
||||
/*************** DEFINES for Intel StrataFlash FLASH chip ********************/
|
||||
|
||||
/* Commands */
|
||||
#define CHIP_CMD_RST 0xFF /* reset flash */
|
||||
#define CHIP_CMD_RD_ID 0x90 /* read the id and lock bits */
|
||||
#define CHIP_CMD_RD_QUERY 0x98 /* read device capabilities */
|
||||
#define CHIP_CMD_RD_STAT 0x70 /* read the status register */
|
||||
#define CHIP_CMD_CLR_STAT 0x50 /* clear the staus register */
|
||||
#define CHIP_CMD_WR_BUF 0xE8 /* clear the staus register */
|
||||
#define CHIP_CMD_PROG 0x40 /* program word command */
|
||||
#define CHIP_CMD_ERASE1 0x20 /* 1st word for block erase */
|
||||
#define CHIP_CMD_ERASE2 0xD0 /* 2nd word for block erase */
|
||||
#define CHIP_CMD_ERASE_SUSP 0xB0 /* suspend block erase */
|
||||
#define CHIP_CMD_LOCK 0x60 /* 1st word for all lock cmds */
|
||||
#define CHIP_CMD_SET_LOCK_BLK 0x01 /* 2nd wrd set block lock bit */
|
||||
#define CHIP_CMD_SET_LOCK_MSTR 0xF1 /* 2nd wrd set master lck bit */
|
||||
#define CHIP_CMD_CLR_LOCK_BLK 0xD0 /* 2nd wrd clear blk lck bit */
|
||||
#define ISF_CMD_RST 0xFF /* reset flash */
|
||||
#define ISF_CMD_RD_ID 0x90 /* read the id and lock bits */
|
||||
#define ISF_CMD_RD_QUERY 0x98 /* read device capabilities */
|
||||
#define ISF_CMD_RD_STAT 0x70 /* read the status register */
|
||||
#define ISF_CMD_CLR_STAT 0x50 /* clear the staus register */
|
||||
#define ISF_CMD_WR_BUF 0xE8 /* clear the staus register */
|
||||
#define ISF_CMD_PROG 0x40 /* program word command */
|
||||
#define ISF_CMD_ERASE1 0x20 /* 1st word for block erase */
|
||||
#define ISF_CMD_ERASE2 0xD0 /* 2nd word for block erase */
|
||||
#define ISF_CMD_ERASE_SUSP 0xB0 /* suspend block erase */
|
||||
#define ISF_CMD_LOCK 0x60 /* 1st word for all lock cmds */
|
||||
#define ISF_CMD_SET_LOCK_BLK 0x01 /* 2nd wrd set block lock bit */
|
||||
#define ISF_CMD_SET_LOCK_MSTR 0xF1 /* 2nd wrd set master lck bit */
|
||||
#define ISF_CMD_CLR_LOCK_BLK 0xD0 /* 2nd wrd clear blk lck bit */
|
||||
|
||||
/* status register bits */
|
||||
#define CHIP_STAT_DPS 0x02 /* Device Protect Status */
|
||||
#define CHIP_STAT_VPPS 0x08 /* VPP Status */
|
||||
#define CHIP_STAT_PSLBS 0x10 /* Program+Set Lock Bit Stat */
|
||||
#define CHIP_STAT_ECLBS 0x20 /* Erase+Clr Lock Bit Stat */
|
||||
#define CHIP_STAT_ESS 0x40 /* Erase Suspend Status */
|
||||
#define CHIP_STAT_RDY 0x80 /* WSM Mach Status, 1=rdy */
|
||||
#define ISF_STAT_DPS 0x02 /* Device Protect Status */
|
||||
#define ISF_STAT_VPPS 0x08 /* VPP Status */
|
||||
#define ISF_STAT_PSLBS 0x10 /* Program+Set Lock Bit Stat */
|
||||
#define ISF_STAT_ECLBS 0x20 /* Erase+Clr Lock Bit Stat */
|
||||
#define ISF_STAT_ESS 0x40 /* Erase Suspend Status */
|
||||
#define ISF_STAT_RDY 0x80 /* WSM Mach Status, 1=rdy */
|
||||
|
||||
#define CHIP_STAT_ERR (CHIP_STAT_VPPS | CHIP_STAT_DPS | \
|
||||
CHIP_STAT_ECLBS | CHIP_STAT_PSLBS)
|
||||
#define ISF_STAT_ERR (ISF_STAT_VPPS | ISF_STAT_DPS | \
|
||||
ISF_STAT_ECLBS | ISF_STAT_PSLBS)
|
||||
|
||||
/* ID and Lock Configuration */
|
||||
#define CHIP_RD_ID_LOCK 0x01 /* Bit 0 of each byte */
|
||||
#define CHIP_RD_ID_MAN 0x89 /* Manufacturer code = 0x89 */
|
||||
#define CHIP_RD_ID_DEV CFG_FLASH_ID
|
||||
|
||||
/* dimensions */
|
||||
#define CHIP_WIDTH 2 /* chips are in 16 bit mode */
|
||||
#define CHIP_WSHIFT 1 /* (log2 of CHIP_WIDTH) */
|
||||
#define CHIP_NBLOCKS CFG_FLASH_NBLOCKS
|
||||
#define CHIP_BLKSZ (128 * 1024) /* of 128Kbytes each */
|
||||
#define CHIP_SIZE (CHIP_BLKSZ * CHIP_NBLOCKS)
|
||||
/* register addresses, valid only following an ISF_CMD_RD_ID command */
|
||||
#define ISF_REG_MAN_CODE 0x00 /* manufacturer code */
|
||||
#define ISF_REG_DEV_CODE 0x01 /* device code */
|
||||
#define ISF_REG_BLK_LCK 0x02 /* block lock configuration */
|
||||
#define ISF_REG_MST_LCK 0x03 /* master lock configuration */
|
||||
|
||||
/********************** DEFINES for Hymod Flash ******************************/
|
||||
|
||||
/*
|
||||
* The hymod board has 2 x 28F320J5 chips running in
|
||||
* 16 bit mode, for a 32 bit wide bank.
|
||||
* this code requires that the flash on any Hymod board appear as a bank
|
||||
* of two (identical) 16bit Intel StrataFlash chips with 64Kword erase
|
||||
* sectors (or blocks), running in x16 bit mode and connected side-by-side
|
||||
* to make a 32-bit wide bus.
|
||||
*/
|
||||
|
||||
typedef unsigned long bank_word_t; /* 8/16/32/64bit unsigned int */
|
||||
typedef volatile bank_word_t *bank_addr_t;
|
||||
typedef unsigned long bank_size_t; /* want this big - >= 32 bit */
|
||||
typedef unsigned long bank_word_t;
|
||||
typedef bank_word_t bank_blk_t[64 * 1024];
|
||||
|
||||
#define BANK_CHIP_WIDTH 2 /* each bank is 2 chips wide */
|
||||
#define BANK_CHIP_WSHIFT 1 /* (log2 of BANK_CHIP_WIDTH) */
|
||||
#define BANK_FILL_WORD(b) (((bank_word_t)(b) << 16) | (bank_word_t)(b))
|
||||
|
||||
#define BANK_WIDTH (CHIP_WIDTH * BANK_CHIP_WIDTH)
|
||||
#define BANK_WSHIFT (CHIP_WSHIFT + BANK_CHIP_WSHIFT)
|
||||
#define BANK_NBLOCKS CHIP_NBLOCKS
|
||||
#define BANK_BLKSZ (CHIP_BLKSZ * BANK_CHIP_WIDTH)
|
||||
#define BANK_SIZE (CHIP_SIZE * BANK_CHIP_WIDTH)
|
||||
#ifdef EXAMPLE
|
||||
|
||||
#define MAX_BANKS 1 /* only one bank possible */
|
||||
/* theoretically the following examples should also work */
|
||||
|
||||
/* one flash chip in x8 mode with 128Kword sectors and 8bit bus */
|
||||
typedef unsigned char bank_word_t;
|
||||
typedef bank_word_t bank_blk_t[128 * 1024];
|
||||
#define BANK_FILL_WORD(b) ((bank_word_t)(b))
|
||||
|
||||
/* four flash chips in x16 mode with 32Kword sectors and 64bit bus */
|
||||
typedef unsigned long long bank_word_t;
|
||||
typedef bank_word_t bank_blk_t[32 * 1024];
|
||||
#define BANK_FILL_WORD(b) ( \
|
||||
((bank_word_t)(b) << 48) \
|
||||
((bank_word_t)(b) << 32) \
|
||||
((bank_word_t)(b) << 16) \
|
||||
((bank_word_t)(b) << 0) \
|
||||
)
|
||||
|
||||
#endif /* EXAMPLE */
|
||||
|
||||
/* the sizes of these two types should probably be the same */
|
||||
typedef bank_word_t *bank_addr_t;
|
||||
typedef unsigned long bank_size_t;
|
||||
|
||||
/* align bank addresses and sizes to bank word boundaries */
|
||||
#define BANK_ADDR_WORD_ALIGN(a) ((bank_addr_t)((bank_size_t)(a) \
|
||||
& ~(BANK_WIDTH - 1)))
|
||||
#define BANK_SIZE_WORD_ALIGN(s) ((bank_size_t)BANK_ADDR_WORD_ALIGN( \
|
||||
(bank_size_t)(s) + (BANK_WIDTH - 1)))
|
||||
& ~(sizeof (bank_word_t) - 1)))
|
||||
#define BANK_SIZE_WORD_ALIGN(s) (((bank_size_t)(s) + sizeof (bank_word_t) - 1) \
|
||||
& ~(sizeof (bank_word_t) - 1))
|
||||
|
||||
/* align bank addresses and sizes to bank block boundaries */
|
||||
#define BANK_ADDR_BLK_ALIGN(a) ((bank_addr_t)((bank_size_t)(a) \
|
||||
& ~(BANK_BLKSZ - 1)))
|
||||
#define BANK_SIZE_BLK_ALIGN(s) ((bank_size_t)BANK_ADDR_BLK_ALIGN( \
|
||||
(bank_size_t)(s) + (BANK_BLKSZ - 1)))
|
||||
|
||||
/* align bank addresses and sizes to bank boundaries */
|
||||
#define BANK_ADDR_BANK_ALIGN(a) ((bank_addr_t)((bank_size_t)(a) \
|
||||
& ~(BANK_SIZE - 1)))
|
||||
#define BANK_SIZE_BANK_ALIGN(s) ((bank_size_t)BANK_ADDR_BANK_ALIGN( \
|
||||
(bank_size_t)(s) + (BANK_SIZE - 1)))
|
||||
& ~(sizeof (bank_blk_t) - 1)))
|
||||
#define BANK_SIZE_BLK_ALIGN(s) (((bank_size_t)(s) + sizeof (bank_blk_t) - 1) \
|
||||
& ~(sizeof (bank_blk_t) - 1))
|
||||
|
||||
/* add an offset to a bank address */
|
||||
#define BANK_ADDR_OFFSET(a, o) (bank_addr_t)((bank_size_t)(a) + \
|
||||
(bank_size_t)(o))
|
||||
|
||||
/* get base address of bank b, given flash base address a */
|
||||
#define BANK_ADDR_BASE(a, b) BANK_ADDR_OFFSET(BANK_ADDR_BANK_ALIGN(a), \
|
||||
(bank_size_t)(b) * BANK_SIZE)
|
||||
#define BANK_ADDR_OFFSET(a, o) ((bank_addr_t)((bank_size_t)(a) + \
|
||||
(bank_size_t)(o)))
|
||||
|
||||
/* adjust a bank address to start of next word, block or bank */
|
||||
#define BANK_ADDR_NEXT_WORD(a) BANK_ADDR_OFFSET(BANK_ADDR_WORD_ALIGN(a), \
|
||||
BANK_WIDTH)
|
||||
sizeof (bank_word_t))
|
||||
#define BANK_ADDR_NEXT_BLK(a) BANK_ADDR_OFFSET(BANK_ADDR_BLK_ALIGN(a), \
|
||||
BANK_BLKSZ)
|
||||
#define BANK_ADDR_NEXT_BANK(a) BANK_ADDR_OFFSET(BANK_ADDR_BANK_ALIGN(a), \
|
||||
BANK_SIZE)
|
||||
sizeof (bank_blk_t))
|
||||
|
||||
/* get bank address of chip register r given a bank base address a */
|
||||
#define BANK_ADDR_REG(a, r) BANK_ADDR_OFFSET(BANK_ADDR_BANK_ALIGN(a), \
|
||||
((bank_size_t)(r) << BANK_WSHIFT))
|
||||
/* get bank address of register r given a bank base address a and block num b */
|
||||
#define BANK_ADDR_REG(a, b, r) BANK_ADDR_OFFSET(BANK_ADDR_OFFSET((a), \
|
||||
(bank_size_t)(b) * sizeof (bank_blk_t)), \
|
||||
(bank_size_t)(r) * sizeof (bank_word_t))
|
||||
|
||||
/* make a bank address for each chip register address */
|
||||
|
||||
#define BANK_ADDR_REG_MAN(a) BANK_ADDR_REG((a), CHIP_ADDR_REG_MAN)
|
||||
#define BANK_ADDR_REG_DEV(a) BANK_ADDR_REG((a), CHIP_ADDR_REG_DEV)
|
||||
#define BANK_ADDR_REG_CFGM(a) BANK_ADDR_REG((a), CHIP_ADDR_REG_CFGM)
|
||||
#define BANK_ADDR_REG_CFG(b,a) BANK_ADDR_REG((a), CHIP_ADDR_REG_CFG(b))
|
||||
|
||||
/*
|
||||
* replicate a chip cmd/stat/rd value into each byte position within a word
|
||||
* so that multiple chips are accessed in a single word i/o operation
|
||||
*
|
||||
* this must be as wide as the bank_word_t type, and take into account the
|
||||
* chip width and bank layout
|
||||
*/
|
||||
|
||||
#define BANK_FILL_WORD(o) ((bank_word_t)( \
|
||||
((unsigned long)(o) << 16) | \
|
||||
((unsigned long)(o) << 0) \
|
||||
))
|
||||
|
||||
/* make a bank word value for each chip cmd/stat/rd value */
|
||||
/* make a bank word value for each StrataFlash value */
|
||||
|
||||
/* Commands */
|
||||
#define BANK_CMD_RST BANK_FILL_WORD(CHIP_CMD_RST)
|
||||
#define BANK_CMD_RD_ID BANK_FILL_WORD(CHIP_CMD_RD_ID)
|
||||
#define BANK_CMD_RD_STAT BANK_FILL_WORD(CHIP_CMD_RD_STAT)
|
||||
#define BANK_CMD_CLR_STAT BANK_FILL_WORD(CHIP_CMD_CLR_STAT)
|
||||
#define BANK_CMD_ERASE1 BANK_FILL_WORD(CHIP_CMD_ERASE1)
|
||||
#define BANK_CMD_ERASE2 BANK_FILL_WORD(CHIP_CMD_ERASE2)
|
||||
#define BANK_CMD_PROG BANK_FILL_WORD(CHIP_CMD_PROG)
|
||||
#define BANK_CMD_LOCK BANK_FILL_WORD(CHIP_CMD_LOCK)
|
||||
#define BANK_CMD_SET_LOCK_BLK BANK_FILL_WORD(CHIP_CMD_SET_LOCK_BLK)
|
||||
#define BANK_CMD_SET_LOCK_MSTR BANK_FILL_WORD(CHIP_CMD_SET_LOCK_MSTR)
|
||||
#define BANK_CMD_CLR_LOCK_BLK BANK_FILL_WORD(CHIP_CMD_CLR_LOCK_BLK)
|
||||
#define BANK_CMD_RST BANK_FILL_WORD(ISF_CMD_RST)
|
||||
#define BANK_CMD_RD_ID BANK_FILL_WORD(ISF_CMD_RD_ID)
|
||||
#define BANK_CMD_RD_STAT BANK_FILL_WORD(ISF_CMD_RD_STAT)
|
||||
#define BANK_CMD_CLR_STAT BANK_FILL_WORD(ISF_CMD_CLR_STAT)
|
||||
#define BANK_CMD_ERASE1 BANK_FILL_WORD(ISF_CMD_ERASE1)
|
||||
#define BANK_CMD_ERASE2 BANK_FILL_WORD(ISF_CMD_ERASE2)
|
||||
#define BANK_CMD_PROG BANK_FILL_WORD(ISF_CMD_PROG)
|
||||
#define BANK_CMD_LOCK BANK_FILL_WORD(ISF_CMD_LOCK)
|
||||
#define BANK_CMD_SET_LOCK_BLK BANK_FILL_WORD(ISF_CMD_SET_LOCK_BLK)
|
||||
#define BANK_CMD_SET_LOCK_MSTR BANK_FILL_WORD(ISF_CMD_SET_LOCK_MSTR)
|
||||
#define BANK_CMD_CLR_LOCK_BLK BANK_FILL_WORD(ISF_CMD_CLR_LOCK_BLK)
|
||||
|
||||
/* status register bits */
|
||||
#define BANK_STAT_DPS BANK_FILL_WORD(CHIP_STAT_DPS)
|
||||
#define BANK_STAT_PSS BANK_FILL_WORD(CHIP_STAT_PSS)
|
||||
#define BANK_STAT_VPPS BANK_FILL_WORD(CHIP_STAT_VPPS)
|
||||
#define BANK_STAT_PSLBS BANK_FILL_WORD(CHIP_STAT_PSLBS)
|
||||
#define BANK_STAT_ECLBS BANK_FILL_WORD(CHIP_STAT_ECLBS)
|
||||
#define BANK_STAT_ESS BANK_FILL_WORD(CHIP_STAT_ESS)
|
||||
#define BANK_STAT_RDY BANK_FILL_WORD(CHIP_STAT_RDY)
|
||||
#define BANK_STAT_DPS BANK_FILL_WORD(ISF_STAT_DPS)
|
||||
#define BANK_STAT_PSS BANK_FILL_WORD(ISF_STAT_PSS)
|
||||
#define BANK_STAT_VPPS BANK_FILL_WORD(ISF_STAT_VPPS)
|
||||
#define BANK_STAT_PSLBS BANK_FILL_WORD(ISF_STAT_PSLBS)
|
||||
#define BANK_STAT_ECLBS BANK_FILL_WORD(ISF_STAT_ECLBS)
|
||||
#define BANK_STAT_ESS BANK_FILL_WORD(ISF_STAT_ESS)
|
||||
#define BANK_STAT_RDY BANK_FILL_WORD(ISF_STAT_RDY)
|
||||
|
||||
#define BANK_STAT_ERR BANK_FILL_WORD(CHIP_STAT_ERR)
|
||||
#define BANK_STAT_ERR BANK_FILL_WORD(ISF_STAT_ERR)
|
||||
|
||||
/* ID and Lock Configuration */
|
||||
#define BANK_RD_ID_LOCK BANK_FILL_WORD(CHIP_RD_ID_LOCK)
|
||||
#define BANK_RD_ID_MAN BANK_FILL_WORD(CHIP_RD_ID_MAN)
|
||||
#define BANK_RD_ID_DEV BANK_FILL_WORD(CHIP_RD_ID_DEV)
|
||||
/* make a bank register address for each StrataFlash register address */
|
||||
|
||||
#define BANK_REG_MAN_CODE(a) BANK_ADDR_REG((a), 0, ISF_REG_MAN_CODE)
|
||||
#define BANK_REG_DEV_CODE(a) BANK_ADDR_REG((a), 0, ISF_REG_DEV_CODE)
|
||||
#define BANK_REG_BLK_LCK(a, b) BANK_ADDR_REG((a), (b), ISF_REG_BLK_LCK)
|
||||
#define BANK_REG_MST_LCK(a) BANK_ADDR_REG((a), 0, ISF_REG_MST_LCK)
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
# DONT FORGET TO CHANGE THE "version" VAR BELOW IF YOU MAKE CHANGES TO THIS FILE
|
||||
|
||||
# (C) Copyright 2001
|
||||
# Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# global_env
|
||||
#
|
||||
# file used by Hymod boards to initialise the u-boot non-volatile
|
||||
# environment when u-boot is first run (it determines this by the
|
||||
# absence of the environment variable "global_env_loaded")
|
||||
#
|
||||
# format of this file is:
|
||||
#
|
||||
# 1. blank lines and lines beginning with '#' are ignored
|
||||
@@ -7,32 +37,94 @@
|
||||
# %s serial number of the main board (10 digit zero filled)
|
||||
# %S serial number of the main board (plain number)
|
||||
# %% a percentage character
|
||||
#
|
||||
# no whitespace is removed in either <name> or <value>
|
||||
# ... otherwise the %x is discarded
|
||||
#
|
||||
# if first character in <name> is a dash ('-'), then an existing env var
|
||||
# will not be overwritten (the dash is removed).
|
||||
# will not be overwritten (the dash is removed). i.e. it is only set if
|
||||
# it does not exist
|
||||
#
|
||||
# if last character in <name> is a plus ('+'), then <value> will be appended
|
||||
# to any existing env var (the plus is removed). Duplicates of <value> are
|
||||
# to any existing env var (the plus is ignored). Duplicates of <value> are
|
||||
# removed.
|
||||
#
|
||||
# similarly, if the last character in <name> is a minus ('-'), then any
|
||||
# occurences of <value> in the current value of <name> will removed (the
|
||||
# minus is ignored).
|
||||
#
|
||||
# leading and trailing whitespace is removed in both <name> and <value>
|
||||
# (after processing any initial or final plus/minus in <name>).
|
||||
#
|
||||
|
||||
# MISCELLANEOUS PARAMETERS
|
||||
|
||||
# version must always come first
|
||||
version=4
|
||||
|
||||
# set the ip address based on the main board serial number
|
||||
ipaddr=192.168.1.%S
|
||||
serverip=192.168.1.254
|
||||
|
||||
# stop auto execute after tftp
|
||||
# stop auto execute after tftp (not a very good name really)
|
||||
autostart=no
|
||||
|
||||
# setting this to "yes" forces the global_env file to be loaded and processed
|
||||
# if the current version is different to the version in the file
|
||||
always_check_env=no
|
||||
|
||||
# BOOTING COMMANDS AND PARAMETERS
|
||||
|
||||
# command to run when "auto-booting"
|
||||
bootcmd=bootm 40080000
|
||||
|
||||
# how long the "countdown" to automatically running "bootcmd" is
|
||||
bootdelay=2
|
||||
|
||||
# how long before it "times out" console input and attempts to run "bootcmd"
|
||||
bootretry=5
|
||||
|
||||
# arguments passed to the boot program (i.e. linux kernel) via register 6
|
||||
# the linux kernel (v2.4) uses the following registers:
|
||||
# r3 - address of board information structure
|
||||
# r4 - address of initial ramdisk image (0 means no initrd)
|
||||
# r5 - size of initial ramdisk image
|
||||
# r6 - address of command line string
|
||||
-bootargs=root=/dev/mtdblock5 rootfstype=squashfs ro
|
||||
|
||||
# these four are for hymod linux integrated into our Sun network
|
||||
bootargs+=serialno=%S
|
||||
bootargs+=nisclient nisdomain=mlb.dmt.csiro.au nissrvadr=138.194.112.4
|
||||
bootargs+=nfsclient
|
||||
bootargs+=automount
|
||||
|
||||
# start a web server by default
|
||||
bootargs+=webserver
|
||||
|
||||
# give negotiation time to finish
|
||||
bootargs+=netsleep=5
|
||||
|
||||
# then our ciscos don't pass packets for 25-30 secs after that, so
|
||||
# pinging the server until it responds prevents network connections
|
||||
# from failing...
|
||||
bootargs+=netping
|
||||
|
||||
# these are old bootargs - we don't need them anymore
|
||||
bootargs-=preload=unix,i2c-cpm,i2c-dev
|
||||
bootargs-=ramdisk_size=32768
|
||||
bootargs-=ramdisk_size=24576
|
||||
|
||||
# FLASH MANIPULATION COMMANDS
|
||||
|
||||
#
|
||||
# 16M flash map, 64 x 256K sectors, mapped at address 0x40000000
|
||||
# 16M flash, 64 x 256K sectors, mapped at address 0x40000000
|
||||
#
|
||||
# sector 0: boot
|
||||
# sector 1: non volatile environment
|
||||
# sectors 2-4: linux kernel image
|
||||
# sectors 5-7: alternate linux kernel image
|
||||
# sectors 8-63: linux initial ramdisk image
|
||||
# Sector(s) Address Size Description
|
||||
#
|
||||
# 0 - 0 0x40000000 256K boot code
|
||||
# 1 - 1 0x40040000 256K non volatile environment
|
||||
# 2 - 4 0x40080000 768K linux kernel image
|
||||
# 5 - 7 0x40140000 768K alternate linux kernel image
|
||||
# 8 - 47 0x40200000 10M linux initial ramdisk image
|
||||
# 48 - 63 0x40c00000 4M ramdisk image for applications
|
||||
#
|
||||
|
||||
fetchboot=tftp 100000 /hymod/u-boot.bin
|
||||
@@ -49,21 +141,21 @@ newlinux=run fetchlinux eraselinux copylinux cmplinux
|
||||
|
||||
fetchaltlinux=tftp 100000 /hymod/altlinux.bin
|
||||
erasealtlinux=erase 1:5-7
|
||||
copyaltlinux=cp.b 100000 40080000 $(filesize)
|
||||
cmpaltlinux=cmp.b 100000 40080000 $(filesize)
|
||||
copyaltlinux=cp.b 100000 40140000 $(filesize)
|
||||
cmpaltlinux=cmp.b 100000 40140000 $(filesize)
|
||||
newaltlinux=run fetchaltlinux erasealtlinux copyaltlinux cmpaltlinux
|
||||
|
||||
fetchird=tftp 100000 /hymod/initrd.bin
|
||||
eraseird=erase 1:8-63
|
||||
copyird=cp.b 100000 40200000 $(filesize)
|
||||
cmpird=cmp.b 100000 40200000 $(filesize)
|
||||
newinitrd=run fetchird eraseird copyird cmpird
|
||||
fetchroot=tftp 100000 /hymod/root.bin
|
||||
eraseroot=erase 1:8-47
|
||||
copyroot=cp.b 100000 40200000 $(filesize)
|
||||
cmproot=cmp.b 100000 40200000 $(filesize)
|
||||
newroot=run fetchroot eraseroot copyroot cmproot
|
||||
|
||||
bootcmd=bootm 40080000 40200000
|
||||
-bootargs=root=/dev/ram rw
|
||||
# these are for hymod linux
|
||||
bootargs+=preload=unix,i2c-cpm,i2c-dev
|
||||
bootargs+=serialno=%S
|
||||
bootargs+=ramdisk_size=32768
|
||||
bootargs+=automount nisclient nisdomain=mlb.dmt.csiro.au nissrvadr=138.194.112.4
|
||||
bootdelay=2
|
||||
fetchard=tftp 100000 /hymod/apprd.bin
|
||||
eraseard=erase 1:48-63
|
||||
copyard=cp.b 100000 40c00000 $(filesize)
|
||||
cmpard=cmp.b 100000 40c00000 $(filesize)
|
||||
newapprd=run fetchard eraseard copyard cmpard
|
||||
|
||||
# pass above map to linux mtd driver
|
||||
bootargs+=mtdparts=phys:256k(u-boot),256k(u-boot-env),768k(linux),768k(altlinux),10m(root),4m(hymod)
|
||||
|
||||
@@ -20,11 +20,12 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Hacked for the Hymod board by Murray.Jensen@cmst.csiro.au, 20-Oct-00
|
||||
* Hacked for the Hymod board by Murray.Jensen@csiro.au, 20-Oct-00
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8260.h>
|
||||
#include <mpc8260_irq.h>
|
||||
#include <ioports.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/iopin_8260.h>
|
||||
@@ -32,15 +33,11 @@
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* imports from eeprom.c */
|
||||
extern int eeprom_load (unsigned, hymod_eeprom_t *);
|
||||
extern int eeprom_fetch (unsigned, char *, ulong);
|
||||
extern void eeprom_print (hymod_eeprom_t *);
|
||||
extern int hymod_eeprom_read (int, hymod_eeprom_t *);
|
||||
extern void hymod_eeprom_print (hymod_eeprom_t *);
|
||||
|
||||
/* imports from fetch.c */
|
||||
extern int fetch_and_parse (char *, ulong, int (*)(uchar *, uchar *));
|
||||
|
||||
/* imports from common/main.c */
|
||||
extern char console_buffer[CFG_CBSIZE];
|
||||
/* imports from env.c */
|
||||
extern void hymod_check_env (void);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -54,274 +51,152 @@ extern char console_buffer[CFG_CBSIZE];
|
||||
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 MII COL */
|
||||
/* PA30 */ {1, 1, 1, 0, 0, 0},
|
||||
/* FCC1 MII CRS */
|
||||
/* PA29 */ {1, 1, 1, 1, 0, 0},
|
||||
/* FCC1 MII TX_ER */
|
||||
/* PA28 */ {1, 1, 1, 1, 0, 0},
|
||||
/* FCC1 MII TX_EN */
|
||||
/* PA27 */ {1, 1, 1, 0, 0, 0},
|
||||
/* FCC1 MII RX_DV */
|
||||
/* PA26 */ {1, 1, 1, 0, 0, 0},
|
||||
/* FCC1 MII RX_ER */
|
||||
/* PA25 */ {1, 0, 0, 1, 0, 0},
|
||||
/* FCC2 MII MDIO */
|
||||
/* PA24 */ {1, 0, 0, 1, 0, 0},
|
||||
/* FCC2 MII MDC */
|
||||
/* PA23 */ {1, 0, 0, 1, 0, 0},
|
||||
/* FCC3 MII MDIO */
|
||||
/* PA22 */ {1, 0, 0, 1, 0, 0},
|
||||
/* FCC3 MII MDC */
|
||||
/* PA21 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC1 MII TxD[3] */
|
||||
/* PA20 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC1 MII TxD[2] */
|
||||
/* PA19 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC1 MII TxD[1] */
|
||||
/* PA18 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC1 MII TxD[0] */
|
||||
/* PA17 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC1 MII RxD[3] */
|
||||
/* PA16 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC1 MII RxD[2] */
|
||||
/* PA15 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC1 MII RxD[1] */
|
||||
/* PA14 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC1 MII RxD[0] */
|
||||
/* PA13 */ {1, 0, 0, 1, 0, 0},
|
||||
/* FCC1 MII MDIO */
|
||||
/* PA12 */ {1, 0, 0, 1, 0, 0},
|
||||
/* FCC1 MII MDC */
|
||||
/* PA11 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SEL_CD */
|
||||
/* PA10 */ {1, 0, 0, 0, 0, 0},
|
||||
/* FLASH STS1 */
|
||||
/* PA9 */ {1, 0, 0, 0, 0, 0},
|
||||
/* FLASH STS0 */
|
||||
/* PA8 */ {1, 0, 0, 0, 0, 0},
|
||||
/* FLASH ~PE */
|
||||
/* PA7 */ {1, 0, 0, 0, 0, 0},
|
||||
/* WATCH ~HRESET */
|
||||
/* PA6 */ {1, 0, 0, 0, 1, 0},
|
||||
/* VC DONE */
|
||||
/* PA5 */ {1, 0, 0, 1, 1, 0},
|
||||
/* VC INIT */
|
||||
/* PA4 */ {1, 0, 0, 1, 0, 0},
|
||||
/* VC ~PROG */
|
||||
/* PA3 */ {1, 0, 0, 1, 0, 0},
|
||||
/* VM ENABLE */
|
||||
/* PA2 */ {1, 0, 0, 0, 1, 0},
|
||||
/* VM DONE */
|
||||
/* PA1 */ {1, 0, 0, 1, 1, 0},
|
||||
/* VM INIT */
|
||||
/* PA0 */ {1, 0, 0, 1, 0, 0}
|
||||
/* VM ~PROG */
|
||||
},
|
||||
{
|
||||
/* cnf par sor dir odr dat */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PA31: FCC1 MII COL */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PA30: FCC1 MII CRS */
|
||||
{ 1, 1, 1, 1, 0, 0 }, /* PA29: FCC1 MII TX_ER */
|
||||
{ 1, 1, 1, 1, 0, 0 }, /* PA28: FCC1 MII TX_EN */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PA27: FCC1 MII RX_DV */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PA26: FCC1 MII RX_ER */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA25: FCC2 MII MDIO */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA24: FCC2 MII MDC */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA23: FCC3 MII MDIO */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA22: FCC3 MII MDC */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PA21: FCC1 MII TxD[3] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PA20: FCC1 MII TxD[2] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PA19: FCC1 MII TxD[1] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PA18: FCC1 MII TxD[0] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PA17: FCC1 MII RxD[3] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PA16: FCC1 MII RxD[2] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PA15: FCC1 MII RxD[1] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PA14: FCC1 MII RxD[0] */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA13: FCC1 MII MDIO */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA12: FCC1 MII MDC */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA11: SEL_CD */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PA10: FLASH STS1 */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PA09: FLASH STS0 */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PA08: FLASH ~PE */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PA07: WATCH ~HRESET */
|
||||
{ 1, 0, 0, 0, 1, 0 }, /* PA06: VC DONE */
|
||||
{ 1, 0, 0, 1, 1, 0 }, /* PA05: VC INIT */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA04: VC ~PROG */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PA03: VM ENABLE */
|
||||
{ 1, 0, 0, 0, 1, 0 }, /* PA02: VM DONE */
|
||||
{ 1, 0, 0, 1, 1, 0 }, /* PA01: VM INIT */
|
||||
{ 1, 0, 0, 1, 0, 0 } /* PA00: VM ~PROG */
|
||||
},
|
||||
|
||||
/* Port B configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC2 MII TX_ER */
|
||||
/* PB30 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RX_DV */
|
||||
/* PB29 */ {1, 1, 1, 1, 0, 0},
|
||||
/* FCC2 MII TX_EN */
|
||||
/* PB28 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RX_ER */
|
||||
/* PB27 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII COL */
|
||||
/* PB26 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII CRS */
|
||||
/* PB25 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC2 MII TxD[3] */
|
||||
/* PB24 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC2 MII TxD[2] */
|
||||
/* PB23 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC2 MII TxD[1] */
|
||||
/* PB22 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC2 MII TxD[0] */
|
||||
/* PB21 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RxD[0] */
|
||||
/* PB20 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RxD[1] */
|
||||
/* PB19 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RxD[2] */
|
||||
/* PB18 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RxD[3] */
|
||||
/* PB17 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RX_DV */
|
||||
/* PB16 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RX_ER */
|
||||
/* PB15 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC3 MII TX_ER */
|
||||
/* PB14 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC3 MII TX_EN */
|
||||
/* PB13 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII COL */
|
||||
/* PB12 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII CRS */
|
||||
/* PB11 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RxD[3] */
|
||||
/* PB10 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RxD[2] */
|
||||
/* PB9 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RxD[1] */
|
||||
/* PB8 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RxD[0] */
|
||||
/* PB7 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC3 MII TxD[3] */
|
||||
/* PB6 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC3 MII TxD[2] */
|
||||
/* PB5 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC3 MII TxD[1] */
|
||||
/* PB4 */ {1, 1, 0, 1, 0, 0},
|
||||
/* FCC3 MII TxD[0] */
|
||||
/* 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 */
|
||||
},
|
||||
{
|
||||
/* cnf par sor dir odr dat */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB31: FCC2 MII TX_ER */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB30: FCC2 MII RX_DV */
|
||||
{ 1, 1, 1, 1, 0, 0 }, /* PB29: FCC2 MII TX_EN */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB28: FCC2 MII RX_ER */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB27: FCC2 MII COL */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB26: FCC2 MII CRS */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB25: FCC2 MII TxD[3] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB24: FCC2 MII TxD[2] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB23: FCC2 MII TxD[1] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB22: FCC2 MII TxD[0] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB21: FCC2 MII RxD[0] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB20: FCC2 MII RxD[1] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB19: FCC2 MII RxD[2] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB18: FCC2 MII RxD[3] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB17: FCC3 MII RX_DV */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB16: FCC3 MII RX_ER */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB15: FCC3 MII TX_ER */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB14: FCC3 MII TX_EN */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB13: FCC3 MII COL */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB12: FCC3 MII CRS */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB11: FCC3 MII RxD[3] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB10: FCC3 MII RxD[2] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB09: FCC3 MII RxD[1] */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PB08: FCC3 MII RxD[0] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB07: FCC3 MII TxD[3] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB06: FCC3 MII TxD[2] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB05: FCC3 MII TxD[1] */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PB04: FCC3 MII TxD[0] */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PB03: pin doesn't exist */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PB02: pin doesn't exist */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PB01: pin doesn't exist */
|
||||
{ 0, 0, 0, 0, 0, 0 } /* PB00: pin doesn't exist */
|
||||
},
|
||||
|
||||
/* Port C */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ {1, 0, 0, 0, 0, 0},
|
||||
/* MEZ ~IACK */
|
||||
/* PC30 */ {0, 0, 0, 0, 0, 0},
|
||||
/* PC29 */ {1, 1, 0, 0, 0, 0},
|
||||
/* CLK SCCx */
|
||||
/* PC28 */ {1, 1, 0, 0, 0, 0},
|
||||
/* CLK4 */
|
||||
/* PC27 */ {1, 1, 0, 0, 0, 0},
|
||||
/* CLK SCCF */
|
||||
/* PC26 */ {1, 1, 0, 0, 0, 0},
|
||||
/* CLK 32K */
|
||||
/* PC25 */ {1, 1, 0, 0, 0, 0},
|
||||
/* BRG4/CLK7 */
|
||||
/* PC24 */ {0, 0, 0, 0, 0, 0},
|
||||
/* PC23 */ {1, 1, 0, 0, 0, 0},
|
||||
/* CLK SCCx */
|
||||
/* PC22 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC1 MII RX_CLK */
|
||||
/* PC21 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC1 MII TX_CLK */
|
||||
/* PC20 */ {1, 1, 0, 0, 0, 0},
|
||||
/* CLK SCCF */
|
||||
/* PC19 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII RX_CLK */
|
||||
/* PC18 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC2 MII TX_CLK */
|
||||
/* PC17 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII RX_CLK */
|
||||
/* PC16 */ {1, 1, 0, 0, 0, 0},
|
||||
/* FCC3 MII TX_CLK */
|
||||
/* PC15 */ {1, 0, 0, 0, 0, 0},
|
||||
/* SCC1 UART ~CTS */
|
||||
/* PC14 */ {1, 0, 0, 0, 0, 0},
|
||||
/* SCC1 UART ~CD */
|
||||
/* PC13 */ {1, 0, 0, 0, 0, 0},
|
||||
/* SCC2 UART ~CTS */
|
||||
/* PC12 */ {1, 0, 0, 0, 0, 0},
|
||||
/* SCC2 UART ~CD */
|
||||
/* PC11 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SCC1 UART ~DTR */
|
||||
/* PC10 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SCC1 UART ~DSR */
|
||||
/* PC9 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SCC2 UART ~DTR */
|
||||
/* PC8 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SCC2 UART ~DSR */
|
||||
/* PC7 */ {1, 0, 0, 0, 0, 0},
|
||||
/* TEMP ~ALERT */
|
||||
/* PC6 */ {1, 0, 0, 0, 0, 0},
|
||||
/* FCC3 INT */
|
||||
/* PC5 */ {1, 0, 0, 0, 0, 0},
|
||||
/* FCC2 INT */
|
||||
/* PC4 */ {1, 0, 0, 0, 0, 0},
|
||||
/* FCC1 INT */
|
||||
/* PC3 */ {1, 1, 1, 1, 0, 0},
|
||||
/* SDMA IDMA2 ~DACK */
|
||||
/* PC2 */ {1, 1, 1, 0, 0, 0},
|
||||
/* SDMA IDMA2 ~DONE */
|
||||
/* PC1 */ {1, 1, 0, 0, 0, 0},
|
||||
/* SDMA IDMA2 ~DREQ */
|
||||
/* PC0 */ {1, 1, 0, 1, 0, 0}
|
||||
/* BRG7 */
|
||||
},
|
||||
/* Port C configuration */
|
||||
{
|
||||
/* cnf par sor dir odr dat */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC31: MEZ ~IACK */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PC30: ? */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC29: CLK SCCx */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC28: CLK4 */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC27: CLK SCCF */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC26: CLK 32K */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC25: BRG4/CLK7 */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PC24: ? */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC23: CLK SCCx */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC22: FCC1 MII RX_CLK */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC21: FCC1 MII TX_CLK */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC20: CLK SCCF */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC19: FCC2 MII RX_CLK */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC18: FCC2 MII TX_CLK */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC17: FCC3 MII RX_CLK */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PC16: FCC3 MII TX_CLK */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC15: SCC1 UART ~CTS */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC14: SCC1 UART ~CD */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC13: SCC2 UART ~CTS */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC12: SCC2 UART ~CD */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PC11: SCC1 UART ~DTR */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PC10: SCC1 UART ~DSR */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PC09: SCC2 UART ~DTR */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PC08: SCC2 UART ~DSR */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC07: TEMP ~ALERT */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC06: FCC3 INT */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC05: FCC2 INT */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PC04: FCC1 INT */
|
||||
{ 0, 1, 1, 1, 0, 0 }, /* PC03: SDMA IDMA2 ~DACK */
|
||||
{ 0, 1, 1, 0, 0, 0 }, /* PC02: SDMA IDMA2 ~DONE */
|
||||
{ 0, 1, 0, 0, 0, 0 }, /* PC01: SDMA IDMA2 ~DREQ */
|
||||
{ 1, 1, 0, 1, 0, 0 } /* PC00: BRG7 */
|
||||
},
|
||||
|
||||
/* Port D */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ {1, 1, 0, 0, 0, 0},
|
||||
/* SCC1 UART RxD */
|
||||
/* PD30 */ {1, 1, 1, 1, 0, 0},
|
||||
/* SCC1 UART TxD */
|
||||
/* PD29 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SCC1 UART ~RTS */
|
||||
/* PD28 */ {1, 1, 0, 0, 0, 0},
|
||||
/* SCC2 UART RxD */
|
||||
/* PD27 */ {1, 1, 0, 1, 0, 0},
|
||||
/* SCC2 UART TxD */
|
||||
/* PD26 */ {1, 0, 0, 1, 0, 0},
|
||||
/* SCC2 UART ~RTS */
|
||||
/* PD25 */ {1, 0, 0, 0, 0, 0},
|
||||
/* SCC1 UART ~RI */
|
||||
/* PD24 */ {1, 0, 0, 0, 0, 0},
|
||||
/* SCC2 UART ~RI */
|
||||
/* PD23 */ {1, 0, 0, 1, 0, 0},
|
||||
/* CLKGEN PD */
|
||||
/* PD22 */ {1, 0, 0, 0, 0, 0},
|
||||
/* USER3 */
|
||||
/* PD21 */ {1, 0, 0, 0, 0, 0},
|
||||
/* USER2 */
|
||||
/* PD20 */ {1, 0, 0, 0, 0, 0},
|
||||
/* USER1 */
|
||||
/* PD19 */ {1, 1, 1, 0, 0, 0},
|
||||
/* SPI ~SEL */
|
||||
/* PD18 */ {1, 1, 1, 0, 0, 0},
|
||||
/* SPI CLK */
|
||||
/* PD17 */ {1, 1, 1, 0, 0, 0},
|
||||
/* SPI MOSI */
|
||||
/* PD16 */ {1, 1, 1, 0, 0, 0},
|
||||
/* SPI MISO */
|
||||
/* PD15 */ {1, 1, 1, 0, 1, 0},
|
||||
/* I2C SDA */
|
||||
/* PD14 */ {1, 1, 1, 0, 1, 0},
|
||||
/* I2C SCL */
|
||||
/* PD13 */ {1, 0, 0, 1, 0, 1},
|
||||
/* TEMP ~STDBY */
|
||||
/* PD12 */ {1, 0, 0, 1, 0, 1},
|
||||
/* FCC3 ~RESET */
|
||||
/* PD11 */ {1, 0, 0, 1, 0, 1},
|
||||
/* FCC2 ~RESET */
|
||||
/* PD10 */ {1, 0, 0, 1, 0, 1},
|
||||
/* FCC1 ~RESET */
|
||||
/* PD9 */ {1, 0, 0, 0, 0, 0},
|
||||
/* PD9 */
|
||||
/* PD8 */ {1, 0, 0, 0, 0, 0},
|
||||
/* PD8 */
|
||||
/* PD7 */ {1, 0, 0, 1, 0, 1},
|
||||
/* PD7 */
|
||||
/* PD6 */ {1, 0, 0, 1, 0, 1},
|
||||
/* PD6 */
|
||||
/* PD5 */ {1, 0, 0, 1, 0, 1},
|
||||
/* PD5 */
|
||||
/* PD4 */ {1, 0, 0, 1, 0, 1},
|
||||
/* PD4 */
|
||||
/* 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 */
|
||||
}
|
||||
/* Port D configuration */
|
||||
{
|
||||
/* cnf par sor dir odr dat */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PD31: SCC1 UART RxD */
|
||||
{ 1, 1, 1, 1, 0, 0 }, /* PD30: SCC1 UART TxD */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PD29: SCC1 UART ~RTS */
|
||||
{ 1, 1, 0, 0, 0, 0 }, /* PD28: SCC2 UART RxD */
|
||||
{ 1, 1, 0, 1, 0, 0 }, /* PD27: SCC2 UART TxD */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PD26: SCC2 UART ~RTS */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD25: SCC1 UART ~RI */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD24: SCC2 UART ~RI */
|
||||
{ 1, 0, 0, 1, 0, 0 }, /* PD23: CLKGEN PD */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD22: USER3 */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD21: USER2 */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD20: USER1 */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PD19: SPI ~SEL */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PD18: SPI CLK */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PD17: SPI MOSI */
|
||||
{ 1, 1, 1, 0, 0, 0 }, /* PD16: SPI MISO */
|
||||
{ 1, 1, 1, 0, 1, 0 }, /* PD15: I2C SDA */
|
||||
{ 1, 1, 1, 0, 1, 0 }, /* PD14: I2C SCL */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD13: TEMP ~STDBY */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD12: FCC3 ~RESET */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD11: FCC2 ~RESET */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD10: FCC1 ~RESET */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD09: PD9 */
|
||||
{ 1, 0, 0, 0, 0, 0 }, /* PD08: PD8 */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD07: PD7 */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD06: PD6 */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD05: PD5 */
|
||||
{ 1, 0, 0, 1, 0, 1 }, /* PD04: PD4 */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PD03: pin doesn't exist */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PD02: pin doesn't exist */
|
||||
{ 0, 0, 0, 0, 0, 0 }, /* PD01: pin doesn't exist */
|
||||
{ 0, 0, 0, 0, 0, 0 } /* PD00: pin doesn't exist */
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -334,17 +209,36 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
*
|
||||
* the data is written to the FS6377 via the i2c bus using address in
|
||||
* "fs6377_addr" (address is 7 bits - R/W bit not included).
|
||||
*
|
||||
* The fs6377 has four clock outputs: A, B, C and D.
|
||||
*
|
||||
* Outputs C and D can each provide two different clock outputs C1/D1 or
|
||||
* C2/D2 depending on the state of the SEL_CD input which is connected to
|
||||
* the MPC8260 I/O port pin PA11. PA11 output (SEL_CD input) low (or 0)
|
||||
* selects C1/D1 and PA11 output (SEL_CD input) high (or 1) selects C2/D2.
|
||||
*
|
||||
* PA11 defaults to output low (or 0) in the i/o port config table above.
|
||||
*
|
||||
* Output A provides a 100MHz for the High Speed Serial chips. Output B
|
||||
* provides a 3.6864MHz clock for more accurate asynchronous serial bit
|
||||
* rates. Output C is routed to the mezzanine connector but is currently
|
||||
* unused - both C1 and C2 are set to 16MHz. Output D is used by both the
|
||||
* alt-input and display mezzanine boards for their video chips. The
|
||||
* alt-input board requires a clock of 24.576MHz and this is available on
|
||||
* D1 (PA11=SEL_CD=0). The display board requires a clock of 27MHz and this
|
||||
* is available on D2 (PA11=SEL_CD=1).
|
||||
*
|
||||
* So the default is a clock suitable for the alt-input board. PA11 is toggled
|
||||
* later in misc_init_r(), if a display board is detected.
|
||||
*/
|
||||
|
||||
uchar fs6377_addr = 0x5c;
|
||||
|
||||
uchar fs6377_regs[16] = {
|
||||
12, 75, 64, 25, 144, 128, 25, 192,
|
||||
0, 16, 135, 192, 224, 64, 64, 192
|
||||
12, 75, 64, 25, 144, 128, 25, 192,
|
||||
0, 16, 135, 192, 224, 64, 64, 192
|
||||
};
|
||||
|
||||
iopin_t pa11 = { IOPIN_PORTA, 11, 0 };
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
@@ -356,7 +250,8 @@ iopin_t pa11 = { IOPIN_PORTA, 11, 0 };
|
||||
* the timebase, for udelay())
|
||||
*/
|
||||
|
||||
int board_postclk_init (void)
|
||||
int
|
||||
board_postclk_init (void)
|
||||
{
|
||||
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
|
||||
|
||||
@@ -371,7 +266,7 @@ int board_postclk_init (void)
|
||||
* if this doesn't work
|
||||
*/
|
||||
(void) i2c_write (fs6377_addr, 0, 1, fs6377_regs,
|
||||
sizeof (fs6377_regs));
|
||||
sizeof (fs6377_regs));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -382,7 +277,8 @@ int board_postclk_init (void)
|
||||
* Check Board Identity: Hardwired to HYMOD
|
||||
*/
|
||||
|
||||
int checkboard (void)
|
||||
int
|
||||
checkboard (void)
|
||||
{
|
||||
puts ("Board: HYMOD\n");
|
||||
return (0);
|
||||
@@ -446,7 +342,8 @@ uint upmc_table[] = {
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
|
||||
};
|
||||
|
||||
int misc_init_f (void)
|
||||
int
|
||||
misc_init_f (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
@@ -465,7 +362,8 @@ int misc_init_f (void)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
long initdram (int board_type)
|
||||
long
|
||||
initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
@@ -523,280 +421,95 @@ long initdram (int board_type)
|
||||
/* containing information to be stored in the eeprom from the tftp server */
|
||||
/* (the file name is based on the serial number and a built-in path) */
|
||||
|
||||
/* these are relative to the root of the server's tftp directory */
|
||||
static char *bddb_cfgdir = "/hymod/bddb";
|
||||
static char *global_env_path = "/hymod/global_env";
|
||||
|
||||
static ulong get_serno (const char *prompt)
|
||||
{
|
||||
for (;;) {
|
||||
int n;
|
||||
char *p;
|
||||
ulong serno;
|
||||
|
||||
n = readline (prompt);
|
||||
|
||||
if (n < 0)
|
||||
return (0);
|
||||
|
||||
if (n == 0)
|
||||
continue;
|
||||
|
||||
serno = simple_strtol (console_buffer, &p, 10);
|
||||
|
||||
if (p > console_buffer && *p == '\0')
|
||||
return (serno);
|
||||
|
||||
printf ("Invalid number (%s) - please re-enter\n", console_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static int read_eeprom (char *label, unsigned offset, hymod_eeprom_t * ep)
|
||||
{
|
||||
char filename[50], prompt[50];
|
||||
ulong serno;
|
||||
int count = 0;
|
||||
|
||||
sprintf (prompt, "Enter %s board serial number: ", label);
|
||||
|
||||
for (;;) {
|
||||
|
||||
if (eeprom_load (offset, ep))
|
||||
return (1);
|
||||
|
||||
printf ("*** %s board EEPROM contents are %sinvalid\n",
|
||||
label, count == 0 ? "" : "STILL ");
|
||||
|
||||
puts ("*** will attempt to fetch from server (Ctrl-C to abort)\n");
|
||||
|
||||
if ((serno = get_serno (prompt)) == 0) {
|
||||
puts ("\n*** interrupted! - ignoring eeprom contents\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
sprintf (filename, "%s/%010lu.cfg", bddb_cfgdir, serno);
|
||||
|
||||
printf ("*** fetching %s board EEPROM contents from server\n",
|
||||
label);
|
||||
|
||||
if (eeprom_fetch (offset, filename, 0x100000) == 0) {
|
||||
puts ("*** fetch failed - ignoring eeprom contents\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
static ulong main_serno;
|
||||
|
||||
static int env_fetch_callback (uchar * name, uchar * value)
|
||||
{
|
||||
char *ov, nv[CFG_CBSIZE], *p, *q, *nn;
|
||||
int override = 1, append = 0, nl;
|
||||
|
||||
nn = name;
|
||||
if (*nn == '-') {
|
||||
override = 0;
|
||||
nn++;
|
||||
}
|
||||
|
||||
if ((nl = strlen (nn)) > 0 && nn[nl - 1] == '+') {
|
||||
append = 1;
|
||||
nn[--nl] = '\0';
|
||||
}
|
||||
|
||||
p = value;
|
||||
q = nv;
|
||||
|
||||
while ((*q = *p++) != '\0')
|
||||
if (*q == '%') {
|
||||
switch (*p++) {
|
||||
|
||||
case '\0': /* whoops - back up */
|
||||
p--;
|
||||
break;
|
||||
|
||||
case '%': /* a single percent character */
|
||||
q++;
|
||||
break;
|
||||
|
||||
case 's': /* main board serial number as string */
|
||||
q += sprintf (q, "%010lu", main_serno);
|
||||
break;
|
||||
|
||||
case 'S': /* main board serial number as number */
|
||||
q += sprintf (q, "%lu", main_serno);
|
||||
break;
|
||||
|
||||
default: /* ignore any others */
|
||||
break;
|
||||
}
|
||||
} else
|
||||
q++;
|
||||
|
||||
if ((ov = getenv (nn)) != NULL) {
|
||||
|
||||
if (append) {
|
||||
|
||||
if (strstr (ov, nv) == NULL) {
|
||||
int ovl, nvl;
|
||||
|
||||
printf ("Appending '%s' to env cmd '%s'\n", nv, nn);
|
||||
|
||||
ovl = strlen (ov);
|
||||
nvl = strlen (nv);
|
||||
|
||||
while (nvl >= 0) {
|
||||
nv[ovl + 1 + nvl] = nv[nvl];
|
||||
nvl--;
|
||||
}
|
||||
|
||||
nv[ovl] = ' ';
|
||||
|
||||
while (--ovl >= 0)
|
||||
nv[ovl] = ov[ovl];
|
||||
|
||||
setenv (nn, nv);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (!override || strcmp (ov, nv) == 0)
|
||||
return (1);
|
||||
|
||||
printf ("Re-setting env cmd '%s' from '%s' to '%s'\n", nn, ov, nv);
|
||||
} else
|
||||
printf ("Setting env cmd '%s' to '%s'\n", nn, nv);
|
||||
|
||||
setenv (nn, nv);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int misc_init_r (void)
|
||||
int
|
||||
last_stage_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
|
||||
int rc;
|
||||
|
||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||
/*
|
||||
* we use the readline () function, but we also want
|
||||
* command timeout enabled
|
||||
*/
|
||||
init_cmd_timeout ();
|
||||
#endif
|
||||
|
||||
memset ((void *) cp, 0, sizeof (*cp));
|
||||
|
||||
/* set up main board config info */
|
||||
|
||||
if (i2c_probe (CFG_I2C_EEPROM_ADDR | HYMOD_EEOFF_MAIN)) {
|
||||
rc = hymod_eeprom_read (0, &cp->main.eeprom);
|
||||
|
||||
if (read_eeprom
|
||||
("main", HYMOD_EEOFF_MAIN << 8, &cp->main.eeprom))
|
||||
cp->main.eeprom_valid = 1;
|
||||
puts ("EEPROM:main...");
|
||||
if (rc < 0)
|
||||
puts ("NOT PRESENT\n");
|
||||
else if (rc == 0)
|
||||
puts ("INVALID\n");
|
||||
else {
|
||||
cp->main.eeprom.valid = 1;
|
||||
|
||||
puts ("EEPROM:main...");
|
||||
printf ("OK (ver %u)\n", cp->main.eeprom.ver);
|
||||
hymod_eeprom_print (&cp->main.eeprom);
|
||||
|
||||
if (cp->main.eeprom_valid) {
|
||||
printf ("OK (ver %u)\n", cp->main.eeprom.ver);
|
||||
eeprom_print (&cp->main.eeprom);
|
||||
main_serno = cp->main.eeprom.serno;
|
||||
} else
|
||||
puts ("BAD\n");
|
||||
/*
|
||||
* hard-wired assumption here: all hymod main boards will have
|
||||
* one xilinx fpga, with the interrupt line connected to IRQ2
|
||||
*
|
||||
* One day, this might be based on the board type
|
||||
*/
|
||||
|
||||
cp->main.mmap[0].prog.exists = 1;
|
||||
cp->main.mmap[0].prog.size = FPGA_MAIN_CFG_SIZE;
|
||||
cp->main.mmap[0].prog.base = FPGA_MAIN_CFG_BASE;
|
||||
cp->main.xlx[0].mmap.prog.exists = 1;
|
||||
cp->main.xlx[0].mmap.prog.size = FPGA_MAIN_CFG_SIZE;
|
||||
cp->main.xlx[0].mmap.prog.base = FPGA_MAIN_CFG_BASE;
|
||||
|
||||
cp->main.mmap[0].reg.exists = 1;
|
||||
cp->main.mmap[0].reg.size = FPGA_MAIN_REG_SIZE;
|
||||
cp->main.mmap[0].reg.base = FPGA_MAIN_REG_BASE;
|
||||
cp->main.xlx[0].mmap.reg.exists = 1;
|
||||
cp->main.xlx[0].mmap.reg.size = FPGA_MAIN_REG_SIZE;
|
||||
cp->main.xlx[0].mmap.reg.base = FPGA_MAIN_REG_BASE;
|
||||
|
||||
cp->main.mmap[0].port.exists = 1;
|
||||
cp->main.mmap[0].port.size = FPGA_MAIN_PORT_SIZE;
|
||||
cp->main.mmap[0].port.base = FPGA_MAIN_PORT_BASE;
|
||||
cp->main.xlx[0].mmap.port.exists = 1;
|
||||
cp->main.xlx[0].mmap.port.size = FPGA_MAIN_PORT_SIZE;
|
||||
cp->main.xlx[0].mmap.port.base = FPGA_MAIN_PORT_BASE;
|
||||
|
||||
cp->main.iopins[0].prog_pin.port = FPGA_MAIN_PROG_PORT;
|
||||
cp->main.iopins[0].prog_pin.pin = FPGA_MAIN_PROG_PIN;
|
||||
cp->main.iopins[0].prog_pin.flag = 1;
|
||||
cp->main.iopins[0].init_pin.port = FPGA_MAIN_INIT_PORT;
|
||||
cp->main.iopins[0].init_pin.pin = FPGA_MAIN_INIT_PIN;
|
||||
cp->main.iopins[0].init_pin.flag = 1;
|
||||
cp->main.iopins[0].done_pin.port = FPGA_MAIN_DONE_PORT;
|
||||
cp->main.iopins[0].done_pin.pin = FPGA_MAIN_DONE_PIN;
|
||||
cp->main.iopins[0].done_pin.flag = 1;
|
||||
cp->main.xlx[0].iopins.prog_pin.port = FPGA_MAIN_PROG_PORT;
|
||||
cp->main.xlx[0].iopins.prog_pin.pin = FPGA_MAIN_PROG_PIN;
|
||||
cp->main.xlx[0].iopins.prog_pin.flag = 1;
|
||||
cp->main.xlx[0].iopins.init_pin.port = FPGA_MAIN_INIT_PORT;
|
||||
cp->main.xlx[0].iopins.init_pin.pin = FPGA_MAIN_INIT_PIN;
|
||||
cp->main.xlx[0].iopins.init_pin.flag = 1;
|
||||
cp->main.xlx[0].iopins.done_pin.port = FPGA_MAIN_DONE_PORT;
|
||||
cp->main.xlx[0].iopins.done_pin.pin = FPGA_MAIN_DONE_PIN;
|
||||
cp->main.xlx[0].iopins.done_pin.flag = 1;
|
||||
#ifdef FPGA_MAIN_ENABLE_PORT
|
||||
cp->main.iopins[0].enable_pin.port = FPGA_MAIN_ENABLE_PORT;
|
||||
cp->main.iopins[0].enable_pin.pin = FPGA_MAIN_ENABLE_PIN;
|
||||
cp->main.iopins[0].enable_pin.flag = 1;
|
||||
cp->main.xlx[0].iopins.enable_pin.port = FPGA_MAIN_ENABLE_PORT;
|
||||
cp->main.xlx[0].iopins.enable_pin.pin = FPGA_MAIN_ENABLE_PIN;
|
||||
cp->main.xlx[0].iopins.enable_pin.flag = 1;
|
||||
#endif
|
||||
} else
|
||||
puts ("EEPROM:main...NOT PRESENT\n");
|
||||
|
||||
cp->main.xlx[0].irq = FPGA_MAIN_IRQ;
|
||||
}
|
||||
|
||||
/* set up mezzanine board config info */
|
||||
|
||||
if (i2c_probe (CFG_I2C_EEPROM_ADDR | HYMOD_EEOFF_MEZZ)) {
|
||||
rc = hymod_eeprom_read (1, &cp->mezz.eeprom);
|
||||
|
||||
if (read_eeprom
|
||||
("mezz", HYMOD_EEOFF_MEZZ << 8, &cp->mezz.eeprom))
|
||||
cp->mezz.eeprom_valid = 1;
|
||||
puts ("EEPROM:mezz...");
|
||||
if (rc < 0)
|
||||
puts ("NOT PRESENT\n");
|
||||
else if (rc == 0)
|
||||
puts ("INVALID\n");
|
||||
else {
|
||||
cp->main.eeprom.valid = 1;
|
||||
|
||||
puts ("EEPROM:mezz...");
|
||||
|
||||
if (cp->mezz.eeprom_valid) {
|
||||
printf ("OK (ver %u)\n", cp->mezz.eeprom.ver);
|
||||
eeprom_print (&cp->mezz.eeprom);
|
||||
} else
|
||||
puts ("BAD\n");
|
||||
|
||||
cp->mezz.mmap[0].prog.exists = 1;
|
||||
cp->mezz.mmap[0].prog.size = FPGA_MEZZ_CFG_SIZE;
|
||||
cp->mezz.mmap[0].prog.base = FPGA_MEZZ_CFG_BASE;
|
||||
|
||||
cp->mezz.mmap[0].reg.exists = 0;
|
||||
|
||||
cp->mezz.mmap[0].port.exists = 0;
|
||||
|
||||
cp->mezz.iopins[0].prog_pin.port = FPGA_MEZZ_PROG_PORT;
|
||||
cp->mezz.iopins[0].prog_pin.pin = FPGA_MEZZ_PROG_PIN;
|
||||
cp->mezz.iopins[0].prog_pin.flag = 1;
|
||||
cp->mezz.iopins[0].init_pin.port = FPGA_MEZZ_INIT_PORT;
|
||||
cp->mezz.iopins[0].init_pin.pin = FPGA_MEZZ_INIT_PIN;
|
||||
cp->mezz.iopins[0].init_pin.flag = 1;
|
||||
cp->mezz.iopins[0].done_pin.port = FPGA_MEZZ_DONE_PORT;
|
||||
cp->mezz.iopins[0].done_pin.pin = FPGA_MEZZ_DONE_PIN;
|
||||
cp->mezz.iopins[0].done_pin.flag = 1;
|
||||
#ifdef FPGA_MEZZ_ENABLE_PORT
|
||||
cp->mezz.iopins[0].enable_pin.port = FPGA_MEZZ_ENABLE_PORT;
|
||||
cp->mezz.iopins[0].enable_pin.pin = FPGA_MEZZ_ENABLE_PIN;
|
||||
cp->mezz.iopins[0].enable_pin.flag = 1;
|
||||
#endif
|
||||
|
||||
if (cp->mezz.eeprom_valid &&
|
||||
cp->mezz.eeprom.bdtype == HYMOD_BDTYPE_DISPLAY) {
|
||||
/*
|
||||
* mezzanine board is a display board - switch the SEL_CD
|
||||
* input of the FS6377 clock generator (via I/O Port Pin PA11) to
|
||||
* high (or 1) to select the 27MHz required by the display board
|
||||
*/
|
||||
iopin_set_high (&pa11);
|
||||
|
||||
puts ("SEL_CD:toggled for display board\n");
|
||||
}
|
||||
} else
|
||||
puts ("EEPROM:mezz...NOT PRESENT\n");
|
||||
|
||||
cp->crc =
|
||||
crc32 (0, (unsigned char *) cp, offsetof (hymod_conf_t, crc));
|
||||
|
||||
if (getenv ("global_env_loaded") == NULL) {
|
||||
|
||||
puts ("*** global environment has not been loaded\n");
|
||||
puts ("*** fetching from server (Control-C to Abort)\n");
|
||||
|
||||
rc = fetch_and_parse (global_env_path, 0x100000,
|
||||
env_fetch_callback);
|
||||
|
||||
if (rc == 0)
|
||||
puts ("*** Fetch of environment failed!\n");
|
||||
else
|
||||
setenv ("global_env_loaded", "yes");
|
||||
printf ("OK (ver %u)\n", cp->mezz.eeprom.ver);
|
||||
hymod_eeprom_print (&cp->mezz.eeprom);
|
||||
}
|
||||
|
||||
cp->crc = crc32 (0, (unsigned char *)cp, offsetof (hymod_conf_t, crc));
|
||||
|
||||
hymod_check_env ();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
#ifndef _ASM_HYMOD_H_
|
||||
#define _ASM_HYMOD_H_
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _HYMOD_H_
|
||||
#define _HYMOD_H_
|
||||
|
||||
#include <linux/config.h>
|
||||
#ifdef CONFIG_8260
|
||||
@@ -28,14 +51,15 @@
|
||||
*/
|
||||
|
||||
#define HYMOD_EEPROM_ID 0xAA /* eeprom id byte */
|
||||
#define HYMOD_EEPROM_VER 1 /* eeprom contents version */
|
||||
#define HYMOD_EEPROM_VER 1 /* eeprom contents version (0-127) */
|
||||
#define HYMOD_EEPROM_SIZE 256 /* number of bytes in the eeprom */
|
||||
|
||||
/* eeprom header */
|
||||
typedef
|
||||
struct {
|
||||
unsigned char id; /* eeprom id byte */
|
||||
unsigned char ver; /* eeprom contents version number */
|
||||
unsigned char :1;
|
||||
unsigned char ver:7; /* eeprom contents version number */
|
||||
unsigned long len; /* total # of bytes btw hdr and crc */
|
||||
}
|
||||
hymod_eehdr_t;
|
||||
@@ -206,7 +230,8 @@ hymod_hss_t;
|
||||
|
||||
typedef
|
||||
struct {
|
||||
unsigned char ver; /* eeprom contents version */
|
||||
unsigned char valid:1; /* contents of this struct is valid */
|
||||
unsigned char ver:7; /* eeprom contents version */
|
||||
unsigned char bdtype; /* board type */
|
||||
unsigned char bdrev; /* board revision */
|
||||
unsigned char batchlen; /* length of batch string below */
|
||||
@@ -262,13 +287,20 @@ typedef
|
||||
}
|
||||
xlx_iopins_t;
|
||||
|
||||
/* all info about one Xilinx chip */
|
||||
typedef
|
||||
struct {
|
||||
xlx_mmap_t mmap;
|
||||
xlx_iopins_t iopins;
|
||||
unsigned long irq:8; /* h/w intr req number for this fpga */
|
||||
}
|
||||
xlx_info_t;
|
||||
|
||||
/* all info about one hymod board */
|
||||
typedef
|
||||
struct {
|
||||
unsigned char eeprom_valid:1;
|
||||
hymod_eeprom_t eeprom;
|
||||
xlx_mmap_t mmap[HYMOD_MAX_XLX];
|
||||
xlx_iopins_t iopins[HYMOD_MAX_XLX];
|
||||
xlx_info_t xlx[HYMOD_MAX_XLX];
|
||||
}
|
||||
hymod_board_t;
|
||||
|
||||
@@ -280,10 +312,11 @@ hymod_board_t;
|
||||
*/
|
||||
typedef
|
||||
struct {
|
||||
unsigned long ver:8; /* version control */
|
||||
hymod_board_t main; /* main board info */
|
||||
hymod_board_t mezz; /* mezzanine board info */
|
||||
unsigned long crc; /* ensures kernel and boot prom agree */
|
||||
}
|
||||
hymod_conf_t;
|
||||
|
||||
#endif /* _ASM_HYMOD_H_ */
|
||||
#endif /* _HYMOD_H_ */
|
||||
113
board/hymod/input.c
Normal file
113
board/hymod/input.c
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
|
||||
*
|
||||
* 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>
|
||||
|
||||
/* imports from common/main.c */
|
||||
extern char console_buffer[CFG_CBSIZE];
|
||||
|
||||
int
|
||||
hymod_get_serno (const char *prompt)
|
||||
{
|
||||
for (;;) {
|
||||
int n, serno;
|
||||
char *p;
|
||||
|
||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||
reset_cmd_timeout ();
|
||||
#endif
|
||||
|
||||
n = readline (prompt);
|
||||
|
||||
if (n < 0)
|
||||
return (n);
|
||||
|
||||
if (n == 0)
|
||||
continue;
|
||||
|
||||
serno = (int) simple_strtol (console_buffer, &p, 10);
|
||||
|
||||
if (p > console_buffer && *p == '\0' && serno > 0)
|
||||
return (serno);
|
||||
|
||||
printf ("Invalid number (%s) - please re-enter\n",
|
||||
console_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
hymod_get_ethaddr (void)
|
||||
{
|
||||
for (;;) {
|
||||
int n;
|
||||
|
||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||
reset_cmd_timeout ();
|
||||
#endif
|
||||
|
||||
n = readline ("Enter board ethernet address: ");
|
||||
|
||||
if (n < 0)
|
||||
return (n);
|
||||
|
||||
if (n == 0)
|
||||
continue;
|
||||
|
||||
if (n == 17) {
|
||||
int i;
|
||||
char *p, *q;
|
||||
uchar ea[6];
|
||||
|
||||
/* see if it looks like an ethernet address */
|
||||
|
||||
p = console_buffer;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
char term = (i == 5 ? '\0' : ':');
|
||||
|
||||
ea[i] = simple_strtol (p, &q, 16);
|
||||
|
||||
if ((q - p) != 2 || *q++ != term)
|
||||
break;
|
||||
|
||||
p = q;
|
||||
}
|
||||
|
||||
if (i == 6) {
|
||||
/* it looks ok - set it */
|
||||
printf ("Setting ethernet addr to %s\n",
|
||||
console_buffer);
|
||||
|
||||
setenv ("ethaddr", console_buffer);
|
||||
|
||||
puts ("Remember to do a 'saveenv' to "
|
||||
"make it permanent\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
printf ("Invalid ethernet addr (%s) - please re-enter\n",
|
||||
console_buffer);
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -79,6 +79,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -76,6 +76,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -60,6 +60,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -299,12 +299,6 @@ int misc_init_r (void)
|
||||
|
||||
void lcd_logo (bd_t * bd)
|
||||
{
|
||||
|
||||
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
|
||||
|
||||
|
||||
FB_INFO_S1D13xxx fb_info;
|
||||
S1D_INDEX s1dReg;
|
||||
S1D_VALUE s1dValue;
|
||||
@@ -328,8 +322,8 @@ void lcd_logo (bd_t * bd)
|
||||
/**/
|
||||
/*----------------------------------------------------------------------------- */
|
||||
memctl = &immr->im_memctl;
|
||||
/* memctl->memc_or5 = 0xFFC007F0; / * 4 MB 17 WS or externel TA */
|
||||
/* memctl->memc_br5 = 0x80000801; / * Start at 0x80000000 */
|
||||
/* memctl->memc_or5 = 0xFFC007F0; / * 4 MB 17 WS or externel TA */
|
||||
/* memctl->memc_br5 = 0x80000801; / * Start at 0x80000000 */
|
||||
|
||||
memctl->memc_or5 = 0xFFC00708; /* 4 MB 17 WS or externel TA */
|
||||
memctl->memc_br5 = 0x80080801; /* Start at 0x80080000 */
|
||||
|
||||
@@ -79,6 +79,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -76,6 +76,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
47
board/logodl/Makefile
Normal file
47
board/logodl/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := logodl.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
|
||||
|
||||
#########################################################################
|
||||
15
board/logodl/config.mk
Normal file
15
board/logodl/config.mk
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Linux-Kernel is expected to be at c000'8000, entry c000'8000
|
||||
#
|
||||
# we load ourself to c170'0000, the upper 1 MB of second bank
|
||||
#
|
||||
# download areas is c800'0000
|
||||
#
|
||||
|
||||
#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 = 0x083E0000
|
||||
830
board/logodl/flash.c
Normal file
830
board/logodl/flash.c
Normal file
@@ -0,0 +1,830 @@
|
||||
/*
|
||||
* (C) 2000 Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* (C) 2003 August Hoeraendl, Logotronic GmbH
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#undef CONFIG_FLASH_16BIT
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#define FLASH_BANK_SIZE 0x1000000
|
||||
#define MAIN_SECT_SIZE 0x20000 /* 2x64k = 128k per sector */
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* NOTE - CONFIG_FLASH_16BIT means the CPU interface is 16-bit, it
|
||||
* has nothing to do with the flash chip being 8-bit or 16-bit.
|
||||
*/
|
||||
#ifdef CONFIG_FLASH_16BIT
|
||||
typedef unsigned short FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned short FLASH_PORT_WIDTHV;
|
||||
|
||||
#define FLASH_ID_MASK 0xFFFF
|
||||
#else
|
||||
typedef unsigned long FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned long FLASH_PORT_WIDTHV;
|
||||
|
||||
#define FLASH_ID_MASK 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define ORMASK(size) ((-size) & OR_AM_MSK)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(FPWV *addr, flash_info_t *info);
|
||||
static void flash_reset(flash_info_t *info);
|
||||
static int write_word_intel(flash_info_t *info, FPWV *dest, FPW data);
|
||||
static int write_word_amd(flash_info_t *info, FPWV *dest, FPW data);
|
||||
#define write_word(in, de, da) write_word_amd(in, de, da)
|
||||
static void flash_get_offsets(ulong base, flash_info_t *info);
|
||||
#ifdef CFG_FLASH_PROTECTION
|
||||
static void flash_sync_real_protect(flash_info_t *info);
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* flash_init()
|
||||
*
|
||||
* sets up flash_info and returns size of FLASH (bytes)
|
||||
*/
|
||||
ulong flash_init(void)
|
||||
{
|
||||
int i, j;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++)
|
||||
{
|
||||
ulong flashbase = 0;
|
||||
flash_info[i].flash_id =
|
||||
(FLASH_MAN_AMD & FLASH_VENDMASK) |
|
||||
(FLASH_AM640U & FLASH_TYPEMASK);
|
||||
flash_info[i].size = FLASH_BANK_SIZE;
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
|
||||
memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
flashbase = PHYS_FLASH_1;
|
||||
break;
|
||||
case 1:
|
||||
flashbase = PHYS_FLASH_2;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_reset(flash_info_t *info)
|
||||
{
|
||||
FPWV *base = (FPWV *)(info->start[0]);
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL)
|
||||
*base = (FPW)0x00FF00FF; /* Intel Read Mode */
|
||||
else if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD)
|
||||
*base = (FPW)0x00F000F0; /* AMD Read Mode */
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start address table */
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL
|
||||
&& (info->flash_id & FLASH_BTYPE)) {
|
||||
int bootsect_size; /* number of bytes/boot sector */
|
||||
int sect_size; /* number of bytes/regular sector */
|
||||
|
||||
bootsect_size = 0x00002000 * (sizeof(FPW)/2);
|
||||
sect_size = 0x00010000 * (sizeof(FPW)/2);
|
||||
|
||||
/* set sector offsets for bottom boot block type */
|
||||
for (i = 0; i < 8; ++i) {
|
||||
info->start[i] = base + (i * bootsect_size);
|
||||
}
|
||||
for (i = 8; i < info->sector_count; i++) {
|
||||
info->start[i] = base + ((i - 7) * sect_size);
|
||||
}
|
||||
}
|
||||
else if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD
|
||||
&& (info->flash_id & FLASH_TYPEMASK) == FLASH_AM640U) {
|
||||
|
||||
int sect_size; /* number of bytes/sector */
|
||||
|
||||
sect_size = 0x00010000 * (sizeof(FPW)/2);
|
||||
|
||||
/* set up sector start address table (uniform sector type) */
|
||||
for( i = 0; i < info->sector_count; i++ )
|
||||
info->start[i] = base + (i * sect_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
uchar *boottype;
|
||||
uchar *bootletter;
|
||||
uchar *fmt;
|
||||
uchar botbootletter[] = "B";
|
||||
uchar topbootletter[] = "T";
|
||||
uchar botboottype[] = "bottom boot sector";
|
||||
uchar topboottype[] = "top boot sector";
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD: printf ("AMD "); break;
|
||||
case FLASH_MAN_BM: printf ("BRIGHT MICRO "); break;
|
||||
case FLASH_MAN_FUJ: printf ("FUJITSU "); break;
|
||||
case FLASH_MAN_SST: printf ("SST "); break;
|
||||
case FLASH_MAN_STM: printf ("STM "); break;
|
||||
case FLASH_MAN_INTEL: printf ("INTEL "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
/* check for top or bottom boot, if it applies */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
boottype = botboottype;
|
||||
bootletter = botbootletter;
|
||||
}
|
||||
else {
|
||||
boottype = topboottype;
|
||||
bootletter = topbootletter;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM640U:
|
||||
fmt = "29LV641D (64 Mbit, uniform sectors)\n";
|
||||
break;
|
||||
case FLASH_28F800C3B:
|
||||
case FLASH_28F800C3T:
|
||||
fmt = "28F800C3%s (8 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL800B:
|
||||
case FLASH_INTEL800T:
|
||||
fmt = "28F800B3%s (8 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F160C3B:
|
||||
case FLASH_28F160C3T:
|
||||
fmt = "28F160C3%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL160B:
|
||||
case FLASH_INTEL160T:
|
||||
fmt = "28F160B3%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F320C3B:
|
||||
case FLASH_28F320C3T:
|
||||
fmt = "28F320C3%s (32 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL320B:
|
||||
case FLASH_INTEL320T:
|
||||
fmt = "28F320B3%s (32 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_28F640C3B:
|
||||
case FLASH_28F640C3T:
|
||||
fmt = "28F640C3%s (64 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_INTEL640B:
|
||||
case FLASH_INTEL640T:
|
||||
fmt = "28F640B3%s (64 Mbit, %s)\n";
|
||||
break;
|
||||
default:
|
||||
fmt = "Unknown Chip Type\n";
|
||||
break;
|
||||
}
|
||||
|
||||
printf (fmt, bootletter, boottype);
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20,
|
||||
info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0) {
|
||||
printf ("\n ");
|
||||
}
|
||||
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
ulong flash_get_size (FPWV *addr, flash_info_t *info)
|
||||
{
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
|
||||
/* Write auto select command sequence and test FLASH answer */
|
||||
addr[0x0555] = (FPW)0x00AA00AA; /* for AMD, Intel ignores this */
|
||||
addr[0x02AA] = (FPW)0x00550055; /* for AMD, Intel ignores this */
|
||||
addr[0x0555] = (FPW)0x00900090; /* selects Intel or AMD */
|
||||
|
||||
/* The manufacturer codes are only 1 byte, so just use 1 byte.
|
||||
* This works for any bus width and any FLASH device width.
|
||||
*/
|
||||
switch (addr[0] & 0xff) {
|
||||
|
||||
case (uchar)AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
|
||||
case (uchar)INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check 16 bits or 32 bits of ID so work on 32 or 16 bit bus. */
|
||||
if (info->flash_id != FLASH_UNKNOWN) switch (addr[1]) {
|
||||
|
||||
case (FPW)AMD_ID_LV640U: /* 29LV640 and 29LV641 have same ID */
|
||||
info->flash_id += FLASH_AM640U;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x00800000 * (sizeof(FPW)/2);
|
||||
break; /* => 8 or 16 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F800C3B:
|
||||
info->flash_id += FLASH_28F800C3B;
|
||||
info->sector_count = 23;
|
||||
info->size = 0x00100000 * (sizeof(FPW)/2);
|
||||
break; /* => 1 or 2 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F800B3B:
|
||||
info->flash_id += FLASH_INTEL800B;
|
||||
info->sector_count = 23;
|
||||
info->size = 0x00100000 * (sizeof(FPW)/2);
|
||||
break; /* => 1 or 2 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F160C3B:
|
||||
info->flash_id += FLASH_28F160C3B;
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00200000 * (sizeof(FPW)/2);
|
||||
break; /* => 2 or 4 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F160B3B:
|
||||
info->flash_id += FLASH_INTEL160B;
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00200000 * (sizeof(FPW)/2);
|
||||
break; /* => 2 or 4 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F320C3B:
|
||||
info->flash_id += FLASH_28F320C3B;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00400000 * (sizeof(FPW)/2);
|
||||
break; /* => 4 or 8 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F320B3B:
|
||||
info->flash_id += FLASH_INTEL320B;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00400000 * (sizeof(FPW)/2);
|
||||
break; /* => 4 or 8 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F640C3B:
|
||||
info->flash_id += FLASH_28F640C3B;
|
||||
info->sector_count = 135;
|
||||
info->size = 0x00800000 * (sizeof(FPW)/2);
|
||||
break; /* => 8 or 16 MB */
|
||||
|
||||
case (FPW)INTEL_ID_28F640B3B:
|
||||
info->flash_id += FLASH_INTEL640B;
|
||||
info->sector_count = 135;
|
||||
info->size = 0x00800000 * (sizeof(FPW)/2);
|
||||
break; /* => 8 or 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
flash_get_offsets((ulong)addr, info);
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
flash_reset(info);
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
#ifdef CFG_FLASH_PROTECTION
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void flash_sync_real_protect(flash_info_t *info)
|
||||
{
|
||||
FPWV *addr = (FPWV *)(info->start[0]);
|
||||
FPWV *sect;
|
||||
int i;
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F800C3B:
|
||||
case FLASH_28F800C3T:
|
||||
case FLASH_28F160C3B:
|
||||
case FLASH_28F160C3T:
|
||||
case FLASH_28F320C3B:
|
||||
case FLASH_28F320C3T:
|
||||
case FLASH_28F640C3B:
|
||||
case FLASH_28F640C3T:
|
||||
/* check for protected sectors */
|
||||
*addr = (FPW)0x00900090;
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02.
|
||||
* D0 = 1 for each device if protected.
|
||||
* If at least one device is protected the sector is marked
|
||||
* protected, but mixed protected and unprotected devices
|
||||
* within a sector should never happen.
|
||||
*/
|
||||
sect = (FPWV *)(info->start[i]);
|
||||
info->protect[i] = (sect[2] & (FPW)(0x00010001)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
flash_reset(info);
|
||||
break;
|
||||
|
||||
case FLASH_AM640U:
|
||||
default:
|
||||
/* no hardware protect that we support */
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
FPWV *addr;
|
||||
int flag, prot, sect;
|
||||
int intel = (info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL;
|
||||
ulong start, now, last;
|
||||
int rcode = 0;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_INTEL800B:
|
||||
case FLASH_INTEL160B:
|
||||
case FLASH_INTEL320B:
|
||||
case FLASH_INTEL640B:
|
||||
case FLASH_28F800C3B:
|
||||
case FLASH_28F160C3B:
|
||||
case FLASH_28F320C3B:
|
||||
case FLASH_28F640C3B:
|
||||
case FLASH_AM640U:
|
||||
break;
|
||||
case FLASH_UNKNOWN:
|
||||
default:
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last && rcode == 0; sect++) {
|
||||
|
||||
if (info->protect[sect] != 0) /* protected, skip it */
|
||||
continue;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr = (FPWV *)(info->start[sect]);
|
||||
if (intel) {
|
||||
*addr = (FPW)0x00500050; /* clear status register */
|
||||
*addr = (FPW)0x00200020; /* erase setup */
|
||||
*addr = (FPW)0x00D000D0; /* erase confirm */
|
||||
}
|
||||
else {
|
||||
/* must be AMD style if not Intel */
|
||||
FPWV *base; /* first address in bank */
|
||||
|
||||
base = (FPWV *)(info->start[0]);
|
||||
base[0x0555] = (FPW)0x00AA00AA; /* unlock */
|
||||
base[0x02AA] = (FPW)0x00550055; /* unlock */
|
||||
base[0x0555] = (FPW)0x00800080; /* erase mode */
|
||||
base[0x0555] = (FPW)0x00AA00AA; /* unlock */
|
||||
base[0x02AA] = (FPW)0x00550055; /* unlock */
|
||||
*addr = (FPW)0x00300030; /* erase sector */
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 50us for AMD, 80us for Intel.
|
||||
* Let's wait 1 ms.
|
||||
*/
|
||||
udelay (1000);
|
||||
|
||||
while ((*addr & (FPW)0x00800080) != (FPW)0x00800080) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
|
||||
if (intel) {
|
||||
/* suspend erase */
|
||||
*addr = (FPW)0x00B000B0;
|
||||
}
|
||||
|
||||
flash_reset(info); /* reset to read mode */
|
||||
rcode = 1; /* failed */
|
||||
break;
|
||||
}
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
flash_reset(info); /* reset to read mode */
|
||||
}
|
||||
|
||||
printf (" done\n");
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
int bad_write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
FPW data = 0; /* 16 or 32 bit word, matches flash bus width on MPC8XX */
|
||||
int bytes; /* number of bytes to program in current word */
|
||||
int left; /* number of bytes left to program */
|
||||
int i, res;
|
||||
|
||||
for (left = cnt, res = 0;
|
||||
left > 0 && res == 0;
|
||||
addr += sizeof(data), left -= sizeof(data) - bytes) {
|
||||
|
||||
bytes = addr & (sizeof(data) - 1);
|
||||
addr &= ~(sizeof(data) - 1);
|
||||
|
||||
/* combine source and destination data so can program
|
||||
* an entire word of 16 or 32 bits
|
||||
*/
|
||||
for (i = 0; i < sizeof(data); i++) {
|
||||
data <<= 8;
|
||||
if (i < bytes || i - bytes >= left )
|
||||
data += *((uchar *)addr + i);
|
||||
else
|
||||
data += *src++;
|
||||
}
|
||||
|
||||
/* write one word to the flash */
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD:
|
||||
res = write_word_amd(info, (FPWV *)addr, data);
|
||||
break;
|
||||
case FLASH_MAN_INTEL:
|
||||
res = write_word_intel(info, (FPWV *)addr, data);
|
||||
break;
|
||||
default:
|
||||
/* unknown flash type, error! */
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
res = 1; /* not really a timeout, but gives error */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/**
|
||||
* write_buf: - Copy memory to flash.
|
||||
*
|
||||
* @param info:
|
||||
* @param src: source of copy transaction
|
||||
* @param addr: where to copy to
|
||||
* @param cnt: number of bytes to copy
|
||||
*
|
||||
* @return error code
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int l;
|
||||
int i, rc;
|
||||
|
||||
wp = (addr & ~1); /* 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 << 8);
|
||||
}
|
||||
for (; i<2 && cnt>0; ++i) {
|
||||
data = (data >> 8) | (*src++ << 8);
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt==0 && i<2; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 2) {
|
||||
/* data = *((vushort*)src); */
|
||||
data = *((FPW*)src);
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
src += sizeof(FPW);
|
||||
wp += sizeof(FPW);
|
||||
cnt -= sizeof(FPW);
|
||||
}
|
||||
|
||||
if (cnt == 0) return ERR_OK;
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) {
|
||||
data = (data >> 8) | (*src++ << 8);
|
||||
--cnt;
|
||||
}
|
||||
for (; i<2; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
|
||||
return write_word(info, wp, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash for AMD FLASH
|
||||
* A word is 16 or 32 bits, whichever the bus width of the flash bank
|
||||
* (not an individual chip) is.
|
||||
*
|
||||
* returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)
|
||||
{
|
||||
ulong start;
|
||||
int flag;
|
||||
int res = 0; /* result, assume success */
|
||||
FPWV *base; /* first address in flash bank */
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*dest & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
|
||||
base = (FPWV *)(info->start[0]);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
base[0x0555] = (FPW)0x00AA00AA; /* unlock */
|
||||
base[0x02AA] = (FPW)0x00550055; /* unlock */
|
||||
base[0x0555] = (FPW)0x00A000A0; /* selects program mode */
|
||||
|
||||
*dest = data; /* start programming the data */
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
start = get_timer (0);
|
||||
|
||||
/* data polling for D7 */
|
||||
while (res == 0 && (*dest & (FPW)0x00800080) != (data & (FPW)0x00800080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*dest = (FPW)0x00F000F0; /* reset bank */
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash for Intel FLASH
|
||||
* A word is 16 or 32 bits, whichever the bus width of the flash bank
|
||||
* (not an individual chip) is.
|
||||
*
|
||||
* returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word_intel (flash_info_t *info, FPWV *dest, FPW data)
|
||||
{
|
||||
ulong start;
|
||||
int flag;
|
||||
int res = 0; /* result, assume success */
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*dest & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
*dest = (FPW)0x00500050; /* clear status register */
|
||||
*dest = (FPW)0x00FF00FF; /* make sure in read mode */
|
||||
*dest = (FPW)0x00400040; /* program setup */
|
||||
|
||||
*dest = data; /* start programming the data */
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
start = get_timer (0);
|
||||
|
||||
while (res == 0 && (*dest & (FPW)0x00800080) != (FPW)0x00800080) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*dest = (FPW)0x00B000B0; /* Suspend program */
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (res == 0 && (*dest & (FPW)0x00100010))
|
||||
res = 1; /* write failed, time out error is close enough */
|
||||
|
||||
*dest = (FPW)0x00500050; /* clear status register */
|
||||
*dest = (FPW)0x00FF00FF; /* make sure in read mode */
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
#ifdef CFG_FLASH_PROTECTION
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
int flash_real_protect (flash_info_t * info, long sector, int prot)
|
||||
{
|
||||
int rcode = 0; /* assume success */
|
||||
FPWV *addr; /* address of sector */
|
||||
FPW value;
|
||||
|
||||
addr = (FPWV *) (info->start[sector]);
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F800C3B:
|
||||
case FLASH_28F800C3T:
|
||||
case FLASH_28F160C3B:
|
||||
case FLASH_28F160C3T:
|
||||
case FLASH_28F320C3B:
|
||||
case FLASH_28F320C3T:
|
||||
case FLASH_28F640C3B:
|
||||
case FLASH_28F640C3T:
|
||||
flash_reset (info); /* make sure in read mode */
|
||||
*addr = (FPW) 0x00600060L; /* lock command setup */
|
||||
if (prot)
|
||||
*addr = (FPW) 0x00010001L; /* lock sector */
|
||||
else
|
||||
*addr = (FPW) 0x00D000D0L; /* unlock sector */
|
||||
flash_reset (info); /* reset to read mode */
|
||||
|
||||
/* now see if it really is locked/unlocked as requested */
|
||||
*addr = (FPW) 0x00900090;
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02.
|
||||
* D0 = 1 for each device if protected.
|
||||
* If at least one device is protected the sector is marked
|
||||
* protected, but return failure. Mixed protected and
|
||||
* unprotected devices within a sector should never happen.
|
||||
*/
|
||||
value = addr[2] & (FPW) 0x00010001;
|
||||
if (value == 0)
|
||||
info->protect[sector] = 0;
|
||||
else if (value == (FPW) 0x00010001)
|
||||
info->protect[sector] = 1;
|
||||
else {
|
||||
/* error, mixed protected and unprotected */
|
||||
rcode = 1;
|
||||
info->protect[sector] = 1;
|
||||
}
|
||||
if (info->protect[sector] != prot)
|
||||
rcode = 1; /* failed to protect/unprotect as requested */
|
||||
|
||||
/* reload all protection bits from hardware for now */
|
||||
flash_sync_real_protect (info);
|
||||
break;
|
||||
|
||||
case FLASH_AM640U:
|
||||
default:
|
||||
/* no hardware protect that we support */
|
||||
info->protect[sector] = prot;
|
||||
break;
|
||||
}
|
||||
|
||||
return rcode;
|
||||
}
|
||||
#endif
|
||||
123
board/logodl/logodl.c
Normal file
123
board/logodl/logodl.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* (C) 2002 Kyle Harris <kharris@nexus-tech.net>, Nexus Technologies, Inc.
|
||||
* (C) 2002 Marius Groeger <mgroeger@sysgo.de>, Sysgo GmbH
|
||||
* (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
/**
|
||||
* board_init: - setup some data structures
|
||||
*
|
||||
* @return: 0 in case of success
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* memory and cpu-speed are setup before relocation */
|
||||
/* so we do _nothing_ here */
|
||||
|
||||
gd->bd->bi_arch_number = MACH_TYPE_LOGODL;
|
||||
gd->bd->bi_boot_params = 0x08000100;
|
||||
gd->bd->bi_baudrate = CONFIG_BAUDRATE;
|
||||
|
||||
(*((volatile short*)0x14800000)) = 0xff; /* power on eth0 */
|
||||
(*((volatile short*)0x14000000)) = 0xff; /* power on uart */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dram_init: - setup dynamic RAM
|
||||
*
|
||||
* @return: 0 in case of success
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* logodl_set_led: - switch LEDs on or off
|
||||
*
|
||||
* @param led: LED to switch (0,1)
|
||||
* @param state: switch on (1) or off (0)
|
||||
*/
|
||||
|
||||
void logodl_set_led(int led, int state)
|
||||
{
|
||||
switch(led) {
|
||||
|
||||
case 0:
|
||||
if (state==1) {
|
||||
CFG_LED_A_CR = CFG_LED_A_BIT;
|
||||
} else if (state==0) {
|
||||
CFG_LED_A_SR = CFG_LED_A_BIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (state==1) {
|
||||
CFG_LED_B_CR = CFG_LED_B_BIT;
|
||||
} else if (state==0) {
|
||||
CFG_LED_B_SR = CFG_LED_B_BIT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* show_boot_progress: - indicate state of the boot process
|
||||
*
|
||||
* @param status: Status number - see README for details.
|
||||
*
|
||||
* The LOGOTRONIC does only have 2 LEDs, so we switch them on at the most
|
||||
* important states (1, 5, 15).
|
||||
*/
|
||||
|
||||
void show_boot_progress (int status)
|
||||
{
|
||||
/*
|
||||
switch(status) {
|
||||
case 1: logodl_set_led(0,1); break;
|
||||
case 5: logodl_set_led(1,1); break;
|
||||
case 15: logodl_set_led(2,1); break;
|
||||
}
|
||||
*/
|
||||
logodl_set_led(0, (status & 1)==1);
|
||||
logodl_set_led(1, (status & 2)==2);
|
||||
|
||||
return;
|
||||
}
|
||||
438
board/logodl/memsetup.S
Normal file
438
board/logodl/memsetup.S
Normal file
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
* Most of this taken from Redboot hal_platform_setup.h with cleanup
|
||||
*
|
||||
* NOTE: I haven't clean this up considerably, just enough to get it
|
||||
* running. See hal_platform_setup.h for the source. See
|
||||
* board/cradle/memsetup.S for another PXA250 setup that is
|
||||
* much cleaner.
|
||||
*
|
||||
* 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
|
||||
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
/*
|
||||
* Memory setup
|
||||
*/
|
||||
|
||||
.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, =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]
|
||||
|
||||
ldr r0, =PSSR /* enable GPIO pins */
|
||||
ldr r1, =CFG_PSSR_VAL
|
||||
str r1, [r0]
|
||||
|
||||
/* 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) */
|
||||
/* */
|
||||
/* ldr r1, =LED_BLANK */
|
||||
/* mov r0, #0xFF */
|
||||
/* str r0, [r1] / turn on hex leds */
|
||||
/* */
|
||||
/*loop: */
|
||||
/* */
|
||||
/* ldr r0, =0xB0070001 */
|
||||
/* ldr r1, =_LED */
|
||||
/* str r0, [r1] / hex display */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Enable memory interface */
|
||||
/* */
|
||||
/* The sequence below is based on the recommended init steps */
|
||||
/* detailed in the Intel PXA250 Operating Systems Developers Guide, */
|
||||
/* Chapter 10. */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 1: Wait for at least 200 microsedonds to allow internal */
|
||||
/* clocks to settle. Only necessary after hard reset... */
|
||||
/* FIXME: can be optimized later */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
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
|
||||
|
||||
mem_init:
|
||||
|
||||
ldr r1, =MEMC_BASE /* get memory controller base addr. */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2a: Initialize Asynchronous static memory controller */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* MSC registers: timing, bus width, mem type */
|
||||
|
||||
/* MSC0: nCS(0,1) */
|
||||
ldr r2, =CFG_MSC0_VAL
|
||||
str r2, [r1, #MSC0_OFFSET]
|
||||
ldr r2, [r1, #MSC0_OFFSET] /* read back to ensure */
|
||||
/* that data latches */
|
||||
/* MSC1: nCS(2,3) */
|
||||
ldr r2, =CFG_MSC1_VAL
|
||||
str r2, [r1, #MSC1_OFFSET]
|
||||
ldr r2, [r1, #MSC1_OFFSET]
|
||||
|
||||
/* MSC2: nCS(4,5) */
|
||||
ldr r2, =CFG_MSC2_VAL
|
||||
str r2, [r1, #MSC2_OFFSET]
|
||||
ldr r2, [r1, #MSC2_OFFSET]
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2b: Initialize Card Interface */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* MECR: Memory Expansion Card Register */
|
||||
ldr r2, =CFG_MECR_VAL
|
||||
str r2, [r1, #MECR_OFFSET]
|
||||
ldr r2, [r1, #MECR_OFFSET]
|
||||
|
||||
/* MCMEM0: Card Interface slot 0 timing */
|
||||
ldr r2, =CFG_MCMEM0_VAL
|
||||
str r2, [r1, #MCMEM0_OFFSET]
|
||||
ldr r2, [r1, #MCMEM0_OFFSET]
|
||||
|
||||
/* MCMEM1: Card Interface slot 1 timing */
|
||||
ldr r2, =CFG_MCMEM1_VAL
|
||||
str r2, [r1, #MCMEM1_OFFSET]
|
||||
ldr r2, [r1, #MCMEM1_OFFSET]
|
||||
|
||||
/* MCATT0: Card Interface Attribute Space Timing, slot 0 */
|
||||
ldr r2, =CFG_MCATT0_VAL
|
||||
str r2, [r1, #MCATT0_OFFSET]
|
||||
ldr r2, [r1, #MCATT0_OFFSET]
|
||||
|
||||
/* MCATT1: Card Interface Attribute Space Timing, slot 1 */
|
||||
ldr r2, =CFG_MCATT1_VAL
|
||||
str r2, [r1, #MCATT1_OFFSET]
|
||||
ldr r2, [r1, #MCATT1_OFFSET]
|
||||
|
||||
/* MCIO0: Card Interface I/O Space Timing, slot 0 */
|
||||
ldr r2, =CFG_MCIO0_VAL
|
||||
str r2, [r1, #MCIO0_OFFSET]
|
||||
ldr r2, [r1, #MCIO0_OFFSET]
|
||||
|
||||
/* MCIO1: Card Interface I/O Space Timing, slot 1 */
|
||||
ldr r2, =CFG_MCIO1_VAL
|
||||
str r2, [r1, #MCIO1_OFFSET]
|
||||
ldr r2, [r1, #MCIO1_OFFSET]
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2c: Write FLYCNFG FIXME: what's that??? */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* test if we run from flash or RAM - RAM/BDI: don't setup RAM */
|
||||
adr r3, mem_init /* r0 <- current position of code */
|
||||
ldr r2, =mem_init
|
||||
cmp r3, r2 /* skip init if in place */
|
||||
beq initirqs
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2d: Initialize Timing for Sync Memory (SDCLK0) */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Before accessing MDREFR we need a valid DRI field, so we set */
|
||||
/* this to power on defaults + DRI field. */
|
||||
|
||||
ldr r3, =CFG_MDREFR_VAL
|
||||
ldr r2, =0xFFF
|
||||
and r3, r3, r2
|
||||
ldr r4, =0x03ca4000
|
||||
orr r4, r4, r3
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 3: Initialize Synchronous Static Memory (Flash/Peripherals) */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Initialize SXCNFG register. Assert the enable bits */
|
||||
|
||||
/* Write SXMRS to cause an MRS command to all enabled banks of */
|
||||
/* synchronous static memory. Note that SXLCR need not be written */
|
||||
/* at this time. */
|
||||
|
||||
/* FIXME: we use async mode for now */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 4: Initialize SDRAM */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Step 4a: assert MDREFR:K?RUN and configure */
|
||||
/* MDREFR:K1DB2 and MDREFR:K2DB2 as desired. */
|
||||
|
||||
ldr r4, =CFG_MDREFR_VAL
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
/* Step 4b: de-assert MDREFR:SLFRSH. */
|
||||
|
||||
bic r4, r4, #(MDREFR_SLFRSH)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
|
||||
/* Step 4c: assert MDREFR:E1PIN and E0PIO */
|
||||
|
||||
orr r4, r4, #(MDREFR_E1PIN|MDREFR_E0PIN)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
|
||||
/* Step 4d: write MDCNFG with MDCNFG:DEx deasserted (set to 0), to */
|
||||
/* configure but not enable each SDRAM partition pair. */
|
||||
|
||||
ldr r4, =CFG_MDCNFG_VAL
|
||||
bic r4, r4, #(MDCNFG_DE0|MDCNFG_DE1)
|
||||
|
||||
str r4, [r1, #MDCNFG_OFFSET] /* write back MDCNFG */
|
||||
ldr r4, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
|
||||
/* Step 4e: Wait for the clock to the SDRAMs to stabilize, */
|
||||
/* 100..200 <20>sec. */
|
||||
|
||||
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
|
||||
|
||||
|
||||
/* Step 4f: Trigger a number (usually 8) refresh cycles by */
|
||||
/* attempting non-burst read or write accesses to disabled */
|
||||
/* SDRAM, as commonly specified in the power up sequence */
|
||||
/* documented in SDRAM data sheets. The address(es) used */
|
||||
/* for this purpose must not be cacheable. */
|
||||
|
||||
/* There should 9 writes, since the first write doesn't */
|
||||
/* trigger a refresh cycle on PXA250. See Intel PXA250 and */
|
||||
/* PXA210 Processors Specification Update, */
|
||||
/* Jan 2003, Errata #116, page 30. */
|
||||
|
||||
|
||||
ldr r3, =CFG_DRAM_BASE
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
|
||||
/* Step 4g: Write MDCNFG with enable bits asserted */
|
||||
/* (MDCNFG:DEx set to 1). */
|
||||
|
||||
ldr r3, [r1, #MDCNFG_OFFSET]
|
||||
orr r3, r3, #(MDCNFG_DE0|MDCNFG_DE1)
|
||||
str r3, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
/* Step 4h: Write MDMRS. */
|
||||
|
||||
ldr r2, =CFG_MDMRS_VAL
|
||||
str r2, [r1, #MDMRS_OFFSET]
|
||||
|
||||
|
||||
/* We are finished with Intel's memory controller initialisation */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Disable (mask) all interrupts at interrupt controller */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
initirqs:
|
||||
|
||||
mov r1, #0 /* clear int. level register (IRQ, not FIQ) */
|
||||
ldr r2, =ICLR
|
||||
str r1, [r2]
|
||||
|
||||
ldr r2, =ICMR /* mask all interrupts at the controller */
|
||||
str r1, [r2]
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Clock initialisation */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
initclks:
|
||||
|
||||
/* Disable the peripheral clocks, and set the core clock frequency */
|
||||
/* (hard-coding at 398.12MHz for now). */
|
||||
|
||||
/* Turn Off ALL on-chip peripheral clocks for re-configuration */
|
||||
/* Note: See label 'ENABLECLKS' for the re-enabling */
|
||||
ldr r1, =CKEN
|
||||
mov r2, #0
|
||||
str r2, [r1]
|
||||
|
||||
|
||||
/* default value in case no valid rotary switch setting is found */
|
||||
ldr r2, =(CCCR_L27|CCCR_M2|CCCR_N10) /* DEFAULT: {200/200/100} */
|
||||
|
||||
/* ... and write the core clock config register */
|
||||
ldr r1, =CCCR
|
||||
str r2, [r1]
|
||||
|
||||
/* 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
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Save SDRAM size */
|
||||
ldr r1, =DRAM_SIZE
|
||||
str r8, [r1]
|
||||
|
||||
/* Interrupt init: Mask all interrupts */
|
||||
ldr r0, =ICMR /* enable no sources */
|
||||
mov r1, #0
|
||||
str r1, [r0]
|
||||
|
||||
/* FIXME */
|
||||
|
||||
#ifndef DEBUG
|
||||
/*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
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* End memsetup */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
endmemsetup:
|
||||
|
||||
mov pc, lr
|
||||
|
||||
55
board/logodl/u-boot.lds
Normal file
55
board/logodl/u-boot.lds
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/pxa/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
bss_end = .;
|
||||
|
||||
armboot_end = .;
|
||||
}
|
||||
@@ -50,6 +50,14 @@ int board_init (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_post_init(void)
|
||||
{
|
||||
setenv("stdout", "serial");
|
||||
setenv("stderr", "serial");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int dram_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -83,6 +83,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -65,6 +65,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
* (C) Copyright 2001, Stuart Hughes, Lineo Inc, stuarth@lineo.com
|
||||
* Added support for the 16M dram simm on the 8260ads boards
|
||||
*
|
||||
* (C) Copyright 2003 Arabella Software Ltd.
|
||||
* Yuli Barcohen <yuli@arabellasw.com>
|
||||
* Added support for SDRAM DIMMs SPD EEPROM, MII, Ethernet PHY init.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
@@ -33,6 +37,7 @@
|
||||
#include <mpc8260.h>
|
||||
#include <i2c.h>
|
||||
#include <spd.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
/*
|
||||
* I/O Port configuration table
|
||||
@@ -129,8 +134,8 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
/* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
|
||||
/* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
|
||||
/* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK13) */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK14) */
|
||||
/* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
|
||||
/* PC15 */ { 0, 0, 0, 1, 0, 0 }, /* PC15 */
|
||||
@@ -138,8 +143,8 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
/* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
|
||||
/* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
|
||||
/* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
|
||||
/* PC10 */ { 1, 1, 0, 0, 0, 0 }, /* LXT970 FETHMDC */
|
||||
/* PC9 */ { 1, 1, 0, 0, 0, 0 }, /* LXT970 FETHMDIO */
|
||||
/* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* LXT970 FETHMDC */
|
||||
/* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* LXT970 FETHMDIO */
|
||||
/* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
|
||||
/* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
|
||||
/* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
|
||||
@@ -153,8 +158,8 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port D */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
|
||||
/* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
|
||||
/* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 UART RxD */
|
||||
/* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 UART TxD */
|
||||
/* PD29 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
|
||||
/* PD28 */ { 0, 1, 0, 0, 0, 0 }, /* PD28 */
|
||||
/* PD27 */ { 0, 1, 1, 1, 0, 0 }, /* PD27 */
|
||||
@@ -169,14 +174,14 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
/* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
|
||||
/* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
|
||||
/* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
|
||||
/* 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 */ { 1, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
|
||||
/* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
|
||||
/* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
|
||||
@@ -188,32 +193,33 @@ const iop_conf_t iop_conf_tab[4][32] = {
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct bscr_ {
|
||||
unsigned long bcsr0;
|
||||
unsigned long bcsr1;
|
||||
unsigned long bcsr2;
|
||||
unsigned long bcsr3;
|
||||
unsigned long bcsr4;
|
||||
unsigned long bcsr5;
|
||||
unsigned long bcsr6;
|
||||
unsigned long bcsr7;
|
||||
} bcsr_t;
|
||||
|
||||
void reset_phy (void)
|
||||
{
|
||||
volatile bcsr_t *bcsr = (bcsr_t *) CFG_BCSR;
|
||||
vu_long *bcsr = (vu_long *)CFG_BCSR;
|
||||
|
||||
/* reset the FEC port */
|
||||
bcsr->bcsr1 &= ~FETH_RST;
|
||||
bcsr->bcsr1 |= FETH_RST;
|
||||
bcsr[1] &= ~FETH_RST;
|
||||
udelay(2);
|
||||
bcsr[1] |= FETH_RST;
|
||||
udelay(1000);
|
||||
#ifdef CONFIG_MII
|
||||
/*
|
||||
* Ethernet PHY is configured (by means of configuration pins)
|
||||
* to work at 10Mb/s only. We reconfigure it using MII
|
||||
* to advertise all capabilities, including 100Mb/s, and
|
||||
* restart autonegotiation.
|
||||
*/
|
||||
miiphy_write(0, PHY_ANAR, 0x01E1); /* Advertise all capabilities */
|
||||
miiphy_write(0, PHY_DCR, 0x0000); /* Do not bypass Rx/Tx (de)scrambler */
|
||||
miiphy_write(0, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#endif /* CONFIG_MII */
|
||||
}
|
||||
|
||||
|
||||
int board_pre_init (void)
|
||||
{
|
||||
volatile bcsr_t *bcsr = (bcsr_t *) CFG_BCSR;
|
||||
vu_long *bcsr = (vu_long *)CFG_BCSR;
|
||||
|
||||
bcsr->bcsr1 = ~FETHIEN & ~RS232EN_1;
|
||||
bcsr[1] = ~FETHIEN & ~RS232EN_1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
* PSDMR_BUFCMD adds a clock
|
||||
* 0 no extra clock
|
||||
*/
|
||||
#define CONFIG_PBI 0
|
||||
#define CONFIG_PBI PSDMR_PBI
|
||||
#define PESSIMISTIC_SDRAM 0
|
||||
#define EAMUX 0 /* EST requires EAMUX */
|
||||
#define BUFCMD 0
|
||||
@@ -379,6 +379,25 @@ long int initdram(int board_type)
|
||||
|
||||
|
||||
sdram_size = 1 << (rows + cols + banks + width);
|
||||
/* hack for high density memory (512MB per CS) */
|
||||
/* !!!!! Will ONLY work with Page Based Interleave !!!!!
|
||||
( PSDMR[PBI] = 1 )
|
||||
*/
|
||||
/* mamory actually has 11 column addresses, but the memory controller
|
||||
doesn't really care.
|
||||
the calculations that follow will however move the rows so that
|
||||
they are muxed one bit off if you use 11 bit columns.
|
||||
The solution is to tell the memory controller the correct size of the memory
|
||||
but change the number of columns to 10 afterwards.
|
||||
The 11th column addre will still be mucxed correctly onto the bus.
|
||||
|
||||
Also be aware that the MPC8266ADS board Rev B has not connected
|
||||
Row addres 13 to anything.
|
||||
|
||||
The fix is to connect ADD16 (from U37-47) to SADDR12 (U28-126)
|
||||
*/
|
||||
if (cols > 10)
|
||||
cols = 10;
|
||||
|
||||
#if(CONFIG_PBI == 0) /* bank-based interleaving */
|
||||
rowst = ((32 - 6) - (rows + cols + width)) * 2;
|
||||
|
||||
@@ -60,6 +60,7 @@ SECTIONS
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
|
||||
@@ -45,7 +45,11 @@ extern int gunzip (void *, int, unsigned char *, int *);
|
||||
extern int mem_test(unsigned long start, unsigned long ramsize, int quiet);
|
||||
|
||||
#define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */
|
||||
#if defined(CONFIG_PIP405) || defined(CONFIG_MIP405)
|
||||
#define IMAGE_SIZE 0x80000
|
||||
#elif defined(CONFIG_VCMA9)
|
||||
#define IMAGE_SIZE 0x40000 /* ugly, but it works for now */
|
||||
#endif
|
||||
|
||||
extern flash_info_t flash_info[]; /* info for FLASH chips */
|
||||
|
||||
@@ -59,6 +63,7 @@ int mpl_prg(unsigned long src,unsigned long size)
|
||||
flash_info_t *info;
|
||||
int i,rc;
|
||||
#if defined(CONFIG_PIP405) || defined(CONFIG_MIP405)
|
||||
char *copystr = (char *)src;
|
||||
unsigned long *magic = (unsigned long *)src;
|
||||
#endif
|
||||
|
||||
@@ -69,8 +74,25 @@ int mpl_prg(unsigned long src,unsigned long size)
|
||||
printf("Bad Magic number\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
start = 0 - size;
|
||||
/* some more checks before we delete the Flash... */
|
||||
/* Checking the ISO_STRING prevents to program a
|
||||
* wrong Firmware Image into the flash.
|
||||
*/
|
||||
i=4; /* skip Magic number */
|
||||
while(1) {
|
||||
if(strncmp(©str[i],"MEV-",4)==0)
|
||||
break;
|
||||
if(i++>=0x100) {
|
||||
printf("Firmware Image for unknown Target\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* we have the ISO STRING, check */
|
||||
if(strncmp(©str[i],CONFIG_ISO_STRING,sizeof(CONFIG_ISO_STRING)-1)!=0) {
|
||||
printf("Wrong Firmware Image: %s\n",©str[i]);
|
||||
return -1;
|
||||
}
|
||||
start = 0 - size;
|
||||
for(i=info->sector_count-1;i>0;i--)
|
||||
{
|
||||
info->protect[i] = 0; /* unprotect this sector */
|
||||
|
||||
@@ -108,17 +108,23 @@ static struct pci_pip405_config_entry piix4_isa_bridge_f0[] = {
|
||||
/* PIIX4 IDE Controller Function 1 */
|
||||
static struct pci_pip405_config_entry piix4_ide_cntrl_f1[] = {
|
||||
{PCI_COMMAND, 0x0001, 2}, /* enable IO access */
|
||||
#if !defined(CONFIG_MIP405T)
|
||||
{PCI_CFG_PIIX4_IDETIM, 0x80008000, 4}, /* enable Both IDE channels */
|
||||
#else
|
||||
{PCI_CFG_PIIX4_IDETIM, 0x80000000, 4}, /* enable IDE channel0 */
|
||||
#endif
|
||||
{ } /* end of device table */
|
||||
};
|
||||
|
||||
/* PIIX4 USB Controller Function 2 */
|
||||
static struct pci_pip405_config_entry piix4_usb_cntrl_f2[] = {
|
||||
#if !defined(CONFIG_MIP405T)
|
||||
{PCI_INTERRUPT_LINE, 31, 1}, /* Int vector = 31 */
|
||||
{PCI_BASE_ADDRESS_4, 0x0000E001, 4}, /* Set IO Address to 0xe000 to 0xe01F */
|
||||
{PCI_LATENCY_TIMER, 0x80, 1}, /* Latency Timer 0x80 */
|
||||
{0xC0, 0x2000, 2}, /* Legacy support */
|
||||
{PCI_COMMAND, 0x0005, 2}, /* enable IO access and Master */
|
||||
#endif
|
||||
{ } /* end of device table */
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user