mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Compare commits
16 Commits
LABEL_2004
...
LABEL_2004
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
998eaaecd4 | ||
|
|
6e5923851e | ||
|
|
c26e454dfc | ||
|
|
ea66bc8804 | ||
|
|
db01a2ea99 | ||
|
|
bda6c8aece | ||
|
|
a3d991bd0d | ||
|
|
a6ab4bf978 | ||
|
|
5a8c51cd5e | ||
|
|
04a85b3b36 | ||
|
|
d716b12671 | ||
|
|
56b86bf0cd | ||
|
|
f525c8a147 | ||
|
|
17d704eb95 | ||
|
|
7e780369e4 | ||
|
|
0608e04da9 |
86
CHANGELOG
86
CHANGELOG
@@ -1,6 +1,90 @@
|
||||
======================================================================
|
||||
Changes for U-Boot 1.0.2:
|
||||
Changes for U-Boot 1.1.1:
|
||||
======================================================================
|
||||
|
||||
* Configure PPChameleon board to use redundand environment in flash
|
||||
|
||||
* Configure PPChameleon board to use JFFS2 NAND support.
|
||||
|
||||
* Added support for JFFS2 filesystem (read-only) on top of NAND flash
|
||||
|
||||
* Patch by Rune Torgersen, 16 Apr 2004:
|
||||
LBA48 fixes
|
||||
|
||||
* Patches by Pantelis Antoniou, 16 Apr 2004:
|
||||
- add support for a new version of an Intracom board and fix
|
||||
various other things on others.
|
||||
- add verify support to the crc32 command (define
|
||||
CONFIG_CRC32_VERIFY to enable it)
|
||||
- fix FEC driver for MPC8xx systems:
|
||||
1. fix compilation problems for boards that use dynamic
|
||||
allocation of DPRAM
|
||||
2. shut down FEC after network transfers
|
||||
- HUSH parser fixes:
|
||||
1. A new test command was added. This is a simplified version of
|
||||
the one in the bourne shell.
|
||||
2. A new exit command was added which terminates the current
|
||||
executing script.
|
||||
3. Fixed handing of $? (exit code of last executed command)
|
||||
- Fix some compile problems;
|
||||
add "once" functionality for the netretry variable
|
||||
|
||||
* Patch by George G. Davis, 02 Apr 2004:
|
||||
add support for Intel Assabet board
|
||||
|
||||
* Patch by Stephen Williams, 01 Apr 2004:
|
||||
Add support for Picture Elements JSE board
|
||||
|
||||
* Patch by Christian Pell, 01 Apr 2004:
|
||||
Add CompactFlash support for PXA systems.
|
||||
|
||||
* Patches by Pantelis Antoniou, 30 Mar 2004:
|
||||
- add auto-complete support to the U-Boot CLI
|
||||
- add support for NETTA and NETPHONE boards; fix NETVIA board
|
||||
- add support for the Epson 156x series of graphical displays
|
||||
(These displays are serial and not suitable for using a normal
|
||||
framebuffer console on them)
|
||||
- add infrastructure needed in order to POST any DSPs in a board
|
||||
- improve and fix various things in the MPC8xx FEC driver:
|
||||
1. The new 87x and 88x series of processors have two FECs,
|
||||
and the new driver supports them both.
|
||||
2. Another change in the 87x/88x series is support for
|
||||
the RMII (Reduced MII) interface. However numerous
|
||||
changes are needed to make it work since the PHYs
|
||||
are connected to the same lines. That means that
|
||||
you have to address them correctly over the MII
|
||||
interface.
|
||||
3. We now correctly match the MII/RMII interface
|
||||
configuration to what the PHY reports.
|
||||
- Fix problem when readingthe MII status register. Due to the
|
||||
internal design of many PHYs you have to read the register
|
||||
twice. The problem is more apparent in 10Mbit mode.
|
||||
- add new mode ".jffs2s" for reading from a NAND device: it just
|
||||
skips over bad blocks.
|
||||
- add networking support for VLANs (802.1q), and CDP (Cisco
|
||||
Discovery Protocol)
|
||||
- some minor patches / cleanup
|
||||
|
||||
* Patch by Yuli Barcohen, 28 Mar 2004:
|
||||
- Add support for MPC8272 family including MPC8247/8248/8271/8272
|
||||
- Add support for MPC8272ADS evaluation board (another flavour of MPC8260ADS)
|
||||
- Change configuration method for MPC8260ADS family
|
||||
|
||||
* add startup code to clear the BSS of standalone applications
|
||||
|
||||
* Fix if / elif handling bug in HUSH shell
|
||||
|
||||
======================================================================
|
||||
Changes for U-Boot 1.1.0:
|
||||
======================================================================
|
||||
|
||||
* Patch by Mark Jonas: Remove config.tmp files only when
|
||||
unconfiguring the board
|
||||
|
||||
* Adapt RMU board for bigger flash memory
|
||||
|
||||
* Patch by Klaus Heydeck, 13 Mar 2003:
|
||||
Add support for KUP4X Board
|
||||
|
||||
* Patch by Pavel Bartusek, 21 Mar 2004
|
||||
Add Reiserfs support
|
||||
|
||||
12
CREDITS
12
CREDITS
@@ -28,12 +28,18 @@ D: ERIC Support
|
||||
|
||||
N: Pantelis Antoniou
|
||||
E: panto@intracom.gr
|
||||
D: NETVIA board support, ARTOS support.
|
||||
D: NETVIA & NETPHONE board support, ARTOS support.
|
||||
|
||||
N: Pierre Aubert
|
||||
E: <p.aubert@staubli.com>
|
||||
D: Support for RPXClassic board
|
||||
|
||||
N: Yuli Barcohen
|
||||
E: yuli@arabellasw.com
|
||||
D: Unified support for Motorola MPC826xADS/MPC8272ADS/PQ2FADS boards.
|
||||
D: Support for Zephyr Engineering ZPC.1900 board.
|
||||
W: http://www.arabellasw.com
|
||||
|
||||
N: Jerry van Baren
|
||||
E: <vanbaren@cideas.com>
|
||||
D: BedBug port to 603e core (MPC82xx). Code for enhanced memory test.
|
||||
@@ -83,6 +89,10 @@ N: Magnus Damm
|
||||
E: damm@opensource.se
|
||||
D: 8xxrom
|
||||
|
||||
N: George G. Davis
|
||||
E: gdavis@mvista.com
|
||||
D: Board ports for ADS GraphicsClient+ and Intel Assabet
|
||||
|
||||
N: Arun Dharankar
|
||||
E: ADharankar@ATTBI.Com
|
||||
D: threads / scheduler example code
|
||||
|
||||
@@ -27,6 +27,7 @@ Pantelis Antoniou <panto@intracom.gr>
|
||||
|
||||
Yuli Barcohen <yuli@arabellasw.com>
|
||||
|
||||
MPC8260ADS MPC826x/MPC827x/MPC8280
|
||||
ZPC1900 MPC8265
|
||||
|
||||
Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
|
||||
@@ -146,6 +147,7 @@ Bill Hargen <Bill_Hargen@Jabil.com>
|
||||
Klaus Heydeck <heydeck@kieback-peter.de>
|
||||
|
||||
KUP4K MPC855
|
||||
KUP4X MPC859
|
||||
|
||||
Murray Jensen <Murray.Jensen@cmst.csiro.au>
|
||||
|
||||
@@ -284,7 +286,6 @@ Unknown / orphaned boards:
|
||||
|
||||
MOUSSE MPC824x
|
||||
|
||||
MPC8260ADS MPC8260
|
||||
RPXsuper MPC8260
|
||||
rsdproto MPC8260
|
||||
|
||||
@@ -298,6 +299,11 @@ Unknown / orphaned boards:
|
||||
# Board CPU #
|
||||
#########################################################################
|
||||
|
||||
George G. Davis <gdavis@mvista.com>
|
||||
|
||||
assabet SA1100
|
||||
gcplus SA1100
|
||||
|
||||
Thomas Elste <info@elste.org>
|
||||
|
||||
modnet50 ARM720T (NET+50)
|
||||
|
||||
39
MAKEALL
39
MAKEALL
@@ -40,15 +40,15 @@ LIST_8xx=" \
|
||||
GEN860T_SC GENIETV GTH hermes \
|
||||
IAD210 ICU862_100MHz IP860 IVML24 \
|
||||
IVML24_128 IVML24_256 IVMS8 IVMS8_128 \
|
||||
IVMS8_256 KUP4K LANTEC lwmon \
|
||||
MBX MBX860T MHPC MPC86xADS \
|
||||
MVS1 NETVIA NETVIA_V2 NX823 \
|
||||
pcu_e QS823 QS850 QS860T \
|
||||
R360MPI RBC823 rmu RPXClassic \
|
||||
RPXlite RRvision SM850 SPD823TS \
|
||||
svm_sc8xx SXNI855T TOP860 TQM823L \
|
||||
TQM823L_LCD TQM850L TQM855L TQM860L \
|
||||
v37 \
|
||||
IVMS8_256 KUP4K KUP4X LANTEC \
|
||||
lwmon MBX MBX860T MHPC \
|
||||
MPC86xADS MVS1 NETVIA NETVIA_V2 \
|
||||
NX823 pcu_e QS823 QS850 \
|
||||
QS860T R360MPI RBC823 rmu \
|
||||
RPXClassic RPXlite RRvision SM850 \
|
||||
SPD823TS svm_sc8xx SXNI855T TOP860 \
|
||||
TQM823L TQM823L_LCD TQM850L TQM855L \
|
||||
TQM860L v37 NETTA NETPHONE \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -60,11 +60,12 @@ LIST_4xx=" \
|
||||
CANBT CPCI405 CPCI4052 CPCI405AB \
|
||||
CPCI440 CPCIISER4 CRAYL1 csb272 \
|
||||
DASA_SIM DP405 DU405 EBONY \
|
||||
ERIC EXBITGEN HUB405 MIP405 \
|
||||
MIP405T ML2 ml300 OCOTEA \
|
||||
OCRTC ORSG PCI405 PIP405 \
|
||||
PLU405 PMC405 PPChameleonEVB VOH405 \
|
||||
W7OLMC W7OLMG WALNUT405 XPEDITE1K \
|
||||
ERIC EXBITGEN HUB405 JSE \
|
||||
MIP405 MIP405T ML2 ml300 \
|
||||
OCOTEA OCRTC ORSG PCI405 \
|
||||
PIP405 PLU405 PMC405 PPChameleonEVB \
|
||||
VOH405 W7OLMC W7OLMG WALNUT405 \
|
||||
XPEDITE1K \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -85,10 +86,10 @@ LIST_824x=" \
|
||||
LIST_8260=" \
|
||||
atc cogent_mpc8260 CPU86 ep8260 \
|
||||
gw8260 hymod IPHASE4539 MPC8260ADS \
|
||||
MPC8266ADS PM826 PM828 ppmc8260 \
|
||||
RPXsuper rsdproto sacsng sbc8260 \
|
||||
SCM TQM8260_AC TQM8260_AD TQM8260_AE \
|
||||
ZPC1900 \
|
||||
MPC8266ADS MPC8272ADS PM826 PM828 \
|
||||
ppmc8260 PQ2FADS RPXsuper rsdproto \
|
||||
sacsng sbc8260 SCM TQM8260_AC \
|
||||
TQM8260_AD TQM8260_AE ZPC1900 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -123,7 +124,7 @@ LIST_ppc="${LIST_5xx} ${LIST_5xxx} \
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_SA="dnp1110 gcplus lart shannon"
|
||||
LIST_SA="assabet dnp1110 gcplus lart shannon"
|
||||
|
||||
#########################################################################
|
||||
## ARM7 Systems
|
||||
|
||||
101
Makefile
101
Makefile
@@ -166,6 +166,9 @@ depend dep:
|
||||
|
||||
tags:
|
||||
ctags -w `find $(SUBDIRS) include \
|
||||
lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
|
||||
fs/cramfs fs/fat fs/fdos fs/jffs2 \
|
||||
net disk rtc dtt drivers drivers/sk98lin common \
|
||||
\( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
|
||||
|
||||
etags:
|
||||
@@ -187,7 +190,7 @@ endif
|
||||
#########################################################################
|
||||
|
||||
unconfig:
|
||||
rm -f include/config.h include/config.mk
|
||||
@rm -f include/config.h include/config.mk board/*/config.tmp
|
||||
|
||||
#========================================================================
|
||||
# PowerPC
|
||||
@@ -200,7 +203,7 @@ unconfig:
|
||||
cmi_mpc5xx_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc5xx cmi
|
||||
|
||||
PATI_config:unconfig
|
||||
PATI_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc5xx pati mpl
|
||||
|
||||
#########################################################################
|
||||
@@ -217,13 +220,17 @@ icecube_5200_config \
|
||||
IceCube_5200_config \
|
||||
IceCube_5100_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring LOWBOOT,$@)" ] || \
|
||||
{ echo "TEXT_BASE = 0xFF000000" >board/icecube/config.tmp ; \
|
||||
@[ -z "$(findstring LOWBOOT_,$@)" ] || \
|
||||
{ if [ "$(findstring DDR,$@)" ] ; \
|
||||
then echo "TEXT_BASE = 0xFF800000" >board/icecube/config.tmp ; \
|
||||
else echo "TEXT_BASE = 0xFF000000" >board/icecube/config.tmp ; \
|
||||
fi ; \
|
||||
echo "... with LOWBOOT configuration" ; \
|
||||
}
|
||||
@[ -z "$(findstring LOWBOOT08,$@)" ] || \
|
||||
{ echo "TEXT_BASE = 0xFF800000" >board/icecube/config.tmp ; \
|
||||
echo "... with 8 MB flash only" ; \
|
||||
echo "... with LOWBOOT configuration" ; \
|
||||
}
|
||||
@[ -z "$(findstring DDR,$@)" ] || \
|
||||
{ echo "#define CONFIG_MPC5200_DDR" >>include/config.h ; \
|
||||
@@ -358,7 +365,10 @@ IVMS8_config: unconfig
|
||||
@./mkconfig -a IVMS8 ppc mpc8xx ivm
|
||||
|
||||
KUP4K_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx kup4k
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx kup4k kup
|
||||
|
||||
KUP4X_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx kup4x kup
|
||||
|
||||
LANTEC_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx lantec
|
||||
@@ -391,6 +401,32 @@ NETVIA_config: unconfig
|
||||
}
|
||||
@./mkconfig -a $(call xtract_NETVIA,$@) ppc mpc8xx netvia
|
||||
|
||||
xtract_NETPHONE = $(subst _V2,,$(subst _config,,$1))
|
||||
|
||||
NETPHONE_V2_config \
|
||||
NETPHONE_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring NETPHONE_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NETPHONE_VERSION 1" >>include/config.h ; \
|
||||
}
|
||||
@[ -z "$(findstring NETPHONE_V2_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NETPHONE_VERSION 2" >>include/config.h ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_NETPHONE,$@) ppc mpc8xx netphone
|
||||
|
||||
xtract_NETTA = $(subst _ISDN,,$(subst _config,,$1))
|
||||
|
||||
NETTA_ISDN_config \
|
||||
NETTA_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring NETTA_config,$@)" ] || \
|
||||
{ echo "#undef CONFIG_NETTA_ISDN" >>include/config.h ; \
|
||||
}
|
||||
@[ -z "$(findstring NETTA_ISDN_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NETTA_ISDN 1" >>include/config.h ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_NETTA,$@) ppc mpc8xx netta
|
||||
|
||||
NX823_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx nx823
|
||||
|
||||
@@ -543,7 +579,7 @@ AR405_config: unconfig
|
||||
ASH405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ash405 esd
|
||||
|
||||
BUBINGA405EP_config:unconfig
|
||||
BUBINGA405EP_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx bubinga405ep
|
||||
|
||||
CANBT_config: unconfig
|
||||
@@ -561,7 +597,7 @@ CPCI440_config: unconfig
|
||||
CPCIISER4_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx cpciiser4 esd
|
||||
|
||||
CRAYL1_config:unconfig
|
||||
CRAYL1_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx L1 cray
|
||||
|
||||
csb272_config: unconfig
|
||||
@@ -576,33 +612,36 @@ DP405_config: unconfig
|
||||
DU405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx du405 esd
|
||||
|
||||
EBONY_config:unconfig
|
||||
EBONY_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ebony
|
||||
|
||||
ERIC_config:unconfig
|
||||
ERIC_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx eric
|
||||
|
||||
EXBITGEN_config:unconfig
|
||||
EXBITGEN_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx exbitgen
|
||||
|
||||
HUB405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx hub405 esd
|
||||
|
||||
MIP405_config:unconfig
|
||||
JSE_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx jse
|
||||
|
||||
MIP405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx mip405 mpl
|
||||
|
||||
MIP405T_config:unconfig
|
||||
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
|
||||
ML2_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ml2
|
||||
|
||||
ml300_config:unconfig
|
||||
ml300_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ml300 xilinx
|
||||
|
||||
OCOTEA_config:unconfig
|
||||
OCOTEA_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ocotea
|
||||
|
||||
OCRTC_config \
|
||||
@@ -612,7 +651,7 @@ ORSG_config: unconfig
|
||||
PCI405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx pci405 esd
|
||||
|
||||
PIP405_config:unconfig
|
||||
PIP405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx pip405 mpl
|
||||
|
||||
PLU405_config: unconfig
|
||||
@@ -647,10 +686,10 @@ W7OLMC_config \
|
||||
W7OLMG_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx w7o
|
||||
|
||||
WALNUT405_config:unconfig
|
||||
WALNUT405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx walnut405
|
||||
|
||||
XPEDITE1K_config:unconfig
|
||||
XPEDITE1K_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx xpedite1k
|
||||
|
||||
#########################################################################
|
||||
@@ -745,8 +784,23 @@ hymod_config: unconfig
|
||||
IPHASE4539_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 iphase4539
|
||||
|
||||
MPC8260ADS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 mpc8260ads
|
||||
MPC8260ADS_config \
|
||||
MPC8260ADS_33MHz_config \
|
||||
MPC8260ADS_40MHz_config \
|
||||
MPC8272ADS_config \
|
||||
PQ2FADS_config \
|
||||
PQ2FADS-VR_config \
|
||||
PQ2FADS-ZU_config \
|
||||
PQ2FADS-ZU_66MHz_config \
|
||||
: unconfig
|
||||
$(if $(findstring PQ2FADS,$@), \
|
||||
@echo "#define CONFIG_ADSTYPE CFG_PQ2FADS" > include/config.h, \
|
||||
@echo "#define CONFIG_ADSTYPE CFG_"$(subst MPC,,$(word 1,$(subst _, ,$@))) > include/config.h)
|
||||
$(if $(findstring MHz,$@), \
|
||||
@echo "#define CONFIG_8260_CLKIN" $(subst MHz,,$(word 2,$(subst _, ,$@)))"000000" >> include/config.h, \
|
||||
$(if $(findstring VR,$@), \
|
||||
@echo "#define CONFIG_8260_CLKIN 66000000" >> include/config.h))
|
||||
@./mkconfig -a MPC8260ADS ppc mpc8260 mpc8260ads
|
||||
|
||||
MPC8266ADS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 mpc8266ads
|
||||
@@ -933,6 +987,9 @@ ZUMA_config: unconfig
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
assabet_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 assabet
|
||||
|
||||
dnp1110_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 dnp1110
|
||||
|
||||
@@ -1222,13 +1279,13 @@ clean:
|
||||
rm -f examples/hello_world examples/timer \
|
||||
examples/eepro100_eeprom examples/sched \
|
||||
examples/mem_to_mem_idma2intr examples/82559_eeprom
|
||||
|
||||
rm -f tools/img2srec tools/mkimage tools/envcrc tools/gen_eth_addr
|
||||
rm -f tools/mpc86x_clk
|
||||
rm -f tools/easylogo/easylogo tools/bmp_logo
|
||||
rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
|
||||
rm -f tools/env/fw_printenv tools/env/fw_setenv
|
||||
rm -f board/cray/L1/bootscript.c board/cray/L1/bootscript.image
|
||||
rm -f board/trab/trab_fkt board/*/config.tmp
|
||||
rm -f board/trab/trab_fkt
|
||||
|
||||
clobber: clean
|
||||
find . -type f \
|
||||
|
||||
49
board/assabet/Makefile
Normal file
49
board/assabet/Makefile
Normal file
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# 2004 (c) MontaVista Software, Inc.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := assabet.o
|
||||
SOBJS := setup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS) $(SOBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
121
board/assabet/assabet.c
Normal file
121
board/assabet/assabet.c
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* 2004 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <SA-1100.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Board dependent initialisation
|
||||
*/
|
||||
|
||||
#define ECOR 0x8000
|
||||
#define ECOR_RESET 0x80
|
||||
#define ECOR_LEVEL_IRQ 0x40
|
||||
#define ECOR_WR_ATTRIB 0x04
|
||||
#define ECOR_ENABLE 0x01
|
||||
|
||||
#define ECSR 0x8002
|
||||
#define ECSR_IOIS8 0x20
|
||||
#define ECSR_PWRDWN 0x04
|
||||
#define ECSR_INT 0x02
|
||||
#define SMC_IO_SHIFT 2
|
||||
#define NCR_0 (*((volatile u_char *)(0x100000a0)))
|
||||
#define NCR_ENET_OSC_EN (1<<3)
|
||||
|
||||
static inline u8
|
||||
readb(volatile u8 * p)
|
||||
{
|
||||
return *p;
|
||||
}
|
||||
|
||||
static inline void
|
||||
writeb(u8 v, volatile u8 * p)
|
||||
{
|
||||
*p = v;
|
||||
}
|
||||
|
||||
static void
|
||||
smc_init(void)
|
||||
{
|
||||
u8 ecor;
|
||||
u8 ecsr;
|
||||
volatile u8 *addr = (volatile u8 *)(0x18000000 + (1 << 25));
|
||||
|
||||
NCR_0 |= NCR_ENET_OSC_EN;
|
||||
udelay(100);
|
||||
|
||||
ecor = readb(addr + (ECOR << SMC_IO_SHIFT)) & ~ECOR_RESET;
|
||||
writeb(ecor | ECOR_RESET, addr + (ECOR << SMC_IO_SHIFT));
|
||||
udelay(100);
|
||||
|
||||
/*
|
||||
* The device will ignore all writes to the enable bit while
|
||||
* reset is asserted, even if the reset bit is cleared in the
|
||||
* same write. Must clear reset first, then enable the device.
|
||||
*/
|
||||
writeb(ecor, addr + (ECOR << SMC_IO_SHIFT));
|
||||
writeb(ecor | ECOR_ENABLE, addr + (ECOR << SMC_IO_SHIFT));
|
||||
|
||||
/*
|
||||
* Set the appropriate byte/word mode.
|
||||
*/
|
||||
ecsr = readb(addr + (ECSR << SMC_IO_SHIFT)) & ~ECSR_IOIS8;
|
||||
ecsr |= ECSR_IOIS8;
|
||||
writeb(ecsr, addr + (ECSR << SMC_IO_SHIFT));
|
||||
udelay(100);
|
||||
}
|
||||
|
||||
static void
|
||||
neponset_init(void)
|
||||
{
|
||||
smc_init();
|
||||
}
|
||||
|
||||
int
|
||||
board_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_arch_number = 25; /* Intel Assabet Board */
|
||||
gd->bd->bi_boot_params = 0xc0000100;
|
||||
|
||||
neponset_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dram_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
7
board/assabet/config.mk
Normal file
7
board/assabet/config.mk
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# SA-1110 based Intel Assabet board
|
||||
#
|
||||
# The Intel Assabet 1 bank of 32 MiB SDRAM
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xc1f00000
|
||||
136
board/assabet/setup.S
Normal file
136
board/assabet/setup.S
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Memory Setup stuff - taken from blob memsetup.S
|
||||
*
|
||||
* Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
|
||||
* Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
|
||||
* 2004 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Board defines:
|
||||
*/
|
||||
|
||||
#define MDCNFG 0x00
|
||||
#define MDCAS00 0x04
|
||||
#define MDCAS01 0x08
|
||||
#define MDCAS02 0x0C
|
||||
#define MSC0 0x10
|
||||
#define MSC1 0x14
|
||||
#define MECR 0x18
|
||||
#define MDREFR 0x1C
|
||||
#define MDCAS20 0x20
|
||||
#define MDCAS21 0x24
|
||||
#define MDCAS22 0x28
|
||||
#define MSC2 0x2C
|
||||
#define SMCNFG 0x30
|
||||
|
||||
#define ASSABET_BCR (0x12000000)
|
||||
#define ASSABET_BCR_DB1110 (0x00a07490 | (0<<16) | (0<<17))
|
||||
#define ASSABET_SCR_nNEPONSET (1 << 9)
|
||||
#define NEPONSET_LEDS (0x10000010)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Setup parameters for the board:
|
||||
*/
|
||||
|
||||
|
||||
MEM_BASE: .long 0xa0000000
|
||||
MEM_START: .long 0xc0000000
|
||||
|
||||
mdcnfg: .long 0x72547254
|
||||
mdcas00: .long 0xaaaaaa7f
|
||||
mdcas01: .long 0xaaaaaaaa
|
||||
mdcas02: .long 0xaaaaaaaa
|
||||
msc0: .long 0x4b384370
|
||||
msc1: .long 0x22212419
|
||||
mecr: .long 0x994a994a
|
||||
mdrefr: .long 0x04340327
|
||||
mdcas20: .long 0xaaaaaa7f
|
||||
mdcas21: .long 0xaaaaaaaa
|
||||
mdcas22: .long 0xaaaaaaaa
|
||||
msc2: .long 0x42196669
|
||||
smcnfg: .long 0x00000000
|
||||
|
||||
BCR: .long ASSABET_BCR
|
||||
BCR_DB1110: .long ASSABET_BCR_DB1110
|
||||
LEDS: .long NEPONSET_LEDS
|
||||
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
|
||||
/* Setting up the memory and stuff */
|
||||
|
||||
ldr r0, MEM_BASE
|
||||
ldr r1, mdcas00
|
||||
str r1, [r0, #MDCAS00]
|
||||
ldr r1, mdcas01
|
||||
str r1, [r0, #MDCAS01]
|
||||
ldr r1, mdcas02
|
||||
str r1, [r0, #MDCAS02]
|
||||
ldr r1, mdcas20
|
||||
str r1, [r0, #MDCAS20]
|
||||
ldr r1, mdcas21
|
||||
str r1, [r0, #MDCAS21]
|
||||
ldr r1, mdcas22
|
||||
str r1, [r0, #MDCAS22]
|
||||
ldr r1, mdrefr
|
||||
str r1, [r0, #MDREFR]
|
||||
ldr r1, mecr
|
||||
str r1, [r0, #MECR]
|
||||
ldr r1, msc0
|
||||
str r1, [r0, #MSC0]
|
||||
ldr r1, msc1
|
||||
str r1, [r0, #MSC1]
|
||||
ldr r1, msc2
|
||||
str r1, [r0, #MSC2]
|
||||
ldr r1, smcnfg
|
||||
str r1, [r0, #SMCNFG]
|
||||
|
||||
ldr r1, mdcnfg
|
||||
str r1, [r0, #MDCNFG]
|
||||
|
||||
/* Load something to activate bank */
|
||||
ldr r2, MEM_START
|
||||
.rept 8
|
||||
ldr r3, [r2]
|
||||
.endr
|
||||
|
||||
/* Enable SDRAM */
|
||||
orr r1, r1, #0x00000001
|
||||
str r1, [r0, #MDCNFG]
|
||||
|
||||
ldr r1, BCR
|
||||
ldr r2, BCR_DB1110
|
||||
str r2, [r1]
|
||||
|
||||
ldr r1, LEDS
|
||||
mov r0, #0x3
|
||||
str r0, [r1]
|
||||
|
||||
/* All done... */
|
||||
mov pc, lr
|
||||
57
board/assabet/u-boot.lds
Normal file
57
board/assabet/u-boot.lds
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* 2004 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/sa1100/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -73,9 +73,6 @@ SECTIONS
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
/* . = env_offset;*/
|
||||
/* common/environment.o(.text)*/
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
@@ -142,6 +139,13 @@ SECTIONS
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
|
||||
. = 0xFFFF8000;
|
||||
.ppcenv :
|
||||
{
|
||||
common/environment.o(.ppcenv);
|
||||
}
|
||||
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
@@ -669,8 +669,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((volatile CFG_FLASH_WORD_SIZE *)dest) &
|
||||
(CFG_FLASH_WORD_SIZE)data) != (CFG_FLASH_WORD_SIZE)data) {
|
||||
if ((*((volatile ulong *)dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
|
||||
44
board/jse/Makefile
Normal file
44
board/jse/Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Copyright 2004 Picture Elements, Inc.
|
||||
# Stephen Williams <steve@icarus.com>
|
||||
#
|
||||
# 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 sdram.o flash.o host_bridge.o
|
||||
SOBJS = init.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
48
board/jse/README.txt
Normal file
48
board/jse/README.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
JSE Configuration Details
|
||||
|
||||
Memory Bank 0 -- Flash chip
|
||||
---------------------------
|
||||
|
||||
0xfff00000 - 0xffffffff
|
||||
|
||||
The flash chip is really only 512Kbytes, but the high address bit of
|
||||
the 1Meg region is ignored, so the flash is replicated through the
|
||||
region. Thus, this is consistent with a flash base address 0xfff80000.
|
||||
|
||||
The placement at the end is to be consistent with reset behavior,
|
||||
where the processor itself initially uses this bus to load the branch
|
||||
vector and start running.
|
||||
|
||||
On-Chip Memory
|
||||
--------------
|
||||
|
||||
0xf4000000 - 0xf4000fff
|
||||
|
||||
The 405GPr includes a 4K on-chip memory that can be placed however
|
||||
software chooses. I choose to place the memory at this address, to
|
||||
keep it out of the cachable areas.
|
||||
|
||||
|
||||
Memory Bank 1 -- SystemACE Controller
|
||||
-------------------------------------
|
||||
|
||||
0xf0000000 - 0xf00fffff
|
||||
|
||||
The SystemACE chip is along on peripheral bank CS#1. We don't need
|
||||
much space, but 1Meg is the smallest we can configure the chip to
|
||||
allocate. We need it far away from the flash region, because this
|
||||
region is set to be non-cached.
|
||||
|
||||
|
||||
Internal Peripherals
|
||||
--------------------
|
||||
|
||||
0xef600300 - 0xef6008ff
|
||||
|
||||
These are scattered various peripherals internal to the PPC405GPr
|
||||
chip.
|
||||
|
||||
SDRAM
|
||||
-----
|
||||
|
||||
0x00000000 - 0x07ffffff (128 MBytes)
|
||||
24
board/jse/config.mk
Normal file
24
board/jse/config.mk
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# (C) Copyright 2003 Picture Elements, Inc.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
#
|
||||
# Picture Elements, Inc. JSE boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xFFF80000
|
||||
671
board/jse/flash.c
Normal file
671
board/jse/flash.c
Normal file
@@ -0,0 +1,671 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 4/5/2001
|
||||
* Wait for completion of each sector erase command issued
|
||||
* 4/5/2001
|
||||
* Chris Hallinan - DS4.COM, Inc. - clh@net1plus.com
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ppc4xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#if CFG_MAX_FLASH_BANKS != 1
|
||||
#error "CFG_MAX_FLASH_BANKS must be 1"
|
||||
#endif
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size (vu_long * addr, flash_info_t * info);
|
||||
static int write_word (flash_info_t * info, ulong dest, ulong data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
|
||||
#define ADDR0 0x5555
|
||||
#define ADDR1 0x2aaa
|
||||
#define FLASH_WORD_SIZE unsigned char
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0;
|
||||
unsigned long base_b0;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
flash_info[0].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
size_b0 =
|
||||
flash_get_size ((vu_long *) FLASH_BASE0_PRELIM,
|
||||
&flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", size_b0, size_b0 << 20);
|
||||
}
|
||||
|
||||
/* Only one bank */
|
||||
/* Setup offsets */
|
||||
flash_get_offsets (FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
/* Monitor protection ON by default */
|
||||
(void) flash_protect (FLAG_PROTECT_SET,
|
||||
FLASH_BASE0_PRELIM,
|
||||
FLASH_BASE0_PRELIM + monitor_flash_len - 1,
|
||||
&flash_info[0]);
|
||||
flash_info[0].size = size_b0;
|
||||
|
||||
return size_b0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
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_SST) ||
|
||||
(info->flash_id == FLASH_AM040)) {
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
} else {
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] =
|
||||
base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
int k;
|
||||
int size;
|
||||
int erased;
|
||||
volatile unsigned long *flash;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD:
|
||||
printf ("AMD ");
|
||||
break;
|
||||
case FLASH_MAN_FUJ:
|
||||
printf ("FUJITSU ");
|
||||
break;
|
||||
case FLASH_MAN_SST:
|
||||
printf ("SST ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM040:
|
||||
printf ("AM29F040 (512 Kbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_AM400B:
|
||||
printf ("AM29LV400B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400T:
|
||||
printf ("AM29LV400T (4 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM800B:
|
||||
printf ("AM29LV800B (8 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM800T:
|
||||
printf ("AM29LV800T (8 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM160B:
|
||||
printf ("AM29LV160B (16 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM160T:
|
||||
printf ("AM29LV160T (16 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM320B:
|
||||
printf ("AM29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T:
|
||||
printf ("AM29LV320T (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_SST800A:
|
||||
printf ("SST39LF/VF800 (8 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_SST160A:
|
||||
printf ("SST39LF/VF160 (16 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
/*
|
||||
* Check if whole sector is erased
|
||||
*/
|
||||
if (i != (info->sector_count - 1))
|
||||
size = info->start[i + 1] - info->start[i];
|
||||
else
|
||||
size = info->start[0] + info->size - info->start[i];
|
||||
erased = 1;
|
||||
flash = (volatile unsigned long *) info->start[i];
|
||||
size = size >> 2; /* divide by 4 for longword access */
|
||||
for (k = 0; k < size; k++) {
|
||||
if (*flash++ != 0xffffffff) {
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
#if 0 /* test-only */
|
||||
printf (" %08lX%s",
|
||||
info->start[i], info->protect[i] ? " (RO)" : " "
|
||||
#else
|
||||
printf (" %08lX%s%s",
|
||||
info->start[i],
|
||||
erased ? " E" : " ", info->protect[i] ? "RO " : " "
|
||||
#endif
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (vu_long * addr, flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
FLASH_WORD_SIZE value;
|
||||
ulong base = (ulong) addr;
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *) addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00900090;
|
||||
|
||||
#ifdef CONFIG_ADCIOP
|
||||
value = addr2[2];
|
||||
#else
|
||||
value = addr2[0];
|
||||
#endif
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) SST_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_SST;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ADCIOP
|
||||
value = addr2[0]; /* device ID */
|
||||
/* printf("\ndev_code=%x\n", value); */
|
||||
#else
|
||||
value = addr2[1]; /* device ID */
|
||||
#endif
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_ID_F040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV400T:
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 0.5 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV400B:
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 0.5 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV800T:
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV800B:
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV160T:
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV160B:
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV320T:
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV320B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
#endif
|
||||
case (FLASH_WORD_SIZE) SST_ID_xF800A:
|
||||
info->flash_id += FLASH_SST800A;
|
||||
info->sector_count = 16;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (FLASH_WORD_SIZE) SST_ID_xF160A:
|
||||
info->flash_id += FLASH_SST160A;
|
||||
info->sector_count = 32;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) ||
|
||||
(info->flash_id == FLASH_AM040)) {
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
} else {
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] =
|
||||
base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
#ifdef CONFIG_ADCIOP
|
||||
addr2 = (volatile FLASH_WORD_SIZE *) (info->start[i]);
|
||||
info->protect[i] = addr2[4] & 1;
|
||||
#else
|
||||
addr2 = (volatile FLASH_WORD_SIZE *) (info->start[i]);
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
|
||||
info->protect[i] = 0;
|
||||
else
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
#if 0 /* test-only */
|
||||
#ifdef CONFIG_ADCIOP
|
||||
addr2 = (volatile unsigned char *) info->start[0];
|
||||
addr2[ADDR0] = 0xAA;
|
||||
addr2[ADDR1] = 0x55;
|
||||
addr2[ADDR0] = 0xF0; /* reset bank */
|
||||
#else
|
||||
addr2 = (FLASH_WORD_SIZE *) info->start[0];
|
||||
*addr2 = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
#endif
|
||||
#else /* test-only */
|
||||
addr2 = (FLASH_WORD_SIZE *) info->start[0];
|
||||
*addr2 = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
#endif /* test-only */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
int wait_for_DQ7 (flash_info_t * info, int sect)
|
||||
{
|
||||
ulong start, now, last;
|
||||
volatile FLASH_WORD_SIZE *addr =
|
||||
(FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
while ((addr[0] & (FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(FLASH_WORD_SIZE) 0x00800080) {
|
||||
if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
return -1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *addr2;
|
||||
int flag, prot, sect, l_sect;
|
||||
int i;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("Can't erase unknown flash type - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n", prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
l_sect = -1;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
printf ("Erasing sector %p\n", addr2); /* CLH */
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) ==
|
||||
FLASH_MAN_SST) {
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE) 0x00500050; /* block erase */
|
||||
for (i = 0; i < 50; i++)
|
||||
udelay (1000); /* wait 1 ms */
|
||||
} else {
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE) 0x00300030; /* sector erase */
|
||||
}
|
||||
l_sect = sect;
|
||||
/*
|
||||
* Wait for each sector to complete, it's more
|
||||
* reliable. According to AMD Spec, you must
|
||||
* issue all erase commands within a specified
|
||||
* timeout. This has been seen to fail, especially
|
||||
* if printf()s are included (for debug)!!
|
||||
*/
|
||||
wait_for_DQ7 (info, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts ();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* We wait for the last triggered sector
|
||||
*/
|
||||
if (l_sect < 0)
|
||||
goto DONE;
|
||||
wait_for_DQ7 (info, l_sect);
|
||||
|
||||
DONE:
|
||||
#endif
|
||||
/* reset to read mode */
|
||||
addr = (FLASH_WORD_SIZE *) info->start[0];
|
||||
addr[0] = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
|
||||
printf (" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < 4 && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < 4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word (info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word (info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < 4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_word (info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word (flash_info_t * info, ulong dest, ulong data)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr2 =
|
||||
(FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *) dest;
|
||||
volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *) & data;
|
||||
ulong start;
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((volatile FLASH_WORD_SIZE *) dest) &
|
||||
(FLASH_WORD_SIZE) data) != (FLASH_WORD_SIZE) data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4 / sizeof (FLASH_WORD_SIZE); i++) {
|
||||
int flag;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00A000A0;
|
||||
|
||||
dest2[i] = data2[i];
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts ();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
while ((dest2[i] & (FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(data2[i] & (FLASH_WORD_SIZE) 0x00800080)) {
|
||||
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
89
board/jse/host_bridge.c
Normal file
89
board/jse/host_bridge.c
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Picture Elements, Inc.
|
||||
* Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form 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
|
||||
*/
|
||||
#ident "$Id:$"
|
||||
|
||||
# include <common.h>
|
||||
# include <pci.h>
|
||||
# include "jse_priv.h"
|
||||
|
||||
/*
|
||||
* The JSE board has an Intel 21555 non-transparent bridge for
|
||||
* communication with the host. We need to render it harmless on the
|
||||
* JSE side, but leave it alone on the host (primary) side. Normally,
|
||||
* this will all be done before the host BIOS can gain access to the
|
||||
* board, due to the Primary Access Lockout bit.
|
||||
*
|
||||
* The host_bridge_init function is called as a late initialization
|
||||
* function, after most of the board is set up, including a PCI scan.
|
||||
*/
|
||||
|
||||
void host_bridge_init (void)
|
||||
{
|
||||
/* The bridge chip is at a fixed location. */
|
||||
pci_dev_t dev = PCI_BDF (0, 10, 0);
|
||||
|
||||
int rc;
|
||||
u32 val32;
|
||||
|
||||
rc = pci_read_config_dword (dev, 0, &val32);
|
||||
|
||||
/* Set subsystem ID --
|
||||
The primary side sees this value at 0x2c. We set it here so
|
||||
that the host can tell what sort of device this is:
|
||||
We are a Picture Elements [0x12c5] JSE [0x008a]. */
|
||||
pci_write_config_dword (dev, 0x6c, 0x008a12c5);
|
||||
|
||||
/* Downstream (Primary-to-Secondary) BARs are set up mostly
|
||||
off. We need only the Memory-0 Bar so that the host can get
|
||||
at the CSR region to set up tables and the lot. */
|
||||
|
||||
/* Downstream Memory 0 setup (4K for CSR) */
|
||||
pci_write_config_dword (dev, 0xac, 0xfffff000);
|
||||
/* Downstream Memory 1 setup (off) */
|
||||
pci_write_config_dword (dev, 0xb0, 0x00000000);
|
||||
/* Downstream Memory 2 setup (off) */
|
||||
pci_write_config_dword (dev, 0xb4, 0x00000000);
|
||||
/* Downstream Memory 3 setup (off) */
|
||||
pci_write_config_dword (dev, 0xb8, 0x00000000);
|
||||
|
||||
/* Upstream (Secondary-to-Primary) BARs are used to get at
|
||||
host memory from the JSE card. Create two regions: a small
|
||||
one to manage individual word reads/writes, and a larger
|
||||
one for doing bulk frame moves. */
|
||||
|
||||
/* Upstream Memory 0 Setup -- (BAR2) 4K non-prefetchable */
|
||||
pci_write_config_dword (dev, 0xc4, 0xfffff000);
|
||||
/* Upstream Memory 1 setup -- (BAR3) 4K non-prefetchable */
|
||||
pci_write_config_dword (dev, 0xc8, 0xfffff000);
|
||||
|
||||
/* Upstream Memory 2 (BAR4) uses page translation, and is set
|
||||
up in CCR1. Configure for 4K pages. */
|
||||
|
||||
/* Set CCR1,0 reigsters. This clears the Primary PCI Lockout
|
||||
bit as well, so we are done configuring after this
|
||||
point. Therefore, this must be the last step.
|
||||
|
||||
CC1[15:12]= 0 (disable I2O message unit)
|
||||
CC1[11:8] = 0x5 (4K page size)
|
||||
CC0[11] = 1 (Secondary Clock Disable: disable clock)
|
||||
CC0[10] = 0 (Primary Access Lockout: allow primary access)
|
||||
*/
|
||||
pci_write_config_dword (dev, 0xcc, 0x05000800);
|
||||
}
|
||||
105
board/jse/init.S
Normal file
105
board/jse/init.S
Normal file
@@ -0,0 +1,105 @@
|
||||
/*------------------------------------------------------------------------+ */
|
||||
/* */
|
||||
/* This source code has been made available to you by IBM on an AS-IS */
|
||||
/* basis. Anyone receiving this source is licensed under IBM */
|
||||
/* copyrights to use it in any way he or she deems fit, including */
|
||||
/* copying it, modifying it, compiling it, and redistributing it either */
|
||||
/* with or without modifications. No license under IBM patents or */
|
||||
/* patent applications is to be implied by the copyright license. */
|
||||
/* */
|
||||
/* Any user of this software should understand that IBM cannot provide */
|
||||
/* technical support for this software and will not be responsible for */
|
||||
/* any consequences resulting from the use of this software. */
|
||||
/* */
|
||||
/* Any person who transfers this source code or any derivative work */
|
||||
/* must include the IBM copyright notice, this paragraph, and the */
|
||||
/* preceding two paragraphs in the transferred software. */
|
||||
/* */
|
||||
/* COPYRIGHT I B M CORPORATION 1995 */
|
||||
/* LICENSED MATERIAL - PROGRAM PROPERTY OF I B M */
|
||||
/*------------------------------------------------------------------------- */
|
||||
|
||||
/*------------------------------------------------------------------------- */
|
||||
/* Function: ext_bus_cntlr_init */
|
||||
/* Description: Initializes the External Bus Controller for the external */
|
||||
/* peripherals. IMPORTANT: For pass1 this code must run from */
|
||||
/* cache since you can not reliably change a peripheral banks */
|
||||
/* timing register (pbxap) while running code from that bank. */
|
||||
/* For ex., since we are running from ROM on bank 0, we can NOT */
|
||||
/* execute the code that modifies bank 0 timings from ROM, so */
|
||||
/* we run it from cache. */
|
||||
/* */
|
||||
/* */
|
||||
/* The layout for the PEI JSE board: */
|
||||
/* Bank 0 - Flash and SRAM */
|
||||
/* Bank 1 - SystemACE */
|
||||
/* Bank 2 - not used */
|
||||
/* Bank 3 - not used */
|
||||
/* Bank 4 - not used */
|
||||
/* Bank 5 - not used */
|
||||
/* Bank 6 - not used */
|
||||
/* Bank 7 - not used */
|
||||
/*------------------------------------------------------------------------- */
|
||||
#include <ppc4xx.h>
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
#include <ppc_defs.h>
|
||||
|
||||
#include <asm/cache.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
#define cpc0_cr0 0xB1
|
||||
|
||||
.globl ext_bus_cntlr_init
|
||||
ext_bus_cntlr_init:
|
||||
mflr r4 /* save link register */
|
||||
bl ..getAddr
|
||||
..getAddr:
|
||||
mflr r3 /* get address of ..getAddr */
|
||||
mtlr r4 /* restore link register */
|
||||
addi r4,0,14 /* set ctr to 10; used to prefetch */
|
||||
mtctr r4 /* 10 cache lines to fit this function */
|
||||
/* in cache (gives us 8x10=80 instrctns) */
|
||||
..ebcloop:
|
||||
icbt r0,r3 /* prefetch cache line for addr in r3 */
|
||||
addi r3,r3,32 /* move to next cache line */
|
||||
bdnz ..ebcloop /* continue for 10 cache lines */
|
||||
|
||||
/*----------------------------------------------------------------- */
|
||||
/* Delay to ensure all accesses to ROM are complete before changing */
|
||||
/* bank 0 timings. 200usec should be enough. */
|
||||
/* 200,000,000 (cycles/sec) X .000200 (sec) = 0x9C40 cycles */
|
||||
/*----------------------------------------------------------------- */
|
||||
addis r3,0,0x0
|
||||
ori r3,r3,0xA000 /* ensure 200usec have passed since reset */
|
||||
mtctr r3
|
||||
..spinlp:
|
||||
bdnz ..spinlp /* spin loop */
|
||||
|
||||
/*----------------------------------------------------------------- */
|
||||
/* Memory Bank 0 (Flash) initialization */
|
||||
/*----------------------------------------------------------------- */
|
||||
|
||||
addi r4,0,pb0ap
|
||||
mtdcr ebccfga,r4
|
||||
addis r4,0,0x9B01
|
||||
ori r4,r4,0x5480
|
||||
mtdcr ebccfgd,r4
|
||||
|
||||
addi r4,0,pb0cr
|
||||
mtdcr ebccfga,r4
|
||||
addis r4,0,0xFFF1 /* BAS=0xFFF,BS=0x0(1MB),BU=0x3(R/W), */
|
||||
ori r4,r4,0x8000 /* BW=0x0( 8 bits) */
|
||||
mtdcr ebccfgd,r4
|
||||
|
||||
blr
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------- */
|
||||
/* Function: sdram_init */
|
||||
/* Description: This function is called by cpu/ppc4xx/start.S code */
|
||||
/* to get the SDRAM initialized. */
|
||||
/*----------------------------------------------------------------------- */
|
||||
.globl sdram_init
|
||||
sdram_init:
|
||||
blr
|
||||
160
board/jse/jse.c
Normal file
160
board/jse/jse.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Picture Elements, Inc.
|
||||
* Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form 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 <ppc4xx.h>
|
||||
# include <asm/processor.h>
|
||||
# include <asm/io.h>
|
||||
# include "jse_priv.h"
|
||||
|
||||
/*
|
||||
* This function is run very early, out of flash, and before devices are
|
||||
* initialized. It is called by lib_ppc/board.c:board_init_f by virtue
|
||||
* of being in the init_sequence array.
|
||||
*
|
||||
* The SDRAM has been initialized already -- start.S:start called
|
||||
* init.S:init_sdram early on -- but it is not yet being used for
|
||||
* anything, not even stack. So be careful.
|
||||
*/
|
||||
int board_early_init_f (void)
|
||||
{
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Interrupt controller setup for the JSE board.
|
||||
| Note: IRQ 0-15 405GP internally generated; active high; level sensitive
|
||||
| IRQ 16 405GP internally generated; active low; level sensitive
|
||||
| IRQ 17-24 RESERVED/UNUSED
|
||||
| IRQ 25 (EXT IRQ 0) PCI SLOT 0; active low; level sensitive
|
||||
| IRQ 26 (EXT IRQ 1) PCI SLOT 1; active low; level sensitive
|
||||
| IRQ 27 (EXT IRQ 2) JP2C CHIP ; active low; level sensitive
|
||||
| IRQ 28 (EXT IRQ 3) PCI bridge; active low; level sensitive
|
||||
| IRQ 29 (EXT IRQ 4) SystemACE IRQ; active high
|
||||
| IRQ 30 (EXT IRQ 5) SystemACE BRdy (unused)
|
||||
| IRQ 31 (EXT IRQ 6) (unused)
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
|
||||
mtdcr (uicer, 0x00000000); /* disable all ints */
|
||||
mtdcr (uiccr, 0x00000000); /* set all to be non-critical */
|
||||
mtdcr (uicpr, 0xFFFFFF87); /* set int polarities */
|
||||
mtdcr (uictr, 0x10000000); /* set int trigger levels */
|
||||
mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
|
||||
|
||||
/* Configure the interface to the SystemACE MCU port.
|
||||
The SystemACE is fast, but there is no reason to have
|
||||
excessivly tight timings. So the settings are slightly
|
||||
generous. */
|
||||
|
||||
/* EBC0_B1AP: BME=1, TWT=2, CSN=0, OEN=1,
|
||||
WBN=0, WBF=1, TH=0, RE=0, SOR=0, BEM=0, PEN=0 */
|
||||
mtdcr (ebccfga, pb1ap);
|
||||
mtdcr (ebccfgd, 0x01011000);
|
||||
|
||||
/* EBC0_B1CR: BAS=x, BS=0(1MB), BU=3(R/W), BW=0(8bits) */
|
||||
mtdcr (ebccfga, pb1cr);
|
||||
mtdcr (ebccfgd, CFG_SYSTEMACE_BASE | 0x00018000);
|
||||
|
||||
/* Enable the /PerWE output as /PerWE, instead of /PCIINT. */
|
||||
/* CPC0_CR1 |= PCIPW */
|
||||
mtdcr (0xb2, mfdcr (0xb2) | 0x00004000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOARD_PRE_INIT
|
||||
int board_pre_init (void)
|
||||
{
|
||||
return board_early_init_f ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function is also called by lib_ppc/board.c:board_init_f (it is
|
||||
* also in the init_sequence array) but later. Many more things are
|
||||
* configured, but we are still running from flash.
|
||||
*/
|
||||
int checkboard (void)
|
||||
{
|
||||
unsigned vers, status;
|
||||
|
||||
/* check that the SystemACE chip is alive. */
|
||||
printf ("ACE: ");
|
||||
vers = readw (CFG_SYSTEMACE_BASE + 0x16);
|
||||
printf ("SystemACE %u.%u (build %u)",
|
||||
(vers >> 12) & 0x0f, (vers >> 8) & 0x0f, vers & 0xff);
|
||||
|
||||
status = readl (CFG_SYSTEMACE_BASE + 0x04);
|
||||
#ifdef DEBUG
|
||||
printf (" STATUS=0x%08x", status);
|
||||
#endif
|
||||
/* If the flash card is present and there is an initial error,
|
||||
then force a restart of the program. */
|
||||
if (status & 0x00000010) {
|
||||
printf (" CFDETECT");
|
||||
|
||||
if (status & 0x04) {
|
||||
/* CONTROLREG = CFGPROG */
|
||||
writew (0x1000, CFG_SYSTEMACE_BASE + 0x18);
|
||||
udelay (500);
|
||||
/* CONTROLREG = CFGRESET */
|
||||
writew (0x0080, CFG_SYSTEMACE_BASE + 0x18);
|
||||
udelay (500);
|
||||
writew (0x0000, CFG_SYSTEMACE_BASE + 0x18);
|
||||
/* CONTROLREG = CFGSTART */
|
||||
writew (0x0020, CFG_SYSTEMACE_BASE + 0x18);
|
||||
|
||||
status = readl (CFG_SYSTEMACE_BASE + 0x04);
|
||||
}
|
||||
}
|
||||
|
||||
/* Wait for the SystemACE to program its chain of devices. */
|
||||
while ((status & 0x84) == 0x00) {
|
||||
udelay (500);
|
||||
status = readl (CFG_SYSTEMACE_BASE + 0x04);
|
||||
}
|
||||
|
||||
if (status & 0x04)
|
||||
printf (" CFG-ERROR");
|
||||
if (status & 0x80)
|
||||
printf (" CFGDONE");
|
||||
|
||||
printf ("\n");
|
||||
|
||||
/* Force /RTS to active. The board it not wired quite
|
||||
correctly to use cts/rtc flow control, so just force the
|
||||
/RST active and forget about it. */
|
||||
writeb (readb (0xef600404) | 0x03, 0xef600404);
|
||||
|
||||
printf ("JSE: ready\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* **** No more functions called by board_init_f. **** */
|
||||
|
||||
/*
|
||||
* This function is called by lib_ppc/board.c:board_init_r. At this
|
||||
* point, basic setup is done, U-Boot has been moved into SDRAM and
|
||||
* PCI has been set up. From here we done late setup.
|
||||
*/
|
||||
int misc_init_r (void)
|
||||
{
|
||||
host_bridge_init ();
|
||||
return 0;
|
||||
}
|
||||
25
board/jse/jse_priv.h
Normal file
25
board/jse/jse_priv.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __jse_priv_H
|
||||
#define __jse_prov_H
|
||||
/*
|
||||
* Copyright (c) 2004 Picture Elements, Inc.
|
||||
* Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form 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
|
||||
*/
|
||||
|
||||
extern void host_bridge_init(void);
|
||||
|
||||
#endif
|
||||
182
board/jse/sdram.c
Normal file
182
board/jse/sdram.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2004 Picture Elements, Inc.
|
||||
* Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form 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 <ppc4xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
# define SDRAM_LEN 0x08000000
|
||||
|
||||
/*
|
||||
* this is even after checkboard. It returns the size of the SDRAM
|
||||
* that we have installed. This function is called by board_init_f
|
||||
* in lib_ppc/board.c to initialize the memory and return what I
|
||||
* found.
|
||||
*/
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
/* Configure the SDRAMS */
|
||||
|
||||
/* disable memory controller */
|
||||
mtdcr (memcfga, mem_mcopt1);
|
||||
mtdcr (memcfgd, 0x00000000);
|
||||
|
||||
udelay (500);
|
||||
|
||||
/* Clear SDRAM0_BESR0 (Bus Error Syndrome Register) */
|
||||
mtdcr (memcfga, mem_besra);
|
||||
mtdcr (memcfgd, 0xffffffff);
|
||||
|
||||
/* Clear SDRAM0_BESR1 (Bus Error Syndrome Register) */
|
||||
mtdcr (memcfga, mem_besrb);
|
||||
mtdcr (memcfgd, 0xffffffff);
|
||||
|
||||
/* Clear SDRAM0_ECCCFG (disable ECC) */
|
||||
mtdcr (memcfga, mem_ecccf);
|
||||
mtdcr (memcfgd, 0x00000000);
|
||||
|
||||
/* Clear SDRAM0_ECCESR (ECC Error Syndrome Register) */
|
||||
mtdcr (memcfga, mem_eccerr);
|
||||
mtdcr (memcfgd, 0xffffffff);
|
||||
|
||||
/* Timing register: CASL=2, PTA=2, CTP=2, LDF=1, RFTA=5, RCD=2 */
|
||||
mtdcr (memcfga, mem_sdtr1);
|
||||
mtdcr (memcfgd, 0x010a4016);
|
||||
|
||||
/* Memory Bank 0 Config == BA=0x00000000, SZ=64M, AM=3, BE=1 */
|
||||
mtdcr (memcfga, mem_mb0cf);
|
||||
mtdcr (memcfgd, 0x00084001);
|
||||
|
||||
/* Memory Bank 1 Config == BA=0x04000000, SZ=64M, AM=3, BE=1 */
|
||||
mtdcr (memcfga, mem_mb1cf);
|
||||
mtdcr (memcfgd, 0x04084001);
|
||||
|
||||
/* Memory Bank 2 Config == BE=0 */
|
||||
mtdcr (memcfga, mem_mb2cf);
|
||||
mtdcr (memcfgd, 0x00000000);
|
||||
|
||||
/* Memory Bank 3 Config == BE=0 */
|
||||
mtdcr (memcfga, mem_mb3cf);
|
||||
mtdcr (memcfgd, 0x00000000);
|
||||
|
||||
/* refresh timer = 0x400 */
|
||||
mtdcr (memcfga, mem_rtr);
|
||||
mtdcr (memcfgd, 0x04000000);
|
||||
|
||||
/* Power management idle timer set to the default. */
|
||||
mtdcr (memcfga, mem_pmit);
|
||||
mtdcr (memcfgd, 0x07c00000);
|
||||
|
||||
udelay (500);
|
||||
|
||||
/* Enable banks (DCE=1, BPRF=1, ECCDD=1, EMDUL=1) */
|
||||
mtdcr (memcfga, mem_mcopt1);
|
||||
mtdcr (memcfgd, 0x80e00000);
|
||||
|
||||
return SDRAM_LEN;
|
||||
}
|
||||
|
||||
/*
|
||||
* The U-Boot core, as part of the initialization to prepare for
|
||||
* loading the monitor into SDRAM, requests of this function that the
|
||||
* memory be tested. Return 0 if the memory tests OK.
|
||||
*/
|
||||
int testdram (void)
|
||||
{
|
||||
unsigned long idx;
|
||||
unsigned val;
|
||||
unsigned errors;
|
||||
volatile unsigned long *sdram;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf ("SDRAM Controller Registers --\n");
|
||||
|
||||
mtdcr (memcfga, mem_mcopt1);
|
||||
val = mfdcr (memcfgd);
|
||||
printf (" SDRAM0_CFG : 0x%08x\n", val);
|
||||
|
||||
mtdcr (memcfga, 0x24);
|
||||
val = mfdcr (memcfgd);
|
||||
printf (" SDRAM0_STATUS: 0x%08x\n", val);
|
||||
|
||||
mtdcr (memcfga, mem_mb0cf);
|
||||
val = mfdcr (memcfgd);
|
||||
printf (" SDRAM0_B0CR : 0x%08x\n", val);
|
||||
|
||||
mtdcr (memcfga, mem_mb1cf);
|
||||
val = mfdcr (memcfgd);
|
||||
printf (" SDRAM0_B1CR : 0x%08x\n", val);
|
||||
|
||||
mtdcr (memcfga, mem_sdtr1);
|
||||
val = mfdcr (memcfgd);
|
||||
printf (" SDRAM0_TR : 0x%08x\n", val);
|
||||
|
||||
mtdcr (memcfga, mem_rtr);
|
||||
val = mfdcr (memcfgd);
|
||||
printf (" SDRAM0_RTR : 0x%08x\n", val);
|
||||
#endif
|
||||
|
||||
/* Wait for memory to be ready by testing MRSCMPbit
|
||||
bit. Really, there should already have been plenty of time,
|
||||
given it was started long ago. But, best to check. */
|
||||
for (idx = 0; idx < 1000000; idx += 1) {
|
||||
mtdcr (memcfga, 0x24);
|
||||
val = mfdcr (memcfgd);
|
||||
if (val & 0x80000000)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(val & 0x80000000)) {
|
||||
printf ("SDRAM ERROR: SDRAM0_STATUS never set!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Start memory test. */
|
||||
printf ("test: %u MB - ", SDRAM_LEN / 1048576);
|
||||
|
||||
sdram = (unsigned long *) CFG_SDRAM_BASE;
|
||||
|
||||
printf ("write - ");
|
||||
for (idx = 2; idx < SDRAM_LEN / 4; idx += 2) {
|
||||
sdram[idx + 0] = idx;
|
||||
sdram[idx + 1] = ~idx;
|
||||
}
|
||||
|
||||
printf ("read - ");
|
||||
errors = 0;
|
||||
for (idx = 2; idx < SDRAM_LEN / 4; idx += 2) {
|
||||
if (sdram[idx + 0] != idx)
|
||||
errors += 1;
|
||||
if (sdram[idx + 1] != ~idx)
|
||||
errors += 1;
|
||||
if (errors > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (errors > 0) {
|
||||
printf ("NOT OK\n");
|
||||
printf ("FIRST ERROR at %p: 0x%08lx:0x%08lx != 0x%08lx:0x%08lx\n",
|
||||
sdram + idx, sdram[idx + 0], sdram[idx + 1], idx, ~idx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("ok\n");
|
||||
return 0;
|
||||
}
|
||||
140
board/jse/u-boot.lds
Normal file
140
board/jse/u-boot.lds
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
.resetvec 0xFFFFFFFC :
|
||||
{
|
||||
*(.resetvec)
|
||||
} = 0xffff
|
||||
|
||||
/* 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 : {
|
||||
/* The start.o file includes the initial jump vector that
|
||||
must be located in the beginning. It is the basic run-
|
||||
time function that calls all other functions. */
|
||||
cpu/ppc4xx/start.o (.text)
|
||||
|
||||
board/jse/init.o (.text)
|
||||
cpu/ppc4xx/kgdb.o (.text)
|
||||
|
||||
/* . = env_offset;*/
|
||||
/* common/environment.o(.text)*/
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# (C) Copyright 2000-2002
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
OBJS = $(BOARD).o flash.o kup.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -197,13 +197,13 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
case AMD_ID_LV800T:
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
case AMD_ID_LV800B:
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
72
board/kup/common/kup.c
Normal file
72
board/kup/common/kup.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.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 <mpc8xx.h>
|
||||
#include "kup.h"
|
||||
|
||||
int misc_init_f (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile sysconf8xx_t *siu = &immap->im_siu_conf;
|
||||
|
||||
while (siu->sc_sipend & 0x20000000) {
|
||||
/* printf("waiting for 5V VCC\n"); */
|
||||
;
|
||||
}
|
||||
|
||||
/* RS232 / RS485 default is RS232 */
|
||||
immap->im_ioport.iop_padat &= ~(PA_RS485);
|
||||
immap->im_ioport.iop_papar &= ~(PA_RS485);
|
||||
immap->im_ioport.iop_paodr &= ~(PA_RS485);
|
||||
immap->im_ioport.iop_padir |= (PA_RS485);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_IDE_LED
|
||||
void ide_led (uchar led, uchar status)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
|
||||
/* We have one led for both pcmcia slots */
|
||||
if (status) { /* led on */
|
||||
immap->im_ioport.iop_padat &= ~(PA_LED_YELLOW);
|
||||
} else {
|
||||
immap->im_ioport.iop_padat |= (PA_LED_YELLOW);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void poweron_key (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
|
||||
immap->im_ioport.iop_pcpar &= ~(PC_SWITCH1);
|
||||
immap->im_ioport.iop_pcdir &= ~(PC_SWITCH1);
|
||||
|
||||
if (immap->im_ioport.iop_pcdat & (PC_SWITCH1))
|
||||
setenv ("key1", "off");
|
||||
else
|
||||
setenv ("key1", "on");
|
||||
}
|
||||
44
board/kup/common/kup.h
Normal file
44
board/kup/common/kup.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __KUP_H
|
||||
#define __KUP_H
|
||||
|
||||
#define PA_8 0x0080
|
||||
#define PA_11 0x0010
|
||||
#define PA_12 0x0008
|
||||
|
||||
#define PB_14 0x00020000
|
||||
#define PB_17 0x00004000
|
||||
|
||||
#define PC_9 0x0040
|
||||
|
||||
#define PA_RS485 PA_11 /* SCC1: 0=RS232 1=RS485 */
|
||||
#define PA_LED_YELLOW PA_8
|
||||
#define BP_USB_VCC PB_14 /* VCC for USB devices 0=vcc on, 1=vcc off*/
|
||||
#define PB_LCD_PWM PB_17 /* PB 17 */
|
||||
#define PC_SWITCH1 PC_9 /* Reboot switch */
|
||||
|
||||
extern void poweron_key (void);
|
||||
|
||||
#endif /* __KUP_H */
|
||||
40
board/kup/kup4k/Makefile
Normal file
40
board/kup/kup4k/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# (C) Copyright 2000-2002
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000, 2001, 2002
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
|
||||
*
|
||||
@@ -24,16 +24,23 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
#include "../common/kup.h"
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
#include "s1d13706.h"
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
#ifdef DEBUG
|
||||
# define debugk(fmt,args...) printf(fmt ,##args)
|
||||
#else
|
||||
# define debugk(fmt,args...)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
volatile unsigned char *VmemAddr;
|
||||
volatile unsigned char *RegAddr;
|
||||
} FB_INFO_S1D13xxx;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile unsigned char *VmemAddr;
|
||||
volatile unsigned char *RegAddr;
|
||||
}FB_INFO_S1D13xxx;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -42,15 +49,15 @@ static long int dram_size (long int, long int *, long int);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
void lcd_logo(bd_t *bd);
|
||||
void lcd_logo(bd_t *bd);
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
const uint sdram_table[] =
|
||||
{
|
||||
const uint sdram_table[] = {
|
||||
/*
|
||||
* Single Read. (Offset 0 in UPMA RAM)
|
||||
*/
|
||||
@@ -114,8 +121,19 @@ const uint sdram_table[] =
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
uchar *latch,rev,mod;
|
||||
|
||||
printf ("### No HW ID - assuming KUP4K-Color\n");
|
||||
/*
|
||||
* Init ChipSelect #4 (CAN + HW-Latch)
|
||||
*/
|
||||
immap->im_memctl.memc_or4 = 0xFFFF8926;
|
||||
immap->im_memctl.memc_br4 = 0x90000401;
|
||||
|
||||
latch=(uchar *)0x90000200;
|
||||
rev = (*latch & 0xF8) >> 3;
|
||||
mod=(*latch & 0x03);
|
||||
printf ("Board: KUP4K Rev %d.%d SN: %s\n",rev,mod,getenv("ethaddr"));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -230,10 +248,42 @@ static long int dram_size (long int mamr_value, long int *base,
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
volatile long int *addr;
|
||||
ulong cnt, val;
|
||||
ulong save[32]; /* to make test non-destructive */
|
||||
unsigned char i = 0;
|
||||
|
||||
memctl->memc_mamr = mamr_value;
|
||||
|
||||
return(get_ram_size(base, maxsize));
|
||||
for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
|
||||
addr = base + cnt; /* pointer arith! */
|
||||
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
/* write 0 to base address */
|
||||
addr = base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
/* check at base address */
|
||||
if ((val = *addr) != 0) {
|
||||
*addr = save[i];
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
|
||||
addr = base + cnt; /* pointer arith! */
|
||||
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
|
||||
if (val != (~cnt)) {
|
||||
return (cnt * sizeof (long));
|
||||
}
|
||||
}
|
||||
return (maxsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -247,7 +297,6 @@ int misc_init_r (void)
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
bd_t *bd = gd->bd;
|
||||
|
||||
|
||||
lcd_logo (bd);
|
||||
#endif /* CONFIG_KUP4K_LOGO */
|
||||
#ifdef CONFIG_IDE_LED
|
||||
@@ -257,14 +306,14 @@ int misc_init_r (void)
|
||||
immap->im_ioport.iop_papar &= ~0x80;
|
||||
immap->im_ioport.iop_padat |= 0x80; /* turn it off */
|
||||
#endif
|
||||
setenv("hw","4k");
|
||||
poweron_key();
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
|
||||
|
||||
#define PB_LCD_PWM ((uint)0x00004000) /* PB 17 */
|
||||
|
||||
void lcd_logo (bd_t * bd)
|
||||
{
|
||||
FB_INFO_S1D13xxx fb_info;
|
||||
@@ -277,104 +326,117 @@ void lcd_logo (bd_t * bd)
|
||||
int rs, gs, bs;
|
||||
int r = 8, g = 8, b = 4;
|
||||
int r1, g1, b1;
|
||||
int n;
|
||||
uchar tmp[64]; /* long enough for environment variables */
|
||||
int tft = 0;
|
||||
|
||||
immr->im_cpm.cp_pbpar &= ~PB_LCD_PWM;
|
||||
immr->im_cpm.cp_pbodr &= ~PB_LCD_PWM;
|
||||
immr->im_cpm.cp_pbdat &= ~PB_LCD_PWM; /* set to 0 = enabled */
|
||||
immr->im_cpm.cp_pbdir |= PB_LCD_PWM;
|
||||
|
||||
immr->im_cpm.cp_pbpar &= ~(PB_LCD_PWM);
|
||||
immr->im_cpm.cp_pbodr &= ~(PB_LCD_PWM);
|
||||
immr->im_cpm.cp_pbdat &= ~(PB_LCD_PWM); /* set to 0 = enabled */
|
||||
immr->im_cpm.cp_pbdir |= (PB_LCD_PWM);
|
||||
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/**/
|
||||
/* Initialize the chip and the frame buffer driver. */
|
||||
/**/
|
||||
/*----------------------------------------------------------------------------- */
|
||||
memctl = &immr->im_memctl;
|
||||
/* memctl->memc_or5 = 0xFFC007F0; / * 4 MB 17 WS or externel TA */
|
||||
/* memctl->memc_br5 = 0x80000801; / * Start at 0x80000000 */
|
||||
memctl = &immr->im_memctl;
|
||||
|
||||
memctl->memc_or5 = 0xFFC00708; /* 4 MB 17 WS or externel TA */
|
||||
|
||||
/*
|
||||
* Init ChipSelect #5 (S1D13768)
|
||||
*/
|
||||
memctl->memc_or5 = 0xFFC007F0; /* 4 MB 17 WS or externel TA */
|
||||
memctl->memc_br5 = 0x80080801; /* Start at 0x80080000 */
|
||||
|
||||
|
||||
fb_info.VmemAddr = (unsigned char *) (S1D_PHYSICAL_VMEM_ADDR);
|
||||
fb_info.RegAddr = (unsigned char *) (S1D_PHYSICAL_REG_ADDR);
|
||||
|
||||
if ((((S1D_VALUE *) fb_info.RegAddr)[0] != 0x28)
|
||||
|| (((S1D_VALUE *) fb_info.RegAddr)[1] != 0x14)) {
|
||||
|| (((S1D_VALUE *) fb_info.RegAddr)[1] != 0x14)) {
|
||||
printf ("Warning:LCD Controller S1D13706 not found\n");
|
||||
setenv ("lcd", "none");
|
||||
return;
|
||||
}
|
||||
|
||||
/* init controller */
|
||||
for (i = 0; i < sizeof (aS1DRegs) / sizeof (aS1DRegs[0]); i++) {
|
||||
s1dReg = aS1DRegs[i].Index;
|
||||
s1dValue = aS1DRegs[i].Value;
|
||||
/* printf("sid1 Index: %02x Register: %02x Wert: %02x\n",i, aS1DRegs[i].Index, aS1DRegs[i].Value); */
|
||||
|
||||
for (i = 0; i < sizeof(aS1DRegs_prelimn) / sizeof(aS1DRegs_prelimn[0]); i++) {
|
||||
s1dReg = aS1DRegs_prelimn[i].Index;
|
||||
s1dValue = aS1DRegs_prelimn[i].Value;
|
||||
debugk ("s13768 reg: %02x value: %02x\n",
|
||||
aS1DRegs_prelimn[i].Index, aS1DRegs_prelimn[i].Value);
|
||||
((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof (S1D_VALUE)] =
|
||||
s1dValue;
|
||||
}
|
||||
|
||||
|
||||
n = getenv_r ("lcd", tmp, sizeof (tmp));
|
||||
if (n > 0) {
|
||||
if (!strcmp ("tft", tmp))
|
||||
tft = 1;
|
||||
else
|
||||
tft = 0;
|
||||
}
|
||||
#if 0
|
||||
if (((S1D_VALUE *) fb_info.RegAddr)[0xAC] & 0x04)
|
||||
tft = 0;
|
||||
else
|
||||
tft = 1;
|
||||
#endif
|
||||
|
||||
debugk ("Port=0x%02x -> TFT=%d\n", tft,
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0xAC]);
|
||||
|
||||
/* init controller */
|
||||
if (!tft) {
|
||||
for (i = 0; i < sizeof(aS1DRegs_stn) / sizeof(aS1DRegs_stn[0]); i++) {
|
||||
s1dReg = aS1DRegs_stn[i].Index;
|
||||
s1dValue = aS1DRegs_stn[i].Value;
|
||||
debugk ("s13768 reg: %02x value: %02x\n",
|
||||
aS1DRegs_stn[i].Index,
|
||||
aS1DRegs_stn[i].Value);
|
||||
((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof(S1D_VALUE)] =
|
||||
s1dValue;
|
||||
}
|
||||
}
|
||||
n = getenv_r ("contrast", tmp, sizeof (tmp));
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0xB3] =
|
||||
(n > 0) ? (uchar) simple_strtoul (tmp, NULL, 10) * 255 / 100 : 0xA0;
|
||||
switch (bd->bi_busfreq) {
|
||||
case 40000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x41;
|
||||
break;
|
||||
case 48000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x22;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x34;
|
||||
break;
|
||||
default:
|
||||
printf ("KUP4K S1D1: unknown busfrequency: %ld assuming 64 MHz\n", bd->bi_busfreq);
|
||||
case 64000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x66;
|
||||
break;
|
||||
}
|
||||
/* setenv("lcd","stn"); */
|
||||
} else {
|
||||
for (i = 0; i < sizeof(aS1DRegs_tft) / sizeof(aS1DRegs_tft[0]); i++) {
|
||||
s1dReg = aS1DRegs_tft[i].Index;
|
||||
s1dValue = aS1DRegs_tft[i].Value;
|
||||
debugk ("s13768 reg: %02x value: %02x\n",
|
||||
aS1DRegs_tft[i].Index,
|
||||
aS1DRegs_tft[i].Value);
|
||||
((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof (S1D_VALUE)] =
|
||||
s1dValue;
|
||||
}
|
||||
|
||||
#undef MONOCHROME
|
||||
#ifdef MONOCHROME
|
||||
switch (bd->bi_busfreq) {
|
||||
#if 0
|
||||
case 24000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x28;
|
||||
break;
|
||||
case 32000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x33;
|
||||
break;
|
||||
#endif
|
||||
case 40000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x40;
|
||||
break;
|
||||
case 48000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x4C;
|
||||
break;
|
||||
default:
|
||||
printf ("KUP4K S1D1: unknown busfrequency: %ld assuming 64 MHz\n",
|
||||
bd->bi_busfreq);
|
||||
case 64000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x69;
|
||||
break;
|
||||
switch (bd->bi_busfreq) {
|
||||
default:
|
||||
printf ("KUP4K S1D1: unknown busfrequency: %ld assuming 64 MHz\n", bd->bi_busfreq);
|
||||
case 40000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x42;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x30;
|
||||
break;
|
||||
}
|
||||
/* setenv("lcd","tft"); */
|
||||
}
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x10] = 0x00;
|
||||
#else
|
||||
switch (bd->bi_busfreq) {
|
||||
#if 0
|
||||
case 24000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x22;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x34;
|
||||
break;
|
||||
case 32000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x34;
|
||||
break;
|
||||
#endif
|
||||
case 40000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x41;
|
||||
break;
|
||||
case 48000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x22;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x34;
|
||||
break;
|
||||
default:
|
||||
printf ("KUP4K S1D1: unknown busfrequency: %ld assuming 64 MHz\n",
|
||||
bd->bi_busfreq);
|
||||
case 64000000:
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x05] = 0x32;
|
||||
((S1D_VALUE *) fb_info.RegAddr)[0x12] = 0x66;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* create and set colormap */
|
||||
rs = 256 / (r - 1);
|
||||
@@ -384,27 +446,13 @@ void lcd_logo (bd_t * bd)
|
||||
r1 = (rs * ((i / (g * b)) % r)) * 255;
|
||||
g1 = (gs * ((i / b) % g)) * 255;
|
||||
b1 = (bs * ((i) % b)) * 255;
|
||||
/* printf("%d %04x %04x %04x\n",i,r1>>4,g1>>4,b1>>4); */
|
||||
debugk ("%d %04x %04x %04x\n", i, r1 >> 4, g1 >> 4, b1 >> 4);
|
||||
S1D_WRITE_PALETTE (fb_info.RegAddr, i, (r1 >> 4), (g1 >> 4),
|
||||
(b1 >> 4));
|
||||
(b1 >> 4));
|
||||
}
|
||||
|
||||
/* copy bitmap */
|
||||
fb = (char *) (fb_info.VmemAddr);
|
||||
memcpy (fb, (uchar *) CONFIG_KUP4K_LOGO, 320 * 240);
|
||||
}
|
||||
#endif /* CONFIG_KUP4K_LOGO */
|
||||
|
||||
#ifdef CONFIG_IDE_LED
|
||||
void ide_led (uchar led, uchar status)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
|
||||
/* We have one led for both pcmcia slots */
|
||||
if (status) { /* led on */
|
||||
immap->im_ioport.iop_padat &= ~0x80;
|
||||
} else {
|
||||
immap->im_ioport.iop_padat |= 0x80;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_KUP4K_LOGO */
|
||||
174
board/kup/kup4k/s1d13706.h
Normal file
174
board/kup/kup4k/s1d13706.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/*---------------------------------------------------------------------------- */
|
||||
/* */
|
||||
/* File generated by S1D13706CFG.EXE */
|
||||
/* */
|
||||
/* Copyright (c) 2000,2001 Epson Research and Development, Inc. */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------- */
|
||||
|
||||
/* Panel: 320x240x8bpp 70Hz Color Single STN 8-bit (PCLK=6.250MHz) (Format 2) */
|
||||
|
||||
#define S1D_DISPLAY_WIDTH 320
|
||||
#define S1D_DISPLAY_HEIGHT 240
|
||||
#define S1D_DISPLAY_BPP 8
|
||||
#define S1D_DISPLAY_SCANLINE_BYTES 320
|
||||
#define S1D_PHYSICAL_VMEM_ADDR 0x800A0000L
|
||||
#define S1D_PHYSICAL_VMEM_SIZE 0x14000L
|
||||
#define S1D_PHYSICAL_REG_ADDR 0x80080000L
|
||||
#define S1D_PHYSICAL_REG_SIZE 0x100
|
||||
#define S1D_DISPLAY_PCLK 6250
|
||||
#define S1D_PALETTE_SIZE 256
|
||||
#define S1D_REGDELAYOFF 0xFFFE
|
||||
#define S1D_REGDELAYON 0xFFFF
|
||||
|
||||
#define S1D_WRITE_PALETTE(p,i,r,g,b) \
|
||||
{ \
|
||||
((volatile S1D_VALUE*)(p))[0x0A/sizeof(S1D_VALUE)] = (S1D_VALUE)((r)>>4); \
|
||||
((volatile S1D_VALUE*)(p))[0x09/sizeof(S1D_VALUE)] = (S1D_VALUE)((g)>>4); \
|
||||
((volatile S1D_VALUE*)(p))[0x08/sizeof(S1D_VALUE)] = (S1D_VALUE)((b)>>4); \
|
||||
((volatile S1D_VALUE*)(p))[0x0B/sizeof(S1D_VALUE)] = (S1D_VALUE)(i); \
|
||||
}
|
||||
|
||||
#define S1D_READ_PALETTE(p,i,r,g,b) \
|
||||
{ \
|
||||
((volatile S1D_VALUE*)(p))[0x0F/sizeof(S1D_VALUE)] = (S1D_VALUE)(i); \
|
||||
r = ((volatile S1D_VALUE*)(p))[0x0E/sizeof(S1D_VALUE)]; \
|
||||
g = ((volatile S1D_VALUE*)(p))[0x0D/sizeof(S1D_VALUE)]; \
|
||||
b = ((volatile S1D_VALUE*)(p))[0x0C/sizeof(S1D_VALUE)]; \
|
||||
}
|
||||
|
||||
typedef unsigned short S1D_INDEX;
|
||||
typedef unsigned char S1D_VALUE;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
S1D_INDEX Index;
|
||||
S1D_VALUE Value;
|
||||
} S1D_REGS;
|
||||
|
||||
|
||||
static S1D_REGS aS1DRegs_prelimn[] =
|
||||
{
|
||||
{0x10,0x00}, /* PANEL Type Register */
|
||||
{0xA8,0x00}, /* GPIO Config Register 0 */
|
||||
{0xA9,0x80}, /* GPIO Config Register 1 */
|
||||
|
||||
};
|
||||
|
||||
static S1D_REGS aS1DRegs_stn[] =
|
||||
{
|
||||
{0x04,0x10}, /* BUSCLK MEMCLK Config Register */
|
||||
{0x10,0xD0}, /* PANEL Type Register */
|
||||
{0x11,0x00}, /* MOD Rate Register */
|
||||
{0x14,0x27}, /* Horizontal Display Period Register */
|
||||
{0x16,0x00}, /* Horizontal Display Period Start Pos Register 0 */
|
||||
{0x17,0x00}, /* Horizontal Display Period Start Pos Register 1 */
|
||||
{0x18,0xF0}, /* Vertical Total Register 0 */
|
||||
{0x19,0x00}, /* Vertical Total Register 1 */
|
||||
{0x1C,0xEF}, /* Vertical Display Period Register 0 */
|
||||
{0x1D,0x00}, /* Vertical Display Period Register 1 */
|
||||
{0x1E,0x00}, /* Vertical Display Period Start Pos Register 0 */
|
||||
{0x1F,0x00}, /* Vertical Display Period Start Pos Register 1 */
|
||||
{0x20,0x87}, /* Horizontal Sync Pulse Width Register */
|
||||
{0x22,0x00}, /* Horizontal Sync Pulse Start Pos Register 0 */
|
||||
{0x23,0x00}, /* Horizontal Sync Pulse Start Pos Register 1 */
|
||||
{0x24,0x80}, /* Vertical Sync Pulse Width Register */
|
||||
{0x26,0x01}, /* Vertical Sync Pulse Start Pos Register 0 */
|
||||
{0x27,0x00}, /* Vertical Sync Pulse Start Pos Register 1 */
|
||||
{0x70,0x83}, /* Display Mode Register */
|
||||
{0x71,0x00}, /* Special Effects Register */
|
||||
{0x74,0x00}, /* Main Window Display Start Address Register 0 */
|
||||
{0x75,0x00}, /* Main Window Display Start Address Register 1 */
|
||||
{0x76,0x00}, /* Main Window Display Start Address Register 2 */
|
||||
{0x78,0x50}, /* Main Window Address Offset Register 0 */
|
||||
{0x79,0x00}, /* Main Window Address Offset Register 1 */
|
||||
{0x7C,0x00}, /* Sub Window Display Start Address Register 0 */
|
||||
{0x7D,0x00}, /* Sub Window Display Start Address Register 1 */
|
||||
{0x7E,0x00}, /* Sub Window Display Start Address Register 2 */
|
||||
{0x80,0x50}, /* Sub Window Address Offset Register 0 */
|
||||
{0x81,0x00}, /* Sub Window Address Offset Register 1 */
|
||||
{0x84,0x00}, /* Sub Window X Start Pos Register 0 */
|
||||
{0x85,0x00}, /* Sub Window X Start Pos Register 1 */
|
||||
{0x88,0x00}, /* Sub Window Y Start Pos Register 0 */
|
||||
{0x89,0x00}, /* Sub Window Y Start Pos Register 1 */
|
||||
{0x8C,0x4F}, /* Sub Window X End Pos Register 0 */
|
||||
{0x8D,0x00}, /* Sub Window X End Pos Register 1 */
|
||||
{0x90,0xEF}, /* Sub Window Y End Pos Register 0 */
|
||||
{0x91,0x00}, /* Sub Window Y End Pos Register 1 */
|
||||
{0xA0,0x00}, /* Power Save Config Register */
|
||||
{0xA1,0x00}, /* CPU Access Control Register */
|
||||
{0xA2,0x00}, /* Software Reset Register */
|
||||
{0xA3,0x00}, /* BIG Endian Support Register */
|
||||
{0xA4,0x00}, /* Scratch Pad Register 0 */
|
||||
{0xA5,0x00}, /* Scratch Pad Register 1 */
|
||||
{0xA8,0x01}, /* GPIO Config Register 0 */
|
||||
{0xA9,0x80}, /* GPIO Config Register 1 */
|
||||
{0xAC,0x01}, /* GPIO Status Control Register 0 */
|
||||
{0xAD,0x00}, /* GPIO Status Control Register 1 */
|
||||
{0xB0,0x10}, /* PWM CV Clock Control Register */
|
||||
{0xB1,0x80}, /* PWM CV Clock Config Register */
|
||||
{0xB2,0x00}, /* CV Clock Burst Length Register */
|
||||
{0xAD,0x80}, /* reset seq */
|
||||
{0x70,0x03},
|
||||
};
|
||||
|
||||
static S1D_REGS aS1DRegs_tft[] =
|
||||
{
|
||||
{0x04,0x10}, /* BUSCLK MEMCLK Config Register */
|
||||
{0x05,0x42}, /* PCLK Config Register */
|
||||
{0x10,0x61}, /* PANEL Type Register */
|
||||
{0x11,0x00}, /* MOD Rate Register */
|
||||
{0x12,0x30}, /* Horizontal Total Register */
|
||||
{0x14,0x27}, /* Horizontal Display Period Register */
|
||||
{0x16,0x11}, /* Horizontal Display Period Start Pos Register 0 */
|
||||
{0x17,0x00}, /* Horizontal Display Period Start Pos Register 1 */
|
||||
{0x18,0xFA}, /* Vertical Total Register 0 */
|
||||
{0x19,0x00}, /* Vertical Total Register 1 */
|
||||
{0x1C,0xEF}, /* Vertical Display Period Register 0 */
|
||||
{0x1D,0x00}, /* Vertical Display Period Register 1 */
|
||||
{0x1E,0x00}, /* Vertical Display Period Start Pos Register 0 */
|
||||
{0x1F,0x00}, /* Vertical Display Period Start Pos Register 1 */
|
||||
{0x20,0x07}, /* Horizontal Sync Pulse Width Register */
|
||||
{0x22,0x00}, /* Horizontal Sync Pulse Start Pos Register 0 */
|
||||
{0x23,0x00}, /* Horizontal Sync Pulse Start Pos Register 1 */
|
||||
{0x24,0x00}, /* Vertical Sync Pulse Width Register */
|
||||
{0x26,0x00}, /* Vertical Sync Pulse Start Pos Register 0 */
|
||||
{0x27,0x00}, /* Vertical Sync Pulse Start Pos Register 1 */
|
||||
{0x70,0x03}, /* Display Mode Register */
|
||||
{0x71,0x00}, /* Special Effects Register */
|
||||
{0x74,0x00}, /* Main Window Display Start Address Register 0 */
|
||||
{0x75,0x00}, /* Main Window Display Start Address Register 1 */
|
||||
{0x76,0x00}, /* Main Window Display Start Address Register 2 */
|
||||
{0x78,0x50}, /* Main Window Address Offset Register 0 */
|
||||
{0x79,0x00}, /* Main Window Address Offset Register 1 */
|
||||
{0x7C,0x00}, /* Sub Window Display Start Address Register 0 */
|
||||
{0x7D,0x00}, /* Sub Window Display Start Address Register 1 */
|
||||
{0x7E,0x00}, /* Sub Window Display Start Address Register 2 */
|
||||
{0x80,0x50}, /* Sub Window Address Offset Register 0 */
|
||||
{0x81,0x00}, /* Sub Window Address Offset Register 1 */
|
||||
{0x84,0x00}, /* Sub Window X Start Pos Register 0 */
|
||||
{0x85,0x00}, /* Sub Window X Start Pos Register 1 */
|
||||
{0x88,0x00}, /* Sub Window Y Start Pos Register 0 */
|
||||
{0x89,0x00}, /* Sub Window Y Start Pos Register 1 */
|
||||
{0x8C,0x4F}, /* Sub Window X End Pos Register 0 */
|
||||
{0x8D,0x00}, /* Sub Window X End Pos Register 1 */
|
||||
{0x90,0xEF}, /* Sub Window Y End Pos Register 0 */
|
||||
{0x91,0x00}, /* Sub Window Y End Pos Register 1 */
|
||||
{0xA0,0x00}, /* Power Save Config Register */
|
||||
{0xA1,0x00}, /* CPU Access Control Register */
|
||||
{0xA2,0x00}, /* Software Reset Register */
|
||||
{0xA3,0x00}, /* BIG Endian Support Register */
|
||||
{0xA4,0x00}, /* Scratch Pad Register 0 */
|
||||
{0xA5,0x00}, /* Scratch Pad Register 1 */
|
||||
{0xA8,0x01}, /* GPIO Config Register 0 */
|
||||
{0xA9,0x80}, /* GPIO Config Register 1 */
|
||||
{0xAC,0x01}, /* GPIO Status Control Register 0 */
|
||||
{0xAD,0x00}, /* GPIO Status Control Register 1 */
|
||||
{0xB0,0x10}, /* PWM CV Clock Control Register */
|
||||
{0xB1,0x80}, /* PWM CV Clock Config Register */
|
||||
{0xB2,0x00}, /* CV Clock Burst Length Register */
|
||||
{0xAD,0x80}, /* reset seq */
|
||||
{0x70,0x03},
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -57,17 +57,17 @@ SECTIONS
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
cpu/mpc8xx/traps.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
/*
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
lib_ppc/cache.o (.text)
|
||||
lib_ppc/time.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o (.ppcenv)
|
||||
common/environment.o(.text)
|
||||
*/
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
40
board/kup/kup4x/Makefile
Normal file
40
board/kup/kup4x/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o usb.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
28
board/kup/kup4x/config.mk
Normal file
28
board/kup/kup4x/config.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# KUP4X board
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x40000000
|
||||
311
board/kup/kup4x/kup4x.c
Normal file
311
board/kup/kup4x/kup4x.c
Normal file
@@ -0,0 +1,311 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.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 <mpc8xx.h>
|
||||
#include "../common/kup.h"
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
/* #include "s1d13706.h" */
|
||||
#endif
|
||||
|
||||
#define KUP4X_USB
|
||||
|
||||
|
||||
typedef struct {
|
||||
volatile unsigned char *VmemAddr;
|
||||
volatile unsigned char *RegAddr;
|
||||
} FB_INFO_S1D13xxx;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int usb_init_kup4x (void);
|
||||
|
||||
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
void lcd_logo (bd_t * bd);
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
const uint sdram_table[] = {
|
||||
/*
|
||||
* Single Read. (Offset 0 in UPMA RAM)
|
||||
*/
|
||||
0x1F07FC04, 0xEEAEFC04, 0x11ADFC04, 0xEFBBBC00,
|
||||
0x1FF77C47, /* last */
|
||||
|
||||
/*
|
||||
* SDRAM Initialization (offset 5 in UPMA RAM)
|
||||
*
|
||||
* This is no UPM entry point. The following definition uses
|
||||
* the remaining space to establish an initialization
|
||||
* sequence, which is executed by a RUN command.
|
||||
*
|
||||
*/
|
||||
0x1FF77C35, 0xEFEABC34, 0x1FB57C35, /* last */
|
||||
|
||||
/*
|
||||
* Burst Read. (Offset 8 in UPMA RAM)
|
||||
*/
|
||||
0x1F07FC04, 0xEEAEFC04, 0x10ADFC04, 0xF0AFFC00,
|
||||
0xF0AFFC00, 0xF1AFFC00, 0xEFBBBC00, 0x1FF77C47, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Single Write. (Offset 18 in UPMA RAM)
|
||||
*/
|
||||
0x1F27FC04, 0xEEAEBC00, 0x01B93C04, 0x1FF77C47, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Burst Write. (Offset 20 in UPMA RAM)
|
||||
*/
|
||||
0x1F07FC04, 0xEEAEBC00, 0x10AD7C00, 0xF0AFFC00,
|
||||
0xF0AFFC00, 0xE1BBBC04, 0x1FF77C47, /* last */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Refresh (Offset 30 in UPMA RAM)
|
||||
*/
|
||||
0x1FF5FC84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
|
||||
0xFFFFFC84, 0xFFFFFC07, /* last */
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Exception. (Offset 3c in UPMA RAM)
|
||||
*/
|
||||
0x7FFFFC07, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*/
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
uchar *latch, rev, mod;
|
||||
|
||||
/*
|
||||
* Init ChipSelect #4 (CAN + HW-Latch)
|
||||
*/
|
||||
memctl->memc_or4 = 0xFFFF8926;
|
||||
memctl->memc_br4 = 0x90000401;
|
||||
|
||||
latch = (uchar *) 0x90000200;
|
||||
rev = (*latch & 0xF8) >> 3;
|
||||
mod = (*latch & 0x03);
|
||||
printf ("Board: KUP4X Rev %d.%d SN: %s\n", rev, mod,
|
||||
getenv ("ethaddr"));
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
long int size_b0 = 0;
|
||||
long int size_b1 = 0;
|
||||
long int size_b2 = 0;
|
||||
long int size_b3 = 0;
|
||||
|
||||
upmconfig (UPMA, (uint *) sdram_table,
|
||||
sizeof (sdram_table) / sizeof (uint));
|
||||
/*
|
||||
* Preliminary prescaler for refresh (depends on number of
|
||||
* banks): This value is selected for four cycles every 62.4 us
|
||||
* with two SDRAM banks or four cycles every 31.2 us with one
|
||||
* bank. It will be adjusted after memory sizing.
|
||||
*/
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
|
||||
memctl->memc_mar = 0x00000088;
|
||||
|
||||
/*
|
||||
* Map controller banks 1 and 2 to the SDRAM banks 2 and 3 at
|
||||
* preliminary addresses - these have to be modified after the
|
||||
* SDRAM size has been determined.
|
||||
*/
|
||||
/* memctl->memc_or1 = CFG_OR1_PRELIM; */
|
||||
/* memctl->memc_br1 = CFG_BR1_PRELIM; */
|
||||
|
||||
/* memctl->memc_or2 = CFG_OR2_PRELIM; */
|
||||
/* memctl->memc_br2 = CFG_BR2_PRELIM; */
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
udelay (200);
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80002830; /* SDRAM bank 0 - execute twice */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80002106; /* SDRAM bank 0 - RUN MRS Pattern from loc 6 */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mcr = 0x80004105; /* SDRAM bank 1 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80004830; /* SDRAM bank 1 - execute twice */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80004106; /* SDRAM bank 1 - RUN MRS Pattern from loc 6 */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mcr = 0x80006105; /* SDRAM bank 2 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80006830; /* SDRAM bank 2 - execute twice */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80006106; /* SDRAM bank 2 - RUN MRS Pattern from loc 6 */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mcr = 0x8000C105; /* SDRAM bank 2 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x8000C830; /* SDRAM bank 2 - execute twice */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x8000C106; /* SDRAM bank 2 - RUN MRS Pattern from loc 6 */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
udelay (1000);
|
||||
#if 0 /* 4 x 8MB */
|
||||
size_b0 = 0x00800000;
|
||||
size_b1 = 0x00800000;
|
||||
size_b2 = 0x00800000;
|
||||
size_b3 = 0x00800000;
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
udelay (1000);
|
||||
memctl->memc_or1 = 0xFF800A00;
|
||||
memctl->memc_br1 = 0x00000081;
|
||||
memctl->memc_or2 = 0xFF000A00;
|
||||
memctl->memc_br2 = 0x00800081;
|
||||
memctl->memc_or3 = 0xFE000A00;
|
||||
memctl->memc_br3 = 0x01000081;
|
||||
memctl->memc_or6 = 0xFE000A00;
|
||||
memctl->memc_br6 = 0x01800081;
|
||||
#else /* 4 x 16 MB */
|
||||
size_b0 = 0x01000000;
|
||||
size_b1 = 0x01000000;
|
||||
size_b2 = 0x01000000;
|
||||
size_b3 = 0x01000000;
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
udelay (1000);
|
||||
memctl->memc_or1 = 0xFF000A00;
|
||||
memctl->memc_br1 = 0x00000081;
|
||||
memctl->memc_or2 = 0xFE000A00;
|
||||
memctl->memc_br2 = 0x01000081;
|
||||
memctl->memc_or3 = 0xFD000A00;
|
||||
memctl->memc_br3 = 0x02000081;
|
||||
memctl->memc_or6 = 0xFC000A00;
|
||||
memctl->memc_br6 = 0x03000081;
|
||||
#endif
|
||||
udelay (10000);
|
||||
|
||||
return (size_b0 + size_b1 + size_b2 + size_b3);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Check memory range for valid RAM. A simple memory test determines
|
||||
* the actually available RAM size between addresses `base' and
|
||||
* `base + maxsize'. Some (not all) hardware errors are detected:
|
||||
* - short between address lines
|
||||
* - short between data lines
|
||||
*/
|
||||
#if 0
|
||||
static long int dram_size (long int mamr_value, long int *base,
|
||||
long int maxsize)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
volatile long int *addr;
|
||||
ulong cnt, val;
|
||||
ulong save[32]; /* to make test non-destructive */
|
||||
unsigned char i = 0;
|
||||
|
||||
memctl->memc_mamr = mamr_value;
|
||||
|
||||
for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
|
||||
addr = base + cnt; /* pointer arith! */
|
||||
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
/* write 0 to base address */
|
||||
addr = base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
/* check at base address */
|
||||
if ((val = *addr) != 0) {
|
||||
*addr = save[i];
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
|
||||
addr = base + cnt; /* pointer arith! */
|
||||
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
|
||||
if (val != (~cnt)) {
|
||||
return (cnt * sizeof (long));
|
||||
}
|
||||
}
|
||||
return (maxsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
|
||||
#ifdef CONFIG_IDE_LED
|
||||
/* Configure PA8 as output port */
|
||||
immap->im_ioport.iop_padir |= 0x80;
|
||||
immap->im_ioport.iop_paodr |= 0x80;
|
||||
immap->im_ioport.iop_papar &= ~0x80;
|
||||
immap->im_ioport.iop_padat |= 0x80; /* turn it off */
|
||||
#endif
|
||||
#ifdef KUP4X_USB
|
||||
usb_init_kup4x ();
|
||||
#endif
|
||||
setenv ("hw", "4x");
|
||||
poweron_key ();
|
||||
return (0);
|
||||
}
|
||||
141
board/kup/kup4x/u-boot.lds
Normal file
141
board/kup/kup4x/u-boot.lds
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
/*
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
*/
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
135
board/kup/kup4x/u-boot.lds.debug
Normal file
135
board/kup/kup4x/u-boot.lds.debug
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
81
board/kup/kup4x/usb.c
Normal file
81
board/kup/kup4x/usb.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.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 <mpc8xx.h>
|
||||
#include "../common/kup.h"
|
||||
|
||||
|
||||
#define SL811_ADR (0x50000000)
|
||||
#define SL811_DAT (0x50000001)
|
||||
|
||||
|
||||
static void sl811_write_index_data (__u8 index, __u8 data)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
__asm__ ("eieio");
|
||||
*(volatile unsigned char *) (SL811_DAT) = data;
|
||||
__asm__ ("eieio");
|
||||
}
|
||||
|
||||
static __u8 sl811_read_index_data (__u8 index)
|
||||
{
|
||||
__u8 data;
|
||||
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
__asm__ ("eieio");
|
||||
data = *(volatile unsigned char *) (SL811_DAT);
|
||||
__asm__ ("eieio");
|
||||
return (data);
|
||||
}
|
||||
|
||||
int usb_init_kup4x (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
int i;
|
||||
unsigned char tmp;
|
||||
|
||||
memctl = &immap->im_memctl;
|
||||
memctl->memc_or7 = 0xFFFF8726;
|
||||
memctl->memc_br7 = 0x50000401; /* start at 0x50000000 */
|
||||
/* BP 14 low = USB ON */
|
||||
immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
|
||||
/* PB 14 nomal port */
|
||||
immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
|
||||
/* output */
|
||||
immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
|
||||
|
||||
puts ("USB: ");
|
||||
|
||||
for (i = 0x10; i < 0xff; i++) {
|
||||
sl811_write_index_data (i, i);
|
||||
tmp = (sl811_read_index_data (i));
|
||||
if (tmp != i) {
|
||||
printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
printf ("SL811 ready\n");
|
||||
return (0);
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*---------------------------------------------------------------------------- */
|
||||
/* */
|
||||
/* File generated by S1D13706CFG.EXE */
|
||||
/* */
|
||||
/* Copyright (c) 2000,2001 Epson Research and Development, Inc. */
|
||||
/* All rights reserved. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------- */
|
||||
|
||||
/* Panel: 320x240x8bpp 70Hz Color Single STN 8-bit (PCLK=6.250MHz) (Format 2) */
|
||||
|
||||
#define S1D_DISPLAY_WIDTH 320
|
||||
#define S1D_DISPLAY_HEIGHT 240
|
||||
#define S1D_DISPLAY_BPP 8
|
||||
#define S1D_DISPLAY_SCANLINE_BYTES 320
|
||||
#define S1D_PHYSICAL_VMEM_ADDR 0x800A0000L
|
||||
#define S1D_PHYSICAL_VMEM_SIZE 0x14000L
|
||||
#define S1D_PHYSICAL_REG_ADDR 0x80080000L
|
||||
#define S1D_PHYSICAL_REG_SIZE 0x100
|
||||
#define S1D_DISPLAY_PCLK 6250
|
||||
#define S1D_PALETTE_SIZE 256
|
||||
#define S1D_REGDELAYOFF 0xFFFE
|
||||
#define S1D_REGDELAYON 0xFFFF
|
||||
|
||||
#define S1D_WRITE_PALETTE(p,i,r,g,b) \
|
||||
{ \
|
||||
((volatile S1D_VALUE*)(p))[0x0A/sizeof(S1D_VALUE)] = (S1D_VALUE)((r)>>4); \
|
||||
((volatile S1D_VALUE*)(p))[0x09/sizeof(S1D_VALUE)] = (S1D_VALUE)((g)>>4); \
|
||||
((volatile S1D_VALUE*)(p))[0x08/sizeof(S1D_VALUE)] = (S1D_VALUE)((b)>>4); \
|
||||
((volatile S1D_VALUE*)(p))[0x0B/sizeof(S1D_VALUE)] = (S1D_VALUE)(i); \
|
||||
}
|
||||
|
||||
#define S1D_READ_PALETTE(p,i,r,g,b) \
|
||||
{ \
|
||||
((volatile S1D_VALUE*)(p))[0x0F/sizeof(S1D_VALUE)] = (S1D_VALUE)(i); \
|
||||
r = ((volatile S1D_VALUE*)(p))[0x0E/sizeof(S1D_VALUE)]; \
|
||||
g = ((volatile S1D_VALUE*)(p))[0x0D/sizeof(S1D_VALUE)]; \
|
||||
b = ((volatile S1D_VALUE*)(p))[0x0C/sizeof(S1D_VALUE)]; \
|
||||
}
|
||||
|
||||
typedef unsigned short S1D_INDEX;
|
||||
typedef unsigned char S1D_VALUE;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
S1D_INDEX Index;
|
||||
S1D_VALUE Value;
|
||||
} S1D_REGS;
|
||||
|
||||
static S1D_REGS aS1DRegs[] =
|
||||
{
|
||||
{0x04,0x10}, /* BUSCLK MEMCLK Config Register */
|
||||
#if 0
|
||||
{0x05,0x32}, /* PCLK Config Register */
|
||||
#endif
|
||||
{0x10,0xD0}, /* PANEL Type Register */
|
||||
{0x11,0x00}, /* MOD Rate Register */
|
||||
#if 0
|
||||
{0x12,0x34}, /* Horizontal Total Register */
|
||||
#endif
|
||||
{0x14,0x27}, /* Horizontal Display Period Register */
|
||||
{0x16,0x00}, /* Horizontal Display Period Start Pos Register 0 */
|
||||
{0x17,0x00}, /* Horizontal Display Period Start Pos Register 1 */
|
||||
{0x18,0xF0}, /* Vertical Total Register 0 */
|
||||
{0x19,0x00}, /* Vertical Total Register 1 */
|
||||
{0x1C,0xEF}, /* Vertical Display Period Register 0 */
|
||||
{0x1D,0x00}, /* Vertical Display Period Register 1 */
|
||||
{0x1E,0x00}, /* Vertical Display Period Start Pos Register 0 */
|
||||
{0x1F,0x00}, /* Vertical Display Period Start Pos Register 1 */
|
||||
{0x20,0x87}, /* Horizontal Sync Pulse Width Register */
|
||||
{0x22,0x00}, /* Horizontal Sync Pulse Start Pos Register 0 */
|
||||
{0x23,0x00}, /* Horizontal Sync Pulse Start Pos Register 1 */
|
||||
{0x24,0x80}, /* Vertical Sync Pulse Width Register */
|
||||
{0x26,0x01}, /* Vertical Sync Pulse Start Pos Register 0 */
|
||||
{0x27,0x00}, /* Vertical Sync Pulse Start Pos Register 1 */
|
||||
{0x70,0x83}, /* Display Mode Register */
|
||||
{0x71,0x00}, /* Special Effects Register */
|
||||
{0x74,0x00}, /* Main Window Display Start Address Register 0 */
|
||||
{0x75,0x00}, /* Main Window Display Start Address Register 1 */
|
||||
{0x76,0x00}, /* Main Window Display Start Address Register 2 */
|
||||
{0x78,0x50}, /* Main Window Address Offset Register 0 */
|
||||
{0x79,0x00}, /* Main Window Address Offset Register 1 */
|
||||
{0x7C,0x00}, /* Sub Window Display Start Address Register 0 */
|
||||
{0x7D,0x00}, /* Sub Window Display Start Address Register 1 */
|
||||
{0x7E,0x00}, /* Sub Window Display Start Address Register 2 */
|
||||
{0x80,0x50}, /* Sub Window Address Offset Register 0 */
|
||||
{0x81,0x00}, /* Sub Window Address Offset Register 1 */
|
||||
{0x84,0x00}, /* Sub Window X Start Pos Register 0 */
|
||||
{0x85,0x00}, /* Sub Window X Start Pos Register 1 */
|
||||
{0x88,0x00}, /* Sub Window Y Start Pos Register 0 */
|
||||
{0x89,0x00}, /* Sub Window Y Start Pos Register 1 */
|
||||
{0x8C,0x4F}, /* Sub Window X End Pos Register 0 */
|
||||
{0x8D,0x00}, /* Sub Window X End Pos Register 1 */
|
||||
{0x90,0xEF}, /* Sub Window Y End Pos Register 0 */
|
||||
{0x91,0x00}, /* Sub Window Y End Pos Register 1 */
|
||||
{0xA0,0x00}, /* Power Save Config Register */
|
||||
{0xA1,0x00}, /* CPU Access Control Register */
|
||||
{0xA2,0x00}, /* Software Reset Register */
|
||||
{0xA3,0x00}, /* BIG Endian Support Register */
|
||||
{0xA4,0x00}, /* Scratch Pad Register 0 */
|
||||
{0xA5,0x00}, /* Scratch Pad Register 1 */
|
||||
{0xA8,0x01}, /* GPIO Config Register 0 */
|
||||
{0xA9,0x80}, /* GPIO Config Register 1 */
|
||||
{0xAC,0x01}, /* GPIO Status Control Register 0 */
|
||||
{0xAD,0x00}, /* GPIO Status Control Register 1 */
|
||||
{0xB0,0x10}, /* PWM CV Clock Control Register */
|
||||
{0xB1,0x80}, /* PWM CV Clock Config Register */
|
||||
{0xB2,0x00}, /* CV Clock Burst Length Register */
|
||||
{0xB3,0xA0}, /* PWM Clock Duty Cycle Register */
|
||||
{0xAD,0x80}, /* reset seq */
|
||||
{0x70,0x03}, /* */
|
||||
};
|
||||
@@ -9,7 +9,7 @@
|
||||
* (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.
|
||||
* (C) Copyright 2003-2004 Arabella Software Ltd.
|
||||
* Yuli Barcohen <yuli@arabellasw.com>
|
||||
* Added support for SDRAM DIMMs SPD EEPROM, MII, Ethernet PHY init.
|
||||
*
|
||||
@@ -47,121 +47,137 @@
|
||||
* according to the five values podr/pdir/ppar/psor/pdat for that entry
|
||||
*/
|
||||
|
||||
#define CFG_FCC1 (CONFIG_ETHER_INDEX == 1)
|
||||
#define CFG_FCC2 (CONFIG_ETHER_INDEX == 2)
|
||||
#define CFG_FCC3 (CONFIG_ETHER_INDEX == 3)
|
||||
|
||||
const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port A configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
|
||||
/* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
|
||||
/* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
|
||||
/* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
|
||||
/* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
|
||||
/* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
|
||||
/* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
|
||||
/* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
|
||||
/* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
|
||||
/* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
|
||||
/* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
|
||||
/* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
|
||||
/* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
|
||||
/* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
|
||||
/* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
|
||||
/* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
|
||||
/* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
|
||||
/* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
|
||||
/* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
|
||||
/* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
|
||||
/* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
|
||||
/* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
|
||||
/* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
|
||||
/* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
|
||||
/* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 1, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
|
||||
/* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
|
||||
/* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
|
||||
/* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
|
||||
/* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
|
||||
/* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { CFG_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII COL */
|
||||
/* PA30 */ { CFG_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII CRS */
|
||||
/* PA29 */ { CFG_FCC1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_ER */
|
||||
/* PA28 */ { CFG_FCC1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_EN */
|
||||
/* PA27 */ { CFG_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_DV */
|
||||
/* PA26 */ { CFG_FCC1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_ER */
|
||||
/* PA25 */ { 0, 0, 0, 0, 0, 0 }, /* PA25 */
|
||||
/* PA24 */ { 0, 0, 0, 0, 0, 0 }, /* PA24 */
|
||||
/* PA23 */ { 0, 0, 0, 0, 0, 0 }, /* PA23 */
|
||||
/* PA22 */ { 0, 0, 0, 0, 0, 0 }, /* PA22 */
|
||||
/* PA21 */ { CFG_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[3] */
|
||||
/* PA20 */ { CFG_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[2] */
|
||||
/* PA19 */ { CFG_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[1] */
|
||||
/* PA18 */ { CFG_FCC1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[0] */
|
||||
/* PA17 */ { CFG_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[0] */
|
||||
/* PA16 */ { CFG_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[1] */
|
||||
/* PA15 */ { CFG_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[2] */
|
||||
/* PA14 */ { CFG_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[3] */
|
||||
/* PA13 */ { 0, 0, 0, 0, 0, 0 }, /* PA13 */
|
||||
/* PA12 */ { 0, 0, 0, 0, 0, 0 }, /* PA12 */
|
||||
/* PA11 */ { 0, 0, 0, 0, 0, 0 }, /* PA11 */
|
||||
/* PA10 */ { 0, 0, 0, 0, 0, 0 }, /* PA10 */
|
||||
/* PA9 */ { 0, 0, 0, 0, 0, 0 }, /* PA9 */
|
||||
/* PA8 */ { 0, 0, 0, 0, 0, 0 }, /* PA8 */
|
||||
/* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 0, 0, 0, 0, 0, 0 }, /* PA6 */
|
||||
/* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
|
||||
/* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
|
||||
/* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
|
||||
/* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 0, 0, 0, 0, 0, 0 }, /* PA1 */
|
||||
/* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
|
||||
},
|
||||
|
||||
/* Port B configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 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 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
|
||||
/* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
|
||||
/* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
|
||||
/* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
|
||||
/* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
|
||||
/* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
|
||||
/* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* 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 */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ { CFG_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
|
||||
/* PB30 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
|
||||
/* PB29 */ { CFG_FCC2, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
|
||||
/* PB28 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
|
||||
/* PB27 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
|
||||
/* PB26 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
|
||||
/* PB25 */ { CFG_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
|
||||
/* PB24 */ { CFG_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
|
||||
/* PB23 */ { CFG_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
|
||||
/* PB22 */ { CFG_FCC2, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
|
||||
/* PB21 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
|
||||
/* PB20 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
|
||||
/* PB19 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
|
||||
/* PB18 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
|
||||
/* PB17 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
|
||||
/* PB16 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
|
||||
/* PB15 */ { CFG_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
|
||||
/* PB14 */ { CFG_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
|
||||
/* PB13 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:COL */
|
||||
/* PB12 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
|
||||
/* PB11 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB10 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB9 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB8 */ { CFG_FCC3, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB7 */ { CFG_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB6 */ { CFG_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB5 */ { CFG_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB4 */ { CFG_FCC3, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
},
|
||||
|
||||
/* Port C */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
|
||||
/* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
|
||||
/* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
|
||||
/* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
|
||||
/* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
|
||||
/* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
|
||||
/* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
|
||||
/* 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 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 */
|
||||
/* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
|
||||
/* 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, 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 */
|
||||
/* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
|
||||
/* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
|
||||
/* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
|
||||
/* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
|
||||
/* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
|
||||
/* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 0, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 0, 0, 0, 0, 0, 0 }, /* PC29 */
|
||||
/* PC28 */ { 0, 0, 0, 0, 0, 0 }, /* PC28 */
|
||||
/* PC27 */ { 0, 0, 0, 0, 0, 0 }, /* PC27 */
|
||||
/* PC26 */ { 0, 0, 0, 0, 0, 0 }, /* PC26 */
|
||||
/* PC25 */ { 0, 0, 0, 0, 0, 0 }, /* PC25 */
|
||||
/* PC24 */ { 0, 0, 0, 0, 0, 0 }, /* PC24 */
|
||||
/* PC23 */ { 0, 0, 0, 0, 0, 0 }, /* PC23 */
|
||||
/* PC22 */ { CFG_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII Tx Clock (CLK10) */
|
||||
/* PC21 */ { CFG_FCC1, 1, 0, 0, 0, 0 }, /* FCC1 MII Rx Clock (CLK11) */
|
||||
/* PC20 */ { 0, 0, 0, 0, 0, 0 }, /* PC20 */
|
||||
#if CONFIG_ADSTYPE == CFG_8272ADS
|
||||
/* PC19 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */
|
||||
/* PC18 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */
|
||||
/* PC17 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK15) */
|
||||
/* PC16 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK16) */
|
||||
#else
|
||||
/* PC19 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK13) */
|
||||
/* PC18 */ { CFG_FCC2, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK14) */
|
||||
/* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */
|
||||
#endif /* CONFIG_ADSTYPE == CFG_8272ADS */
|
||||
/* PC15 */ { 0, 0, 0, 0, 0, 0 }, /* PC15 */
|
||||
/* PC14 */ { 0, 0, 0, 0, 0, 0 }, /* PC14 */
|
||||
/* PC13 */ { 0, 0, 0, 0, 0, 0 }, /* PC13 */
|
||||
/* PC12 */ { 0, 0, 0, 0, 0, 0 }, /* PC12 */
|
||||
/* PC11 */ { 0, 0, 0, 0, 0, 0 }, /* PC11 */
|
||||
#if CONFIG_ADSTYPE == CFG_8272ADS
|
||||
/* PC10 */ { 0, 0, 0, 0, 0, 0 }, /* PC10 */
|
||||
/* PC9 */ { 0, 0, 0, 0, 0, 0 }, /* PC9 */
|
||||
#else
|
||||
/* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */
|
||||
/* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */
|
||||
#endif /* CONFIG_ADSTYPE == CFG_8272ADS */
|
||||
/* PC8 */ { 0, 0, 0, 0, 0, 0 }, /* PC8 */
|
||||
/* PC7 */ { 0, 0, 0, 0, 0, 0 }, /* PC7 */
|
||||
/* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* PC6 */
|
||||
/* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* PC5 */
|
||||
/* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* PC4 */
|
||||
/* PC3 */ { 0, 0, 0, 0, 0, 0 }, /* PC3 */
|
||||
/* PC2 */ { 0, 0, 0, 0, 0, 0 }, /* PC2 */
|
||||
/* PC1 */ { 0, 0, 0, 0, 0, 0 }, /* PC1 */
|
||||
/* PC0 */ { 0, 0, 0, 0, 0, 0 }, /* PC0 */
|
||||
},
|
||||
|
||||
/* 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 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
|
||||
/* PD29 */ { 0, 0, 0, 0, 0, 0 }, /* PD29 */
|
||||
/* PD28 */ { 0, 1, 0, 0, 0, 0 }, /* PD28 */
|
||||
/* PD27 */ { 0, 1, 1, 1, 0, 0 }, /* PD27 */
|
||||
/* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
|
||||
@@ -198,19 +214,25 @@ void reset_phy (void)
|
||||
{
|
||||
vu_long *bcsr = (vu_long *)CFG_BCSR;
|
||||
|
||||
/* reset the FEC port */
|
||||
bcsr[1] &= ~FETH1_RST;
|
||||
/* Reset the PHY */
|
||||
#if CFG_PHY_ADDR == 0
|
||||
bcsr[1] &= ~(FETHIEN1 | FETH1_RST);
|
||||
udelay(2);
|
||||
bcsr[1] |= FETH1_RST;
|
||||
#else
|
||||
bcsr[3] &= ~(FETHIEN2 | FETH2_RST);
|
||||
udelay(2);
|
||||
bcsr[3] |= FETH2_RST;
|
||||
#endif /* CFG_PHY_ADDR == 0 */
|
||||
udelay(1000);
|
||||
#ifdef CONFIG_MII
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
#if CONFIG_ADSTYPE >= CFG_PQ2FADS
|
||||
/*
|
||||
* Do not bypass Rx/Tx (de)scrambler (fix configuration error)
|
||||
* Enable autonegotiation.
|
||||
*/
|
||||
miiphy_write(0, 16, 0x610);
|
||||
miiphy_write(0, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
miiphy_write(CFG_PHY_ADDR, 16, 0x610);
|
||||
miiphy_write(CFG_PHY_ADDR, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#else
|
||||
/*
|
||||
* Ethernet PHY is configured (by means of configuration pins)
|
||||
@@ -218,9 +240,9 @@ void reset_phy (void)
|
||||
* 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);
|
||||
miiphy_write(CFG_PHY_ADDR, PHY_ANAR, 0x01E1); /* Advertise all capabilities */
|
||||
miiphy_write(CFG_PHY_ADDR, PHY_DCR, 0x0000); /* Do not bypass Rx/Tx (de)scrambler */
|
||||
miiphy_write(CFG_PHY_ADDR, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#endif /* CONFIG_ADSTYPE == CFG_PQ2FADS */
|
||||
#endif /* CONFIG_MII */
|
||||
}
|
||||
@@ -229,7 +251,12 @@ int board_early_init_f (void)
|
||||
{
|
||||
vu_long *bcsr = (vu_long *)CFG_BCSR;
|
||||
|
||||
bcsr[1] = ~FETHIEN1 & ~RS232EN_1;
|
||||
#if (CONFIG_CONS_INDEX == 1) || (CONFIG_KGDB_INDEX == 1)
|
||||
bcsr[1] &= ~RS232EN_1;
|
||||
#endif
|
||||
#if (CONFIG_CONS_INDEX > 1) || (CONFIG_KGDB_INDEX > 1)
|
||||
bcsr[1] &= ~RS232EN_2;
|
||||
#endif
|
||||
|
||||
#if CONFIG_ADSTYPE != CFG_8260ADS /* PCI mode can be selected */
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
@@ -252,8 +279,10 @@ int board_early_init_f (void)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
long int msize = 32;
|
||||
#elif CONFIG_ADSTYPE == CFG_8272ADS
|
||||
long int msize = 64;
|
||||
#else
|
||||
long int msize = 16;
|
||||
#endif
|
||||
@@ -470,6 +499,8 @@ int checkboard (void)
|
||||
puts ("Board: Motorola MPC8266ADS\n");
|
||||
#elif CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
puts ("Board: Motorola PQ2FADS-ZU\n");
|
||||
#elif CONFIG_ADSTYPE == CFG_8272ADS
|
||||
puts ("Board: Motorola MPC8272ADS\n");
|
||||
#else
|
||||
puts ("Board: unknown\n");
|
||||
#endif
|
||||
|
||||
40
board/netphone/Makefile
Normal file
40
board/netphone/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o phone_console.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
28
board/netphone/config.mk
Normal file
28
board/netphone/config.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# netVia Boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x40000000
|
||||
528
board/netphone/flash.c
Normal file
528
board/netphone/flash.c
Normal file
@@ -0,0 +1,528 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info);
|
||||
static int write_byte(flash_info_t * info, ulong dest, uchar data);
|
||||
static void flash_get_offsets(ulong base, flash_info_t * info);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
unsigned long size;
|
||||
#if CONFIG_NETPHONE_VERSION == 2
|
||||
unsigned long size1;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i)
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
size = flash_get_size((vu_long *) FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
|
||||
size, size << 20);
|
||||
}
|
||||
|
||||
/* Remap FLASH according to real size */
|
||||
memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size & 0xFFFF8000);
|
||||
memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | (memctl->memc_br0 & ~(BR_BA_MSK));
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size = flash_get_size((vu_long *) CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
flash_get_offsets(CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE, CFG_FLASH_BASE + monitor_flash_len - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
#ifdef CFG_ENV_ADDR_REDUND
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR_REDUND,
|
||||
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
flash_info[0].size = size;
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 2
|
||||
size1 = flash_get_size((vu_long *) FLASH_BASE4_PRELIM, &flash_info[1]);
|
||||
|
||||
if (flash_info[1].flash_id == FLASH_UNKNOWN && size1 > 0) {
|
||||
printf("## Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n", size1, size1 << 20);
|
||||
}
|
||||
|
||||
/* Remap FLASH according to real size */
|
||||
memctl->memc_or4 = CFG_OR_TIMING_FLASH | (-size1 & 0xFFFF8000);
|
||||
memctl->memc_br4 = (CFG_FLASH_BASE4 & BR_BA_MSK) | (memctl->memc_br4 & ~(BR_BA_MSK));
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size1 = flash_get_size((vu_long *) CFG_FLASH_BASE4, &flash_info[1]);
|
||||
|
||||
flash_get_offsets(CFG_FLASH_BASE4, &flash_info[1]);
|
||||
|
||||
size += size1;
|
||||
#endif
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets(ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start address table */
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
}
|
||||
} else if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
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_MX:
|
||||
printf("MXIC ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM040:
|
||||
printf("AM29LV040B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400B:
|
||||
printf("AM29LV400B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400T:
|
||||
printf("AM29LV400T (4 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM800B:
|
||||
printf("AM29LV800B (8 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM800T:
|
||||
printf("AM29LV800T (8 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM160B:
|
||||
printf("AM29LV160B (16 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM160T:
|
||||
printf("AM29LV160T (16 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM320B:
|
||||
printf("AM29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T:
|
||||
printf("AM29LV320T (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
printf(" %08lX%s", info->start[i], info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
uchar mid;
|
||||
uchar pid;
|
||||
vu_char *caddr = (vu_char *) addr;
|
||||
ulong base = (ulong) addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
caddr[0x0555] = 0xAA;
|
||||
caddr[0x02AA] = 0x55;
|
||||
caddr[0x0555] = 0x90;
|
||||
|
||||
mid = caddr[0];
|
||||
switch (mid) {
|
||||
case (AMD_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (FUJ_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case (MX_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_MX;
|
||||
break;
|
||||
case (STM_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_STM;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
pid = caddr[1]; /* device ID */
|
||||
switch (pid) {
|
||||
case (AMD_ID_LV400T & 0xFF):
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 512 kB */
|
||||
|
||||
case (AMD_ID_LV400B & 0xFF):
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 512 kB */
|
||||
|
||||
case (AMD_ID_LV800T & 0xFF):
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (AMD_ID_LV800B & 0xFF):
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (AMD_ID_LV160T & 0xFF):
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case (AMD_ID_LV160B & 0xFF):
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case (AMD_ID_LV040B & 0xFF):
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x00080000;
|
||||
break;
|
||||
|
||||
case (STM_ID_M29W040B & 0xFF):
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x00080000;
|
||||
break;
|
||||
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case (AMD_ID_LV320T & 0xFF):
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case (AMD_ID_LV320B & 0xFF):
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
#endif
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
printf(" ");
|
||||
/* set up sector start address table */
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
}
|
||||
} else if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection: D0 = 1 if protected */
|
||||
caddr = (volatile unsigned char *)(info->start[i]);
|
||||
info->protect[i] = caddr[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
caddr = (vu_char *) info->start[0];
|
||||
|
||||
caddr[0x0555] = 0xAA;
|
||||
caddr[0x02AA] = 0x55;
|
||||
caddr[0x0555] = 0xF0;
|
||||
|
||||
udelay(20000);
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
vu_char *addr = (vu_char *) (info->start[0]);
|
||||
int flag, prot, sect, l_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_UNKNOWN) ||
|
||||
(info->flash_id > FLASH_AMD_COMP)) {
|
||||
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");
|
||||
}
|
||||
|
||||
l_sect = -1;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
addr[0x0555] = 0x80;
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (vu_char *) (info->start[sect]);
|
||||
addr[0] = 0x30;
|
||||
l_sect = sect;
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay(1000);
|
||||
|
||||
/*
|
||||
* We wait for the last triggered sector
|
||||
*/
|
||||
if (l_sect < 0)
|
||||
goto DONE;
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
addr = (vu_char *) (info->start[l_sect]);
|
||||
while ((addr[0] & 0x80) != 0x80) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
return 1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
DONE:
|
||||
/* reset to read mode */
|
||||
addr = (vu_char *) info->start[0];
|
||||
addr[0] = 0xF0; /* reset bank */
|
||||
|
||||
printf(" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
int rc;
|
||||
|
||||
while (cnt > 0) {
|
||||
if ((rc = write_byte(info, addr++, *src++)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
--cnt;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_byte(flash_info_t * info, ulong dest, uchar data)
|
||||
{
|
||||
vu_char *addr = (vu_char *) (info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_char *) dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
addr[0x0555] = 0xA0;
|
||||
|
||||
*((vu_char *) dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer(0);
|
||||
while ((*((vu_char *) dest) & 0x80) != (data & 0x80)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
708
board/netphone/netphone.c
Normal file
708
board/netphone/netphone.c
Normal file
@@ -0,0 +1,708 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Pantelis Antoniou, Intracom S.A., panto@intracom.gr
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pantelis Antoniou, Intracom S.A., panto@intracom.gr
|
||||
* U-Boot port on NetTA4 board
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <miiphy.h>
|
||||
#include <sed156x.h>
|
||||
|
||||
#include "mpc8xx.h"
|
||||
|
||||
#ifdef CONFIG_HW_WATCHDOG
|
||||
#include <watchdog.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/* some sane bit macros */
|
||||
#define _BD(_b) (1U << (31-(_b)))
|
||||
#define _BDR(_l, _h) (((((1U << (31-(_l))) - 1) << 1) | 1) & ~((1U << (31-(_h))) - 1))
|
||||
|
||||
#define _BW(_b) (1U << (15-(_b)))
|
||||
#define _BWR(_l, _h) (((((1U << (15-(_l))) - 1) << 1) | 1) & ~((1U << (15-(_h))) - 1))
|
||||
|
||||
#define _BB(_b) (1U << (7-(_b)))
|
||||
#define _BBR(_l, _h) (((((1U << (7-(_l))) - 1) << 1) | 1) & ~((1U << (7-(_h))) - 1))
|
||||
|
||||
#define _B(_b) _BD(_b)
|
||||
#define _BR(_l, _h) _BDR(_l, _h)
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*
|
||||
* Return 1 always.
|
||||
*/
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
printf ("Intracom NetPhone V%d\n", CONFIG_NETPHONE_VERSION);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
#define CS_0000 0x00000000
|
||||
#define CS_0001 0x10000000
|
||||
#define CS_0010 0x20000000
|
||||
#define CS_0011 0x30000000
|
||||
#define CS_0100 0x40000000
|
||||
#define CS_0101 0x50000000
|
||||
#define CS_0110 0x60000000
|
||||
#define CS_0111 0x70000000
|
||||
#define CS_1000 0x80000000
|
||||
#define CS_1001 0x90000000
|
||||
#define CS_1010 0xA0000000
|
||||
#define CS_1011 0xB0000000
|
||||
#define CS_1100 0xC0000000
|
||||
#define CS_1101 0xD0000000
|
||||
#define CS_1110 0xE0000000
|
||||
#define CS_1111 0xF0000000
|
||||
|
||||
#define BS_0000 0x00000000
|
||||
#define BS_0001 0x01000000
|
||||
#define BS_0010 0x02000000
|
||||
#define BS_0011 0x03000000
|
||||
#define BS_0100 0x04000000
|
||||
#define BS_0101 0x05000000
|
||||
#define BS_0110 0x06000000
|
||||
#define BS_0111 0x07000000
|
||||
#define BS_1000 0x08000000
|
||||
#define BS_1001 0x09000000
|
||||
#define BS_1010 0x0A000000
|
||||
#define BS_1011 0x0B000000
|
||||
#define BS_1100 0x0C000000
|
||||
#define BS_1101 0x0D000000
|
||||
#define BS_1110 0x0E000000
|
||||
#define BS_1111 0x0F000000
|
||||
|
||||
#define GPL0_AAAA 0x00000000
|
||||
#define GPL0_AAA0 0x00200000
|
||||
#define GPL0_AAA1 0x00300000
|
||||
#define GPL0_000A 0x00800000
|
||||
#define GPL0_0000 0x00A00000
|
||||
#define GPL0_0001 0x00B00000
|
||||
#define GPL0_111A 0x00C00000
|
||||
#define GPL0_1110 0x00E00000
|
||||
#define GPL0_1111 0x00F00000
|
||||
|
||||
#define GPL1_0000 0x00000000
|
||||
#define GPL1_0001 0x00040000
|
||||
#define GPL1_1110 0x00080000
|
||||
#define GPL1_1111 0x000C0000
|
||||
|
||||
#define GPL2_0000 0x00000000
|
||||
#define GPL2_0001 0x00010000
|
||||
#define GPL2_1110 0x00020000
|
||||
#define GPL2_1111 0x00030000
|
||||
|
||||
#define GPL3_0000 0x00000000
|
||||
#define GPL3_0001 0x00004000
|
||||
#define GPL3_1110 0x00008000
|
||||
#define GPL3_1111 0x0000C000
|
||||
|
||||
#define GPL4_0000 0x00000000
|
||||
#define GPL4_0001 0x00001000
|
||||
#define GPL4_1110 0x00002000
|
||||
#define GPL4_1111 0x00003000
|
||||
|
||||
#define GPL5_0000 0x00000000
|
||||
#define GPL5_0001 0x00000400
|
||||
#define GPL5_1110 0x00000800
|
||||
#define GPL5_1111 0x00000C00
|
||||
#define LOOP 0x00000080
|
||||
|
||||
#define EXEN 0x00000040
|
||||
|
||||
#define AMX_COL 0x00000000
|
||||
#define AMX_ROW 0x00000020
|
||||
#define AMX_MAR 0x00000030
|
||||
|
||||
#define NA 0x00000008
|
||||
|
||||
#define UTA 0x00000004
|
||||
|
||||
#define TODT 0x00000002
|
||||
|
||||
#define LAST 0x00000001
|
||||
|
||||
#define A10_AAAA GPL0_AAAA
|
||||
#define A10_AAA0 GPL0_AAA0
|
||||
#define A10_AAA1 GPL0_AAA1
|
||||
#define A10_000A GPL0_000A
|
||||
#define A10_0000 GPL0_0000
|
||||
#define A10_0001 GPL0_0001
|
||||
#define A10_111A GPL0_111A
|
||||
#define A10_1110 GPL0_1110
|
||||
#define A10_1111 GPL0_1111
|
||||
|
||||
#define RAS_0000 GPL1_0000
|
||||
#define RAS_0001 GPL1_0001
|
||||
#define RAS_1110 GPL1_1110
|
||||
#define RAS_1111 GPL1_1111
|
||||
|
||||
#define CAS_0000 GPL2_0000
|
||||
#define CAS_0001 GPL2_0001
|
||||
#define CAS_1110 GPL2_1110
|
||||
#define CAS_1111 GPL2_1111
|
||||
|
||||
#define WE_0000 GPL3_0000
|
||||
#define WE_0001 GPL3_0001
|
||||
#define WE_1110 GPL3_1110
|
||||
#define WE_1111 GPL3_1111
|
||||
|
||||
/* #define CAS_LATENCY 3 */
|
||||
#define CAS_LATENCY 2
|
||||
|
||||
const uint sdram_table[0x40] = {
|
||||
|
||||
#if CAS_LATENCY == 3
|
||||
/* RSS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0000 | BS_1111 | A10_0001 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_0001 | BS_0001 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* RBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_0001 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_0001 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* WSS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_0000 | BS_0001 | A10_0000 | RAS_1111 | CAS_0001 | WE_0000 | AMX_COL | UTA, /* WRITE */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* WBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_0000 | A10_0000 | RAS_1111 | CAS_0001 | WE_0000 | AMX_COL, /* WRITE */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0001 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
#endif
|
||||
|
||||
#if CAS_LATENCY == 2
|
||||
/* RSS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_0001 | A10_0000 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_1110 | BS_1111 | A10_0001 | RAS_1110 | CAS_1111 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* RBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_0000 | A10_0000 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0001 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1110 | BS_1111 | A10_0001 | RAS_1110 | CAS_1111 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* WSS */
|
||||
CS_0001 | BS_1111 | A10_AAA0 | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0000 | BS_0001 | A10_0001 | RAS_1110 | CAS_0001 | WE_0000 | AMX_COL | UTA, /* WRITE */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_,
|
||||
|
||||
/* WBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_0000 | A10_0000 | RAS_1111 | CAS_0001 | WE_0001 | AMX_COL, /* WRITE */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1110 | BS_0001 | A10_0001 | RAS_1110 | CAS_1111 | WE_1110 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
#endif
|
||||
|
||||
/* UPT */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_0001 | WE_1111 | AMX_COL | UTA | LOOP, /* ATRFR */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | LOOP, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* EXC */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | LAST,
|
||||
_NOT_USED_,
|
||||
|
||||
/* REG */
|
||||
CS_1110 | BS_1111 | A10_1110 | RAS_1110 | CAS_1110 | WE_1110 | AMX_MAR | UTA,
|
||||
CS_0001 | BS_1111 | A10_0001 | RAS_0001 | CAS_0001 | WE_0001 | AMX_MAR | UTA | LAST,
|
||||
};
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 2
|
||||
static const uint nandcs_table[0x40] = {
|
||||
/* RSS */
|
||||
CS_1000 | GPL4_1111 | GPL5_1111 | UTA,
|
||||
CS_0000 | GPL4_1110 | GPL5_1111 | UTA,
|
||||
CS_0000 | GPL4_0000 | GPL5_1111 | UTA,
|
||||
CS_0000 | GPL4_0000 | GPL5_1111 | UTA,
|
||||
CS_0000 | GPL4_0000 | GPL5_1111,
|
||||
CS_0000 | GPL4_0001 | GPL5_1111 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_1111 | UTA,
|
||||
CS_0011 | GPL4_1111 | GPL5_1111 | UTA | LAST, /* NOP */
|
||||
|
||||
/* RBS */
|
||||
_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_,
|
||||
|
||||
/* WSS */
|
||||
CS_1000 | GPL4_1111 | GPL5_1110 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_0000 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_0000 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_0000 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_0001 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_1111 | UTA,
|
||||
CS_0000 | GPL4_1111 | GPL5_1111,
|
||||
CS_0011 | GPL4_1111 | GPL5_1111 | UTA | LAST,
|
||||
|
||||
/* WBS */
|
||||
_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_,
|
||||
|
||||
/* UPT */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* EXC */
|
||||
CS_0001 | LAST,
|
||||
_NOT_USED_,
|
||||
|
||||
/* REG */
|
||||
CS_1110 ,
|
||||
CS_0001 | LAST,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* 0xC8 = 0b11001000 , CAS3, >> 2 = 0b00 11 0 010 */
|
||||
/* 0x88 = 0b10001000 , CAS2, >> 2 = 0b00 10 0 010 */
|
||||
#define MAR_SDRAM_INIT ((CAS_LATENCY << 6) | 0x00000008LU)
|
||||
|
||||
/* 8 */
|
||||
#define CFG_MAMR ((CFG_MAMR_PTA << MAMR_PTA_SHIFT) | MAMR_PTAE | \
|
||||
MAMR_AMA_TYPE_0 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A11 | \
|
||||
MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_4X)
|
||||
|
||||
void check_ram(unsigned int addr, unsigned int size)
|
||||
{
|
||||
unsigned int i, j, v, vv;
|
||||
volatile unsigned int *p;
|
||||
unsigned int pv;
|
||||
|
||||
p = (unsigned int *)addr;
|
||||
pv = (unsigned int)p;
|
||||
for (i = 0; i < size / sizeof(unsigned int); i++, pv += sizeof(unsigned int))
|
||||
*p++ = pv;
|
||||
|
||||
p = (unsigned int *)addr;
|
||||
for (i = 0; i < size / sizeof(unsigned int); i++) {
|
||||
v = (unsigned int)p;
|
||||
vv = *p;
|
||||
if (vv != v) {
|
||||
printf("%p: read %08x instead of %08x\n", p, vv, v);
|
||||
hang();
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
for (j = 0; j < 5; j++) {
|
||||
switch (j) {
|
||||
case 0: v = 0x00000000; break;
|
||||
case 1: v = 0xffffffff; break;
|
||||
case 2: v = 0x55555555; break;
|
||||
case 3: v = 0xaaaaaaaa; break;
|
||||
default:v = 0xdeadbeef; break;
|
||||
}
|
||||
p = (unsigned int *)addr;
|
||||
for (i = 0; i < size / sizeof(unsigned int); i++) {
|
||||
*p = v;
|
||||
vv = *p;
|
||||
if (vv != v) {
|
||||
printf("%p: read %08x instead of %08x\n", p, vv, v);
|
||||
hang();
|
||||
}
|
||||
*p = ~v;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
long int size;
|
||||
|
||||
upmconfig(UPMB, (uint *) sdram_table, sizeof(sdram_table) / sizeof(sdram_table[0]));
|
||||
|
||||
/*
|
||||
* Preliminary prescaler for refresh
|
||||
*/
|
||||
memctl->memc_mptpr = MPTPR_PTP_DIV8;
|
||||
|
||||
memctl->memc_mar = MAR_SDRAM_INIT; /* 32-bit address to be output on the address bus if AMX = 0b11 */
|
||||
|
||||
/*
|
||||
* Map controller bank 3 to the SDRAM bank at preliminary address.
|
||||
*/
|
||||
memctl->memc_or3 = CFG_OR3_PRELIM;
|
||||
memctl->memc_br3 = CFG_BR3_PRELIM;
|
||||
|
||||
memctl->memc_mbmr = CFG_MAMR & ~MAMR_PTAE; /* no refresh yet */
|
||||
|
||||
udelay(200);
|
||||
|
||||
/* perform SDRAM initialisation sequence */
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_UPM_B | MCR_MB_CS3 | MCR_MLCF(1) | MCR_MAD(0x3C); /* precharge all */
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_UPM_B | MCR_MB_CS3 | MCR_MLCF(2) | MCR_MAD(0x30); /* refresh 2 times(0) */
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_UPM_B | MCR_MB_CS3 | MCR_MLCF(1) | MCR_MAD(0x3E); /* exception program (write mar)*/
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mbmr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay(10000);
|
||||
|
||||
{
|
||||
u32 d1, d2;
|
||||
|
||||
d1 = 0xAA55AA55;
|
||||
*(volatile u32 *)0 = d1;
|
||||
d2 = *(volatile u32 *)0;
|
||||
if (d1 != d2) {
|
||||
printf("DRAM fails: wrote 0x%08x read 0x%08x\n", d1, d2);
|
||||
hang();
|
||||
}
|
||||
|
||||
d1 = 0x55AA55AA;
|
||||
*(volatile u32 *)0 = d1;
|
||||
d2 = *(volatile u32 *)0;
|
||||
if (d1 != d2) {
|
||||
printf("DRAM fails: wrote 0x%08x read 0x%08x\n", d1, d2);
|
||||
hang();
|
||||
}
|
||||
}
|
||||
|
||||
size = get_ram_size((long *)0, SDRAM_MAX_SIZE);
|
||||
|
||||
if (size == 0) {
|
||||
printf("SIZE is zero: LOOP on 0\n");
|
||||
for (;;) {
|
||||
*(volatile u32 *)0 = 0;
|
||||
(void)*(volatile u32 *)0;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void reset_phys(void)
|
||||
{
|
||||
int phyno;
|
||||
unsigned short v;
|
||||
|
||||
udelay(10000);
|
||||
/* reset the damn phys */
|
||||
mii_init();
|
||||
|
||||
for (phyno = 0; phyno < 32; ++phyno) {
|
||||
miiphy_read(phyno, PHY_PHYIDR1, &v);
|
||||
if (v == 0xFFFF)
|
||||
continue;
|
||||
miiphy_write(phyno, PHY_BMCR, PHY_BMCR_POWD);
|
||||
udelay(10000);
|
||||
miiphy_write(phyno, PHY_BMCR, PHY_BMCR_RESET | PHY_BMCR_AUTON);
|
||||
udelay(10000);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* GP = general purpose, SP = special purpose (on chip peripheral) */
|
||||
|
||||
/* bits that can have a special purpose or can be configured as inputs/outputs */
|
||||
#define PA_GP_INMASK 0
|
||||
#define PA_GP_OUTMASK (_BW(3) | _BW(7) | _BW(10) | _BW(14) | _BW(15))
|
||||
#define PA_SP_MASK 0
|
||||
#define PA_ODR_VAL 0
|
||||
#define PA_GP_OUTVAL (_BW(3) | _BW(14) | _BW(15))
|
||||
#define PA_SP_DIRVAL 0
|
||||
|
||||
#define PB_GP_INMASK _B(28)
|
||||
#define PB_GP_OUTMASK (_B(19) | _B(23) | _B(26) | _B(27) | _B(29) | _B(30))
|
||||
#define PB_SP_MASK (_BR(22, 25))
|
||||
#define PB_ODR_VAL 0
|
||||
#define PB_GP_OUTVAL (_B(26) | _B(27) | _B(29) | _B(30))
|
||||
#define PB_SP_DIRVAL 0
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
#define PC_GP_INMASK _BW(12)
|
||||
#define PC_GP_OUTMASK (_BW(10) | _BW(11) | _BW(13) | _BW(15))
|
||||
#elif CONFIG_NETPHONE_VERSION == 2
|
||||
#define PC_GP_INMASK (_BW(13) | _BW(15))
|
||||
#define PC_GP_OUTMASK (_BW(10) | _BW(11) | _BW(12))
|
||||
#endif
|
||||
#define PC_SP_MASK 0
|
||||
#define PC_SOVAL 0
|
||||
#define PC_INTVAL 0
|
||||
#define PC_GP_OUTVAL (_BW(10) | _BW(11))
|
||||
#define PC_SP_DIRVAL 0
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
#define PE_GP_INMASK _B(31)
|
||||
#define PE_GP_OUTMASK (_B(17) | _B(18) |_B(20) | _B(24) | _B(27) | _B(28) | _B(29) | _B(30))
|
||||
#define PE_GP_OUTVAL (_B(20) | _B(24) | _B(27) | _B(28))
|
||||
#elif CONFIG_NETPHONE_VERSION == 2
|
||||
#define PE_GP_INMASK _BR(28, 31)
|
||||
#define PE_GP_OUTMASK (_B(17) | _B(18) |_B(20) | _B(24) | _B(27))
|
||||
#define PE_GP_OUTVAL (_B(20) | _B(24) | _B(27))
|
||||
#endif
|
||||
#define PE_SP_MASK 0
|
||||
#define PE_ODR_VAL 0
|
||||
#define PE_SP_DIRVAL 0
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile iop8xx_t *ioport = &immap->im_ioport;
|
||||
volatile cpm8xx_t *cpm = &immap->im_cpm;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
|
||||
/* NAND chip select */
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
memctl->memc_or1 = ((0xFFFFFFFFLU & ~(NAND_SIZE - 1)) | OR_CSNT_SAM | OR_BI | OR_SCY_8_CLK | OR_EHTR | OR_TRLX);
|
||||
memctl->memc_br1 = ((NAND_BASE & BR_BA_MSK) | BR_PS_8 | BR_V);
|
||||
#elif CONFIG_NETPHONE_VERSION == 2
|
||||
upmconfig(UPMA, (uint *) nandcs_table, sizeof(nandcs_table) / sizeof(nandcs_table[0]));
|
||||
memctl->memc_or1 = ((0xFFFFFFFFLU & ~(NAND_SIZE - 1)) | OR_BI | OR_G5LS);
|
||||
memctl->memc_br1 = ((NAND_BASE & BR_BA_MSK) | BR_PS_8 | BR_V | BR_MS_UPMA);
|
||||
memctl->memc_mamr = 0; /* all clear */
|
||||
#endif
|
||||
|
||||
/* DSP chip select */
|
||||
memctl->memc_or2 = ((0xFFFFFFFFLU & ~(DSP_SIZE - 1)) | OR_CSNT_SAM | OR_BI | OR_ACS_DIV2 | OR_SETA | OR_TRLX);
|
||||
memctl->memc_br2 = ((DSP_BASE & BR_BA_MSK) | BR_PS_16 | BR_V);
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
memctl->memc_br4 &= ~BR_V;
|
||||
#endif
|
||||
memctl->memc_br5 &= ~BR_V;
|
||||
memctl->memc_br6 &= ~BR_V;
|
||||
memctl->memc_br7 &= ~BR_V;
|
||||
|
||||
ioport->iop_padat = PA_GP_OUTVAL;
|
||||
ioport->iop_paodr = PA_ODR_VAL;
|
||||
ioport->iop_padir = PA_GP_OUTMASK | PA_SP_DIRVAL;
|
||||
ioport->iop_papar = PA_SP_MASK;
|
||||
|
||||
cpm->cp_pbdat = PB_GP_OUTVAL;
|
||||
cpm->cp_pbodr = PB_ODR_VAL;
|
||||
cpm->cp_pbdir = PB_GP_OUTMASK | PB_SP_DIRVAL;
|
||||
cpm->cp_pbpar = PB_SP_MASK;
|
||||
|
||||
ioport->iop_pcdat = PC_GP_OUTVAL;
|
||||
ioport->iop_pcdir = PC_GP_OUTMASK | PC_SP_DIRVAL;
|
||||
ioport->iop_pcso = PC_SOVAL;
|
||||
ioport->iop_pcint = PC_INTVAL;
|
||||
ioport->iop_pcpar = PC_SP_MASK;
|
||||
|
||||
cpm->cp_pedat = PE_GP_OUTVAL;
|
||||
cpm->cp_peodr = PE_ODR_VAL;
|
||||
cpm->cp_pedir = PE_GP_OUTMASK | PE_SP_DIRVAL;
|
||||
cpm->cp_pepar = PE_SP_MASK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
|
||||
extern ulong nand_probe(ulong physadr);
|
||||
extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
|
||||
|
||||
void nand_init(void)
|
||||
{
|
||||
unsigned long totlen;
|
||||
|
||||
totlen = nand_probe(CFG_NAND_BASE);
|
||||
printf ("%4lu MB\n", totlen >> 20);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HW_WATCHDOG
|
||||
|
||||
void hw_watchdog_reset(void)
|
||||
{
|
||||
/* XXX add here the really funky stuff */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SHOW_ACTIVITY
|
||||
|
||||
static volatile int left_to_poll = PHONE_CONSOLE_POLL_HZ; /* poll */
|
||||
|
||||
/* called from timer interrupt every 1/CFG_HZ sec */
|
||||
void board_show_activity(ulong timestamp)
|
||||
{
|
||||
if (left_to_poll > -PHONE_CONSOLE_POLL_HZ)
|
||||
--left_to_poll;
|
||||
}
|
||||
|
||||
extern void phone_console_do_poll(void);
|
||||
|
||||
static void do_poll(void)
|
||||
{
|
||||
unsigned int base;
|
||||
|
||||
while (left_to_poll <= 0) {
|
||||
phone_console_do_poll();
|
||||
base = left_to_poll + PHONE_CONSOLE_POLL_HZ;
|
||||
do {
|
||||
left_to_poll = base;
|
||||
} while (base != left_to_poll);
|
||||
}
|
||||
}
|
||||
|
||||
/* called when looping */
|
||||
void show_activity(int arg)
|
||||
{
|
||||
do_poll();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CFG_CONSOLE_IS_IN_ENV) && defined(CFG_CONSOLE_OVERWRITE_ROUTINE)
|
||||
int overwrite_console(void)
|
||||
{
|
||||
/* printf("overwrite_console called\n"); */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int drv_phone_init(void);
|
||||
extern int drv_phone_use_me(void);
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
return drv_phone_init();
|
||||
}
|
||||
|
||||
int last_stage_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 2
|
||||
/* assert peripheral reset */
|
||||
((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat &= ~_BW(12);
|
||||
for (i = 0; i < 10; i++)
|
||||
udelay(1000);
|
||||
((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat |= _BW(12);
|
||||
#endif
|
||||
reset_phys();
|
||||
|
||||
/* check in order to enable the local console */
|
||||
left_to_poll = PHONE_CONSOLE_POLL_HZ;
|
||||
i = CFG_HZ * 2;
|
||||
while (i > 0) {
|
||||
|
||||
if (tstc()) {
|
||||
getc();
|
||||
break;
|
||||
}
|
||||
|
||||
do_poll();
|
||||
|
||||
if (drv_phone_use_me()) {
|
||||
console_assign(stdin, "phone");
|
||||
console_assign(stdout, "phone");
|
||||
console_assign(stderr, "phone");
|
||||
setenv("bootdelay", "-1");
|
||||
break;
|
||||
}
|
||||
|
||||
udelay(1000000 / CFG_HZ);
|
||||
i--;
|
||||
left_to_poll--;
|
||||
}
|
||||
left_to_poll = PHONE_CONSOLE_POLL_HZ;
|
||||
|
||||
return 0;
|
||||
}
|
||||
1143
board/netphone/phone_console.c
Normal file
1143
board/netphone/phone_console.c
Normal file
File diff suppressed because it is too large
Load Diff
138
board/netphone/u-boot.lds
Normal file
138
board/netphone/u-boot.lds
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_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/mpc8xx/start.o (.text)
|
||||
cpu/mpc8xx/traps.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
lib_ppc/cache.o (.text)
|
||||
lib_ppc/time.o (.text)
|
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/environment.o (.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
135
board/netphone/u-boot.lds.debug
Normal file
135
board/netphone/u-boot.lds.debug
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
40
board/netta/Makefile
Normal file
40
board/netta/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o dsp.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
28
board/netta/config.mk
Normal file
28
board/netta/config.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# netVia Boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x40000000
|
||||
1031
board/netta/dsp.c
Normal file
1031
board/netta/dsp.c
Normal file
File diff suppressed because it is too large
Load Diff
508
board/netta/flash.c
Normal file
508
board/netta/flash.c
Normal file
@@ -0,0 +1,508 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info);
|
||||
static int write_byte(flash_info_t * info, ulong dest, uchar data);
|
||||
static void flash_get_offsets(ulong base, flash_info_t * info);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
unsigned long size;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i)
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
size = flash_get_size((vu_long *) FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", size, size << 20);
|
||||
}
|
||||
|
||||
/* Remap FLASH according to real size */
|
||||
memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size & 0xFFFF8000);
|
||||
memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | (memctl->memc_br0 & ~(BR_BA_MSK));
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size = flash_get_size((vu_long *) CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
flash_get_offsets(CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE, CFG_FLASH_BASE + monitor_flash_len - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
#ifdef CFG_ENV_ADDR_REDUND
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR_REDUND,
|
||||
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
|
||||
flash_info[0].size = size;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets(ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start address table */
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
}
|
||||
} else if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
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_MX:
|
||||
printf("MXIC ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM040:
|
||||
printf("AM29LV040B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400B:
|
||||
printf("AM29LV400B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400T:
|
||||
printf("AM29LV400T (4 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM800B:
|
||||
printf("AM29LV800B (8 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM800T:
|
||||
printf("AM29LV800T (8 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM160B:
|
||||
printf("AM29LV160B (16 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM160T:
|
||||
printf("AM29LV160T (16 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM320B:
|
||||
printf("AM29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T:
|
||||
printf("AM29LV320T (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
printf(" %08lX%s", info->start[i], info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
uchar mid;
|
||||
uchar pid;
|
||||
vu_char *caddr = (vu_char *) addr;
|
||||
ulong base = (ulong) addr;
|
||||
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
caddr[0x0555] = 0xAA;
|
||||
caddr[0x02AA] = 0x55;
|
||||
caddr[0x0555] = 0x90;
|
||||
|
||||
mid = caddr[0];
|
||||
switch (mid) {
|
||||
case (AMD_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (FUJ_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case (MX_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_MX;
|
||||
break;
|
||||
case (STM_MANUFACT & 0xFF):
|
||||
info->flash_id = FLASH_MAN_STM;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
pid = caddr[1]; /* device ID */
|
||||
switch (pid) {
|
||||
case (AMD_ID_LV400T & 0xFF):
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 512 kB */
|
||||
|
||||
case (AMD_ID_LV400B & 0xFF):
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 512 kB */
|
||||
|
||||
case (AMD_ID_LV800T & 0xFF):
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (AMD_ID_LV800B & 0xFF):
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (AMD_ID_LV160T & 0xFF):
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case (AMD_ID_LV160B & 0xFF):
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case (AMD_ID_LV040B & 0xFF):
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x00080000;
|
||||
break;
|
||||
|
||||
case (STM_ID_M29W040B & 0xFF):
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x00080000;
|
||||
break;
|
||||
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case (AMD_ID_LV320T & 0xFF):
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case (AMD_ID_LV320B & 0xFF):
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
#endif
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
printf(" ");
|
||||
/* set up sector start address table */
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_AM040) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
}
|
||||
} else if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection: D0 = 1 if protected */
|
||||
caddr = (volatile unsigned char *)(info->start[i]);
|
||||
info->protect[i] = caddr[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
caddr = (vu_char *) info->start[0];
|
||||
|
||||
caddr[0x0555] = 0xAA;
|
||||
caddr[0x02AA] = 0x55;
|
||||
caddr[0x0555] = 0xF0;
|
||||
|
||||
udelay(20000);
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
vu_char *addr = (vu_char *) (info->start[0]);
|
||||
int flag, prot, sect, l_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_UNKNOWN) ||
|
||||
(info->flash_id > FLASH_AMD_COMP)) {
|
||||
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");
|
||||
}
|
||||
|
||||
l_sect = -1;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
addr[0x0555] = 0x80;
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (vu_char *) (info->start[sect]);
|
||||
addr[0] = 0x30;
|
||||
l_sect = sect;
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay(1000);
|
||||
|
||||
/*
|
||||
* We wait for the last triggered sector
|
||||
*/
|
||||
if (l_sect < 0)
|
||||
goto DONE;
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
addr = (vu_char *) (info->start[l_sect]);
|
||||
while ((addr[0] & 0x80) != 0x80) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
return 1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
DONE:
|
||||
/* reset to read mode */
|
||||
addr = (vu_char *) info->start[0];
|
||||
addr[0] = 0xF0; /* reset bank */
|
||||
|
||||
printf(" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
int rc;
|
||||
|
||||
while (cnt > 0) {
|
||||
if ((rc = write_byte(info, addr++, *src++)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
--cnt;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_byte(flash_info_t * info, ulong dest, uchar data)
|
||||
{
|
||||
vu_char *addr = (vu_char *) (info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_char *) dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
addr[0x0555] = 0xA0;
|
||||
|
||||
*((vu_char *) dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer(0);
|
||||
while ((*((vu_char *) dest) & 0x80) != (data & 0x80)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
575
board/netta/netta.c
Normal file
575
board/netta/netta.c
Normal file
@@ -0,0 +1,575 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pantelis Antoniou, Intracom S.A., panto@intracom.gr
|
||||
* U-Boot port on NetTA4 board
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
#include "mpc8xx.h"
|
||||
|
||||
#ifdef CONFIG_HW_WATCHDOG
|
||||
#include <watchdog.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/* some sane bit macros */
|
||||
#define _BD(_b) (1U << (31-(_b)))
|
||||
#define _BDR(_l, _h) (((((1U << (31-(_l))) - 1) << 1) | 1) & ~((1U << (31-(_h))) - 1))
|
||||
|
||||
#define _BW(_b) (1U << (15-(_b)))
|
||||
#define _BWR(_l, _h) (((((1U << (15-(_l))) - 1) << 1) | 1) & ~((1U << (15-(_h))) - 1))
|
||||
|
||||
#define _BB(_b) (1U << (7-(_b)))
|
||||
#define _BBR(_l, _h) (((((1U << (7-(_l))) - 1) << 1) | 1) & ~((1U << (7-(_h))) - 1))
|
||||
|
||||
#define _B(_b) _BD(_b)
|
||||
#define _BR(_l, _h) _BDR(_l, _h)
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*
|
||||
* Return 1 always.
|
||||
*/
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
printf ("Intracom NETTA"
|
||||
#if defined(CONFIG_NETTA_ISDN)
|
||||
" with ISDN support"
|
||||
#endif
|
||||
"\n"
|
||||
);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
#define _NOT_USED_ 0xFFFFFFFF
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
#define CS_0000 0x00000000
|
||||
#define CS_0001 0x10000000
|
||||
#define CS_0010 0x20000000
|
||||
#define CS_0011 0x30000000
|
||||
#define CS_0100 0x40000000
|
||||
#define CS_0101 0x50000000
|
||||
#define CS_0110 0x60000000
|
||||
#define CS_0111 0x70000000
|
||||
#define CS_1000 0x80000000
|
||||
#define CS_1001 0x90000000
|
||||
#define CS_1010 0xA0000000
|
||||
#define CS_1011 0xB0000000
|
||||
#define CS_1100 0xC0000000
|
||||
#define CS_1101 0xD0000000
|
||||
#define CS_1110 0xE0000000
|
||||
#define CS_1111 0xF0000000
|
||||
|
||||
#define BS_0000 0x00000000
|
||||
#define BS_0001 0x01000000
|
||||
#define BS_0010 0x02000000
|
||||
#define BS_0011 0x03000000
|
||||
#define BS_0100 0x04000000
|
||||
#define BS_0101 0x05000000
|
||||
#define BS_0110 0x06000000
|
||||
#define BS_0111 0x07000000
|
||||
#define BS_1000 0x08000000
|
||||
#define BS_1001 0x09000000
|
||||
#define BS_1010 0x0A000000
|
||||
#define BS_1011 0x0B000000
|
||||
#define BS_1100 0x0C000000
|
||||
#define BS_1101 0x0D000000
|
||||
#define BS_1110 0x0E000000
|
||||
#define BS_1111 0x0F000000
|
||||
|
||||
#define A10_AAAA 0x00000000
|
||||
#define A10_AAA0 0x00200000
|
||||
#define A10_AAA1 0x00300000
|
||||
#define A10_000A 0x00800000
|
||||
#define A10_0000 0x00A00000
|
||||
#define A10_0001 0x00B00000
|
||||
#define A10_111A 0x00C00000
|
||||
#define A10_1110 0x00E00000
|
||||
#define A10_1111 0x00F00000
|
||||
|
||||
#define RAS_0000 0x00000000
|
||||
#define RAS_0001 0x00040000
|
||||
#define RAS_1110 0x00080000
|
||||
#define RAS_1111 0x000C0000
|
||||
|
||||
#define CAS_0000 0x00000000
|
||||
#define CAS_0001 0x00010000
|
||||
#define CAS_1110 0x00020000
|
||||
#define CAS_1111 0x00030000
|
||||
|
||||
#define WE_0000 0x00000000
|
||||
#define WE_0001 0x00004000
|
||||
#define WE_1110 0x00008000
|
||||
#define WE_1111 0x0000C000
|
||||
|
||||
#define GPL4_0000 0x00000000
|
||||
#define GPL4_0001 0x00001000
|
||||
#define GPL4_1110 0x00002000
|
||||
#define GPL4_1111 0x00003000
|
||||
|
||||
#define GPL5_0000 0x00000000
|
||||
#define GPL5_0001 0x00000400
|
||||
#define GPL5_1110 0x00000800
|
||||
#define GPL5_1111 0x00000C00
|
||||
#define LOOP 0x00000080
|
||||
|
||||
#define EXEN 0x00000040
|
||||
|
||||
#define AMX_COL 0x00000000
|
||||
#define AMX_ROW 0x00000020
|
||||
#define AMX_MAR 0x00000030
|
||||
|
||||
#define NA 0x00000008
|
||||
|
||||
#define UTA 0x00000004
|
||||
|
||||
#define TODT 0x00000002
|
||||
|
||||
#define LAST 0x00000001
|
||||
|
||||
/* #define CAS_LATENCY 3 */
|
||||
#define CAS_LATENCY 2
|
||||
|
||||
const uint sdram_table[0x40] = {
|
||||
|
||||
#if CAS_LATENCY == 3
|
||||
/* RSS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0000 | BS_1111 | A10_0001 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_0001 | BS_0001 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* RBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_0001 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_0001 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* WSS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_0000 | BS_0001 | A10_0000 | RAS_1111 | CAS_0001 | WE_0000 | AMX_COL | UTA, /* WRITE */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* WBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1111 | BS_1111 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_0000 | A10_0000 | RAS_1111 | CAS_0001 | WE_0000 | AMX_COL, /* WRITE */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0001 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA, /* PALL */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
#endif
|
||||
|
||||
#if CAS_LATENCY == 2
|
||||
/* RSS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_0001 | A10_0000 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_1110 | BS_1111 | A10_0001 | RAS_1110 | CAS_1111 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* RBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_0000 | A10_0000 | RAS_1111 | CAS_0001 | WE_1111 | AMX_COL | UTA, /* READ */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0001 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1110 | BS_1111 | A10_0001 | RAS_1110 | CAS_1111 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* WSS */
|
||||
CS_0001 | BS_1111 | A10_AAA0 | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0000 | BS_0001 | A10_0001 | RAS_1110 | CAS_0001 | WE_0000 | AMX_COL | UTA, /* WRITE */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_,
|
||||
|
||||
/* WBS */
|
||||
CS_0001 | BS_1111 | A10_AAAA | RAS_0001 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* ACT */
|
||||
CS_1110 | BS_1110 | A10_0000 | RAS_1111 | CAS_1110 | WE_1110 | AMX_COL, /* NOP */
|
||||
CS_0001 | BS_0000 | A10_0000 | RAS_1111 | CAS_0001 | WE_0001 | AMX_COL, /* WRITE */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1111 | BS_0000 | A10_0000 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL, /* NOP */
|
||||
CS_1110 | BS_0001 | A10_0001 | RAS_1110 | CAS_1111 | WE_1110 | AMX_COL | UTA, /* NOP */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | TODT | LAST, /* PALL */
|
||||
_NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
#endif
|
||||
|
||||
/* UPT */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_0001 | WE_1111 | AMX_COL | UTA | LOOP, /* ATRFR */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | LOOP, /* NOP */
|
||||
CS_1111 | BS_1111 | A10_1111 | RAS_1111 | CAS_1111 | WE_1111 | AMX_COL | UTA | TODT | LAST, /* NOP */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/* EXC */
|
||||
CS_0001 | BS_1111 | A10_1111 | RAS_0001 | CAS_1111 | WE_0001 | AMX_COL | UTA | LAST,
|
||||
_NOT_USED_,
|
||||
|
||||
/* REG */
|
||||
CS_1110 | BS_1111 | A10_1110 | RAS_1110 | CAS_1110 | WE_1110 | AMX_MAR | UTA,
|
||||
CS_0001 | BS_1111 | A10_0001 | RAS_0001 | CAS_0001 | WE_0001 | AMX_MAR | UTA | LAST,
|
||||
};
|
||||
|
||||
/* 0xC8 = 0b11001000 , CAS3, >> 2 = 0b00 11 0 010 */
|
||||
/* 0x88 = 0b10001000 , CAS2, >> 2 = 0b00 10 0 010 */
|
||||
#define MAR_SDRAM_INIT ((CAS_LATENCY << 6) | 0x00000008LU)
|
||||
|
||||
/* 8 */
|
||||
#define CFG_MAMR ((CFG_MAMR_PTA << MAMR_PTA_SHIFT) | MAMR_PTAE | \
|
||||
MAMR_AMA_TYPE_0 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A11 | \
|
||||
MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_4X)
|
||||
|
||||
void check_ram(unsigned int addr, unsigned int size)
|
||||
{
|
||||
unsigned int i, j, v, vv;
|
||||
volatile unsigned int *p;
|
||||
unsigned int pv;
|
||||
|
||||
p = (unsigned int *)addr;
|
||||
pv = (unsigned int)p;
|
||||
for (i = 0; i < size / sizeof(unsigned int); i++, pv += sizeof(unsigned int))
|
||||
*p++ = pv;
|
||||
|
||||
p = (unsigned int *)addr;
|
||||
for (i = 0; i < size / sizeof(unsigned int); i++) {
|
||||
v = (unsigned int)p;
|
||||
vv = *p;
|
||||
if (vv != v) {
|
||||
printf("%p: read %08x instead of %08x\n", p, vv, v);
|
||||
hang();
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
for (j = 0; j < 5; j++) {
|
||||
switch (j) {
|
||||
case 0: v = 0x00000000; break;
|
||||
case 1: v = 0xffffffff; break;
|
||||
case 2: v = 0x55555555; break;
|
||||
case 3: v = 0xaaaaaaaa; break;
|
||||
default:v = 0xdeadbeef; break;
|
||||
}
|
||||
p = (unsigned int *)addr;
|
||||
for (i = 0; i < size / sizeof(unsigned int); i++) {
|
||||
*p = v;
|
||||
vv = *p;
|
||||
if (vv != v) {
|
||||
printf("%p: read %08x instead of %08x\n", p, vv, v);
|
||||
hang();
|
||||
}
|
||||
*p = ~v;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
long int size;
|
||||
|
||||
upmconfig(UPMB, (uint *) sdram_table, sizeof(sdram_table) / sizeof(uint));
|
||||
|
||||
/*
|
||||
* Preliminary prescaler for refresh
|
||||
*/
|
||||
memctl->memc_mptpr = MPTPR_PTP_DIV8;
|
||||
|
||||
memctl->memc_mar = MAR_SDRAM_INIT; /* 32-bit address to be output on the address bus if AMX = 0b11 */
|
||||
|
||||
/*
|
||||
* Map controller bank 3 to the SDRAM bank at preliminary address.
|
||||
*/
|
||||
memctl->memc_or3 = CFG_OR3_PRELIM;
|
||||
memctl->memc_br3 = CFG_BR3_PRELIM;
|
||||
|
||||
memctl->memc_mbmr = CFG_MAMR & ~MAMR_PTAE; /* no refresh yet */
|
||||
|
||||
udelay(200);
|
||||
|
||||
/* perform SDRAM initialisation sequence */
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_UPM_B | MCR_MB_CS3 | MCR_MLCF(1) | MCR_MAD(0x3C); /* precharge all */
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_UPM_B | MCR_MB_CS3 | MCR_MLCF(2) | MCR_MAD(0x30); /* refresh 2 times(0) */
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mcr = MCR_OP_RUN | MCR_UPM_B | MCR_MB_CS3 | MCR_MLCF(1) | MCR_MAD(0x3E); /* exception program (write mar)*/
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mbmr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay(10000);
|
||||
|
||||
{
|
||||
u32 d1, d2;
|
||||
|
||||
d1 = 0xAA55AA55;
|
||||
*(volatile u32 *)0 = d1;
|
||||
d2 = *(volatile u32 *)0;
|
||||
if (d1 != d2) {
|
||||
printf("DRAM fails: wrote 0x%08x read 0x%08x\n", d1, d2);
|
||||
hang();
|
||||
}
|
||||
|
||||
d1 = 0x55AA55AA;
|
||||
*(volatile u32 *)0 = d1;
|
||||
d2 = *(volatile u32 *)0;
|
||||
if (d1 != d2) {
|
||||
printf("DRAM fails: wrote 0x%08x read 0x%08x\n", d1, d2);
|
||||
hang();
|
||||
}
|
||||
}
|
||||
|
||||
size = get_ram_size((long *)0, SDRAM_MAX_SIZE);
|
||||
|
||||
#if 0
|
||||
printf("check 0\n");
|
||||
check_ram(( 0 << 20), (2 << 20));
|
||||
printf("check 16\n");
|
||||
check_ram((16 << 20), (2 << 20));
|
||||
printf("check 32\n");
|
||||
check_ram((32 << 20), (2 << 20));
|
||||
printf("check 48\n");
|
||||
check_ram((48 << 20), (2 << 20));
|
||||
#endif
|
||||
|
||||
if (size == 0) {
|
||||
printf("SIZE is zero: LOOP on 0\n");
|
||||
for (;;) {
|
||||
*(volatile u32 *)0 = 0;
|
||||
(void)*(volatile u32 *)0;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void reset_phys(void)
|
||||
{
|
||||
int phyno;
|
||||
unsigned short v;
|
||||
|
||||
/* reset the damn phys */
|
||||
mii_init();
|
||||
|
||||
for (phyno = 0; phyno < 32; ++phyno) {
|
||||
miiphy_read(phyno, PHY_PHYIDR1, &v);
|
||||
if (v == 0xFFFF)
|
||||
continue;
|
||||
miiphy_write(phyno, PHY_BMCR, PHY_BMCR_POWD);
|
||||
udelay(10000);
|
||||
miiphy_write(phyno, PHY_BMCR, PHY_BMCR_RESET | PHY_BMCR_AUTON);
|
||||
udelay(10000);
|
||||
}
|
||||
}
|
||||
|
||||
extern int board_dsp_reset(void);
|
||||
|
||||
int last_stage_init(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
reset_phys();
|
||||
r = board_dsp_reset();
|
||||
if (r < 0)
|
||||
printf("*** WARNING *** DSP reset failed (run diagnostics)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* GP = general purpose, SP = special purpose (on chip peripheral) */
|
||||
|
||||
/* bits that can have a special purpose or can be configured as inputs/outputs */
|
||||
#define PA_GP_INMASK (_BWR(3) | _BWR(7, 9) | _BW(11))
|
||||
#define PA_GP_OUTMASK (_BW(6) | _BW(10) | _BWR(12, 15))
|
||||
#define PA_SP_MASK (_BWR(0, 2) | _BWR(4, 5))
|
||||
#define PA_ODR_VAL 0
|
||||
#define PA_GP_OUTVAL (_BW(13) | _BWR(14, 15))
|
||||
#define PA_SP_DIRVAL 0
|
||||
|
||||
#define PB_GP_INMASK (_B(28) | _B(31))
|
||||
#define PB_GP_OUTMASK (_BR(16, 19) | _BR(26, 27) | _BR(29, 30))
|
||||
#define PB_SP_MASK (_BR(22, 25))
|
||||
#define PB_ODR_VAL 0
|
||||
#define PB_GP_OUTVAL (_BR(16, 19) | _BR(26, 27) | _BR(29, 31))
|
||||
#define PB_SP_DIRVAL 0
|
||||
|
||||
#define PC_GP_INMASK (_BW(5) | _BW(7) | _BW(8) | _BWR(9, 11) | _BWR(13, 15))
|
||||
#define PC_GP_OUTMASK (_BW(6) | _BW(12))
|
||||
#define PC_SP_MASK (_BW(4) | _BW(8))
|
||||
#define PC_SOVAL 0
|
||||
#define PC_INTVAL _BW(7)
|
||||
#define PC_GP_OUTVAL (_BW(6) | _BW(12))
|
||||
#define PC_SP_DIRVAL 0
|
||||
|
||||
#define PD_GP_INMASK 0
|
||||
#define PD_GP_OUTMASK _BWR(3, 15)
|
||||
#define PD_SP_MASK 0
|
||||
#define PD_GP_OUTVAL (_BWR(5, 7) | _BW(9) | _BW(11))
|
||||
#define PD_SP_DIRVAL 0
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile iop8xx_t *ioport = &immap->im_ioport;
|
||||
volatile cpm8xx_t *cpm = &immap->im_cpm;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
|
||||
/* CS1: NAND chip select */
|
||||
memctl->memc_or1 = ((0xFFFFFFFFLU & ~(NAND_SIZE - 1)) | OR_BI | OR_SCY_2_CLK | OR_TRLX | OR_ACS_DIV2) ;
|
||||
memctl->memc_br1 = ((NAND_BASE & BR_BA_MSK) | BR_PS_8 | BR_V);
|
||||
|
||||
/* CS2: DSP */
|
||||
memctl->memc_or2 = ((0xFFFFFFFFLU & ~(DSP_SIZE - 1)) | OR_CSNT_SAM | OR_BI | OR_SCY_7_CLK | OR_ACS_DIV2);
|
||||
memctl->memc_br2 = ((DSP_BASE & BR_BA_MSK) | BR_PS_16 | BR_V);
|
||||
|
||||
/* CS4: External register chip select */
|
||||
memctl->memc_or4 = ((0xFFFFFFFFLU & ~(ER_SIZE - 1)) | OR_BI | OR_SCY_4_CLK);
|
||||
memctl->memc_br4 = ((ER_BASE & BR_BA_MSK) | BR_PS_32 | BR_V);
|
||||
|
||||
/* CS5: dummy for accurate delay */
|
||||
memctl->memc_or5 = ((0xFFFFFFFFLU & ~(DUMMY_SIZE - 1)) | OR_CSNT_SAM | OR_BI | OR_SCY_0_CLK | OR_ACS_DIV2);
|
||||
memctl->memc_br5 = ((DUMMY_BASE & BR_BA_MSK) | BR_PS_32 | BR_V);
|
||||
|
||||
ioport->iop_padat = PA_GP_OUTVAL;
|
||||
ioport->iop_paodr = PA_ODR_VAL;
|
||||
ioport->iop_padir = PA_GP_OUTMASK | PA_SP_DIRVAL;
|
||||
ioport->iop_papar = PA_SP_MASK;
|
||||
|
||||
cpm->cp_pbdat = PB_GP_OUTVAL;
|
||||
cpm->cp_pbodr = PB_ODR_VAL;
|
||||
cpm->cp_pbdir = PB_GP_OUTMASK | PB_SP_DIRVAL;
|
||||
cpm->cp_pbpar = PB_SP_MASK;
|
||||
|
||||
ioport->iop_pcdat = PC_GP_OUTVAL;
|
||||
ioport->iop_pcdir = PC_GP_OUTMASK | PC_SP_DIRVAL;
|
||||
ioport->iop_pcso = PC_SOVAL;
|
||||
ioport->iop_pcint = PC_INTVAL;
|
||||
ioport->iop_pcpar = PC_SP_MASK;
|
||||
|
||||
ioport->iop_pddat = PD_GP_OUTVAL;
|
||||
ioport->iop_pddir = PD_GP_OUTMASK | PD_SP_DIRVAL;
|
||||
ioport->iop_pdpar = PD_SP_MASK;
|
||||
|
||||
ioport->iop_pddat |= (1 << (15 - 6)) | (1 << (15 - 7));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
|
||||
extern ulong nand_probe(ulong physadr);
|
||||
extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];
|
||||
|
||||
void nand_init(void)
|
||||
{
|
||||
unsigned long totlen = nand_probe(CFG_NAND_BASE);
|
||||
|
||||
printf ("%4lu MB\n", totlen >> 20);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
|
||||
|
||||
int pcmcia_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
return 0; /* No hotkeys supported */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HW_WATCHDOG
|
||||
|
||||
void hw_watchdog_reset(void)
|
||||
{
|
||||
/* XXX add here the really funky stuff */
|
||||
}
|
||||
|
||||
#endif
|
||||
138
board/netta/u-boot.lds
Normal file
138
board/netta/u-boot.lds
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_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/mpc8xx/start.o (.text)
|
||||
cpu/mpc8xx/traps.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
lib_ppc/cache.o (.text)
|
||||
lib_ppc/time.o (.text)
|
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/environment.o (.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
135
board/netta/u-boot.lds.debug
Normal file
135
board/netta/u-boot.lds.debug
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o(.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -21,6 +21,8 @@
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
@@ -49,28 +51,35 @@ unsigned long flash_init (void)
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
debug ("\n## Get flash bank size @ 0x%08x\n", FLASH_BASE_PRELIM);
|
||||
|
||||
size_b0 = flash_get_size((vu_long *)FLASH_BASE_PRELIM, &flash_info[0]);
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
|
||||
size_b0, size_b0<<20);
|
||||
}
|
||||
|
||||
debug ("## Before remap: BR0: 0x%08x OR0: 0x%08x\n",
|
||||
memctl->memc_br0, memctl->memc_or0);
|
||||
|
||||
/* Remap FLASH according to real size */
|
||||
memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size_b0 & 0xFFFF8000);
|
||||
memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
|
||||
|
||||
debug ("## BR0: 0x%08x OR0: 0x%08x\n",
|
||||
memctl->memc_br0, memctl->memc_or0);
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
|
||||
size_b0 = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
|
||||
flash_get_offsets (CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+monitor_flash_len-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
@@ -80,8 +89,21 @@ unsigned long flash_init (void)
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#if defined(CFG_ENV_ADDR_REDUND) || defined(CFG_ENV_OFFSET_REDUND)
|
||||
debug ("Protect redundand environment: %08lx ... %08lx\n",
|
||||
(ulong)CFG_ENV_ADDR_REDUND,
|
||||
(ulong)CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE - 1);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR_REDUND,
|
||||
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
flash_info[0].size = size_b0;
|
||||
|
||||
debug ("## Final Flash bank size: %08lx\n", size_b0);
|
||||
|
||||
return (size_b0);
|
||||
}
|
||||
|
||||
@@ -192,6 +214,8 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
|
||||
value = addr[0] ;
|
||||
|
||||
debug ("Manuf. ID @ 0x%08lx: 0x%08lx\n", (ulong)addr, value);
|
||||
|
||||
switch (value & 0x00FF00FF) {
|
||||
case AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
@@ -208,6 +232,8 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
|
||||
value = addr[2] ; /* device ID */
|
||||
|
||||
debug ("Device ID @ 0x%08lx: 0x%08lx\n", (ulong)(&addr[1]), value);
|
||||
|
||||
switch (value & 0x00FF00FF) {
|
||||
case (AMD_ID_LV400T & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM400T;
|
||||
@@ -244,25 +270,22 @@ static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case AMD_ID_LV320T:
|
||||
case (AMD_ID_LV320T & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
case AMD_ID_LV320B:
|
||||
case (AMD_ID_LV320B & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 16 MB */
|
||||
#endif
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
/*%%% sector start address modified */
|
||||
/* set up sector start address table */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
@@ -314,6 +337,8 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
int flag, prot, sect, l_sect;
|
||||
ulong start, now, last;
|
||||
|
||||
debug ("flash_erase: first: %d last: %d\n", s_first, s_last);
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
|
||||
@@ -139,7 +139,7 @@ static block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_LED
|
||||
#if !defined(CONFIG_KUP4K) && !defined(CONFIG_HMI10)
|
||||
#if !defined(CONFIG_KUP4K) && !defined(CONFIG_KUP4X) &&!defined(CONFIG_BMS2003)
|
||||
static void ide_led (uchar led, uchar status);
|
||||
#else
|
||||
extern void ide_led (uchar led, uchar status);
|
||||
@@ -782,15 +782,17 @@ set_pcmcia_timing (int pmode)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __PPC__
|
||||
#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
|
||||
static void __inline__
|
||||
ide_outb(int dev, int port, unsigned char val)
|
||||
{
|
||||
PRINTF ("ide_outb (dev= %d, port= %d, val= 0x%02x) : @ 0x%08lx\n",
|
||||
PRINTF ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
|
||||
dev, port, val, (ATA_CURR_BASE(dev)+port));
|
||||
|
||||
/* Ensure I/O operations complete */
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile("eieio");
|
||||
#endif
|
||||
*((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
@@ -802,15 +804,17 @@ ide_outb(int dev, int port, unsigned char val)
|
||||
#endif /* __PPC__ */
|
||||
|
||||
|
||||
#ifdef __PPC__
|
||||
#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
|
||||
static unsigned char __inline__
|
||||
ide_inb(int dev, int port)
|
||||
{
|
||||
uchar val;
|
||||
/* Ensure I/O operations complete */
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile("eieio");
|
||||
#endif
|
||||
val = *((uchar *)(ATA_CURR_BASE(dev)+port));
|
||||
PRINTF ("ide_inb (dev= %d, port= %d) : @ 0x%08lx -> 0x%02x\n",
|
||||
PRINTF ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
|
||||
dev, port, (ATA_CURR_BASE(dev)+port), val);
|
||||
return (val);
|
||||
}
|
||||
@@ -856,6 +860,8 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
volatile ushort *pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
ushort *dbuf = (ushort *)sect_buf;
|
||||
|
||||
PRINTF("in input swap data base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (words--) {
|
||||
*dbuf++ = ld_le16(pbuf);
|
||||
*dbuf++ = ld_le16(pbuf);
|
||||
@@ -878,7 +884,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
|
||||
|
||||
|
||||
#ifdef __PPC__
|
||||
#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
|
||||
static void
|
||||
output_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
@@ -889,9 +895,13 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
*pbuf = *dbuf++;
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -922,7 +932,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
}
|
||||
#endif /* __PPC__ */
|
||||
|
||||
#ifdef __PPC__
|
||||
#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
|
||||
static void
|
||||
input_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
@@ -932,10 +942,17 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
|
||||
PRINTF("in input data base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (words--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
*dbuf++ = *pbuf;
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -1169,13 +1186,12 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (iop->command_set_2 & 0x0400) { /* LBA 48 support */
|
||||
dev_desc->lba48support = 1;
|
||||
dev_desc->lba48 = (unsigned long long)iop->lba48_capacity[0] |
|
||||
dev_desc->lba48 = 1;
|
||||
dev_desc->lba = (unsigned long long)iop->lba48_capacity[0] |
|
||||
((unsigned long long)iop->lba48_capacity[1] << 16) |
|
||||
((unsigned long long)iop->lba48_capacity[2] << 32) |
|
||||
((unsigned long long)iop->lba48_capacity[3] << 48);
|
||||
} else {
|
||||
dev_desc->lba48support = 0;
|
||||
dev_desc->lba48 = 0;
|
||||
}
|
||||
#endif /* CONFIG_LBA48 */
|
||||
@@ -1537,7 +1553,11 @@ static void ide_reset (void)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE) && !defined(CONFIG_KUP4K) && !defined(CONFIG_HMI10)
|
||||
#if defined(CONFIG_IDE_LED) && \
|
||||
!defined(CONFIG_AMIGAONEG3SE) && \
|
||||
!defined(CONFIG_KUP4K) && \
|
||||
!defined(CONFIG_KUP4X) && \
|
||||
!defined(CONFIG_HMI10)
|
||||
|
||||
static uchar led_buffer = 0; /* Buffer for current LED status */
|
||||
|
||||
@@ -1572,7 +1592,7 @@ static void ide_led (uchar led, uchar status)
|
||||
#define AT_PRINTF(fmt,args...)
|
||||
#endif
|
||||
|
||||
#ifdef __PPC__
|
||||
#if defined(__PPC__) || defined(CONFIG_PXA_PCMCIA)
|
||||
/* since ATAPI may use commands with not 4 bytes alligned length
|
||||
* we have our own transfer functions, 2 bytes alligned */
|
||||
static void
|
||||
@@ -1584,8 +1604,13 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
|
||||
PRINTF("in output data shorts base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (shorts--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -1613,8 +1638,13 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
|
||||
PRINTF("in input data shorts base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (shorts--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
|
||||
@@ -49,6 +49,8 @@ static int part_num=0;
|
||||
|
||||
static struct part_info part;
|
||||
|
||||
#ifndef CONFIG_JFFS2_NAND
|
||||
|
||||
struct part_info*
|
||||
jffs2_part_info(int part_num)
|
||||
{
|
||||
@@ -88,6 +90,33 @@ jffs2_part_info(int part_num)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* CONFIG_JFFS2_NAND */
|
||||
|
||||
struct part_info*
|
||||
jffs2_part_info(int part_num)
|
||||
{
|
||||
if(part_num==0){
|
||||
|
||||
if(part.usr_priv==(void*)1)
|
||||
return ∂
|
||||
|
||||
memset(&part, 0, sizeof(part));
|
||||
|
||||
part.offset = CONFIG_JFFS2_NAND_OFF;
|
||||
part.size = CONFIG_JFFS2_NAND_SIZE; /* the bigger size the slower jffs2 */
|
||||
|
||||
#ifndef CONFIG_JFFS2_NAND_DEV
|
||||
#define CONFIG_JFFS2_NAND_DEV 0
|
||||
#endif
|
||||
/* nand device with the JFFS2 parition plus 1 */
|
||||
part.usr_priv = (void*)(CONFIG_JFFS2_NAND_DEV+1);
|
||||
return ∂
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_JFFS2_NAND */
|
||||
#endif /* ifndef CFG_JFFS_CUSTOM_PART */
|
||||
|
||||
int
|
||||
|
||||
@@ -963,6 +963,8 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_CRC32_VERIFY
|
||||
|
||||
int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, length;
|
||||
@@ -992,6 +994,62 @@ int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* CONFIG_CRC32_VERIFY */
|
||||
|
||||
int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr, length;
|
||||
ulong crc;
|
||||
ulong *ptr;
|
||||
ulong vcrc;
|
||||
int verify;
|
||||
int ac;
|
||||
char **av;
|
||||
|
||||
if (argc < 3) {
|
||||
usage:
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
av = argv + 1;
|
||||
ac = argc - 1;
|
||||
if (strcmp(*av, "-v") == 0) {
|
||||
verify = 1;
|
||||
av++;
|
||||
ac--;
|
||||
if (ac < 3)
|
||||
goto usage;
|
||||
} else
|
||||
verify = 0;
|
||||
|
||||
addr = simple_strtoul(*av++, NULL, 16);
|
||||
addr += base_address;
|
||||
length = simple_strtoul(*av++, NULL, 16);
|
||||
|
||||
crc = crc32(0, (const uchar *) addr, length);
|
||||
|
||||
if (!verify) {
|
||||
printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
|
||||
addr, addr + length - 1, crc);
|
||||
if (ac > 2) {
|
||||
ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
|
||||
*ptr = crc;
|
||||
}
|
||||
} else {
|
||||
vcrc = simple_strtoul(*av++, NULL, 16);
|
||||
if (vcrc != crc) {
|
||||
printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
|
||||
addr, addr + length - 1, crc, vcrc);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
#endif /* CONFIG_CRC32_VERIFY */
|
||||
|
||||
/**************************************************/
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
|
||||
U_BOOT_CMD(
|
||||
@@ -1032,12 +1090,25 @@ U_BOOT_CMD(
|
||||
"[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
|
||||
);
|
||||
|
||||
#ifndef CONFIG_CRC32_VERIFY
|
||||
|
||||
U_BOOT_CMD(
|
||||
crc32, 4, 1, do_mem_crc,
|
||||
"crc32 - checksum calculation\n",
|
||||
"address count [addr]\n - compute CRC32 checksum [save at addr]\n"
|
||||
);
|
||||
|
||||
#else /* CONFIG_CRC32_VERIFY */
|
||||
|
||||
U_BOOT_CMD(
|
||||
crc32, 5, 1, do_mem_crc,
|
||||
"crc32 - checksum calculation\n",
|
||||
"address count [addr]\n - compute CRC32 checksum [save at addr]\n"
|
||||
"-v address count crc\n - verify crc of memory area\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_CRC32_VERIFY */
|
||||
|
||||
U_BOOT_CMD(
|
||||
base, 2, 1, do_mem_base,
|
||||
"base - print or set address offset\n",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <asm/io.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
||||
# include <status_led.h>
|
||||
@@ -63,6 +64,7 @@ struct nand_oob_config {
|
||||
#define NANDRW_READ 0x01
|
||||
#define NANDRW_WRITE 0x00
|
||||
#define NANDRW_JFFS2 0x02
|
||||
#define NANDRW_JFFS2_SKIP 0x04
|
||||
|
||||
/*
|
||||
* Function Prototypes
|
||||
@@ -207,6 +209,11 @@ int do_nand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
else if (cmdtail && !strncmp(cmdtail, ".jffs2", 2))
|
||||
cmd |= NANDRW_JFFS2; /* skip bad blocks */
|
||||
else if (cmdtail && !strncmp(cmdtail, ".jffs2s", 2)) {
|
||||
cmd |= NANDRW_JFFS2; /* skip bad blocks (on read too) */
|
||||
if (cmd & NANDRW_READ)
|
||||
cmd |= NANDRW_JFFS2_SKIP; /* skip bad blocks (on read too) */
|
||||
}
|
||||
#ifdef SXNI855T
|
||||
/* need ".e" same as ".j" for compatibility with older units */
|
||||
else if (cmdtail && !strcmp(cmdtail, ".e"))
|
||||
@@ -225,7 +232,7 @@ int do_nand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
&total, (u_char*)addr);
|
||||
|
||||
printf (" %d bytes %s: %s\n", total,
|
||||
(cmd & NANDRW_READ) ? "read" : "write",
|
||||
(cmd & NANDRW_READ) ? "read" : "written",
|
||||
ret ? "ERROR" : "OK");
|
||||
|
||||
return ret;
|
||||
@@ -258,7 +265,7 @@ U_BOOT_CMD(
|
||||
"nand - NAND sub-system\n",
|
||||
"info - show available NAND devices\n"
|
||||
"nand device [dev] - show or set current device\n"
|
||||
"nand read[.jffs2] addr off size\n"
|
||||
"nand read[.jffs2[s]] addr off size\n"
|
||||
"nand write[.jffs2] addr off size - read/write `size' bytes starting\n"
|
||||
" at offset `off' to/from memory address `addr'\n"
|
||||
"nand erase [clean] [off size] - erase `size' bytes from\n"
|
||||
@@ -420,6 +427,7 @@ static void nand_print_bad(struct nand_chip* nand)
|
||||
* 1: NANDRW_READ read, fail on bad block
|
||||
* 2: NANDRW_WRITE | NANDRW_JFFS2 write, skip bad blocks
|
||||
* 3: NANDRW_READ | NANDRW_JFFS2 read, data all 0xff for bad blocks
|
||||
* 7: NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP read, skip bad blocks
|
||||
*/
|
||||
static int nand_rw (struct nand_chip* nand, int cmd,
|
||||
size_t start, size_t len,
|
||||
@@ -450,6 +458,10 @@ static int nand_rw (struct nand_chip* nand, int cmd,
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (cmd == (NANDRW_READ | NANDRW_JFFS2 | NANDRW_JFFS2_SKIP)) {
|
||||
start += erasesize;
|
||||
continue;
|
||||
}
|
||||
else if (cmd == (NANDRW_WRITE | NANDRW_JFFS2)) {
|
||||
/* skip bad block */
|
||||
start += erasesize;
|
||||
@@ -1657,4 +1669,17 @@ static int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_JFFS2_NAND
|
||||
|
||||
int read_jffs2_nand(size_t start, size_t len,
|
||||
size_t * retlen, u_char * buf, int nanddev)
|
||||
{
|
||||
return nand_rw(nand_dev_desc + nanddev, NANDRW_READ | NANDRW_JFFS2,
|
||||
start, len, retlen, buf);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_JFFS2_NAND */
|
||||
|
||||
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
||||
|
||||
111
common/cmd_net.c
111
common/cmd_net.c
@@ -94,52 +94,50 @@ U_BOOT_CMD(
|
||||
);
|
||||
#endif /* CFG_CMD_NFS */
|
||||
|
||||
static void netboot_update_env(void)
|
||||
static void netboot_update_env (void)
|
||||
{
|
||||
char tmp[16] ;
|
||||
char tmp[22];
|
||||
|
||||
if (NetOurGatewayIP) {
|
||||
ip_to_string (NetOurGatewayIP, tmp);
|
||||
setenv("gatewayip", tmp);
|
||||
}
|
||||
if (NetOurGatewayIP) {
|
||||
ip_to_string (NetOurGatewayIP, tmp);
|
||||
setenv ("gatewayip", tmp);
|
||||
}
|
||||
|
||||
if (NetOurSubnetMask) {
|
||||
ip_to_string (NetOurSubnetMask, tmp);
|
||||
setenv("netmask", tmp);
|
||||
}
|
||||
if (NetOurSubnetMask) {
|
||||
ip_to_string (NetOurSubnetMask, tmp);
|
||||
setenv ("netmask", tmp);
|
||||
}
|
||||
|
||||
if (NetOurHostName[0])
|
||||
setenv("hostname", NetOurHostName);
|
||||
if (NetOurHostName[0])
|
||||
setenv ("hostname", NetOurHostName);
|
||||
|
||||
if (NetOurRootPath[0])
|
||||
setenv("rootpath", NetOurRootPath);
|
||||
if (NetOurRootPath[0])
|
||||
setenv ("rootpath", NetOurRootPath);
|
||||
|
||||
if (NetOurIP) {
|
||||
ip_to_string (NetOurIP, tmp);
|
||||
setenv("ipaddr", tmp);
|
||||
}
|
||||
if (NetOurIP) {
|
||||
ip_to_string (NetOurIP, tmp);
|
||||
setenv ("ipaddr", tmp);
|
||||
}
|
||||
|
||||
if (NetServerIP) {
|
||||
ip_to_string (NetServerIP, tmp);
|
||||
setenv("serverip", tmp);
|
||||
}
|
||||
|
||||
if (NetOurDNSIP) {
|
||||
ip_to_string (NetOurDNSIP, tmp);
|
||||
setenv("dnsip", tmp);
|
||||
}
|
||||
if (NetServerIP) {
|
||||
ip_to_string (NetServerIP, tmp);
|
||||
setenv ("serverip", tmp);
|
||||
}
|
||||
|
||||
if (NetOurDNSIP) {
|
||||
ip_to_string (NetOurDNSIP, tmp);
|
||||
setenv ("dnsip", tmp);
|
||||
}
|
||||
#if (CONFIG_BOOTP_MASK & CONFIG_BOOTP_DNS2)
|
||||
if (NetOurDNS2IP) {
|
||||
ip_to_string (NetOurDNS2IP, tmp);
|
||||
setenv("dnsip2", tmp);
|
||||
}
|
||||
if (NetOurDNS2IP) {
|
||||
ip_to_string (NetOurDNS2IP, tmp);
|
||||
setenv ("dnsip2", tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NetOurNISDomain[0])
|
||||
setenv("domain", NetOurNISDomain);
|
||||
|
||||
if (NetOurNISDomain[0])
|
||||
setenv ("domain", NetOurNISDomain);
|
||||
}
|
||||
|
||||
static int
|
||||
netboot_common (int proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
|
||||
{
|
||||
@@ -238,4 +236,47 @@ U_BOOT_CMD(
|
||||
);
|
||||
#endif /* CFG_CMD_PING */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_CDP)
|
||||
|
||||
static void cdp_update_env(void)
|
||||
{
|
||||
char tmp[16];
|
||||
|
||||
if (CDPApplianceVLAN != htons(-1)) {
|
||||
printf("CDP offered appliance VLAN %d\n", ntohs(CDPApplianceVLAN));
|
||||
VLAN_to_string(CDPApplianceVLAN, tmp);
|
||||
setenv("vlan", tmp);
|
||||
NetOurVLAN = CDPApplianceVLAN;
|
||||
}
|
||||
|
||||
if (CDPNativeVLAN != htons(-1)) {
|
||||
printf("CDP offered native VLAN %d\n", ntohs(CDPNativeVLAN));
|
||||
VLAN_to_string(CDPNativeVLAN, tmp);
|
||||
setenv("nvlan", tmp);
|
||||
NetOurNativeVLAN = CDPNativeVLAN;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int do_cdp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
int r;
|
||||
|
||||
r = NetLoop(CDP);
|
||||
if (r < 0) {
|
||||
printf("cdp failed; perhaps not a CISCO switch?\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
cdp_update_env();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
cdp, 1, 1, do_cdp,
|
||||
"cdp - Perform CDP network configuration\n",
|
||||
);
|
||||
#endif /* CFG_CMD_CDP */
|
||||
|
||||
#endif /* CFG_CMD_NET */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -63,6 +63,9 @@
|
||||
#if defined(CONFIG_LWMON)
|
||||
#include <i2c.h>
|
||||
#endif
|
||||
#ifdef CONFIG_PXA_PCMCIA
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA) || \
|
||||
((CONFIG_COMMANDS & CFG_CMD_IDE) && defined(CONFIG_IDE_8xx_PCCARD))
|
||||
@@ -86,32 +89,35 @@ static int hardware_disable(int slot);
|
||||
static int hardware_enable (int slot);
|
||||
static int voltage_set(int slot, int vcc, int vpp);
|
||||
|
||||
#ifndef CONFIG_I82365
|
||||
#if (! defined(CONFIG_I82365)) && (! defined(CONFIG_PXA_PCMCIA))
|
||||
static u_int m8xx_get_graycode(u_int size);
|
||||
#endif /* CONFIG_I82365 */
|
||||
#endif /* !CONFIG_I82365, !CONFIG_PXA_PCMCIA */
|
||||
#if 0
|
||||
static u_int m8xx_get_speed(u_int ns, u_int is_io);
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef CONFIG_PXA_PCMCIA
|
||||
|
||||
/* look up table for pgcrx registers */
|
||||
|
||||
static u_int *pcmcia_pgcrx[2] = {
|
||||
&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcra,
|
||||
&((immap_t *)CFG_IMMR)->im_pcmcia.pcmc_pgcrb,
|
||||
};
|
||||
|
||||
#define PCMCIA_PGCRX(slot) (*pcmcia_pgcrx[slot])
|
||||
|
||||
#endif /* CONFIG_PXA_PCMCIA */
|
||||
|
||||
#endif /* CONFIG_I82365 */
|
||||
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
|
||||
static void print_funcid (int func);
|
||||
static void print_fixed (volatile uchar *p);
|
||||
static int identify (volatile uchar *p);
|
||||
static int check_ide_device (int slot);
|
||||
#endif /* CONFIG_IDE_8xx_PCCARD */
|
||||
#endif /* CONFIG_IDE_8xx_PCCARD, CONFIG_PXA_PCMCIA */
|
||||
|
||||
const char *indent = "\t ";
|
||||
|
||||
@@ -151,8 +157,7 @@ int pcmcia_on (void)
|
||||
|
||||
rc = i82365_init();
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
if (rc == 0) {
|
||||
rc = check_ide_device(0);
|
||||
}
|
||||
|
||||
@@ -160,6 +165,8 @@ int pcmcia_on (void)
|
||||
}
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_PXA_PCMCIA
|
||||
|
||||
#ifdef CONFIG_HMI10
|
||||
# define HMI10_FRAM_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(2) | PCMCIA_SL(4))
|
||||
#endif
|
||||
@@ -280,8 +287,108 @@ int pcmcia_on (void)
|
||||
}
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PXA_PCMCIA */
|
||||
|
||||
#endif /* CONFIG_I82365 */
|
||||
|
||||
#ifdef CONFIG_PXA_PCMCIA
|
||||
|
||||
static int hardware_enable (int slot)
|
||||
{
|
||||
return 0; /* No hardware to enable */
|
||||
}
|
||||
|
||||
static int hardware_disable(int slot)
|
||||
{
|
||||
return 0; /* No hardware to disable */
|
||||
}
|
||||
|
||||
static int voltage_set(int slot, int vcc, int vpp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void msWait(unsigned msVal)
|
||||
{
|
||||
udelay(msVal*1000);
|
||||
}
|
||||
|
||||
int pcmcia_on (void)
|
||||
{
|
||||
unsigned int reg_arr[] = {
|
||||
0x48000028, CFG_MCMEM0_VAL,
|
||||
0x4800002c, CFG_MCMEM1_VAL,
|
||||
0x48000030, CFG_MCATT0_VAL,
|
||||
0x48000034, CFG_MCATT1_VAL,
|
||||
0x48000038, CFG_MCIO0_VAL,
|
||||
0x4800003c, CFG_MCIO1_VAL,
|
||||
|
||||
0, 0
|
||||
};
|
||||
int i, rc;
|
||||
|
||||
#ifdef CONFIG_EXADRON1
|
||||
int cardDetect;
|
||||
volatile unsigned int *v_pBCRReg =
|
||||
(volatile unsigned int *) 0x08000000;
|
||||
#endif
|
||||
|
||||
debug ("%s\n", __FUNCTION__);
|
||||
|
||||
i = 0;
|
||||
while (reg_arr[i])
|
||||
*((volatile unsigned int *) reg_arr[i++]) |= reg_arr[i++];
|
||||
udelay (1000);
|
||||
|
||||
debug ("%s: programmed mem controller \n", __FUNCTION__);
|
||||
|
||||
#ifdef CONFIG_EXADRON1
|
||||
|
||||
/*define useful BCR masks */
|
||||
#define BCR_CF_INIT_VAL 0x00007230
|
||||
#define BCR_CF_PWRON_BUSOFF_RESETOFF_VAL 0x00007231
|
||||
#define BCR_CF_PWRON_BUSOFF_RESETON_VAL 0x00007233
|
||||
#define BCR_CF_PWRON_BUSON_RESETON_VAL 0x00007213
|
||||
#define BCR_CF_PWRON_BUSON_RESETOFF_VAL 0x00007211
|
||||
|
||||
/* we see from the GPIO bit if the card is present */
|
||||
cardDetect = !(GPLR0 & GPIO_bit (14));
|
||||
|
||||
if (cardDetect) {
|
||||
printf ("No PCMCIA card found!\n");
|
||||
}
|
||||
|
||||
/* reset the card via the BCR line */
|
||||
*v_pBCRReg = (unsigned) BCR_CF_INIT_VAL;
|
||||
msWait (500);
|
||||
|
||||
*v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETOFF_VAL;
|
||||
msWait (500);
|
||||
|
||||
*v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSOFF_RESETON_VAL;
|
||||
msWait (500);
|
||||
|
||||
*v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETON_VAL;
|
||||
msWait (500);
|
||||
|
||||
*v_pBCRReg = (unsigned) BCR_CF_PWRON_BUSON_RESETOFF_VAL;
|
||||
msWait (1500);
|
||||
|
||||
/* enable address bus */
|
||||
GPCR1 = 0x01;
|
||||
/* and the first CF slot */
|
||||
MECR = 0x00000002;
|
||||
|
||||
#endif /* EXADRON 1 */
|
||||
|
||||
rc = check_ide_device (0); /* use just slot 0 */
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PXA_PCMCIA */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
|
||||
@@ -296,6 +403,9 @@ static int pcmcia_off (void)
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_PXA_PCMCIA
|
||||
|
||||
static int pcmcia_off (void)
|
||||
{
|
||||
int i;
|
||||
@@ -327,13 +437,23 @@ static int pcmcia_off (void)
|
||||
hardware_disable(_slot_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PXA_PCMCIA */
|
||||
|
||||
#endif /* CONFIG_I82365 */
|
||||
|
||||
#ifdef CONFIG_PXA_PCMCIA
|
||||
static int pcmcia_off (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CFG_CMD_PCMCIA */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
|
||||
|
||||
#define MAX_TUPEL_SZ 512
|
||||
#define MAX_FEATURES 4
|
||||
@@ -2125,11 +2245,11 @@ done:
|
||||
#endif /* R360MPI */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* KUP4K Board */
|
||||
/* KUP4K and KUP4X Boards */
|
||||
/* -------------------------------------------------------------------- */
|
||||
#if defined(CONFIG_KUP4K)
|
||||
#if defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
|
||||
|
||||
#define PCMCIA_BOARD_MSG "KUP4K"
|
||||
#define PCMCIA_BOARD_MSG "KUP"
|
||||
|
||||
#define KUP4K_PCMCIA_B_3V3 (0x00020000)
|
||||
|
||||
@@ -2337,7 +2457,7 @@ static int voltage_set(int slot, int vcc, int vpp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif /* KUP4K */
|
||||
#endif /* KUP4K || KUP4X */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -2370,7 +2490,7 @@ static const u_int m8xx_size_to_gray[M8XX_SIZES_NO] =
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef CONFIG_I82365
|
||||
#if ( ! defined(CONFIG_I82365) && ! defined(CONFIG_PXA_PCMCIA) )
|
||||
|
||||
static u_int m8xx_get_graycode(u_int size)
|
||||
{
|
||||
@@ -2444,7 +2564,7 @@ static u_int m8xx_get_speed(u_int ns, u_int is_io)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
|
||||
static void print_funcid (int func)
|
||||
{
|
||||
puts (indent);
|
||||
@@ -2486,7 +2606,7 @@ static void print_funcid (int func)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
|
||||
static void print_fixed (volatile uchar *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
@@ -2544,7 +2664,7 @@ static void print_fixed (volatile uchar *p)
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_PXA_PCMCIA)
|
||||
|
||||
#define MAX_IDENT_CHARS 64
|
||||
#define MAX_IDENT_FIELDS 4
|
||||
@@ -2606,6 +2726,370 @@ static int identify (volatile uchar *p)
|
||||
}
|
||||
#endif /* CONFIG_IDE_8xx_PCCARD */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* NETTA board by Intracom S.A. */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#if defined(CONFIG_NETTA)
|
||||
|
||||
/* some sane bit macros */
|
||||
#define _BD(_b) (1U << (31-(_b)))
|
||||
#define _BDR(_l, _h) (((((1U << (31-(_l))) - 1) << 1) | 1) & ~((1U << (31-(_h))) - 1))
|
||||
|
||||
#define _BW(_b) (1U << (15-(_b)))
|
||||
#define _BWR(_l, _h) (((((1U << (15-(_l))) - 1) << 1) | 1) & ~((1U << (15-(_h))) - 1))
|
||||
|
||||
#define _BB(_b) (1U << (7-(_b)))
|
||||
#define _BBR(_l, _h) (((((1U << (7-(_l))) - 1) << 1) | 1) & ~((1U << (7-(_h))) - 1))
|
||||
|
||||
#define _B(_b) _BD(_b)
|
||||
#define _BR(_l, _h) _BDR(_l, _h)
|
||||
|
||||
#define PCMCIA_BOARD_MSG "NETTA"
|
||||
|
||||
static const unsigned short vppd_masks[2] = { _BW(14), _BW(15) };
|
||||
|
||||
static void cfg_vppd(int no)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask;
|
||||
|
||||
if ((unsigned int)no >= sizeof(vppd_masks)/sizeof(vppd_masks[0]))
|
||||
return;
|
||||
|
||||
mask = vppd_masks[no];
|
||||
|
||||
immap->im_ioport.iop_papar &= ~mask;
|
||||
immap->im_ioport.iop_paodr &= ~mask;
|
||||
immap->im_ioport.iop_padir |= mask;
|
||||
}
|
||||
|
||||
static void set_vppd(int no, int what)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask;
|
||||
|
||||
if ((unsigned int)no >= sizeof(vppd_masks)/sizeof(vppd_masks[0]))
|
||||
return;
|
||||
|
||||
mask = vppd_masks[no];
|
||||
|
||||
if (what)
|
||||
immap->im_ioport.iop_padat |= mask;
|
||||
else
|
||||
immap->im_ioport.iop_padat &= ~mask;
|
||||
}
|
||||
|
||||
static const unsigned short vccd_masks[2] = { _BW(10), _BW(6) };
|
||||
|
||||
static void cfg_vccd(int no)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask;
|
||||
|
||||
if ((unsigned int)no >= sizeof(vccd_masks)/sizeof(vccd_masks[0]))
|
||||
return;
|
||||
|
||||
mask = vccd_masks[no];
|
||||
|
||||
immap->im_ioport.iop_papar &= ~mask;
|
||||
immap->im_ioport.iop_paodr &= ~mask;
|
||||
immap->im_ioport.iop_padir |= mask;
|
||||
}
|
||||
|
||||
static void set_vccd(int no, int what)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask;
|
||||
|
||||
if ((unsigned int)no >= sizeof(vccd_masks)/sizeof(vccd_masks[0]))
|
||||
return;
|
||||
|
||||
mask = vccd_masks[no];
|
||||
|
||||
if (what)
|
||||
immap->im_ioport.iop_padat |= mask;
|
||||
else
|
||||
immap->im_ioport.iop_padat &= ~mask;
|
||||
}
|
||||
|
||||
static const unsigned short oc_mask = _BW(8);
|
||||
|
||||
static void cfg_oc(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask = oc_mask;
|
||||
|
||||
immap->im_ioport.iop_pcdir &= ~mask;
|
||||
immap->im_ioport.iop_pcso &= ~mask;
|
||||
immap->im_ioport.iop_pcint &= ~mask;
|
||||
immap->im_ioport.iop_pcpar &= ~mask;
|
||||
}
|
||||
|
||||
static int get_oc(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask = oc_mask;
|
||||
int what;
|
||||
|
||||
what = !!(immap->im_ioport.iop_pcdat & mask);;
|
||||
return what;
|
||||
}
|
||||
|
||||
static const unsigned short shdn_mask = _BW(12);
|
||||
|
||||
static void cfg_shdn(void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask;
|
||||
|
||||
mask = shdn_mask;
|
||||
|
||||
immap->im_ioport.iop_papar &= ~mask;
|
||||
immap->im_ioport.iop_paodr &= ~mask;
|
||||
immap->im_ioport.iop_padir |= mask;
|
||||
}
|
||||
|
||||
static void set_shdn(int what)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
unsigned short mask;
|
||||
|
||||
mask = shdn_mask;
|
||||
|
||||
if (what)
|
||||
immap->im_ioport.iop_padat |= mask;
|
||||
else
|
||||
immap->im_ioport.iop_padat &= ~mask;
|
||||
}
|
||||
|
||||
static void cfg_ports (void);
|
||||
|
||||
static int hardware_enable(int slot)
|
||||
{
|
||||
volatile immap_t *immap;
|
||||
volatile cpm8xx_t *cp;
|
||||
volatile pcmconf8xx_t *pcmp;
|
||||
volatile sysconf8xx_t *sysp;
|
||||
uint reg, pipr, mask;
|
||||
int i;
|
||||
|
||||
debug ("hardware_enable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
|
||||
|
||||
udelay(10000);
|
||||
|
||||
immap = (immap_t *)CFG_IMMR;
|
||||
sysp = (sysconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_siu_conf));
|
||||
pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
|
||||
cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
|
||||
|
||||
/* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
|
||||
cfg_ports ();
|
||||
|
||||
/* clear interrupt state, and disable interrupts */
|
||||
pcmp->pcmc_pscr = PCMCIA_MASK(_slot_);
|
||||
pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
|
||||
|
||||
/*
|
||||
* Disable interrupts, DMA, and PCMCIA buffers
|
||||
* (isolate the interface) and assert RESET signal
|
||||
*/
|
||||
debug ("Disable PCMCIA buffers and assert RESET\n");
|
||||
reg = 0;
|
||||
reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
|
||||
reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
|
||||
PCMCIA_PGCRX(_slot_) = reg;
|
||||
|
||||
udelay(500);
|
||||
|
||||
/*
|
||||
* Make sure there is a card in the slot, then configure the interface.
|
||||
*/
|
||||
udelay(10000);
|
||||
debug ("[%d] %s: PIPR(%p)=0x%x\n",
|
||||
__LINE__,__FUNCTION__,
|
||||
&(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
|
||||
if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
|
||||
printf (" No Card found\n");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Power On: Set VAVCC to 3.3V or 5V, set VAVPP to Hi-Z
|
||||
*/
|
||||
mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
|
||||
pipr = pcmp->pcmc_pipr;
|
||||
debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
|
||||
pipr,
|
||||
(reg&PCMCIA_VS1(slot))?"n":"ff",
|
||||
(reg&PCMCIA_VS2(slot))?"n":"ff");
|
||||
|
||||
if ((pipr & mask) == mask) {
|
||||
set_vppd(0, 1); set_vppd(1, 1); /* VAVPP => Hi-Z */
|
||||
set_vccd(0, 0); set_vccd(1, 1); /* 5V on, 3V off */
|
||||
puts (" 5.0V card found: ");
|
||||
} else {
|
||||
set_vppd(0, 1); set_vppd(1, 1); /* VAVPP => Hi-Z */
|
||||
set_vccd(0, 1); set_vccd(1, 0); /* 5V off, 3V on */
|
||||
puts (" 3.3V card found: ");
|
||||
}
|
||||
|
||||
/* Wait 500 ms; use this to check for over-current */
|
||||
for (i=0; i<5000; ++i) {
|
||||
if (!get_oc()) {
|
||||
printf (" *** Overcurrent - Safety shutdown ***\n");
|
||||
set_vccd(0, 0); set_vccd(1, 0); /* VAVPP => Hi-Z */
|
||||
return (1);
|
||||
}
|
||||
udelay (100);
|
||||
}
|
||||
|
||||
debug ("Enable PCMCIA buffers and stop RESET\n");
|
||||
reg = PCMCIA_PGCRX(_slot_);
|
||||
reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
|
||||
reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
|
||||
PCMCIA_PGCRX(_slot_) = reg;
|
||||
|
||||
udelay(250000); /* some cards need >150 ms to come up :-( */
|
||||
|
||||
debug ("# hardware_enable done\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_PCMCIA)
|
||||
static int hardware_disable(int slot)
|
||||
{
|
||||
volatile immap_t *immap;
|
||||
volatile pcmconf8xx_t *pcmp;
|
||||
u_long reg;
|
||||
|
||||
debug ("hardware_disable: " PCMCIA_BOARD_MSG " Slot %c\n", 'A'+slot);
|
||||
|
||||
immap = (immap_t *)CFG_IMMR;
|
||||
pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
|
||||
|
||||
/* Configure PCMCIA General Control Register */
|
||||
debug ("Disable PCMCIA buffers and assert RESET\n");
|
||||
reg = 0;
|
||||
reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
|
||||
reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
|
||||
PCMCIA_PGCRX(_slot_) = reg;
|
||||
|
||||
/* All voltages off / Hi-Z */
|
||||
set_vppd(0, 1); set_vppd(1, 1);
|
||||
set_vccd(0, 1); set_vccd(1, 1);
|
||||
|
||||
udelay(10000);
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CFG_CMD_PCMCIA */
|
||||
|
||||
|
||||
static int voltage_set(int slot, int vcc, int vpp)
|
||||
{
|
||||
volatile immap_t *immap;
|
||||
volatile cpm8xx_t *cp;
|
||||
volatile pcmconf8xx_t *pcmp;
|
||||
u_long reg;
|
||||
ushort sreg;
|
||||
|
||||
debug ("voltage_set: "
|
||||
PCMCIA_BOARD_MSG
|
||||
" Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
|
||||
'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
|
||||
|
||||
immap = (immap_t *)CFG_IMMR;
|
||||
cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
|
||||
pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
|
||||
/*
|
||||
* Disable PCMCIA buffers (isolate the interface)
|
||||
* and assert RESET signal
|
||||
*/
|
||||
debug ("Disable PCMCIA buffers and assert RESET\n");
|
||||
reg = PCMCIA_PGCRX(_slot_);
|
||||
reg |= __MY_PCMCIA_GCRX_CXRESET; /* active high */
|
||||
reg |= __MY_PCMCIA_GCRX_CXOE; /* active low */
|
||||
PCMCIA_PGCRX(_slot_) = reg;
|
||||
udelay(500);
|
||||
|
||||
/*
|
||||
* Configure Port C pins for
|
||||
* 5 Volts Enable and 3 Volts enable,
|
||||
* Turn all power pins to Hi-Z
|
||||
*/
|
||||
debug ("PCMCIA power OFF\n");
|
||||
cfg_ports (); /* Enables switch, but all in Hi-Z */
|
||||
|
||||
sreg = immap->im_ioport.iop_pcdat;
|
||||
set_vppd(0, 1); set_vppd(1, 1);
|
||||
|
||||
switch(vcc) {
|
||||
case 0:
|
||||
break; /* Switch off */
|
||||
|
||||
case 33:
|
||||
set_vccd(0, 1); set_vccd(1, 0);
|
||||
break;
|
||||
|
||||
case 50:
|
||||
set_vccd(0, 0); set_vccd(1, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Checking supported voltages */
|
||||
|
||||
debug ("PIPR: 0x%x --> %s\n",
|
||||
pcmp->pcmc_pipr,
|
||||
(pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
|
||||
|
||||
done:
|
||||
debug ("Enable PCMCIA buffers and stop RESET\n");
|
||||
reg = PCMCIA_PGCRX(_slot_);
|
||||
reg &= ~__MY_PCMCIA_GCRX_CXRESET; /* active high */
|
||||
reg &= ~__MY_PCMCIA_GCRX_CXOE; /* active low */
|
||||
PCMCIA_PGCRX(_slot_) = reg;
|
||||
udelay(500);
|
||||
|
||||
debug ("voltage_set: " PCMCIA_BOARD_MSG " Slot %c, DONE\n",
|
||||
slot+'A');
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void cfg_ports (void)
|
||||
{
|
||||
volatile immap_t *immap;
|
||||
volatile cpm8xx_t *cp;
|
||||
|
||||
immap = (immap_t *)CFG_IMMR;
|
||||
cp = (cpm8xx_t *)(&(((immap_t *)CFG_IMMR)->im_cpm));
|
||||
|
||||
|
||||
cfg_vppd(0); cfg_vppd(1); /* VPPD0,VPPD1 VAVPP => Hi-Z */
|
||||
cfg_vccd(0); cfg_vccd(1); /* 3V and 5V off */
|
||||
cfg_shdn();
|
||||
cfg_oc();
|
||||
|
||||
/*
|
||||
* Configure Port A for TPS2211 PC-Card Power-Interface Switch
|
||||
*
|
||||
* Switch off all voltages, assert shutdown
|
||||
*/
|
||||
set_vppd(0, 1); set_vppd(1, 1);
|
||||
set_vccd(0, 0); set_vccd(1, 0);
|
||||
set_shdn(1);
|
||||
|
||||
udelay(100000);
|
||||
}
|
||||
|
||||
#endif /* NETTA */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#endif /* CFG_CMD_PCMCIA || (CFG_CMD_IDE && CONFIG_IDE_8xx_PCCARD) */
|
||||
|
||||
435
common/command.c
435
common/command.c
@@ -74,6 +74,159 @@ U_BOOT_CMD(
|
||||
" - echo args to console; \\c suppresses newline\n"
|
||||
);
|
||||
|
||||
#ifdef CFG_HUSH_PARSER
|
||||
|
||||
int
|
||||
do_test (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
char **ap;
|
||||
int left, adv, expr, last_expr, neg, last_cmp;
|
||||
|
||||
/* args? */
|
||||
if (argc < 3)
|
||||
return 1;
|
||||
|
||||
#if 0
|
||||
{
|
||||
printf("test:");
|
||||
left = 1;
|
||||
while (argv[left])
|
||||
printf(" %s", argv[left++]);
|
||||
}
|
||||
#endif
|
||||
|
||||
last_expr = 0;
|
||||
left = argc - 1; ap = argv + 1;
|
||||
if (left > 0 && strcmp(ap[0], "!") == 0) {
|
||||
neg = 1;
|
||||
ap++;
|
||||
left--;
|
||||
} else
|
||||
neg = 0;
|
||||
|
||||
expr = -1;
|
||||
last_cmp = -1;
|
||||
last_expr = -1;
|
||||
while (left > 0) {
|
||||
|
||||
if (strcmp(ap[0], "-o") == 0 || strcmp(ap[0], "-a") == 0)
|
||||
adv = 1;
|
||||
else if (strcmp(ap[0], "-z") == 0 || strcmp(ap[0], "-n") == 0)
|
||||
adv = 2;
|
||||
else
|
||||
adv = 3;
|
||||
|
||||
if (left < adv) {
|
||||
expr = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (adv == 1) {
|
||||
if (strcmp(ap[0], "-o") == 0) {
|
||||
last_expr = expr;
|
||||
last_cmp = 0;
|
||||
} else if (strcmp(ap[0], "-a") == 0) {
|
||||
last_expr = expr;
|
||||
last_cmp = 1;
|
||||
} else {
|
||||
expr = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (adv == 2) {
|
||||
if (strcmp(ap[0], "-z") == 0)
|
||||
expr = strlen(ap[1]) == 0 ? 0 : 1;
|
||||
else if (strcmp(ap[0], "-n") == 0)
|
||||
expr = strlen(ap[1]) == 0 ? 1 : 0;
|
||||
else {
|
||||
expr = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (last_cmp == 0)
|
||||
expr = last_expr || expr;
|
||||
else if (last_cmp == 1)
|
||||
expr = last_expr && expr;
|
||||
last_cmp = -1;
|
||||
}
|
||||
|
||||
if (adv == 3) {
|
||||
if (strcmp(ap[1], "=") == 0)
|
||||
expr = strcmp(ap[0], ap[2]) == 0;
|
||||
else if (strcmp(ap[1], "!=") == 0)
|
||||
expr = strcmp(ap[0], ap[2]) != 0;
|
||||
else if (strcmp(ap[1], ">") == 0)
|
||||
expr = strcmp(ap[0], ap[2]) > 0;
|
||||
else if (strcmp(ap[1], "<") == 0)
|
||||
expr = strcmp(ap[0], ap[2]) < 0;
|
||||
else if (strcmp(ap[1], "-eq") == 0)
|
||||
expr = simple_strtol(ap[0], NULL, 10) == simple_strtol(ap[2], NULL, 10);
|
||||
else if (strcmp(ap[1], "-ne") == 0)
|
||||
expr = simple_strtol(ap[0], NULL, 10) != simple_strtol(ap[2], NULL, 10);
|
||||
else if (strcmp(ap[1], "-lt") == 0)
|
||||
expr = simple_strtol(ap[0], NULL, 10) < simple_strtol(ap[2], NULL, 10);
|
||||
else if (strcmp(ap[1], "-le") == 0)
|
||||
expr = simple_strtol(ap[0], NULL, 10) <= simple_strtol(ap[2], NULL, 10);
|
||||
else if (strcmp(ap[1], "-gt") == 0)
|
||||
expr = simple_strtol(ap[0], NULL, 10) > simple_strtol(ap[2], NULL, 10);
|
||||
else if (strcmp(ap[1], "-ge") == 0)
|
||||
expr = simple_strtol(ap[0], NULL, 10) >= simple_strtol(ap[2], NULL, 10);
|
||||
else {
|
||||
expr = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (last_cmp == 0)
|
||||
expr = last_expr || expr;
|
||||
else if (last_cmp == 1)
|
||||
expr = last_expr && expr;
|
||||
last_cmp = -1;
|
||||
}
|
||||
|
||||
ap += adv; left -= adv;
|
||||
}
|
||||
|
||||
if (neg)
|
||||
expr = !expr;
|
||||
|
||||
expr = !expr;
|
||||
|
||||
#if 0
|
||||
printf(": returns %d\n", expr);
|
||||
#endif
|
||||
|
||||
return expr;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
test, CFG_MAXARGS, 1, do_test,
|
||||
"test - minimal test like /bin/sh\n",
|
||||
"[args..]\n"
|
||||
" - test functionality\n"
|
||||
);
|
||||
|
||||
int
|
||||
do_exit (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
int r;
|
||||
|
||||
r = 0;
|
||||
if (argc > 1)
|
||||
r = simple_strtoul(argv[1], NULL, 10);
|
||||
|
||||
return -r - 2;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
exit, 2, 1, do_exit,
|
||||
"exit - exit script\n",
|
||||
" - exit functionality\n"
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use puts() instead of printf() to avoid printf buffer overflow
|
||||
* for long help messages
|
||||
@@ -217,3 +370,285 @@ cmd_tbl_t *find_cmd (const char *cmd)
|
||||
|
||||
return NULL; /* not found or ambiguous command */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
|
||||
int var_complete(int argc, char *argv[], char last_char, int maxv, char *cmdv[])
|
||||
{
|
||||
static char tmp_buf[512];
|
||||
int space;
|
||||
|
||||
space = last_char == '\0' || last_char == ' ' || last_char == '\t';
|
||||
|
||||
if (space && argc == 1)
|
||||
return env_complete("", maxv, cmdv, sizeof(tmp_buf), tmp_buf);
|
||||
|
||||
if (!space && argc == 2)
|
||||
return env_complete(argv[1], maxv, cmdv, sizeof(tmp_buf), tmp_buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void install_auto_complete_handler(const char *cmd,
|
||||
int (*complete)(int argc, char *argv[], char last_char, int maxv, char *cmdv[]))
|
||||
{
|
||||
cmd_tbl_t *cmdtp;
|
||||
|
||||
cmdtp = find_cmd(cmd);
|
||||
if (cmdtp == NULL)
|
||||
return;
|
||||
|
||||
cmdtp->complete = complete;
|
||||
}
|
||||
|
||||
void install_auto_complete(void)
|
||||
{
|
||||
install_auto_complete_handler("printenv", var_complete);
|
||||
install_auto_complete_handler("setenv", var_complete);
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_RUN)
|
||||
install_auto_complete_handler("run", var_complete);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************************/
|
||||
|
||||
static int complete_cmdv(int argc, char *argv[], char last_char, int maxv, char *cmdv[])
|
||||
{
|
||||
cmd_tbl_t *cmdtp;
|
||||
const char *p;
|
||||
int len, clen;
|
||||
int n_found = 0;
|
||||
const char *cmd;
|
||||
|
||||
/* sanity? */
|
||||
if (maxv < 2)
|
||||
return -2;
|
||||
|
||||
cmdv[0] = NULL;
|
||||
|
||||
if (argc == 0) {
|
||||
/* output full list of commands */
|
||||
for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) {
|
||||
if (n_found >= maxv - 2) {
|
||||
cmdv[n_found++] = "...";
|
||||
break;
|
||||
}
|
||||
cmdv[n_found++] = cmdtp->name;
|
||||
}
|
||||
cmdv[n_found] = NULL;
|
||||
return n_found;
|
||||
}
|
||||
|
||||
/* more than one arg or one but the start of the next */
|
||||
if (argc > 1 || (last_char == '\0' || last_char == ' ' || last_char == '\t')) {
|
||||
cmdtp = find_cmd(argv[0]);
|
||||
if (cmdtp == NULL || cmdtp->complete == NULL) {
|
||||
cmdv[0] = NULL;
|
||||
return 0;
|
||||
}
|
||||
return (*cmdtp->complete)(argc, argv, last_char, maxv, cmdv);
|
||||
}
|
||||
|
||||
cmd = argv[0];
|
||||
/*
|
||||
* Some commands allow length modifiers (like "cp.b");
|
||||
* compare command name only until first dot.
|
||||
*/
|
||||
p = strchr(cmd, '.');
|
||||
if (p == NULL)
|
||||
len = strlen(cmd);
|
||||
else
|
||||
len = p - cmd;
|
||||
|
||||
/* return the partial matches */
|
||||
for (cmdtp = &__u_boot_cmd_start; cmdtp != &__u_boot_cmd_end; cmdtp++) {
|
||||
|
||||
clen = strlen(cmdtp->name);
|
||||
if (clen < len)
|
||||
continue;
|
||||
|
||||
if (memcmp(cmd, cmdtp->name, len) != 0)
|
||||
continue;
|
||||
|
||||
/* too many! */
|
||||
if (n_found >= maxv - 2) {
|
||||
cmdv[n_found++] = "...";
|
||||
break;
|
||||
}
|
||||
|
||||
cmdv[n_found++] = cmdtp->name;
|
||||
}
|
||||
|
||||
cmdv[n_found] = NULL;
|
||||
return n_found;
|
||||
}
|
||||
|
||||
static int make_argv(char *s, int argvsz, char *argv[])
|
||||
{
|
||||
int argc = 0;
|
||||
|
||||
/* split into argv */
|
||||
while (argc < argvsz - 1) {
|
||||
|
||||
/* skip any white space */
|
||||
while ((*s == ' ') || (*s == '\t'))
|
||||
++s;
|
||||
|
||||
if (*s == '\0') /* end of s, no more args */
|
||||
break;
|
||||
|
||||
argv[argc++] = s; /* begin of argument string */
|
||||
|
||||
/* find end of string */
|
||||
while (*s && (*s != ' ') && (*s != '\t'))
|
||||
++s;
|
||||
|
||||
if (*s == '\0') /* end of s, no more args */
|
||||
break;
|
||||
|
||||
*s++ = '\0'; /* terminate current arg */
|
||||
}
|
||||
argv[argc] = NULL;
|
||||
|
||||
return argc;
|
||||
}
|
||||
|
||||
static void print_argv(const char *banner, const char *leader, const char *sep, int linemax, char *argv[])
|
||||
{
|
||||
int ll = leader != NULL ? strlen(leader) : 0;
|
||||
int sl = sep != NULL ? strlen(sep) : 0;
|
||||
int len, i;
|
||||
|
||||
if (banner) {
|
||||
puts("\n");
|
||||
puts(banner);
|
||||
}
|
||||
|
||||
i = linemax; /* force leader and newline */
|
||||
while (*argv != NULL) {
|
||||
len = strlen(*argv) + sl;
|
||||
if (i + len >= linemax) {
|
||||
puts("\n");
|
||||
if (leader)
|
||||
puts(leader);
|
||||
i = ll - sl;
|
||||
} else if (sep)
|
||||
puts(sep);
|
||||
puts(*argv++);
|
||||
i += len;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static int find_common_prefix(char *argv[])
|
||||
{
|
||||
int i, len;
|
||||
char *anchor, *s, *t;
|
||||
|
||||
if (*argv == NULL)
|
||||
return 0;
|
||||
|
||||
/* begin with max */
|
||||
anchor = *argv++;
|
||||
len = strlen(anchor);
|
||||
while ((t = *argv++) != NULL) {
|
||||
s = anchor;
|
||||
for (i = 0; i < len; i++, t++, s++) {
|
||||
if (*t != *s)
|
||||
break;
|
||||
}
|
||||
len = s - anchor;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static char tmp_buf[CFG_CBSIZE]; /* copy of console I/O buffer */
|
||||
|
||||
int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
|
||||
{
|
||||
int n = *np, col = *colp;
|
||||
char *argv[CFG_MAXARGS + 1]; /* NULL terminated */
|
||||
char *cmdv[20];
|
||||
char *s, *t;
|
||||
const char *sep;
|
||||
int i, j, k, len, seplen, argc;
|
||||
int cnt;
|
||||
char last_char;
|
||||
|
||||
if (strcmp(prompt, CFG_PROMPT) != 0)
|
||||
return 0; /* not in normal console */
|
||||
|
||||
cnt = strlen(buf);
|
||||
if (cnt >= 1)
|
||||
last_char = buf[cnt - 1];
|
||||
else
|
||||
last_char = '\0';
|
||||
|
||||
/* copy to secondary buffer which will be affected */
|
||||
strcpy(tmp_buf, buf);
|
||||
|
||||
/* separate into argv */
|
||||
argc = make_argv(tmp_buf, sizeof(argv)/sizeof(argv[0]), argv);
|
||||
|
||||
/* do the completion and return the possible completions */
|
||||
i = complete_cmdv(argc, argv, last_char, sizeof(cmdv)/sizeof(cmdv[0]), cmdv);
|
||||
|
||||
/* no match; bell and out */
|
||||
if (i == 0) {
|
||||
if (argc > 1) /* allow tab for non command */
|
||||
return 0;
|
||||
putc('\a');
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = NULL;
|
||||
len = 0;
|
||||
sep = NULL;
|
||||
seplen = 0;
|
||||
if (i == 1) { /* one match; perfect */
|
||||
k = strlen(argv[argc - 1]);
|
||||
s = cmdv[0] + k;
|
||||
len = strlen(s);
|
||||
sep = " ";
|
||||
seplen = 1;
|
||||
} else if (i > 1 && (j = find_common_prefix(cmdv)) != 0) { /* more */
|
||||
k = strlen(argv[argc - 1]);
|
||||
j -= k;
|
||||
if (j > 0) {
|
||||
s = cmdv[0] + k;
|
||||
len = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (s != NULL) {
|
||||
k = len + seplen;
|
||||
/* make sure it fits */
|
||||
if (n + k >= CFG_CBSIZE - 2) {
|
||||
putc('\a');
|
||||
return 1;
|
||||
}
|
||||
|
||||
t = buf + cnt;
|
||||
for (i = 0; i < len; i++)
|
||||
*t++ = *s++;
|
||||
if (sep != NULL)
|
||||
for (i = 0; i < seplen; i++)
|
||||
*t++ = sep[i];
|
||||
*t = '\0';
|
||||
n += k;
|
||||
col += k;
|
||||
puts(t - k);
|
||||
if (sep == NULL)
|
||||
putc('\a');
|
||||
*np = n;
|
||||
*colp = col;
|
||||
} else {
|
||||
print_argv(NULL, " ", " ", 78, cmdv);
|
||||
|
||||
puts(prompt);
|
||||
puts(buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -412,6 +412,9 @@ int console_init_r (void)
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
char *stdinname, *stdoutname, *stderrname;
|
||||
device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
|
||||
#ifdef CFG_CONSOLE_ENV_OVERWRITE
|
||||
int i;
|
||||
#endif /* CFG_CONSOLE_ENV_OVERWRITE */
|
||||
|
||||
/* set default handlers at first */
|
||||
gd->jt[XF_getc] = serial_getc;
|
||||
@@ -483,7 +486,7 @@ int console_init_r (void)
|
||||
for (i = 0; i < 3; i++) {
|
||||
setenv (stdio_names[i], stdio_devices[i]->name);
|
||||
}
|
||||
#endif /* CFG_CONSOLE_ENV_OVERWRITE */
|
||||
#endif /* CFG_CONSOLE_ENV_OVERWRITE */
|
||||
|
||||
#if 0
|
||||
/* If nothing usable installed, use only the initial console */
|
||||
|
||||
@@ -260,3 +260,44 @@ void env_relocate (void)
|
||||
disable_nvram();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf)
|
||||
{
|
||||
int i, nxt, len, vallen, found;
|
||||
const char *lval, *rval;
|
||||
|
||||
found = 0;
|
||||
cmdv[0] = NULL;
|
||||
|
||||
len = strlen(var);
|
||||
/* now iterate over the variables and select those that match */
|
||||
for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
|
||||
|
||||
for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
|
||||
;
|
||||
|
||||
lval = env_get_addr(i);
|
||||
rval = strchr(lval, '=');
|
||||
if (rval != NULL) {
|
||||
vallen = rval - lval;
|
||||
rval++;
|
||||
} else
|
||||
vallen = strlen(lval);
|
||||
|
||||
if (len > 0 && (vallen < len || memcmp(lval, var, len) != 0))
|
||||
continue;
|
||||
|
||||
if (found >= maxv - 2 || bufsz < vallen + 1) {
|
||||
cmdv[found++] = "...";
|
||||
break;
|
||||
}
|
||||
cmdv[found++] = buf;
|
||||
memcpy(buf, lval, vallen); buf += vallen; bufsz -= vallen;
|
||||
*buf++ = '\0'; bufsz--;
|
||||
}
|
||||
|
||||
cmdv[found] = NULL;
|
||||
return found;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
defined(CONFIG_R360MPI) || \
|
||||
defined(CONFIG_TQM8xxL) || \
|
||||
defined(CONFIG_RRVISION) || \
|
||||
defined(CONFIG_TRAB) ) && \
|
||||
defined(CONFIG_TRAB) || \
|
||||
defined(CONFIG_PPCHAMELEONEVB) ) && \
|
||||
defined(ENV_CRC) /* Environment embedded in U-Boot .ppcenv section */
|
||||
/* XXX - This only works with GNU C */
|
||||
# define __PPCENV__ __attribute__ ((section(".ppcenv")))
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#include <common.h>
|
||||
#include <flash.h>
|
||||
|
||||
@@ -45,6 +47,11 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
|
||||
short s_end = info->sector_count - 1; /* index of last sector */
|
||||
int i;
|
||||
|
||||
debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
|
||||
(flag & FLAG_PROTECT_SET) ? "ON" :
|
||||
(flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
|
||||
from, to);
|
||||
|
||||
/* Do nothing if input data is bad. */
|
||||
if (info->sector_count == 0 || info->size == 0 || to < from) {
|
||||
return;
|
||||
@@ -73,6 +80,7 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
|
||||
#else
|
||||
info->protect[i] = 0;
|
||||
#endif /* CFG_FLASH_PROTECTION */
|
||||
debug ("protect off %d\n", i);
|
||||
}
|
||||
else if (flag & FLAG_PROTECT_SET) {
|
||||
#if defined(CFG_FLASH_PROTECTION)
|
||||
@@ -80,6 +88,7 @@ flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
|
||||
#else
|
||||
info->protect[i] = 1;
|
||||
#endif /* CFG_FLASH_PROTECTION */
|
||||
debug ("protect on %d\n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,6 +290,7 @@ char **global_argv;
|
||||
unsigned int global_argc;
|
||||
#endif
|
||||
unsigned int last_return_code;
|
||||
int nesting_level;
|
||||
#ifndef __U_BOOT__
|
||||
extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */
|
||||
#endif
|
||||
@@ -416,7 +417,9 @@ static int b_check_space(o_string *o, int len);
|
||||
static int b_addchr(o_string *o, int ch);
|
||||
static void b_reset(o_string *o);
|
||||
static int b_addqchr(o_string *o, int ch, int quote);
|
||||
#ifndef __U_BOOT__
|
||||
static int b_adduint(o_string *o, unsigned int i);
|
||||
#endif
|
||||
/* in_str manipulations: */
|
||||
static int static_get(struct in_str *i);
|
||||
static int static_peek(struct in_str *i);
|
||||
@@ -936,6 +939,7 @@ char *simple_itoa(unsigned int i)
|
||||
return p + 1;
|
||||
}
|
||||
|
||||
#ifndef __U_BOOT__
|
||||
static int b_adduint(o_string *o, unsigned int i)
|
||||
{
|
||||
int r;
|
||||
@@ -944,6 +948,7 @@ static int b_adduint(o_string *o, unsigned int i)
|
||||
do r=b_addchr(o, *p++); while (r==0 && *p);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int static_get(struct in_str *i)
|
||||
{
|
||||
@@ -1843,7 +1848,7 @@ static int run_list_real(struct pipe *pi)
|
||||
if (rmode == RES_THEN || rmode == RES_ELSE) if_code = next_if_code;
|
||||
if (rmode == RES_THEN && if_code) continue;
|
||||
if (rmode == RES_ELSE && !if_code) continue;
|
||||
if (rmode == RES_ELIF && !if_code) continue;
|
||||
if (rmode == RES_ELIF && !if_code) break;
|
||||
if (rmode == RES_FOR && pi->num_progs) {
|
||||
if (!list) {
|
||||
/* if no variable values after "in" we skip "for" */
|
||||
@@ -1921,6 +1926,10 @@ static int run_list_real(struct pipe *pi)
|
||||
}
|
||||
last_return_code=rcode;
|
||||
#else
|
||||
if (rcode < -1) {
|
||||
last_return_code = -rcode - 2;
|
||||
return -2; /* exit */
|
||||
}
|
||||
last_return_code=(rcode == 0) ? 0 : 1;
|
||||
#endif
|
||||
#ifndef __U_BOOT__
|
||||
@@ -2145,6 +2154,10 @@ static int xglob(o_string *dest, int flags, glob_t *pglob)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __U_BOOT__
|
||||
static char *get_dollar_var(char ch);
|
||||
#endif
|
||||
|
||||
/* This is used to get/check local shell variables */
|
||||
static char *get_local_var(const char *s)
|
||||
{
|
||||
@@ -2152,6 +2165,12 @@ static char *get_local_var(const char *s)
|
||||
|
||||
if (!s)
|
||||
return NULL;
|
||||
|
||||
#ifdef __U_BOOT__
|
||||
if (*s == '$')
|
||||
return get_dollar_var(s[1]);
|
||||
#endif
|
||||
|
||||
for (cur = top_vars; cur; cur=cur->next)
|
||||
if(strcmp(cur->name, s)==0)
|
||||
return cur->value;
|
||||
@@ -2168,12 +2187,19 @@ static int set_local_var(const char *s, int flg_export)
|
||||
int result=0;
|
||||
struct variables *cur;
|
||||
|
||||
#ifdef __U_BOOT__
|
||||
/* might be possible! */
|
||||
if (!isalpha(*s))
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
name=strdup(s);
|
||||
|
||||
#ifdef __U_BOOT__
|
||||
if (getenv(name) != NULL) {
|
||||
printf ("ERROR: "
|
||||
"There is a global environment variable with the same name.\n");
|
||||
free(name);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@@ -2278,7 +2304,10 @@ static void unset_local_var(const char *name)
|
||||
|
||||
static int is_assignment(const char *s)
|
||||
{
|
||||
if (s==NULL || !isalpha(*s)) return 0;
|
||||
if (s == NULL)
|
||||
return 0;
|
||||
|
||||
if (!isalpha(*s)) return 0;
|
||||
++s;
|
||||
while(isalnum(*s) || *s=='_') ++s;
|
||||
return *s=='=';
|
||||
@@ -2749,15 +2778,35 @@ static int parse_group(o_string *dest, struct p_context *ctx,
|
||||
* see the bash man page under "Parameter Expansion" */
|
||||
static char *lookup_param(char *src)
|
||||
{
|
||||
char *p=NULL;
|
||||
if (src) {
|
||||
char *p;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
p = getenv(src);
|
||||
if (!p)
|
||||
p = get_local_var(src);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef __U_BOOT__
|
||||
static char *get_dollar_var(char ch)
|
||||
{
|
||||
static char buf[40];
|
||||
|
||||
buf[0] = '\0';
|
||||
switch (ch) {
|
||||
case '?':
|
||||
sprintf(buf, "%u", (unsigned int)last_return_code);
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* return code: 0 for OK, 1 for syntax error */
|
||||
static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *input)
|
||||
{
|
||||
@@ -2799,7 +2848,15 @@ static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *i
|
||||
break;
|
||||
#endif
|
||||
case '?':
|
||||
#ifndef __U_BOOT__
|
||||
b_adduint(dest,last_return_code);
|
||||
#else
|
||||
ctx->child->sp++;
|
||||
b_addchr(dest, SPECIAL_VAR_SYMBOL);
|
||||
b_addchr(dest, '$');
|
||||
b_addchr(dest, '?');
|
||||
b_addchr(dest, SPECIAL_VAR_SYMBOL);
|
||||
#endif
|
||||
advance = 1;
|
||||
break;
|
||||
#ifndef __U_BOOT__
|
||||
@@ -2885,8 +2942,11 @@ int parse_stream(o_string *dest, struct p_context *ctx,
|
||||
if (input->__promptme == 0) return 1;
|
||||
#endif
|
||||
next = (ch == '\n') ? 0 : b_peek(input);
|
||||
debug_printf("parse_stream: ch=%c (%d) m=%d quote=%d\n",
|
||||
ch,ch,m,dest->quote);
|
||||
|
||||
debug_printf("parse_stream: ch=%c (%d) m=%d quote=%d - %c\n",
|
||||
ch >= ' ' ? ch : '.', ch, m,
|
||||
dest->quote, ctx->stack == NULL ? '*' : '.');
|
||||
|
||||
if (m==0 || ((m==1 || m==2) && dest->quote)) {
|
||||
b_addqchr(dest, ch, dest->quote);
|
||||
} else {
|
||||
@@ -3107,7 +3167,18 @@ int parse_stream_outer(struct in_str *inp, int flag)
|
||||
#ifndef __U_BOOT__
|
||||
run_list(ctx.list_head);
|
||||
#else
|
||||
if (((code = run_list(ctx.list_head)) == -1))
|
||||
code = run_list(ctx.list_head);
|
||||
if (code == -2) { /* exit */
|
||||
b_free(&temp);
|
||||
code = 0;
|
||||
/* XXX hackish way to not allow exit from main loop */
|
||||
if (inp->peek == file_peek) {
|
||||
printf("exit not allowed from main input shell.\n");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (code == -1)
|
||||
flag_repeat = 0;
|
||||
#endif
|
||||
} else {
|
||||
|
||||
@@ -365,6 +365,10 @@ void main_loop (void)
|
||||
u_boot_hush_start ();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
install_auto_complete();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PREBOOT
|
||||
if ((p = getenv ("preboot")) != NULL) {
|
||||
# ifdef CONFIG_AUTOBOOT_KEYED
|
||||
@@ -608,6 +612,14 @@ int readline (const char *const prompt)
|
||||
*/
|
||||
if (n < CFG_CBSIZE-2) {
|
||||
if (c == '\t') { /* expand TABs */
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
/* if auto completion triggered just continue */
|
||||
*p = '\0';
|
||||
if (cmd_auto_complete(prompt, console_buffer, &n, &col)) {
|
||||
p = console_buffer + n; /* reset */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
puts (tab_seq+(col&07));
|
||||
col += 8 - (col&07);
|
||||
} else {
|
||||
|
||||
@@ -203,6 +203,8 @@ int miiphy_link (unsigned char addr)
|
||||
{
|
||||
unsigned short reg;
|
||||
|
||||
/* dummy read; needed to latch some phys */
|
||||
(void)miiphy_read(addr, PHY_BMSR, ®);
|
||||
if (miiphy_read (addr, PHY_BMSR, ®)) {
|
||||
puts ("PHY_BMSR read failed, assuming no link\n");
|
||||
return (0);
|
||||
|
||||
@@ -286,16 +286,8 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */
|
||||
}
|
||||
|
||||
if (fec->xcv_type == SEVENWIRE) {
|
||||
/*
|
||||
* Set FEC-Lite transmit control register(X_CNTRL):
|
||||
*/
|
||||
/*fec->eth->x_cntrl = 0x00000002; */ /* half-duplex, heartbeat */
|
||||
fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
|
||||
} else {
|
||||
/*fec->eth->x_cntrl = 0x00000006; */ /* full-duplex, heartbeat */
|
||||
fec->eth->x_cntrl = 0x00000004; /* full-duplex, heartbeat disabled */
|
||||
|
||||
fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
/*
|
||||
* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
|
||||
* and do not drop the Preamble.
|
||||
@@ -485,7 +477,7 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
} while ((phyStatus & 0x0020) != 0x0020);
|
||||
} while (!(phyStatus & 0x0004));
|
||||
|
||||
#if (DEBUG & 0x2)
|
||||
printf("PHY auto neg complete! \n");
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* added 8260 masks by
|
||||
* Marius Groeger <mag@sysgo.de>
|
||||
*
|
||||
* added HiP7 (8270/8275/8280) processors support by
|
||||
* added HiP7 (824x/827x/8280) processors support by
|
||||
* Yuli Barcohen <yuli@arabellasw.com>
|
||||
*/
|
||||
|
||||
@@ -129,6 +129,10 @@ int checkcpu (void)
|
||||
case 0x0A01:
|
||||
puts ("0.1 1K49M");
|
||||
break;
|
||||
case 0x0C00:
|
||||
case 0x0D00:
|
||||
printf ("0.0 0K50M");
|
||||
break;
|
||||
default:
|
||||
printf ("unknown [immr=0x%04x,k=0x%04x]", m, k);
|
||||
break;
|
||||
|
||||
@@ -155,6 +155,7 @@ void cpu_init_f (volatile immap_t * immr)
|
||||
defined(CONFIG_MHPC) || \
|
||||
defined(CONFIG_PCU_E) || \
|
||||
defined(CONFIG_R360MPI) || \
|
||||
defined(CONFIG_RMU) || \
|
||||
defined(CONFIG_RPXCLASSIC) || \
|
||||
defined(CONFIG_RPXLITE) || \
|
||||
defined(CONFIG_SPD823TS)
|
||||
|
||||
757
cpu/mpc8xx/fec.c
757
cpu/mpc8xx/fec.c
@@ -29,13 +29,71 @@
|
||||
|
||||
#undef ET_DEBUG
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(FEC_ENET)
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && \
|
||||
(defined(FEC_ENET) || defined(CONFIG_ETHER_ON_FEC1) || defined(CONFIG_ETHER_ON_FEC2))
|
||||
|
||||
/* compatibility test, if only FEC_ENET defined assume ETHER on FEC1 */
|
||||
#if defined(FEC_ENET) && !defined(CONFIG_ETHER_ON_FEC1) && !defined(CONFIG_ETHER_ON_FEC2)
|
||||
#define CONFIG_ETHER_ON_FEC1 1
|
||||
#endif
|
||||
|
||||
/* define WANT_MII when MII support is required */
|
||||
#if defined(CFG_DISCOVER_PHY) || defined(CONFIG_FEC1_PHY) || defined(CONFIG_FEC2_PHY)
|
||||
#define WANT_MII
|
||||
#else
|
||||
#undef WANT_MII
|
||||
#endif
|
||||
|
||||
#if defined(WANT_MII)
|
||||
#include <miiphy.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RMII) && !defined(WANT_MII)
|
||||
#error RMII support is unusable without a working PHY.
|
||||
#endif
|
||||
|
||||
#ifdef CFG_DISCOVER_PHY
|
||||
#include <miiphy.h>
|
||||
static void mii_discover_phy(void);
|
||||
static int mii_discover_phy(struct eth_device *dev);
|
||||
#endif
|
||||
|
||||
static struct ether_fcc_info_s
|
||||
{
|
||||
int ether_index;
|
||||
int fecp_offset;
|
||||
int phy_addr;
|
||||
int actual_phy_addr;
|
||||
int initialized;
|
||||
}
|
||||
ether_fcc_info[] = {
|
||||
#if defined(CONFIG_ETHER_ON_FEC1)
|
||||
{
|
||||
0,
|
||||
offsetof(immap_t, im_cpm.cp_fec1),
|
||||
#if defined(CONFIG_FEC1_PHY)
|
||||
CONFIG_FEC1_PHY,
|
||||
#else
|
||||
-1, /* discover */
|
||||
#endif
|
||||
-1,
|
||||
0,
|
||||
|
||||
},
|
||||
#endif
|
||||
#if defined(CONFIG_ETHER_ON_FEC2)
|
||||
{
|
||||
1,
|
||||
offsetof(immap_t, im_cpm.cp_fec2),
|
||||
#if defined(CONFIG_FEC2_PHY)
|
||||
CONFIG_FEC2_PHY,
|
||||
#else
|
||||
-1,
|
||||
#endif
|
||||
-1,
|
||||
0,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Ethernet Transmit and Receive Buffers */
|
||||
#define DBUF_LENGTH 1520
|
||||
|
||||
@@ -47,8 +105,11 @@ static void mii_discover_phy(void);
|
||||
#define PKT_MINBUF_SIZE 64
|
||||
#define PKT_MAXBLR_SIZE 1520
|
||||
|
||||
|
||||
static char txbuf[DBUF_LENGTH];
|
||||
#ifdef __GNUC__
|
||||
static char txbuf[DBUF_LENGTH] __attribute__ ((aligned(8)));
|
||||
#else
|
||||
#error txbuf must be aligned.
|
||||
#endif
|
||||
|
||||
static uint rxIdx; /* index of the current RX buffer */
|
||||
static uint txIdx; /* index of the current TX buffer */
|
||||
@@ -74,28 +135,49 @@ static void fec_halt(struct eth_device* dev);
|
||||
int fec_initialize(bd_t *bis)
|
||||
{
|
||||
struct eth_device* dev;
|
||||
struct ether_fcc_info_s *efis;
|
||||
int i;
|
||||
|
||||
dev = (struct eth_device*) malloc(sizeof *dev);
|
||||
memset(dev, 0, sizeof *dev);
|
||||
for (i = 0; i < sizeof(ether_fcc_info) / sizeof(ether_fcc_info[0]); i++) {
|
||||
|
||||
sprintf(dev->name, "FEC ETHERNET");
|
||||
dev->iobase = 0;
|
||||
dev->priv = 0;
|
||||
dev->init = fec_init;
|
||||
dev->halt = fec_halt;
|
||||
dev->send = fec_send;
|
||||
dev->recv = fec_recv;
|
||||
dev = malloc(sizeof(*dev));
|
||||
if (dev == NULL)
|
||||
hang();
|
||||
|
||||
eth_register(dev);
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
|
||||
/* for FEC1 make sure that the name of the interface is the same
|
||||
as the old one for compatibility reasons */
|
||||
if (i == 0) {
|
||||
sprintf (dev->name, "FEC ETHERNET");
|
||||
} else {
|
||||
sprintf (dev->name, "FEC%d ETHERNET",
|
||||
ether_fcc_info[i].ether_index + 1);
|
||||
}
|
||||
|
||||
efis = ðer_fcc_info[i];
|
||||
|
||||
/*
|
||||
* reset actual phy addr
|
||||
*/
|
||||
efis->actual_phy_addr = -1;
|
||||
|
||||
dev->priv = efis;
|
||||
dev->init = fec_init;
|
||||
dev->halt = fec_halt;
|
||||
dev->send = fec_send;
|
||||
dev->recv = fec_recv;
|
||||
|
||||
eth_register(dev);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int fec_send(struct eth_device* dev, volatile void *packet, int length)
|
||||
{
|
||||
int j, rc;
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile fec_t *fecp = &(immr->im_cpm.cp_fec);
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
volatile fec_t *fecp = (volatile fec_t *)(CFG_IMMR + efis->fecp_offset);
|
||||
|
||||
/* section 16.9.23.3
|
||||
* Wait for ready
|
||||
@@ -142,50 +224,66 @@ static int fec_send(struct eth_device* dev, volatile void *packet, int length)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int fec_recv(struct eth_device* dev)
|
||||
static int fec_recv (struct eth_device *dev)
|
||||
{
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
volatile fec_t *fecp =
|
||||
(volatile fec_t *) (CFG_IMMR + efis->fecp_offset);
|
||||
int length;
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile fec_t *fecp = &(immr->im_cpm.cp_fec);
|
||||
|
||||
for (;;) {
|
||||
/* section 16.9.23.2 */
|
||||
if (rtx->rxbd[rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
|
||||
length = -1;
|
||||
break; /* nothing received - leave for() loop */
|
||||
}
|
||||
for (;;) {
|
||||
/* section 16.9.23.2 */
|
||||
if (rtx->rxbd[rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
|
||||
length = -1;
|
||||
break; /* nothing received - leave for() loop */
|
||||
}
|
||||
|
||||
length = rtx->rxbd[rxIdx].cbd_datlen;
|
||||
length = rtx->rxbd[rxIdx].cbd_datlen;
|
||||
|
||||
if (rtx->rxbd[rxIdx].cbd_sc & 0x003f) {
|
||||
if (rtx->rxbd[rxIdx].cbd_sc & 0x003f) {
|
||||
#ifdef ET_DEBUG
|
||||
printf("%s[%d] err: %x\n",
|
||||
__FUNCTION__,__LINE__,rtx->rxbd[rxIdx].cbd_sc);
|
||||
printf ("%s[%d] err: %x\n",
|
||||
__FUNCTION__, __LINE__,
|
||||
rtx->rxbd[rxIdx].cbd_sc);
|
||||
#endif
|
||||
} else {
|
||||
/* Pass the packet up to the protocol layers. */
|
||||
NetReceive(NetRxPackets[rxIdx], length - 4);
|
||||
} else {
|
||||
volatile uchar *rx = NetRxPackets[rxIdx];
|
||||
|
||||
length -= 4;
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_CDP)
|
||||
if ((rx[0] & 1) != 0
|
||||
&& memcmp ((uchar *) rx, NetBcastAddr, 6) != 0
|
||||
&& memcmp ((uchar *) rx, NetCDPAddr, 6) != 0)
|
||||
rx = NULL;
|
||||
#endif
|
||||
/*
|
||||
* Pass the packet up to the protocol layers.
|
||||
*/
|
||||
if (rx != NULL)
|
||||
NetReceive (rx, length);
|
||||
}
|
||||
|
||||
/* Give the buffer back to the FEC. */
|
||||
rtx->rxbd[rxIdx].cbd_datlen = 0;
|
||||
|
||||
/* wrap around buffer index when necessary */
|
||||
if ((rxIdx + 1) >= PKTBUFSRX) {
|
||||
rtx->rxbd[PKTBUFSRX - 1].cbd_sc =
|
||||
(BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
|
||||
rxIdx = 0;
|
||||
} else {
|
||||
rtx->rxbd[rxIdx].cbd_sc = BD_ENET_RX_EMPTY;
|
||||
rxIdx++;
|
||||
}
|
||||
|
||||
__asm__ ("eieio");
|
||||
|
||||
/* Try to fill Buffer Descriptors */
|
||||
fecp->fec_r_des_active = 0x01000000; /* Descriptor polling active */
|
||||
}
|
||||
|
||||
/* Give the buffer back to the FEC. */
|
||||
rtx->rxbd[rxIdx].cbd_datlen = 0;
|
||||
|
||||
/* wrap around buffer index when necessary */
|
||||
if ((rxIdx + 1) >= PKTBUFSRX) {
|
||||
rtx->rxbd[PKTBUFSRX - 1].cbd_sc = (BD_ENET_RX_WRAP | BD_ENET_RX_EMPTY);
|
||||
rxIdx = 0;
|
||||
} else {
|
||||
rtx->rxbd[rxIdx].cbd_sc = BD_ENET_RX_EMPTY;
|
||||
rxIdx++;
|
||||
}
|
||||
|
||||
__asm__ ("eieio");
|
||||
|
||||
/* Try to fill Buffer Descriptors */
|
||||
fecp->fec_r_des_active = 0x01000000; /* Descriptor polling active */
|
||||
}
|
||||
|
||||
return length;
|
||||
return length;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
@@ -210,34 +308,255 @@ static int fec_recv(struct eth_device* dev)
|
||||
|
||||
#define FEC_RESET_DELAY 50
|
||||
|
||||
static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
#if defined(CONFIG_RMII)
|
||||
|
||||
static inline void fec_10Mbps(struct eth_device *dev)
|
||||
{
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
int fecidx = efis->ether_index;
|
||||
uint mask = (fecidx == 0) ? 0x0000010 : 0x0000008;
|
||||
|
||||
int i;
|
||||
if ((unsigned int)fecidx >= 2)
|
||||
hang();
|
||||
|
||||
((volatile immap_t *)CFG_IMMR)->im_cpm.cp_cptr |= mask;
|
||||
}
|
||||
|
||||
static inline void fec_100Mbps(struct eth_device *dev)
|
||||
{
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
int fecidx = efis->ether_index;
|
||||
uint mask = (fecidx == 0) ? 0x0000010 : 0x0000008;
|
||||
|
||||
if ((unsigned int)fecidx >= 2)
|
||||
hang();
|
||||
|
||||
((volatile immap_t *)CFG_IMMR)->im_cpm.cp_cptr &= ~mask;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline void fec_full_duplex(struct eth_device *dev)
|
||||
{
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
volatile fec_t *fecp = (volatile fec_t *)(CFG_IMMR + efis->fecp_offset);
|
||||
|
||||
fecp->fec_r_cntrl &= ~FEC_RCNTRL_DRT;
|
||||
fecp->fec_x_cntrl |= FEC_TCNTRL_FDEN; /* FD enable */
|
||||
}
|
||||
|
||||
static inline void fec_half_duplex(struct eth_device *dev)
|
||||
{
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
volatile fec_t *fecp = (volatile fec_t *)(CFG_IMMR + efis->fecp_offset);
|
||||
|
||||
fecp->fec_r_cntrl |= FEC_RCNTRL_DRT;
|
||||
fecp->fec_x_cntrl &= ~FEC_TCNTRL_FDEN; /* FD disable */
|
||||
}
|
||||
|
||||
static void fec_pin_init(int fecidx)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
bd_t *bd = gd->bd;
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile fec_t *fecp = &(immr->im_cpm.cp_fec);
|
||||
volatile fec_t *fecp;
|
||||
|
||||
#if defined(CONFIG_FADS) /* FADS family uses FPGA (BCSR) to control PHYs */
|
||||
#if defined(CONFIG_DUET_ADS)
|
||||
*(vu_char *)BCSR5 &= ~(BCSR5_MII1_EN | BCSR5_MII1_RST);
|
||||
#else
|
||||
/* configure FADS for fast (FEC) ethernet, half-duplex */
|
||||
/* The LXT970 needs about 50ms to recover from reset, so
|
||||
* wait for it by discovering the PHY before leaving eth_init().
|
||||
/*
|
||||
* only two FECs please
|
||||
*/
|
||||
{
|
||||
volatile uint *bcsr4 = (volatile uint *) BCSR4;
|
||||
*bcsr4 = (*bcsr4 & ~(BCSR4_FETH_EN | BCSR4_FETHCFG1))
|
||||
| (BCSR4_FETHCFG0 | BCSR4_FETHFDE | BCSR4_FETHRST);
|
||||
if ((unsigned int)fecidx >= 2)
|
||||
hang();
|
||||
|
||||
if (fecidx == 0)
|
||||
fecp = &immr->im_cpm.cp_fec1;
|
||||
else
|
||||
fecp = &immr->im_cpm.cp_fec2;
|
||||
|
||||
/*
|
||||
* Set MII speed to 2.5 MHz or slightly below.
|
||||
* * According to the MPC860T (Rev. D) Fast ethernet controller user
|
||||
* * manual (6.2.14),
|
||||
* * the MII management interface clock must be less than or equal
|
||||
* * to 2.5 MHz.
|
||||
* * This MDC frequency is equal to system clock / (2 * MII_SPEED).
|
||||
* * Then MII_SPEED = system_clock / 2 * 2,5 Mhz.
|
||||
*/
|
||||
fecp->fec_mii_speed = ((bd->bi_intfreq + 4999999) / 5000000) << 1;
|
||||
|
||||
#if defined(CONFIG_NETTA) || defined(CONFIG_NETPHONE)
|
||||
/* our PHYs are the limit at 2.5 MHz */
|
||||
fecp->fec_mii_speed <<= 1;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DUET) && defined(WANT_MII)
|
||||
/* use MDC for MII */
|
||||
immr->im_ioport.iop_pdpar |= 0x0080;
|
||||
immr->im_ioport.iop_pddir &= ~0x0080;
|
||||
#endif
|
||||
|
||||
if (fecidx == 0) {
|
||||
#if defined(CONFIG_ETHER_ON_FEC1)
|
||||
|
||||
#if defined(CONFIG_DUET) /* MPC87x/88x have got 2 FECs and different pinout */
|
||||
|
||||
#if !defined(CONFIG_RMII)
|
||||
|
||||
immr->im_ioport.iop_papar |= 0xf830;
|
||||
immr->im_ioport.iop_padir |= 0x0830;
|
||||
immr->im_ioport.iop_padir &= ~0xf000;
|
||||
|
||||
immr->im_cpm.cp_pbpar |= 0x00001001;
|
||||
immr->im_cpm.cp_pbdir &= ~0x00001001;
|
||||
|
||||
immr->im_ioport.iop_pcpar |= 0x000c;
|
||||
immr->im_ioport.iop_pcdir &= ~0x000c;
|
||||
|
||||
immr->im_cpm.cp_pepar |= 0x00000003;
|
||||
immr->im_cpm.cp_pedir |= 0x00000003;
|
||||
immr->im_cpm.cp_peso &= ~0x00000003;
|
||||
|
||||
immr->im_cpm.cp_cptr &= ~0x00000100;
|
||||
|
||||
#else
|
||||
|
||||
#if !defined(CONFIG_FEC1_PHY_NORXERR)
|
||||
immr->im_ioport.iop_papar |= 0x1000;
|
||||
immr->im_ioport.iop_padir &= ~0x1000;
|
||||
#endif
|
||||
immr->im_ioport.iop_papar |= 0xe810;
|
||||
immr->im_ioport.iop_padir |= 0x0810;
|
||||
immr->im_ioport.iop_padir &= ~0xe000;
|
||||
|
||||
immr->im_cpm.cp_pbpar |= 0x00000001;
|
||||
immr->im_cpm.cp_pbdir &= ~0x00000001;
|
||||
|
||||
immr->im_cpm.cp_cptr |= 0x00000100;
|
||||
immr->im_cpm.cp_cptr &= ~0x00000050;
|
||||
|
||||
#endif /* !CONFIG_RMII */
|
||||
|
||||
#elif !defined(CONFIG_ICU862) && !defined(CONFIG_IAD210)
|
||||
/*
|
||||
* Configure all of port D for MII.
|
||||
*/
|
||||
immr->im_ioport.iop_pdpar = 0x1fff;
|
||||
|
||||
/*
|
||||
* Bits moved from Rev. D onward
|
||||
*/
|
||||
if ((get_immr(0) & 0xffff) < 0x0501)
|
||||
immr->im_ioport.iop_pddir = 0x1c58; /* Pre rev. D */
|
||||
else
|
||||
immr->im_ioport.iop_pddir = 0x1fff; /* Rev. D and later */
|
||||
#else
|
||||
/*
|
||||
* Configure port A for MII.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ICU862) && defined(CFG_DISCOVER_PHY)
|
||||
|
||||
/*
|
||||
* On the ICU862 board the MII-MDC pin is routed to PD8 pin
|
||||
* * of CPU, so for this board we need to configure Utopia and
|
||||
* * enable PD8 to MII-MDC function
|
||||
*/
|
||||
immr->im_ioport.iop_pdpar |= 0x4080;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Has Utopia been configured?
|
||||
*/
|
||||
if (immr->im_ioport.iop_pdpar & (0x8000 >> 1)) {
|
||||
/*
|
||||
* YES - Use MUXED mode for UTOPIA bus.
|
||||
* This frees Port A for use by MII (see 862UM table 41-6).
|
||||
*/
|
||||
immr->im_ioport.utmode &= ~0x80;
|
||||
} else {
|
||||
/*
|
||||
* NO - set SPLIT mode for UTOPIA bus.
|
||||
*
|
||||
* This doesn't really effect UTOPIA (which isn't
|
||||
* enabled anyway) but just tells the 862
|
||||
* to use port A for MII (see 862UM table 41-6).
|
||||
*/
|
||||
immr->im_ioport.utmode |= 0x80;
|
||||
}
|
||||
#endif /* !defined(CONFIG_ICU862) */
|
||||
|
||||
#endif /* CONFIG_ETHER_ON_FEC1 */
|
||||
} else if (fecidx == 1) {
|
||||
|
||||
#if defined(CONFIG_ETHER_ON_FEC2)
|
||||
|
||||
#if defined(CONFIG_DUET) /* MPC87x/88x have got 2 FECs and different pinout */
|
||||
|
||||
#if !defined(CONFIG_RMII)
|
||||
|
||||
#warning this configuration is not tested; please report if it works
|
||||
immr->im_cpm.cp_pepar |= 0x0003fffc;
|
||||
immr->im_cpm.cp_pedir |= 0x0003fffc;
|
||||
immr->im_cpm.cp_peso &= ~0x000087fc;
|
||||
immr->im_cpm.cp_peso |= 0x00037800;
|
||||
|
||||
immr->im_cpm.cp_cptr &= ~0x00000080;
|
||||
#else
|
||||
|
||||
#if !defined(CONFIG_FEC2_PHY_NORXERR)
|
||||
immr->im_cpm.cp_pepar |= 0x00000010;
|
||||
immr->im_cpm.cp_pedir |= 0x00000010;
|
||||
immr->im_cpm.cp_peso &= ~0x00000010;
|
||||
#endif
|
||||
immr->im_cpm.cp_pepar |= 0x00039620;
|
||||
immr->im_cpm.cp_pedir |= 0x00039620;
|
||||
immr->im_cpm.cp_peso |= 0x00031000;
|
||||
immr->im_cpm.cp_peso &= ~0x00008620;
|
||||
|
||||
immr->im_cpm.cp_cptr |= 0x00000080;
|
||||
immr->im_cpm.cp_cptr &= ~0x00000028;
|
||||
#endif /* CONFIG_RMII */
|
||||
|
||||
#endif /* CONFIG_DUET */
|
||||
|
||||
#endif /* CONFIG_ETHER_ON_FEC2 */
|
||||
|
||||
/* reset the LXT970 PHY */
|
||||
*bcsr4 &= ~BCSR4_FETHRST;
|
||||
udelay (10);
|
||||
*bcsr4 |= BCSR4_FETHRST;
|
||||
udelay (10);
|
||||
}
|
||||
}
|
||||
|
||||
static int fec_init (struct eth_device *dev, bd_t * bd)
|
||||
{
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile fec_t *fecp =
|
||||
(volatile fec_t *) (CFG_IMMR + efis->fecp_offset);
|
||||
int i;
|
||||
|
||||
if (efis->ether_index == 0) {
|
||||
#if defined(CONFIG_FADS) /* FADS family uses FPGA (BCSR) to control PHYs */
|
||||
#if defined(CONFIG_DUET_ADS)
|
||||
*(vu_char *) BCSR5 &= ~(BCSR5_MII1_EN | BCSR5_MII1_RST);
|
||||
#else
|
||||
/* configure FADS for fast (FEC) ethernet, half-duplex */
|
||||
/* The LXT970 needs about 50ms to recover from reset, so
|
||||
* wait for it by discovering the PHY before leaving eth_init().
|
||||
*/
|
||||
{
|
||||
volatile uint *bcsr4 = (volatile uint *) BCSR4;
|
||||
|
||||
*bcsr4 = (*bcsr4 & ~(BCSR4_FETH_EN | BCSR4_FETHCFG1))
|
||||
| (BCSR4_FETHCFG0 | BCSR4_FETHFDE |
|
||||
BCSR4_FETHRST);
|
||||
|
||||
/* reset the LXT970 PHY */
|
||||
*bcsr4 &= ~BCSR4_FETHRST;
|
||||
udelay (10);
|
||||
*bcsr4 |= BCSR4_FETHRST;
|
||||
udelay (10);
|
||||
}
|
||||
#endif /* CONFIG_DUET_ADS */
|
||||
#endif /* CONFIG_FADS */
|
||||
}
|
||||
|
||||
/* Whack a reset.
|
||||
* A delay is required between a reset of the FEC block and
|
||||
* initialization of other FEC registers because the reset takes
|
||||
@@ -269,15 +588,22 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
/* Set station address
|
||||
*/
|
||||
#define ea eth_get_dev()->enetaddr
|
||||
fecp->fec_addr_low = (ea[0] << 24) | (ea[1] << 16) |
|
||||
(ea[2] << 8) | (ea[3] ) ;
|
||||
fecp->fec_addr_high = (ea[4] << 8) | (ea[5] ) ;
|
||||
fecp->fec_addr_low = (ea[0] << 24) | (ea[1] << 16) | (ea[2] << 8) | (ea[3]);
|
||||
fecp->fec_addr_high = (ea[4] << 8) | (ea[5]);
|
||||
#undef ea
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_CDP)
|
||||
/*
|
||||
* Turn on multicast address hash table
|
||||
*/
|
||||
fecp->fec_hash_table_high = 0xffffffff;
|
||||
fecp->fec_hash_table_low = 0xffffffff;
|
||||
#else
|
||||
/* Clear multicast address hash table
|
||||
*/
|
||||
fecp->fec_hash_table_high = 0;
|
||||
fecp->fec_hash_table_low = 0;
|
||||
fecp->fec_hash_table_low = 0;
|
||||
#endif
|
||||
|
||||
/* Set maximum receive buffer size.
|
||||
*/
|
||||
@@ -295,9 +621,10 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
|
||||
if (!rtx) {
|
||||
#ifdef CFG_ALLOC_DPRAM
|
||||
rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + dpram_alloc_align(sizeof(RTXBD),8));
|
||||
rtx = (RTXBD *) (immr->im_cpm.cp_dpmem +
|
||||
dpram_alloc_align (sizeof (RTXBD), 8));
|
||||
#else
|
||||
rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_FEC_BASE);
|
||||
rtx = (RTXBD *) (immr->im_cpm.cp_dpmem + CPM_FEC_BASE);
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
@@ -306,8 +633,8 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
* Empty, Wrap
|
||||
*/
|
||||
for (i = 0; i < PKTBUFSRX; i++) {
|
||||
rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
|
||||
rtx->rxbd[i].cbd_datlen = 0; /* Reset */
|
||||
rtx->rxbd[i].cbd_sc = BD_ENET_RX_EMPTY;
|
||||
rtx->rxbd[i].cbd_datlen = 0; /* Reset */
|
||||
rtx->rxbd[i].cbd_bufaddr = (uint) NetRxPackets[i];
|
||||
}
|
||||
rtx->rxbd[PKTBUFSRX - 1].cbd_sc |= BD_ENET_RX_WRAP;
|
||||
@@ -318,8 +645,8 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
* Last, Tx CRC
|
||||
*/
|
||||
for (i = 0; i < TX_BUF_CNT; i++) {
|
||||
rtx->txbd[i].cbd_sc = BD_ENET_TX_LAST | BD_ENET_TX_TC;
|
||||
rtx->txbd[i].cbd_datlen = 0; /* Reset */
|
||||
rtx->txbd[i].cbd_sc = BD_ENET_TX_LAST | BD_ENET_TX_TC;
|
||||
rtx->txbd[i].cbd_datlen = 0; /* Reset */
|
||||
rtx->txbd[i].cbd_bufaddr = (uint) (&txbuf[0]);
|
||||
}
|
||||
rtx->txbd[TX_BUF_CNT - 1].cbd_sc |= BD_ENET_TX_WRAP;
|
||||
@@ -331,10 +658,10 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
|
||||
/* Enable MII mode
|
||||
*/
|
||||
#if 0 /* Full duplex mode */
|
||||
#if 0 /* Full duplex mode */
|
||||
fecp->fec_r_cntrl = FEC_RCNTRL_MII_MODE;
|
||||
fecp->fec_x_cntrl = FEC_TCNTRL_FDEN;
|
||||
#else /* Half duplex mode */
|
||||
#else /* Half duplex mode */
|
||||
fecp->fec_r_cntrl = FEC_RCNTRL_MII_MODE | FEC_RCNTRL_DRT;
|
||||
fecp->fec_x_cntrl = 0;
|
||||
#endif
|
||||
@@ -343,86 +670,69 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
*/
|
||||
fecp->fec_fun_code = 0x78000000;
|
||||
|
||||
/* Set MII speed to 2.5 MHz or slightly below.
|
||||
* According to the MPC860T (Rev. D) Fast ethernet controller user
|
||||
* manual (6.2.14),
|
||||
* the MII management interface clock must be less than or equal
|
||||
* to 2.5 MHz.
|
||||
* This MDC frequency is equal to system clock / (2 * MII_SPEED).
|
||||
* Then MII_SPEED = system_clock / 2 * 2,5 Mhz.
|
||||
/*
|
||||
* Setup the pin configuration of the FEC
|
||||
*/
|
||||
fecp->fec_mii_speed = ((bd->bi_intfreq + 4999999) / 5000000) << 1;
|
||||
|
||||
#if defined(CONFIG_DUET) /* MPC87x/88x have got 2 FECs and different pinout */
|
||||
immr->im_ioport.iop_papar |= 0xf830;
|
||||
immr->im_ioport.iop_padir |= 0x0830;
|
||||
immr->im_ioport.iop_padir &= ~0xf000;
|
||||
immr->im_cpm.cp_pbpar |= 0x00001001;
|
||||
immr->im_cpm.cp_pbdir &= ~0x00001001;
|
||||
immr->im_ioport.iop_pcpar |= 0x000c;
|
||||
immr->im_ioport.iop_pcdir &= ~0x000c;
|
||||
immr->im_ioport.iop_pdpar |= 0x0080;
|
||||
immr->im_ioport.iop_pddir &= ~0x0080;
|
||||
immr->im_cpm.cp_pepar |= 0x00000003;
|
||||
immr->im_cpm.cp_pedir |= 0x00000003;
|
||||
immr->im_cpm.cp_peso &= ~0x00000003;
|
||||
#elif !defined(CONFIG_ICU862) && !defined(CONFIG_IAD210)
|
||||
/* Configure all of port D for MII.
|
||||
*/
|
||||
immr->im_ioport.iop_pdpar = 0x1fff;
|
||||
|
||||
/* Bits moved from Rev. D onward */
|
||||
if ((get_immr (0) & 0xffff) < 0x0501) {
|
||||
immr->im_ioport.iop_pddir = 0x1c58; /* Pre rev. D */
|
||||
} else {
|
||||
immr->im_ioport.iop_pddir = 0x1fff; /* Rev. D and later */
|
||||
}
|
||||
#else
|
||||
/* Configure port A for MII.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ICU862) && defined(CFG_DISCOVER_PHY)
|
||||
|
||||
/* On the ICU862 board the MII-MDC pin is routed to PD8 pin
|
||||
* of CPU, so for this board we need to configure Utopia and
|
||||
* enable PD8 to MII-MDC function */
|
||||
immr->im_ioport.iop_pdpar |= 0x4080;
|
||||
#endif
|
||||
|
||||
/* Has Utopia been configured? */
|
||||
if (immr->im_ioport.iop_pdpar & (0x8000 >> 1)) {
|
||||
/*
|
||||
* YES - Use MUXED mode for UTOPIA bus.
|
||||
* This frees Port A for use by MII (see 862UM table 41-6).
|
||||
*/
|
||||
immr->im_ioport.utmode &= ~0x80;
|
||||
} else {
|
||||
/*
|
||||
* NO - set SPLIT mode for UTOPIA bus.
|
||||
*
|
||||
* This doesn't really effect UTOPIA (which isn't
|
||||
* enabled anyway) but just tells the 862
|
||||
* to use port A for MII (see 862UM table 41-6).
|
||||
*/
|
||||
immr->im_ioport.utmode |= 0x80;
|
||||
}
|
||||
#endif /* !defined(CONFIG_ICU862) */
|
||||
fec_pin_init (efis->ether_index);
|
||||
|
||||
rxIdx = 0;
|
||||
txIdx = 0;
|
||||
|
||||
/* Now enable the transmit and receive processing
|
||||
/*
|
||||
* Now enable the transmit and receive processing
|
||||
*/
|
||||
fecp->fec_ecntrl = FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN;
|
||||
|
||||
if (efis->phy_addr == -1) {
|
||||
#ifdef CFG_DISCOVER_PHY
|
||||
/* wait for the PHY to wake up after reset
|
||||
/*
|
||||
* wait for the PHY to wake up after reset
|
||||
*/
|
||||
efis->actual_phy_addr = mii_discover_phy (dev);
|
||||
#else
|
||||
efis->actual_phy_addr = -1;
|
||||
#endif
|
||||
if (efis->actual_phy_addr == -1) {
|
||||
printf ("Unable to discover phy!\n");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
efis->actual_phy_addr = efis->phy_addr;
|
||||
}
|
||||
#if defined(CONFIG_MII) && defined(CONFIG_RMII)
|
||||
|
||||
/* the MII interface is connected to FEC1
|
||||
* so for the miiphy_xxx function to work we must
|
||||
* call mii_init since fec_halt messes the thing up
|
||||
*/
|
||||
mii_discover_phy();
|
||||
if (efis->ether_index != 0)
|
||||
mii_init();
|
||||
|
||||
/*
|
||||
* adapt the RMII speed to the speed of the phy
|
||||
*/
|
||||
if (miiphy_speed (efis->actual_phy_addr) == _100BASET) {
|
||||
fec_100Mbps (dev);
|
||||
} else {
|
||||
fec_10Mbps (dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MII)
|
||||
/*
|
||||
* adapt to the half/full speed settings
|
||||
*/
|
||||
if (miiphy_duplex (efis->actual_phy_addr) == FULL) {
|
||||
fec_full_duplex (dev);
|
||||
} else {
|
||||
fec_half_duplex (dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* And last, try to fill Rx Buffer Descriptors */
|
||||
fecp->fec_r_des_active = 0x01000000; /* Descriptor polling active */
|
||||
fecp->fec_r_des_active = 0x01000000; /* Descriptor polling active */
|
||||
|
||||
efis->initialized = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -430,24 +740,37 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
|
||||
static void fec_halt(struct eth_device* dev)
|
||||
{
|
||||
#if 0
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
|
||||
#endif
|
||||
struct ether_fcc_info_s *efis = dev->priv;
|
||||
volatile fec_t *fecp = (volatile fec_t *)(CFG_IMMR + efis->fecp_offset);
|
||||
int i;
|
||||
|
||||
/* avoid halt if initialized; mii gets stuck otherwise */
|
||||
if (!efis->initialized)
|
||||
return;
|
||||
|
||||
/* Whack a reset.
|
||||
* A delay is required between a reset of the FEC block and
|
||||
* initialization of other FEC registers because the reset takes
|
||||
* some time to complete. If you don't delay, subsequent writes
|
||||
* to FEC registers might get killed by the reset routine which is
|
||||
* still in progress.
|
||||
*/
|
||||
|
||||
fecp->fec_ecntrl = FEC_ECNTRL_PINMUX | FEC_ECNTRL_RESET;
|
||||
for (i = 0;
|
||||
(fecp->fec_ecntrl & FEC_ECNTRL_RESET) && (i < FEC_RESET_DELAY);
|
||||
++i) {
|
||||
udelay (1);
|
||||
}
|
||||
if (i == FEC_RESET_DELAY) {
|
||||
printf ("FEC_RESET_DELAY timeout\n");
|
||||
return;
|
||||
}
|
||||
|
||||
efis->initialized = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void restart(void)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
immr->im_cpm.cp_scc[SCC_ENET].scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CFG_DISCOVER_PHY) || (CONFIG_COMMANDS & CFG_CMD_MII)
|
||||
|
||||
static int phyaddr = -1; /* didn't find a PHY yet */
|
||||
static uint phytype;
|
||||
#if defined(CFG_DISCOVER_PHY) || defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
|
||||
|
||||
/* Make MII read/write commands for the FEC.
|
||||
*/
|
||||
@@ -489,14 +812,20 @@ mii_send(uint mii_cmd)
|
||||
{
|
||||
uint mii_reply;
|
||||
volatile fec_t *ep;
|
||||
int cnt;
|
||||
|
||||
ep = &(((immap_t *)CFG_IMMR)->im_cpm.cp_fec);
|
||||
|
||||
ep->fec_mii_data = mii_cmd; /* command to phy */
|
||||
|
||||
/* wait for mii complete */
|
||||
while (!(ep->fec_ievent & FEC_ENET_MII))
|
||||
; /* spin until done */
|
||||
cnt = 0;
|
||||
while (!(ep->fec_ievent & FEC_ENET_MII)) {
|
||||
if (++cnt > 1000) {
|
||||
printf("mii_send STUCK!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
mii_reply = ep->fec_mii_data; /* result from phy */
|
||||
ep->fec_ievent = FEC_ENET_MII; /* clear MII complete */
|
||||
#if 0
|
||||
@@ -508,12 +837,13 @@ mii_send(uint mii_cmd)
|
||||
#endif /* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CFG_CMD_MII) */
|
||||
|
||||
#if defined(CFG_DISCOVER_PHY)
|
||||
static void
|
||||
mii_discover_phy(void)
|
||||
static int mii_discover_phy(struct eth_device *dev)
|
||||
{
|
||||
#define MAX_PHY_PASSES 11
|
||||
uint phyno;
|
||||
int pass;
|
||||
uint phytype;
|
||||
int phyaddr;
|
||||
|
||||
phyaddr = -1; /* didn't find a PHY yet */
|
||||
for (pass = 1; pass <= MAX_PHY_PASSES && phyaddr < 0; ++pass) {
|
||||
@@ -571,12 +901,11 @@ mii_discover_phy(void)
|
||||
if (phyaddr < 0) {
|
||||
printf("No PHY device found.\n");
|
||||
}
|
||||
return phyaddr;
|
||||
}
|
||||
#endif /* CFG_DISCOVER_PHY */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_MII) && !defined(CONFIG_BITBANGMII)
|
||||
|
||||
static int mii_init_done = 0;
|
||||
#if (defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)) && !defined(CONFIG_BITBANGMII)
|
||||
|
||||
/****************************************************************************
|
||||
* mii_init -- Initialize the MII for MII command without ethernet
|
||||
@@ -585,16 +914,11 @@ static int mii_init_done = 0;
|
||||
*/
|
||||
void mii_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
bd_t *bd = gd->bd;
|
||||
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile fec_t *fecp = &(immr->im_cpm.cp_fec);
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
if (mii_init_done != 0) {
|
||||
return;
|
||||
}
|
||||
for (j = 0; j < sizeof(ether_fcc_info) / sizeof(ether_fcc_info[0]); j++) {
|
||||
|
||||
/* Whack a reset.
|
||||
* A delay is required between a reset of the FEC block and
|
||||
@@ -623,76 +947,16 @@ void mii_init (void)
|
||||
*/
|
||||
fecp->fec_ievent = 0xffc0;
|
||||
|
||||
/* Set MII speed to 2.5 MHz or slightly below.
|
||||
* According to the MPC860T (Rev. D) Fast ethernet controller user
|
||||
* manual (6.2.14),
|
||||
* the MII management interface clock must be less than or equal
|
||||
* to 2.5 MHz.
|
||||
* This MDC frequency is equal to system clock / (2 * MII_SPEED).
|
||||
* Then MII_SPEED = system_clock / 2 * 2,5 Mhz.
|
||||
*/
|
||||
fecp->fec_mii_speed = ((bd->bi_intfreq + 4999999) / 5000000) << 1;
|
||||
|
||||
#if defined(CONFIG_DUET) /* MPC87x/88x have got 2 FECs and different pinout */
|
||||
immr->im_ioport.iop_papar |= 0xf830;
|
||||
immr->im_ioport.iop_padir |= 0x0830;
|
||||
immr->im_ioport.iop_padir &= ~0xf000;
|
||||
immr->im_cpm.cp_pbpar |= 0x00001001;
|
||||
immr->im_cpm.cp_pbdir &= ~0x00001001;
|
||||
immr->im_ioport.iop_pcpar |= 0x000c;
|
||||
immr->im_ioport.iop_pcdir &= ~0x000c;
|
||||
immr->im_ioport.iop_pdpar |= 0x0080;
|
||||
immr->im_ioport.iop_pddir &= ~0x0080;
|
||||
immr->im_cpm.cp_pepar |= 0x00000003;
|
||||
immr->im_cpm.cp_pedir |= 0x00000003;
|
||||
immr->im_cpm.cp_peso &= ~0x00000003;
|
||||
#elif !defined(CONFIG_ICU862) && !defined(CONFIG_IAD210)
|
||||
/* Configure all of port D for MII.
|
||||
*/
|
||||
immr->im_ioport.iop_pdpar = 0x1fff;
|
||||
|
||||
/* Bits moved from Rev. D onward */
|
||||
if ((get_immr (0) & 0xffff) < 0x0501) {
|
||||
immr->im_ioport.iop_pddir = 0x1c58; /* Pre rev. D */
|
||||
} else {
|
||||
immr->im_ioport.iop_pddir = 0x1fff; /* Rev. D and later */
|
||||
}
|
||||
#else
|
||||
/* Configure port A for MII.
|
||||
/* Setup the pin configuration of the FEC(s)
|
||||
*/
|
||||
fec_pin_init(ether_fcc_info[i].ether_index);
|
||||
|
||||
#if defined(CONFIG_ICU862)
|
||||
|
||||
/* On the ICU862 board the MII-MDC pin is routed to PD8 pin
|
||||
* of CPU, so for this board we need to configure Utopia and
|
||||
* enable PD8 to MII-MDC function */
|
||||
immr->im_ioport.iop_pdpar |= 0x4080;
|
||||
#endif
|
||||
|
||||
/* Has Utopia been configured? */
|
||||
if (immr->im_ioport.iop_pdpar & (0x8000 >> 1)) {
|
||||
/*
|
||||
* YES - Use MUXED mode for UTOPIA bus.
|
||||
* This frees Port A for use by MII (see 862UM table 41-6).
|
||||
*/
|
||||
immr->im_ioport.utmode &= ~0x80;
|
||||
} else {
|
||||
/*
|
||||
* NO - set SPLIT mode for UTOPIA bus.
|
||||
*
|
||||
* This doesn't really effect UTOPIA (which isn't
|
||||
* enabled anyway) but just tells the 862
|
||||
* to use port A for MII (see 862UM table 41-6).
|
||||
*/
|
||||
immr->im_ioport.utmode |= 0x80;
|
||||
}
|
||||
#endif /* !defined(CONFIG_ICU862) */
|
||||
/* Now enable the transmit and receive processing
|
||||
*/
|
||||
fecp->fec_ecntrl = FEC_ECNTRL_PINMUX | FEC_ECNTRL_ETHER_EN;
|
||||
|
||||
mii_init_done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Read and write a MII PHY register, routines used by MII Utilities
|
||||
*
|
||||
@@ -714,28 +978,23 @@ int miiphy_read(unsigned char addr, unsigned char reg, unsigned short *value)
|
||||
rdreg = mii_send(mk_mii_read(addr, reg));
|
||||
|
||||
*value = rdreg;
|
||||
|
||||
#ifdef MII_DEBUG
|
||||
printf ("0x%04x\n", *value);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int miiphy_write(unsigned char addr, unsigned char reg, unsigned short value)
|
||||
{
|
||||
short rdreg; /* register working value */
|
||||
|
||||
#ifdef MII_DEBUG
|
||||
printf ("miiphy_write(0x%x) @ 0x%x = ", reg, addr);
|
||||
#endif
|
||||
|
||||
rdreg = mii_send(mk_mii_write(addr, reg, value));
|
||||
|
||||
#ifdef MII_DEBUG
|
||||
printf ("0x%04x\n", value);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_MII) && !defined(CONFIG_BITBANGMII)*/
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
*
|
||||
* The processor starts at 0x00000100 and the code is executed
|
||||
* from flash. The code is organized to be at an other address
|
||||
* in memory, but as long we don't jump around before relocating.
|
||||
* in memory, but as long we don't jump around before relocating,
|
||||
* board_init lies at a quite high address and when the cpu has
|
||||
* jumped there, everything is ok.
|
||||
* This works because the cpu gives the FLASH (CS0) the whole
|
||||
* address space at startup, and board_init lies as a echo of
|
||||
* the flash somewhere up there in the memorymap.
|
||||
* the flash somewhere up there in the memory map.
|
||||
*
|
||||
* board_init will change CS0 to be positioned at the correct
|
||||
* address and (s)dram will be positioned at address 0
|
||||
|
||||
10
disk/part.c
10
disk/part.c
@@ -87,12 +87,8 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
if ((dev_desc->lba * dev_desc->blksz)>0L) {
|
||||
ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem;
|
||||
lbaint_t lba;
|
||||
#ifdef CONFIG_LBA48
|
||||
if (dev_desc->lba48support)
|
||||
lba = dev_desc->lba48;
|
||||
else
|
||||
#endif
|
||||
lba = dev_desc->lba;
|
||||
|
||||
lba = dev_desc->lba;
|
||||
|
||||
lba512 = (lba * (dev_desc->blksz/512));
|
||||
mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */
|
||||
@@ -104,7 +100,7 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
gb_quot = gb / 10;
|
||||
gb_rem = gb - (10 * gb_quot);
|
||||
#ifdef CONFIG_LBA48
|
||||
if (dev_desc->lba48support)
|
||||
if (dev_desc->lba48)
|
||||
printf (" Supports 48-bit addressing\n");
|
||||
#endif
|
||||
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
|
||||
|
||||
10
doc/README.IceCube
Normal file
10
doc/README.IceCube
Normal file
@@ -0,0 +1,10 @@
|
||||
---------------------------------------------------------------------------
|
||||
Build target Flash address | BDI "go" command | Reset Vector
|
||||
---------------------------------------------------------------------------
|
||||
MPC5200LITE 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
MPC5200LITE_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
MPC5200LITE_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200_DDR 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
icecube_5200_DDR_LOWBOOT 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200_DDR_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
---------------------------------------------------------------------------
|
||||
24
doc/README.JFFS2_NAND
Normal file
24
doc/README.JFFS2_NAND
Normal file
@@ -0,0 +1,24 @@
|
||||
JFFS2 NAND support:
|
||||
|
||||
To ebable, use the following #define in the board configuration file:
|
||||
|
||||
#define CONFIG_JFFS2_NAND 1
|
||||
|
||||
Configuration of partitions is similar to how this is done in U-Boot
|
||||
for JFFS2 on top NOR flash. If a single parition is used, it can be
|
||||
configured using the following #defines in the configuration file:
|
||||
|
||||
#define CONFIG_JFFS2_NAND_DEV 0 /* nand device jffs2 lives on */
|
||||
#define CONFIG_JFFS2_NAND_OFF 0 /* start of jffs2 partition */
|
||||
#define CONFIG_JFFS2_NAND_SIZE 2*1024*1024 /* size of jffs2 partition */
|
||||
|
||||
If more than a single partition is desired, the user can define a
|
||||
CFG_JFFS_CUSTOM_PART macro and implement a
|
||||
|
||||
struct part_info* jffs2_part_info(int part_num)
|
||||
|
||||
function in a board-specific module. An example of such function is
|
||||
available in common/cmd_jffs2.c
|
||||
|
||||
The default configuration for the DAVE board has a single JFFS2
|
||||
partition of 2 MB size.
|
||||
48
doc/README.PXA_CF
Normal file
48
doc/README.PXA_CF
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
These are brief instructions on how to add support for CF adapters to
|
||||
custom designed PXA boards. You need to set the parameters in the
|
||||
config file. This should work for most implementations especially if you
|
||||
follow the connections of the standard lubbock. Anyway just the block
|
||||
marked memory configuration should be touched since the other parameters
|
||||
are imposed by the PXA architecture.
|
||||
|
||||
#define CONFIG_PXA_PCMCIA 1
|
||||
#define CONFIG_PXA_IDE 1
|
||||
|
||||
#define CONFIG_PCMCIA_SLOT_A 1
|
||||
/* just to keep build system happy */
|
||||
|
||||
#define CFG_PCMCIA_MEM_ADDR 0x28000000
|
||||
#define CFG_PCMCIA_MEM_SIZE 0x10000000
|
||||
|
||||
#define CFG_MECR_VAL 0x00000000
|
||||
#define CFG_MCMEM0_VAL 0x00004204
|
||||
#define CFG_MCMEM1_VAL 0x00000000
|
||||
#define CFG_MCATT0_VAL 0x00010504
|
||||
#define CFG_MCATT1_VAL 0x00000000
|
||||
#define CFG_MCIO0_VAL 0x00008407
|
||||
#define CFG_MCIO1_VAL 0x00000000
|
||||
/* memory configuration */
|
||||
|
||||
#define CFG_IDE_MAXBUS 1
|
||||
/* max. 1 IDE bus */
|
||||
#define CFG_IDE_MAXDEVICE 1
|
||||
/* max. 1 drive per IDE bus */
|
||||
|
||||
#define CFG_ATA_IDE0_OFFSET 0x0000
|
||||
|
||||
#define CFG_ATA_BASE_ADDR 0x20000000
|
||||
|
||||
/* Offset for data I/O */
|
||||
#define CFG_ATA_DATA_OFFSET 0x1f0
|
||||
|
||||
/* Offset for normal register accesses */
|
||||
#define CFG_ATA_REG_OFFSET 0x1f0
|
||||
|
||||
/* Offset for alternate registers */
|
||||
#define CFG_ATA_ALT_OFFSET 0x3f0
|
||||
|
||||
|
||||
Another important point is that maybe you have to power the pcmcia
|
||||
subsystem. This is very board specific, for an example on how to
|
||||
do it please search for CONFIG_EXADRON1 in cmd_pcmcia.c
|
||||
15
doc/README.VLAN
Normal file
15
doc/README.VLAN
Normal file
@@ -0,0 +1,15 @@
|
||||
U-Boot has networking support for VLANs (802.1q), and CDP (Cisco
|
||||
Discovery Protocol).
|
||||
|
||||
You control the sending/receiving of VLAN tagged packets with the
|
||||
"vlan" environmental variable. When not present no tagging is
|
||||
performed.
|
||||
|
||||
CDP is used mainly to discover your device VLAN(s) when connected to
|
||||
a Cisco switch.
|
||||
|
||||
Note: In order to enable CDP support a small change is needed in the
|
||||
networking driver. You have to enable reception of the
|
||||
01:00:0c:cc:cc:cc MAC address which is a multicast address.
|
||||
|
||||
Various defines control CDP; see the README section.
|
||||
@@ -38,7 +38,7 @@ OBJS = 3c589.o 5701rls.o ali512x.o \
|
||||
pcnet.o plb2800_eth.o \
|
||||
ps2ser.o ps2mult.o pc_keyb.o keyboard.o \
|
||||
rtl8019.o rtl8139.o \
|
||||
s3c24x0_i2c.o sed13806.o \
|
||||
s3c24x0_i2c.o sed13806.o sed156x.o \
|
||||
serial.o serial_max3100.o serial_pl011.o serial_pl010.o \
|
||||
smc91111.o smiLynxEM.o status_led.o sym53c8xx.o \
|
||||
ti_pci1410a.o tigon3.o w83c553f.o omap1510_i2c.o \
|
||||
|
||||
566
drivers/sed156x.c
Normal file
566
drivers/sed156x.c
Normal file
@@ -0,0 +1,566 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
*
|
||||
* Pantelis Antoniou <panto@intracom.gr>
|
||||
* Intracom S.A.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
#include <sed156x.h>
|
||||
|
||||
#ifdef CONFIG_SED156X
|
||||
|
||||
/* configure according to the selected display */
|
||||
#if defined(CONFIG_SED156X_PG12864Q)
|
||||
#define LCD_WIDTH 128
|
||||
#define LCD_HEIGHT 64
|
||||
#define LCD_LINES 64
|
||||
#define LCD_PAGES 9
|
||||
#define LCD_COLUMNS 132
|
||||
#else
|
||||
#error Unsupported SED156x configuration
|
||||
#endif
|
||||
|
||||
/* include the font data */
|
||||
#include <video_font.h>
|
||||
|
||||
#if VIDEO_FONT_WIDTH != 8 || VIDEO_FONT_HEIGHT != 16
|
||||
#error Expecting VIDEO_FONT_WIDTH == 8 && VIDEO_FONT_HEIGHT == 16
|
||||
#endif
|
||||
|
||||
#define LCD_BYTE_WIDTH (LCD_WIDTH / 8)
|
||||
#define VIDEO_FONT_BYTE_WIDTH (VIDEO_FONT_WIDTH / 8)
|
||||
|
||||
#define LCD_TEXT_WIDTH (LCD_WIDTH / VIDEO_FONT_WIDTH)
|
||||
#define LCD_TEXT_HEIGHT (LCD_HEIGHT / VIDEO_FONT_HEIGHT)
|
||||
|
||||
#define LCD_BYTE_LINESZ (LCD_BYTE_WIDTH * VIDEO_FONT_HEIGHT)
|
||||
|
||||
const int sed156x_text_width = LCD_TEXT_WIDTH;
|
||||
const int sed156x_text_height = LCD_TEXT_HEIGHT;
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
#define SED156X_SPI_RXD() (SED156X_SPI_RXD_PORT & SED156X_SPI_RXD_MASK)
|
||||
|
||||
#define SED156X_SPI_TXD(x) \
|
||||
do { \
|
||||
if (x) \
|
||||
SED156X_SPI_TXD_PORT |= SED156X_SPI_TXD_MASK; \
|
||||
else \
|
||||
SED156X_SPI_TXD_PORT &= ~SED156X_SPI_TXD_MASK; \
|
||||
} while(0)
|
||||
|
||||
#define SED156X_SPI_CLK(x) \
|
||||
do { \
|
||||
if (x) \
|
||||
SED156X_SPI_CLK_PORT |= SED156X_SPI_CLK_MASK; \
|
||||
else \
|
||||
SED156X_SPI_CLK_PORT &= ~SED156X_SPI_CLK_MASK; \
|
||||
} while(0)
|
||||
|
||||
#define SED156X_SPI_CLK_TOGGLE() (SED156X_SPI_CLK_PORT ^= SED156X_SPI_CLK_MASK)
|
||||
|
||||
#define SED156X_SPI_BIT_DELAY() /* no delay */
|
||||
|
||||
#define SED156X_CS(x) \
|
||||
do { \
|
||||
if (x) \
|
||||
SED156X_CS_PORT |= SED156X_CS_MASK; \
|
||||
else \
|
||||
SED156X_CS_PORT &= ~SED156X_CS_MASK; \
|
||||
} while(0)
|
||||
|
||||
#define SED156X_A0(x) \
|
||||
do { \
|
||||
if (x) \
|
||||
SED156X_A0_PORT |= SED156X_A0_MASK; \
|
||||
else \
|
||||
SED156X_A0_PORT &= ~SED156X_A0_MASK; \
|
||||
} while(0)
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
/*** LCD Commands ***/
|
||||
|
||||
#define LCD_ON 0xAF /* Display ON */
|
||||
#define LCD_OFF 0xAE /* Display OFF */
|
||||
#define LCD_LADDR 0x40 /* Display start line set + (6-bit) address */
|
||||
#define LCD_PADDR 0xB0 /* Page address set + (4-bit) page */
|
||||
#define LCD_CADRH 0x10 /* Column address set upper + (4-bit) column hi */
|
||||
#define LCD_CADRL 0x00 /* Column address set lower + (4-bit) column lo */
|
||||
#define LCD_ADC_NRM 0xA0 /* ADC select Normal */
|
||||
#define LCD_ADC_REV 0xA1 /* ADC select Reverse */
|
||||
#define LCD_DSP_NRM 0xA6 /* LCD display Normal */
|
||||
#define LCD_DSP_REV 0xA7 /* LCD display Reverse */
|
||||
#define LCD_DPT_NRM 0xA4 /* Display all points Normal */
|
||||
#define LCD_DPT_ALL 0xA5 /* Display all points ON */
|
||||
#define LCD_BIAS9 0xA2 /* LCD bias set 1/9 */
|
||||
#define LCD_BIAS7 0xA3 /* LCD bias set 1/7 */
|
||||
#define LCD_CAINC 0xE0 /* Read/modify/write */
|
||||
#define LCD_CAEND 0xEE /* End */
|
||||
#define LCD_RESET 0xE2 /* Reset */
|
||||
#define LCD_C_NRM 0xC0 /* Common output mode select Normal direction */
|
||||
#define LCD_C_RVS 0xC8 /* Common output mode select Reverse direction */
|
||||
#define LCD_PWRMD 0x28 /* Power control set + (3-bit) mode */
|
||||
#define LCD_RESRT 0x20 /* V5 v. reg. int. resistor ratio set + (3-bit) ratio */
|
||||
#define LCD_EVSET 0x81 /* Electronic volume mode set + byte = (6-bit) volume */
|
||||
#define LCD_SIOFF 0xAC /* Static indicator OFF */
|
||||
#define LCD_SION 0xAD /* Static indicator ON + byte = (2-bit) mode */
|
||||
#define LCD_NOP 0xE3 /* NOP */
|
||||
#define LCD_TEST 0xF0 /* Test/Test mode reset (Note: *DO NOT USE*) */
|
||||
|
||||
/*-------------------------------------------------------------------------------
|
||||
Compound commands
|
||||
-------------------------------------------------------------------------------
|
||||
Command Description Commands
|
||||
---------- ------------------------ -------------------------------------
|
||||
POWS_ON POWER SAVER ON command LCD_OFF, LCD_D_ALL
|
||||
POWS_OFF POWER SAVER OFF command LCD_D_NRM
|
||||
SLEEPON SLEEP mode LCD_SIOFF, POWS_ON
|
||||
SLEEPOFF SLEEP mode cancel LCD_D_NRM, LCD_SION, LCD_SIS_???
|
||||
STDBYON STAND BY mode LCD_SION, POWS_ON
|
||||
STDBYOFF STAND BY mode cancel LCD_D_NRM
|
||||
-------------------------------------------------------------------------------*/
|
||||
|
||||
/*** LCD various parameters ***/
|
||||
#define LCD_PPB 8 /* Pixels per byte (display is B/W, 1 bit per pixel) */
|
||||
|
||||
/*** LCD Status byte masks ***/
|
||||
#define LCD_S_BUSY 0x80 /* Status Read - BUSY mask */
|
||||
#define LCD_S_ADC 0x40 /* Status Read - ADC mask */
|
||||
#define LCD_S_ONOFF 0x20 /* Status Read - ON/OFF mask */
|
||||
#define LCD_S_RESET 0x10 /* Status Read - RESET mask */
|
||||
|
||||
/*** LCD commands parameter masks ***/
|
||||
#define LCD_M_LADDR 0x3F /* Display start line (6-bit) address mask */
|
||||
#define LCD_M_PADDR 0x0F /* Page address (4-bit) page mask */
|
||||
#define LCD_M_CADRH 0x0F /* Column address upper (4-bit) column hi mask */
|
||||
#define LCD_M_CADRL 0x0F /* Column address lower (4-bit) column lo mask */
|
||||
#define LCD_M_PWRMD 0x07 /* Power control (3-bit) mode mask */
|
||||
#define LCD_M_RESRT 0x07 /* V5 v. reg. int. resistor ratio (3-bit) ratio mask */
|
||||
#define LCD_M_EVSET 0x3F /* Electronic volume mode byte (6-bit) volume mask */
|
||||
#define LCD_M_SION 0x03 /* Static indicator ON (2-bit) mode mask */
|
||||
|
||||
/*** LCD Power control cirquits control masks ***/
|
||||
#define LCD_PWRBSTR 0x04 /* Power control mode - Booster cirquit ON */
|
||||
#define LCD_PWRVREG 0x02 /* Power control mode - Voltage regulator cirquit ON */
|
||||
#define LCD_PWRVFOL 0x01 /* Power control mode - Voltage follower cirquit ON */
|
||||
|
||||
/*** LCD Static indicator states ***/
|
||||
#define LCD_SIS_OFF 0x00 /* Static indicator register set - OFF state */
|
||||
#define LCD_SIS_BL 0x01 /* Static indicator register set - 1s blink state */
|
||||
#define LCD_SIS_RBL 0x02 /* Static indicator register set - .5s rapid blink state */
|
||||
#define LCD_SIS_ON 0x03 /* Static indicator register set - constantly on state */
|
||||
|
||||
/*** LCD functions special parameters (commands) ***/
|
||||
#define LCD_PREVP 0x80 /* Page number for moving to previous */
|
||||
#define LCD_NEXTP 0x81 /* or next page */
|
||||
#define LCD_ERR_P 0xFF /* Error in page number */
|
||||
|
||||
/*** LCD initialization settings ***/
|
||||
#define LCD_BIAS LCD_BIAS9 /* Bias: 1/9 */
|
||||
#define LCD_ADCMODE LCD_ADC_NRM /* ADC mode: normal */
|
||||
#define LCD_COMDIR LCD_C_NRM /* Common output mode: normal */
|
||||
#define LCD_RRATIO 0 /* Resistor ratio: 0 */
|
||||
#define LCD_CNTRST 0x1C /* electronic volume: 1Ch */
|
||||
#define LCD_POWERM (LCD_PWRBSTR | LCD_PWRVREG | LCD_PWRVFOL) /* Power mode: All on */
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
static inline unsigned int sed156x_transfer(unsigned int val)
|
||||
{
|
||||
unsigned int rx;
|
||||
int b;
|
||||
|
||||
rx = 0; b = 8;
|
||||
while (--b >= 0) {
|
||||
SED156X_SPI_TXD(val & 0x80);
|
||||
val <<= 1;
|
||||
SED156X_SPI_CLK_TOGGLE();
|
||||
SED156X_SPI_BIT_DELAY();
|
||||
rx <<= 1;
|
||||
if (SED156X_SPI_RXD())
|
||||
rx |= 1;
|
||||
SED156X_SPI_CLK_TOGGLE();
|
||||
SED156X_SPI_BIT_DELAY();
|
||||
}
|
||||
|
||||
return rx;
|
||||
}
|
||||
|
||||
unsigned int sed156x_data_transfer(unsigned int val)
|
||||
{
|
||||
unsigned int rx;
|
||||
|
||||
SED156X_SPI_CLK(1);
|
||||
SED156X_CS(0);
|
||||
SED156X_A0(1);
|
||||
|
||||
rx = sed156x_transfer(val);
|
||||
|
||||
SED156X_CS(1);
|
||||
|
||||
return rx;
|
||||
}
|
||||
|
||||
void sed156x_data_block_transfer(const u8 *p, int size)
|
||||
{
|
||||
SED156X_SPI_CLK(1);
|
||||
SED156X_CS(0);
|
||||
SED156X_A0(1);
|
||||
|
||||
while (--size >= 0)
|
||||
sed156x_transfer(*p++);
|
||||
|
||||
SED156X_CS(1);
|
||||
}
|
||||
|
||||
unsigned int sed156x_cmd_transfer(unsigned int val)
|
||||
{
|
||||
unsigned int rx;
|
||||
|
||||
SED156X_SPI_CLK(1);
|
||||
SED156X_CS(0);
|
||||
SED156X_A0(0);
|
||||
|
||||
rx = sed156x_transfer(val);
|
||||
|
||||
SED156X_CS(1);
|
||||
SED156X_A0(1);
|
||||
|
||||
return rx;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static u8 hw_screen[LCD_PAGES][LCD_COLUMNS];
|
||||
static u8 last_hw_screen[LCD_PAGES][LCD_COLUMNS];
|
||||
static u8 sw_screen[LCD_BYTE_WIDTH * LCD_HEIGHT];
|
||||
|
||||
void sed156x_sync(void)
|
||||
{
|
||||
int i, j, last_page;
|
||||
u8 *d;
|
||||
const u8 *s, *e, *b, *r;
|
||||
u8 v0, v1, v2, v3, v4, v5, v6, v7;
|
||||
|
||||
/* copy and rotate sw_screen to hw_screen */
|
||||
for (i = 0; i < LCD_HEIGHT / 8; i++) {
|
||||
|
||||
d = &hw_screen[i][0];
|
||||
s = &sw_screen[LCD_BYTE_WIDTH * 8 * i + LCD_BYTE_WIDTH - 1];
|
||||
|
||||
for (j = 0; j < LCD_WIDTH / 8; j++) {
|
||||
|
||||
v0 = s[0 * LCD_BYTE_WIDTH];
|
||||
v1 = s[1 * LCD_BYTE_WIDTH];
|
||||
v2 = s[2 * LCD_BYTE_WIDTH];
|
||||
v3 = s[3 * LCD_BYTE_WIDTH];
|
||||
v4 = s[4 * LCD_BYTE_WIDTH];
|
||||
v5 = s[5 * LCD_BYTE_WIDTH];
|
||||
v6 = s[6 * LCD_BYTE_WIDTH];
|
||||
v7 = s[7 * LCD_BYTE_WIDTH];
|
||||
|
||||
d[0] = ((v7 & 0x01) << 7) |
|
||||
((v6 & 0x01) << 6) |
|
||||
((v5 & 0x01) << 5) |
|
||||
((v4 & 0x01) << 4) |
|
||||
((v3 & 0x01) << 3) |
|
||||
((v2 & 0x01) << 2) |
|
||||
((v1 & 0x01) << 1) |
|
||||
(v0 & 0x01) ;
|
||||
|
||||
d[1] = ((v7 & 0x02) << 6) |
|
||||
((v6 & 0x02) << 5) |
|
||||
((v5 & 0x02) << 4) |
|
||||
((v4 & 0x02) << 3) |
|
||||
((v3 & 0x02) << 2) |
|
||||
((v2 & 0x02) << 1) |
|
||||
((v1 & 0x02) << 0) |
|
||||
((v0 & 0x02) >> 1) ;
|
||||
|
||||
d[2] = ((v7 & 0x04) << 5) |
|
||||
((v6 & 0x04) << 4) |
|
||||
((v5 & 0x04) << 3) |
|
||||
((v4 & 0x04) << 2) |
|
||||
((v3 & 0x04) << 1) |
|
||||
(v2 & 0x04) |
|
||||
((v1 & 0x04) >> 1) |
|
||||
((v0 & 0x04) >> 2) ;
|
||||
|
||||
d[3] = ((v7 & 0x08) << 4) |
|
||||
((v6 & 0x08) << 3) |
|
||||
((v5 & 0x08) << 2) |
|
||||
((v4 & 0x08) << 1) |
|
||||
(v3 & 0x08) |
|
||||
((v2 & 0x08) >> 1) |
|
||||
((v1 & 0x08) >> 2) |
|
||||
((v0 & 0x08) >> 3) ;
|
||||
|
||||
d[4] = ((v7 & 0x10) << 3) |
|
||||
((v6 & 0x10) << 2) |
|
||||
((v5 & 0x10) << 1) |
|
||||
(v4 & 0x10) |
|
||||
((v3 & 0x10) >> 1) |
|
||||
((v2 & 0x10) >> 2) |
|
||||
((v1 & 0x10) >> 3) |
|
||||
((v0 & 0x10) >> 4) ;
|
||||
|
||||
d[5] = ((v7 & 0x20) << 2) |
|
||||
((v6 & 0x20) << 1) |
|
||||
(v5 & 0x20) |
|
||||
((v4 & 0x20) >> 1) |
|
||||
((v3 & 0x20) >> 2) |
|
||||
((v2 & 0x20) >> 3) |
|
||||
((v1 & 0x20) >> 4) |
|
||||
((v0 & 0x20) >> 5) ;
|
||||
|
||||
d[6] = ((v7 & 0x40) << 1) |
|
||||
(v6 & 0x40) |
|
||||
((v5 & 0x40) >> 1) |
|
||||
((v4 & 0x40) >> 2) |
|
||||
((v3 & 0x40) >> 3) |
|
||||
((v2 & 0x40) >> 4) |
|
||||
((v1 & 0x40) >> 5) |
|
||||
((v0 & 0x40) >> 6) ;
|
||||
|
||||
d[7] = (v7 & 0x80) |
|
||||
((v6 & 0x80) >> 1) |
|
||||
((v5 & 0x80) >> 2) |
|
||||
((v4 & 0x80) >> 3) |
|
||||
((v3 & 0x80) >> 4) |
|
||||
((v2 & 0x80) >> 5) |
|
||||
((v1 & 0x80) >> 6) |
|
||||
((v0 & 0x80) >> 7) ;
|
||||
|
||||
d += 8;
|
||||
s--;
|
||||
}
|
||||
}
|
||||
|
||||
/* and now output only the differences */
|
||||
for (i = 0; i < LCD_PAGES; i++) {
|
||||
|
||||
b = &hw_screen[i][0];
|
||||
e = &hw_screen[i][LCD_COLUMNS];
|
||||
|
||||
d = &last_hw_screen[i][0];
|
||||
s = b;
|
||||
|
||||
last_page = -1;
|
||||
|
||||
/* update only the differences */
|
||||
do {
|
||||
while (s < e && *s == *d) {
|
||||
s++;
|
||||
d++;
|
||||
}
|
||||
if (s == e)
|
||||
break;
|
||||
r = s;
|
||||
while (s < e && *s != *d)
|
||||
*d++ = *s++;
|
||||
|
||||
j = r - b;
|
||||
|
||||
if (i != last_page) {
|
||||
sed156x_cmd_transfer(LCD_PADDR | i);
|
||||
last_page = i;
|
||||
}
|
||||
|
||||
sed156x_cmd_transfer(LCD_CADRH | ((j >> 4) & 0x0F));
|
||||
sed156x_cmd_transfer(LCD_CADRL | (j & 0x0F));
|
||||
sed156x_data_block_transfer(r, s - r);
|
||||
|
||||
} while (s < e);
|
||||
}
|
||||
|
||||
/********
|
||||
for (i = 0; i < LCD_PAGES; i++) {
|
||||
sed156x_cmd_transfer(LCD_PADDR | i);
|
||||
sed156x_cmd_transfer(LCD_CADRH | 0);
|
||||
sed156x_cmd_transfer(LCD_CADRL | 0);
|
||||
sed156x_data_block_transfer(&hw_screen[i][0], LCD_COLUMNS);
|
||||
}
|
||||
memcpy(last_hw_screen, hw_screen, sizeof(last_hw_screen));
|
||||
********/
|
||||
}
|
||||
|
||||
void sed156x_clear(void)
|
||||
{
|
||||
memset(sw_screen, 0, sizeof(sw_screen));
|
||||
}
|
||||
|
||||
void sed156x_output_at(int x, int y, const char *str, int size)
|
||||
{
|
||||
int i, j;
|
||||
u8 *p;
|
||||
const u8 *s;
|
||||
|
||||
if ((unsigned int)y >= LCD_TEXT_HEIGHT || (unsigned int)x >= LCD_TEXT_WIDTH)
|
||||
return;
|
||||
|
||||
p = &sw_screen[y * VIDEO_FONT_HEIGHT * LCD_BYTE_WIDTH + x * VIDEO_FONT_BYTE_WIDTH];
|
||||
|
||||
while (--size >= 0) {
|
||||
|
||||
s = &video_fontdata[((int)*str++ & 0xff) * VIDEO_FONT_BYTE_WIDTH * VIDEO_FONT_HEIGHT];
|
||||
for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
|
||||
for (j = 0; j < VIDEO_FONT_BYTE_WIDTH; j++)
|
||||
*p++ = *s++;
|
||||
p += LCD_BYTE_WIDTH - VIDEO_FONT_BYTE_WIDTH;
|
||||
}
|
||||
p -= (LCD_BYTE_LINESZ - VIDEO_FONT_BYTE_WIDTH);
|
||||
|
||||
if (x >= LCD_TEXT_WIDTH)
|
||||
break;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
void sed156x_reverse_at(int x, int y, int size)
|
||||
{
|
||||
int i, j;
|
||||
u8 *p;
|
||||
|
||||
if ((unsigned int)y >= LCD_TEXT_HEIGHT || (unsigned int)x >= LCD_TEXT_WIDTH)
|
||||
return;
|
||||
|
||||
p = &sw_screen[y * VIDEO_FONT_HEIGHT * LCD_BYTE_WIDTH + x * VIDEO_FONT_BYTE_WIDTH];
|
||||
|
||||
while (--size >= 0) {
|
||||
|
||||
for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
|
||||
for (j = 0; j < VIDEO_FONT_BYTE_WIDTH; j++, p++)
|
||||
*p = ~*p;
|
||||
p += LCD_BYTE_WIDTH - VIDEO_FONT_BYTE_WIDTH;
|
||||
}
|
||||
p -= (LCD_BYTE_LINESZ - VIDEO_FONT_BYTE_WIDTH);
|
||||
|
||||
if (x >= LCD_TEXT_WIDTH)
|
||||
break;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
void sed156x_scroll_line(void)
|
||||
{
|
||||
memmove(&sw_screen[0],
|
||||
&sw_screen[LCD_BYTE_LINESZ],
|
||||
LCD_BYTE_WIDTH * (LCD_HEIGHT - VIDEO_FONT_HEIGHT));
|
||||
}
|
||||
|
||||
void sed156x_scroll(int dx, int dy)
|
||||
{
|
||||
u8 *p1 = NULL, *p2 = NULL, *p3 = NULL; /* pacify gcc */
|
||||
int adx, ady, i, sz;
|
||||
|
||||
adx = dx > 0 ? dx : -dx;
|
||||
ady = dy > 0 ? dy : -dy;
|
||||
|
||||
/* overscroll? erase everything */
|
||||
if (adx >= LCD_TEXT_WIDTH || ady >= LCD_TEXT_HEIGHT) {
|
||||
memset(sw_screen, 0, sizeof(sw_screen));
|
||||
return;
|
||||
}
|
||||
|
||||
sz = LCD_BYTE_LINESZ * ady;
|
||||
if (dy > 0) {
|
||||
p1 = &sw_screen[0];
|
||||
p2 = &sw_screen[sz];
|
||||
p3 = &sw_screen[LCD_BYTE_WIDTH * LCD_HEIGHT - sz];
|
||||
} else if (dy < 0) {
|
||||
p1 = &sw_screen[sz];
|
||||
p2 = &sw_screen[0];
|
||||
p3 = &sw_screen[0];
|
||||
}
|
||||
|
||||
if (ady > 0) {
|
||||
memmove(p1, p2, LCD_BYTE_WIDTH * LCD_HEIGHT - sz);
|
||||
memset(p3, 0, sz);
|
||||
}
|
||||
|
||||
sz = VIDEO_FONT_BYTE_WIDTH * adx;
|
||||
if (dx > 0) {
|
||||
p1 = &sw_screen[0];
|
||||
p2 = &sw_screen[0] + sz;
|
||||
p3 = &sw_screen[0] + LCD_BYTE_WIDTH - sz;
|
||||
} else if (dx < 0) {
|
||||
p1 = &sw_screen[0] + sz;
|
||||
p2 = &sw_screen[0];
|
||||
p3 = &sw_screen[0];
|
||||
}
|
||||
|
||||
/* xscroll */
|
||||
if (adx > 0) {
|
||||
for (i = 0; i < LCD_HEIGHT; i++) {
|
||||
memmove(p1, p2, LCD_BYTE_WIDTH - sz);
|
||||
memset(p3, 0, sz);
|
||||
p1 += LCD_BYTE_WIDTH;
|
||||
p2 += LCD_BYTE_WIDTH;
|
||||
p3 += LCD_BYTE_WIDTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sed156x_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
SED156X_CS(1);
|
||||
SED156X_A0(1);
|
||||
|
||||
/* Send initialization commands to the LCD */
|
||||
sed156x_cmd_transfer(LCD_OFF); /* Turn display OFF */
|
||||
sed156x_cmd_transfer(LCD_BIAS); /* set the LCD Bias, */
|
||||
sed156x_cmd_transfer(LCD_ADCMODE); /* ADC mode, */
|
||||
sed156x_cmd_transfer(LCD_COMDIR); /* common output mode, */
|
||||
sed156x_cmd_transfer(LCD_RESRT | LCD_RRATIO); /* resistor ratio, */
|
||||
sed156x_cmd_transfer(LCD_EVSET); /* electronic volume, */
|
||||
sed156x_cmd_transfer(LCD_CNTRST);
|
||||
sed156x_cmd_transfer(LCD_PWRMD | LCD_POWERM); /* and power mode */
|
||||
sed156x_cmd_transfer(LCD_PADDR | 0); /* cursor home */
|
||||
sed156x_cmd_transfer(LCD_CADRH | 0);
|
||||
sed156x_cmd_transfer(LCD_CADRL | 0);
|
||||
sed156x_cmd_transfer(LCD_LADDR | 0); /* and display start line */
|
||||
sed156x_cmd_transfer(LCD_DSP_NRM); /* LCD display Normal */
|
||||
|
||||
/* clear everything */
|
||||
memset(sw_screen, 0, sizeof(sw_screen));
|
||||
memset(hw_screen, 0, sizeof(hw_screen));
|
||||
memset(last_hw_screen, 0, sizeof(last_hw_screen));
|
||||
|
||||
for (i = 0; i < LCD_PAGES; i++) {
|
||||
sed156x_cmd_transfer(LCD_PADDR | i);
|
||||
sed156x_cmd_transfer(LCD_CADRH | 0);
|
||||
sed156x_cmd_transfer(LCD_CADRL | 0);
|
||||
sed156x_data_block_transfer(&hw_screen[i][0], LCD_COLUMNS);
|
||||
}
|
||||
|
||||
sed156x_clear();
|
||||
sed156x_sync();
|
||||
sed156x_cmd_transfer(LCD_ON); /* Turn display ON */
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SED156X */
|
||||
@@ -51,6 +51,9 @@ SECTIONS
|
||||
.sdata : { *(.sdata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.sbss : { *(.sbss) }
|
||||
.bss : { *(.bss) }
|
||||
|
||||
_end = .;
|
||||
}
|
||||
|
||||
@@ -57,4 +57,5 @@ SECTIONS
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
_end = .;
|
||||
}
|
||||
|
||||
@@ -110,8 +110,17 @@ static void __attribute__((unused)) dummy(void)
|
||||
#include <_exports.h>
|
||||
}
|
||||
|
||||
extern unsigned long __bss_start, _end;
|
||||
|
||||
void app_startup(char **argv)
|
||||
{
|
||||
unsigned long * cp = &__bss_start;
|
||||
|
||||
/* Zero out BSS */
|
||||
while (cp < &_end) {
|
||||
*cp++ = 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_I386)
|
||||
/* x86 does not have a dedicated register for passing global_data */
|
||||
global_data = (gd_t *)argv[-1];
|
||||
|
||||
@@ -140,6 +140,130 @@
|
||||
# define DEBUGF(fmt,args...)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
|
||||
/*
|
||||
* Support for jffs2 on top of NAND-flash
|
||||
*
|
||||
* NAND memory isn't mapped in processor's address space,
|
||||
* so data should be fetched from flash before
|
||||
* being processed. This is exactly what functions declared
|
||||
* here do.
|
||||
*
|
||||
*/
|
||||
|
||||
/* this one defined in cmd_nand.c */
|
||||
int read_jffs2_nand(size_t start, size_t len,
|
||||
size_t * retlen, u_char * buf, int nanddev);
|
||||
|
||||
#define NAND_PAGE_SIZE 512
|
||||
#define NAND_PAGE_SHIFT 9
|
||||
#define NAND_PAGE_MASK (~(NAND_PAGE_SIZE-1))
|
||||
|
||||
#ifndef NAND_CACHE_PAGES
|
||||
#define NAND_CACHE_PAGES 16
|
||||
#endif
|
||||
#define NAND_CACHE_SIZE (NAND_CACHE_PAGES*NAND_PAGE_SIZE)
|
||||
|
||||
static u8* nand_cache = NULL;
|
||||
static u32 nand_cache_off = (u32)-1;
|
||||
static int nanddev = 0; /* nand device of current partition */
|
||||
|
||||
static int read_nand_cached(u32 off, u32 size, u_char *buf)
|
||||
{
|
||||
u32 bytes_read = 0;
|
||||
size_t retlen;
|
||||
int cpy_bytes;
|
||||
|
||||
while (bytes_read < size) {
|
||||
if ((off + bytes_read < nand_cache_off) ||
|
||||
(off + bytes_read >= nand_cache_off+NAND_CACHE_SIZE)) {
|
||||
nand_cache_off = (off + bytes_read) & NAND_PAGE_MASK;
|
||||
if (!nand_cache) {
|
||||
/* This memory never gets freed but 'cause
|
||||
it's a bootloader, nobody cares */
|
||||
nand_cache = malloc(NAND_CACHE_SIZE);
|
||||
if (!nand_cache) {
|
||||
printf("read_nand_cached: can't alloc cache size %d bytes\n",
|
||||
NAND_CACHE_SIZE);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (read_jffs2_nand(nand_cache_off, NAND_CACHE_SIZE,
|
||||
&retlen, nand_cache, nanddev) < 0 ||
|
||||
retlen != NAND_CACHE_SIZE) {
|
||||
printf("read_nand_cached: error reading nand off %#x size %d bytes\n",
|
||||
nand_cache_off, NAND_CACHE_SIZE);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
cpy_bytes = nand_cache_off + NAND_CACHE_SIZE - (off + bytes_read);
|
||||
if (cpy_bytes > size - bytes_read)
|
||||
cpy_bytes = size - bytes_read;
|
||||
memcpy(buf + bytes_read,
|
||||
nand_cache + off + bytes_read - nand_cache_off,
|
||||
cpy_bytes);
|
||||
bytes_read += cpy_bytes;
|
||||
}
|
||||
return bytes_read;
|
||||
}
|
||||
|
||||
static void *get_fl_mem(u32 off, u32 size, void *ext_buf)
|
||||
{
|
||||
u_char *buf = ext_buf ? (u_char*)ext_buf : (u_char*)malloc(size);
|
||||
|
||||
if (NULL == buf) {
|
||||
printf("get_fl_mem: can't alloc %d bytes\n", size);
|
||||
return NULL;
|
||||
}
|
||||
if (read_nand_cached(off, size, buf) < 0) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void *get_node_mem(u32 off)
|
||||
{
|
||||
struct jffs2_unknown_node node;
|
||||
void *ret = NULL;
|
||||
|
||||
if (NULL == get_fl_mem(off, sizeof(node), &node))
|
||||
return NULL;
|
||||
|
||||
if (!(ret = get_fl_mem(off, node.magic ==
|
||||
JFFS2_MAGIC_BITMASK ? node.totlen : sizeof(node),
|
||||
NULL))) {
|
||||
printf("off = %#x magic %#x type %#x node.totlen = %d\n",
|
||||
off, node.magic, node.nodetype, node.totlen);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void put_fl_mem(void *buf)
|
||||
{
|
||||
free(buf);
|
||||
}
|
||||
|
||||
#else /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
||||
|
||||
static inline void *get_fl_mem(u32 off, u32 size, void *ext_buf)
|
||||
{
|
||||
return (void*)off;
|
||||
}
|
||||
|
||||
static inline void *get_node_mem(u32 off)
|
||||
{
|
||||
return (void*)off;
|
||||
}
|
||||
|
||||
static inline void put_fl_mem(void *buf)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
||||
|
||||
|
||||
/* Compression names */
|
||||
static char *compr_names[] = {
|
||||
@@ -269,8 +393,12 @@ insert_node(struct b_list *list, u32 offset)
|
||||
*/
|
||||
static int compare_inodes(struct b_node *new, struct b_node *old)
|
||||
{
|
||||
struct jffs2_raw_inode *jNew = (struct jffs2_raw_inode *)new->offset;
|
||||
struct jffs2_raw_inode *jOld = (struct jffs2_raw_inode *)old->offset;
|
||||
struct jffs2_raw_inode ojNew;
|
||||
struct jffs2_raw_inode ojOld;
|
||||
struct jffs2_raw_inode *jNew =
|
||||
(struct jffs2_raw_inode *)get_fl_mem(new->offset, sizeof(ojNew), &ojNew);
|
||||
struct jffs2_raw_inode *jOld =
|
||||
(struct jffs2_raw_inode *)get_fl_mem(old->offset, sizeof(ojOld), &ojOld);
|
||||
|
||||
return jNew->version > jOld->version;
|
||||
}
|
||||
@@ -282,8 +410,12 @@ static int compare_inodes(struct b_node *new, struct b_node *old)
|
||||
*/
|
||||
static int compare_dirents(struct b_node *new, struct b_node *old)
|
||||
{
|
||||
struct jffs2_raw_dirent *jNew = (struct jffs2_raw_dirent *)new->offset;
|
||||
struct jffs2_raw_dirent *jOld = (struct jffs2_raw_dirent *)old->offset;
|
||||
struct jffs2_raw_dirent ojNew;
|
||||
struct jffs2_raw_dirent ojOld;
|
||||
struct jffs2_raw_dirent *jNew =
|
||||
(struct jffs2_raw_dirent *)get_fl_mem(new->offset, sizeof(ojNew), &ojNew);
|
||||
struct jffs2_raw_dirent *jOld =
|
||||
(struct jffs2_raw_dirent *)get_fl_mem(old->offset, sizeof(ojOld), &ojOld);
|
||||
int cmp;
|
||||
|
||||
/* ascending sort by pino */
|
||||
@@ -322,8 +454,10 @@ jffs2_scan_empty(u32 start_offset, struct part_info *part)
|
||||
{
|
||||
char *max = part->offset + part->size - sizeof(struct jffs2_raw_inode);
|
||||
char *offset = part->offset + start_offset;
|
||||
u32 off;
|
||||
|
||||
while (offset < max && *(u32 *)offset == 0xFFFFFFFF) {
|
||||
while (offset < max &&
|
||||
*(u32*)get_fl_mem((u32)offset, sizeof(u32), &off) == 0xFFFFFFFF) {
|
||||
offset += sizeof(u32);
|
||||
/* return if spinning is due */
|
||||
if (((u32)offset & ((1 << SPIN_BLKSIZE)-1)) == 0) break;
|
||||
@@ -377,7 +511,8 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
* we will live with it.
|
||||
*/
|
||||
for (b = pL->frag.listHead; b != NULL; b = b->next) {
|
||||
jNode = (struct jffs2_raw_inode *) (b->offset);
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
sizeof(struct jffs2_raw_inode), NULL);
|
||||
if ((inode == jNode->ino)) {
|
||||
/* get actual file length from the newest node */
|
||||
if (jNode->version >= latestVersion) {
|
||||
@@ -385,11 +520,12 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
latestVersion = jNode->version;
|
||||
}
|
||||
}
|
||||
put_fl_mem(jNode);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (b = pL->frag.listHead; b != NULL; b = b->next) {
|
||||
jNode = (struct jffs2_raw_inode *) (b->offset);
|
||||
jNode = (struct jffs2_raw_inode *) get_node_mem(b->offset);
|
||||
if ((inode == jNode->ino)) {
|
||||
#if 0
|
||||
putLabeledWord("\r\n\r\nread_inode: totlen = ", jNode->totlen);
|
||||
@@ -415,8 +551,10 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
if(dest) {
|
||||
src = ((char *) jNode) + sizeof(struct jffs2_raw_inode);
|
||||
/* ignore data behind latest known EOF */
|
||||
if (jNode->offset > totalSize)
|
||||
if (jNode->offset > totalSize) {
|
||||
put_fl_mem(jNode);
|
||||
continue;
|
||||
}
|
||||
|
||||
lDest = (char *) (dest + jNode->offset);
|
||||
#if 0
|
||||
@@ -447,6 +585,7 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
default:
|
||||
/* unknown */
|
||||
putLabeledWord("UNKOWN COMPRESSION METHOD = ", jNode->compr);
|
||||
put_fl_mem(jNode);
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
@@ -458,6 +597,7 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
#endif
|
||||
}
|
||||
counter++;
|
||||
put_fl_mem(jNode);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -483,12 +623,14 @@ jffs2_1pass_find_inode(struct b_lists * pL, const char *name, u32 pino)
|
||||
counter = 0;
|
||||
/* we need to search all and return the inode with the highest version */
|
||||
for(b = pL->dir.listHead; b; b = b->next, counter++) {
|
||||
jDir = (struct jffs2_raw_dirent *) (b->offset);
|
||||
jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
|
||||
if ((pino == jDir->pino) && (len == jDir->nsize) &&
|
||||
(jDir->ino) && /* 0 for unlink */
|
||||
(!strncmp(jDir->name, name, len))) { /* a match */
|
||||
if (jDir->version < version)
|
||||
if (jDir->version < version) {
|
||||
put_fl_mem(jDir);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (jDir->version == version && inode != 0) {
|
||||
/* I'm pretty sure this isn't legal */
|
||||
@@ -508,6 +650,7 @@ jffs2_1pass_find_inode(struct b_lists * pL, const char *name, u32 pino)
|
||||
putLabeledWord("b = ", (u32) b);
|
||||
putLabeledWord("counter = ", counter);
|
||||
#endif
|
||||
put_fl_mem(jDir);
|
||||
}
|
||||
return inode;
|
||||
}
|
||||
@@ -603,22 +746,26 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
|
||||
struct jffs2_raw_dirent *jDir;
|
||||
|
||||
for (b = pL->dir.listHead; b; b = b->next) {
|
||||
jDir = (struct jffs2_raw_dirent *) (b->offset);
|
||||
jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
|
||||
if ((pino == jDir->pino) && (jDir->ino)) { /* ino=0 -> unlink */
|
||||
u32 i_version = 0;
|
||||
struct jffs2_raw_inode ojNode;
|
||||
struct jffs2_raw_inode *jNode, *i = NULL;
|
||||
struct b_node *b2 = pL->frag.listHead;
|
||||
|
||||
while (b2) {
|
||||
jNode = (struct jffs2_raw_inode *) (b2->offset);
|
||||
jNode = (struct jffs2_raw_inode *)
|
||||
get_fl_mem(b2->offset, sizeof(ojNode), &ojNode);
|
||||
if (jNode->ino == jDir->ino
|
||||
&& jNode->version >= i_version)
|
||||
i = jNode;
|
||||
i = get_fl_mem(b2->offset, sizeof(*i), NULL);
|
||||
b2 = b2->next;
|
||||
}
|
||||
|
||||
dump_inode(pL, jDir, i);
|
||||
put_fl_mem(i);
|
||||
}
|
||||
put_fl_mem(jDir);
|
||||
}
|
||||
return pino;
|
||||
}
|
||||
@@ -686,7 +833,9 @@ jffs2_1pass_resolve_inode(struct b_lists * pL, u32 ino)
|
||||
struct b_node *b2;
|
||||
struct jffs2_raw_dirent *jDir;
|
||||
struct jffs2_raw_inode *jNode;
|
||||
struct jffs2_raw_dirent *jDirFound = NULL;
|
||||
u8 jDirFoundType = 0;
|
||||
u32 jDirFoundIno = 0;
|
||||
u32 jDirFoundPino = 0;
|
||||
char tmp[256];
|
||||
u32 version = 0;
|
||||
u32 pino;
|
||||
@@ -694,12 +843,14 @@ jffs2_1pass_resolve_inode(struct b_lists * pL, u32 ino)
|
||||
|
||||
/* we need to search all and return the inode with the highest version */
|
||||
for(b = pL->dir.listHead; b; b = b->next) {
|
||||
jDir = (struct jffs2_raw_dirent *) (b->offset);
|
||||
jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
|
||||
if (ino == jDir->ino) {
|
||||
if (jDir->version < version)
|
||||
if (jDir->version < version) {
|
||||
put_fl_mem(jDir);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (jDir->version == version && jDirFound) {
|
||||
if (jDir->version == version && jDirFoundType) {
|
||||
/* I'm pretty sure this isn't legal */
|
||||
putstr(" ** ERROR ** ");
|
||||
putnstr(jDir->name, jDir->nsize);
|
||||
@@ -707,19 +858,22 @@ jffs2_1pass_resolve_inode(struct b_lists * pL, u32 ino)
|
||||
version);
|
||||
}
|
||||
|
||||
jDirFound = jDir;
|
||||
jDirFoundType = jDir->type;
|
||||
jDirFoundIno = jDir->ino;
|
||||
jDirFoundPino = jDir->pino;
|
||||
version = jDir->version;
|
||||
}
|
||||
put_fl_mem(jDir);
|
||||
}
|
||||
/* now we found the right entry again. (shoulda returned inode*) */
|
||||
if (jDirFound->type != DT_LNK)
|
||||
return jDirFound->ino;
|
||||
if (jDirFoundType != DT_LNK)
|
||||
return jDirFoundIno;
|
||||
|
||||
/* it's a soft link so we follow it again. */
|
||||
b2 = pL->frag.listHead;
|
||||
while (b2) {
|
||||
jNode = (struct jffs2_raw_inode *) (b2->offset);
|
||||
if (jNode->ino == jDirFound->ino) {
|
||||
jNode = (struct jffs2_raw_inode *) get_node_mem(b2->offset);
|
||||
if (jNode->ino == jDirFoundIno) {
|
||||
src = (unsigned char *) (b2->offset + sizeof(struct jffs2_raw_inode));
|
||||
|
||||
#if 0
|
||||
@@ -730,16 +884,18 @@ jffs2_1pass_resolve_inode(struct b_lists * pL, u32 ino)
|
||||
#endif
|
||||
strncpy(tmp, src, jNode->dsize);
|
||||
tmp[jNode->dsize] = '\0';
|
||||
put_fl_mem(jNode);
|
||||
break;
|
||||
}
|
||||
b2 = b2->next;
|
||||
put_fl_mem(jNode);
|
||||
}
|
||||
/* ok so the name of the new file to find is in tmp */
|
||||
/* if it starts with a slash it is root based else shared dirs */
|
||||
if (tmp[0] == '/')
|
||||
pino = 1;
|
||||
else
|
||||
pino = jDirFound->pino;
|
||||
pino = jDirFoundPino;
|
||||
|
||||
return jffs2_1pass_search_inode(pL, tmp, pino);
|
||||
}
|
||||
@@ -796,6 +952,7 @@ unsigned char
|
||||
jffs2_1pass_rescan_needed(struct part_info *part)
|
||||
{
|
||||
struct b_node *b;
|
||||
struct jffs2_unknown_node onode;
|
||||
struct jffs2_unknown_node *node;
|
||||
struct b_lists *pL = (struct b_lists *)part->jffs2_priv;
|
||||
|
||||
@@ -814,10 +971,19 @@ jffs2_1pass_rescan_needed(struct part_info *part)
|
||||
DEBUGF ("rescan: different partition\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
if (nanddev != (int)part->usr_priv - 1) {
|
||||
DEBUGF ("rescan: nand device changed\n");
|
||||
return -1;
|
||||
}
|
||||
#endif /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
||||
|
||||
/* but suppose someone reflashed a partition at the same offset... */
|
||||
b = pL->dir.listHead;
|
||||
while (b) {
|
||||
node = (struct jffs2_unknown_node *) (b->offset);
|
||||
node = (struct jffs2_unknown_node *) get_fl_mem(b->offset,
|
||||
sizeof(onode), &onode);
|
||||
if (node->nodetype != JFFS2_NODETYPE_DIRENT) {
|
||||
DEBUGF ("rescan: fs changed beneath me? (%lx)\n",
|
||||
(unsigned long) b->offset);
|
||||
@@ -833,12 +999,14 @@ static void
|
||||
dump_fragments(struct b_lists *pL)
|
||||
{
|
||||
struct b_node *b;
|
||||
struct jffs2_raw_inode ojNode;
|
||||
struct jffs2_raw_inode *jNode;
|
||||
|
||||
putstr("\r\n\r\n******The fragment Entries******\r\n");
|
||||
b = pL->frag.listHead;
|
||||
while (b) {
|
||||
jNode = (struct jffs2_raw_inode *) (b->offset);
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
sizeof(ojNode), &ojNode);
|
||||
putLabeledWord("\r\n\tbuild_list: FLASH_OFFSET = ", b->offset);
|
||||
putLabeledWord("\tbuild_list: totlen = ", jNode->totlen);
|
||||
putLabeledWord("\tbuild_list: inode = ", jNode->ino);
|
||||
@@ -867,7 +1035,7 @@ dump_dirents(struct b_lists *pL)
|
||||
putstr("\r\n\r\n******The directory Entries******\r\n");
|
||||
b = pL->dir.listHead;
|
||||
while (b) {
|
||||
jDir = (struct jffs2_raw_dirent *) (b->offset);
|
||||
jDir = (struct jffs2_raw_dirent *) get_node_mem(b->offset);
|
||||
putstr("\r\n");
|
||||
putnstr(jDir->name, jDir->nsize);
|
||||
putLabeledWord("\r\n\tbuild_list: magic = ", jDir->magic);
|
||||
@@ -883,6 +1051,7 @@ dump_dirents(struct b_lists *pL)
|
||||
putLabeledWord("\tbuild_list: name_crc = ", jDir->name_crc);
|
||||
putLabeledWord("\tbuild_list: offset = ", b->offset); /* FIXME: ? [RS] */
|
||||
b = b->next;
|
||||
put_fl_mem(jDir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -899,6 +1068,10 @@ jffs2_1pass_build_lists(struct part_info * part)
|
||||
u32 counterF = 0;
|
||||
u32 counterN = 0;
|
||||
|
||||
#if defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND)
|
||||
nanddev = (int)part->usr_priv - 1;
|
||||
#endif /* defined(CONFIG_JFFS2_NAND) && (CONFIG_COMMANDS & CFG_CMD_NAND) */
|
||||
|
||||
/* turn off the lcd. Refreshing the lcd adds 50% overhead to the */
|
||||
/* jffs2 list building enterprise nope. in newer versions the overhead is */
|
||||
/* only about 5 %. not enough to inconvenience people for. */
|
||||
@@ -918,22 +1091,26 @@ jffs2_1pass_build_lists(struct part_info * part)
|
||||
oldoffset = offset;
|
||||
}
|
||||
|
||||
node = (struct jffs2_unknown_node *) (part->offset + offset);
|
||||
node = (struct jffs2_unknown_node *) get_node_mem((u32)part->offset + offset);
|
||||
if (node->magic == JFFS2_MAGIC_BITMASK && hdr_crc(node)) {
|
||||
/* if its a fragment add it */
|
||||
if (node->nodetype == JFFS2_NODETYPE_INODE &&
|
||||
inode_crc((struct jffs2_raw_inode *) node)) {
|
||||
if (insert_node(&pL->frag, (u32) part->offset +
|
||||
offset) == NULL)
|
||||
offset) == NULL) {
|
||||
put_fl_mem(node);
|
||||
return 0;
|
||||
}
|
||||
} else if (node->nodetype == JFFS2_NODETYPE_DIRENT &&
|
||||
dirent_crc((struct jffs2_raw_dirent *) node) &&
|
||||
dirent_name_crc((struct jffs2_raw_dirent *) node)) {
|
||||
if (! (counterN%100))
|
||||
puts ("\b\b. ");
|
||||
if (insert_node(&pL->dir, (u32) part->offset +
|
||||
offset) == NULL)
|
||||
offset) == NULL) {
|
||||
put_fl_mem(node);
|
||||
return 0;
|
||||
}
|
||||
counterN++;
|
||||
} else if (node->nodetype == JFFS2_NODETYPE_CLEANMARKER) {
|
||||
if (node->totlen != sizeof(struct jffs2_unknown_node))
|
||||
@@ -960,7 +1137,7 @@ jffs2_1pass_build_lists(struct part_info * part)
|
||||
counter4++;
|
||||
}
|
||||
/* printf("unknown node magic %4.4x %4.4x @ %lx\n", node->magic, node->nodetype, (unsigned long)node); */
|
||||
|
||||
put_fl_mem(node);
|
||||
}
|
||||
|
||||
putstr("\b\b done.\r\n"); /* close off the dots */
|
||||
@@ -993,6 +1170,7 @@ static u32
|
||||
jffs2_1pass_fill_info(struct b_lists * pL, struct b_jffs2_info * piL)
|
||||
{
|
||||
struct b_node *b;
|
||||
struct jffs2_raw_inode ojNode;
|
||||
struct jffs2_raw_inode *jNode;
|
||||
int i;
|
||||
|
||||
@@ -1004,7 +1182,8 @@ jffs2_1pass_fill_info(struct b_lists * pL, struct b_jffs2_info * piL)
|
||||
|
||||
b = pL->frag.listHead;
|
||||
while (b) {
|
||||
jNode = (struct jffs2_raw_inode *) (b->offset);
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
sizeof(ojNode), &ojNode);
|
||||
if (jNode->compr < JFFS2_NUM_COMPR) {
|
||||
piL->compr_info[jNode->compr].num_frags++;
|
||||
piL->compr_info[jNode->compr].compr_sum += jNode->csize;
|
||||
|
||||
@@ -75,19 +75,19 @@ static void sd_print_item (struct item_head * ih, char * item)
|
||||
time_t ttime;
|
||||
|
||||
if (stat_data_v1 (ih)) {
|
||||
struct stat_data_v1 * sd = (struct stat_data_v1 *)item;
|
||||
ttime = sd_v1_mtime(sd);
|
||||
ctime_r(&ttime, filetime);
|
||||
printf ("%-10s %4hd %6d %6d %9d %24.24s",
|
||||
bb_mode_string(sd_v1_mode(sd)), sd_v1_nlink(sd),sd_v1_uid(sd), sd_v1_gid(sd),
|
||||
sd_v1_size(sd), filetime);
|
||||
struct stat_data_v1 * sd = (struct stat_data_v1 *)item;
|
||||
ttime = sd_v1_mtime(sd);
|
||||
ctime_r(&ttime, filetime);
|
||||
printf ("%-10s %4hd %6d %6d %9d %24.24s",
|
||||
bb_mode_string(sd_v1_mode(sd)), sd_v1_nlink(sd),sd_v1_uid(sd), sd_v1_gid(sd),
|
||||
sd_v1_size(sd), filetime);
|
||||
} else {
|
||||
struct stat_data * sd = (struct stat_data *)item;
|
||||
ttime = sd_v2_mtime(sd);
|
||||
ctime_r(&ttime, filetime);
|
||||
printf ("%-10s %4d %6d %6d %9d %24.24s",
|
||||
bb_mode_string(sd_v2_mode(sd)), sd_v2_nlink(sd),sd_v2_uid(sd),sd_v2_gid(sd),
|
||||
(__u32) sd_v2_size(sd), filetime);
|
||||
ttime = sd_v2_mtime(sd);
|
||||
ctime_r(&ttime, filetime);
|
||||
printf ("%-10s %4d %6d %6d %9d %24.24s",
|
||||
bb_mode_string(sd_v2_mode(sd)), sd_v2_nlink(sd),sd_v2_uid(sd),sd_v2_gid(sd),
|
||||
(__u32) sd_v2_size(sd), filetime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ static int
|
||||
journal_read (int block, int len, char *buffer)
|
||||
{
|
||||
return reiserfs_devread ((INFO->journal_block + block) << INFO->blocksize_shift,
|
||||
0, len, buffer);
|
||||
0, len, buffer);
|
||||
}
|
||||
|
||||
/* Read a block from ReiserFS file system, taking the journal into
|
||||
@@ -247,7 +247,7 @@ journal_init (void)
|
||||
*journal_table++ = desc.j_len;
|
||||
for (i = 0; i < __le32_to_cpu(desc.j_len) && i < JOURNAL_TRANS_HALF; i++)
|
||||
{
|
||||
/* both are in the little endian format */
|
||||
/* both are in the little endian format */
|
||||
*journal_table++ = desc.j_realblock[i];
|
||||
#ifdef REISERDEBUG
|
||||
printf ("block %d is in journal %d.\n",
|
||||
@@ -287,7 +287,7 @@ reiserfs_mount (unsigned part_length)
|
||||
|
||||
if (part_length < superblock + (sizeof (super) >> SECTOR_BITS)
|
||||
|| ! reiserfs_devread (superblock, 0, sizeof (struct reiserfs_super_block),
|
||||
(char *) &super)
|
||||
(char *) &super)
|
||||
|| (substring (REISER3FS_SUPER_MAGIC_STRING, super.s_magic) > 0
|
||||
&& substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0
|
||||
&& substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0)
|
||||
@@ -299,7 +299,7 @@ reiserfs_mount (unsigned part_length)
|
||||
superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS;
|
||||
if (part_length < superblock + (sizeof (super) >> SECTOR_BITS)
|
||||
|| ! reiserfs_devread (superblock, 0, sizeof (struct reiserfs_super_block),
|
||||
(char *) &super))
|
||||
(char *) &super))
|
||||
return 0;
|
||||
|
||||
if (substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0
|
||||
@@ -664,7 +664,7 @@ reiserfs_read (char *buf, unsigned len)
|
||||
* directly without using block_read
|
||||
*/
|
||||
reiserfs_devread (blocknr << INFO->blocksize_shift,
|
||||
blk_offset, to_read, buf);
|
||||
blk_offset, to_read, buf);
|
||||
update_buf_len:
|
||||
len -= to_read;
|
||||
buf += to_read;
|
||||
@@ -717,15 +717,15 @@ reiserfs_dir (char *dirname)
|
||||
|
||||
#ifdef REISERDEBUG
|
||||
printf ("sd_mode=%x sd_size=%d\n",
|
||||
stat_data_v1(INFO->current_ih) ? sd_v1_mode((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_mode((struct stat_data *) (INFO->current_item)),
|
||||
stat_data_v1(INFO->current_ih) ? sd_v1_size((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_size((struct stat_data *) INFO->current_item)
|
||||
);
|
||||
stat_data_v1(INFO->current_ih) ? sd_v1_mode((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_mode((struct stat_data *) (INFO->current_item)),
|
||||
stat_data_v1(INFO->current_ih) ? sd_v1_size((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_size((struct stat_data *) INFO->current_item)
|
||||
);
|
||||
|
||||
#endif /* REISERDEBUG */
|
||||
mode = stat_data_v1(INFO->current_ih) ?
|
||||
sd_v1_mode((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v1_mode((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_mode((struct stat_data *) INFO->current_item);
|
||||
|
||||
/* If we've got a symbolic link, then chase it. */
|
||||
@@ -740,8 +740,8 @@ reiserfs_dir (char *dirname)
|
||||
|
||||
/* Get the symlink size. */
|
||||
filemax = stat_data_v1(INFO->current_ih) ?
|
||||
sd_v1_size((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_size((struct stat_data *) INFO->current_item);
|
||||
sd_v1_size((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_size((struct stat_data *) INFO->current_item);
|
||||
|
||||
/* Find out how long our remaining name is. */
|
||||
len = 0;
|
||||
@@ -760,7 +760,7 @@ reiserfs_dir (char *dirname)
|
||||
|
||||
INFO->fileinfo.k_dir_id = dir_id;
|
||||
INFO->fileinfo.k_objectid = objectid;
|
||||
filepos = 0;
|
||||
filepos = 0;
|
||||
if (! next_key ()
|
||||
|| reiserfs_read (linkbuf, filemax) != filemax)
|
||||
{
|
||||
@@ -804,8 +804,8 @@ reiserfs_dir (char *dirname)
|
||||
|
||||
filepos = 0;
|
||||
filemax = stat_data_v1(INFO->current_ih) ?
|
||||
sd_v1_size((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_size((struct stat_data *) INFO->current_item);
|
||||
sd_v1_size((struct stat_data_v1 *) INFO->current_item) :
|
||||
sd_v2_size((struct stat_data *) INFO->current_item);
|
||||
#if 0
|
||||
/* If this is a new stat data and size is > 4GB set filemax to
|
||||
* maximum
|
||||
@@ -879,22 +879,22 @@ reiserfs_dir (char *dirname)
|
||||
if (cmp <= 0)
|
||||
{
|
||||
char fn[PATH_MAX];
|
||||
struct fsys_reiser_info info_save;
|
||||
struct fsys_reiser_info info_save;
|
||||
|
||||
if (print_possibilities > 0)
|
||||
print_possibilities = -print_possibilities;
|
||||
*name_end = 0;
|
||||
strcpy(fn, filename);
|
||||
*name_end = tmp;
|
||||
*name_end = tmp;
|
||||
|
||||
/* If NAME is "." or "..", do not count it. */
|
||||
if (strcmp (fn, ".") != 0 && strcmp (fn, "..") != 0) {
|
||||
memcpy(&info_save, INFO, sizeof(struct fsys_reiser_info));
|
||||
search_stat (deh_dir_id(de_head), deh_objectid(de_head));
|
||||
sd_print_item(INFO->current_ih, INFO->current_item);
|
||||
printf(" %s\n", fn);
|
||||
search_stat (dir_id, objectid);
|
||||
memcpy(INFO, &info_save, sizeof(struct fsys_reiser_info));
|
||||
if (strcmp (fn, ".") != 0 && strcmp (fn, "..") != 0) {
|
||||
memcpy(&info_save, INFO, sizeof(struct fsys_reiser_info));
|
||||
search_stat (deh_dir_id(de_head), deh_objectid(de_head));
|
||||
sd_print_item(INFO->current_ih, INFO->current_item);
|
||||
printf(" %s\n", fn);
|
||||
search_stat (dir_id, objectid);
|
||||
memcpy(INFO, &info_save, sizeof(struct fsys_reiser_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,13 +157,13 @@ struct offset_v2 {
|
||||
*/
|
||||
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
/* little endian version */
|
||||
__u64 k_offset:60;
|
||||
__u64 k_type: 4;
|
||||
/* little endian version */
|
||||
__u64 k_offset:60;
|
||||
__u64 k_type: 4;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
/* big endian version */
|
||||
__u64 k_type: 4;
|
||||
__u64 k_offset:60;
|
||||
/* big endian version */
|
||||
__u64 k_type: 4;
|
||||
__u64 k_offset:60;
|
||||
#else
|
||||
#error "__LITTLE_ENDIAN_BITFIELD or __BIG_ENDIAN_BITFIELD must be defined"
|
||||
#endif
|
||||
@@ -368,7 +368,7 @@ struct reiserfs_de_head
|
||||
__u32 deh_dir_id; /* objectid of the parent directory of the
|
||||
object, that is referenced by directory entry */
|
||||
__u32 deh_objectid;/* objectid of the object, that is referenced by
|
||||
directory entry */
|
||||
directory entry */
|
||||
__u16 deh_location;/* offset of name in the whole item */
|
||||
__u16 deh_state; /* whether 1) entry contains stat data (for
|
||||
future), and 2) whether entry is hidden
|
||||
|
||||
@@ -473,7 +473,11 @@ typedef struct comm_proc {
|
||||
union fec_lcd fl_un;
|
||||
#define cp_fec fl_un.fl_un_fec
|
||||
#define lcd_cmap fl_un.fl_un_cmap
|
||||
char res18[0x1000];
|
||||
char res18[0xE00];
|
||||
|
||||
/* The DUET family has a second FEC here */
|
||||
fec_t cp_fec2;
|
||||
#define cp_fec1 cp_fec /* consistency macro */
|
||||
|
||||
/* Dual Ported RAM follows.
|
||||
* There are many different formats for this memory area
|
||||
|
||||
@@ -83,9 +83,14 @@
|
||||
* downloading RAM microcode.
|
||||
*/
|
||||
#define CPM_DATAONLY_BASE ((uint)128)
|
||||
#define CPM_DATAONLY_SIZE ((uint)(16 * 1024) - CPM_DATAONLY_BASE)
|
||||
#define CPM_DP_NOSPACE ((uint)0x7fffffff)
|
||||
#ifndef CONFIG_MPC8272_FAMILY
|
||||
#define CPM_DATAONLY_SIZE ((uint)(8 * 1024) - CPM_DATAONLY_BASE)
|
||||
#define CPM_FCC_SPECIAL_BASE ((uint)0x0000b000)
|
||||
#else /* 8247/48/71/72 */
|
||||
#define CPM_DATAONLY_SIZE ((uint)(4 * 1024) - CPM_DATAONLY_BASE)
|
||||
#define CPM_FCC_SPECIAL_BASE ((uint)0x00009000)
|
||||
#endif /* !CONFIG_MPC8272_FAMILY */
|
||||
|
||||
/* The number of pages of host memory we allocate for CPM. This is
|
||||
* done early in kernel initialization to get physically contiguous
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
#define CFG_CMD_ITEST 0x0040000000000000U /* Integer (and string) test */
|
||||
#define CFG_CMD_NFS 0x0080000000000000U /* NFS support */
|
||||
#define CFG_CMD_REISER 0x0100000000000000U /* Reiserfs support */
|
||||
#define CFG_CMD_CDP 0x0200000000000000U /* Cisco Discovery Protocol */
|
||||
|
||||
#define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFU /* ALL commands */
|
||||
|
||||
@@ -131,7 +132,8 @@
|
||||
CFG_CMD_SDRAM | \
|
||||
CFG_CMD_SPI | \
|
||||
CFG_CMD_USB | \
|
||||
CFG_CMD_VFD )
|
||||
CFG_CMD_VFD | \
|
||||
CFG_CMD_CDP )
|
||||
|
||||
/* Default configuration
|
||||
*/
|
||||
|
||||
@@ -46,6 +46,10 @@ struct cmd_tbl_s {
|
||||
#ifdef CFG_LONGHELP
|
||||
char *help; /* Help message (long) */
|
||||
#endif
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
/* do auto completion on the arguments */
|
||||
int (*complete)(int argc, char *argv[], char last_char, int maxv, char *cmdv[]);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct cmd_tbl_s cmd_tbl_t;
|
||||
@@ -57,6 +61,11 @@ extern cmd_tbl_t __u_boot_cmd_end;
|
||||
/* common/command.c */
|
||||
cmd_tbl_t *find_cmd(const char *cmd);
|
||||
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
extern void install_auto_complete(void);
|
||||
extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Monitor Command
|
||||
*
|
||||
|
||||
@@ -64,6 +64,15 @@ typedef volatile unsigned char vu_char;
|
||||
#elif defined(CONFIG_5xx)
|
||||
#include <asm/5xx_immap.h>
|
||||
#elif defined(CONFIG_8260)
|
||||
#if defined(CONFIG_MPC8247) \
|
||||
|| defined(CONFIG_MPC8248) \
|
||||
|| defined(CONFIG_MPC8271) \
|
||||
|| defined(CONFIG_MPC8272)
|
||||
#define CONFIG_MPC8272_FAMILY 1
|
||||
#endif
|
||||
#if defined(CONFIG_MPC8272_FAMILY)
|
||||
#define CONFIG_MPC8260 1
|
||||
#endif
|
||||
#include <asm/immap_8260.h>
|
||||
#endif
|
||||
#ifdef CONFIG_MPC85xx
|
||||
@@ -196,6 +205,10 @@ void setenv (char *, char *);
|
||||
# include <asm/u-boot-i386.h>
|
||||
#endif /* CONFIG_I386 */
|
||||
|
||||
#ifdef CONFIG_AUTO_COMPLETE
|
||||
int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
|
||||
#endif
|
||||
|
||||
void pci_init (void);
|
||||
void pci_init_board(void);
|
||||
void pciinfo (int, int);
|
||||
|
||||
@@ -980,10 +980,10 @@ typedef struct scc_enet {
|
||||
|
||||
#endif /* CONFIG_IVMS8, CONFIG_IVML24 */
|
||||
|
||||
/*** KUP4K *********************************************************/
|
||||
/* The KUP4K uses the FEC on a MPC855T for Ethernet */
|
||||
/*** KUP4K, KUP4X ****************************************************/
|
||||
/* The KUP4 boards uses the FEC on a MPC8xx for Ethernet */
|
||||
|
||||
#if defined(CONFIG_KUP4K)
|
||||
#if defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
|
||||
|
||||
#define FEC_ENET /* use FEC for EThernet */
|
||||
#undef SCC_ENET
|
||||
|
||||
@@ -232,7 +232,10 @@
|
||||
* Ethernet configuration
|
||||
*/
|
||||
#define CONFIG_MPC5xxx_FEC 1
|
||||
#define CONFIG_FEC_10MBIT 1 /* Workaround for FEC 100Mbit problem */
|
||||
/*
|
||||
* Define CONFIG_FEC_10MBIT to force FEC at 10Mb
|
||||
*/
|
||||
/* #define CONFIG_FEC_10MBIT 1 */
|
||||
#define CONFIG_PHY_ADDR 0x00
|
||||
|
||||
/*
|
||||
@@ -278,10 +281,10 @@
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
|
||||
#define CFG_BOOTCS_START 0xFF800000
|
||||
#define CFG_BOOTCS_START (CFG_CS1_START + CFG_CS1_SIZE)
|
||||
#define CFG_BOOTCS_SIZE 0x00800000
|
||||
#define CFG_BOOTCS_CFG 0x00047801
|
||||
#define CFG_CS1_START 0xFF000000
|
||||
#define CFG_CS1_START CFG_FLASH_BASE
|
||||
#define CFG_CS1_SIZE 0x00800000
|
||||
#define CFG_CS1_CFG 0x00047800
|
||||
|
||||
|
||||
304
include/configs/JSE.h
Normal file
304
include/configs/JSE.h
Normal file
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
* (C) Copyright 2003 Picture Elements, Inc.
|
||||
* Stephen Williams <steve@icarus.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
|
||||
*/
|
||||
|
||||
/*
|
||||
* board/config.h - configuration options, board specific
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
/*
|
||||
* High Level Configuration Options for the JSE board
|
||||
* (Theoretically easy to change, but the board is fixed.)
|
||||
*/
|
||||
|
||||
#define CONFIG_JSE 1
|
||||
/* JSE has a PPC405GPr */
|
||||
#define CONFIG_405GP 1
|
||||
/* ... which is a 4xxx series */
|
||||
#define CONFIG_4xx 1
|
||||
/* ... with a 33MHz OSC. connected to the SysCLK input */
|
||||
#define CONFIG_SYS_CLK_FREQ 33333333
|
||||
/* ... with on-chip memory here (4KBytes) */
|
||||
#define CFG_OCM_DATA_ADDR 0xF4000000
|
||||
#define CFG_OCM_DATA_SIZE 0x00001000
|
||||
/* Do not set up locked dcache as init ram. */
|
||||
#undef CFG_INIT_DCACHE_CS
|
||||
|
||||
/* Map the SystemACE chip (CS#1) here. (Must be a multiple of 1Meg) */
|
||||
#define CONFIG_SYSTEMACE 1
|
||||
#define CFG_SYSTEMACE_BASE 0xf0000000
|
||||
#define CONFIG_DOS_PARTITION 1
|
||||
|
||||
/* Use the On-Chip-Memory (OCM) as a temporary stack for the startup code. */
|
||||
#define CFG_TEMP_STACK_OCM 1
|
||||
/* ... place INIT RAM in the OCM address */
|
||||
# define CFG_INIT_RAM_ADDR CFG_OCM_DATA_ADDR
|
||||
/* ... give it the whole init ram */
|
||||
# define CFG_INIT_RAM_END CFG_OCM_DATA_SIZE
|
||||
/* ... Shave a bit off the end for global data */
|
||||
# define CFG_GBL_DATA_SIZE 128
|
||||
# define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
/* ... and place the stack pointer at the top of what's left. */
|
||||
# define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
|
||||
/* Enable board_pre_init function */
|
||||
#define CONFIG_BOARD_PRE_INIT 1
|
||||
#define CONFIG_BOARD_EARLY_INIT_F 1
|
||||
/* Disable post-clk setup init function */
|
||||
#undef CONFIG_BOARD_POSTCLK_INIT
|
||||
/* Disable call to post_init_f: late init function. */
|
||||
#undef CONFIG_POST
|
||||
/* Enable DRAM test. */
|
||||
#define CFG_DRAM_TEST 1
|
||||
/* Enable misc_init_r function. */
|
||||
#define CONFIG_MISC_INIT_R 1
|
||||
|
||||
/* JSE has EEPROM chips that are good for environment. */
|
||||
#undef CFG_ENV_IS_IN_NVRAM
|
||||
#undef CFG_ENV_IS_IN_FLASH
|
||||
#define CFG_ENV_IS_IN_EEPROM 1
|
||||
#undef CFG_ENV_IS_NOWHERE
|
||||
|
||||
/* This is the 7bit address of the device, not including P. */
|
||||
#define CFG_I2C_EEPROM_ADDR 0x50
|
||||
/* After the device address, need one more address byte. */
|
||||
#define CFG_I2C_EEPROM_ADDR_LEN 1
|
||||
/* The EEPROM is 512 bytes. */
|
||||
#define CFG_EEPROM_SIZE 512
|
||||
/* The EEPROM can do 16byte ( 1 << 4 ) page writes. */
|
||||
#define CFG_EEPROM_PAGE_WRITE_BITS 4
|
||||
#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
|
||||
/* Put the environment in the second half. */
|
||||
#define CFG_ENV_OFFSET 0x00
|
||||
#define CFG_ENV_SIZE 512
|
||||
|
||||
|
||||
/* The JSE connects UART1 to the console tap connector. */
|
||||
#define CONFIG_UART1_CONSOLE 1
|
||||
/* Set console baudrate to 9600 */
|
||||
#define CONFIG_BAUDRATE 9600
|
||||
|
||||
/* Size (bytes) of interrupt driven serial port buffer.
|
||||
* Set to 0 to use polling instead of interrupts.
|
||||
* Setting to 0 will also disable RTS/CTS handshaking.
|
||||
*/
|
||||
#undef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
|
||||
/*
|
||||
* Configuration related to auto-boot.
|
||||
*
|
||||
* CONFIG_BOOTDELAY sets the delay (in seconds) that U-Boot will wait
|
||||
* before resorting to autoboot. This value can be overridden by the
|
||||
* bootdelay environment variable.
|
||||
*
|
||||
* CONFIG_AUTOBOOT_PROMPT is the string that U-Boot emits to warn the
|
||||
* user that an autoboot will happen.
|
||||
*
|
||||
* CONFIG_BOOTCOMMAND is the sequence of commands that U-Boot will
|
||||
* execute to boot the JSE. This loads the uimage and initrd.img files
|
||||
* from CompactFlash into memory, then boots them from memory.
|
||||
*
|
||||
* CONFIG_BOOTARGS is the arguments passed to the Linux kernel to get
|
||||
* it going on the JSE.
|
||||
*/
|
||||
#define CONFIG_BOOTDELAY 5
|
||||
#define CONFIG_BOOTARGS "root=/dev/ram0 init=/linuxrc rw"
|
||||
#define CONFIG_BOOTCOMMAND "fatload ace 0 2000000 uimage; fatload ace 0 2100000 initrd.img; bootm 2000000 2100000"
|
||||
|
||||
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
|
||||
|
||||
#define CONFIG_MII 1 /* MII PHY management */
|
||||
#define CONFIG_PHY_ADDR 1 /* PHY address */
|
||||
|
||||
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
|
||||
CFG_CMD_PCI | \
|
||||
CFG_CMD_IRQ | \
|
||||
CFG_CMD_FLASH | \
|
||||
CFG_CMD_NET | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_PING | \
|
||||
CFG_CMD_MII | \
|
||||
CFG_CMD_EEPROM | \
|
||||
CFG_CMD_FAT | \
|
||||
CFG_CMD_ELF )
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
/* watchdog disabled */
|
||||
#undef CONFIG_WATCHDOG
|
||||
/* SPD EEPROM (sdram speed config) disabled */
|
||||
#undef CONFIG_SPD_EEPRO
|
||||
#undef SPD_EEPROM_ADDRESS
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "=> " /* Monitor Command Prompt */
|
||||
|
||||
#define CFG_HUSH_PARSER /* use "hush" command parser */
|
||||
#ifdef CFG_HUSH_PARSER
|
||||
#define CFG_PROMPT_HUSH_PS2 "> "
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#else
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#endif
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
|
||||
|
||||
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
|
||||
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
|
||||
|
||||
/*
|
||||
* If CFG_EXT_SERIAL_CLOCK, then the UART divisor is 1.
|
||||
* If CFG_405_UART_ERRATA_59, then UART divisor is 31.
|
||||
* Otherwise, UART divisor is determined by CPU Clock and CFG_BASE_BAUD value.
|
||||
* The Linux BASE_BAUD define should match this configuration.
|
||||
* baseBaud = cpuClock/(uartDivisor*16)
|
||||
* If CFG_405_UART_ERRATA_59 and 200MHz CPU clock,
|
||||
* set Linux BASE_BAUD to 403200.
|
||||
*/
|
||||
#undef CFG_EXT_SERIAL_CLOCK /* external serial clock */
|
||||
#undef CFG_405_UART_ERRATA_59 /* 405GP/CR Rev. D silicon */
|
||||
#define CFG_BASE_BAUD 691200
|
||||
|
||||
/* The following table includes the supported baudrates */
|
||||
#define CFG_BAUDRATE_TABLE \
|
||||
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
|
||||
|
||||
#define CFG_LOAD_ADDR 0x100000 /* default load address */
|
||||
#define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
|
||||
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
||||
#define CONFIG_HARD_I2C 1 /* I2C with hardware support */
|
||||
#undef CONFIG_SOFT_I2C /* I2C bit-banged */
|
||||
#define CFG_I2C_SPEED 400000 /* I2C speed and slave address */
|
||||
#define CFG_I2C_SLAVE 0x7F
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PCI stuff
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
#define PCI_HOST_ADAPTER 0 /* configure ar pci adapter */
|
||||
#define PCI_HOST_FORCE 1 /* configure as pci host */
|
||||
#define PCI_HOST_AUTO 2 /* detected via arbiter enable */
|
||||
|
||||
#define CONFIG_PCI /* include pci support */
|
||||
#define CONFIG_PCI_HOST PCI_HOST_FORCE /* select pci host function */
|
||||
#undef CONFIG_PCI_PNP /* do pci plug-and-play */
|
||||
/* resource configuration */
|
||||
|
||||
#define CFG_PCI_SUBSYS_VENDORID 0x0000 /* PCI Vendor ID: to-do!!! */
|
||||
#define CFG_PCI_SUBSYS_DEVICEID 0x0000 /* PCI Device ID: to-do!!! */
|
||||
#define CFG_PCI_PTM1LA 0x00000000 /* point to sdram */
|
||||
#define CFG_PCI_PTM1MS 0x80000001 /* 2GB, enable hard-wired to 1 */
|
||||
#define CFG_PCI_PTM1PCI 0x00000000 /* Host: use this pci address */
|
||||
#define CFG_PCI_PTM2LA 0x00000000 /* disabled */
|
||||
#define CFG_PCI_PTM2MS 0x00000000 /* disabled */
|
||||
#define CFG_PCI_PTM2PCI 0x04000000 /* Host: use this pci address */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* External peripheral base address
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
#undef CONFIG_IDE_LED /* no led for ide supported */
|
||||
#undef CONFIG_IDE_RESET /* no reset for ide supported */
|
||||
|
||||
#define CFG_KEY_REG_BASE_ADDR 0xF0100000
|
||||
#define CFG_IR_REG_BASE_ADDR 0xF0200000
|
||||
#define CFG_FPGA_REG_BASE_ADDR 0xF0300000
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Start addresses for the final memory configuration
|
||||
* (Set up by the startup code)
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_FLASH_BASE 0xFFF80000
|
||||
#define CFG_MONITOR_BASE CFG_FLASH_BASE
|
||||
#define CFG_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Monitor */
|
||||
#define CFG_MALLOC_LEN (128 * 1024) /* Reserve 128 kB for malloc() */
|
||||
|
||||
/*
|
||||
* For booting Linux, the board info and command line data
|
||||
* have to be in the first 8 MB of memory, since this is
|
||||
* the maximum mapped by the Linux kernel during initialization.
|
||||
*/
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* FLASH organization
|
||||
*/
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
|
||||
#define CFG_MAX_FLASH_SECT 256 /* max number of sectors on one chip */
|
||||
|
||||
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
|
||||
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Cache Configuration
|
||||
*/
|
||||
#define CFG_DCACHE_SIZE 16384 /* For IBM 405GPr CPUs */
|
||||
#define CFG_CACHELINE_SIZE 32 /* ... */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Init Memory Controller:
|
||||
*
|
||||
* BR0/1 and OR0/1 (FLASH)
|
||||
*/
|
||||
|
||||
#define FLASH_BASE0_PRELIM CFG_FLASH_BASE /* FLASH bank #0 */
|
||||
#define FLASH_BASE1_PRELIM 0 /* FLASH bank #1 */
|
||||
|
||||
|
||||
/* Configuration Port location */
|
||||
#define CONFIG_PORT_ADDR 0xF0000500
|
||||
|
||||
|
||||
/*
|
||||
* Internal Definitions
|
||||
*
|
||||
* Boot Flags
|
||||
*/
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */
|
||||
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
|
||||
#endif
|
||||
#endif /* __CONFIG_H */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2000, 2001, 2002
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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
|
||||
@@ -38,7 +38,7 @@
|
||||
#define CONFIG_MPC855 1 /* This is a MPC855 CPU */
|
||||
#define CONFIG_KUP4K 1 /* ...on a KUP4K module */
|
||||
|
||||
#define CONFIG_8xx_CONS_SMC1 1 /* Console is on SMC1 */
|
||||
#define CONFIG_8xx_CONS_SMC1 1 /* Console is on SMC1 */
|
||||
#undef CONFIG_8xx_CONS_SMC2
|
||||
#undef CONFIG_8xx_CONS_NONE
|
||||
#define CONFIG_BAUDRATE 115200 /* console baudrate */
|
||||
@@ -48,7 +48,7 @@
|
||||
#define CONFIG_BOOTDELAY 1 /* autoboot after 1 second */
|
||||
#endif
|
||||
|
||||
#define CONFIG_CLOCKS_IN_MHZ 1 /* clocks passsed to Linux in MHz */
|
||||
#define CONFIG_CLOCKS_IN_MHZ 1 /* clocks passsed to Linux in MHz */
|
||||
|
||||
#define CONFIG_BOARD_TYPES 1 /* support board types */
|
||||
|
||||
@@ -56,35 +56,38 @@
|
||||
#undef CONFIG_BOOTARGS
|
||||
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"slot_a_boot=setenv bootargs root=/dev/hda2 ip=off panic=1;\
|
||||
diskboot 200000 0:1; bootm 200000\0" \
|
||||
"slot_b_boot=setenv bootargs root=/dev/hda2 ip=off panic=1;\
|
||||
diskboot 200000 2:1; bootm 200000\0" \
|
||||
"nfs_boot=dhcp; run nfsargs addip; bootm 200000\0" \
|
||||
"panic_boot=echo No Bootdevice !!! reset\0" \
|
||||
"nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(nfsip):$(rootpath)\0" \
|
||||
"ramargs=setenv bootargs root=/dev/ram rw\0" \
|
||||
"addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(nfsip):$(gatewayip)\
|
||||
:$(netmask):$(hostname):$(netdev):off panic=1\0" \
|
||||
"netdev=eth0\0" \
|
||||
"load=tftp 200000 bootloader.bitmap;tftp 100000 u-boot.bin\0" \
|
||||
"update=protect off 1:0-8;era 1:0-8;cp.b 100000 40000000 $(filesize);\
|
||||
cp.b 200000 40040000 14000\0" \
|
||||
"nfsip=192.168.2.19\0"
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"slot_a_boot=setenv bootargs root=/dev/hda2 ip=off;" \
|
||||
"run addhw; diskboot 200000 0:1; bootm 200000\0" \
|
||||
"slot_b_boot=setenv bootargs root=/dev/hda2 ip=off;" \
|
||||
"run addhw; diskboot 200000 2:1; bootm 200000\0" \
|
||||
"nfs_boot=dhcp; run nfsargs addip addhw; bootm 200000\0" \
|
||||
"panic_boot=echo No Bootdevice !!! reset\0" \
|
||||
"nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath)\0" \
|
||||
"ramargs=setenv bootargs root=/dev/ram rw\0" \
|
||||
"addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip)" \
|
||||
":$(netmask):$(hostname):$(netdev):off\0" \
|
||||
"addhw=setenv bootargs $(bootargs) hw=$(hw) key1=$(key1) panic=1\0" \
|
||||
"netdev=eth0\0" \
|
||||
"contrast=55\0" \
|
||||
"silent=1\0" \
|
||||
"load=tftp 200000 bootloader-4k.bitmap;tftp 100000 bootloader-4k.bin\0" \
|
||||
"update=protect off 1:0-5;era 1:0-5;cp.b 100000 40000000 $(filesize);" \
|
||||
"cp.b 200000 40040000 14000\0"
|
||||
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"run slot_a_boot;run slot_b_boot;run nfs_boot;run panic_boot"
|
||||
|
||||
|
||||
#define CONFIG_MISC_INIT_R 1
|
||||
#define CONFIG_MISC_INIT_R 1
|
||||
#define CONFIG_MISC_INIT_F 1
|
||||
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */
|
||||
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
|
||||
#define CONFIG_STATUS_LED 1 /* Status LED enabled */
|
||||
#define CONFIG_STATUS_LED 1 /* Status LED enabled */
|
||||
|
||||
#undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */
|
||||
|
||||
@@ -93,10 +96,14 @@ cp.b 200000 40040000 14000\0"
|
||||
#define CONFIG_MAC_PARTITION
|
||||
#define CONFIG_DOS_PARTITION
|
||||
|
||||
#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */
|
||||
#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */
|
||||
|
||||
#define CONFIG_ETHADDR 00:0B:64:00:00:00 /* our OUI from IEEE */
|
||||
#define CONFIG_KUP4K_LOGO 0x40040000 /* Address of logo bitmap */
|
||||
#define CONFIG_HARD_I2C
|
||||
#define CFG_I2C_SPEED 40000
|
||||
#define CFG_I2C_SLAVE 0x7F
|
||||
|
||||
#define CONFIG_ETHADDR 00:0B:64:00:00:00 /* our OUI from IEEE */
|
||||
#define CONFIG_KUP4K_LOGO 0x40040000 /* Address of logo bitmap */
|
||||
|
||||
/* Define to allow the user to overwrite serial and ethaddr */
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
@@ -104,6 +111,7 @@ cp.b 200000 40040000 14000\0"
|
||||
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_IDE | \
|
||||
CFG_CMD_I2C | \
|
||||
CFG_CMD_DATE )
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
@@ -112,25 +120,25 @@ cp.b 200000 40040000 14000\0"
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "=> " /* Monitor Command Prompt */
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "=> " /* Monitor Command Prompt */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#else
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#endif
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
|
||||
|
||||
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
|
||||
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
|
||||
#define CFG_MEMTEST_START 0x000400000 /* memtest works on */
|
||||
#define CFG_MEMTEST_END 0x002C00000 /* 4 ... 44 MB in DRAM */
|
||||
|
||||
#define CFG_LOAD_ADDR 0x200000 /* default load address */
|
||||
#define CFG_LOAD_ADDR 0x200000 /* default load address */
|
||||
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
||||
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
|
||||
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 115200 }
|
||||
|
||||
#define CFG_CONSOLE_INFO_QUIET 1
|
||||
|
||||
@@ -148,42 +156,42 @@ cp.b 200000 40040000 14000\0"
|
||||
* Definitions for initial stack pointer and data area (in DPRAM)
|
||||
*/
|
||||
#define CFG_INIT_RAM_ADDR CFG_IMMR
|
||||
#define CFG_INIT_RAM_END 0x2F00 /* End of used area in DPRAM */
|
||||
#define CFG_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
|
||||
#define CFG_INIT_RAM_END 0x2F00 /* End of used area in DPRAM */
|
||||
#define CFG_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
|
||||
#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Start addresses for the final memory configuration
|
||||
* (Set up by the startup code)
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_FLASH_BASE 0x40000000
|
||||
#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */
|
||||
#define CFG_MONITOR_LEN (192 << 10) /* Reserve 192 kB for Monitor */
|
||||
#define CFG_MONITOR_BASE CFG_FLASH_BASE
|
||||
#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */
|
||||
#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */
|
||||
|
||||
/*
|
||||
* For booting Linux, the board info and command line data
|
||||
* have to be in the first 8 MB of memory, since this is
|
||||
* the maximum mapped by the Linux kernel during initialization.
|
||||
*/
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* FLASH organization
|
||||
*/
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
|
||||
#define CFG_MAX_FLASH_SECT 67 /* max number of sectors on one chip */
|
||||
#define CFG_MAX_FLASH_SECT 19 /* max number of sectors on one chip */
|
||||
|
||||
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
|
||||
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_OFFSET 0x8000 /* Offset of Environment Sector */
|
||||
#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
|
||||
#define CFG_ENV_SECT_SIZE 0x8000
|
||||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_OFFSET 0x30000 /* Offset of Environment Sector */
|
||||
#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
|
||||
#define CFG_ENV_SECT_SIZE 0x10000
|
||||
|
||||
/* Address and size of Redundant Environment Sector */
|
||||
#if 0
|
||||
@@ -195,7 +203,7 @@ cp.b 200000 40040000 14000\0"
|
||||
*/
|
||||
#if 0
|
||||
#define CFG_HWINFO_OFFSET 0x0003FFC0 /* offset of HW Info block */
|
||||
#define CFG_HWINFO_SIZE 0x00000040 /* size of HW Info block */
|
||||
#define CFG_HWINFO_SIZE 0x00000040 /* size of HW Info block */
|
||||
#define CFG_HWINFO_MAGIC 0x54514D38 /* 'TQM8' */
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------
|
||||
@@ -275,7 +283,7 @@ cp.b 200000 40040000 14000\0"
|
||||
*/
|
||||
|
||||
/* KUP4K use both slots, SLOT_A as "primary". */
|
||||
#define CONFIG_PCMCIA_SLOT_A 1
|
||||
#define CONFIG_PCMCIA_SLOT_A 1
|
||||
|
||||
#define CFG_PCMCIA_MEM_ADDR (0xE0000000)
|
||||
#define CFG_PCMCIA_MEM_SIZE ( 64 << 20 )
|
||||
@@ -293,10 +301,10 @@ cp.b 200000 40040000 14000\0"
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define CONFIG_IDE_8xx_PCCARD 1 /* Use IDE with PC Card Adapter */
|
||||
#define CONFIG_IDE_8xx_PCCARD 1 /* Use IDE with PC Card Adapter */
|
||||
|
||||
#undef CONFIG_IDE_8xx_DIRECT /* Direct IDE not supported */
|
||||
#define CONFIG_IDE_LED 1 /* LED for ide supported */
|
||||
#undef CONFIG_IDE_8xx_DIRECT /* Direct IDE not supported */
|
||||
#define CONFIG_IDE_LED 1 /* LED for ide supported */
|
||||
#undef CONFIG_IDE_RESET /* reset for ide not supported */
|
||||
|
||||
#define CFG_IDE_MAXBUS 2
|
||||
@@ -323,7 +331,7 @@ cp.b 200000 40040000 14000\0"
|
||||
*-----------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
#define CFG_DER 0
|
||||
#define CFG_DER 0
|
||||
|
||||
/*
|
||||
* Init Memory Controller:
|
||||
@@ -350,29 +358,9 @@ cp.b 200000 40040000 14000\0"
|
||||
#define CFG_BR0_PRELIM ((FLASH_BASE0_PRELIM & BR_BA_MSK) | BR_PS_16 | BR_V )
|
||||
|
||||
|
||||
/*
|
||||
* BR2/3 and OR2/3 (SDRAM)
|
||||
*
|
||||
*/
|
||||
#define SDRAM_BASE1_PRELIM 0x00000000 /* SDRAM bank #0 */
|
||||
#define SDRAM_BASE2_PRELIM 0x20000000 /* SDRAM bank #1 */
|
||||
#define SDRAM_BASE3_PRELIM 0x30000000 /* SDRAM bank #2 */
|
||||
#define SDRAM_MAX_SIZE 0x04000000 /* max 648 MB per bank */
|
||||
|
||||
/* SDRAM timing: Multiplexed addresses, GPL5 output to GPL5_A (don't care) */
|
||||
#define CFG_OR_TIMING_SDRAM 0x00000A00
|
||||
|
||||
#if 0
|
||||
#define CFG_OR1_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_SDRAM )
|
||||
#define CFG_BR1_PRELIM ((SDRAM_BASE1_PRELIM & BR_BA_MSK) | BR_MS_UPMA | BR_V )
|
||||
|
||||
#define CFG_OR2_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_SDRAM )
|
||||
#define CFG_BR2_PRELIM ((SDRAM_BASE2_PRELIM & BR_BA_MSK) | BR_MS_UPMA | BR_V )
|
||||
|
||||
#define CFG_OR3_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_SDRAM )
|
||||
#define CFG_BR3_PRELIM ((SDRAM_BASE3_PRELIM & BR_BA_MSK) | BR_MS_UPMA | BR_V )
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Memory Periodic Timer Prescaler
|
||||
@@ -388,11 +376,11 @@ cp.b 200000 40040000 14000\0"
|
||||
* gclk CPU clock (not bus clock!)
|
||||
* Trefresh Refresh cycle * 4 (four word bursts used)
|
||||
*
|
||||
* 4096 Rows from SDRAM example configuration
|
||||
* 1000 factor s -> ms
|
||||
* 32 PTP (pre-divider from MPTPR) from SDRAM example configuration
|
||||
* 4 Number of refresh cycles per period
|
||||
* 64 Refresh cycle in ms per number of rows
|
||||
* 4096 Rows from SDRAM example configuration
|
||||
* 1000 factor s -> ms
|
||||
* 32 PTP (pre-divider from MPTPR) from SDRAM example configuration
|
||||
* 4 Number of refresh cycles per period
|
||||
* 64 Refresh cycle in ms per number of rows
|
||||
* --------------------------------------------
|
||||
* Divider = 4096 * 32 * 1000 / (4 * 64) = 512000
|
||||
*
|
||||
@@ -428,7 +416,7 @@ cp.b 200000 40040000 14000\0"
|
||||
*
|
||||
* Boot Flags
|
||||
*/
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||
|
||||
|
||||
@@ -437,6 +425,6 @@ cp.b 200000 40040000 14000\0"
|
||||
#define CONFIG_AUTOBOOT_PROMPT "Boote in %d Sekunden - stop mit \"2\"\n"
|
||||
#endif
|
||||
#define CONFIG_AUTOBOOT_STOP_STR "." /* easy to stop for now */
|
||||
|
||||
#define CONFIG_SILENT_CONSOLE 1
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
|
||||
389
include/configs/KUP4X.h
Normal file
389
include/configs/KUP4X.h
Normal file
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* board/config.h - configuration options, board specific
|
||||
* Derived from ../tqm8xx/tqm8xx.c
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
/*
|
||||
* High Level Configuration Options
|
||||
* (easy to change)
|
||||
*/
|
||||
|
||||
#define CONFIG_MPC859T 1 /* This is a MPC859T CPU */
|
||||
#define CONFIG_KUP4X 1 /* ...on a KUP4X module */
|
||||
|
||||
#define CONFIG_8xx_CONS_SMC1 1 /* Console is on SMC1 */
|
||||
#undef CONFIG_8xx_CONS_SMC2
|
||||
#undef CONFIG_8xx_CONS_NONE
|
||||
#define CONFIG_BAUDRATE 115200 /* console baudrate */
|
||||
#if 0
|
||||
#define CONFIG_BOOTDELAY -1 /* autoboot disabled */
|
||||
#else
|
||||
#define CONFIG_BOOTDELAY 1 /* autoboot after 1 second */
|
||||
#endif
|
||||
|
||||
#define CONFIG_CLOCKS_IN_MHZ 1 /* clocks passsed to Linux in MHz */
|
||||
|
||||
#define CONFIG_BOARD_TYPES 1 /* support board types */
|
||||
|
||||
#define CFG_8XX_FACT 8 /* Multiply by 8 */
|
||||
#define CFG_8XX_XIN 16000000 /* 16 MHz in */
|
||||
|
||||
|
||||
#define MPC8XX_HZ ((CFG_8XX_XIN) * (CFG_8XX_FACT))
|
||||
|
||||
/* should ALWAYS define this, measure_gclk in speed.c is unreliable */
|
||||
/* in general, we always know this for FADS+new ADS anyway */
|
||||
#define CONFIG_8xx_GCLK_FREQ MPC8XX_HZ
|
||||
|
||||
|
||||
#undef CONFIG_BOOTARGS
|
||||
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"slot_a_boot=setenv bootargs root=/dev/hda2 ip=off;" \
|
||||
"run addhw;diskboot 200000 0:1;bootm 200000\0" \
|
||||
"slot_b_boot=setenv bootargs root=/dev/hda2 ip=off;" \
|
||||
"run addhw;diskboot 200000 2:1;bootm 200000\0" \
|
||||
"nfs_boot=dhcp;run nfsargs addip addhw;bootm 200000\0" \
|
||||
"panic_boot=echo No Bootdevice !!! reset\0" \
|
||||
"nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath)\0" \
|
||||
"ramargs=setenv bootargs root=/dev/ram rw\0" \
|
||||
"addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip)" \
|
||||
":$(netmask):$(hostname):$(netdev):off\0" \
|
||||
"addhw=setenv bootargs $(bootargs) hw=$(hw) key1=$(key1) panic=1\0" \
|
||||
"netdev=eth0\0" \
|
||||
"silent=1\0" \
|
||||
"load=tftp 200000 bootloader-4x.bitmap;tftp 100000 bootloader-4x.bin\0" \
|
||||
"update=protect off 1:0-5;era 1:0-5;cp.b 100000 40000000 $(filesize);" \
|
||||
"cp.b 200000 40040000 14000\0"
|
||||
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"run slot_a_boot;run nfs_boot;run panic_boot"
|
||||
|
||||
|
||||
#define CONFIG_MISC_INIT_R 1
|
||||
#define CONFIG_MISC_INIT_F 1
|
||||
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */
|
||||
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
|
||||
#define CONFIG_STATUS_LED 1 /* Status LED enabled */
|
||||
|
||||
#undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */
|
||||
|
||||
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE)
|
||||
|
||||
#define CONFIG_MAC_PARTITION
|
||||
#define CONFIG_DOS_PARTITION
|
||||
|
||||
#define CONFIG_HARD_I2C
|
||||
#define CFG_I2C_SPEED 40000
|
||||
#define CFG_I2C_SLAVE 0x7F
|
||||
|
||||
#define CONFIG_ETHADDR 00:0B:64:80:00:00 /* our OUI from IEEE */
|
||||
#undef CONFIG_KUP4K_LOGO
|
||||
|
||||
/* Define to allow the user to overwrite serial and ethaddr */
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
|
||||
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_I2C | \
|
||||
CFG_CMD_IDE )
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "=> " /* Monitor Command Prompt */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#else
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#endif
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
|
||||
|
||||
#define CFG_MEMTEST_START 0x000400000 /* memtest works on */
|
||||
#define CFG_MEMTEST_END 0x003C00000 /* 4 ... 60 MB in DRAM */
|
||||
#define CFG_LOAD_ADDR 0x200000 /* default load address */
|
||||
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
||||
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 115200 }
|
||||
|
||||
#define CFG_CONSOLE_INFO_QUIET 1
|
||||
|
||||
/*
|
||||
* Low Level Configuration Settings
|
||||
* (address mappings, register initial values, etc.)
|
||||
* You should know what you are doing if you make changes here.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
* Internal Memory Mapped Register
|
||||
*/
|
||||
#define CFG_IMMR 0xFFF00000
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Definitions for initial stack pointer and data area (in DPRAM)
|
||||
*/
|
||||
#define CFG_INIT_RAM_ADDR CFG_IMMR
|
||||
#define CFG_INIT_RAM_END 0x2F00 /* End of used area in DPRAM */
|
||||
#define CFG_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
|
||||
#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Start addresses for the final memory configuration
|
||||
* (Set up by the startup code)
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_FLASH_BASE 0x40000000
|
||||
#define CFG_MONITOR_LEN (192 << 10) /* Reserve 256 kB for Monitor */
|
||||
#define CFG_MONITOR_BASE CFG_FLASH_BASE
|
||||
#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */
|
||||
|
||||
/*
|
||||
* For booting Linux, the board info and command line data
|
||||
* have to be in the first 8 MB of memory, since this is
|
||||
* the maximum mapped by the Linux kernel during initialization.
|
||||
*/
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* FLASH organization
|
||||
*/
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
|
||||
#define CFG_MAX_FLASH_SECT 19 /* max number of sectors on one chip */
|
||||
|
||||
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
|
||||
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_OFFSET 0x30000 /* Offset of Environment Sector */
|
||||
#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
|
||||
#define CFG_ENV_SECT_SIZE 0x10000
|
||||
|
||||
/* Address and size of Redundant Environment Sector */
|
||||
#if 0
|
||||
#define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET+CFG_ENV_SIZE)
|
||||
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SIZE)
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------
|
||||
* Hardware Information Block
|
||||
*/
|
||||
#if 0
|
||||
#define CFG_HWINFO_OFFSET 0x0003FFC0 /* offset of HW Info block */
|
||||
#define CFG_HWINFO_SIZE 0x00000040 /* size of HW Info block */
|
||||
#define CFG_HWINFO_MAGIC 0x54514D38 /* 'TQM8' */
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------
|
||||
* Cache Configuration
|
||||
*/
|
||||
#define CFG_CACHELINE_SIZE 16 /* For all MPC8xx CPUs */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CACHELINE_SHIFT 4 /* log base 2 of the above value */
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* SYPCR - System Protection Control 11-9
|
||||
* SYPCR can only be written once after reset!
|
||||
*-----------------------------------------------------------------------
|
||||
* Software & Bus Monitor Timer max, Bus Monitor enable, SW Watchdog freeze
|
||||
*/
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
#define CFG_SYPCR (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | \
|
||||
SYPCR_SWE | SYPCR_SWRI| SYPCR_SWP)
|
||||
#else
|
||||
#define CFG_SYPCR (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | SYPCR_SWP)
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* SIUMCR - SIU Module Configuration 11-6
|
||||
*-----------------------------------------------------------------------
|
||||
* PCMCIA config., multi-function pin tri-state
|
||||
*/
|
||||
#define CFG_SIUMCR (SIUMCR_DBGC00 | SIUMCR_DBPC00 | SIUMCR_MLRC00)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* TBSCR - Time Base Status and Control 11-26
|
||||
*-----------------------------------------------------------------------
|
||||
* Clear Reference Interrupt Status, Timebase freezing enabled
|
||||
*/
|
||||
#define CFG_TBSCR (TBSCR_REFA | TBSCR_REFB | TBSCR_TBF)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PISCR - Periodic Interrupt Status and Control 11-31
|
||||
*-----------------------------------------------------------------------
|
||||
* Clear Periodic Interrupt Status, Interrupt Timer freezing enabled
|
||||
*/
|
||||
#define CFG_PISCR (PISCR_PS | PISCR_PITF)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PLPRCR - PLL, Low-Power, and Reset Control Register 15-30
|
||||
*-----------------------------------------------------------------------
|
||||
* set the PLL, the low-power modes and the reset control (15-29)
|
||||
*/
|
||||
#define CFG_PLPRCR ((CFG_8XX_FACT << PLPRCR_MFI_SHIFT) | \
|
||||
PLPRCR_SPLSS | PLPRCR_TEXPS)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* SCCR - System Clock and reset Control Register 15-27
|
||||
*-----------------------------------------------------------------------
|
||||
* Set clock output, timebase and RTC source and divider,
|
||||
* power management and some other internal clocks
|
||||
*/
|
||||
#define SCCR_MASK SCCR_EBDF00
|
||||
#define CFG_SCCR (SCCR_TBS | SCCR_EBDF01 | \
|
||||
SCCR_COM00 | SCCR_DFSYNC00 | SCCR_DFBRG00 | \
|
||||
SCCR_DFNL000 | SCCR_DFNH000 | SCCR_DFLCD000 | \
|
||||
SCCR_DFALCD00)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PCMCIA stuff
|
||||
*-----------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
/* KUP4K use both slots, SLOT_A as "primary". */
|
||||
#define CONFIG_PCMCIA_SLOT_A 1
|
||||
|
||||
#define CFG_PCMCIA_MEM_ADDR (0xE0000000)
|
||||
#define CFG_PCMCIA_MEM_SIZE ( 64 << 20 )
|
||||
#define CFG_PCMCIA_DMA_ADDR (0xE4000000)
|
||||
#define CFG_PCMCIA_DMA_SIZE ( 64 << 20 )
|
||||
#define CFG_PCMCIA_ATTRB_ADDR (0xE8000000)
|
||||
#define CFG_PCMCIA_ATTRB_SIZE ( 64 << 20 )
|
||||
#define CFG_PCMCIA_IO_ADDR (0xEC000000)
|
||||
#define CFG_PCMCIA_IO_SIZE ( 64 << 20 )
|
||||
|
||||
#define PCMCIA_SOCKETS_NO 1
|
||||
#define PCMCIA_MEM_WIN_NO 8
|
||||
/*-----------------------------------------------------------------------
|
||||
* IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter)
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define CONFIG_IDE_8xx_PCCARD 1 /* Use IDE with PC Card Adapter */
|
||||
|
||||
#undef CONFIG_IDE_8xx_DIRECT /* Direct IDE not supported */
|
||||
#define CONFIG_IDE_LED 1 /* LED for ide supported */
|
||||
#undef CONFIG_IDE_RESET /* reset for ide not supported */
|
||||
|
||||
#define CFG_IDE_MAXBUS 1
|
||||
#define CFG_IDE_MAXDEVICE 2
|
||||
|
||||
#define CFG_ATA_IDE0_OFFSET 0x0000
|
||||
|
||||
#define CFG_ATA_IDE1_OFFSET (4 * CFG_PCMCIA_MEM_SIZE)
|
||||
|
||||
#define CFG_ATA_BASE_ADDR CFG_PCMCIA_MEM_ADDR
|
||||
|
||||
/* Offset for data I/O */
|
||||
#define CFG_ATA_DATA_OFFSET (CFG_PCMCIA_MEM_SIZE + 0x320)
|
||||
|
||||
/* Offset for normal register accesses */
|
||||
#define CFG_ATA_REG_OFFSET (2 * CFG_PCMCIA_MEM_SIZE + 0x320)
|
||||
|
||||
/* Offset for alternate registers */
|
||||
#define CFG_ATA_ALT_OFFSET 0x0100
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
#define CFG_DER 0
|
||||
|
||||
/*
|
||||
* Init Memory Controller:
|
||||
*
|
||||
* BR0/1 and OR0/1 (FLASH)
|
||||
*/
|
||||
#define FLASH_BASE0_PRELIM 0x40000000 /* FLASH bank #0 */
|
||||
|
||||
/* used to re-map FLASH both when starting from SRAM or FLASH:
|
||||
* restrict access enough to keep SRAM working (if any)
|
||||
* but not too much to meddle with FLASH accesses
|
||||
*/
|
||||
#define CFG_REMAP_OR_AM 0x80000000 /* OR addr mask */
|
||||
#define CFG_PRELIM_OR_AM 0xE0000000 /* OR addr mask */
|
||||
|
||||
/*
|
||||
* FLASH timing:
|
||||
*/
|
||||
#define CFG_OR_TIMING_FLASH (OR_ACS_DIV1 | OR_TRLX | OR_CSNT_SAM | \
|
||||
OR_SCY_2_CLK | OR_EHTR | OR_BI)
|
||||
|
||||
#define CFG_OR0_REMAP (CFG_REMAP_OR_AM | CFG_OR_TIMING_FLASH)
|
||||
#define CFG_OR0_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_FLASH)
|
||||
#define CFG_BR0_PRELIM ((FLASH_BASE0_PRELIM & BR_BA_MSK) | BR_PS_16 | BR_V )
|
||||
|
||||
|
||||
/* SDRAM timing: Multiplexed addresses, GPL5 output to GPL5_A (don't care) */
|
||||
#define CFG_OR_TIMING_SDRAM 0x00000A00
|
||||
|
||||
|
||||
#define CFG_MPTPR 0x400
|
||||
|
||||
/*
|
||||
* MAMR settings for SDRAM
|
||||
*/
|
||||
#define CFG_MAMR 0x80802114
|
||||
|
||||
|
||||
/*
|
||||
* Internal Definitions
|
||||
*
|
||||
* Boot Flags
|
||||
*/
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||
|
||||
|
||||
#define CONFIG_AUTOBOOT_KEYED /* use key strings to stop autoboot */
|
||||
#if 0
|
||||
#define CONFIG_AUTOBOOT_PROMPT "Boote in %d Sekunden - stop mit \"2\"\n"
|
||||
#endif
|
||||
#define CONFIG_AUTOBOOT_STOP_STR "." /* easy to stop for now */
|
||||
#define CONFIG_SILENT_CONSOLE 1
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
@@ -7,10 +7,11 @@
|
||||
* Note: my board is a PILOT rev.
|
||||
* Note: the mpc8260ads doesn't come with a proper Ethernet MAC address.
|
||||
*
|
||||
* (C) Copyright 2003 Arabella Software Ltd.
|
||||
* (C) Copyright 2003-2004 Arabella Software Ltd.
|
||||
* Yuli Barcohen <yuli@arabellasw.com>
|
||||
* Added support for SDRAM DIMMs SPD EEPROM, MII, JFFS2.
|
||||
* Ported to PQ2FADS-ZU and PQ2FADS-VR boards.
|
||||
* Ported to MPC8272ADS board.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
@@ -39,18 +40,24 @@
|
||||
* (easy to change)
|
||||
*/
|
||||
|
||||
#define CONFIG_MPC8260 1 /* This is an MPC8260 CPU */
|
||||
#define CONFIG_MPC8260ADS 1 /* ...on motorola ads board */
|
||||
#define CONFIG_MPC8260ADS 1 /* Motorola PQ2 ADS family board */
|
||||
|
||||
/* ADS flavours */
|
||||
#define CFG_8260ADS 1 /* MPC8260ADS */
|
||||
#define CFG_8266ADS 2 /* MPC8266ADS */
|
||||
#define CFG_PQ2FADS 3 /* PQ2FADS-ZU or PQ2FADS-VR */
|
||||
#define CFG_8272ADS 4 /* MPC8272ADS */
|
||||
|
||||
#ifndef CONFIG_ADSTYPE
|
||||
#define CONFIG_ADSTYPE CFG_8260ADS
|
||||
#endif /* CONFIG_ADSTYPE */
|
||||
|
||||
#if CONFIG_ADSTYPE == CFG_8272ADS
|
||||
#define CONFIG_MPC8272 1
|
||||
#else
|
||||
#define CONFIG_MPC8260 1
|
||||
#endif /* CONFIG_ADSTYPE == CFG_8272ADS */
|
||||
|
||||
#define CONFIG_BOARD_EARLY_INIT_F 1 /* Call board_early_init_f */
|
||||
|
||||
/* allow serial and ethaddr to be overwritten */
|
||||
@@ -92,42 +99,60 @@
|
||||
|
||||
#define CONFIG_ETHER_INDEX 2 /* which SCC/FCC channel for ethernet */
|
||||
|
||||
#if (CONFIG_ETHER_INDEX == 2)
|
||||
/*
|
||||
* - Rx-CLK is CLK13
|
||||
* - Tx-CLK is CLK14
|
||||
* - Select bus for bd/buffers (see 28-13)
|
||||
* - Full duplex
|
||||
*/
|
||||
# define CFG_CMXFCR_MASK (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
|
||||
#if CONFIG_ETHER_INDEX == 1
|
||||
|
||||
# define CFG_PHY_ADDR 0
|
||||
# define CFG_CMXFCR_VALUE (CMXFCR_RF1CS_CLK11 | CMXFCR_TF1CS_CLK10)
|
||||
# define CFG_CMXFCR_MASK (CMXFCR_FC1 | CMXFCR_RF1CS_MSK | CMXFCR_TF1CS_MSK)
|
||||
|
||||
#elif CONFIG_ETHER_INDEX == 2
|
||||
|
||||
#if CONFIG_ADSTYPE == CFG_8272ADS /* RxCLK is CLK15, TxCLK is CLK16 */
|
||||
# define CFG_PHY_ADDR 3
|
||||
# define CFG_CMXFCR_VALUE (CMXFCR_RF2CS_CLK15 | CMXFCR_TF2CS_CLK16)
|
||||
#else /* RxCLK is CLK13, TxCLK is CLK14 */
|
||||
# define CFG_PHY_ADDR 0
|
||||
# define CFG_CMXFCR_VALUE (CMXFCR_RF2CS_CLK13 | CMXFCR_TF2CS_CLK14)
|
||||
# define CFG_CPMFCR_RAMTYPE 0
|
||||
# define CFG_FCC_PSMR (FCC_PSMR_FDE | FCC_PSMR_LPB)
|
||||
#endif /* CONFIG_ADSTYPE == CFG_8272ADS */
|
||||
|
||||
# define CFG_CMXFCR_MASK (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
|
||||
|
||||
#endif /* CONFIG_ETHER_INDEX */
|
||||
|
||||
#define CFG_CPMFCR_RAMTYPE 0 /* BDs and buffers on 60x bus */
|
||||
#define CFG_FCC_PSMR (FCC_PSMR_FDE | FCC_PSMR_LPB) /* Full duplex */
|
||||
|
||||
#define CONFIG_MII /* MII PHY management */
|
||||
#define CONFIG_BITBANGMII /* bit-bang MII PHY management */
|
||||
/*
|
||||
* GPIO pins used for bit-banged MII communications
|
||||
*/
|
||||
#define MDIO_PORT 2 /* Port C */
|
||||
#define MDIO_ACTIVE (iop->pdir |= 0x00400000)
|
||||
#define MDIO_TRISTATE (iop->pdir &= ~0x00400000)
|
||||
#define MDIO_READ ((iop->pdat & 0x00400000) != 0)
|
||||
|
||||
#define MDIO(bit) if(bit) iop->pdat |= 0x00400000; \
|
||||
else iop->pdat &= ~0x00400000
|
||||
#if CONFIG_ADSTYPE == CFG_8272ADS
|
||||
#define CFG_MDIO_PIN 0x00002000 /* PC18 */
|
||||
#define CFG_MDC_PIN 0x00001000 /* PC19 */
|
||||
#else
|
||||
#define CFG_MDIO_PIN 0x00400000 /* PC9 */
|
||||
#define CFG_MDC_PIN 0x00200000 /* PC10 */
|
||||
#endif /* CONFIG_ADSTYPE == CFG_8272ADS */
|
||||
|
||||
#define MDC(bit) if(bit) iop->pdat |= 0x00200000; \
|
||||
else iop->pdat &= ~0x00200000
|
||||
#define MDIO_ACTIVE (iop->pdir |= CFG_MDIO_PIN)
|
||||
#define MDIO_TRISTATE (iop->pdir &= ~CFG_MDIO_PIN)
|
||||
#define MDIO_READ ((iop->pdat & CFG_MDIO_PIN) != 0)
|
||||
|
||||
#define MDIO(bit) if(bit) iop->pdat |= CFG_MDIO_PIN; \
|
||||
else iop->pdat &= ~CFG_MDIO_PIN
|
||||
|
||||
#define MDC(bit) if(bit) iop->pdat |= CFG_MDC_PIN; \
|
||||
else iop->pdat &= ~CFG_MDC_PIN
|
||||
|
||||
#define MIIDELAY udelay(1)
|
||||
|
||||
#endif /* CONFIG_ETHER_ON_FCC */
|
||||
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
#undef CONFIG_SPD_EEPROM /* On PQ2FADS-ZU, SDRAM is soldered */
|
||||
#if CONFIG_ADSTYPE >= CFG_PQ2FADS
|
||||
#undef CONFIG_SPD_EEPROM /* On new boards, SDRAM is soldered */
|
||||
#else
|
||||
#define CONFIG_HARD_I2C 1 /* To enable I2C support */
|
||||
#define CFG_I2C_SPEED 100000 /* I2C speed and slave address */
|
||||
@@ -136,21 +161,21 @@
|
||||
#if defined(CONFIG_SPD_EEPROM) && !defined(CONFIG_SPD_ADDR)
|
||||
#define CONFIG_SPD_ADDR 0x50
|
||||
#endif
|
||||
#endif /* CONFIG_ADSTYPE == CFG_PQ2FADS */
|
||||
#endif /* CONFIG_ADSTYPE >= CFG_PQ2FADS */
|
||||
|
||||
#ifndef CONFIG_SDRAM_PBI
|
||||
#define CONFIG_SDRAM_PBI 0 /* By default, use bank-based interleaving */
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_8260_CLKIN
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
#if CONFIG_ADSTYPE >= CFG_PQ2FADS
|
||||
#define CONFIG_8260_CLKIN 100000000 /* in Hz */
|
||||
#else
|
||||
#define CONFIG_8260_CLKIN 66000000 /* in Hz */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define CONFIG_BAUDRATE 115200
|
||||
#define CONFIG_BAUDRATE 38400
|
||||
|
||||
#define CFG_EXCLUDE CFG_CMD_BEDBUG | \
|
||||
CFG_CMD_BMP | \
|
||||
@@ -176,7 +201,7 @@
|
||||
CFG_CMD_USB | \
|
||||
CFG_CMD_VFD
|
||||
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
#if CONFIG_ADSTYPE >= CFG_PQ2FADS
|
||||
#define CONFIG_COMMANDS (CFG_CMD_ALL & ~( \
|
||||
CFG_CMD_SDRAM | \
|
||||
CFG_CMD_I2C | \
|
||||
@@ -184,14 +209,14 @@
|
||||
#else
|
||||
#define CONFIG_COMMANDS (CFG_CMD_ALL & ~( \
|
||||
CFG_EXCLUDE ) )
|
||||
#endif /* CONFIG_ADSTYPE == CFG_PQ2FADS */
|
||||
#endif /* CONFIG_ADSTYPE >= CFG_PQ2FADS */
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
|
||||
#define CONFIG_BOOTCOMMAND "bootm 100000" /* autoboot command */
|
||||
#define CONFIG_BOOTARGS "root=/dev/ram rw"
|
||||
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
|
||||
#define CONFIG_BOOTCOMMAND "bootm fff80000" /* autoboot command */
|
||||
#define CONFIG_BOOTARGS "root=/dev/mtdblock2"
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#undef CONFIG_KGDB_ON_SMC /* define if kgdb on SMC */
|
||||
@@ -256,12 +281,12 @@
|
||||
#define RS232EN_2 0x01000001
|
||||
#define FETHIEN1 0x08000008
|
||||
#define FETH1_RST 0x04000004
|
||||
#define FETHIEN2 0x01000000
|
||||
#define FETHIEN2 0x10000000
|
||||
#define FETH2_RST 0x08000000
|
||||
#define BCSR_PCI_MODE 0x01000000
|
||||
|
||||
#define CFG_INIT_RAM_ADDR CFG_IMMR
|
||||
#define CFG_INIT_RAM_END 0x4000 /* End of used area in DPRAM */
|
||||
#define CFG_INIT_RAM_END 0x2000 /* End of used area in DPRAM */
|
||||
#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
|
||||
#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
@@ -273,7 +298,6 @@
|
||||
( HRCW_BMS | HRCW_APPC10 ) |\
|
||||
( HRCW_MODCK_H0101 ) \
|
||||
)
|
||||
|
||||
/* no slaves */
|
||||
#define CFG_HRCW_SLAVE1 0
|
||||
#define CFG_HRCW_SLAVE2 0
|
||||
@@ -336,8 +360,8 @@
|
||||
#define CFG_PISCR (PISCR_PS|PISCR_PTF|PISCR_PTE)
|
||||
#define CFG_RCCR 0
|
||||
|
||||
#if CONFIG_ADSTYPE == CFG_8266ADS
|
||||
#undef CFG_LSDRAM_BASE /* No local bus SDRAM on MPC8266ADS */
|
||||
#if (CONFIG_ADSTYPE == CFG_8266ADS) || (CONFIG_ADSTYPE == CFG_8272ADS)
|
||||
#undef CFG_LSDRAM_BASE /* No local bus SDRAM on these boards */
|
||||
#endif /* CONFIG_ADSTYPE == CFG_8266ADS */
|
||||
|
||||
#if CONFIG_ADSTYPE == CFG_PQ2FADS
|
||||
@@ -347,6 +371,11 @@
|
||||
#define CFG_LSDMR 0x828737A3
|
||||
#define CFG_LSRT 0x13
|
||||
#define CFG_MPTPR 0x2800
|
||||
#elif CONFIG_ADSTYPE == CFG_8272ADS
|
||||
#define CFG_OR2 0xFC002CC0
|
||||
#define CFG_PSDMR 0x834E24A3
|
||||
#define CFG_PSRT 0x13
|
||||
#define CFG_MPTPR 0x2800
|
||||
#else
|
||||
#define CFG_OR2 0xFF000CA0
|
||||
#define CFG_PSDMR 0x016EB452
|
||||
|
||||
802
include/configs/NETPHONE.h
Normal file
802
include/configs/NETPHONE.h
Normal file
@@ -0,0 +1,802 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pantelis Antoniou, Intracom S.A., panto@intracom.gr
|
||||
* U-Boot port on NetTA4 board
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
#if !defined(CONFIG_NETPHONE_VERSION) || CONFIG_NETPHONE_VERSION > 2
|
||||
#error Unsupported CONFIG_NETPHONE version
|
||||
#endif
|
||||
|
||||
/*
|
||||
* High Level Configuration Options
|
||||
* (easy to change)
|
||||
*/
|
||||
|
||||
#define CONFIG_MPC870 1 /* This is a MPC885 CPU */
|
||||
#define CONFIG_NETPHONE 1 /* ...on a NetPhone board */
|
||||
|
||||
#define CONFIG_8xx_CONS_SMC1 1 /* Console is on SMC1 */
|
||||
#undef CONFIG_8xx_CONS_SMC2
|
||||
#undef CONFIG_8xx_CONS_NONE
|
||||
|
||||
#define CONFIG_BAUDRATE 115200 /* console baudrate = 115kbps */
|
||||
|
||||
/* #define CONFIG_XIN 10000000 */
|
||||
#define CONFIG_XIN 50000000
|
||||
#define MPC8XX_HZ 120000000
|
||||
/* #define MPC8XX_HZ 66666666 */
|
||||
|
||||
#define CONFIG_8xx_GCLK_FREQ MPC8XX_HZ
|
||||
|
||||
#if 0
|
||||
#define CONFIG_BOOTDELAY -1 /* autoboot disabled */
|
||||
#else
|
||||
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
|
||||
#endif
|
||||
|
||||
#undef CONFIG_CLOCKS_IN_MHZ /* clocks NOT passsed to Linux in MHz */
|
||||
|
||||
#define CONFIG_PREBOOT "echo;"
|
||||
|
||||
#undef CONFIG_BOOTARGS
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"tftpboot; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) " \
|
||||
"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; " \
|
||||
"bootm"
|
||||
|
||||
#define CONFIG_AUTOSCRIPT
|
||||
#define CONFIG_LOADS_ECHO 0 /* echo off for serial download */
|
||||
#undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */
|
||||
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
|
||||
#undef CONFIG_CAN_DRIVER /* CAN Driver support disabled */
|
||||
|
||||
#define CONFIG_STATUS_LED 1 /* Status LED enabled */
|
||||
#define CONFIG_BOARD_SPECIFIC_LED /* version has board specific leds */
|
||||
|
||||
#define CONFIG_BOOTP_MASK (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE | CONFIG_BOOTP_NISDOMAIN)
|
||||
|
||||
#undef CONFIG_MAC_PARTITION
|
||||
#undef CONFIG_DOS_PARTITION
|
||||
|
||||
#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */
|
||||
|
||||
#define CONFIG_NET_MULTI 1 /* the only way to get the FEC in */
|
||||
#define FEC_ENET 1 /* eth.c needs it that way... */
|
||||
#undef CFG_DISCOVER_PHY
|
||||
#define CONFIG_MII 1
|
||||
#define CONFIG_RMII 1 /* use RMII interface */
|
||||
|
||||
#define CONFIG_ETHER_ON_FEC1 1
|
||||
#define CONFIG_FEC1_PHY 8 /* phy address of FEC */
|
||||
#define CONFIG_FEC1_PHY_NORXERR 1
|
||||
|
||||
#define CONFIG_ETHER_ON_FEC2 1
|
||||
#define CONFIG_FEC2_PHY 4
|
||||
#define CONFIG_FEC2_PHY_NORXERR 1
|
||||
|
||||
#define CONFIG_ENV_OVERWRITE 1 /* allow modification of vendor params */
|
||||
|
||||
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
|
||||
CFG_CMD_NAND | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_PING | \
|
||||
CFG_CMD_MII | \
|
||||
CFG_CMD_CDP \
|
||||
)
|
||||
|
||||
#define CONFIG_BOARD_EARLY_INIT_F 1
|
||||
#define CONFIG_MISC_INIT_R
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "=> " /* Monitor Command Prompt */
|
||||
|
||||
#define CFG_HUSH_PARSER 1
|
||||
#define CFG_PROMPT_HUSH_PS2 "> "
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#else
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#endif
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
|
||||
|
||||
#define CFG_MEMTEST_START 0x0300000 /* memtest works on */
|
||||
#define CFG_MEMTEST_END 0x0700000 /* 3 ... 7 MB in DRAM */
|
||||
|
||||
#define CFG_LOAD_ADDR 0x100000 /* default load address */
|
||||
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
||||
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
|
||||
|
||||
/*
|
||||
* Low Level Configuration Settings
|
||||
* (address mappings, register initial values, etc.)
|
||||
* You should know what you are doing if you make changes here.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------
|
||||
* Internal Memory Mapped Register
|
||||
*/
|
||||
#define CFG_IMMR 0xFF000000
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Definitions for initial stack pointer and data area (in DPRAM)
|
||||
*/
|
||||
#define CFG_INIT_RAM_ADDR CFG_IMMR
|
||||
#define CFG_INIT_RAM_END 0x3000 /* End of used area in DPRAM */
|
||||
#define CFG_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
|
||||
#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Start addresses for the final memory configuration
|
||||
* (Set up by the startup code)
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_FLASH_BASE 0x40000000
|
||||
#if defined(DEBUG)
|
||||
#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */
|
||||
#else
|
||||
#define CFG_MONITOR_LEN (192 << 10) /* Reserve 192 kB for Monitor */
|
||||
#endif
|
||||
#define CFG_MONITOR_BASE CFG_FLASH_BASE
|
||||
#define CFG_MALLOC_LEN (128 << 10) /* Reserve 128 kB for malloc() */
|
||||
#if CONFIG_NETPHONE_VERSION == 2
|
||||
#define CFG_FLASH_BASE4 0x40080000
|
||||
#endif
|
||||
|
||||
#define CFG_RESET_ADDRESS 0x80000000
|
||||
|
||||
/*
|
||||
* For booting Linux, the board info and command line data
|
||||
* have to be in the first 8 MB of memory, since this is
|
||||
* the maximum mapped by the Linux kernel during initialization.
|
||||
*/
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* FLASH organization
|
||||
*/
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
|
||||
#elif CONFIG_NETPHONE_VERSION == 2
|
||||
#define CFG_MAX_FLASH_BANKS 2 /* max number of memory banks */
|
||||
#endif
|
||||
#define CFG_MAX_FLASH_SECT 8 /* max number of sectors on one chip */
|
||||
|
||||
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
|
||||
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_SECT_SIZE 0x10000
|
||||
|
||||
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x60000)
|
||||
#define CFG_ENV_OFFSET 0
|
||||
#define CFG_ENV_SIZE 0x4000
|
||||
|
||||
#define CFG_ENV_ADDR_REDUND (CFG_FLASH_BASE + 0x70000)
|
||||
#define CFG_ENV_OFFSET_REDUND 0
|
||||
#define CFG_ENV_SIZE_REDUND CFG_ENV_SIZE
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Cache Configuration
|
||||
*/
|
||||
#define CFG_CACHELINE_SIZE 16 /* For all MPC8xx CPUs */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CACHELINE_SHIFT 4 /* log base 2 of the above value */
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* SYPCR - System Protection Control 11-9
|
||||
* SYPCR can only be written once after reset!
|
||||
*-----------------------------------------------------------------------
|
||||
* Software & Bus Monitor Timer max, Bus Monitor enable, SW Watchdog freeze
|
||||
*/
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
#define CFG_SYPCR (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | \
|
||||
SYPCR_SWE | SYPCR_SWRI| SYPCR_SWP)
|
||||
#else
|
||||
#define CFG_SYPCR (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | SYPCR_SWP)
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* SIUMCR - SIU Module Configuration 11-6
|
||||
*-----------------------------------------------------------------------
|
||||
* PCMCIA config., multi-function pin tri-state
|
||||
*/
|
||||
#ifndef CONFIG_CAN_DRIVER
|
||||
#define CFG_SIUMCR (SIUMCR_DBGC00 | SIUMCR_DBPC00 | SIUMCR_MLRC01 | SIUMCR_FRC)
|
||||
#else /* we must activate GPL5 in the SIUMCR for CAN */
|
||||
#define CFG_SIUMCR (SIUMCR_DBGC11 | SIUMCR_DBPC00 | SIUMCR_MLRC01 | SIUMCR_FRC)
|
||||
#endif /* CONFIG_CAN_DRIVER */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* TBSCR - Time Base Status and Control 11-26
|
||||
*-----------------------------------------------------------------------
|
||||
* Clear Reference Interrupt Status, Timebase freezing enabled
|
||||
*/
|
||||
#define CFG_TBSCR (TBSCR_REFA | TBSCR_REFB | TBSCR_TBF)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* RTCSC - Real-Time Clock Status and Control Register 11-27
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
#define CFG_RTCSC (RTCSC_SEC | RTCSC_ALR | RTCSC_RTF| RTCSC_RTE)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PISCR - Periodic Interrupt Status and Control 11-31
|
||||
*-----------------------------------------------------------------------
|
||||
* Clear Periodic Interrupt Status, Interrupt Timer freezing enabled
|
||||
*/
|
||||
#define CFG_PISCR (PISCR_PS | PISCR_PITF)
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PLPRCR - PLL, Low-Power, and Reset Control Register 15-30
|
||||
*-----------------------------------------------------------------------
|
||||
* Reset PLL lock status sticky bit, timer expired status bit and timer
|
||||
* interrupt status bit
|
||||
*
|
||||
*/
|
||||
|
||||
#if CONFIG_XIN == 10000000
|
||||
|
||||
#if MPC8XX_HZ == 120000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(0 << PLPRCR_S_SHIFT) | (12 << PLPRCR_MFI_SHIFT) | (0 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 100000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(0 << PLPRCR_S_SHIFT) | (10 << PLPRCR_MFI_SHIFT) | (0 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 50000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(1 << PLPRCR_S_SHIFT) | (8 << PLPRCR_MFI_SHIFT) | (3 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 25000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(2 << PLPRCR_S_SHIFT) | (8 << PLPRCR_MFI_SHIFT) | (3 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 40000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(1 << PLPRCR_S_SHIFT) | (8 << PLPRCR_MFI_SHIFT) | (4 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 75000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(1 << PLPRCR_S_SHIFT) | (15 << PLPRCR_MFI_SHIFT) | (0 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#else
|
||||
#error unsupported CPU freq for XIN = 10MHz
|
||||
#endif
|
||||
|
||||
#elif CONFIG_XIN == 50000000
|
||||
|
||||
#if MPC8XX_HZ == 120000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(0 << PLPRCR_S_SHIFT) | (12 << PLPRCR_MFI_SHIFT) | (4 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 100000000
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(0 << PLPRCR_S_SHIFT) | (6 << PLPRCR_MFI_SHIFT) | (2 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#elif MPC8XX_HZ == 66666666
|
||||
#define CFG_PLPRCR ((0 << PLPRCR_MFN_SHIFT) | (0 << PLPRCR_MFD_SHIFT) | \
|
||||
(1 << PLPRCR_S_SHIFT) | (8 << PLPRCR_MFI_SHIFT) | (2 << PLPRCR_PDF_SHIFT) | \
|
||||
PLPRCR_TEXPS)
|
||||
#else
|
||||
#error unsupported CPU freq for XIN = 50MHz
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#error unsupported XIN freq
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------
|
||||
* SCCR - System Clock and reset Control Register 15-27
|
||||
*-----------------------------------------------------------------------
|
||||
* Set clock output, timebase and RTC source and divider,
|
||||
* power management and some other internal clocks
|
||||
*/
|
||||
|
||||
#define SCCR_MASK SCCR_EBDF11
|
||||
#if MPC8XX_HZ > 66666666
|
||||
#define CFG_SCCR (SCCR_TBS | \
|
||||
SCCR_COM00 | SCCR_DFSYNC00 | SCCR_DFBRG00 | \
|
||||
SCCR_DFNL000 | SCCR_DFNH000 | SCCR_DFLCD000 | \
|
||||
SCCR_DFALCD00 | SCCR_EBDF01)
|
||||
#else
|
||||
#define CFG_SCCR (SCCR_TBS | \
|
||||
SCCR_COM00 | SCCR_DFSYNC00 | SCCR_DFBRG00 | \
|
||||
SCCR_DFNL000 | SCCR_DFNH000 | SCCR_DFLCD000 | \
|
||||
SCCR_DFALCD00)
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
/*#define CFG_DER 0x2002000F*/
|
||||
#define CFG_DER 0
|
||||
|
||||
/*
|
||||
* Init Memory Controller:
|
||||
*
|
||||
* BR0/1 and OR0/1 (FLASH)
|
||||
*/
|
||||
|
||||
#define FLASH_BASE0_PRELIM 0x40000000 /* FLASH bank #0 */
|
||||
|
||||
/* used to re-map FLASH both when starting from SRAM or FLASH:
|
||||
* restrict access enough to keep SRAM working (if any)
|
||||
* but not too much to meddle with FLASH accesses
|
||||
*/
|
||||
#define CFG_REMAP_OR_AM 0x80000000 /* OR addr mask */
|
||||
#define CFG_PRELIM_OR_AM 0xE0000000 /* OR addr mask */
|
||||
|
||||
/* FLASH timing: ACS = 11, TRLX = 0, CSNT = 1, SCY = 5, EHTR = 1 */
|
||||
#define CFG_OR_TIMING_FLASH (OR_CSNT_SAM | OR_BI | OR_SCY_5_CLK | OR_TRLX)
|
||||
|
||||
#define CFG_OR0_REMAP (CFG_REMAP_OR_AM | CFG_OR_TIMING_FLASH)
|
||||
#define CFG_OR0_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_FLASH)
|
||||
#define CFG_BR0_PRELIM ((FLASH_BASE0_PRELIM & BR_BA_MSK) | BR_PS_8 | BR_V )
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 2
|
||||
|
||||
#define FLASH_BASE4_PRELIM 0x40080000 /* FLASH bank #1 */
|
||||
|
||||
#define CFG_OR4_REMAP (CFG_REMAP_OR_AM | CFG_OR_TIMING_FLASH)
|
||||
#define CFG_OR4_PRELIM (CFG_PRELIM_OR_AM | CFG_OR_TIMING_FLASH)
|
||||
#define CFG_BR4_PRELIM ((FLASH_BASE4_PRELIM & BR_BA_MSK) | BR_PS_8 | BR_V )
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BR3 and OR3 (SDRAM)
|
||||
*
|
||||
*/
|
||||
#define SDRAM_BASE3_PRELIM 0x00000000 /* SDRAM bank #0 */
|
||||
#define SDRAM_MAX_SIZE (256 << 20) /* max 256MB per bank */
|
||||
|
||||
/* SDRAM timing: Multiplexed addresses, GPL5 output to GPL5_A (don't care) */
|
||||
#define CFG_OR_TIMING_SDRAM (OR_CSNT_SAM | OR_G5LS)
|
||||
|
||||
#define CFG_OR3_PRELIM ((0xFFFFFFFFLU & ~(SDRAM_MAX_SIZE - 1)) | CFG_OR_TIMING_SDRAM)
|
||||
#define CFG_BR3_PRELIM ((SDRAM_BASE3_PRELIM & BR_BA_MSK) | BR_MS_UPMB | BR_PS_32 | BR_V)
|
||||
|
||||
/*
|
||||
* Memory Periodic Timer Prescaler
|
||||
*/
|
||||
|
||||
/*
|
||||
* Memory Periodic Timer Prescaler
|
||||
*
|
||||
* The Divider for PTA (refresh timer) configuration is based on an
|
||||
* example SDRAM configuration (64 MBit, one bank). The adjustment to
|
||||
* the number of chip selects (NCS) and the actually needed refresh
|
||||
* rate is done by setting MPTPR.
|
||||
*
|
||||
* PTA is calculated from
|
||||
* PTA = (gclk * Trefresh) / ((2 ^ (2 * DFBRG)) * PTP * NCS)
|
||||
*
|
||||
* gclk CPU clock (not bus clock!)
|
||||
* Trefresh Refresh cycle * 4 (four word bursts used)
|
||||
*
|
||||
* 4096 Rows from SDRAM example configuration
|
||||
* 1000 factor s -> ms
|
||||
* 32 PTP (pre-divider from MPTPR) from SDRAM example configuration
|
||||
* 4 Number of refresh cycles per period
|
||||
* 64 Refresh cycle in ms per number of rows
|
||||
* --------------------------------------------
|
||||
* Divider = 4096 * 32 * 1000 / (4 * 64) = 512000
|
||||
*
|
||||
* 50 MHz => 50.000.000 / Divider = 98
|
||||
* 66 Mhz => 66.000.000 / Divider = 129
|
||||
* 80 Mhz => 80.000.000 / Divider = 156
|
||||
*/
|
||||
|
||||
#define CFG_MAMR_PTA 234
|
||||
|
||||
/*
|
||||
* For 16 MBit, refresh rates could be 31.3 us
|
||||
* (= 64 ms / 2K = 125 / quad bursts).
|
||||
* For a simpler initialization, 15.6 us is used instead.
|
||||
*
|
||||
* #define CFG_MPTPR_2BK_2K MPTPR_PTP_DIV32 for 2 banks
|
||||
* #define CFG_MPTPR_1BK_2K MPTPR_PTP_DIV64 for 1 bank
|
||||
*/
|
||||
#define CFG_MPTPR_2BK_4K MPTPR_PTP_DIV16 /* setting for 2 banks */
|
||||
#define CFG_MPTPR_1BK_4K MPTPR_PTP_DIV32 /* setting for 1 bank */
|
||||
|
||||
/* refresh rate 7.8 us (= 64 ms / 8K = 31.2 / quad bursts) for 256 MBit */
|
||||
#define CFG_MPTPR_2BK_8K MPTPR_PTP_DIV8 /* setting for 2 banks */
|
||||
#define CFG_MPTPR_1BK_8K MPTPR_PTP_DIV16 /* setting for 1 bank */
|
||||
|
||||
/*
|
||||
* MAMR settings for SDRAM
|
||||
*/
|
||||
|
||||
/* 8 column SDRAM */
|
||||
#define CFG_MAMR_8COL ((CFG_MAMR_PTA << MAMR_PTA_SHIFT) | MAMR_PTAE | \
|
||||
MAMR_AMA_TYPE_0 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A11 | \
|
||||
MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_4X)
|
||||
|
||||
/* 9 column SDRAM */
|
||||
#define CFG_MAMR_9COL ((CFG_MAMR_PTA << MAMR_PTA_SHIFT) | MAMR_PTAE | \
|
||||
MAMR_AMA_TYPE_1 | MAMR_DSA_1_CYCL | MAMR_G0CLA_A10 | \
|
||||
MAMR_RLFA_1X | MAMR_WLFA_1X | MAMR_TLFA_4X)
|
||||
|
||||
/*
|
||||
* Internal Definitions
|
||||
*
|
||||
* Boot Flags
|
||||
*/
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||
|
||||
#define CONFIG_ARTOS /* include ARTOS support */
|
||||
|
||||
#define CONFIG_LAST_STAGE_INIT /* needed to reset the damn phys */
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
#define DSP_SIZE 0x00010000 /* 64K */
|
||||
#define NAND_SIZE 0x00010000 /* 64K */
|
||||
|
||||
#define DSP_BASE 0xF1000000
|
||||
#define NAND_BASE 0xF1010000
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
/* NAND */
|
||||
#define CFG_NAND_BASE NAND_BASE
|
||||
#define CONFIG_MTD_NAND_ECC_JFFS2
|
||||
|
||||
#define CFG_MAX_NAND_DEVICE 1
|
||||
|
||||
#define SECTORSIZE 512
|
||||
#define ADDR_COLUMN 1
|
||||
#define ADDR_PAGE 2
|
||||
#define ADDR_COLUMN_PAGE 3
|
||||
#define NAND_ChipID_UNKNOWN 0x00
|
||||
#define NAND_MAX_FLOORS 1
|
||||
#define NAND_MAX_CHIPS 1
|
||||
|
||||
/* ALE = PD17, CLE = PE18, CE = PE20, F_RY_BY = PE31 */
|
||||
#define NAND_DISABLE_CE(nand) \
|
||||
do { \
|
||||
(((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat) |= (1 << (31 - 20)); \
|
||||
} while(0)
|
||||
|
||||
#define NAND_ENABLE_CE(nand) \
|
||||
do { \
|
||||
(((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat) &= ~(1 << (31 - 20)); \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_CLRALE(nandptr) \
|
||||
do { \
|
||||
(((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat) &= ~(1 << (31 - 17)); \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_SETALE(nandptr) \
|
||||
do { \
|
||||
(((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat) |= (1 << (31 - 17)); \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_CLRCLE(nandptr) \
|
||||
do { \
|
||||
(((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat) &= ~(1 << (31 - 18)); \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_SETCLE(nandptr) \
|
||||
do { \
|
||||
(((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat) |= (1 << (31 - 18)); \
|
||||
} while(0)
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
#define NAND_WAIT_READY(nand) \
|
||||
do { \
|
||||
int _tries = 0; \
|
||||
while ((((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat & (1 << (31 - 31))) == 0) \
|
||||
if (++_tries > 100000) \
|
||||
break; \
|
||||
} while (0)
|
||||
#elif CONFIG_NETPHONE_VERSION == 2
|
||||
#define NAND_WAIT_READY(nand) \
|
||||
do { \
|
||||
int _tries = 0; \
|
||||
while ((((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat & (1 << (15 - 15))) == 0) \
|
||||
if (++_tries > 100000) \
|
||||
break; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define WRITE_NAND_COMMAND(d, adr) \
|
||||
do { \
|
||||
*(volatile unsigned char *)((unsigned long)(adr)) = (unsigned char)(d); \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_NAND_ADDRESS(d, adr) \
|
||||
do { \
|
||||
*(volatile unsigned char *)((unsigned long)(adr)) = (unsigned char)(d); \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_NAND(d, adr) \
|
||||
do { \
|
||||
*(volatile unsigned char *)((unsigned long)(adr)) = (unsigned char)(d); \
|
||||
} while(0)
|
||||
|
||||
#define READ_NAND(adr) \
|
||||
((unsigned char)(*(volatile unsigned char *)(unsigned long)(adr)))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#if CONFIG_NETPHONE_VERSION == 1
|
||||
#define STATUS_LED_BIT 0x00000008 /* bit 28 */
|
||||
#elif CONFIG_NETPHONE_VERSION == 2
|
||||
#define STATUS_LED_BIT 0x00000080 /* bit 24 */
|
||||
#endif
|
||||
|
||||
#define STATUS_LED_PERIOD (CFG_HZ / 2)
|
||||
#define STATUS_LED_STATE STATUS_LED_BLINKING
|
||||
|
||||
#define STATUS_LED_ACTIVE 0 /* LED on for bit == 0 */
|
||||
#define STATUS_LED_BOOT 0 /* LED 0 used for boot status */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* LEDs */
|
||||
|
||||
/* led_id_t is unsigned int mask */
|
||||
typedef unsigned int led_id_t;
|
||||
|
||||
#define __led_toggle(_msk) \
|
||||
do { \
|
||||
((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat ^= (_msk); \
|
||||
} while(0)
|
||||
|
||||
#define __led_set(_msk, _st) \
|
||||
do { \
|
||||
if ((_st)) \
|
||||
((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat |= (_msk); \
|
||||
else \
|
||||
((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pedat &= ~(_msk); \
|
||||
} while(0)
|
||||
|
||||
#define __led_init(msk, st) __led_set(msk, st)
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
(V1) version 1 of the board
|
||||
(V2) version 2 of the board
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Pin definitions:
|
||||
|
||||
+------+----------------+--------+------------------------------------------------------------
|
||||
| # | Name | Type | Comment
|
||||
+------+----------------+--------+------------------------------------------------------------
|
||||
| PA3 | SPIEN_MAX | Output | MAX serial to uart chip select
|
||||
| PA7 | DSP_INT | Output | DSP interrupt
|
||||
| PA10 | DSP_RESET | Output | DSP reset
|
||||
| PA14 | USBOE | Output | USB (1)
|
||||
| PA15 | USBRXD | Output | USB (1)
|
||||
| PB19 | BT_RTS | Output | Bluetooth (0)
|
||||
| PB23 | BT_CTS | Output | Bluetooth (0)
|
||||
| PB26 | SPIEN_SEP | Output | Serial EEPROM chip select
|
||||
| PB27 | SPICS_DISP | Output | Display chip select
|
||||
| PB28 | SPI_RXD_3V | Input | SPI Data Rx
|
||||
| PB29 | SPI_TXD | Output | SPI Data Tx
|
||||
| PB30 | SPI_CLK | Output | SPI Clock
|
||||
| PC10 | DISPA0 | Output | Display A0
|
||||
| PC11 | BACKLIGHT | Output | Display backlit
|
||||
| PC12 | SPI2RXD | Input | (V1) 2nd SPI RXD
|
||||
| | IO_RESET | Output | (V2) General I/O reset
|
||||
| PC13 | SPI2TXD | Output | (V1) 2nd SPI TXD (V1)
|
||||
| | HOOK | Input | (V2) Hook input interrupt
|
||||
| PC15 | SPI2CLK | Output | (V1) 2nd SPI CLK
|
||||
| | F_RY_BY | Input | (V2) NAND F_RY_BY
|
||||
| PE17 | F_ALE | Output | NAND F_ALE
|
||||
| PE18 | F_CLE | Output | NAND F_CLE
|
||||
| PE20 | F_CE | Output | NAND F_CE
|
||||
| PE24 | SPICS_SCOUT | Output | (V1) Codec chip select
|
||||
| | LED | Output | (V2) LED
|
||||
| PE27 | SPICS_ER | Output | External serial register CS
|
||||
| PE28 | LEDIO1 | Output | (V1) LED
|
||||
| | BKBR1 | Input | (V2) Keyboard input scan
|
||||
| PE29 | LEDIO2 | Output | (V1) LED hook for A (TA2)
|
||||
| | BKBR2 | Input | (V2) Keyboard input scan
|
||||
| PE30 | LEDIO3 | Output | (V1) LED hook for A (TA2)
|
||||
| | BKBR3 | Input | (V2) Keyboard input scan
|
||||
| PE31 | F_RY_BY | Input | (V1) NAND F_RY_BY
|
||||
| | BKBR4 | Input | (V2) Keyboard input scan
|
||||
+------+----------------+--------+---------------------------------------------------
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Serial register input:
|
||||
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| # | Name | Comment
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| 0 | BKBR1 | (V1) Keyboard input scan
|
||||
| 1 | BKBR3 | (V1) Keyboard input scan
|
||||
| 2 | BKBR4 | (V1) Keyboard input scan
|
||||
| 3 | BKBR2 | (V1) Keyboard input scan
|
||||
| 4 | HOOK | (V1) Hook switch
|
||||
| 5 | BT_LINK | (V1) Bluetooth link status
|
||||
| 6 | HOST_WAKE | (V1) Bluetooth host wake up
|
||||
| 7 | OK_ETH | (V1) Cisco inline power OK status
|
||||
+------+----------------+------------------------------------------------------------
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Serial register output:
|
||||
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| # | Name | Comment
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| 0 | KEY1 | Keyboard output scan
|
||||
| 1 | KEY2 | Keyboard output scan
|
||||
| 2 | KEY3 | Keyboard output scan
|
||||
| 3 | KEY4 | Keyboard output scan
|
||||
| 4 | KEY5 | Keyboard output scan
|
||||
| 5 | KEY6 | Keyboard output scan
|
||||
| 6 | KEY7 | Keyboard output scan
|
||||
| 7 | BT_WAKE | Bluetooth wake up
|
||||
+------+----------------+------------------------------------------------------------
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Chip selects:
|
||||
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| # | Name | Comment
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| CS0 | CS0 | Boot flash
|
||||
| CS1 | CS_FLASH | NAND flash
|
||||
| CS2 | CS_DSP | DSP
|
||||
| CS3 | DCS_DRAM | DRAM
|
||||
| CS4 | CS_FLASH2 | (V2) 2nd flash
|
||||
+------+----------------+------------------------------------------------------------
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Interrupts:
|
||||
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| # | Name | Comment
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| IRQ1 | IRQ_DSP | DSP interrupt
|
||||
| IRQ3 | S_INTER | DUSLIC ???
|
||||
| IRQ4 | F_RY_BY | NAND
|
||||
| IRQ7 | IRQ_MAX | MAX 3100 interrupt
|
||||
+------+----------------+------------------------------------------------------------
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Interrupts on PCMCIA pins:
|
||||
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| # | Name | Comment
|
||||
+------+----------------+------------------------------------------------------------
|
||||
| IP_A0| PHY1_LINK | Link status changed for #1 Ethernet interface
|
||||
| IP_A1| PHY2_LINK | Link status changed for #2 Ethernet interface
|
||||
| IP_A2| RMII1_MDINT | PHY interrupt for #1
|
||||
| IP_A3| RMII2_MDINT | PHY interrupt for #2
|
||||
| IP_A5| HOST_WAKE | (V2) Bluetooth host wake
|
||||
| IP_A6| OK_ETH | (V2) Cisco inline power OK
|
||||
+------+----------------+------------------------------------------------------------
|
||||
|
||||
*************************************************************************************************/
|
||||
|
||||
#define CONFIG_SED156X 1 /* use SED156X */
|
||||
#define CONFIG_SED156X_PG12864Q 1 /* type of display used */
|
||||
|
||||
/* serial interfacing macros */
|
||||
|
||||
#define SED156X_SPI_RXD_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
|
||||
#define SED156X_SPI_RXD_MASK 0x00000008
|
||||
|
||||
#define SED156X_SPI_TXD_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
|
||||
#define SED156X_SPI_TXD_MASK 0x00000004
|
||||
|
||||
#define SED156X_SPI_CLK_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
|
||||
#define SED156X_SPI_CLK_MASK 0x00000002
|
||||
|
||||
#define SED156X_CS_PORT (((volatile immap_t *)CFG_IMMR)->im_cpm.cp_pbdat)
|
||||
#define SED156X_CS_MASK 0x00000010
|
||||
|
||||
#define SED156X_A0_PORT (((volatile immap_t *)CFG_IMMR)->im_ioport.iop_pcdat)
|
||||
#define SED156X_A0_MASK 0x0020
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
#define CFG_CONSOLE_IS_IN_ENV 1
|
||||
#define CFG_CONSOLE_OVERWRITE_ROUTINE 1
|
||||
#define CFG_CONSOLE_ENV_OVERWRITE 1
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
/* use board specific hardware */
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
#define CONFIG_HW_WATCHDOG
|
||||
#define CONFIG_SHOW_ACTIVITY
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
/* phone console configuration */
|
||||
|
||||
#define PHONE_CONSOLE_POLL_HZ (CFG_HZ/200) /* poll every 5ms */
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
#define CONFIG_CDP_DEVICE_ID 20
|
||||
#define CONFIG_CDP_DEVICE_ID_PREFIX "NP" /* netphone */
|
||||
#define CONFIG_CDP_PORT_ID "eth%d"
|
||||
#define CONFIG_CDP_CAPABILITIES 0x00000010
|
||||
#define CONFIG_CDP_VERSION "u-boot" " " __DATE__ " " __TIME__
|
||||
#define CONFIG_CDP_PLATFORM "Intracom NetPhone"
|
||||
#define CONFIG_CDP_TRIGGER 0x20020001
|
||||
#define CONFIG_CDP_POWER_CONSUMPTION 4300 /* 90 mA @ 48V */
|
||||
#define CONFIG_CDP_APPLIANCE_VLAN_TYPE 0x01 /* ipphone */
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
#define CONFIG_AUTO_COMPLETE 1
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
#define CONFIG_CRC32_VERIFY 1
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
#define CONFIG_HUSH_OLD_PARSER_COMPATIBLE 1
|
||||
|
||||
/*************************************************************************************************/
|
||||
#endif /* __CONFIG_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user