mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-04 10:46:40 +03:00
Compare commits
271 Commits
next
...
U_BOOT_0_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9af3c87df | ||
|
|
0bb9c6d97b | ||
|
|
2fbb03d89a | ||
|
|
5dca182836 | ||
|
|
fd365c3f43 | ||
|
|
4fb2fdd81e | ||
|
|
53ea025bf5 | ||
|
|
698f757abb | ||
|
|
9773f1a266 | ||
|
|
05bb0f7d1c | ||
|
|
1d515fd105 | ||
|
|
bbceee2758 | ||
|
|
5dbddaef7c | ||
|
|
af44ce1d72 | ||
|
|
4618c6ab0f | ||
|
|
202886e0d6 | ||
|
|
59f24d6411 | ||
|
|
a76ba54ab6 | ||
|
|
1e29473207 | ||
|
|
c82d8344f7 | ||
|
|
5656ee5159 | ||
|
|
ba2b8c99d8 | ||
|
|
c3fa9c7991 | ||
|
|
7ab1fcab65 | ||
|
|
fd83e8f3cc | ||
|
|
ec5b860b79 | ||
|
|
404ad7fddb | ||
|
|
959605070f | ||
|
|
9e960983f2 | ||
|
|
ecb55a9cef | ||
|
|
b7124744e3 | ||
|
|
84c233e876 | ||
|
|
c876ddbae3 | ||
|
|
9505ad35e5 | ||
|
|
c2a33e02f0 | ||
|
|
b36b891209 | ||
|
|
b8ab5b6a2d | ||
|
|
2cd07417a0 | ||
|
|
127a8ef38e | ||
|
|
6b7b721d21 | ||
|
|
ca06e5e1bc | ||
|
|
2fb31894aa | ||
|
|
0254406bb7 | ||
|
|
99316db63a | ||
|
|
4b7207cd40 | ||
|
|
2f6fe53c2d | ||
|
|
a51f981a4d | ||
|
|
4e8ae64a5e | ||
|
|
858629febf | ||
|
|
778767853c | ||
|
|
e94fcf85b0 | ||
|
|
f2e461526b | ||
|
|
a965326b8b | ||
|
|
afda246c56 | ||
|
|
323589970b | ||
|
|
955b0446fb | ||
|
|
ab877d2898 | ||
|
|
0287dc5998 | ||
|
|
548e010ceb | ||
|
|
313407468f | ||
|
|
0bbf91b835 | ||
|
|
fa2330df08 | ||
|
|
b0416e7240 | ||
|
|
24de8299a5 | ||
|
|
86a91ee48b | ||
|
|
1bfcfbd2b6 | ||
|
|
d0ad4a3962 | ||
|
|
ca609c46f6 | ||
|
|
f93b71f66a | ||
|
|
d084527f4c | ||
|
|
8395a4ee16 | ||
|
|
0f38cf79a6 | ||
|
|
b4c31ff9af | ||
|
|
440e08e365 | ||
|
|
0947cd2822 | ||
|
|
70be492e02 | ||
|
|
a7d9ede1be | ||
|
|
044e11a99a | ||
|
|
86f34a4a5c | ||
|
|
81ddd12649 | ||
|
|
abe8ec0058 | ||
|
|
f1c1a033fc | ||
|
|
cb6ddd4bac | ||
|
|
07c7005ef5 | ||
|
|
20cd658966 | ||
|
|
1d3f1fbfc9 | ||
|
|
598cace710 | ||
|
|
9cb4521c18 | ||
|
|
4b12b7848b | ||
|
|
4b548838d4 | ||
|
|
f19df3df99 | ||
|
|
3408138bd8 | ||
|
|
803522e308 | ||
|
|
931c9671ea | ||
|
|
0c4ba1701a | ||
|
|
ed0368637a | ||
|
|
fa732b7bc6 | ||
|
|
877ca67929 | ||
|
|
98c6751dca | ||
|
|
02e58cb16f | ||
|
|
c3587e105a | ||
|
|
9ed561e2a9 | ||
|
|
b3e34cab10 | ||
|
|
7067d32b82 | ||
|
|
76e0eb31ba | ||
|
|
93e0ff4276 | ||
|
|
d93622ec0d | ||
|
|
93e6168826 | ||
|
|
1871891c7b | ||
|
|
2e59dab8cd | ||
|
|
cd1d2fa56f | ||
|
|
d05e5b88d6 | ||
|
|
4061869227 | ||
|
|
0bb275ee7e | ||
|
|
d38d06d26d | ||
|
|
de6c759ac5 | ||
|
|
ec92a0d748 | ||
|
|
e22ede21f2 | ||
|
|
fb3c93d828 | ||
|
|
061b69b867 | ||
|
|
1510a32215 | ||
|
|
2a967eee65 | ||
|
|
fe7937a43e | ||
|
|
393285c547 | ||
|
|
76e9ee4014 | ||
|
|
aec41f5a99 | ||
|
|
5bd7914826 | ||
|
|
72f816bb1d | ||
|
|
2e3fce6047 | ||
|
|
0e6b5c95ba | ||
|
|
af742b4509 | ||
|
|
8950d29557 | ||
|
|
01c0719117 | ||
|
|
73e319c4e2 | ||
|
|
a0fb24cb71 | ||
|
|
623942c28e | ||
|
|
8df8042b24 | ||
|
|
c5d3979e4b | ||
|
|
529b836fd0 | ||
|
|
0efbe014c8 | ||
|
|
2c4ee9d273 | ||
|
|
6dc8ff8933 | ||
|
|
3f41baf819 | ||
|
|
0dde803b1a | ||
|
|
145f0f2bfd | ||
|
|
8a48315f1a | ||
|
|
4b7616f44d | ||
|
|
4cc53f2468 | ||
|
|
ab49df5716 | ||
|
|
884169971c | ||
|
|
d2f8dfc9e4 | ||
|
|
259f08f908 | ||
|
|
8ee8e9fb17 | ||
|
|
f97472928d | ||
|
|
343384468c | ||
|
|
c8888a3064 | ||
|
|
bc6d7db71f | ||
|
|
ea825d0da4 | ||
|
|
1f9a3fa93d | ||
|
|
b834d7fdd0 | ||
|
|
c0b6c05023 | ||
|
|
8603e4edb1 | ||
|
|
00403e7054 | ||
|
|
345e64144d | ||
|
|
07e703a6b6 | ||
|
|
b8b6a7efdb | ||
|
|
b88a09f9fb | ||
|
|
7738787e67 | ||
|
|
915e9586bb | ||
|
|
626eecf7ca | ||
|
|
6c70c2d920 | ||
|
|
f472193178 | ||
|
|
43addf9c46 | ||
|
|
c5f00eee97 | ||
|
|
16a78f7453 | ||
|
|
889992582d | ||
|
|
f29075c80c | ||
|
|
c55d855f14 | ||
|
|
0d8699d8b4 | ||
|
|
ae0a512a7a | ||
|
|
d27f1e2e9f | ||
|
|
6520fc7d76 | ||
|
|
6365fc1dba | ||
|
|
639fab42fc | ||
|
|
50e336ef01 | ||
|
|
16948ad514 | ||
|
|
8e7ce96d2c | ||
|
|
6853c9ac8a | ||
|
|
7c980c2933 | ||
|
|
2935b75404 | ||
|
|
dc4c293bb4 | ||
|
|
9164b95259 | ||
|
|
b9697c568c | ||
|
|
adeeaae644 | ||
|
|
2322999783 | ||
|
|
c4a33a7257 | ||
|
|
a2b1e9ab35 | ||
|
|
4762446c2c | ||
|
|
887f2ae5c4 | ||
|
|
3cc1e568f8 | ||
|
|
76429b356d | ||
|
|
0871aab0ae | ||
|
|
acdcc1d416 | ||
|
|
76944be127 | ||
|
|
7ebb90dbad | ||
|
|
cd0194618d | ||
|
|
dd70a2eebe | ||
|
|
c2d2919f70 | ||
|
|
e17ae1282d | ||
|
|
bdc7c1e6b0 | ||
|
|
ac09fb2877 | ||
|
|
6ffab10b04 | ||
|
|
3afca0085c | ||
|
|
5450258b5c | ||
|
|
12f4378df7 | ||
|
|
2624c68fda | ||
|
|
1570142012 | ||
|
|
e722ad6db9 | ||
|
|
cb358d7347 | ||
|
|
811182acf2 | ||
|
|
4de33d136f | ||
|
|
dddfaba1b7 | ||
|
|
175e74227f | ||
|
|
67951bb601 | ||
|
|
020c3f4a68 | ||
|
|
3837617fed | ||
|
|
da6e699861 | ||
|
|
63e1d21332 | ||
|
|
d1cd2ec073 | ||
|
|
883a4875ac | ||
|
|
8b7c3ffe04 | ||
|
|
40a0dd7bae | ||
|
|
6bdd261e35 | ||
|
|
13177da74a | ||
|
|
a4e66789ea | ||
|
|
3a59b01052 | ||
|
|
838dad9d0d | ||
|
|
ec28501746 | ||
|
|
b83e9c6869 | ||
|
|
959a5946bc | ||
|
|
deece49ddc | ||
|
|
15e8fcd5f3 | ||
|
|
3111c78abe | ||
|
|
314b538df5 | ||
|
|
0e3ae923b1 | ||
|
|
9af8118286 | ||
|
|
4f40b1d157 | ||
|
|
ea83a47fa5 | ||
|
|
b6aeec131c | ||
|
|
e3f98d52ca | ||
|
|
f927be05a7 | ||
|
|
d6011ecc83 | ||
|
|
1ac124472b | ||
|
|
8d309a02a3 | ||
|
|
beaff29244 | ||
|
|
dd43c39c43 | ||
|
|
d69d21fcdb | ||
|
|
e931db31bb | ||
|
|
f3c0e0bfb8 | ||
|
|
22874e8c9c | ||
|
|
ce5eb643ea | ||
|
|
b839bbe562 | ||
|
|
750f83b2ef | ||
|
|
aac448715d | ||
|
|
74505dd14f | ||
|
|
eea324cbde | ||
|
|
e47b2abf2f | ||
|
|
915531931a | ||
|
|
fda0926381 | ||
|
|
643a03dff1 | ||
|
|
9956b03b95 |
12
CHANGELOG
Normal file
12
CHANGELOG
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
======================================================================
|
||||
Notes for U-Boot 1.0.0:
|
||||
======================================================================
|
||||
|
||||
This is the initial version of "Das U-Boot", the Universal Boot Loader.
|
||||
|
||||
It is based on version 2.0.0 (the "Halloween Release") of PPCBoot.
|
||||
For information about the history of the project please see the
|
||||
PPCBoot project page at http://sourceforge.net/projects/ppcboot
|
||||
|
||||
======================================================================
|
||||
242
CREDITS
Normal file
242
CREDITS
Normal file
@@ -0,0 +1,242 @@
|
||||
#
|
||||
# Parts of the development effort for this project have been
|
||||
# sponsored by SIEMENS AG, Austria. Thanks to SIEMENS for
|
||||
# supporting an Open Source project!
|
||||
#
|
||||
#
|
||||
# This is at least a partial credits-file of individual people that
|
||||
# have contributed to the U-Boot project. It is sorted by name and
|
||||
# formatted to allow easy grepping and beautification by scripts.
|
||||
# The fields are: name (N), email (E), web-address (W), PGP key ID
|
||||
# and fingerprint (P), description (D), and snail-mail address (S).
|
||||
# Thanks,
|
||||
#
|
||||
# Wolfgang Denk
|
||||
#----------
|
||||
|
||||
N: Dr. Bruno Achauer
|
||||
E: bruno@exet-ag.de
|
||||
D: Support for NetBSD (both as host and target system)
|
||||
|
||||
N: Swen Anderson
|
||||
E: sand@peppercon.de
|
||||
D: ERIC Support
|
||||
|
||||
N: Guillaume Alexandre
|
||||
E: guillaume.alexandre@gespac.ch
|
||||
D: Add PCIPPC6 configuration
|
||||
|
||||
N: Pierre Aubert
|
||||
E: <p.aubert@staubli.com>
|
||||
D: Support for RPXClassic board
|
||||
|
||||
N: Andre Beaudin
|
||||
E: <andre.beaudin@colubris.com>
|
||||
D: PCMCIA, Ethernet, TFTP
|
||||
|
||||
N: Jerry van Baren
|
||||
E: <vanbaren@cideas.com>
|
||||
D: BedBug port to 603e core (MPC82xx). Code for enhanced memory test.
|
||||
|
||||
N: Raphael Bossek
|
||||
E: raphael.bossek@solutions4linux.de
|
||||
D: 8xxrom-0.3.0
|
||||
|
||||
N: David Brown
|
||||
E: DBrown03@harris.com
|
||||
D: Extensions to 8xxrom-0.3.0
|
||||
|
||||
N: Oliver Brown
|
||||
E: obrown@adventnetworks.com
|
||||
D: Port to the gw8260 board
|
||||
|
||||
N: Jonathan De Bruyne
|
||||
E: jonathan.debruyne@siemens.atea.be
|
||||
D: Port to Siemens IAD210 board
|
||||
|
||||
N: Conn Clark
|
||||
E: clark@esteem.com
|
||||
D: ESTEEM192E support
|
||||
|
||||
N: Magnus Damm
|
||||
E: eramdam@kieray1.p.y.ki.era.ericsson.se
|
||||
D: 8xxrom
|
||||
|
||||
N: Kári Davíðsson
|
||||
E: kd@flaga.is
|
||||
D: FLAGA DM Support
|
||||
|
||||
N: Wolfgang Denk
|
||||
E: wd@denx.de
|
||||
D: U-Boot initial version, continuing maintenance, ARMBoot merge
|
||||
W: http://www.denx.de
|
||||
|
||||
N: Dan A. Dickey
|
||||
E: ddickey@charter.net
|
||||
D: FADS Support
|
||||
|
||||
N: James F. Dougherty
|
||||
E: jfd@GigabitNetworks.COM
|
||||
D: Port to the MOUSSE board
|
||||
|
||||
N: Dave Ellis
|
||||
E: DGE@sixnetio.com
|
||||
D: EEPROM Speedup, SXNI855T port
|
||||
|
||||
N: Dr. Wolfgang Grandegger
|
||||
E: wg@denx.de
|
||||
D: Support for Interphase 4539 T1/E1/J1 PMC, PN62, CCM, SCM boards
|
||||
W: www.denx.de
|
||||
|
||||
N: Frank Gottschling
|
||||
E: fgottschling@eltec.de
|
||||
D: Support for ELTEC MHPC/BAB7xx/ELPPC boards, cfb-console, i8042, SMI LynxEM
|
||||
W: www.eltec.de
|
||||
|
||||
N: Marius Groeger
|
||||
E: mgroeger@sysgo.de
|
||||
D: MBX Support, board specific function interface, EST SBC8260 support; initial support for StrongARM (LART), ARM720TDMI (implementa A7)
|
||||
W: www.elinos.com
|
||||
|
||||
N: Kirk Haderlie
|
||||
E: khaderlie@vividimage.com
|
||||
D: Added TFTP to 8xxrom (-> 0.3.1)
|
||||
|
||||
N: Chris Hallinan
|
||||
E: clh@net1plus.com
|
||||
D: DHCP Support
|
||||
|
||||
N: Anne-Sophie Harnois
|
||||
E: Anne-Sophie.Harnois@nextream.fr
|
||||
D: Port to Walnut405 board
|
||||
|
||||
N: Andreas Heppel
|
||||
E: aheppel@sysgo.de
|
||||
D: CPU Support for MPC 75x; board support for Eltec BAB750 [obsolete!]
|
||||
|
||||
N: Josh Huber
|
||||
E: huber@alum.wpi.edu
|
||||
D: Port to the Galileo Evaluation Board, and the MPC74xx cpu series.
|
||||
W: http://www.mclx.com/
|
||||
|
||||
H: Stuart Hughes
|
||||
E: stuarth@lineo.com
|
||||
D: Port to MPC8260ADS board
|
||||
|
||||
H: Rich Ireland
|
||||
E: r.ireland@computer.org
|
||||
D: FPGA device configuration driver
|
||||
|
||||
N: Gary Jennejohn
|
||||
E: garyj@jennejohn.org, gj@denx.de
|
||||
D: Support for Samsung ARM920T S3C2400X, ARM920T "TRAB"
|
||||
W: www.denx.de
|
||||
|
||||
N: Murray Jensen
|
||||
E: Murray.Jensen@cmst.csiro.au
|
||||
D: Initial 8260 support; GDB support
|
||||
D: Port to Cogent+Hymod boards; Hymod Board Database
|
||||
W: http://www.msa.cmst.csiro.au/ourstaff/MurrayJensen/mjj.html
|
||||
|
||||
N: Yoo. Jonghoon
|
||||
E: yooth@ipone.co.kr
|
||||
D: Added port to the RPXlite board
|
||||
|
||||
N: Brad Kemp
|
||||
E: Brad.Kemp@seranoa.com
|
||||
D: Port to Windriver ppmc8260 board
|
||||
|
||||
N: Thomas Koeller
|
||||
E: tkoeller@gmx.net
|
||||
D: Port to Motorola Sandpoint 3 (MPC8240)
|
||||
|
||||
N: Thomas Lange
|
||||
E: thomas@corelatus.com
|
||||
D: Support for GTH board; lots of PCMCIA fixes
|
||||
|
||||
N: Raymond Lo
|
||||
E: lo@routefree.com
|
||||
D: Support for DOS partitions
|
||||
|
||||
N: Dan Malek
|
||||
E: dan@netx4.com
|
||||
D: FADSROM, the grandfather of all of this
|
||||
|
||||
N: Jay Monkman
|
||||
E: jtm@smoothsmoothie.com
|
||||
D: EST SBC8260 support
|
||||
|
||||
N: Frank Morauf
|
||||
E: frank.morauf@salzbrenner.com
|
||||
D: Support for Embedded Planet RPX Super Board
|
||||
|
||||
N: David Müller
|
||||
E: d.mueller@elsoft.ch
|
||||
D: Support for Samsung ARM920T SMDK2410 eval board
|
||||
|
||||
N: Rolf Offermanns
|
||||
E: rof@sysgo.de
|
||||
D: Initial support for SSV-DNP1110, SMC91111 driver
|
||||
W: www.elinos.com
|
||||
|
||||
N: Keith Outwater
|
||||
E: Keith_Outwater@mvis.com
|
||||
D: Support for GEN860T board
|
||||
|
||||
N: Keith Outwater
|
||||
E: keith_outwater@mvis.com
|
||||
D: Support for generic/custom MPC860T board (GEN860T)
|
||||
|
||||
N: Frank Panno
|
||||
E: fpanno@delphintech.com
|
||||
D: Support for Embedded Planet EP8260 Board
|
||||
|
||||
N: Denis Peter
|
||||
E: d.peter@mpl.ch
|
||||
D: Support for 4xx SCSI, floppy, CDROM, CT69000 video, ...
|
||||
D: Support for PIP405 board
|
||||
D: Support for MIP405 board
|
||||
|
||||
N: Bill Pitts
|
||||
E: wlp@mindspring.com
|
||||
D: BedBug embedded debugger code
|
||||
|
||||
N: Stefan Roese
|
||||
E: stefan.roese@esd-electronics.com
|
||||
D: IBM PPC401/403/405GP Support; Windows environment support
|
||||
|
||||
N: Neil Russell
|
||||
E: caret@c-side.com
|
||||
D: Author of LiMon-1.4.2, which contributed some ideas
|
||||
|
||||
N: Paolo Scaffardi
|
||||
E: arsenio@tin.it
|
||||
D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots more
|
||||
|
||||
N: Robert Schwebel
|
||||
E: r.schwebel@pengutronix.de
|
||||
D: Support for csb226 board (xscale)
|
||||
N: Rob Taylor
|
||||
E: robt@flyingpig.com
|
||||
D: Port to MBX860T and Sandpoint8240
|
||||
|
||||
N: Erik Theisen
|
||||
E: etheisen@mindspring.com
|
||||
D: MBX8xx and many other patches
|
||||
|
||||
N: Jim Thompson
|
||||
E: jim@musenki.com
|
||||
D: Support for MUSENKI board
|
||||
|
||||
N: David Updegraff
|
||||
E: dave@cray.com
|
||||
D: Port to Cray L1 board; DHCP vendor extensions
|
||||
|
||||
N: Christian Vejlbo
|
||||
E: christian.vejlbo@tellabs.com
|
||||
D: FADS860T ethernet support
|
||||
|
||||
N: Alex Zuepke
|
||||
E: azu@sysgo.de
|
||||
D: Overall improvements on StrongARM, ARM720TDMI; Support for Tuxscreen; initial PCMCIA support for ARM
|
||||
W: www.elinos.com
|
||||
249
MAINTAINERS
Normal file
249
MAINTAINERS
Normal file
@@ -0,0 +1,249 @@
|
||||
#########################################################################
|
||||
# #
|
||||
# Regular Maintainers for U-Boot board support: #
|
||||
# #
|
||||
# For any board without permanent maintainer, please contact #
|
||||
# for PowerPC systems: #
|
||||
# Wolfgang Denk <wd@denx.de> #
|
||||
# for ARM systems: #
|
||||
# Marius Gröger <mag@sysgo.de> #
|
||||
# and Cc: the <U-Boot-Users@lists.sourceforge.net> mailing lists. #
|
||||
# #
|
||||
# Note: lists sorted by Maintainer Name #
|
||||
#########################################################################
|
||||
|
||||
|
||||
#########################################################################
|
||||
# #
|
||||
# Maintainer Name, Email Address #
|
||||
# Board CPU #
|
||||
#########################################################################
|
||||
|
||||
Greg Allen <gallen@arlut.utexas.edu>
|
||||
|
||||
UTX8245 MPC8245
|
||||
|
||||
Pantelis Antoniou <panto@intracom.gr>
|
||||
|
||||
NETVIA MPC8xx
|
||||
|
||||
Jerry Van Baren <vanbaren_gerald@si.com>
|
||||
|
||||
sacsng MPC8260
|
||||
|
||||
Oliver Brown <obrown@adventnetworks.com>
|
||||
|
||||
sbc8260 MPC8260
|
||||
gw8260 MPC8260
|
||||
|
||||
Conn Clark <clark@esteem.com>
|
||||
|
||||
ESTEEM192E MPC8xx
|
||||
|
||||
Kári Davíðsson <kd@flaga.is>
|
||||
|
||||
FLAGADM MPC823
|
||||
|
||||
Wolfgang Denk <wd@denx.de>
|
||||
|
||||
AMX860 MPC860
|
||||
ETX094 MPC850
|
||||
FPS850L MPC850
|
||||
ICU862 MPC862
|
||||
IP860 MPC860
|
||||
IVML24 MPC860
|
||||
IVML24_128 MPC860
|
||||
IVML24_256 MPC860
|
||||
IVMS8 MPC860
|
||||
IVMS8_128 MPC860
|
||||
IVMS8_256 MPC860
|
||||
LANTEC MPC850
|
||||
RRvision MPC823
|
||||
SM850 MPC850
|
||||
SPD823TS MPC823
|
||||
TQM823L MPC823
|
||||
TQM823L_LCD MPC823
|
||||
TQM850L MPC850
|
||||
TQM855L MPC855
|
||||
TQM860L MPC860
|
||||
TQM860L_FEC MPC860
|
||||
c2mon MPC855
|
||||
hermes MPC860
|
||||
lwmon MPC823
|
||||
pcu_e MPC855
|
||||
|
||||
CU824 MPC8240
|
||||
Sandpoint8240 MPC8240
|
||||
|
||||
CPU86 MPC8260
|
||||
PM826 MPC8260
|
||||
TQM8260 MPC8260
|
||||
|
||||
PCIPPC2 MPC750
|
||||
PCIPPC6 MPC750
|
||||
|
||||
Jon Diekema <diekema_jon@si.com>
|
||||
|
||||
sbc8260 MPC8260
|
||||
|
||||
Dave Ellis <DGE@sixnetio.com>
|
||||
|
||||
SXNI855T MPC8xx
|
||||
|
||||
Frank Gottschling <fgottschling@eltec.de>
|
||||
|
||||
MHPC MPC8xx
|
||||
|
||||
BAB7xx MPC740/MPC750
|
||||
|
||||
Wolfgang Grandegger <wg@denx.de>
|
||||
|
||||
CCM MPC855
|
||||
|
||||
PN62 MPC8240
|
||||
|
||||
IPHASE4539 MPC8260
|
||||
SCM MPC8260
|
||||
|
||||
Howard Gray <mvsensor@matrix-vision.de>
|
||||
|
||||
MVS1 MPC823
|
||||
|
||||
Murray Jensen <Murray.Jensen@cmst.csiro.au>
|
||||
|
||||
cogent_mpc8xx MPC8xx
|
||||
|
||||
cogent_mpc8260 MPC8260
|
||||
hymod MPC8260
|
||||
|
||||
Brad Kemp <Brad.Kemp@seranoa.com>
|
||||
|
||||
ppmc8260 MPC8260
|
||||
|
||||
Nye Liu <nyet@zumanetworks.com>
|
||||
|
||||
ZUMA MPC7xx_74xx
|
||||
|
||||
Thomas Lange <thomas@corelatus.com>
|
||||
|
||||
GTH MPC860
|
||||
|
||||
Eran Man <eran@nbase.co.il>
|
||||
|
||||
EVB64260_750CX MPC750CX
|
||||
|
||||
Scott McNutt <smcnutt@artesyncp.com>
|
||||
|
||||
EBONY PPC440GP
|
||||
|
||||
Keith Outwater <Keith_Outwater@mvis.com>
|
||||
|
||||
GEN860T MPC860T
|
||||
|
||||
Frank Panno <fpanno@delphintech.com>
|
||||
|
||||
ep8260 MPC8260
|
||||
|
||||
Denis Peter <d.peter@mpl.ch>
|
||||
|
||||
MIP405 PPC4xx
|
||||
PIP405 PPC4xx
|
||||
|
||||
Stefan Roese <stefan.roese@esd-electronics.com>
|
||||
|
||||
ADCIOP IOP480 (PPC401)
|
||||
AR405 PPC405GP
|
||||
CANBT PPC405CR
|
||||
CPCI405 PPC405GP
|
||||
CPCI440 PPC440GP
|
||||
CPCIISER4 PPC405GP
|
||||
DASA_SIM IOP480 (PPC401)
|
||||
DU405 PPC405GP
|
||||
OCRTC PPC405GP
|
||||
ORSG PPC405GP
|
||||
|
||||
Peter De Schrijver <p2@mind.be>
|
||||
|
||||
ML2 PPC4xx
|
||||
|
||||
Erik Theisen <etheisen@mindspring.com>
|
||||
|
||||
W7OLMC PPC4xx
|
||||
W7OLMG PPC4xx
|
||||
|
||||
Jim Thompson <jim@musenki.com>
|
||||
|
||||
MUSENKI MPC8245/8241
|
||||
Sandpoint8245 MPC8245
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Unknown / orphaned boards:
|
||||
|
||||
ADS860 MPC8xx
|
||||
FADS823 MPC8xx
|
||||
FADS850SAR MPC8xx
|
||||
FADS860T MPC8xx
|
||||
GENIETV MPC8xx
|
||||
IAD210 MPC8xx
|
||||
MBX MPC8xx
|
||||
MBX860T MPC8xx
|
||||
NX823 MPC8xx
|
||||
RPXClassic MPC8xx
|
||||
RPXlite MPC8xx
|
||||
|
||||
CRAYL1 PPC4xx
|
||||
ERIC PPC4xx
|
||||
WALNUT405 PPC4xx
|
||||
|
||||
MOUSSE MPC824x
|
||||
|
||||
MPC8260ADS MPC8260
|
||||
RPXsuper MPC8260
|
||||
rsdproto MPC8260
|
||||
|
||||
EVB64260 MPC7xx_74xx
|
||||
|
||||
|
||||
#########################################################################
|
||||
# ARM Systems: #
|
||||
# #
|
||||
# Maintainer Name, Email Address #
|
||||
# Board CPU #
|
||||
#########################################################################
|
||||
|
||||
Marius Gröger <mag@sysgo.de>
|
||||
|
||||
impa7 ARM720T (EP7211)
|
||||
ep7312 ARM720T (EP7312)
|
||||
|
||||
Kyle Harris <kharris@nexus-tech.net>
|
||||
|
||||
lubbock xscale
|
||||
cradle xscale
|
||||
|
||||
Gary Jennejohn <gj@denx.de>
|
||||
|
||||
smdk2400 ARM920T
|
||||
trab ARM920T
|
||||
|
||||
David Müller <d.mueller@elsoft.ch>
|
||||
|
||||
smdk2410 ARM920T
|
||||
|
||||
Rolf Offermanns <rof@sysgo.de>
|
||||
|
||||
shannon SA1100
|
||||
|
||||
Robert Schwebel <r.schwebel@pengutronix.de>
|
||||
|
||||
csb226 xscale
|
||||
|
||||
Alex Züpke <azu@sysgo.de>
|
||||
|
||||
lart SA1100
|
||||
dnp1110 SA1110
|
||||
|
||||
#########################################################################
|
||||
# End of MAINTAINERS list #
|
||||
#########################################################################
|
||||
138
MAKEALL
Normal file
138
MAKEALL
Normal file
@@ -0,0 +1,138 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "${CROSS_COMPILE}" ] ; then
|
||||
MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
|
||||
else
|
||||
MAKE=make
|
||||
fi
|
||||
|
||||
[ -d LOG ] || mkdir LOG || exit 1
|
||||
|
||||
LIST=""
|
||||
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_8xx=" \
|
||||
ADS860 AMX860 c2mon CCM \
|
||||
cogent_mpc8xx ESTEEM192E ETX094 FADS823 \
|
||||
FADS850SAR FADS860T FLAGADM FPS850L \
|
||||
GEN860T GENIETV GTH hermes \
|
||||
IAD210 ICU862_100MHz IP860 IVML24 \
|
||||
IVML24_128 IVML24_256 IVMS8 IVMS8_128 \
|
||||
IVMS8_256 LANTEC lwmon MBX \
|
||||
MBX860T MHPC MVS1 NETVIA \
|
||||
NX823 pcu_e R360MPI RPXClassic \
|
||||
RPXlite RRvision SM850 SPD823TS \
|
||||
SXNI855T TQM823L TQM823L_LCD TQM850L \
|
||||
TQM855L TQM860L TQM860L_FEC TTTech \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## PPC4xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_4xx=" \
|
||||
ADCIOP AR405 CANBT CPCI405 \
|
||||
CPCI4052 CPCI440 CPCIISER4 CRAYL1 \
|
||||
DASA_SIM DU405 EBONY ERIC \
|
||||
MIP405 ML2 OCRTC ORSG \
|
||||
PCI405 PIP405 W7OLMC W7OLMG \
|
||||
WALNUT405 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MPC824x Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_824x=" \
|
||||
BMW CU824 MOUSSE MUSENKI \
|
||||
OXC PN62 Sandpoint8240 Sandpoint8245 \
|
||||
utx8245 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## MPC8260 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_8260=" \
|
||||
cogent_mpc8260 CPU86 ep8260 gw8260 \
|
||||
hymod IPHASE4539 MPC8260ADS PM826 \
|
||||
ppmc8260 RPXsuper rsdproto sacsng \
|
||||
sbc8260 SCM TQM8260 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
## 74xx/7xx Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_74xx=" \
|
||||
EVB64260 PCIPPC2 PCIPPC6 ZUMA \
|
||||
"
|
||||
|
||||
LIST_7xx=" \
|
||||
BAB7xx ELPPC \
|
||||
"
|
||||
|
||||
LIST_ppc="${LIST_8xx} ${LIST_824x} ${LIST_8260} \
|
||||
${LIST_4xx} ${LIST_74xx} ${LIST_7xx}"
|
||||
|
||||
#########################################################################
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_SA="lart shannon dnp1110"
|
||||
|
||||
#########################################################################
|
||||
## ARM7 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_ARM7="impa7 ep7312"
|
||||
|
||||
#########################################################################
|
||||
## ARM9 Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_ARM9="smdk2400 smdk2410 trab"
|
||||
|
||||
#########################################################################
|
||||
## Xscale Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_xscale="lubbock cradle csb226"
|
||||
|
||||
|
||||
LIST_arm="${LIST_SA} ${LIST_ARM7} ${LIST_ARM9} ${LIST_xscale}"
|
||||
|
||||
|
||||
#----- for now, just run PPC by default -----
|
||||
[ $# = 0 ] && set $LIST_ppc
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
build_target() {
|
||||
target=$1
|
||||
|
||||
${MAKE} distclean >/dev/null
|
||||
${MAKE} ${target}_config
|
||||
${MAKE} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR
|
||||
${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
|
||||
for arg in $@
|
||||
do
|
||||
case "$arg" in
|
||||
8xx|824x|8260|4xx|7xx|74xx|SA|ARM7|ARM9|ppc|arm|xscale)
|
||||
for target in `eval echo '$LIST_'${arg}`
|
||||
do
|
||||
build_target ${target}
|
||||
done
|
||||
;;
|
||||
*) build_target ${arg}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
656
Makefile
Normal file
656
Makefile
Normal file
@@ -0,0 +1,656 @@
|
||||
#
|
||||
# (C) Copyright 2000, 2001, 2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
HOSTARCH := $(shell uname -m | \
|
||||
sed -e s/i.86/i386/ \
|
||||
-e s/sun4u/sparc64/ \
|
||||
-e s/arm.*/arm/ \
|
||||
-e s/sa110/arm/ \
|
||||
-e s/powerpc/ppc/ \
|
||||
-e s/macppc/ppc/)
|
||||
|
||||
HOSTOS := $(shell uname -s | tr A-Z a-z | \
|
||||
sed -e 's/\(cygwin\).*/cygwin/')
|
||||
|
||||
export HOSTARCH
|
||||
|
||||
# Deal with colliding definitions from tcsh etc.
|
||||
VENDOR=
|
||||
|
||||
#########################################################################
|
||||
|
||||
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||
export TOPDIR
|
||||
|
||||
ifeq (include/config.mk,$(wildcard include/config.mk))
|
||||
# load ARCH, BOARD, and CPU configuration
|
||||
include include/config.mk
|
||||
export ARCH CPU BOARD VENDOR
|
||||
# load other configuration
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
ifeq ($(HOSTARCH),ppc)
|
||||
CROSS_COMPILE =
|
||||
else
|
||||
## #ifeq ($(CPU),mpc8xx)
|
||||
## CROSS_COMPILE = ppc_8xx-
|
||||
## #endif
|
||||
## #ifeq ($(CPU),ppc4xx)
|
||||
## #CROSS_COMPILE = ppc_4xx-
|
||||
## #endif
|
||||
## #ifeq ($(CPU),mpc824x)
|
||||
## #CROSS_COMPILE = ppc_82xx-
|
||||
## #endif
|
||||
## #ifeq ($(CPU),mpc8260)
|
||||
## #CROSS_COMPILE = ppc_82xx-
|
||||
## #endif
|
||||
## #ifeq ($(CPU),74xx_7xx)
|
||||
## #CROSS_COMPILE = ppc_74xx-)
|
||||
## #endif
|
||||
ifeq ($(ARCH),ppc)
|
||||
CROSS_COMPILE = ppc_8xx-
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
CROSS_COMPILE = arm_920TDI-
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
export CROSS_COMPILE
|
||||
|
||||
# The "tools" are needed early, so put this first
|
||||
SUBDIRS = tools \
|
||||
lib_generic \
|
||||
lib_$(ARCH) \
|
||||
cpu/$(CPU) \
|
||||
board/$(BOARDDIR) \
|
||||
common \
|
||||
disk \
|
||||
fs \
|
||||
net \
|
||||
rtc \
|
||||
dtt \
|
||||
drivers \
|
||||
post \
|
||||
post/cpu \
|
||||
examples
|
||||
|
||||
#########################################################################
|
||||
# U-Boot objects....order is important (i.e. start must be first)
|
||||
|
||||
OBJS = cpu/$(CPU)/start.o
|
||||
|
||||
ifeq ($(CPU),ppc4xx)
|
||||
OBJS += cpu/$(CPU)/resetvec.o
|
||||
endif
|
||||
|
||||
LIBS = board/$(BOARDDIR)/lib$(BOARD).a
|
||||
LIBS += cpu/$(CPU)/lib$(CPU).a
|
||||
LIBS += lib_$(ARCH)/lib$(ARCH).a
|
||||
LIBS += fs/jffs2/libjffs2.a
|
||||
LIBS += net/libnet.a
|
||||
LIBS += disk/libdisk.a
|
||||
LIBS += rtc/librtc.a
|
||||
LIBS += dtt/libdtt.a
|
||||
LIBS += drivers/libdrivers.a
|
||||
LIBS += post/libpost.a post/cpu/libcpu.a
|
||||
LIBS += common/libcommon.a
|
||||
LIBS += lib_generic/libgeneric.a
|
||||
|
||||
#########################################################################
|
||||
|
||||
all: u-boot.srec u-boot.bin System.map
|
||||
|
||||
install: all
|
||||
cp u-boot.bin /tftpboot/u-boot.bin
|
||||
cp u-boot.bin /net/sam/tftpboot/u-boot.bin
|
||||
|
||||
u-boot.srec: u-boot
|
||||
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
|
||||
|
||||
u-boot.bin: u-boot
|
||||
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
|
||||
|
||||
u-boot.dis: u-boot
|
||||
$(OBJDUMP) -d $< > $@
|
||||
|
||||
u-boot: depend subdirs $(OBJS) $(LIBS) $(LDSCRIPT)
|
||||
$(LD) $(LDFLAGS) $(OBJS) $(LIBS) $(LIBS) -Map u-boot.map -o u-boot
|
||||
|
||||
subdirs:
|
||||
@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir || exit 1 ; done
|
||||
|
||||
depend dep:
|
||||
@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
|
||||
|
||||
tags:
|
||||
ctags -w `find $(SUBDIRS) include \
|
||||
\( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
|
||||
|
||||
etags:
|
||||
etags -a `find $(SUBDIRS) include \
|
||||
\( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
|
||||
|
||||
System.map: u-boot
|
||||
@$(NM) $< | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > System.map
|
||||
|
||||
#########################################################################
|
||||
else
|
||||
all install u-boot u-boot.srec depend dep:
|
||||
@echo "System not configured - see README" >&2
|
||||
@ exit 1
|
||||
endif
|
||||
|
||||
#########################################################################
|
||||
|
||||
unconfig:
|
||||
rm -f include/config.h include/config.mk
|
||||
|
||||
#========================================================================
|
||||
# PowerPC
|
||||
#========================================================================
|
||||
#########################################################################
|
||||
## MPC8xx Systems
|
||||
#########################################################################
|
||||
|
||||
ADS860_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx fads
|
||||
|
||||
AMX860_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx amx860 westel
|
||||
|
||||
c2mon_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx c2mon
|
||||
|
||||
CCM_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx CCM siemens
|
||||
|
||||
cogent_mpc8xx_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx cogent
|
||||
|
||||
ESTEEM192E_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx esteem192e
|
||||
|
||||
ETX094_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx etx094
|
||||
|
||||
FADS823_config \
|
||||
FADS850SAR_config \
|
||||
FADS860T_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx fads
|
||||
|
||||
FLAGADM_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx flagadm
|
||||
|
||||
GEN860T_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx gen860t
|
||||
|
||||
GENIETV_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx genietv
|
||||
|
||||
GTH_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx gth
|
||||
|
||||
hermes_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx hermes
|
||||
|
||||
IAD210_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx IAD210 siemens
|
||||
|
||||
xtract_ICU862 = $(subst _100MHz,,$(subst _config,,$1))
|
||||
|
||||
ICU862_100MHz_config \
|
||||
ICU862_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _100MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_100MHz" >>include/config.h ; \
|
||||
echo "... with 100MHz system clock" ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_ICU862,$@) ppc mpc8xx icu862
|
||||
|
||||
IP860_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx ip860
|
||||
|
||||
IVML24_256_config \
|
||||
IVML24_128_config \
|
||||
IVML24_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring IVML24_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_IVML24_16M" >>include/config.h ; \
|
||||
}
|
||||
@[ -z "$(findstring IVML24_128_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_IVML24_32M" >>include/config.h ; \
|
||||
}
|
||||
@[ -z "$(findstring IVML24_256_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_IVML24_64M" >>include/config.h ; \
|
||||
}
|
||||
@./mkconfig -a IVML24 ppc mpc8xx ivm
|
||||
|
||||
IVMS8_256_config \
|
||||
IVMS8_128_config \
|
||||
IVMS8_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring IVMS8_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_IVMS8_16M" >>include/config.h ; \
|
||||
}
|
||||
@[ -z "$(findstring IVMS8_128_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_IVMS8_32M" >>include/config.h ; \
|
||||
}
|
||||
@[ -z "$(findstring IVMS8_256_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_IVMS8_64M" >>include/config.h ; \
|
||||
}
|
||||
@./mkconfig -a IVMS8 ppc mpc8xx ivm
|
||||
|
||||
LANTEC_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx lantec
|
||||
|
||||
lwmon_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx lwmon
|
||||
|
||||
MBX_config \
|
||||
MBX860T_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx mbx8xx
|
||||
|
||||
MHPC_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx mhpc eltec
|
||||
|
||||
MVS1_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx mvs1
|
||||
|
||||
NETVIA_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx netvia
|
||||
|
||||
NX823_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx nx823
|
||||
|
||||
pcu_e_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx pcu_e siemens
|
||||
|
||||
R360MPI_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx r360mpi
|
||||
|
||||
RPXClassic_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx RPXClassic
|
||||
|
||||
RPXlite_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx RPXlite
|
||||
|
||||
RRvision_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx RRvision
|
||||
|
||||
RRvision_LCD_config: unconfig
|
||||
@echo "#define CONFIG_LCD" >include/config.h
|
||||
@echo "#define CONFIG_SHARP_LQ104V7DS01" >>include/config.h
|
||||
@./mkconfig -a RRvision ppc mpc8xx RRvision
|
||||
|
||||
SM850_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
|
||||
|
||||
SPD823TS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx spd8xx
|
||||
|
||||
SXNI855T_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx sixnet
|
||||
|
||||
# Play some tricks for configuration selection
|
||||
# All boards can come with 50 MHz (default), 66MHz or 80MHz clock,
|
||||
# but only 855 and 860 boards may come with FEC
|
||||
# and 823 boards may have LCD support
|
||||
xtract_8xx = $(subst _66MHz,,$(subst _80MHz,,$(subst _LCD,,$(subst _FEC,,$(subst _config,,$1)))))
|
||||
|
||||
FPS850L_config \
|
||||
TQM823L_config \
|
||||
TQM823L_66MHz_config \
|
||||
TQM823L_80MHz_config \
|
||||
TQM823L_LCD_config \
|
||||
TQM823L_LCD_66MHz_config \
|
||||
TQM823L_LCD_80MHz_config \
|
||||
TQM850L_config \
|
||||
TQM850L_66MHz_config \
|
||||
TQM850L_80MHz_config \
|
||||
TQM855L_config \
|
||||
TQM855L_66MHz_config \
|
||||
TQM855L_80MHz_config \
|
||||
TQM855L_FEC_config \
|
||||
TQM855L_FEC_66MHz_config \
|
||||
TQM855L_FEC_80MHz_config \
|
||||
TQM860L_config \
|
||||
TQM860L_66MHz_config \
|
||||
TQM860L_80MHz_config \
|
||||
TQM860L_FEC_config \
|
||||
TQM860L_FEC_66MHz_config \
|
||||
TQM860L_FEC_80MHz_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _FEC,$@)" ] || \
|
||||
{ echo "#define CONFIG_FEC_ENET" >>include/config.h ; \
|
||||
echo "... with FEC support" ; \
|
||||
}
|
||||
@[ -z "$(findstring _66MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_66MHz" >>include/config.h ; \
|
||||
echo "... with 66MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _80MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_80MHz" >>include/config.h ; \
|
||||
echo "... with 80MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _LCD,$@)" ] || \
|
||||
{ echo "#define CONFIG_LCD" >>include/config.h ; \
|
||||
echo "#define CONFIG_NEC_NL6648BC20" >>include/config.h ; \
|
||||
echo "... with LCD display" ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_8xx,$@) ppc mpc8xx tqm8xx
|
||||
|
||||
TTTech_config: unconfig
|
||||
@echo "#define CONFIG_LCD" >include/config.h
|
||||
@echo "#define CONFIG_SHARP_LQ104V7DS01" >>include/config.h
|
||||
@./mkconfig -a TQM823L ppc mpc8xx tqm8xx
|
||||
|
||||
#########################################################################
|
||||
## PPC4xx Systems
|
||||
#########################################################################
|
||||
|
||||
ADCIOP_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx adciop esd
|
||||
|
||||
AR405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ar405 esd
|
||||
|
||||
CANBT_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx canbt esd
|
||||
|
||||
CPCI405_config \
|
||||
CPCI4052_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx cpci405 esd
|
||||
@echo "BOARD_REVISION = $(@:_config=)" >>include/config.mk
|
||||
|
||||
CPCI440_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx cpci440 esd
|
||||
|
||||
CPCIISER4_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx cpciiser4 esd
|
||||
|
||||
CRAYL1_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx L1 cray
|
||||
|
||||
DASA_SIM_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx dasa_sim esd
|
||||
|
||||
DU405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx du405 esd
|
||||
|
||||
EBONY_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ebony
|
||||
|
||||
ERIC_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx eric
|
||||
|
||||
MIP405_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx mip405 mpl
|
||||
|
||||
ML2_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ml2
|
||||
|
||||
OCRTC_config \
|
||||
ORSG_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ocrtc esd
|
||||
|
||||
PCI405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx pci405 esd
|
||||
|
||||
PIP405_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx pip405 mpl
|
||||
|
||||
W7OLMC_config \
|
||||
W7OLMG_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx w7o
|
||||
|
||||
WALNUT405_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx walnut405
|
||||
|
||||
#########################################################################
|
||||
## MPC824x Systems
|
||||
#########################################################################
|
||||
BMW_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x bmw
|
||||
|
||||
CU824_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x cu824
|
||||
|
||||
MOUSSE_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x mousse
|
||||
|
||||
MUSENKI_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x musenki
|
||||
|
||||
OXC_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x oxc
|
||||
|
||||
PN62_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x pn62
|
||||
|
||||
Sandpoint8240_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x sandpoint
|
||||
|
||||
Sandpoint8245_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x sandpoint
|
||||
|
||||
utx8245_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x utx8245
|
||||
|
||||
#########################################################################
|
||||
## MPC8260 Systems
|
||||
#########################################################################
|
||||
xtract_82xx = $(subst _ROMBOOT,,$(subst _L2,,$(subst _266MHz,,$(subst _300MHz,,$(subst _config,,$1)))))
|
||||
|
||||
cogent_mpc8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 cogent
|
||||
|
||||
CPU86_config \
|
||||
CPU86_ROMBOOT_config: unconfig
|
||||
@./mkconfig $(call xtract_82xx,$@) ppc mpc8260 cpu86
|
||||
@cd ./include ; \
|
||||
if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
|
||||
echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
|
||||
echo "... booting from 8-bit flash" ; \
|
||||
else \
|
||||
echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
|
||||
echo "... booting from 64-bit flash" ; \
|
||||
fi; \
|
||||
echo "export CONFIG_BOOT_ROM" >> config.mk;
|
||||
|
||||
ep8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 ep8260
|
||||
|
||||
gw8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 gw8260
|
||||
|
||||
hymod_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 hymod
|
||||
|
||||
IPHASE4539_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 iphase4539
|
||||
|
||||
MPC8260ADS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 mpc8260ads
|
||||
|
||||
PM826_config \
|
||||
PM826_ROMBOOT_config: unconfig
|
||||
@./mkconfig $(call xtract_82xx,$@) ppc mpc8260 pm826
|
||||
@cd ./include ; \
|
||||
if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
|
||||
echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
|
||||
echo "... booting from 8-bit flash" ; \
|
||||
else \
|
||||
echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
|
||||
echo "... booting from 64-bit flash" ; \
|
||||
fi; \
|
||||
echo "export CONFIG_BOOT_ROM" >> config.mk; \
|
||||
|
||||
ppmc8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 ppmc8260
|
||||
|
||||
RPXsuper_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 rpxsuper
|
||||
|
||||
rsdproto_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 rsdproto
|
||||
|
||||
sacsng_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 sacsng
|
||||
|
||||
sbc8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 sbc8260
|
||||
|
||||
SCM_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 SCM siemens
|
||||
|
||||
TQM8260_config \
|
||||
TQM8260_L2_config \
|
||||
TQM8260_266MHz_config \
|
||||
TQM8260_L2_266MHz_config \
|
||||
TQM8260_300MHz_config: unconfig
|
||||
@ >include/config.h
|
||||
@if [ "$(findstring _L2_,$@)" ] ; then \
|
||||
echo "#define CONFIG_L2_CACHE" >>include/config.h ; \
|
||||
echo "... with L2 Cache support (60x Bus Mode)" ; \
|
||||
else \
|
||||
echo "#undef CONFIG_L2_CACHE" >>include/config.h ; \
|
||||
echo "... without L2 Cache support" ; \
|
||||
fi
|
||||
@[ -z "$(findstring _266MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_266MHz" >>include/config.h ; \
|
||||
echo "... with 266MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _300MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_300MHz" >>include/config.h ; \
|
||||
echo "... with 300MHz system clock" ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_82xx,$@) ppc mpc8260 tqm8260
|
||||
|
||||
#########################################################################
|
||||
## 74xx/7xx Systems
|
||||
#########################################################################
|
||||
|
||||
EVB64260_config \
|
||||
EVB64260_750CX_config: unconfig
|
||||
@./mkconfig EVB64260 ppc 74xx_7xx evb64260
|
||||
|
||||
ZUMA_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc 74xx_7xx evb64260
|
||||
|
||||
PCIPPC2_config \
|
||||
PCIPPC6_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc 74xx_7xx pcippc2
|
||||
|
||||
BAB7xx_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc 74xx_7xx bab7xx eltec
|
||||
|
||||
ELPPC_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc 74xx_7xx elppc eltec
|
||||
|
||||
#========================================================================
|
||||
# ARM
|
||||
#========================================================================
|
||||
#########################################################################
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
lart_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 lart
|
||||
|
||||
dnp1110_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 dnp1110
|
||||
|
||||
shannon_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 shannon
|
||||
|
||||
#########################################################################
|
||||
## ARM920T Systems
|
||||
#########################################################################
|
||||
|
||||
smdk2400_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm920t smdk2400
|
||||
|
||||
smdk2410_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm920t smdk2410
|
||||
|
||||
trab_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm920t trab
|
||||
|
||||
#########################################################################
|
||||
## ARM720T Systems
|
||||
#########################################################################
|
||||
|
||||
impa7_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm720t impa7
|
||||
|
||||
ep7312_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm720t ep7312
|
||||
|
||||
#########################################################################
|
||||
## Xscale Systems
|
||||
#########################################################################
|
||||
|
||||
lubbock_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm xscale lubbock
|
||||
|
||||
cradle_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm xscale cradle
|
||||
|
||||
csb226_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm xscale csb226
|
||||
|
||||
#########################################################################
|
||||
|
||||
clean:
|
||||
find . -type f \
|
||||
\( -name 'core' -o -name '*.bak' -o -name '*~' \
|
||||
-o -name '*.o' -o -name '*.a' \) -print \
|
||||
| xargs rm -f
|
||||
rm -f examples/hello_world examples/timer examples/eepro100_eeprom
|
||||
rm -f tools/img2srec tools/mkimage tools/envcrc tools/gen_eth_addr
|
||||
rm -f tools/easylogo/easylogo tools/bmp_logo
|
||||
rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
|
||||
|
||||
clobber: clean
|
||||
find . -type f \
|
||||
\( -name .depend -o -name '*.srec' -o -name '*.bin' \) \
|
||||
-print \
|
||||
| xargs rm -f
|
||||
rm -f $(OBJS) *.bak tags TAGS
|
||||
rm -fr *.*~
|
||||
rm -f u-boot u-boot.bin u-boot.elf u-boot.srec u-boot.map System.map
|
||||
rm -f tools/crc32.c tools/environment.c
|
||||
rm -f include/asm/arch include/asm
|
||||
|
||||
mrproper \
|
||||
distclean: clobber unconfig
|
||||
|
||||
backup:
|
||||
F=`basename $(TOPDIR)` ; cd .. ; \
|
||||
gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
|
||||
|
||||
#########################################################################
|
||||
24
arm_config.mk
Normal file
24
arm_config.mk
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# (C) Copyright 2000-2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
|
||||
40
board/RPXClassic/Makefile
Normal file
40
board/RPXClassic/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
290
board/RPXClassic/RPXClassic.c
Normal file
290
board/RPXClassic/RPXClassic.c
Normal file
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Stäubli Faverges - <www.staubli.com>
|
||||
* Pierre AUBERT p.aubert@staubli.com
|
||||
* U-Boot port on RPXClassic LF (CLLF_BW31) board
|
||||
*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <i2c.h>
|
||||
#include <config.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static long int dram_size (long int, long int *, long int);
|
||||
static unsigned char aschex_to_byte (unsigned char *cp);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define _NOT_USED_ 0xFFFFCC25
|
||||
|
||||
const uint sdram_table[] =
|
||||
{
|
||||
/*
|
||||
* Single Read. (Offset 00h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0X0CAFCC04, 0X03AFCC08,
|
||||
0x3FBFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Burst Read. (Offset 08h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0x0CAFCC84, 0x03AFCC88,
|
||||
0x3FBFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Single Write. (Offset 18h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0x0CFFCC04, 0x03FFCC00,
|
||||
0x3FFFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Burst Write. (Offset 20h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0x0CFFCC80, 0x03FFCC8C,
|
||||
0x0CFFCC00, 0x33FFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Refresh. (Offset 30h in UPMA RAM)
|
||||
*/
|
||||
0xC0FFCC24, 0x03FFCC24, 0x0FFFCC24, 0x0FFFCC24,
|
||||
0x3FFFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Exception. (Offset 3Ch in UPMA RAM)
|
||||
*/
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*/
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
puts ("Board: RPXClassic\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* board_get_enetaddr -- Read the MAC Address in the I2C EEPROM
|
||||
*-----------------------------------------------------------------------------
|
||||
*/
|
||||
void board_get_enetaddr (uchar * enet)
|
||||
{
|
||||
int i;
|
||||
char buff[256], *cp;
|
||||
|
||||
/* Initialize I2C */
|
||||
i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE);
|
||||
|
||||
/* Read 256 bytes in EEPROM */
|
||||
i2c_read (0x54, 0, 1, buff, 128);
|
||||
i2c_read (0x54, 128, 1, buff + 128, 128);
|
||||
|
||||
/* Retrieve MAC address in buffer (key EA) */
|
||||
for (cp = buff;;) {
|
||||
if (cp[0] == 'E' && cp[1] == 'A') {
|
||||
cp += 3;
|
||||
/* Read MAC address */
|
||||
for (i = 0; i < 6; i++, cp += 2) {
|
||||
enet[i] = aschex_to_byte (cp);
|
||||
}
|
||||
}
|
||||
/* Scan to the end of the record */
|
||||
while ((*cp != '\n') && (*cp != 0xff)) {
|
||||
cp++;
|
||||
}
|
||||
/* If the next character is a \n, 0 or ff, we are done. */
|
||||
cp++;
|
||||
if ((*cp == '\n') || (*cp == 0) || (*cp == 0xff))
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FEC_ENET
|
||||
/* The MAC address is the same as normal ethernet except the 3rd byte */
|
||||
/* (See the E.P. Planet Core Overview manual */
|
||||
enet[3] |= 0x80;
|
||||
|
||||
/* Validate the fast ethernet tranceiver */
|
||||
*((volatile uchar *) BCSR2) &= ~BCSR2_MIICTL;
|
||||
*((volatile uchar *) BCSR2) &= ~BCSR2_MIIPWRDWN;
|
||||
*((volatile uchar *) BCSR2) |= BCSR2_MIIRST;
|
||||
*((volatile uchar *) BCSR2) |= BCSR2_MIIPWRDWN;
|
||||
#endif
|
||||
|
||||
printf ("MAC address = %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
enet[0], enet[1], enet[2], enet[3], enet[4], enet[5]);
|
||||
|
||||
}
|
||||
|
||||
void rpxclassic_init (void)
|
||||
{
|
||||
/* Enable NVRAM */
|
||||
*((uchar *) BCSR0) |= BCSR0_ENNVRAM;
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
long int size10;
|
||||
|
||||
upmconfig (UPMA, (uint *) sdram_table,
|
||||
sizeof (sdram_table) / sizeof (uint));
|
||||
|
||||
/* Refresh clock prescalar */
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
|
||||
memctl->memc_mar = 0x00000000;
|
||||
|
||||
/* Map controller banks 1 to the SDRAM bank */
|
||||
memctl->memc_or1 = CFG_OR1_PRELIM;
|
||||
memctl->memc_br1 = CFG_BR1_PRELIM;
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR_10COL & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
udelay (200);
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80002230; /* SDRAM bank 0 - refresh twice */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/* Check Bank 0 Memory Size
|
||||
* try 10 column mode
|
||||
*/
|
||||
|
||||
size10 = dram_size (CFG_MAMR_10COL, (ulong *) SDRAM_BASE_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
return (size10);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
static unsigned char aschex_to_byte (unsigned char *cp)
|
||||
{
|
||||
u_char byte, c;
|
||||
|
||||
c = *cp++;
|
||||
|
||||
if ((c >= 'A') && (c <= 'F')) {
|
||||
c -= 'A';
|
||||
c += 10;
|
||||
} else if ((c >= 'a') && (c <= 'f')) {
|
||||
c -= 'a';
|
||||
c += 10;
|
||||
} else {
|
||||
c -= '0';
|
||||
}
|
||||
|
||||
byte = c * 16;
|
||||
|
||||
c = *cp;
|
||||
|
||||
if ((c >= 'A') && (c <= 'F')) {
|
||||
c -= 'A';
|
||||
c += 10;
|
||||
} else if ((c >= 'a') && (c <= 'f')) {
|
||||
c -= 'a';
|
||||
c += 10;
|
||||
} else {
|
||||
c -= '0';
|
||||
}
|
||||
|
||||
byte += c;
|
||||
|
||||
return (byte);
|
||||
}
|
||||
29
board/RPXClassic/config.mk
Normal file
29
board/RPXClassic/config.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Stäubli Faverges - <www.staubli.com>
|
||||
# Pierre AUBERT p.aubert@staubli.com
|
||||
# U-Boot port on RPXClassic LF (CLLF_BW31) board
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xff000000
|
||||
447
board/RPXClassic/flash.c
Normal file
447
board/RPXClassic/flash.c
Normal file
@@ -0,0 +1,447 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Stäubli Faverges - <www.staubli.com>
|
||||
* Pierre AUBERT p.aubert@staubli.com
|
||||
* U-Boot port on RPXClassic LF (CLLF_BW31) board
|
||||
*
|
||||
* RPXClassic uses Am29DL323B flash memory with 2 banks
|
||||
*
|
||||
*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include <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_word (flash_info_t *info, ulong dest, ulong data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0 ;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
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+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
flash_info[0].size = size_b0;
|
||||
|
||||
return (size_b0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x00010000;
|
||||
info->start[3] = base + 0x00018000;
|
||||
info->start[4] = base + 0x00020000;
|
||||
info->start[5] = base + 0x00028000;
|
||||
info->start[6] = base + 0x00030000;
|
||||
info->start[7] = base + 0x00038000;
|
||||
for (i = 8; i < info->sector_count; i++) {
|
||||
info->start[i] = base + ((i-7) * 0x00040000) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
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;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AMDL323B:
|
||||
printf ("AMDL323DB (16 Mbytes, bottom boot sect)\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;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
|
||||
/* Reset flash componeny */
|
||||
addr [0] = 0xf0f0f0f0;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0xAAA] = 0xAAAAAAAA ;
|
||||
addr[0x555] = 0x55555555 ;
|
||||
addr[0xAAA] = 0x90909090 ;
|
||||
|
||||
value = addr[0] ;
|
||||
|
||||
switch (value & 0x00FF00FF) {
|
||||
case AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[2] ; /* device ID */
|
||||
|
||||
switch (value & 0x00FF00FF) {
|
||||
case (AMD_ID_DL323B & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AMDL323B;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x01000000; /* 16 Mb */
|
||||
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
/* set up sector start address table */
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x00010000;
|
||||
info->start[3] = base + 0x00018000;
|
||||
info->start[4] = base + 0x00020000;
|
||||
info->start[5] = base + 0x00028000;
|
||||
info->start[6] = base + 0x00030000;
|
||||
info->start[7] = base + 0x00038000;
|
||||
for (i = 8; i < info->sector_count; i++) {
|
||||
info->start[i] = base + ((i-7) * 0x00040000) ;
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < 23; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr = (volatile unsigned long *)(info->start[i]);
|
||||
info->protect[i] = addr[4] & 1 ;
|
||||
}
|
||||
/* Check for protected sectors in the 2nd bank */
|
||||
addr[0x100AAA] = 0xAAAAAAAA ;
|
||||
addr[0x100555] = 0x55555555 ;
|
||||
addr[0x100AAA] = 0x90909090 ;
|
||||
|
||||
for (i = 23; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr = (volatile unsigned long *)(info->start[i]);
|
||||
info->protect[i] = addr[4] & 1 ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
|
||||
*addr = 0xF0F0F0F0; /* reset bank 1 */
|
||||
addr = (volatile unsigned long *)info->start[23];
|
||||
|
||||
*addr = 0xF0F0F0F0; /* reset bank 2 */
|
||||
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
vu_long *addr = (vu_long*)(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[0xAAA] = 0xAAAAAAAA;
|
||||
addr[0x555] = 0x55555555;
|
||||
addr[0xAAA] = 0x80808080;
|
||||
addr[0xAAA] = 0xAAAAAAAA;
|
||||
addr[0x555] = 0x55555555;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (vu_long *)(info->start[sect]) ;
|
||||
addr[0] = 0x30303030 ;
|
||||
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_long *)(info->start[l_sect]);
|
||||
while ((addr[0] & 0x80808080) != 0x80808080) {
|
||||
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_long *)info->start[0];
|
||||
addr[0] = 0xF0F0F0F0; /* 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)
|
||||
{
|
||||
vu_long *addr = (vu_long *)(info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_long *)dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0xAAA] = 0xAAAAAAAA;
|
||||
addr[0x555] = 0x55555555;
|
||||
addr[0xAAA] = 0xA0A0A0A0;
|
||||
|
||||
*((vu_long *)dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
while ((*((vu_long *)dest) & 0x80808080) != (data & 0x80808080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
134
board/RPXClassic/u-boot.lds
Normal file
134
board/RPXClassic/u-boot.lds
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
/* XXX ?
|
||||
. = 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: */
|
||||
. = (. + 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 = .);
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
|
||||
131
board/RPXClassic/u-boot.lds.debug
Normal file
131
board/RPXClassic/u-boot.lds.debug
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
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 = .);
|
||||
|
||||
__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/RPXlite/Makefile
Normal file
40
board/RPXlite/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
195
board/RPXlite/RPXlite.c
Normal file
195
board/RPXlite/RPXlite.c
Normal file
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Yoo. Jonghoon, IPone, yooth@ipone.co.kr
|
||||
* U-Boot port on RPXlite board
|
||||
*
|
||||
* DRAM related UPMA register values are modified.
|
||||
* See RPXLite engineering note : 50MHz/60ns - UPM RAM WORDS
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static long int dram_size (long int, long int *, long int);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define _NOT_USED_ 0xFFFFCC25
|
||||
|
||||
const uint sdram_table[] =
|
||||
{
|
||||
/*
|
||||
* Single Read. (Offset 00h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0X0CAFCC04, 0X03AFCC08,
|
||||
0x3FBFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Burst Read. (Offset 08h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0x0CAFCC84, 0x03AFCC88,
|
||||
0x3FBFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Single Write. (Offset 18h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0x0CFFCC04, 0x03FFCC00,
|
||||
0x3FFFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Burst Write. (Offset 20h in UPMA RAM)
|
||||
*/
|
||||
0xCFFFCC24, 0x0FFFCC04, 0x0CFFCC80, 0x03FFCC8C,
|
||||
0x0CFFCC00, 0x33FFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Refresh. (Offset 30h in UPMA RAM)
|
||||
*/
|
||||
0xC0FFCC24, 0x03FFCC24, 0x0FFFCC24, 0x0FFFCC24,
|
||||
0x3FFFCC27, /* last */
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_,
|
||||
|
||||
/*
|
||||
* Exception. (Offset 3Ch in UPMA RAM)
|
||||
*/
|
||||
_NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*/
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
puts ("Board: RPXlite\n") ;
|
||||
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 size10 ;
|
||||
|
||||
upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
|
||||
|
||||
/* Refresh clock prescalar */
|
||||
memctl->memc_mptpr = CFG_MPTPR ;
|
||||
|
||||
memctl->memc_mar = 0x00000000;
|
||||
|
||||
/* Map controller banks 1 to the SDRAM bank */
|
||||
memctl->memc_or1 = CFG_OR1_PRELIM;
|
||||
memctl->memc_br1 = CFG_BR1_PRELIM;
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR_10COL & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
udelay(200);
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80002230 ; /* SDRAM bank 0 - refresh twice */
|
||||
udelay(1);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/* Check Bank 0 Memory Size
|
||||
* try 10 column mode
|
||||
*/
|
||||
|
||||
size10 = dram_size (CFG_MAMR_10COL, (ulong *)SDRAM_BASE_PRELIM, SDRAM_MAX_SIZE) ;
|
||||
|
||||
return (size10);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
28
board/RPXlite/config.mk
Normal file
28
board/RPXlite/config.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# RPXlite boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xfff00000
|
||||
524
board/RPXlite/flash.c
Normal file
524
board/RPXlite/flash.c
Normal file
@@ -0,0 +1,524 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Yoo. Jonghoon, IPone, yooth@ipone.co.kr
|
||||
* U-Boot port on RPXlite board
|
||||
*
|
||||
* Some of flash control words are modified. (from 2x16bit device
|
||||
* to 4x8bit device)
|
||||
* RPXLite board I tested has only 4 AM29LV800BB devices. Other devices
|
||||
* are not tested.
|
||||
*
|
||||
* (?) Does an RPXLite board which
|
||||
* does not use AM29LV800 flash memory exist ?
|
||||
* I don't know...
|
||||
*/
|
||||
|
||||
#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_word (flash_info_t *info, ulong dest, ulong 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_b0 ;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
/*
|
||||
size_b0 = flash_get_size((vu_long *)FLASH_BASE_DEBUG, &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);
|
||||
}
|
||||
*/
|
||||
/* 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;
|
||||
%%%*/
|
||||
/* 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+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
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_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00010000;
|
||||
info->start[2] = base + 0x00018000;
|
||||
info->start[3] = base + 0x00020000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + ((i-3) * 0x00040000) ;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
info->start[i--] = base + info->size - 0x00018000;
|
||||
info->start[i--] = base + info->size - 0x00020000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00040000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
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;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0xAAA] = 0x00AA00AA ;
|
||||
addr[0x555] = 0x00550055 ;
|
||||
addr[0xAAA] = 0x00900090 ;
|
||||
|
||||
value = addr[0] ;
|
||||
|
||||
switch (value & 0x00FF00FF) {
|
||||
case AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[2] ; /* device ID */
|
||||
|
||||
switch (value & 0x00FF00FF) {
|
||||
case (AMD_ID_LV400T & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (AMD_ID_LV400B & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case (AMD_ID_LV800T & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case (AMD_ID_LV800B & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00400000; /*%%% Size doubled by yooth */
|
||||
break; /* => 4 MB */
|
||||
|
||||
case (AMD_ID_LV160T & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case (AMD_ID_LV160B & 0x00FF00FF):
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case AMD_ID_LV320T:
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
case AMD_ID_LV320B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
#endif
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
/*%%% sector start address modified */
|
||||
/* set up sector start address table */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00010000;
|
||||
info->start[2] = base + 0x00018000;
|
||||
info->start[3] = base + 0x00020000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + ((i-3) * 0x00040000) ;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
info->start[i--] = base + info->size - 0x00018000;
|
||||
info->start[i--] = base + info->size - 0x00020000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00040000;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr = (volatile unsigned long *)(info->start[i]);
|
||||
info->protect[i] = addr[4] & 1 ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
|
||||
*addr = 0xF0F0F0F0; /* reset bank */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
vu_long *addr = (vu_long*)(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[0xAAA] = 0xAAAAAAAA;
|
||||
addr[0x555] = 0x55555555;
|
||||
addr[0xAAA] = 0x80808080;
|
||||
addr[0xAAA] = 0xAAAAAAAA;
|
||||
addr[0x555] = 0x55555555;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (vu_long *)(info->start[sect]) ;
|
||||
addr[0] = 0x30303030 ;
|
||||
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_long *)(info->start[l_sect]);
|
||||
while ((addr[0] & 0x80808080) != 0x80808080) {
|
||||
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_long *)info->start[0];
|
||||
addr[0] = 0xF0F0F0F0; /* 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)
|
||||
{
|
||||
vu_long *addr = (vu_long *)(info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_long *)dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0xAAA] = 0xAAAAAAAA;
|
||||
addr[0x555] = 0x55555555;
|
||||
addr[0xAAA] = 0xA0A0A0A0;
|
||||
|
||||
*((vu_long *)dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
while ((*((vu_long *)dest) & 0x80808080) != (data & 0x80808080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
134
board/RPXlite/u-boot.lds
Normal file
134
board/RPXlite/u-boot.lds
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
/* XXX ?
|
||||
. = 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: */
|
||||
. = (. + 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 = .);
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
|
||||
131
board/RPXlite/u-boot.lds.debug
Normal file
131
board/RPXlite/u-boot.lds.debug
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
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 = .);
|
||||
|
||||
__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/RRvision/Makefile
Normal file
40
board/RRvision/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2000-2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
268
board/RRvision/RRvision.c
Normal file
268
board/RRvision/RRvision.c
Normal file
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* (C) Copyright 2001-2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static long int dram_size (long int, long int *, long int);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#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.
|
||||
*
|
||||
*/
|
||||
0x1FF77C34, 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)
|
||||
*/
|
||||
0x1F07FC04, 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:
|
||||
*
|
||||
* Always return 1 (no second DRAM bank).
|
||||
*/
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
unsigned char *s = getenv ("serial#");
|
||||
|
||||
puts ("Board: RRvision ");
|
||||
|
||||
for (; s && *s; ++s) {
|
||||
if (*s == ' ')
|
||||
break;
|
||||
putc (*s);
|
||||
}
|
||||
|
||||
putc ('\n');
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
unsigned long reg;
|
||||
long int size8, size9;
|
||||
long int size = 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_2BK_8K;
|
||||
|
||||
memctl->memc_mar = 0x00000088;
|
||||
|
||||
/*
|
||||
* Map controller bank 1 the SDRAM bank 2 at physical address 0.
|
||||
*/
|
||||
memctl->memc_or1 = CFG_OR2_PRELIM;
|
||||
memctl->memc_br1 = CFG_BR2_PRELIM;
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR_8COL & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
udelay (200);
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80002230; /* SDRAM bank 0 - execute twice */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Check Bank 0 Memory Size
|
||||
*
|
||||
* try 8 column mode
|
||||
*/
|
||||
size8 = dram_size (CFG_MAMR_8COL,
|
||||
(ulong *)SDRAM_BASE2_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* try 9 column mode
|
||||
*/
|
||||
size9 = dram_size (CFG_MAMR_9COL,
|
||||
(ulong *) SDRAM_BASE2_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
if (size8 < size9) { /* leave configuration at 9 columns */
|
||||
size = size9;
|
||||
/* debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size >> 20); */
|
||||
} else { /* back to 8 columns */
|
||||
size = size8;
|
||||
memctl->memc_mamr = CFG_MAMR_8COL;
|
||||
udelay (500);
|
||||
/* debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size >> 20); */
|
||||
}
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Adjust refresh rate depending on SDRAM type
|
||||
* For types > 128 MBit leave it at the current (fast) rate
|
||||
*/
|
||||
if (size < 0x02000000) {
|
||||
/* reduce to 15.6 us (62.4 us / quad) */
|
||||
memctl->memc_mptpr = CFG_MPTPR_2BK_4K;
|
||||
udelay (1000);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final mapping
|
||||
*/
|
||||
memctl->memc_or1 = ((-size) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
|
||||
memctl->memc_br1 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
|
||||
|
||||
/*
|
||||
* No bank 1
|
||||
*
|
||||
* invalidate bank
|
||||
*/
|
||||
memctl->memc_br3 = 0;
|
||||
|
||||
/* adjust refresh rate depending on SDRAM type, one bank */
|
||||
reg = memctl->memc_mptpr;
|
||||
reg >>= 1; /* reduce to CFG_MPTPR_1BK_8K / _4K */
|
||||
memctl->memc_mptpr = reg;
|
||||
|
||||
udelay (10000);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
28
board/RRvision/config.mk
Normal file
28
board/RRvision/config.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# RedRock vision boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x40000000
|
||||
522
board/RRvision/flash.c
Normal file
522
board/RRvision/flash.c
Normal file
@@ -0,0 +1,522 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
#ifndef CFG_ENV_ADDR
|
||||
#define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
#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);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
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 & OR_AM_MSK);
|
||||
memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size = flash_get_size((vu_long *)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+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
flash_info[0].size = size;
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
puts ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD: puts ("AMD "); break;
|
||||
case FLASH_MAN_FUJ: puts ("FUJITSU "); break;
|
||||
default: puts ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM400B: puts ("AM29LV400B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400T: puts ("AM29LV400T (4 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM800B: puts ("AM29LV800B (8 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM800T: puts ("AM29LV800T (8 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM160B: puts ("AM29LV160B (16 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM160T: puts ("AM29LV160T (16 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM320B: puts ("AM29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T: puts ("AM29LV320T (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
default: puts ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
puts (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
puts ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
puts ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00900090;
|
||||
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
case AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
case AMD_ID_LV400T:
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case AMD_ID_LV400B:
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case AMD_ID_LV800T:
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case AMD_ID_LV800B:
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case AMD_ID_LV160T:
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case AMD_ID_LV160B:
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
case AMD_ID_LV320T:
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
case AMD_ID_LV320B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 71;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
switch (value) {
|
||||
case AMD_ID_LV400B:
|
||||
case AMD_ID_LV800B:
|
||||
case AMD_ID_LV160B:
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x0000C000;
|
||||
info->start[3] = base + 0x00010000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00020000) - 0x00060000;
|
||||
}
|
||||
break;
|
||||
case AMD_ID_LV400T:
|
||||
case AMD_ID_LV800T:
|
||||
case AMD_ID_LV160T:
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
info->start[i--] = base + info->size - 0x0000C000;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00020000;
|
||||
}
|
||||
break;
|
||||
case AMD_ID_LV320B:
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base;
|
||||
/*
|
||||
* The first 8 sectors are 8 kB,
|
||||
* all the other ones are 64 kB
|
||||
*/
|
||||
base += (i < 8)
|
||||
? 2 * ( 8 << 10)
|
||||
: 2 * (64 << 10);
|
||||
}
|
||||
break;
|
||||
case AMD_ID_LV320T:
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base;
|
||||
/*
|
||||
* The last 8 sectors are 8 kB,
|
||||
* all the other ones are 64 kB
|
||||
*/
|
||||
base += (i < (info->sector_count - 8))
|
||||
? 2 * (64 << 10)
|
||||
: 2 * ( 8 << 10);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return (0);
|
||||
break;
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr = (volatile unsigned long *)(info->start[i]);
|
||||
info->protect[i] = addr[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
|
||||
*addr = 0x00F000F0; /* reset bank */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
vu_long *addr = (vu_long*)(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) {
|
||||
puts ("- missing\n");
|
||||
} else {
|
||||
puts ("- 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 {
|
||||
puts ("\n");
|
||||
}
|
||||
|
||||
l_sect = -1;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00800080;
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (vu_long*)(info->start[sect]);
|
||||
addr[0] = 0x00300030;
|
||||
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_long*)(info->start[l_sect]);
|
||||
while ((addr[0] & 0x00800080) != 0x00800080) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
puts ("Timeout\n");
|
||||
return 1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
DONE:
|
||||
/* reset to read mode */
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
addr[0] = 0x00F000F0; /* reset bank */
|
||||
|
||||
puts (" 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)
|
||||
{
|
||||
vu_long *addr = (vu_long*)(info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_long *)dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00A000A0;
|
||||
|
||||
*((vu_long *)dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
while ((*((vu_long *)dest) & 0x00800080) != (data & 0x00800080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
136
board/RRvision/u-boot.lds
Normal file
136
board/RRvision/u-boot.lds
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
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/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)
|
||||
|
||||
. = env_offset;
|
||||
common/environment.o (.ppcenv)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.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 = .);
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
|
||||
43
board/bmw/Makefile
Normal file
43
board/bmw/Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# (C) Copyright 2002
|
||||
# James F. Dougherty, Broadcom Corporation, jfd@broadcom.com
|
||||
# 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 ns16550.o serial.o m48t59y.o
|
||||
|
||||
SOBJS = early_init.o
|
||||
|
||||
$(LIB): .depend $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
340
board/bmw/README
Normal file
340
board/bmw/README
Normal file
@@ -0,0 +1,340 @@
|
||||
Broadcom 95xx BMW CPCI Platform
|
||||
|
||||
Overview
|
||||
=========
|
||||
BMW is an MPC8245 system controller featuring:
|
||||
* 3U CPCI Form Factor
|
||||
* BCM5703 Gigabit Ethernet
|
||||
* M48T59Y NVRAM
|
||||
* 16MB DOC
|
||||
* DIP Socket for Socketed DOC up to 1GB
|
||||
* 64MB SDRAM
|
||||
* LCD Display
|
||||
* Configurable Jumper options for 66,85, and 100Mhz memory bus
|
||||
|
||||
|
||||
BMW System Address Map
|
||||
======================
|
||||
BMW uses the MPC8245 CHRP Address MAP B found in the MPC8245 Users Manual
|
||||
(P.121, Section 3.1 Address Maps, Address Map B). Other I/O devices found
|
||||
onboard the processor module are listed briefly below:
|
||||
|
||||
0x00000000 - 0x40000000 - 64MB SDRAM SIMM
|
||||
(Unregistered PC-100 SDRAM DIMM Module)
|
||||
|
||||
0xFF000000 - 0xFF001FFF - M-Systems DiskOnChip (TM) 2000
|
||||
TSOP 16MB (MD2211-D16-V3)
|
||||
|
||||
0x70000000 - 0x70001FFF - M-Systems DiskOnChip (TM) 2000
|
||||
DIP32 (Socketed 16MB - 1GB ) *
|
||||
NOTE: this is not populated on all systems.
|
||||
|
||||
0x7c000000 - 0x7c000000 - Reset Register
|
||||
(Write 0 to reset)
|
||||
|
||||
0x7c000001 - 0x7c000001 - System LED
|
||||
(Clear Bit 7 to turn on, set to shut off)
|
||||
|
||||
0x7c000002 - 0x7c000002 - M48T59 Watchdog IRQ3
|
||||
(Clear bit 7 to reset, set to assert IRQ3)
|
||||
|
||||
0x7c000003 - 0x7c000003 - M48T59 Write-Protect Register
|
||||
(Clear bit 7 to make R/W, set to make R/O)
|
||||
|
||||
0x7c002000 - 0x7c002003 - Infineon OSRAM DLR2416 4 Character
|
||||
5x7 Dot Matrix Alphanumeric Display
|
||||
(Each byte sets the appropriate character)
|
||||
|
||||
0x7c004000 - 0x7c005FF0 - SGS-THOMSON M48T59Y 8K NVRAM/RTC
|
||||
NVRAM Memory Region
|
||||
|
||||
0x7c005FF0 - 0x7c005FFF - SGS-THOMSON M48T59Y 8K NVRAM/RTC
|
||||
Realtime Clock Registers
|
||||
|
||||
0xFFF00000 - 0xFFF80000 - 512K PLCC32 BootRom
|
||||
(AMD AM29F040, ST 29W040B)
|
||||
|
||||
0xFFF00100 - System Reset Vector
|
||||
|
||||
|
||||
IO/MMU (BAT) Configuration
|
||||
======================
|
||||
The following Block-Address-Translation (BAT) configuration
|
||||
is recommended to access all I/O devices.
|
||||
|
||||
#define CFG_IBAT0L (0x00000000 | BATL_PP_10 | BATL_MEMCOHERENCE)
|
||||
#define CFG_IBAT0U (0x00000000 | BATU_BL_256M | BATU_VS | BATU_VP)
|
||||
|
||||
#define CFG_IBAT1L (0x70000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
|
||||
#define CFG_IBAT1U (0x70000000 | BATU_BL_256M | BATU_VS | BATU_VP)
|
||||
|
||||
#define CFG_IBAT2L (0x80000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
|
||||
#define CFG_IBAT2U (0x80000000 | BATU_BL_256M | BATU_VS | BATU_VP)
|
||||
|
||||
#define CFG_IBAT3L (0xF0000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
|
||||
#define CFG_IBAT3U (0xF0000000 | BATU_BL_256M | BATU_VS | BATU_VP)
|
||||
|
||||
#define CFG_DBAT0L CFG_IBAT0L
|
||||
#define CFG_DBAT0U CFG_IBAT0U
|
||||
#define CFG_DBAT1L CFG_IBAT1L
|
||||
#define CFG_DBAT1U CFG_IBAT1U
|
||||
#define CFG_DBAT2L CFG_IBAT2L
|
||||
#define CFG_DBAT2U CFG_IBAT2U
|
||||
#define CFG_DBAT3L CFG_IBAT3L
|
||||
#define CFG_DBAT3U CFG_IBAT3U
|
||||
|
||||
|
||||
Interrupt Mappings
|
||||
======================
|
||||
BMW uses MPC8245 discrete mode interrupts. With the following
|
||||
hardwired mappings:
|
||||
|
||||
BCM5701 10/100/1000 Ethernet IRQ1
|
||||
CompactPCI Interrupt A IRQ2
|
||||
RTC/Watchdog Interrupt IRQ3
|
||||
Internal NS16552 UART IRQ4
|
||||
|
||||
|
||||
Jumper Settings
|
||||
======================
|
||||
|
||||
BMW has a jumper (JP600) for selecting 66, 85, or 100Mhz memory bus.
|
||||
A jumper (X) is a 0 bit.
|
||||
|
||||
Hence 66= 10110
|
||||
85= 11000
|
||||
100= 10000
|
||||
|
||||
Jumper Settings for various Speeds
|
||||
=======================
|
||||
J1 J2 J3 J4 J5
|
||||
X X 66Mhz
|
||||
=======================
|
||||
J1 J2 J3 J4 J5
|
||||
X X X 85Mhz
|
||||
=======================
|
||||
J1 J2 J3 J4 J5
|
||||
X X X X 100Mhz
|
||||
=======================
|
||||
|
||||
Obviously, 100Mhz memory bus is recommended for optimum performance.
|
||||
|
||||
|
||||
U-Boot
|
||||
===============
|
||||
Broadcom BMW board is supported under config_BWM option.
|
||||
Supported features:
|
||||
|
||||
- NVRAM setenv/getenv (used by Linux Kernel for configuration variables)
|
||||
- BCM570x TFTP file transfer support
|
||||
- LCD Display Support
|
||||
- DOC Support - (underway)
|
||||
|
||||
|
||||
|
||||
U-Boot 1.2.0 (Aug 6 2002 - 17:44:48)
|
||||
|
||||
CPU: MPC8245 Revision 16.20 at 264 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)
|
||||
Built: Aug 6 2002 at 17:44:37
|
||||
Local Bus at 66 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 4095 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
DOC: No DiskOnChip found
|
||||
Hit any key to stop autoboot: 0
|
||||
=>printenv
|
||||
bootdelay=5
|
||||
baudrate=9600
|
||||
clocks_in_mhz=1
|
||||
hostname=switch-2
|
||||
bootcmd=tftp 100000 vmlinux.img;bootm
|
||||
gateway=10.16.64.1
|
||||
ethaddr=00:00:10:18:10:10
|
||||
nfsroot=172.16.40.111:/boot/root-fs
|
||||
filesize=5ec8c
|
||||
netmask=255.255.240.0
|
||||
ipaddr=172.16.40.114
|
||||
serverip=172.16.40.111
|
||||
root=/dev/nfs
|
||||
stdin=serial
|
||||
stdout=serial
|
||||
stderr=serial
|
||||
|
||||
Environment size: 315/8172 bytes
|
||||
=>boot
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DevTools
|
||||
========
|
||||
ELDK
|
||||
DENX Embedded Linux Development Kit
|
||||
|
||||
ROM Emulator
|
||||
Grammar Engine PROMICE P1160-90-AI21E (2MBx8bit, 90ns access time)
|
||||
Grammar Engine PL32E 32Pin PLCC Emulation cables
|
||||
Grammar Engine 3VA8CON (3Volt adapter with Short cables)
|
||||
Grammar Engine FPNET PromICE Ethernet Adapters
|
||||
|
||||
ICE
|
||||
WRS/EST VisionICE-II (PPC8240)
|
||||
|
||||
|
||||
|
||||
=>reset
|
||||
|
||||
|
||||
U-Boot 1.2.0 (Aug 6 2002 - 17:44:48)
|
||||
|
||||
CPU: MPC8245 Revision 16.20 at 264 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)
|
||||
Built: Aug 6 2002 at 17:44:37
|
||||
Local Bus at 66 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 4095 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
DOC: No DiskOnChip found
|
||||
Hit any key to stop autoboot: 0
|
||||
|
||||
Broadcom BCM5701 1000Base-T: bus 0, device 13, function 0: MBAR=0x80100000
|
||||
BCM570x PCI Memory base address @0x80100000
|
||||
eth0:Broadcom BCM5701 1000Base-T: 100 Mbps half duplex link up, flow control OFF
|
||||
eth0: Broadcom BCM5701 1000Base-T @0x80100000,node addr 000010181010
|
||||
eth0: BCM5700 with Broadcom BCM5701 Integrated Copper transceiver found
|
||||
eth0: 32-bit PCI 33MHz, MTU: 1500,Rx Checksum ON
|
||||
ARP broadcast 1
|
||||
TFTP from server 172.16.40.111; our IP address is 172.16.40.114
|
||||
Filename 'vmlinux.img'.
|
||||
Load address: 0x100000
|
||||
Loading: #################################################################
|
||||
####################################T #############################
|
||||
######################
|
||||
done
|
||||
Bytes transferred = 777199 (bdbef hex)
|
||||
|
||||
eth0:Broadcom BCM5701 1000Base-T,HALT,POWER DOWN,done - offline.
|
||||
## Booting image at 00100000 ...
|
||||
Image Name: vmlinux.bin.gz
|
||||
Created: 2002-08-06 6:30:13 UTC
|
||||
Image Type: PowerPC Linux Kernel Image (gzip compressed)
|
||||
Data Size: 777135 Bytes = 758 kB = 0 MB
|
||||
Load Address: 00000000
|
||||
Entry Point: 00000000
|
||||
Verifying Checksum ... OK
|
||||
Uncompressing Kernel Image ... OK
|
||||
Memory BAT mapping: BAT2=64Mb, BAT3=0Mb, residual: 0Mb
|
||||
Linux version 2.4.19-rc3 (jfd@que) (gcc version 2.95.3 20010111 (prerelease/franzo/20010111)) #168 Mon Aug 5 23:29:20 PDT 2002
|
||||
CPU:82xx: 32 I-Cache Block Size, 32 D-Cache Block Size PVR: 0x810000
|
||||
U-Boot Environment: 0xc01b08f0
|
||||
IP PNP: 802.3 Ethernet Address=<0:0:10:18:10:10>
|
||||
cpu0: MPC8245/KAHLUA-II : BMW Platform : 64MB RAM: BPLD Rev. 6e
|
||||
NOTICE: mounting root file system via NFS
|
||||
IP PNP: switch-2: eth0 IP 172.16.40.114/255.255.240.0 gateway 10.16.64.1 server 172.16.40.111
|
||||
On node 0 totalpages: 16384
|
||||
zone(0): 16384 pages.
|
||||
zone(1): 0 pages.
|
||||
zone(2): 0 pages.
|
||||
Kernel command line: console=ttyS0,9600 ip=172.16.40.114:172.16.40.111:10.16.64.1:255.255.240.0:switch-2:eth0 root=/dev/nfs rw nfsroot=172.16.40.111:/boot/root-fs,timeo=200,retrans=500 nfsaddrs=172.16.40.114:172.16.40.111
|
||||
root_dev_setup:/dev/nfs or 00:ff
|
||||
time_init: decrementer frequency = 16.501145 MHz
|
||||
Calibrating delay loop... 175.71 BogoMIPS
|
||||
Memory: 62572k available (1396k kernel code, 436k data, 100k init, 0k highmem)
|
||||
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
|
||||
Inode cache hash table entries: 4096 (order: 3, 32768 bytes)
|
||||
Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
|
||||
Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes)
|
||||
Page-cache hash table entries: 16384 (order: 4, 65536 bytes)
|
||||
POSIX conformance testing by UNIFIX
|
||||
PCI: Probing PCI hardware
|
||||
Linux NET4.0 for Linux 2.4
|
||||
Based upon Swansea University Computer Society NET3.039
|
||||
Initializing RT netlink socket
|
||||
Starting kswapd
|
||||
devfs: v1.12a (20020514) Richard Gooch (rgooch@atnf.csiro.au)
|
||||
devfs: devfs_debug: 0x0
|
||||
devfs: boot_options: 0x1
|
||||
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
|
||||
pty: 256 Unix98 ptys configured
|
||||
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled
|
||||
Testing ttyS0 (0xf7f51500, 0xf7f51500)...
|
||||
Testing ttyS1 (0xfc004600, 0xfc004600)...
|
||||
ttyS00 at 0xf7f51500 (irq = 24) is a ST16650
|
||||
ttyS01 at 0xfc004600 (irq = 25) is a 16550A
|
||||
Real Time Clock Driver v1.10e
|
||||
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
|
||||
loop: loaded (max 8 devices)
|
||||
TFFS 5.1.1 Flash disk driver for DiskOnChip
|
||||
Copyright (C) 1998,2001 M-Systems Flash Disk Pioneers Ltd.
|
||||
DOC device(s) found: 1
|
||||
fl_init: registered device at major: 100
|
||||
fl_geninit: registered device at major: 100
|
||||
Partition check:
|
||||
fla: p1
|
||||
partition: /dev/fl/0: start_sect: 0,nr_sects: 32000 Fl_blk_size[]: 16000KB
|
||||
partition: /dev/fl/1: start_sect: 2,nr_sects: 31998 Fl_blk_size[]: 15999KB
|
||||
partition: /dev/fl/2: start_sect: 0,nr_sects: 0 Fl_blk_size[]: 0KB
|
||||
partition: /dev/fl/3: start_sect: 0,nr_sects: 0 Fl_blk_size[]: 0KB
|
||||
Broadcom Gigabit Ethernet Driver bcm5700 ver. 3.0.7 (07/17/02)
|
||||
eth0: Broadcom BCM5701 found at mem bfff0000, IRQ 1, node addr 000010181010
|
||||
eth0: Broadcom BCM5701 Integrated Copper transceiver found
|
||||
eth0: Scatter-gather ON, 64-bit DMA ON, Tx Checksum ON, Rx Checksum ON, 802.1Q VLAN ON
|
||||
bond0 registered without MII link monitoring, in bonding mode.
|
||||
rtc: unable to get misc minor
|
||||
NET4: Linux TCP/IP 1.0 for NET4.0
|
||||
IP Protocols: ICMP, UDP, TCP, IGMP
|
||||
IP: routing cache hash table of 512 buckets, 4Kbytes
|
||||
TCP: Hash tables configured (established 4096 bind 4096)
|
||||
bcm5700: eth0 NIC Link is UP, 100 Mbps half duplex
|
||||
IP-Config: Gateway not on directly connected network.
|
||||
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
|
||||
802.1Q VLAN Support v1.7 Ben Greear <greearb@candelatech.com>
|
||||
All bugs added by David S. Miller <davem@redhat.com>
|
||||
Looking up port of RPC 100003/2 on 172.16.40.111
|
||||
Looking up port of RPC 100005/1 on 172.16.40.111
|
||||
VFS: Mounted root (nfs filesystem).
|
||||
Mounted devfs on /dev
|
||||
Freeing unused kernel memory: 100k init
|
||||
INIT: version 2.78 booting
|
||||
Mounting local filesystems...
|
||||
not mounted anything
|
||||
Setting up symlinks in /dev...done.
|
||||
Setting up extra devices in /dev...done.
|
||||
Starting devfsd...Started device management daemon for /dev
|
||||
INIT: Entering runlevel: 2
|
||||
Starting internet superserver: inetd.
|
||||
|
||||
|
||||
Welcome to Linux/PPC
|
||||
MPC8245/BMW
|
||||
|
||||
|
||||
|
||||
switch-2 login: root
|
||||
Password:
|
||||
PAM_unix[49]: (login) session opened for user root by LOGIN(uid=0)
|
||||
Last login: Thu Nov 25 11:51:14 1920 on console
|
||||
|
||||
|
||||
Welcome to Linux/PPC
|
||||
MPC8245/BMW
|
||||
|
||||
|
||||
|
||||
login[49]: ROOT LOGIN on `console'
|
||||
|
||||
root@switch-2:~# cat /proc/cpuinfo
|
||||
cpu : 82xx
|
||||
revision : 16.20 (pvr 8081 1014)
|
||||
bogomips : 175.71
|
||||
vendor : Broadcom
|
||||
machine : BMW/MPC8245
|
||||
root@switch-2:~#
|
||||
162
board/bmw/bmw.c
Normal file
162
board/bmw/bmw.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* James F. Dougherty, Broadcom Corporation, jfd@broadcom.com
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <devices.h>
|
||||
#include <syscall.h>
|
||||
#include <net.h>
|
||||
#include <version.h>
|
||||
#include <dtt.h>
|
||||
#include <mpc824x.h>
|
||||
#include <asm/processor.h>
|
||||
#include <linux/mtd/doc2000.h>
|
||||
|
||||
#include "bmw.h"
|
||||
#include "m48t59y.h"
|
||||
#include <pci.h>
|
||||
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
ulong busfreq = get_bus_freq(0);
|
||||
char buf[32];
|
||||
|
||||
puts ("Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)\n");
|
||||
printf("Built: %s at %s\n", __DATE__ , __TIME__ );
|
||||
/* printf("MPLD: Revision %d\n", SYS_REVID_GET()); */
|
||||
printf("Local Bus at %s MHz\n", strmhz(buf, busfreq));
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
return 64*1024*1024;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
get_tod(void)
|
||||
{
|
||||
int year, month, day, hour, minute, second;
|
||||
|
||||
m48_tod_get(&year,
|
||||
&month,
|
||||
&day,
|
||||
&hour,
|
||||
&minute,
|
||||
&second);
|
||||
|
||||
printf(" Current date/time: %d/%d/%d %d:%d:%d \n",
|
||||
month, day, year, hour, minute, second);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* EPIC, PCI, and I/O devices.
|
||||
* Initialize Mousse Platform, probe for PCI devices,
|
||||
* Query configuration parameters if not set.
|
||||
*/
|
||||
int misc_init_f (void)
|
||||
{
|
||||
#if 0
|
||||
m48_tod_init(); /* Init SGS M48T59Y TOD/NVRAM */
|
||||
printf("RTC: M48T589 TOD/NVRAM (%d) bytes\n",
|
||||
TOD_NVRAM_SIZE);
|
||||
get_tod();
|
||||
#endif
|
||||
|
||||
sys_led_msg("BOOT");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Initialize PCI Devices, report devices found.
|
||||
*/
|
||||
struct pci_controller hose;
|
||||
|
||||
void pci_init (void)
|
||||
{
|
||||
pci_mpc824x_init(&hose);
|
||||
/* pci_dev_init(0); */
|
||||
}
|
||||
|
||||
/*
|
||||
* Write characters to LCD display.
|
||||
* Note that the bytes for the first character is the last address.
|
||||
*/
|
||||
void
|
||||
sys_led_msg(char* msg)
|
||||
{
|
||||
LED_REG(0) = msg[3];
|
||||
LED_REG(1) = msg[2];
|
||||
LED_REG(2) = msg[1];
|
||||
LED_REG(3) = msg[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* Map onboard TSOP-16MB DOC FLASH chip.
|
||||
*/
|
||||
void doc_init (void)
|
||||
{
|
||||
doc_probe(DOC_BASE_ADDR);
|
||||
}
|
||||
|
||||
#define NV_ADDR ((volatile unsigned char *) CFG_ENV_ADDR)
|
||||
|
||||
/* Read from NVRAM */
|
||||
void*
|
||||
nvram_read(void *dest, const long src, size_t count)
|
||||
{
|
||||
int i;
|
||||
volatile unsigned char* d = (unsigned char*)dest;
|
||||
volatile unsigned char* s = (unsigned char*)src;
|
||||
|
||||
for( i = 0; i < count;i++)
|
||||
d[i] = s[i];
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Write to NVRAM */
|
||||
void
|
||||
nvram_write(long dest, const void *src, size_t count)
|
||||
{
|
||||
int i;
|
||||
volatile unsigned char* d = (unsigned char*)dest;
|
||||
volatile unsigned char* s = (unsigned char*)src;
|
||||
|
||||
SYS_TOD_UNPROTECT();
|
||||
|
||||
for( i = 0; i < count;i++)
|
||||
d[i] = s[i];
|
||||
|
||||
SYS_TOD_PROTECT();
|
||||
}
|
||||
86
board/bmw/bmw.h
Normal file
86
board/bmw/bmw.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* BMW/MPC8245 Board definitions.
|
||||
* For more info, see http://www.vooha.com/
|
||||
*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* James Dougherty (jfd@broadcom.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
|
||||
*/
|
||||
|
||||
#ifndef __BMW_H
|
||||
#define __BMW_H
|
||||
|
||||
/* System addresses */
|
||||
|
||||
#define PCI_SPECIAL_BASE 0xfe000000
|
||||
#define PCI_SPECIAL_SIZE 0x01000000
|
||||
|
||||
#define EUMBBAR_VAL 0x80500000 /* Location of EUMB region */
|
||||
#define EUMBSIZE 0x00100000 /* Size of EUMB region */
|
||||
|
||||
/* Extended ROM space devices */
|
||||
#define DOC_BASE_ADDR 0xff000000 /* Onboard DOC TSOP 16MB */
|
||||
#define DOC2_BASE_ADDR 0x70000000 /* DIP32 socket -> 1GB */
|
||||
#define XROM_BASE_ADDR 0x7c000000 /* RCS2 (PAL / Satellite IO) */
|
||||
#define PLD_REG_BASE XROM_BASE_ADDR
|
||||
#define LED_REG_BASE (XROM_BASE_ADDR | 0x2000)
|
||||
#define TOD_BASE (XROM_BASE_ADDR | 0x4000)
|
||||
#define LED_REG(x) (*(volatile unsigned char *) \
|
||||
(LED_REG_BASE + (x)))
|
||||
#define XROM_DEV_SIZE 0x00006000
|
||||
|
||||
#define ENET_DEV_BASE 0x80000000
|
||||
|
||||
#define PLD_REG(off) (*(volatile unsigned char *)\
|
||||
(PLD_REG_BASE + (off)))
|
||||
|
||||
#define PLD_REVID_B1 0x7f /* Fix me */
|
||||
#define PLD_REVID_B2 0x01 /* Fix me */
|
||||
|
||||
#define SYS_HARD_RESET() { for (;;) PLD_REG(0) = 0; } /* clr 0x80 bit */
|
||||
#define SYS_REVID_GET() ((int) PLD_REG(0) & 0x7f)
|
||||
#define SYS_LED_OFF() (PLD_REG(1) |= 0x80)
|
||||
#define SYS_LED_ON() (PLD_REG(1) &= ~0x80)
|
||||
#define SYS_WATCHDOG_IRQ3() (PLD_REG(2) |= 0x80)
|
||||
#define SYS_WATCHDOG_RESET() (PLD_REG(2) &= ~0x80)
|
||||
#define SYS_TOD_PROTECT() (PLD_REG(3) |= 0x80)
|
||||
#define SYS_TOD_UNPROTECT() (PLD_REG(3) &= ~0x80)
|
||||
|
||||
#define TOD_REG_BASE (TOD_BASE | 0x1ff0)
|
||||
#define TOD_NVRAM_BASE TOD_BASE
|
||||
#define TOD_NVRAM_SIZE 0x1ff0
|
||||
#define TOD_NVRAM_LIMIT (TOD_NVRAM_BASE + TOD_NVRAM_SIZE)
|
||||
#define RTC(r) (TOD_BASE + r)
|
||||
|
||||
/* Onboard BCM570x device */
|
||||
#define PCI_ENET_IOADDR 0x80000000
|
||||
#define PCI_ENET_MEMADDR 0x80000000
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* C Function prototypes */
|
||||
void sys_led_msg(char* msg);
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __BMW_H */
|
||||
32
board/bmw/config.mk
Normal file
32
board/bmw/config.mk
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# CU824 board
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xFFF00000
|
||||
# NOTE: The flags below affect how the BCM570x driver is compiled
|
||||
PLATFORM_CPPFLAGS += -DEMBEDDED -DBIG_ENDIAN_HOST -DINCLUDE_5701_AX_FIX=1\
|
||||
-DDBG=0 -DT3_JUMBO_RCV_RCB_ENTRY_COUNT=256\
|
||||
-DTEXT_BASE=$(TEXT_BASE)
|
||||
1172
board/bmw/early_init.S
Normal file
1172
board/bmw/early_init.S
Normal file
File diff suppressed because it is too large
Load Diff
757
board/bmw/flash.c
Normal file
757
board/bmw/flash.c
Normal file
@@ -0,0 +1,757 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc824x.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/pci_io.h>
|
||||
|
||||
#define ROM_CS0_START 0xFF800000
|
||||
#define ROM_CS1_START 0xFF000000
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data);
|
||||
#if 0
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info);
|
||||
#endif /* 0 */
|
||||
|
||||
/*flash command address offsets*/
|
||||
|
||||
#if 0
|
||||
#define ADDR0 (0x555)
|
||||
#define ADDR1 (0x2AA)
|
||||
#define ADDR3 (0x001)
|
||||
#else
|
||||
#define ADDR0 (0xAAA)
|
||||
#define ADDR1 (0x555)
|
||||
#define ADDR3 (0x001)
|
||||
#endif
|
||||
|
||||
#define FLASH_WORD_SIZE unsigned char
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if 0
|
||||
static int byte_parity_odd(unsigned char x) __attribute__ ((const));
|
||||
#endif /* 0 */
|
||||
static unsigned long flash_id(unsigned char mfct, unsigned char chip) __attribute__ ((const));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FLASH_WORD_SIZE extval;
|
||||
unsigned short intval;
|
||||
} map_entry;
|
||||
|
||||
#if 0
|
||||
static int
|
||||
byte_parity_odd(unsigned char x)
|
||||
{
|
||||
x ^= x >> 4;
|
||||
x ^= x >> 2;
|
||||
x ^= x >> 1;
|
||||
return (x & 0x1) != 0;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
|
||||
static unsigned long
|
||||
flash_id(unsigned char mfct, unsigned char chip)
|
||||
{
|
||||
static const map_entry mfct_map[] =
|
||||
{
|
||||
{(FLASH_WORD_SIZE) AMD_MANUFACT, (unsigned short) ((unsigned long) FLASH_MAN_AMD >> 16)},
|
||||
{(FLASH_WORD_SIZE) FUJ_MANUFACT, (unsigned short) ((unsigned long) FLASH_MAN_FUJ >> 16)},
|
||||
{(FLASH_WORD_SIZE) STM_MANUFACT, (unsigned short) ((unsigned long) FLASH_MAN_STM >> 16)},
|
||||
{(FLASH_WORD_SIZE) MT_MANUFACT, (unsigned short) ((unsigned long) FLASH_MAN_MT >> 16)},
|
||||
{(FLASH_WORD_SIZE) INTEL_MANUFACT,(unsigned short) ((unsigned long) FLASH_MAN_INTEL >> 16)},
|
||||
{(FLASH_WORD_SIZE) INTEL_ALT_MANU,(unsigned short) ((unsigned long) FLASH_MAN_INTEL >> 16)}
|
||||
};
|
||||
|
||||
static const map_entry chip_map[] =
|
||||
{
|
||||
{AMD_ID_F040B, FLASH_AM040},
|
||||
{(FLASH_WORD_SIZE) STM_ID_x800AB, FLASH_STM800AB}
|
||||
};
|
||||
|
||||
const map_entry *p;
|
||||
unsigned long result = FLASH_UNKNOWN;
|
||||
|
||||
/* find chip id */
|
||||
for(p = &chip_map[0]; p < &chip_map[sizeof chip_map / sizeof chip_map[0]]; p++)
|
||||
if(p->extval == chip)
|
||||
{
|
||||
result = FLASH_VENDMASK | p->intval;
|
||||
break;
|
||||
}
|
||||
|
||||
/* find vendor id */
|
||||
for(p = &mfct_map[0]; p < &mfct_map[sizeof mfct_map / sizeof mfct_map[0]]; p++)
|
||||
if(p->extval == mfct)
|
||||
{
|
||||
result &= ~FLASH_VENDMASK;
|
||||
result |= (unsigned long) p->intval << 16;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned long
|
||||
flash_init(void)
|
||||
{
|
||||
unsigned long i;
|
||||
unsigned char j;
|
||||
static const ulong flash_banks[] = CFG_FLASH_BANKS;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++)
|
||||
{
|
||||
flash_info_t * const pflinfo = &flash_info[i];
|
||||
pflinfo->flash_id = FLASH_UNKNOWN;
|
||||
pflinfo->size = 0;
|
||||
pflinfo->sector_count = 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < sizeof flash_banks / sizeof flash_banks[0]; i++)
|
||||
{
|
||||
flash_info_t * const pflinfo = &flash_info[i];
|
||||
const unsigned long base_address = flash_banks[i];
|
||||
volatile FLASH_WORD_SIZE * const flash = (FLASH_WORD_SIZE *) base_address;
|
||||
#if 0
|
||||
volatile FLASH_WORD_SIZE * addr2;
|
||||
#endif
|
||||
#if 0
|
||||
/* write autoselect sequence */
|
||||
flash[0x5555] = 0xaa;
|
||||
flash[0x2aaa] = 0x55;
|
||||
flash[0x5555] = 0x90;
|
||||
#else
|
||||
flash[0xAAA << (3 * i)] = 0xaa;
|
||||
flash[0x555 << (3 * i)] = 0x55;
|
||||
flash[0xAAA << (3 * i)] = 0x90;
|
||||
#endif
|
||||
__asm__ __volatile__("sync");
|
||||
|
||||
#if 0
|
||||
pflinfo->flash_id = flash_id(flash[0x0], flash[0x1]);
|
||||
#else
|
||||
pflinfo->flash_id = flash_id(flash[0x0], flash[0x2 + 14 * i]);
|
||||
#endif
|
||||
|
||||
switch(pflinfo->flash_id & FLASH_TYPEMASK)
|
||||
{
|
||||
case FLASH_AM040:
|
||||
pflinfo->size = 0x00080000;
|
||||
pflinfo->sector_count = 8;
|
||||
for(j = 0; j < 8; j++)
|
||||
{
|
||||
pflinfo->start[j] = base_address + 0x00010000 * j;
|
||||
pflinfo->protect[j] = flash[(j << 16) | 0x2];
|
||||
}
|
||||
break;
|
||||
case FLASH_STM800AB:
|
||||
pflinfo->size = 0x00100000;
|
||||
pflinfo->sector_count = 19;
|
||||
pflinfo->start[0] = base_address;
|
||||
pflinfo->start[1] = base_address + 0x4000;
|
||||
pflinfo->start[2] = base_address + 0x6000;
|
||||
pflinfo->start[3] = base_address + 0x8000;
|
||||
for(j = 1; j < 16; j++)
|
||||
{
|
||||
pflinfo->start[j+3] = base_address + 0x00010000 * j;
|
||||
}
|
||||
#if 0
|
||||
/* check for protected sectors */
|
||||
for (j = 0; j < pflinfo->sector_count; j++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile FLASH_WORD_SIZE *)(pflinfo->start[j]);
|
||||
if (pflinfo->flash_id & FLASH_MAN_SST)
|
||||
pflinfo->protect[j] = 0;
|
||||
else
|
||||
pflinfo->protect[j] = addr2[2] & 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
/* reset device to read mode */
|
||||
flash[0x0000] = 0xf0;
|
||||
__asm__ __volatile__("sync");
|
||||
}
|
||||
|
||||
return flash_info[0].size + flash_info[1].size;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start address table */
|
||||
if (info->flash_id & FLASH_MAN_SST)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
flash_print_info(flash_info_t *info)
|
||||
{
|
||||
static const char unk[] = "Unknown";
|
||||
const char *mfct = unk, *type = unk;
|
||||
unsigned int i;
|
||||
|
||||
if(info->flash_id != FLASH_UNKNOWN)
|
||||
{
|
||||
switch(info->flash_id & FLASH_VENDMASK)
|
||||
{
|
||||
case FLASH_MAN_AMD: mfct = "AMD"; break;
|
||||
case FLASH_MAN_FUJ: mfct = "FUJITSU"; break;
|
||||
case FLASH_MAN_STM: mfct = "STM"; break;
|
||||
case FLASH_MAN_SST: mfct = "SST"; break;
|
||||
case FLASH_MAN_BM: mfct = "Bright Microelectonics"; break;
|
||||
case FLASH_MAN_INTEL: mfct = "Intel"; break;
|
||||
}
|
||||
|
||||
switch(info->flash_id & FLASH_TYPEMASK)
|
||||
{
|
||||
case FLASH_AM040: type = "AM29F040B (512K * 8, uniform sector size)"; break;
|
||||
case FLASH_AM400B: type = "AM29LV400B (4 Mbit, bottom boot sect)"; break;
|
||||
case FLASH_AM400T: type = "AM29LV400T (4 Mbit, top boot sector)"; break;
|
||||
case FLASH_AM800B: type = "AM29LV800B (8 Mbit, bottom boot sect)"; break;
|
||||
case FLASH_AM800T: type = "AM29LV800T (8 Mbit, top boot sector)"; break;
|
||||
case FLASH_AM160T: type = "AM29LV160T (16 Mbit, top boot sector)"; break;
|
||||
case FLASH_AM320B: type = "AM29LV320B (32 Mbit, bottom boot sect)"; break;
|
||||
case FLASH_AM320T: type = "AM29LV320T (32 Mbit, top boot sector)"; break;
|
||||
case FLASH_STM800AB: type = "M29W800AB (8 Mbit, bottom boot sect)"; break;
|
||||
case FLASH_SST800A: type = "SST39LF/VF800 (8 Mbit, uniform sector size)"; break;
|
||||
case FLASH_SST160A: type = "SST39LF/VF160 (16 Mbit, uniform sector size)"; break;
|
||||
}
|
||||
}
|
||||
|
||||
printf(
|
||||
"\n Brand: %s Type: %s\n"
|
||||
" Size: %lu KB in %d Sectors\n",
|
||||
mfct,
|
||||
type,
|
||||
info->size >> 10,
|
||||
info->sector_count
|
||||
);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
unsigned long size;
|
||||
unsigned int erased;
|
||||
unsigned long * flash = (unsigned long *) info->start[i];
|
||||
|
||||
/*
|
||||
* Check if whole sector is erased
|
||||
*/
|
||||
size =
|
||||
(i != (info->sector_count - 1)) ?
|
||||
(info->start[i + 1] - info->start[i]) >> 2 :
|
||||
(info->start[0] + info->size - info->start[i]) >> 2;
|
||||
|
||||
for(
|
||||
flash = (unsigned long *) info->start[i], erased = 1;
|
||||
(flash != (unsigned long *) info->start[i] + size) && erased;
|
||||
flash++
|
||||
)
|
||||
erased = *flash == ~0x0UL;
|
||||
|
||||
printf(
|
||||
"%s %08lX %s %s",
|
||||
(i % 5) ? "" : "\n ",
|
||||
info->start[i],
|
||||
erased ? "E" : " ",
|
||||
info->protect[i] ? "RO" : " "
|
||||
);
|
||||
}
|
||||
|
||||
puts("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
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;
|
||||
|
||||
printf("flash_get_size: \n");
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
eieio();
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE)0xAA;
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE)0x55;
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE)0x90;
|
||||
value = addr2[0];
|
||||
|
||||
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 */
|
||||
}
|
||||
printf("recognised manufacturer");
|
||||
|
||||
value = addr2[ADDR3]; /* device ID */
|
||||
debug ("\ndev_code=%x\n", value);
|
||||
|
||||
switch (value) {
|
||||
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 */
|
||||
|
||||
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 */
|
||||
|
||||
case (FLASH_WORD_SIZE)AMD_ID_F040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x00080000;
|
||||
break; /* => 0.5 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
printf("flash id %lx; sector count %x, size %lx\n", info->flash_id,info->sector_count,info->size);
|
||||
/* set up sector start address table */
|
||||
if (info->flash_id & FLASH_MAN_SST)
|
||||
{
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
}
|
||||
else
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile FLASH_WORD_SIZE *)(info->start[i]);
|
||||
if (info->flash_id & FLASH_MAN_SST)
|
||||
info->protect[i] = 0;
|
||||
else
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr2 = (FLASH_WORD_SIZE *)info->start[0];
|
||||
*addr2 = (FLASH_WORD_SIZE)0x00F000F0; /* reset bank */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *)(info->start[0]);
|
||||
int flag, prot, sect, l_sect;
|
||||
ulong start, now, last;
|
||||
unsigned char sh8b;
|
||||
|
||||
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_MAN_STM | FLASH_AMD_COMP))) {
|
||||
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;
|
||||
|
||||
/* Check the ROM CS */
|
||||
if ((info->start[0] >= ROM_CS1_START) && (info->start[0] < ROM_CS0_START))
|
||||
sh8b = 3;
|
||||
else
|
||||
sh8b = 0;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr[ADDR1 << sh8b] = (FLASH_WORD_SIZE)0x00550055;
|
||||
addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00800080;
|
||||
addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr[ADDR1 << sh8b] = (FLASH_WORD_SIZE)0x00550055;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (FLASH_WORD_SIZE *)(info->start[0] + (
|
||||
(info->start[sect] - info->start[0]) << sh8b));
|
||||
if (info->flash_id & FLASH_MAN_SST)
|
||||
{
|
||||
addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr[ADDR1 << sh8b] = (FLASH_WORD_SIZE)0x00550055;
|
||||
addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00800080;
|
||||
addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr[ADDR1 << sh8b] = (FLASH_WORD_SIZE)0x00550055;
|
||||
addr[0] = (FLASH_WORD_SIZE)0x00500050; /* block erase */
|
||||
udelay(30000); /* wait 30 ms */
|
||||
}
|
||||
else
|
||||
addr[0] = (FLASH_WORD_SIZE)0x00300030; /* sector erase */
|
||||
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 = (FLASH_WORD_SIZE *)(info->start[0] + (
|
||||
(info->start[l_sect] - info->start[0]) << sh8b));
|
||||
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 */
|
||||
serial_putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
DONE:
|
||||
/* 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;
|
||||
volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
|
||||
ulong start;
|
||||
int flag;
|
||||
int i;
|
||||
unsigned char sh8b;
|
||||
|
||||
/* Check the ROM CS */
|
||||
if ((info->start[0] >= ROM_CS1_START) && (info->start[0] < ROM_CS0_START))
|
||||
sh8b = 3;
|
||||
else
|
||||
sh8b = 0;
|
||||
|
||||
dest2 = (FLASH_WORD_SIZE *)(((dest - info->start[0]) << sh8b) +
|
||||
info->start[0]);
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*dest2 & (FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
for (i=0; i<4/sizeof(FLASH_WORD_SIZE); i++)
|
||||
{
|
||||
addr2[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr2[ADDR1 << sh8b] = (FLASH_WORD_SIZE)0x00550055;
|
||||
addr2[ADDR0 << sh8b] = (FLASH_WORD_SIZE)0x00A000A0;
|
||||
|
||||
dest2[i << sh8b] = data2[i];
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
while ((dest2[i << sh8b] & (FLASH_WORD_SIZE)0x00800080) !=
|
||||
(data2[i] & (FLASH_WORD_SIZE)0x00800080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
323
board/bmw/m48t59y.c
Normal file
323
board/bmw/m48t59y.c
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
* SGS M48-T59Y TOD/NVRAM Driver
|
||||
*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 1999, by Curt McDowell, 08-06-99, Broadcom Corp.
|
||||
*
|
||||
* (C) Copyright 2001, James Dougherty, 07/18/01, Broadcom Corp.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* SGS M48-T59Y TOD/NVRAM Driver
|
||||
*
|
||||
* The SGS M48 an 8K NVRAM starting at offset M48_BASE_ADDR and
|
||||
* continuing for 8176 bytes. After that starts the Time-Of-Day (TOD)
|
||||
* registers which are used to set/get the internal date/time functions.
|
||||
*
|
||||
* This module implements Y2K compliance by taking full year numbers
|
||||
* and translating back and forth from the TOD 2-digit year.
|
||||
*
|
||||
* NOTE: for proper interaction with an operating system, the TOD should
|
||||
* be used to store Universal Coordinated Time (GMT) and timezone
|
||||
* conversions should be used.
|
||||
*
|
||||
* Here is a diagram of the memory layout:
|
||||
*
|
||||
* +---------------------------------------------+ 0xffe0a000
|
||||
* | Non-volatile memory | .
|
||||
* | | .
|
||||
* | (8176 bytes of Non-volatile memory) | .
|
||||
* | | .
|
||||
* +---------------------------------------------+ 0xffe0bff0
|
||||
* | Flags |
|
||||
* +---------------------------------------------+ 0xffe0bff1
|
||||
* | Unused |
|
||||
* +---------------------------------------------+ 0xffe0bff2
|
||||
* | Alarm Seconds |
|
||||
* +---------------------------------------------+ 0xffe0bff3
|
||||
* | Alarm Minutes |
|
||||
* +---------------------------------------------+ 0xffe0bff4
|
||||
* | Alarm Date |
|
||||
* +---------------------------------------------+ 0xffe0bff5
|
||||
* | Interrupts |
|
||||
* +---------------------------------------------+ 0xffe0bff6
|
||||
* | WatchDog |
|
||||
* +---------------------------------------------+ 0xffe0bff7
|
||||
* | Calibration |
|
||||
* +---------------------------------------------+ 0xffe0bff8
|
||||
* | Seconds |
|
||||
* +---------------------------------------------+ 0xffe0bff9
|
||||
* | Minutes |
|
||||
* +---------------------------------------------+ 0xffe0bffa
|
||||
* | Hours |
|
||||
* +---------------------------------------------+ 0xffe0bffb
|
||||
* | Day |
|
||||
* +---------------------------------------------+ 0xffe0bffc
|
||||
* | Date |
|
||||
* +---------------------------------------------+ 0xffe0bffd
|
||||
* | Month |
|
||||
* +---------------------------------------------+ 0xffe0bffe
|
||||
* | Year (2 digits only) |
|
||||
* +---------------------------------------------+ 0xffe0bfff
|
||||
*/
|
||||
#include <common.h>
|
||||
#include <rtc.h>
|
||||
#include "bmw.h"
|
||||
|
||||
/*
|
||||
* Imported from mousse.h:
|
||||
*
|
||||
* TOD_REG_BASE Base of m48t59y TOD registers
|
||||
* SYS_TOD_UNPROTECT() Disable NVRAM write protect
|
||||
* SYS_TOD_PROTECT() Re-enable NVRAM write protect
|
||||
*/
|
||||
|
||||
#define YEAR 0xf
|
||||
#define MONTH 0xe
|
||||
#define DAY 0xd
|
||||
#define DAY_OF_WEEK 0xc
|
||||
#define HOUR 0xb
|
||||
#define MINUTE 0xa
|
||||
#define SECOND 0x9
|
||||
#define CONTROL 0x8
|
||||
#define WATCH 0x7
|
||||
#define INTCTL 0x6
|
||||
#define WD_DATE 0x5
|
||||
#define WD_HOUR 0x4
|
||||
#define WD_MIN 0x3
|
||||
#define WD_SEC 0x2
|
||||
#define _UNUSED 0x1
|
||||
#define FLAGS 0x0
|
||||
|
||||
#define M48_ADDR ((volatile unsigned char *) TOD_REG_BASE)
|
||||
|
||||
int m48_tod_init(void)
|
||||
{
|
||||
SYS_TOD_UNPROTECT();
|
||||
|
||||
M48_ADDR[CONTROL] = 0;
|
||||
M48_ADDR[WATCH] = 0;
|
||||
M48_ADDR[INTCTL] = 0;
|
||||
|
||||
/*
|
||||
* If the oscillator is currently stopped (as on a new part shipped
|
||||
* from the factory), start it running.
|
||||
*
|
||||
* Here is an example of the TOD bytes on a brand new M48T59Y part:
|
||||
* 00 00 00 00 00 00 00 00 00 88 8c c3 bf c8 f5 01
|
||||
*/
|
||||
|
||||
if (M48_ADDR[SECOND] & 0x80)
|
||||
M48_ADDR[SECOND] = 0;
|
||||
|
||||
/* Is battery low */
|
||||
if ( M48_ADDR[FLAGS] & 0x10) {
|
||||
printf("NOTICE: Battery low on Real-Time Clock (replace SNAPHAT).\n");
|
||||
}
|
||||
|
||||
SYS_TOD_PROTECT();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* m48_tod_set
|
||||
*/
|
||||
|
||||
static int to_bcd(int value)
|
||||
{
|
||||
return value / 10 * 16 + value % 10;
|
||||
}
|
||||
|
||||
static int from_bcd(int value)
|
||||
{
|
||||
return value / 16 * 10 + value % 16;
|
||||
}
|
||||
|
||||
static int day_of_week(int y, int m, int d) /* 0-6 ==> Sun-Sat */
|
||||
{
|
||||
static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
|
||||
y -= m < 3;
|
||||
return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: the TOD should store the current GMT
|
||||
*/
|
||||
|
||||
int m48_tod_set(int year, /* 1980-2079 */
|
||||
int month, /* 01-12 */
|
||||
int day, /* 01-31 */
|
||||
int hour, /* 00-23 */
|
||||
int minute, /* 00-59 */
|
||||
int second) /* 00-59 */
|
||||
|
||||
{
|
||||
SYS_TOD_UNPROTECT();
|
||||
|
||||
M48_ADDR[CONTROL] |= 0x80; /* Set WRITE bit */
|
||||
|
||||
M48_ADDR[YEAR] = to_bcd(year % 100);
|
||||
M48_ADDR[MONTH] = to_bcd(month);
|
||||
M48_ADDR[DAY] = to_bcd(day);
|
||||
M48_ADDR[DAY_OF_WEEK] = day_of_week(year, month, day) + 1;
|
||||
M48_ADDR[HOUR] = to_bcd(hour);
|
||||
M48_ADDR[MINUTE] = to_bcd(minute);
|
||||
M48_ADDR[SECOND] = to_bcd(second);
|
||||
|
||||
M48_ADDR[CONTROL] &= ~0x80; /* Clear WRITE bit */
|
||||
|
||||
SYS_TOD_PROTECT();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: the TOD should store the current GMT
|
||||
*/
|
||||
|
||||
int m48_tod_get(int *year, /* 1980-2079 */
|
||||
int *month, /* 01-12 */
|
||||
int *day, /* 01-31 */
|
||||
int *hour, /* 00-23 */
|
||||
int *minute, /* 00-59 */
|
||||
int *second) /* 00-59 */
|
||||
{
|
||||
int y;
|
||||
|
||||
SYS_TOD_UNPROTECT();
|
||||
|
||||
M48_ADDR[CONTROL] |= 0x40; /* Set READ bit */
|
||||
|
||||
y = from_bcd(M48_ADDR[YEAR]);
|
||||
*year = y < 80 ? 2000 + y : 1900 + y;
|
||||
*month = from_bcd(M48_ADDR[MONTH]);
|
||||
*day = from_bcd(M48_ADDR[DAY]);
|
||||
/* day_of_week = M48_ADDR[DAY_OF_WEEK] & 0xf; */
|
||||
*hour = from_bcd(M48_ADDR[HOUR]);
|
||||
*minute = from_bcd(M48_ADDR[MINUTE]);
|
||||
*second = from_bcd(M48_ADDR[SECOND] & 0x7f);
|
||||
|
||||
M48_ADDR[CONTROL] &= ~0x40; /* Clear READ bit */
|
||||
|
||||
SYS_TOD_PROTECT();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int m48_tod_get_second(void)
|
||||
{
|
||||
return from_bcd(M48_ADDR[SECOND] & 0x7f);
|
||||
}
|
||||
|
||||
/*
|
||||
* Watchdog function
|
||||
*
|
||||
* If usec is 0, the watchdog timer is disarmed.
|
||||
*
|
||||
* If usec is non-zero, the watchdog timer is armed (or re-armed) for
|
||||
* approximately usec microseconds (if the exact requested usec is
|
||||
* not supported by the chip, the next higher available value is used).
|
||||
*
|
||||
* Minimum watchdog timeout = 62500 usec
|
||||
* Maximum watchdog timeout = 124 sec (124000000 usec)
|
||||
*/
|
||||
|
||||
void m48_watchdog_arm(int usec)
|
||||
{
|
||||
int mpy, res;
|
||||
|
||||
SYS_TOD_UNPROTECT();
|
||||
|
||||
if (usec == 0) {
|
||||
res = 0;
|
||||
mpy = 0;
|
||||
} else if (usec < 2000000) { /* Resolution: 1/16s if below 2s */
|
||||
res = 0;
|
||||
mpy = (usec + 62499) / 62500;
|
||||
} else if (usec < 8000000) { /* Resolution: 1/4s if below 8s */
|
||||
res = 1;
|
||||
mpy = (usec + 249999) / 250000;
|
||||
} else if (usec < 32000000) { /* Resolution: 1s if below 32s */
|
||||
res = 2;
|
||||
mpy = (usec + 999999) / 1000000;
|
||||
} else { /* Resolution: 4s up to 124s */
|
||||
res = 3;
|
||||
mpy = (usec + 3999999) / 4000000;
|
||||
if (mpy > 31)
|
||||
mpy = 31;
|
||||
}
|
||||
|
||||
M48_ADDR[WATCH] = (0x80 | /* Steer to RST signal (IRQ = N/C) */
|
||||
mpy << 2 |
|
||||
res);
|
||||
|
||||
SYS_TOD_PROTECT();
|
||||
}
|
||||
|
||||
/*
|
||||
* U-Boot RTC support.
|
||||
*/
|
||||
void
|
||||
rtc_get( struct rtc_time *tmp )
|
||||
{
|
||||
m48_tod_get(&tmp->tm_year,
|
||||
&tmp->tm_mon,
|
||||
&tmp->tm_mday,
|
||||
&tmp->tm_hour,
|
||||
&tmp->tm_min,
|
||||
&tmp->tm_sec);
|
||||
tmp->tm_yday = 0;
|
||||
tmp->tm_isdst= 0;
|
||||
|
||||
#ifdef RTC_DEBUG
|
||||
printf( "Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
|
||||
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
|
||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec );
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
rtc_set( struct rtc_time *tmp )
|
||||
{
|
||||
m48_tod_set(tmp->tm_year, /* 1980-2079 */
|
||||
tmp->tm_mon, /* 01-12 */
|
||||
tmp->tm_mday, /* 01-31 */
|
||||
tmp->tm_hour, /* 00-23 */
|
||||
tmp->tm_min, /* 00-59 */
|
||||
tmp->tm_sec); /* 00-59 */
|
||||
|
||||
#ifdef RTC_DEBUG
|
||||
printf( "Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
|
||||
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
|
||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
rtc_reset (void)
|
||||
{
|
||||
m48_tod_init();
|
||||
}
|
||||
|
||||
57
board/bmw/m48t59y.h
Normal file
57
board/bmw/m48t59y.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* SGS M48-T59Y TOD/NVRAM Driver
|
||||
*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 1999, by Curt McDowell, 08-06-99, Broadcom Corp.
|
||||
*
|
||||
* (C) Copyright 2001, James Dougherty, 07/18/01, Broadcom Corp.
|
||||
*
|
||||
* 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 __M48_T59_Y_H
|
||||
#define __M48_T59_Y_H
|
||||
|
||||
/*
|
||||
* M48 T59Y -Timekeeping Battery backed SRAM.
|
||||
*/
|
||||
|
||||
int m48_tod_init(void);
|
||||
|
||||
int m48_tod_set(int year,
|
||||
int month,
|
||||
int day,
|
||||
int hour,
|
||||
int minute,
|
||||
int second);
|
||||
|
||||
int m48_tod_get(int *year,
|
||||
int *month,
|
||||
int *day,
|
||||
int *hour,
|
||||
int *minute,
|
||||
int *second);
|
||||
|
||||
int m48_tod_get_second(void);
|
||||
|
||||
void m48_watchdog_arm(int usec);
|
||||
|
||||
#endif /*!__M48_T59_Y_H */
|
||||
60
board/bmw/ns16550.c
Normal file
60
board/bmw/ns16550.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* COM1 NS16550 support
|
||||
* originally from linux source (arch/ppc/boot/ns16550.c)
|
||||
* modified to use CFG_ISA_MEM and new defines
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "ns16550.h"
|
||||
|
||||
typedef struct NS16550 *NS16550_t;
|
||||
|
||||
const NS16550_t COM_PORTS[] = { (NS16550_t) ((CFG_EUMB_ADDR) + 0x4500), (NS16550_t) ((CFG_EUMB_ADDR) + 0x4600)};
|
||||
|
||||
volatile struct NS16550 *
|
||||
NS16550_init(int chan, int baud_divisor)
|
||||
{
|
||||
volatile struct NS16550 *com_port;
|
||||
com_port = (struct NS16550 *) COM_PORTS[chan];
|
||||
com_port->ier = 0x00;
|
||||
com_port->lcr = LCR_BKSE; /* Access baud rate */
|
||||
com_port->dll = baud_divisor & 0xff; /* 9600 baud */
|
||||
com_port->dlm = (baud_divisor >> 8) & 0xff;
|
||||
com_port->lcr = LCR_8N1; /* 8 data, 1 stop, no parity */
|
||||
com_port->mcr = MCR_RTS; /* RTS/DTR */
|
||||
com_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR; /* Clear & enable FIFOs */
|
||||
return (com_port);
|
||||
}
|
||||
|
||||
void
|
||||
NS16550_reinit(volatile struct NS16550 *com_port, int baud_divisor)
|
||||
{
|
||||
com_port->ier = 0x00;
|
||||
com_port->lcr = LCR_BKSE; /* Access baud rate */
|
||||
com_port->dll = baud_divisor & 0xff; /* 9600 baud */
|
||||
com_port->dlm = (baud_divisor >> 8) & 0xff;
|
||||
com_port->lcr = LCR_8N1; /* 8 data, 1 stop, no parity */
|
||||
com_port->mcr = MCR_RTS; /* RTS/DTR */
|
||||
com_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR; /* Clear & enable FIFOs */
|
||||
}
|
||||
|
||||
void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
|
||||
{
|
||||
while ((com_port->lsr & LSR_THRE) == 0) ;
|
||||
com_port->thr = c;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
NS16550_getc(volatile struct NS16550 *com_port)
|
||||
{
|
||||
while ((com_port->lsr & LSR_DR) == 0) ;
|
||||
return (com_port->rbr);
|
||||
}
|
||||
|
||||
int NS16550_tstc(volatile struct NS16550 *com_port)
|
||||
{
|
||||
return ((com_port->lsr & LSR_DR) != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
81
board/bmw/ns16550.h
Normal file
81
board/bmw/ns16550.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* NS16550 Serial Port
|
||||
* originally from linux source (arch/ppc/boot/ns16550.h)
|
||||
* modified slightly to
|
||||
* have addresses as offsets from CFG_ISA_BASE
|
||||
* added a few more definitions
|
||||
* added prototypes for ns16550.c
|
||||
* reduced no of com ports to 2
|
||||
* modifications (c) Rob Taylor, Flying Pig Systems. 2000.
|
||||
* further modified to support the 8245 duart
|
||||
* modifications (c) Paul Jimenez, Musenki, Inc. 2001.
|
||||
*/
|
||||
|
||||
|
||||
struct NS16550
|
||||
{
|
||||
unsigned char rbrthrdlb; /* 0 */
|
||||
unsigned char ierdmb; /* 1 */
|
||||
unsigned char iirfcrafr; /* 2 */
|
||||
unsigned char lcr; /* 3 */
|
||||
unsigned char mcr; /* 4 */
|
||||
unsigned char lsr; /* 5 */
|
||||
unsigned char msr; /* 6 */
|
||||
unsigned char scr; /* 7 */
|
||||
unsigned char reserved[2]; /* 8 & 9 */
|
||||
unsigned char dsr; /* 10 */
|
||||
unsigned char dcr; /* 11 */
|
||||
};
|
||||
|
||||
|
||||
#define rbr rbrthrdlb
|
||||
#define thr rbrthrdlb
|
||||
#define dll rbrthrdlb
|
||||
#define ier ierdmb
|
||||
#define dlm ierdmb
|
||||
#define iir iirfcrafr
|
||||
#define fcr iirfcrafr
|
||||
#define afr iirfcrafr
|
||||
|
||||
#define FCR_FIFO_EN 0x01 /*fifo enable*/
|
||||
#define FCR_RXSR 0x02 /*reciever soft reset*/
|
||||
#define FCR_TXSR 0x04 /*transmitter soft reset*/
|
||||
#define FCR_DMS 0x08 /* DMA Mode Select */
|
||||
|
||||
#define MCR_RTS 0x02 /* Readyu to Send */
|
||||
#define MCR_LOOP 0x10 /* Local loopback mode enable */
|
||||
/* #define MCR_DTR 0x01 noton 8245 duart */
|
||||
/* #define MCR_DMA_EN 0x04 noton 8245 duart */
|
||||
/* #define MCR_TX_DFR 0x08 noton 8245 duart */
|
||||
|
||||
#define LCR_WLS_MSK 0x03 /* character length slect mask*/
|
||||
#define LCR_WLS_5 0x00 /* 5 bit character length */
|
||||
#define LCR_WLS_6 0x01 /* 6 bit character length */
|
||||
#define LCR_WLS_7 0x02 /* 7 bit character length */
|
||||
#define LCR_WLS_8 0x03 /* 8 bit character length */
|
||||
#define LCR_STB 0x04 /* Number of stop Bits, off = 1, on = 1.5 or 2) */
|
||||
#define LCR_PEN 0x08 /* Parity eneble*/
|
||||
#define LCR_EPS 0x10 /* Even Parity Select*/
|
||||
#define LCR_STKP 0x20 /* Stick Parity*/
|
||||
#define LCR_SBRK 0x40 /* Set Break*/
|
||||
#define LCR_BKSE 0x80 /* Bank select enable - aka DLAB on 8245 */
|
||||
|
||||
#define LSR_DR 0x01 /* Data ready */
|
||||
#define LSR_OE 0x02 /* Overrun */
|
||||
#define LSR_PE 0x04 /* Parity error */
|
||||
#define LSR_FE 0x08 /* Framing error */
|
||||
#define LSR_BI 0x10 /* Break */
|
||||
#define LSR_THRE 0x20 /* Xmit holding register empty */
|
||||
#define LSR_TEMT 0x40 /* Xmitter empty */
|
||||
#define LSR_ERR 0x80 /* Error */
|
||||
|
||||
/* useful defaults for LCR*/
|
||||
#define LCR_8N1 0x03
|
||||
|
||||
|
||||
volatile struct NS16550 * NS16550_init(int chan, int baud_divisor);
|
||||
void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c);
|
||||
unsigned char NS16550_getc(volatile struct NS16550 *com_port);
|
||||
int NS16550_tstc(volatile struct NS16550 *com_port);
|
||||
void NS16550_reinit(volatile struct NS16550 *com_port, int baud_divisor);
|
||||
|
||||
83
board/bmw/serial.c
Normal file
83
board/bmw/serial.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include "ns16550.h"
|
||||
|
||||
#if CONFIG_CONS_INDEX == 1
|
||||
static struct NS16550 *console =
|
||||
(struct NS16550 *) (CFG_EUMB_ADDR + 0x4500);
|
||||
#elif CONFIG_CONS_INDEX == 2
|
||||
static struct NS16550 *console =
|
||||
(struct NS16550 *) (CFG_EUMB_ADDR + 0x4500);
|
||||
#else
|
||||
#error no valid console defined
|
||||
#endif
|
||||
|
||||
extern ulong get_bus_freq (ulong);
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int clock_divisor = gd->bus_clk / 16 / gd->baudrate;
|
||||
|
||||
NS16550_init (CONFIG_CONS_INDEX - 1, clock_divisor);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void serial_putc (const char c)
|
||||
{
|
||||
if (c == '\n') {
|
||||
serial_putc ('\r');
|
||||
}
|
||||
NS16550_putc (console, c);
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int serial_getc (void)
|
||||
{
|
||||
return NS16550_getc (console);
|
||||
}
|
||||
|
||||
int serial_tstc (void)
|
||||
{
|
||||
return NS16550_tstc (console);
|
||||
}
|
||||
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int clock_divisor = get_bus_freq (0) / 16 / gd->baudrate;
|
||||
|
||||
NS16550_reinit (console, clock_divisor);
|
||||
}
|
||||
128
board/bmw/u-boot.lds
Normal file
128
board/bmw/u-boot.lds
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
cpu/mpc824x/start.o (.text)
|
||||
lib_ppc/board.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/environment.o (.text)
|
||||
|
||||
*(.text)
|
||||
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
40
board/c2mon/Makefile
Normal file
40
board/c2mon/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
266
board/c2mon/c2mon.c
Normal file
266
board/c2mon/c2mon.c
Normal file
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static long int dram_size (long int, long int *, long int);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#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.
|
||||
*
|
||||
*/
|
||||
0x1FF77C34, 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)
|
||||
*/
|
||||
0x1F07FC04, 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)
|
||||
{
|
||||
unsigned char *s = getenv ("serial#");
|
||||
|
||||
puts ("Board: TTTech C2MON ");
|
||||
|
||||
for (; s && *s; ++s) {
|
||||
if (*s == ' ')
|
||||
break;
|
||||
putc (*s);
|
||||
}
|
||||
|
||||
putc ('\n');
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
unsigned long reg;
|
||||
long int size8, size9;
|
||||
long int size = 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_2BK_8K;
|
||||
|
||||
memctl->memc_mar = 0x00000088;
|
||||
|
||||
/*
|
||||
* Map controller bank 2 the SDRAM bank 2 at physical address 0.
|
||||
*/
|
||||
memctl->memc_or2 = CFG_OR2_PRELIM;
|
||||
memctl->memc_br2 = CFG_BR2_PRELIM;
|
||||
|
||||
memctl->memc_mamr = CFG_MAMR_8COL & (~(MAMR_PTAE)); /* no refresh yet */
|
||||
|
||||
udelay (200);
|
||||
|
||||
/* perform SDRAM initializsation sequence */
|
||||
|
||||
memctl->memc_mcr = 0x80004105; /* SDRAM bank 0 */
|
||||
udelay (1);
|
||||
memctl->memc_mcr = 0x80004230; /* SDRAM bank 0 - execute twice */
|
||||
udelay (1);
|
||||
|
||||
memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Check Bank 0 Memory Size
|
||||
*
|
||||
* try 8 column mode
|
||||
*/
|
||||
size8 = dram_size (CFG_MAMR_8COL,
|
||||
(ulong *)SDRAM_BASE2_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* try 9 column mode
|
||||
*/
|
||||
size9 = dram_size (CFG_MAMR_9COL,
|
||||
(ulong *) SDRAM_BASE2_PRELIM,
|
||||
SDRAM_MAX_SIZE);
|
||||
|
||||
if (size8 < size9) { /* leave configuration at 9 columns */
|
||||
size = size9;
|
||||
/* debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size >> 20); */
|
||||
} else { /* back to 8 columns */
|
||||
size = size8;
|
||||
memctl->memc_mamr = CFG_MAMR_8COL;
|
||||
udelay (500);
|
||||
/* debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size >> 20); */
|
||||
}
|
||||
|
||||
udelay (1000);
|
||||
|
||||
/*
|
||||
* Adjust refresh rate depending on SDRAM type
|
||||
* For types > 128 MBit leave it at the current (fast) rate
|
||||
*/
|
||||
if (size < 0x02000000) {
|
||||
/* reduce to 15.6 us (62.4 us / quad) */
|
||||
memctl->memc_mptpr = CFG_MPTPR_2BK_4K;
|
||||
udelay (1000);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final mapping
|
||||
*/
|
||||
memctl->memc_or2 = ((-size) & 0xFFFF0000) | CFG_OR_TIMING_SDRAM;
|
||||
memctl->memc_br2 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
|
||||
|
||||
/*
|
||||
* No bank 1
|
||||
*
|
||||
* invalidate bank
|
||||
*/
|
||||
memctl->memc_br3 = 0;
|
||||
|
||||
/* adjust refresh rate depending on SDRAM type, one bank */
|
||||
reg = memctl->memc_mptpr;
|
||||
reg >>= 1; /* reduce to CFG_MPTPR_1BK_8K / _4K */
|
||||
memctl->memc_mptpr = reg;
|
||||
|
||||
udelay (10000);
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
28
board/c2mon/config.mk
Normal file
28
board/c2mon/config.mk
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# TTTech C2MON boards
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x40000000
|
||||
570
board/c2mon/flash.c
Normal file
570
board/c2mon/flash.c
Normal file
@@ -0,0 +1,570 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
#ifndef CFG_ENV_ADDR
|
||||
#define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
#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);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
unsigned long size_b0, size_b1;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
size_b1 = flash_get_size((vu_long *)FLASH_BASE1_PRELIM, &flash_info[1]);
|
||||
|
||||
if (size_b1 > size_b0) {
|
||||
printf ("## ERROR: "
|
||||
"Bank 1 (0x%08lx = %ld MB) > Bank 0 (0x%08lx = %ld MB)\n",
|
||||
size_b1, size_b1<<20,
|
||||
size_b0, size_b0<<20
|
||||
);
|
||||
flash_info[0].flash_id = FLASH_UNKNOWN;
|
||||
flash_info[1].flash_id = FLASH_UNKNOWN;
|
||||
flash_info[0].sector_count = -1;
|
||||
flash_info[1].sector_count = -1;
|
||||
flash_info[0].size = 0;
|
||||
flash_info[1].size = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Remap FLASH according to real size */
|
||||
memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size_b0 & OR_AM_MSK);
|
||||
memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
|
||||
|
||||
/* 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+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
if (size_b1) {
|
||||
memctl->memc_or1 = CFG_OR_TIMING_FLASH | (-size_b1 & 0xFFFF8000);
|
||||
memctl->memc_br1 = ((CFG_FLASH_BASE + size_b0) & BR_BA_MSK) |
|
||||
BR_MS_GPCM | BR_V;
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size_b1 = flash_get_size((vu_long *)(CFG_FLASH_BASE + size_b0),
|
||||
&flash_info[1]);
|
||||
|
||||
flash_get_offsets (CFG_FLASH_BASE + size_b0, &flash_info[1]);
|
||||
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+CFG_MONITOR_LEN-1,
|
||||
&flash_info[1]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SIZE-1,
|
||||
&flash_info[1]);
|
||||
#endif
|
||||
} else {
|
||||
memctl->memc_br1 = 0; /* invalidate bank */
|
||||
|
||||
flash_info[1].flash_id = FLASH_UNKNOWN;
|
||||
flash_info[1].sector_count = -1;
|
||||
}
|
||||
|
||||
flash_info[0].size = size_b0;
|
||||
flash_info[1].size = size_b1;
|
||||
|
||||
return (size_b0 + size_b1);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start address table */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x0000C000;
|
||||
info->start[3] = base + 0x00010000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00020000) - 0x00060000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
info->start[i--] = base + info->size - 0x0000C000;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00020000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
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;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00900090;
|
||||
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
case AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
case AMD_ID_LV400T:
|
||||
info->flash_id += FLASH_AM400T;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case AMD_ID_LV400B:
|
||||
info->flash_id += FLASH_AM400B;
|
||||
info->sector_count = 11;
|
||||
info->size = 0x00100000;
|
||||
break; /* => 1 MB */
|
||||
|
||||
case AMD_ID_LV800T:
|
||||
info->flash_id += FLASH_AM800T;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case AMD_ID_LV800B:
|
||||
info->flash_id += FLASH_AM800B;
|
||||
info->sector_count = 19;
|
||||
info->size = 0x00200000;
|
||||
break; /* => 2 MB */
|
||||
|
||||
case AMD_ID_LV160T:
|
||||
info->flash_id += FLASH_AM160T;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
|
||||
case AMD_ID_LV160B:
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
#if 0 /* enable when device IDs are available */
|
||||
case AMD_ID_LV320T:
|
||||
info->flash_id += FLASH_AM320T;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
|
||||
case AMD_ID_LV320B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 67;
|
||||
info->size = 0x00800000;
|
||||
break; /* => 8 MB */
|
||||
#endif
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00008000;
|
||||
info->start[2] = base + 0x0000C000;
|
||||
info->start[3] = base + 0x00010000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00020000) - 0x00060000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
info->start[i--] = base + info->size - 0x0000C000;
|
||||
info->start[i--] = base + info->size - 0x00010000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00020000;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr = (volatile unsigned long *)(info->start[i]);
|
||||
info->protect[i] = addr[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
|
||||
*addr = 0x00F000F0; /* reset bank */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
vu_long *addr = (vu_long*)(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] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00800080;
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr = (vu_long*)(info->start[sect]);
|
||||
addr[0] = 0x00300030;
|
||||
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_long*)(info->start[l_sect]);
|
||||
while ((addr[0] & 0x00800080) != 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;
|
||||
}
|
||||
}
|
||||
|
||||
DONE:
|
||||
/* reset to read mode */
|
||||
addr = (volatile unsigned long *)info->start[0];
|
||||
addr[0] = 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)
|
||||
{
|
||||
vu_long *addr = (vu_long*)(info->start[0]);
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((vu_long *)dest) & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0x0555] = 0x00AA00AA;
|
||||
addr[0x02AA] = 0x00550055;
|
||||
addr[0x0555] = 0x00A000A0;
|
||||
|
||||
*((vu_long *)dest) = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
while ((*((vu_long *)dest) & 0x00800080) != (data & 0x00800080)) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
133
board/c2mon/u-boot.lds
Normal file
133
board/c2mon/u-boot.lds
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* 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_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)
|
||||
}
|
||||
.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 = .);
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
|
||||
131
board/c2mon/u-boot.lds.debug
Normal file
131
board/c2mon/u-boot.lds.debug
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* 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 = .);
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
|
||||
47
board/cogent/Makefile
Normal file
47
board/cogent/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := mb.o flash.o dipsw.o lcd.o serial.o # pci.o rtc.o par.o kbm.o
|
||||
SOBJS :=
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
118
board/cogent/README
Normal file
118
board/cogent/README
Normal file
@@ -0,0 +1,118 @@
|
||||
Cogent Modular Architecture configuration
|
||||
-----------------------------------------
|
||||
|
||||
As the name suggests, the Cogent platform is a modular system where
|
||||
you have a motherboard into which plugs a cpu module and one or more
|
||||
i/o modules. This provides very nice flexibility, but makes the
|
||||
configuration task somewhat harder.
|
||||
|
||||
The possible Cogent motherboards are:
|
||||
|
||||
Code Config Variable Description
|
||||
---- --------------- -----------
|
||||
|
||||
CMA101 CONFIG_CMA101 32MB ram, 2 ser, 1 par, rtc, dipsw,
|
||||
2x16 lcd, eth(?)
|
||||
CMA102 CONFIG_CMA102 32MB ram, 2 ser, 1 par, rtc, dipsw,
|
||||
2x16 lcd
|
||||
CMA111 CONFIG_CMA111 32MB ram, 1MB flash, 4 ser, 1 par,
|
||||
rtc, ps/2 kbd/mse, 2x16 lcd, 2xPCI,
|
||||
10/100TP eth
|
||||
CMA120 CONFIG_CMA120 32MB ram, 1MB flash, 4 ser, 1 par,
|
||||
rtc, ps/2 kbd/mse, 2x16 lcd, 2xPCI,
|
||||
10/100TP eth, 2xPCMCIA, video/lcd-panel
|
||||
CMA150 CONFIG_CMA150 8MB ram, 1MB flash, 2 ser, 1 par, rtc,
|
||||
ps/2 kbd/mse, 2x16 lcd
|
||||
|
||||
The possible Cogent PowerPC CPU modules are:
|
||||
|
||||
Code Config Variable Description
|
||||
---- --------------- -----------
|
||||
|
||||
CMA278-603EV CONFIG_CMA278_603EV PPC603ev CPU, 66MHz clock, 512K EPROM,
|
||||
JTAG/COP
|
||||
CMA278-603ER CONFIG_CMA278_603ER PPC603er CPU, 66MHz clock, 512K EPROM,
|
||||
JTAG/COP
|
||||
CMA278-740 CONFIG_CMA278_740 PPC740 CPU, 66MHz clock, 512K EPROM,
|
||||
JTAG/COP
|
||||
CMA280-509 CONFIG_CMA280_509 MPC505/509 CPU, 50MHz clock,
|
||||
512K EPROM, BDM
|
||||
CMA282 CONFIG_CMA282 MPC8260 CPU, 66MHz clock, 512K EPROM,
|
||||
JTAG, 16M RAM, 1 x ser (SMC2),
|
||||
1 x 10baseT PHY (SCC4), 1 x 10/100 TP
|
||||
PHY (FCC1), 2 x 48pin DIN (FCC2 + TDM1)
|
||||
CMA285 CONFIG_CMA285 MPC801 CPU, 33MHz clock, 512K EPROM,
|
||||
BDM
|
||||
CMA286-21 CONFIG_CMA286_21 MPC821 CPU, 66MHz clock, 512K EPROM,
|
||||
BDM, 16M RAM, 2 x ser (SMC1 + SMC2),
|
||||
1 x 10baseT PHY (SCC2)
|
||||
CMA286-60-OLD CONFIG_CMA286_60_OLD MPC860 CPU, 33MHz clock, 128K EPROM,
|
||||
BDM
|
||||
CMA286-60 CONFIG_CMA286_60 MPC860 CPU, 66MHz clock, 512K EPROM,
|
||||
BDM, 16M RAM, 2 x ser (SMC1 + SMC2),
|
||||
1 x 10baseT PHY (SCC2)
|
||||
CMA286-60P CONFIG_CMA286_60P MPC860P CPU, 66MHz clock, 512K EPROM,
|
||||
BDM, 16M RAM, 2 x ser (SMC1 + SMC2),
|
||||
1 x 10baseT PHY (SCC2)
|
||||
CMA287-23 CONFIG_CMA287_23 MPC823 CPU, 33MHz clock, 512K EPROM,
|
||||
BDM
|
||||
CMA287-50 CONFIG_CMA287_50 MPC850 CPU, 33MHz clock, 512K EPROM,
|
||||
BDM
|
||||
|
||||
(there are a lot of other cpu modules with ARM, MIPS and M-CORE CPUs,
|
||||
but we'll worry about those later).
|
||||
|
||||
The possible Cogent CMA I/O Modules are:
|
||||
|
||||
Code Config Variable Description
|
||||
---- --------------- -----------
|
||||
|
||||
CMA302 CONFIG_CMA302 up to 16M flash, ps/2 keyboard/mouse
|
||||
CMA352 CONFIG_CMA352 CMAbus <=> PCI
|
||||
|
||||
Currently supported:
|
||||
|
||||
Motherboards: CMA102
|
||||
CPU Modules: CMA286-60-OLD
|
||||
I/O Modules: CMA302 I/O module
|
||||
|
||||
To configure, perform the usual U-Boot configuration task of editing
|
||||
"include/config_cogent_mpc8xx.h" and reviewing all the options and
|
||||
settings in there. In particular, check the chip select values
|
||||
installed into the memory controller's various option and base
|
||||
registers - these are set by the defines CFG_CMA_CSn_{BASE,SIZE} and
|
||||
CFG_{B,O}Rn_PRELIM. Also be careful of the clock settings installed
|
||||
into the SCCR - via the define CFG_SCCR. Finally, decide whether you
|
||||
want the serial console on motherboard serial port A or on one of the
|
||||
8xx SMC ports, and set CONFIG_8xx_CONS_{SMC1,SMC2,NONE} accordingly
|
||||
(NONE means use Cogent motherboard serial port A).
|
||||
|
||||
Then edit the file "cogent/config.mk". Firstly, set TEXT_BASE to be
|
||||
the base address of the EPROM for the CPU module. This should be the
|
||||
same as the value selected for CFG_MONITOR_BASE in
|
||||
"include/config_cogent_*.h" (in fact, I have made this automatic via
|
||||
the -DTEXT_BASE=... option in CPPFLAGS).
|
||||
|
||||
Finally, set the values of the make variables $(CMA_MB) and $(CMA_IOMS).
|
||||
|
||||
$(CMA_MB) is the name of the directory that contains support for your
|
||||
motherboard. At this stage, only "cma10x" exists, which supports the
|
||||
CMA101 and CMA102 motherboards - but only selected devices, namely
|
||||
serial, lcd and dipsw.
|
||||
|
||||
$(CMA_IOMS) is a list of zero or more directories that contain
|
||||
support for the i/o modules you have installed. At this stage, only
|
||||
"cma302" exists, which supports the CMA302 flash i/o module - but
|
||||
only the flash part, not the ps/2 keyboard and mouse interfaces.
|
||||
|
||||
There should be a make variable for each of the above directories,
|
||||
which is the directory name with "_O" appended. This make variable is
|
||||
a list of object files to compile from that directory and include in
|
||||
the library.
|
||||
|
||||
e.g. cma10x_O = serial.o ...
|
||||
|
||||
That's it. Good Luck.
|
||||
|
||||
Murray.Jensen@cmst.csiro.au
|
||||
August 31, 2000.
|
||||
69
board/cogent/README.cma286
Normal file
69
board/cogent/README.cma286
Normal file
@@ -0,0 +1,69 @@
|
||||
CPU module revisions
|
||||
--------------------
|
||||
|
||||
My cpu module has the model number "CMA286-60-990526-01". My motherboard
|
||||
has the model number "CMA102-32M-990526-01". These are both fairly old,
|
||||
and may not reflect current design. In particular, I can see from the
|
||||
Cogent web site that the CMA286 has been significantly redesigned - it
|
||||
now has on board RAM (4M), ethernet 10baseT PHY (on SCC2), 2 serial ports
|
||||
(SMC1 and SMC2), and 48pin DIN for the FEC (if present i.e. MPC860T), and
|
||||
also the EPROM is 512K.
|
||||
|
||||
My CMA286-60 has none of this, and only 128K EPROM. In addition, the CPU
|
||||
clock is listed as 66MHz, whereas mine is 33.333MHz.
|
||||
|
||||
Clocks
|
||||
------
|
||||
|
||||
Quote from my "CMA286 MPC860/821 User's Manual":
|
||||
|
||||
"When setting up the Periodic Interrupt Timer (PIT), be aware that the
|
||||
CMA286 places the MPC860/821 in PLL X1 Mode. This means that we feed
|
||||
a 25MHz clock directly into the MPC860/821. This mode sets the divisor
|
||||
for the PIT to be 512. In addition, the Time Base Register (TMB)
|
||||
divisor is set to 16."
|
||||
|
||||
I interpreted this information to mean that EXTCLK is 25MHz and that at
|
||||
power on reset, MODCK1=1 and MODCK2=0, which selects EXTCLK as the
|
||||
source for OSCCLK and PITRTCLK, sets RTDIV to 512 and sets MF (the
|
||||
multiplication factor) to 1 (I assume this is what they mean by X1
|
||||
mode above). MF=1 means the cpus internal clock runs at the same
|
||||
rate as EXTCLK i.e. 25MHz.
|
||||
|
||||
Furthermore, since SCCR[TBS] (the Time Base Source selector bit in the
|
||||
System Clock and Reset Control register) is set in the cpu initialisation
|
||||
code, the TMBCLK source is forced to be GCLK2 and the TMBCLK prescale is
|
||||
forced to be 16. This results in TMBCLK=1562500.
|
||||
|
||||
One problem - since PITRTCLK source is EXTCLK (25Mhz) and RTDIV is 512,
|
||||
PITRTCLK will be 48828.125 (huh?). Another quote from the MPC860 Users
|
||||
Manual:
|
||||
|
||||
"When used by the real-time clock (RTC), the PITRTCLK source is first
|
||||
divided as determined by RTDIV, and then divided in the RTC circuits by
|
||||
either 8192 or 9600. Therefore, in order for the RTC to count in
|
||||
seconds, the clock source must satisfy:
|
||||
|
||||
(EXTCLK or OSCM) / [(4 or 512) x (8192 or 9600)] = 1
|
||||
|
||||
The RTC will operate with other frequencies, but it will not count in
|
||||
units of seconds."
|
||||
|
||||
Therefore, the internal RTC of the MPC860 is not going to count in
|
||||
seconds, so we must use the motherboard RTC (if we need a RTC).
|
||||
|
||||
I presume this means that they do not provide a fixed oscillator for
|
||||
OSCM. The code in get_gclk_freq() assumes PITRTCLK source is OSCM,
|
||||
RTDIV is 4, and that OSCM/4 is 8192 (i.e. a ~32KHz oscillator). Since
|
||||
the CMA286-60 doesn't have this (at least mine doesn't) we can't use
|
||||
the code in get_gclk_freq().
|
||||
|
||||
Finally, it appears that the internal clock in my CMA286-60 is actually
|
||||
33.333MHz. Which makes TMBCLK=2083312.5 (another huh?) and
|
||||
PITRTCLK=65103.515625 (bloody hell!).
|
||||
|
||||
If anyone finds anything wrong with the stuff above, I would appreciate
|
||||
an email about it.
|
||||
|
||||
Murray Jensen <Murray.Jensen@cmst.csiro.au>
|
||||
21-Aug-00
|
||||
31
board/cogent/config.mk
Normal file
31
board/cogent/config.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# Cogent Modular Architecture
|
||||
#
|
||||
|
||||
# Boot EPROM location
|
||||
TEXT_BASE = 0xfff00000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
|
||||
50
board/cogent/dipsw.c
Normal file
50
board/cogent/dipsw.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <common.h>
|
||||
#include <board/cogent/dipsw.h>
|
||||
|
||||
unsigned char
|
||||
dipsw_raw(void)
|
||||
{
|
||||
return cma_mb_reg_read(&((cma_mb_dipsw *)CMA_MB_DIPSW_BASE)->dip_val);
|
||||
}
|
||||
|
||||
unsigned char
|
||||
dipsw_cooked(void)
|
||||
{
|
||||
unsigned char val1, val2, mask1, mask2;
|
||||
|
||||
val1 = dipsw_raw();
|
||||
|
||||
/*
|
||||
* we want to mirror the bits because the low bit is switch 1 and high
|
||||
* bit is switch 8 and also invert them because 1=off and 0=on, according
|
||||
* to manual.
|
||||
*
|
||||
* this makes the value more intuitive i.e.
|
||||
* - left most, or high, or top, bit is left most switch (1);
|
||||
* - right most, or low, or bottom, bit is right most switch (8)
|
||||
* - a set bit means "on" and a clear bit means "off"
|
||||
*/
|
||||
|
||||
val2 = 0;
|
||||
for (mask1 = 1 << 7, mask2 = 1; mask1 > 0; mask1 >>= 1, mask2 <<= 1)
|
||||
if ((val1 & mask1) == 0)
|
||||
val2 |= mask2;
|
||||
|
||||
return (val2);
|
||||
}
|
||||
|
||||
void
|
||||
dipsw_init(void)
|
||||
{
|
||||
unsigned char val, mask;
|
||||
|
||||
val = dipsw_cooked();
|
||||
|
||||
printf("|");
|
||||
for (mask = 1 << 7; mask > 0; mask >>= 1)
|
||||
if (val & mask)
|
||||
printf("on |");
|
||||
else
|
||||
printf("off|");
|
||||
printf("\n");
|
||||
}
|
||||
3
board/cogent/dipsw.h
Normal file
3
board/cogent/dipsw.h
Normal file
@@ -0,0 +1,3 @@
|
||||
extern unsigned char dipsw_raw(void);
|
||||
extern unsigned char dipsw_cooked(void);
|
||||
extern void dipsw_init(void);
|
||||
648
board/cogent/flash.c
Normal file
648
board/cogent/flash.c
Normal file
@@ -0,0 +1,648 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <board/cogent/flash.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#if defined(CONFIG_CMA302)
|
||||
|
||||
/*
|
||||
* probe for the existence of flash at address "addr"
|
||||
* 0 = yes, 1 = bad Manufacturer's Id, 2 = bad Device Id
|
||||
*/
|
||||
static int
|
||||
c302f_probe_word(c302f_addr_t addr)
|
||||
{
|
||||
/* reset the flash */
|
||||
*addr = C302F_BNK_CMD_RST;
|
||||
|
||||
/* check the manufacturer id */
|
||||
*addr = C302F_BNK_CMD_RD_ID;
|
||||
if (*C302F_BNK_ADDR_MAN(addr) != C302F_BNK_RD_ID_MAN)
|
||||
return 1;
|
||||
|
||||
/* check the device id */
|
||||
*addr = C302F_BNK_CMD_RD_ID;
|
||||
if (*C302F_BNK_ADDR_DEV(addr) != C302F_BNK_RD_ID_DEV)
|
||||
return 2;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("\nMaster Lock Config = 0x%08lx\n",
|
||||
*C302F_BNK_ADDR_CFGM(addr));
|
||||
for (i = 0; i < C302F_BNK_NBLOCKS; i++)
|
||||
printf("Block %2d Lock Config = 0x%08lx\n",
|
||||
i, *C302F_BNK_ADDR_CFG(i, addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* reset the flash again */
|
||||
*addr = C302F_BNK_CMD_RST;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* probe for Cogent CMA302 flash module at address "base" and store
|
||||
* info for any found into flash_info entry "fip". Must find at least
|
||||
* one bank.
|
||||
*/
|
||||
static void
|
||||
c302f_probe(flash_info_t *fip, c302f_addr_t base)
|
||||
{
|
||||
c302f_addr_t addr, eaddr;
|
||||
int nbanks;
|
||||
|
||||
fip->size = 0L;
|
||||
fip->sector_count = 0;
|
||||
|
||||
addr = base;
|
||||
eaddr = C302F_BNK_ADDR_BASE(addr, C302F_MAX_BANKS);
|
||||
nbanks = 0;
|
||||
|
||||
while (addr < eaddr) {
|
||||
c302f_addr_t addrw, eaddrw, addrb;
|
||||
int i, osc, nsc;
|
||||
|
||||
addrw = addr;
|
||||
eaddrw = C302F_BNK_ADDR_NEXT_WORD(addrw);
|
||||
|
||||
while (addrw < eaddrw)
|
||||
if (c302f_probe_word(addrw++) != 0)
|
||||
goto out;
|
||||
|
||||
/* bank exists - append info for this bank to *fip */
|
||||
fip->flash_id = FLASH_MAN_INTEL|FLASH_28F008S5;
|
||||
fip->size += C302F_BNK_SIZE;
|
||||
osc = fip->sector_count;
|
||||
fip->sector_count += C302F_BNK_NBLOCKS;
|
||||
if ((nsc = fip->sector_count) >= CFG_MAX_FLASH_SECT)
|
||||
panic("Too many sectors in flash at address 0x%08lx\n",
|
||||
(unsigned long)base);
|
||||
|
||||
addrb = addr;
|
||||
for (i = osc; i < nsc; i++) {
|
||||
fip->start[i] = (ulong)addrb;
|
||||
fip->protect[i] = 0;
|
||||
addrb = C302F_BNK_ADDR_NEXT_BLK(addrb);
|
||||
}
|
||||
|
||||
addr = C302F_BNK_ADDR_NEXT_BNK(addr);
|
||||
nbanks++;
|
||||
}
|
||||
|
||||
out:
|
||||
if (nbanks == 0)
|
||||
panic("ERROR: no flash found at address 0x%08lx\n",
|
||||
(unsigned long)base);
|
||||
}
|
||||
|
||||
static void
|
||||
c302f_reset(flash_info_t *info, int sect)
|
||||
{
|
||||
c302f_addr_t addrw, eaddrw;
|
||||
|
||||
addrw = (c302f_addr_t)info->start[sect];
|
||||
eaddrw = C302F_BNK_ADDR_NEXT_WORD(addrw);
|
||||
|
||||
while (addrw < eaddrw) {
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" writing reset cmd to addr 0x%08lx\n",
|
||||
(unsigned long)addrw);
|
||||
#endif
|
||||
*addrw = C302F_BNK_CMD_RST;
|
||||
addrw++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
c302f_erase_init(flash_info_t *info, int sect)
|
||||
{
|
||||
c302f_addr_t addrw, saddrw, eaddrw;
|
||||
int flag;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf("0x%08lx C302F_BNK_CMD_PROG\n", C302F_BNK_CMD_PROG);
|
||||
printf("0x%08lx C302F_BNK_CMD_ERASE1\n", C302F_BNK_CMD_ERASE1);
|
||||
printf("0x%08lx C302F_BNK_CMD_ERASE2\n", C302F_BNK_CMD_ERASE2);
|
||||
printf("0x%08lx C302F_BNK_CMD_CLR_STAT\n", C302F_BNK_CMD_CLR_STAT);
|
||||
printf("0x%08lx C302F_BNK_CMD_RST\n", C302F_BNK_CMD_RST);
|
||||
printf("0x%08lx C302F_BNK_STAT_RDY\n", C302F_BNK_STAT_RDY);
|
||||
printf("0x%08lx C302F_BNK_STAT_ERR\n", C302F_BNK_STAT_ERR);
|
||||
#endif
|
||||
|
||||
saddrw = (c302f_addr_t)info->start[sect];
|
||||
eaddrw = C302F_BNK_ADDR_NEXT_WORD(saddrw);
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf("erasing sector %d, start addr = 0x%08lx "
|
||||
"(bank next word addr = 0x%08lx)\n", sect,
|
||||
(unsigned long)saddrw, (unsigned long)eaddrw);
|
||||
#endif
|
||||
|
||||
/* Disable intrs which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
for (addrw = saddrw; addrw < eaddrw; addrw++) {
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" writing erase cmd to addr 0x%08lx\n",
|
||||
(unsigned long)addrw);
|
||||
#endif
|
||||
*addrw = C302F_BNK_CMD_ERASE1;
|
||||
*addrw = C302F_BNK_CMD_ERASE2;
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
}
|
||||
|
||||
static int
|
||||
c302f_erase_poll(flash_info_t *info, int sect)
|
||||
{
|
||||
c302f_addr_t addrw, saddrw, eaddrw;
|
||||
int sectdone, haderr;
|
||||
|
||||
saddrw = (c302f_addr_t)info->start[sect];
|
||||
eaddrw = C302F_BNK_ADDR_NEXT_WORD(saddrw);
|
||||
|
||||
sectdone = 1;
|
||||
haderr = 0;
|
||||
|
||||
for (addrw = saddrw; addrw < eaddrw; addrw++) {
|
||||
c302f_word_t stat = *addrw;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf(" checking status at addr "
|
||||
"0x%08lx [0x%08lx]\n",
|
||||
(unsigned long)addrw, stat);
|
||||
#endif
|
||||
if ((stat & C302F_BNK_STAT_RDY) != C302F_BNK_STAT_RDY)
|
||||
sectdone = 0;
|
||||
else if ((stat & C302F_BNK_STAT_ERR) != 0) {
|
||||
printf(" failed on sector %d "
|
||||
"(stat = 0x%08lx) at "
|
||||
"address 0x%08lx\n",
|
||||
sect, stat,
|
||||
(unsigned long)addrw);
|
||||
*addrw = C302F_BNK_CMD_CLR_STAT;
|
||||
haderr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (haderr)
|
||||
return (-1);
|
||||
else
|
||||
return (sectdone);
|
||||
}
|
||||
|
||||
static int
|
||||
c302f_write_word(c302f_addr_t addr, c302f_word_t value)
|
||||
{
|
||||
c302f_word_t stat;
|
||||
ulong start;
|
||||
int flag, retval;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
*addr = C302F_BNK_CMD_PROG;
|
||||
|
||||
*addr = value;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
retval = 0;
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
do {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
retval = 1;
|
||||
goto done;
|
||||
}
|
||||
stat = *addr;
|
||||
} while ((stat & C302F_BNK_STAT_RDY) != C302F_BNK_STAT_RDY);
|
||||
|
||||
if ((stat & C302F_BNK_STAT_ERR) != 0) {
|
||||
printf("flash program failed (stat = 0x%08lx) "
|
||||
"at address 0x%08lx\n", (ulong)stat, (ulong)addr);
|
||||
*addr = C302F_BNK_CMD_CLR_STAT;
|
||||
retval = 3;
|
||||
}
|
||||
|
||||
done:
|
||||
/* reset to read mode */
|
||||
*addr = C302F_BNK_CMD_RST;
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_CMA302 */
|
||||
|
||||
unsigned long
|
||||
flash_init(void)
|
||||
{
|
||||
unsigned long total;
|
||||
int i;
|
||||
flash_info_t *fip;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
fip = &flash_info[0];
|
||||
total = 0L;
|
||||
|
||||
#if defined(CONFIG_CMA302)
|
||||
c302f_probe(fip, (c302f_addr_t)CFG_FLASH_BASE);
|
||||
total += fip->size;
|
||||
fip++;
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_FLASH)
|
||||
/* not yet ...
|
||||
cmbf_probe(fip, (cmbf_addr_t)CMA_MB_FLASH_BASE);
|
||||
total += fip->size;
|
||||
fip++;
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*
|
||||
* protect monitor and environment sectors
|
||||
*/
|
||||
|
||||
#if CFG_MONITOR_BASE == CFG_FLASH_BASE
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SECT_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
return total;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
flash_print_info(flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL: printf ("INTEL "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F008S5: printf ("28F008S5\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 % 4) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %2d - %08lX%s", i,
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
int
|
||||
flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int prot, sect, haderr;
|
||||
ulong start, now, last;
|
||||
void (*erase_init)(flash_info_t *, int);
|
||||
int (*erase_poll)(flash_info_t *, int);
|
||||
void (*reset)(flash_info_t *, int);
|
||||
int rcode = 0;
|
||||
|
||||
#ifdef FLASH_DEBUG
|
||||
printf("\nflash_erase: erase %d sectors (%d to %d incl.) from\n"
|
||||
" Bank # %d: ", s_last - s_first + 1, s_first, s_last,
|
||||
(info - flash_info) + 1);
|
||||
flash_print_info(info);
|
||||
#endif
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (info->flash_id) {
|
||||
|
||||
#if defined(CONFIG_CMA302)
|
||||
case FLASH_MAN_INTEL|FLASH_28F008S5:
|
||||
erase_init = c302f_erase_init;
|
||||
erase_poll = c302f_erase_poll;
|
||||
reset = c302f_reset;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_FLASH)
|
||||
case FLASH_MAN_INTEL|FLASH_28F800_B:
|
||||
case FLASH_MAN_AMD|FLASH_AM29F800B:
|
||||
/* not yet ...
|
||||
erase_init = cmbf_erase_init;
|
||||
erase_poll = cmbf_erase_poll;
|
||||
reset = cmbf_reset;
|
||||
break;
|
||||
*/
|
||||
#endif
|
||||
|
||||
default:
|
||||
printf ("Flash type %08lx not supported - 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 sector%s will not be erased!\n",
|
||||
prot, (prot > 1 ? "s" : ""));
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
last = 0;
|
||||
haderr = 0;
|
||||
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
ulong estart;
|
||||
int sectdone;
|
||||
|
||||
(*erase_init)(info, sect);
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
estart = get_timer(start);
|
||||
|
||||
do {
|
||||
now = get_timer(start);
|
||||
|
||||
if (now - estart > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout (sect %d)\n", sect);
|
||||
haderr = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef FLASH_DEBUG
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
#endif
|
||||
|
||||
sectdone = (*erase_poll)(info, sect);
|
||||
|
||||
if (sectdone < 0) {
|
||||
haderr = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (!sectdone);
|
||||
|
||||
if (haderr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (haderr > 0) {
|
||||
printf (" failed\n");
|
||||
rcode = 1;
|
||||
}
|
||||
else
|
||||
printf (" done\n");
|
||||
|
||||
/* reset to read mode */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
(*reset)(info, sect);
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 3 - write error
|
||||
*/
|
||||
|
||||
int
|
||||
write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
ulong start, now, last;
|
||||
|
||||
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
|
||||
*/
|
||||
start = get_timer (0);
|
||||
last = 0;
|
||||
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;
|
||||
|
||||
/* show that we're waiting */
|
||||
now = get_timer(start);
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
* 3 - write error
|
||||
*/
|
||||
static int
|
||||
write_word(flash_info_t *info, ulong dest, ulong data)
|
||||
{
|
||||
int retval;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*(ulong *)dest & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
switch (info->flash_id) {
|
||||
|
||||
#if defined(CONFIG_CMA302)
|
||||
case FLASH_MAN_INTEL|FLASH_28F008S5:
|
||||
retval = c302f_write_word((c302f_addr_t)dest, (c302f_word_t)data);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_FLASH)
|
||||
case FLASH_MAN_INTEL|FLASH_28F800_B:
|
||||
case FLASH_MAN_AMD|FLASH_AM29F800B:
|
||||
/* not yet ...
|
||||
retval = cmbf_write_word((cmbf_addr_t)dest, (cmbf_word_t)data);
|
||||
*/
|
||||
retval = 3;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
printf ("Flash type %08lx not supported - aborted\n",
|
||||
info->flash_id);
|
||||
retval = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
305
board/cogent/flash.h
Normal file
305
board/cogent/flash.h
Normal file
@@ -0,0 +1,305 @@
|
||||
/**************** DEFINES for Intel 28F008S5 FLASH chip **********************/
|
||||
|
||||
/* register addresses, valid only following a I8S5_CMD_RD_ID command */
|
||||
#define I8S5_ADDR_MAN 0x00000 /* manufacturer's id */
|
||||
#define I8S5_ADDR_DEV 0x00001 /* device id */
|
||||
#define I8S5_ADDR_CFGM 0x00003 /* master lock configuration */
|
||||
#define I8S5_ADDR_CFG(b) (((b)<<16)|2) /* block lock configuration */
|
||||
|
||||
/* Commands */
|
||||
#define I8S5_CMD_RST 0xFF /* reset flash */
|
||||
#define I8S5_CMD_RD_ID 0x90 /* read the id and lock bits */
|
||||
#define I8S5_CMD_RD_STAT 0x70 /* read the status register */
|
||||
#define I8S5_CMD_CLR_STAT 0x50 /* clear the staus register */
|
||||
#define I8S5_CMD_ERASE1 0x20 /* first word for block erase */
|
||||
#define I8S5_CMD_ERASE2 0xD0 /* second word for block erase */
|
||||
#define I8S5_CMD_PROG 0x40 /* program word command */
|
||||
#define I8S5_CMD_LOCK 0x60 /* first word for all lock commands */
|
||||
#define I8S5_CMD_SET_LOCK_BLK 0x01 /* 2nd word for set block lock bit */
|
||||
#define I8S5_CMD_SET_LOCK_MSTR 0xF1 /* 2nd word for set master lock bit */
|
||||
#define I8S5_CMD_CLR_LOCK_BLK 0xD0 /* 2nd word for clear block lock bit */
|
||||
|
||||
/* status register bits */
|
||||
#define I8S5_STAT_DPS 0x02 /* Device Protect Status */
|
||||
#define I8S5_STAT_PSS 0x04 /* Program Suspend Status */
|
||||
#define I8S5_STAT_VPPS 0x08 /* VPP Status */
|
||||
#define I8S5_STAT_PSLBS 0x10 /* Program and Set Lock Bit Status */
|
||||
#define I8S5_STAT_ECLBS 0x20 /* Erase and Clear Lock Bit Status */
|
||||
#define I8S5_STAT_ESS 0x40 /* Erase Suspend Status */
|
||||
#define I8S5_STAT_RDY 0x80 /* Write State Machine Status, 1=rdy */
|
||||
|
||||
#define I8S5_STAT_ERR (I8S5_STAT_VPPS | I8S5_STAT_DPS | \
|
||||
I8S5_STAT_ECLBS | I8S5_STAT_PSLBS)
|
||||
|
||||
/* ID and Lock Configuration */
|
||||
#define I8S5_RD_ID_LOCK 0x01 /* Bit 0 of each byte */
|
||||
#define I8S5_RD_ID_MAN 0x89 /* Manufacturer code = 0x89 */
|
||||
#define I8S5_RD_ID_DEV 0xA6 /* Device code = 0xA6, 28F008S5 */
|
||||
|
||||
/* dimensions */
|
||||
#define I8S5_NBLOCKS 16 /* a 28F008S5 consists of 16 blocks */
|
||||
#define I8S5_BLKSZ (64*1024) /* of 64Kbyte each */
|
||||
#define I8S5_SIZE (I8S5_BLKSZ * I8S5_NBLOCKS)
|
||||
|
||||
/**************** DEFINES for Intel 28F800B5 FLASH chip **********************/
|
||||
|
||||
/* register addresses, valid only following a I8S5_CMD_RD_ID command */
|
||||
#define I8B5_ADDR_MAN 0x00000 /* manufacturer's id */
|
||||
#define I8B5_ADDR_DEV 0x00001 /* device id */
|
||||
|
||||
/* Commands */
|
||||
#define I8B5_CMD_RST 0xFF /* reset flash */
|
||||
#define I8B5_CMD_RD_ID 0x90 /* read the id and lock bits */
|
||||
#define I8B5_CMD_RD_STAT 0x70 /* read the status register */
|
||||
#define I8B5_CMD_CLR_STAT 0x50 /* clear the staus register */
|
||||
#define I8B5_CMD_ERASE1 0x20 /* first word for block erase */
|
||||
#define I8B5_CMD_ERASE2 0xD0 /* second word for block erase */
|
||||
#define I8B5_CMD_PROG 0x40 /* program word command */
|
||||
|
||||
/* status register bits */
|
||||
#define I8B5_STAT_VPPS 0x08 /* VPP Status */
|
||||
#define I8B5_STAT_DWS 0x10 /* Program and Set Lock Bit Status */
|
||||
#define I8B5_STAT_ES 0x20 /* Erase and Clear Lock Bit Status */
|
||||
#define I8B5_STAT_ESS 0x40 /* Erase Suspend Status */
|
||||
#define I8B5_STAT_RDY 0x80 /* Write State Machine Status, 1=rdy */
|
||||
|
||||
#define I8B5_STAT_ERR (I8B5_STAT_VPPS | I8B5_STAT_DWS | I8B5_STAT_ES)
|
||||
|
||||
/* ID Configuration */
|
||||
#define I8B5_RD_ID_MAN 0x89 /* Manufacturer code = 0x89 */
|
||||
#define I8B5_RD_ID_DEV1 0x889D /* Device code = 0x889D, 28F800B5 */
|
||||
|
||||
/* dimensions */
|
||||
#define I8B5_NBLOCKS 8 /* a 28F008S5 consists of 16 blocks */
|
||||
#define I8B5_BLKSZ (128*1024) /* of 64Kbyte each */
|
||||
#define I8B5_SIZE (I8B5_BLKSZ * I8B5_NBLOCKS)
|
||||
|
||||
/****************** DEFINES for Cogent CMA302 Flash **************************/
|
||||
|
||||
/*
|
||||
* Quoted from the CMA302 manual:
|
||||
*
|
||||
* Although the CMA302 supports 64-bit reads, all writes must be done with
|
||||
* word size only. When programming the CMA302, the FLASH devices appear as 2
|
||||
* banks of interleaved, 32-bit wide FLASH. Each 32-bit word consists of four
|
||||
* 28F008S5 devices. The first bank is accessed when the word address is even,
|
||||
* while the second bank is accessed when the word address is odd. This must
|
||||
* be taken into account when programming the desired word. Also, when locking
|
||||
* blocks, software must lock both banks. The CMA302 does not directly support
|
||||
* byte writing. Programming and/or erasing individual bytes is done with
|
||||
* selective use of the Write Command. By not placing the Write Command value
|
||||
* on a particular byte lane, that byte will not be written with the following
|
||||
* Write Data. Also, remember that within a byte lane (i.e. D0-7), there are
|
||||
* two 28F008S5 devices, one for each bank or every other word.
|
||||
*
|
||||
* End quote.
|
||||
*
|
||||
* Each 28F008S5 is 8Mbit, with 8 bit wide data. i.e. each is 1Mbyte. The
|
||||
* chips are arranged on the CMA302 in multiples of two banks, each bank having
|
||||
* 4 chips. Each bank must be accessed as a single 32 bit wide device (i.e.
|
||||
* aligned on a 32 bit boundary), with each byte lane within the 32 bits (0-3)
|
||||
* going to each of the 4 chips and the word address selecting the bank, even
|
||||
* being the low bank and odd the high bank. For 64bit reads, both banks are
|
||||
* read simultaneously with the second bank on byte lanes 4-7. Each 28F008S5
|
||||
* consists of 16 64Kbyte "block"s. Before programming a byte, the block that
|
||||
* the byte resides within must be erased. So if you want to program contiguous
|
||||
* memory locations, you must erase all 8 chips at the same time. i.e. the
|
||||
* flash on the CMA302 can be viewed as a number of 512Kbyte blocks.
|
||||
*
|
||||
* Note: I am going to treat banks as 8 Mbytes (1Meg of 64bit words), whereas
|
||||
* the example code treats them as a pair of interleaved 1 Mbyte x 32bit banks.
|
||||
*/
|
||||
|
||||
typedef unsigned long c302f_word_t; /* 32 or 64 bit unsigned integer */
|
||||
typedef volatile c302f_word_t *c302f_addr_t;
|
||||
typedef unsigned long c302f_size_t; /* want this big - at least 32 bit */
|
||||
|
||||
/* layout of banks on cma302 board */
|
||||
#define C302F_BNK_WIDTH 8 /* each bank is 8 chips wide */
|
||||
#define C302F_BNK_WSHIFT 3 /* log base 2 of C302F_BNK_WIDTH */
|
||||
#define C302F_BNK_NBLOCKS I8S5_NBLOCKS
|
||||
#define C302F_BNK_BLKSZ (I8S5_BLKSZ * C302F_BNK_WIDTH)
|
||||
#define C302F_BNK_SIZE (I8S5_SIZE * C302F_BNK_WIDTH)
|
||||
|
||||
#define C302F_MAX_BANKS 2 /* up to 2 banks (8M each) on CMA302 */
|
||||
|
||||
/* align addresses and sizes to bank boundaries */
|
||||
#define C302F_BNK_ADDR_ALIGN(a) ((c302f_addr_t)((c302f_size_t)(a) \
|
||||
& ~(C302F_BNK_WIDTH - 1)))
|
||||
#define C302F_BNK_SIZE_ALIGN(s) ((c302f_size_t)C302F_BNK_ADDR_ALIGN( \
|
||||
(c302f_size_t)(s) + (C302F_BNK_WIDTH - 1)))
|
||||
|
||||
/* align addresses and sizes to block boundaries */
|
||||
#define C302F_BLK_ADDR_ALIGN(a) ((c302f_addr_t)((c302f_size_t)(a) \
|
||||
& ~(C302F_BNK_BLKSZ - 1)))
|
||||
#define C302F_BLK_SIZE_ALIGN(s) ((c302f_size_t)C302F_BLK_ADDR_ALIGN( \
|
||||
(c302f_size_t)(s) + (C302F_BNK_BLKSZ - 1)))
|
||||
|
||||
/* add a byte offset to a flash address */
|
||||
#define C302F_ADDR_ADD_BYTEOFF(a,o) \
|
||||
(c302f_addr_t)((c302f_size_t)(a) + (o))
|
||||
|
||||
/* get base address of bank b, given flash base address a */
|
||||
#define C302F_BNK_ADDR_BASE(a,b) \
|
||||
C302F_ADDR_ADD_BYTEOFF((a), \
|
||||
(c302f_size_t)(b) * C302F_BNK_SIZE)
|
||||
|
||||
/* adjust an address a (within a bank) to next word, block or bank */
|
||||
#define C302F_BNK_ADDR_NEXT_WORD(a) \
|
||||
C302F_ADDR_ADD_BYTEOFF((a), C302F_BNK_WIDTH)
|
||||
#define C302F_BNK_ADDR_NEXT_BLK(a) \
|
||||
C302F_ADDR_ADD_BYTEOFF((a), C302F_BNK_BLKSZ)
|
||||
#define C302F_BNK_ADDR_NEXT_BNK(a) \
|
||||
C302F_ADDR_ADD_BYTEOFF((a), C302F_BNK_SIZE)
|
||||
|
||||
/* get bank address of chip register r given a bank base address a */
|
||||
#define C302F_BNK_ADDR_I8S5REG(a,r) \
|
||||
C302F_ADDR_ADD_BYTEOFF((a), \
|
||||
(r) << C302F_BNK_WSHIFT)
|
||||
|
||||
/* make a bank representation for each chip address */
|
||||
|
||||
#define C302F_BNK_ADDR_MAN(a) C302F_BNK_ADDR_I8S5REG((a), I8S5_ADDR_MAN)
|
||||
#define C302F_BNK_ADDR_DEV(a) C302F_BNK_ADDR_I8S5REG((a), I8S5_ADDR_DEV)
|
||||
#define C302F_BNK_ADDR_CFGM(a) C302F_BNK_ADDR_I8S5REG((a), I8S5_ADDR_CFGM)
|
||||
#define C302F_BNK_ADDR_CFG(b,a) C302F_BNK_ADDR_I8S5REG((a), I8S5_ADDR_CFG(b))
|
||||
|
||||
/*
|
||||
* replicate a chip cmd/stat/rd value into each byte position within a word
|
||||
* so that multiple chips are accessed in a single word i/o operation
|
||||
*
|
||||
* this must be as wide as the c302f_word_t type
|
||||
*/
|
||||
#define C302F_FILL_WORD(o) (((unsigned long)(o) << 24) | \
|
||||
((unsigned long)(o) << 16) | \
|
||||
((unsigned long)(o) << 8) | \
|
||||
(unsigned long)(o))
|
||||
|
||||
/* make a bank representation for each chip cmd/stat/rd value */
|
||||
|
||||
/* Commands */
|
||||
#define C302F_BNK_CMD_RST C302F_FILL_WORD(I8S5_CMD_RST)
|
||||
#define C302F_BNK_CMD_RD_ID C302F_FILL_WORD(I8S5_CMD_RD_ID)
|
||||
#define C302F_BNK_CMD_RD_STAT C302F_FILL_WORD(I8S5_CMD_RD_STAT)
|
||||
#define C302F_BNK_CMD_CLR_STAT C302F_FILL_WORD(I8S5_CMD_CLR_STAT)
|
||||
#define C302F_BNK_CMD_ERASE1 C302F_FILL_WORD(I8S5_CMD_ERASE1)
|
||||
#define C302F_BNK_CMD_ERASE2 C302F_FILL_WORD(I8S5_CMD_ERASE2)
|
||||
#define C302F_BNK_CMD_PROG C302F_FILL_WORD(I8S5_CMD_PROG)
|
||||
#define C302F_BNK_CMD_LOCK C302F_FILL_WORD(I8S5_CMD_LOCK)
|
||||
#define C302F_BNK_CMD_SET_LOCK_BLK C302F_FILL_WORD(I8S5_CMD_SET_LOCK_BLK)
|
||||
#define C302F_BNK_CMD_SET_LOCK_MSTR C302F_FILL_WORD(I8S5_CMD_SET_LOCK_MSTR)
|
||||
#define C302F_BNK_CMD_CLR_LOCK_BLK C302F_FILL_WORD(I8S5_CMD_CLR_LOCK_BLK)
|
||||
|
||||
/* status register bits */
|
||||
#define C302F_BNK_STAT_DPS C302F_FILL_WORD(I8S5_STAT_DPS)
|
||||
#define C302F_BNK_STAT_PSS C302F_FILL_WORD(I8S5_STAT_PSS)
|
||||
#define C302F_BNK_STAT_VPPS C302F_FILL_WORD(I8S5_STAT_VPPS)
|
||||
#define C302F_BNK_STAT_PSLBS C302F_FILL_WORD(I8S5_STAT_PSLBS)
|
||||
#define C302F_BNK_STAT_ECLBS C302F_FILL_WORD(I8S5_STAT_ECLBS)
|
||||
#define C302F_BNK_STAT_ESS C302F_FILL_WORD(I8S5_STAT_ESS)
|
||||
#define C302F_BNK_STAT_RDY C302F_FILL_WORD(I8S5_STAT_RDY)
|
||||
|
||||
#define C302F_BNK_STAT_ERR C302F_FILL_WORD(I8S5_STAT_ERR)
|
||||
|
||||
/* ID and Lock Configuration */
|
||||
#define C302F_BNK_RD_ID_LOCK C302F_FILL_WORD(I8S5_RD_ID_LOCK)
|
||||
#define C302F_BNK_RD_ID_MAN C302F_FILL_WORD(I8S5_RD_ID_MAN)
|
||||
#define C302F_BNK_RD_ID_DEV C302F_FILL_WORD(I8S5_RD_ID_DEV)
|
||||
|
||||
/*************** DEFINES for Cogent Motherboard Flash ************************/
|
||||
|
||||
typedef unsigned short cmbf_word_t; /* 16 bit unsigned integer */
|
||||
typedef volatile cmbf_word_t *cmbf_addr_t;
|
||||
typedef unsigned long cmbf_size_t; /* want this big - at least 32 bit */
|
||||
|
||||
/* layout of banks on cogent motherboard - only 1 bank, 16 bit wide */
|
||||
#define CMBF_BNK_WIDTH 1 /* each bank is one chip wide */
|
||||
#define CMBF_BNK_WSHIFT 0 /* log base 2 of CMBF_BNK_WIDTH */
|
||||
#define CMBF_BNK_NBLOCKS I8B5_NBLOCKS
|
||||
#define CMBF_BNK_BLKSZ (I8B5_BLKSZ * CMBF_BNK_WIDTH)
|
||||
#define CMBF_BNK_SIZE (I8B5_SIZE * CMBF_BNK_WIDTH)
|
||||
|
||||
#define CMBF_MAX_BANKS 1 /* only 1 x 1Mbyte bank on cogent m/b */
|
||||
|
||||
/* align addresses and sizes to bank boundaries */
|
||||
#define CMBF_BNK_ADDR_ALIGN(a) ((c302f_addr_t)((c302f_size_t)(a) \
|
||||
& ~(CMBF_BNK_WIDTH - 1)))
|
||||
#define CMBF_BNK_SIZE_ALIGN(s) ((c302f_size_t)CMBF_BNK_ADDR_ALIGN( \
|
||||
(c302f_size_t)(s) + (CMBF_BNK_WIDTH - 1)))
|
||||
|
||||
/* align addresses and sizes to block boundaries */
|
||||
#define CMBF_BLK_ADDR_ALIGN(a) ((c302f_addr_t)((c302f_size_t)(a) \
|
||||
& ~(CMBF_BNK_BLKSZ - 1)))
|
||||
#define CMBF_BLK_SIZE_ALIGN(s) ((c302f_size_t)CMBF_BLK_ADDR_ALIGN( \
|
||||
(c302f_size_t)(s) + (CMBF_BNK_BLKSZ - 1)))
|
||||
|
||||
/* add a byte offset to a flash address */
|
||||
#define CMBF_ADDR_ADD_BYTEOFF(a,o) \
|
||||
(c302f_addr_t)((c302f_size_t)(a) + (o))
|
||||
|
||||
/* get base address of bank b, given flash base address a */
|
||||
#define CMBF_BNK_ADDR_BASE(a,b) \
|
||||
CMBF_ADDR_ADD_BYTEOFF((a), \
|
||||
(c302f_size_t)(b) * CMBF_BNK_SIZE)
|
||||
|
||||
/* adjust an address a (within a bank) to next word, block or bank */
|
||||
#define CMBF_BNK_ADDR_NEXT_WORD(a) \
|
||||
CMBF_ADDR_ADD_BYTEOFF((a), CMBF_BNK_WIDTH)
|
||||
#define CMBF_BNK_ADDR_NEXT_BLK(a) \
|
||||
CMBF_ADDR_ADD_BYTEOFF((a), CMBF_BNK_BLKSZ)
|
||||
#define CMBF_BNK_ADDR_NEXT_BNK(a) \
|
||||
CMBF_ADDR_ADD_BYTEOFF((a), CMBF_BNK_SIZE)
|
||||
|
||||
/* get bank address of chip register r given a bank base address a */
|
||||
#define CMBF_BNK_ADDR_I8B5REG(a,r) \
|
||||
CMBF_ADDR_ADD_BYTEOFF((a), \
|
||||
(r) << CMBF_BNK_WSHIFT)
|
||||
|
||||
/* make a bank representation for each chip address */
|
||||
|
||||
#define CMBF_BNK_ADDR_MAN(a) CMBF_BNK_ADDR_I8B5REG((a), I8B5_ADDR_MAN)
|
||||
#define CMBF_BNK_ADDR_DEV(a) CMBF_BNK_ADDR_I8B5REG((a), I8B5_ADDR_DEV)
|
||||
#define CMBF_BNK_ADDR_CFGM(a) CMBF_BNK_ADDR_I8B5REG((a), I8B5_ADDR_CFGM)
|
||||
#define CMBF_BNK_ADDR_CFG(b,a) CMBF_BNK_ADDR_I8B5REG((a), I8B5_ADDR_CFG(b))
|
||||
|
||||
/*
|
||||
* replicate a chip cmd/stat/rd value into each byte position within a word
|
||||
* so that multiple chips are accessed in a single word i/o operation
|
||||
*
|
||||
* this must be as wide as the c302f_word_t type
|
||||
*/
|
||||
#define CMBF_FILL_WORD(o) (((unsigned long)(o) << 24) | \
|
||||
((unsigned long)(o) << 16) | \
|
||||
((unsigned long)(o) << 8) | \
|
||||
(unsigned long)(o))
|
||||
|
||||
/* make a bank representation for each chip cmd/stat/rd value */
|
||||
|
||||
/* Commands */
|
||||
#define CMBF_BNK_CMD_RST CMBF_FILL_WORD(I8B5_CMD_RST)
|
||||
#define CMBF_BNK_CMD_RD_ID CMBF_FILL_WORD(I8B5_CMD_RD_ID)
|
||||
#define CMBF_BNK_CMD_RD_STAT CMBF_FILL_WORD(I8B5_CMD_RD_STAT)
|
||||
#define CMBF_BNK_CMD_CLR_STAT CMBF_FILL_WORD(I8B5_CMD_CLR_STAT)
|
||||
#define CMBF_BNK_CMD_ERASE1 CMBF_FILL_WORD(I8B5_CMD_ERASE1)
|
||||
#define CMBF_BNK_CMD_ERASE2 CMBF_FILL_WORD(I8B5_CMD_ERASE2)
|
||||
#define CMBF_BNK_CMD_PROG CMBF_FILL_WORD(I8B5_CMD_PROG)
|
||||
#define CMBF_BNK_CMD_LOCK CMBF_FILL_WORD(I8B5_CMD_LOCK)
|
||||
#define CMBF_BNK_CMD_SET_LOCK_BLK CMBF_FILL_WORD(I8B5_CMD_SET_LOCK_BLK)
|
||||
#define CMBF_BNK_CMD_SET_LOCK_MSTR CMBF_FILL_WORD(I8B5_CMD_SET_LOCK_MSTR)
|
||||
#define CMBF_BNK_CMD_CLR_LOCK_BLK CMBF_FILL_WORD(I8B5_CMD_CLR_LOCK_BLK)
|
||||
|
||||
/* status register bits */
|
||||
#define CMBF_BNK_STAT_DPS CMBF_FILL_WORD(I8B5_STAT_DPS)
|
||||
#define CMBF_BNK_STAT_PSS CMBF_FILL_WORD(I8B5_STAT_PSS)
|
||||
#define CMBF_BNK_STAT_VPPS CMBF_FILL_WORD(I8B5_STAT_VPPS)
|
||||
#define CMBF_BNK_STAT_PSLBS CMBF_FILL_WORD(I8B5_STAT_PSLBS)
|
||||
#define CMBF_BNK_STAT_ECLBS CMBF_FILL_WORD(I8B5_STAT_ECLBS)
|
||||
#define CMBF_BNK_STAT_ESS CMBF_FILL_WORD(I8B5_STAT_ESS)
|
||||
#define CMBF_BNK_STAT_RDY CMBF_FILL_WORD(I8B5_STAT_RDY)
|
||||
|
||||
#define CMBF_BNK_STAT_ERR CMBF_FILL_WORD(I8B5_STAT_ERR)
|
||||
|
||||
/* ID and Lock Configuration */
|
||||
#define CMBF_BNK_RD_ID_LOCK CMBF_FILL_WORD(I8B5_RD_ID_LOCK)
|
||||
#define CMBF_BNK_RD_ID_MAN CMBF_FILL_WORD(I8B5_RD_ID_MAN)
|
||||
#define CMBF_BNK_RD_ID_DEV CMBF_FILL_WORD(I8B5_RD_ID_DEV)
|
||||
3
board/cogent/kbm.c
Normal file
3
board/cogent/kbm.c
Normal file
@@ -0,0 +1,3 @@
|
||||
/* keyboard/mouse not implemented yet */
|
||||
|
||||
int cma_kbm_not_implemented = 1;
|
||||
79
board/cogent/kbm.h
Normal file
79
board/cogent/kbm.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* keyboard/mouse not implemented yet */
|
||||
|
||||
extern int cma_kbm_not_implemented;
|
||||
|
||||
/**************** DEFINES for H8542B Keyboard/Mouse Controller ***************/
|
||||
|
||||
/*
|
||||
* note the auxillary port is used to control the mouse
|
||||
*/
|
||||
|
||||
/* 8542B Commands (Sent to the Command Port) */
|
||||
#define HT8542_CMD_SET_BYTE 0x60 /* Set the command byte */
|
||||
#define HT8542_CMD_GET_BYTE 0x20 /* Get the command byte */
|
||||
#define HT8542_CMD_KBD_OBUFF 0xD2 /* Write to HT8542 Kbd Output Buffer */
|
||||
#define HT8542_CMD_AUX_OBUFF 0xD3 /* Write to HT8542 Mse Output Buffer */
|
||||
#define HT8542_CMD_AUX_WRITE 0xD4 /* Write to Mouse Port */
|
||||
#define HT8542_CMD_AUX_OFF 0xA7 /* Disable Mouse Port */
|
||||
#define HT8542_CMD_AUX_ON 0xA8 /* Re-Enable Mouse Port */
|
||||
#define HT8542_CMD_AUX_TEST 0xA9 /* Test for the presence of a Mouse */
|
||||
#define HT8542_CMD_DIAG 0xAA /* Start Diagnostics */
|
||||
#define HT8542_CMD_KBD_TEST 0xAB /* Test for presence of a keyboard */
|
||||
#define HT8542_CMD_KBD_OFF 0xAD /* Disable Kbd Port (use KBD_DAT_ON) */
|
||||
#define HT8542_CMD_KBD_ON 0xAE /* Enable Kbd Port (use KBD_DAT_OFF) */
|
||||
|
||||
/* HT8542B cmd byte set by KBD_CMD_SET_BYTE and retrieved by KBD_CMD_GET_BYTE */
|
||||
#define HT8542_CMD_BYTE_TRANS 0x40
|
||||
#define HT8542_CMD_BYTE_AUX_OFF 0x20 /* 1 = mse port disabled, 0 = enabled */
|
||||
#define HT8542_CMD_BYTE_KBD_OFF 0x10 /* 1 = kbd port disabled, 0 = enabled */
|
||||
#define HT8542_CMD_BYTE_OVER 0x08 /* 1 = override keyboard lock */
|
||||
#define HT8542_CMD_BYTE_RES 0x04 /* reserved */
|
||||
#define HT8542_CMD_BYTE_AUX_INT 0x02 /* 1 = enable mouse interrupt */
|
||||
#define HT8542_CMD_BYTE_KBD_INT 0x01 /* 1 = enable keyboard interrupt */
|
||||
|
||||
/* Keyboard Commands (Sent to the Data Port) */
|
||||
#define KBD_CMD_LED 0xED /* Set Keyboard LEDS with next byte */
|
||||
#define KBD_CMD_ECHO 0xEE /* Echo - we get 0xFA, 0xEE back */
|
||||
#define KBD_CMD_MODE 0xF0 /* set scan code mode with next byte */
|
||||
#define KBD_CMD_ID 0xF2 /* get keyboard/mouse ID */
|
||||
#define KBD_CMD_RPT 0xF3 /* Set Repeat Rate and Delay 2nd Byte */
|
||||
#define KBD_CMD_ON 0xF4 /* Enable keyboard */
|
||||
#define KBD_CMD_OFF 0xF5 /* Disables Scanning, Resets to Def */
|
||||
#define KBD_CMD_DEF 0xF6 /* Reverts kbd to default settings */
|
||||
#define KBD_CMD_RST 0xFF /* Reset - should get 0xFA, 0xAA back */
|
||||
|
||||
/* Set LED second bit defines */
|
||||
#define KBD_CMD_LED_SCROLL 0x01 /* Set SCROLL LOCK LED on */
|
||||
#define KBD_CMD_LED_NUM 0x02 /* Set NUM LOCK LED on */
|
||||
#define KBD_CMD_LED_CAPS 0x04 /* Set CAPS LOCK LED on */
|
||||
|
||||
/* Set Mode second byte defines */
|
||||
#define KBD_CMD_MODE_STAT 0x00 /* get current scan code mode */
|
||||
#define KBD_CMD_MODE_SCAN1 0x01 /* set mode to scan code 1 */
|
||||
#define KBD_CMD_MODE_SCAN2 0x02 /* set mode to scan code 2 */
|
||||
#define KBD_CMD_MODE_SCAN3 0x03 /* set mode to scan code 3 */
|
||||
|
||||
/* Keyboard/Mouse ID Codes */
|
||||
#define KBD_CMD_ID_1ST 0xAB /* 1st byte is 0xAB, 2nd is actual ID */
|
||||
#define KBD_CMD_ID_KBD 0x83 /* Keyboard */
|
||||
#define KBD_CMD_ID_MOUSE 0x00 /* Mouse */
|
||||
|
||||
/* Keyboard Data Return Defines */
|
||||
#define KBD_STAT_OVER 0x00 /* Buffer Overrun */
|
||||
#define KBD_STAT_DIAG_OK 0x55 /* Internal Self Test OK */
|
||||
#define KBD_STAT_RST_OK 0xAA /* Reset Complete */
|
||||
#define KBD_STAT_ECHO 0xEE /* Echo Command Return */
|
||||
#define KBD_STAT_BRK 0xF0 /* Prefix for Break Key Code */
|
||||
#define KBD_STAT_ACK 0xFA /* Received after all commands */
|
||||
#define KBD_STAT_DIAG_FAIL 0xFD /* Internal Self Test Failed */
|
||||
#define KBD_STAT_RESEND 0xFE /* Resend Last Command */
|
||||
|
||||
/* HT8542B Status Register Bit Defines */
|
||||
#define HT8542_STAT_OBF 0x01 /* 1 = output buffer is full */
|
||||
#define HT8542_STAT_IBF 0x02 /* 1 = input buffer is full */
|
||||
#define HT8542_STAT_SYS 0x04 /* system flag - unused */
|
||||
#define HT8542_STAT_CMD 0x08 /* 1 = cmd in input buffer, 0 = data */
|
||||
#define HT8542_STAT_INH 0x10 /* 1 = Inhibit - unused */
|
||||
#define HT8542_STAT_TX 0x20 /* 1 = Transmit Timeout has occured */
|
||||
#define HT8542_STAT_RX 0x40 /* 1 = Receive Timeout has occured */
|
||||
#define HT8542_STAT_PERR 0x80 /* 1 = Parity Error from Keyboard */
|
||||
231
board/cogent/lcd.c
Normal file
231
board/cogent/lcd.c
Normal file
@@ -0,0 +1,231 @@
|
||||
/* most of this is taken from the file */
|
||||
/* hal/powerpc/cogent/current/src/hal_diag.c in the */
|
||||
/* Cygnus eCos source. Here is the copyright notice: */
|
||||
/* */
|
||||
/*============================================================================= */
|
||||
/* */
|
||||
/* hal_diag.c */
|
||||
/* */
|
||||
/* HAL diagnostic output code */
|
||||
/* */
|
||||
/*============================================================================= */
|
||||
/*####COPYRIGHTBEGIN#### */
|
||||
/* */
|
||||
/* ------------------------------------------- */
|
||||
/* The contents of this file are subject to the Cygnus eCos Public License */
|
||||
/* Version 1.0 (the "License"); you may not use this file except in */
|
||||
/* compliance with the License. You may obtain a copy of the License at */
|
||||
/* http://sourceware.cygnus.com/ecos */
|
||||
/* */
|
||||
/* Software distributed under the License is distributed on an "AS IS" */
|
||||
/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the */
|
||||
/* License for the specific language governing rights and limitations under */
|
||||
/* the License. */
|
||||
/* */
|
||||
/* The Original Code is eCos - Embedded Cygnus Operating System, released */
|
||||
/* September 30, 1998. */
|
||||
/* */
|
||||
/* The Initial Developer of the Original Code is Cygnus. Portions created */
|
||||
/* by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. */
|
||||
/* ------------------------------------------- */
|
||||
/* */
|
||||
/*####COPYRIGHTEND#### */
|
||||
/*============================================================================= */
|
||||
/*#####DESCRIPTIONBEGIN#### */
|
||||
/* */
|
||||
/* Author(s): nickg, jskov */
|
||||
/* Contributors: nickg, jskov */
|
||||
/* Date: 1999-03-23 */
|
||||
/* Purpose: HAL diagnostic output */
|
||||
/* Description: Implementations of HAL diagnostic output support. */
|
||||
/* */
|
||||
/*####DESCRIPTIONEND#### */
|
||||
/* */
|
||||
/*============================================================================= */
|
||||
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Cogent board specific LCD code */
|
||||
|
||||
#include <common.h>
|
||||
#include <stdarg.h>
|
||||
#include <board/cogent/lcd.h>
|
||||
|
||||
static char lines[2][LCD_LINE_LENGTH+1];
|
||||
static int curline;
|
||||
static int linepos;
|
||||
static int heartbeat_active;
|
||||
/* make the next two strings exactly LCD_LINE_LENGTH (16) chars long */
|
||||
/* pad to the right with spaces if necessary */
|
||||
static char init_line0[LCD_LINE_LENGTH+1] = "U-Boot Cogent ";
|
||||
static char init_line1[LCD_LINE_LENGTH+1] = "mjj, 11 Aug 2000";
|
||||
|
||||
static inline unsigned char
|
||||
lcd_read_status(cma_mb_lcd *clp)
|
||||
{
|
||||
/* read the Busy Status Register */
|
||||
return (cma_mb_reg_read(&clp->lcd_bsr));
|
||||
}
|
||||
|
||||
static inline void
|
||||
lcd_wait_not_busy(cma_mb_lcd *clp)
|
||||
{
|
||||
/*
|
||||
* wait for not busy
|
||||
* Note: It seems that the LCD isn't quite ready to process commands
|
||||
* when it clears the BUSY flag. Reading the status address an extra
|
||||
* time seems to give it enough breathing room.
|
||||
*/
|
||||
|
||||
while (lcd_read_status(clp) & LCD_STAT_BUSY)
|
||||
;
|
||||
|
||||
(void)lcd_read_status(clp);
|
||||
}
|
||||
|
||||
static inline void
|
||||
lcd_write_command(cma_mb_lcd *clp, unsigned char cmd)
|
||||
{
|
||||
lcd_wait_not_busy(clp);
|
||||
|
||||
/* write the Command Register */
|
||||
cma_mb_reg_write(&clp->lcd_cmd, cmd);
|
||||
}
|
||||
|
||||
static inline void
|
||||
lcd_write_data(cma_mb_lcd *clp, unsigned char data)
|
||||
{
|
||||
lcd_wait_not_busy(clp);
|
||||
|
||||
/* write the Current Character Register */
|
||||
cma_mb_reg_write(&clp->lcd_ccr, data);
|
||||
}
|
||||
|
||||
static inline void
|
||||
lcd_dis(int addr, char *string)
|
||||
{
|
||||
cma_mb_lcd *clp = (cma_mb_lcd *)CMA_MB_LCD_BASE;
|
||||
int pos, linelen;
|
||||
|
||||
linelen = LCD_LINE_LENGTH;
|
||||
if (heartbeat_active && addr == LCD_LINE0)
|
||||
linelen--;
|
||||
|
||||
lcd_write_command(clp, LCD_CMD_ADD + addr);
|
||||
for (pos = 0; *string != '\0' && pos < linelen; pos++)
|
||||
lcd_write_data(clp, *string++);
|
||||
}
|
||||
|
||||
void
|
||||
lcd_init(void)
|
||||
{
|
||||
cma_mb_lcd *clp = (cma_mb_lcd *)CMA_MB_LCD_BASE;
|
||||
int i;
|
||||
|
||||
/* configure the lcd for 8 bits/char, 2 lines and 5x7 dot matrix */
|
||||
lcd_write_command(clp, LCD_CMD_MODE);
|
||||
|
||||
/* turn the LCD display on */
|
||||
lcd_write_command(clp, LCD_CMD_DON);
|
||||
|
||||
curline = 0;
|
||||
linepos = 0;
|
||||
|
||||
for (i = 0; i < LCD_LINE_LENGTH; i++) {
|
||||
lines[0][i] = init_line0[i];
|
||||
lines[1][i] = init_line1[i];
|
||||
}
|
||||
|
||||
lines[0][LCD_LINE_LENGTH] = lines[1][LCD_LINE_LENGTH] = 0;
|
||||
|
||||
lcd_dis(LCD_LINE0, lines[0]);
|
||||
lcd_dis(LCD_LINE1, lines[1]);
|
||||
|
||||
printf("HD44780 2 line x %d char display\n", LCD_LINE_LENGTH);
|
||||
}
|
||||
|
||||
void
|
||||
lcd_write_char(const char c)
|
||||
{
|
||||
int i, linelen;
|
||||
|
||||
/* ignore CR */
|
||||
if (c == '\r')
|
||||
return;
|
||||
|
||||
linelen = LCD_LINE_LENGTH;
|
||||
if (heartbeat_active && curline == 0)
|
||||
linelen--;
|
||||
|
||||
if (c == '\n') {
|
||||
lcd_dis(LCD_LINE0, &lines[curline^1][0]);
|
||||
lcd_dis(LCD_LINE1, &lines[curline][0]);
|
||||
|
||||
/* Do a line feed */
|
||||
curline ^= 1;
|
||||
linelen = LCD_LINE_LENGTH;
|
||||
if (heartbeat_active && curline == 0)
|
||||
linelen--;
|
||||
linepos = 0;
|
||||
|
||||
for (i = 0; i < linelen; i++)
|
||||
lines[curline][i] = ' ';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Only allow to be output if there is room on the LCD line */
|
||||
if (linepos < linelen)
|
||||
lines[curline][linepos++] = c;
|
||||
}
|
||||
|
||||
void
|
||||
lcd_flush(void)
|
||||
{
|
||||
lcd_dis(LCD_LINE1, &lines[curline][0]);
|
||||
}
|
||||
|
||||
void
|
||||
lcd_write_string(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
for (p = (char *)s; *p != '\0'; p++)
|
||||
lcd_write_char(*p);
|
||||
}
|
||||
|
||||
void
|
||||
lcd_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[CFG_PBSIZE];
|
||||
|
||||
va_start(args, fmt);
|
||||
(void)vsprintf(buf, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
lcd_write_string(buf);
|
||||
}
|
||||
|
||||
void
|
||||
lcd_heartbeat(void)
|
||||
{
|
||||
cma_mb_lcd *clp = (cma_mb_lcd *)CMA_MB_LCD_BASE;
|
||||
#if 0
|
||||
static char rotchars[] = { '|', '/', '-', '\\' };
|
||||
#else
|
||||
/* HD44780 Rom Code A00 has no backslash */
|
||||
static char rotchars[] = { '|', '/', '-', '\315' };
|
||||
#endif
|
||||
static int rotator_index = 0;
|
||||
|
||||
heartbeat_active = 1;
|
||||
|
||||
/* write the address */
|
||||
lcd_write_command(clp, LCD_CMD_ADD + LCD_LINE0 + (LCD_LINE_LENGTH - 1));
|
||||
|
||||
/* write the next char in the sequence */
|
||||
lcd_write_data(clp, rotchars[rotator_index]);
|
||||
|
||||
if (++rotator_index >= (sizeof rotchars / sizeof rotchars[0]))
|
||||
rotator_index = 0;
|
||||
}
|
||||
84
board/cogent/lcd.h
Normal file
84
board/cogent/lcd.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* most of this is taken from the file */
|
||||
/* hal/powerpc/cogent/current/src/hal_diag.c in the */
|
||||
/* Cygnus eCos source. Here is the copyright notice: */
|
||||
/* */
|
||||
/*============================================================================= */
|
||||
/* */
|
||||
/* hal_diag.c */
|
||||
/* */
|
||||
/* HAL diagnostic output code */
|
||||
/* */
|
||||
/*============================================================================= */
|
||||
/*####COPYRIGHTBEGIN#### */
|
||||
/* */
|
||||
/* ------------------------------------------- */
|
||||
/* The contents of this file are subject to the Cygnus eCos Public License */
|
||||
/* Version 1.0 (the "License"); you may not use this file except in */
|
||||
/* compliance with the License. You may obtain a copy of the License at */
|
||||
/* http://sourceware.cygnus.com/ecos */
|
||||
/* */
|
||||
/* Software distributed under the License is distributed on an "AS IS" */
|
||||
/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the */
|
||||
/* License for the specific language governing rights and limitations under */
|
||||
/* the License. */
|
||||
/* */
|
||||
/* The Original Code is eCos - Embedded Cygnus Operating System, released */
|
||||
/* September 30, 1998. */
|
||||
/* */
|
||||
/* The Initial Developer of the Original Code is Cygnus. Portions created */
|
||||
/* by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. */
|
||||
/* ------------------------------------------- */
|
||||
/* */
|
||||
/*####COPYRIGHTEND#### */
|
||||
/*============================================================================= */
|
||||
/*#####DESCRIPTIONBEGIN#### */
|
||||
/* */
|
||||
/* Author(s): nickg, jskov */
|
||||
/* Contributors: nickg, jskov */
|
||||
/* Date: 1999-03-23 */
|
||||
/* Purpose: HAL diagnostic output */
|
||||
/* Description: Implementations of HAL diagnostic output support. */
|
||||
/* */
|
||||
/*####DESCRIPTIONEND#### */
|
||||
/* */
|
||||
/*============================================================================= */
|
||||
|
||||
/* FEMA 162B 16 character x 2 line LCD */
|
||||
|
||||
/* status register bit definitions */
|
||||
#define LCD_STAT_BUSY 0x80 /* 1 = display busy */
|
||||
#define LCD_STAT_ADD 0x7F /* bits 0-6 return current display address */
|
||||
|
||||
/* command register definitions */
|
||||
#define LCD_CMD_RST 0x01 /* clear entire display and reset display addr */
|
||||
#define LCD_CMD_HOME 0x02 /* reset display address and reset any shifting */
|
||||
#define LCD_CMD_ECL 0x04 /* move cursor left one pos on next data write */
|
||||
#define LCD_CMD_ESL 0x05 /* shift display left one pos on next data write */
|
||||
#define LCD_CMD_ECR 0x06 /* move cursor right one pos on next data write */
|
||||
#define LCD_CMD_ESR 0x07 /* shift disp right one pos on next data write */
|
||||
#define LCD_CMD_DOFF 0x08 /* display off, cursor off, blinking off */
|
||||
#define LCD_CMD_BL 0x09 /* blink character at current cursor position */
|
||||
#define LCD_CMD_CUR 0x0A /* enable cursor on */
|
||||
#define LCD_CMD_DON 0x0C /* turn display on */
|
||||
#define LCD_CMD_CL 0x10 /* move cursor left one position */
|
||||
#define LCD_CMD_SL 0x14 /* shift display left one position */
|
||||
#define LCD_CMD_CR 0x18 /* move cursor right one position */
|
||||
#define LCD_CMD_SR 0x1C /* shift display right one position */
|
||||
#define LCD_CMD_MODE 0x38 /* sets 8 bits, 2 lines, 5x7 characters */
|
||||
#define LCD_CMD_ACG 0x40 /* bits 0-5 sets character generator address */
|
||||
#define LCD_CMD_ADD 0x80 /* bits 0-6 sets display data addr to line 1 + */
|
||||
|
||||
/* LCD status values */
|
||||
#define LCD_OK 0x00
|
||||
#define LCD_ERR 0x01
|
||||
|
||||
#define LCD_LINE0 0x00
|
||||
#define LCD_LINE1 0x40
|
||||
|
||||
#define LCD_LINE_LENGTH 16
|
||||
|
||||
extern void lcd_init(void);
|
||||
extern void lcd_write_char(const char);
|
||||
extern void lcd_flush(void);
|
||||
extern void lcd_write_string(const char *);
|
||||
extern void lcd_printf(const char *, ...);
|
||||
285
board/cogent/mb.c
Normal file
285
board/cogent/mb.c
Normal file
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <board/cogent/dipsw.h>
|
||||
#include <board/cogent/lcd.h>
|
||||
#include <board/cogent/rtc.h>
|
||||
#include <board/cogent/par.h>
|
||||
#include <board/cogent/pci.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(CONFIG_8260)
|
||||
|
||||
#include <ioports.h>
|
||||
|
||||
/*
|
||||
* I/O Port configuration table
|
||||
*
|
||||
* if conf is 1, then that port pin will be configured at boot time
|
||||
* according to the five values podr/pdir/ppar/psor/pdat for that entry
|
||||
*/
|
||||
|
||||
const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port A configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA30 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA29 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA28 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA27 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA26 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA25 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA24 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA23 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA22 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA21 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA20 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA19 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA18 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA17 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA16 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA15 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA14 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA13 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA12 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA11 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA10 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC2 TXD */
|
||||
/* PA8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC2 RXD */
|
||||
/* PA7 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA6 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA5 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA4 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA3 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA2 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA1 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PA0 */ { 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
|
||||
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB30 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB29 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB28 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB27 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB26 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB25 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB24 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB23 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB22 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB21 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB20 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB19 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB18 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB17 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB16 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB15 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB14 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB13 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB12 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB11 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB10 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB9 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB8 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB7 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB6 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB5 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB4 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
},
|
||||
|
||||
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC30 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC29 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC28 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC27 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC26 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC25 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC24 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC23 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC22 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC21 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC20 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC19 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC18 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC17 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC16 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC15 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC14 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC13 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC12 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC11 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC10 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC9 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC8 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC7 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC6 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC5 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC4 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC3 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC2 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC1 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PC0 */ { 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
|
||||
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD30 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD29 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD28 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD27 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD26 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD25 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD24 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD23 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD22 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD21 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD20 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD19 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD18 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD17 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD16 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD15 */ { 1, 1, 1, 0, 0, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 0, 0 }, /* I2C SCL */
|
||||
/* PD13 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD12 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD11 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD10 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD7 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD6 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD5 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD4 */ { 0, 0, 0, 0, 0, 0 },
|
||||
/* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* CONFIG_8260 */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Check Board Identity:
|
||||
*/
|
||||
|
||||
int
|
||||
checkboard(void)
|
||||
{
|
||||
puts ("Board: Cogent " COGENT_MOTHERBOARD " motherboard with a "
|
||||
COGENT_CPU_MODULE " CPU Module\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations while still
|
||||
* running in flash
|
||||
*/
|
||||
|
||||
int misc_init_f (void)
|
||||
{
|
||||
printf ("DIPSW: ");
|
||||
dipsw_init();
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
long int
|
||||
initdram(int board_type)
|
||||
{
|
||||
#if CONFIG_CMA111
|
||||
return (32L * 1024L * 1024L);
|
||||
#else
|
||||
unsigned char dipsw_val;
|
||||
int dual, size0, size1;
|
||||
long int memsize;
|
||||
|
||||
dipsw_val = dipsw_cooked();
|
||||
|
||||
dual = dipsw_val & 0x01;
|
||||
size0 = (dipsw_val & 0x08) >> 3;
|
||||
size1 = (dipsw_val & 0x04) >> 2;
|
||||
|
||||
if (size0)
|
||||
if (size1)
|
||||
memsize = 16L * 1024L * 1024L;
|
||||
else
|
||||
memsize = 1L * 1024L * 1024L;
|
||||
else
|
||||
if (size1)
|
||||
memsize = 4L * 1024L * 1024L;
|
||||
else {
|
||||
printf("[Illegal dip switch settings - assuming 16Mbyte SIMMs] ");
|
||||
memsize = 16L * 1024L * 1024L; /* shouldn't happen - guess 16M */
|
||||
}
|
||||
|
||||
if (dual)
|
||||
memsize *= 2L;
|
||||
|
||||
return (memsize);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations after monitor
|
||||
* has been relocated into ram
|
||||
*/
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
printf ("LCD: ");
|
||||
lcd_init();
|
||||
|
||||
#if 0
|
||||
printf ("RTC: ");
|
||||
rtc_init();
|
||||
|
||||
printf ("PAR: ");
|
||||
par_init();
|
||||
|
||||
printf ("KBM: ");
|
||||
kbm_init();
|
||||
|
||||
printf ("PCI: ");
|
||||
pci_init();
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
525
board/cogent/mb.h
Normal file
525
board/cogent/mb.h
Normal file
@@ -0,0 +1,525 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* defines for Cogent Motherboards
|
||||
*/
|
||||
|
||||
#ifndef _COGENT_MB_H
|
||||
#define _COGENT_MB_H
|
||||
|
||||
/*
|
||||
* Cogent Motherboard Address Map
|
||||
*
|
||||
* The size of a Cogent motherboard address space is 256 Mbytes (i.e. 28 bits).
|
||||
*
|
||||
* The first 32 Mbyte (0x0000000-0x1FFFFFF) is usually RAM. The following
|
||||
* 3 x 32 Mbyte areas (0x2000000-0x3FFFFFF, 0x4000000-0x5FFFFFF and
|
||||
* 0x6000000-0x7FFFFFF) are general I/O "slots" (slots 1, 2 and 3).
|
||||
* Most other motherboard devices have registers mapped into the area
|
||||
* 0xE000000-0xFFFFFFF (Motherboard I/O slot?). The area 0x8000000-0xDFFFFFF
|
||||
* is free for whatever.
|
||||
*
|
||||
* The location of the motherboard address space in the physical address space
|
||||
* of the cpu is given by CMA_MB_BASE. This value is determined by the cpu
|
||||
* module plugged into the motherboard and is configured above.
|
||||
*
|
||||
* Motherboard I/O devices mapped into the area (0xE000000-0xFFFFFFF)
|
||||
* generally only use byte lane 0 (D0-7) for their transfers, i.e. only
|
||||
* 8 bit, or 1 byte, transfers can take place, so all the registers are
|
||||
* only 8 bits wide. The exceptions are the motherboard flash, which uses
|
||||
* byte lanes 0 and 1 (i.e. 16 bits), and the mapped PCI address space.
|
||||
*
|
||||
* I/O registers within the mapped motherboard devices are 64 bit aligned
|
||||
* i.e. they are 8 bytes apart. For big endian addressing, the 8 bit register
|
||||
* will be at byte 7 (the address + 7). For little endian addressing, the
|
||||
* register will be at byte 0 (the address + 0). To learn the endianess
|
||||
* we must include <asm/byteorder.h>
|
||||
*
|
||||
* Take the CMA102 and CMA111 motherboards as examples...
|
||||
*
|
||||
* The CMA102 has three CMABus I/O Expansion slots and no PCI bridge. The 3
|
||||
* CMABus slots are each mapped directly onto the three general I/O slots.
|
||||
*
|
||||
* The CMA111 has only one CMABus I/O Expansion slot, but has a V360EPC PCI
|
||||
* bridge. The CMABus slot is mapped onto general I/O slot 1. The standard
|
||||
* PCI Bus space is mapped onto general I/O slot 2, with a small area at the
|
||||
* top reserved for access to the V360EPC registers (0x5FF0000-0x5FFFFFF).
|
||||
* I/O slot 3 is unused. The extended PCI Bus space is mapped onto the area
|
||||
* 0xA000000-0xDFFFFFF.
|
||||
*/
|
||||
|
||||
#define CMA_MB_RAM_BASE (CFG_CMA_MB_BASE+0x0000000)
|
||||
#define CMA_MB_RAM_SIZE 0x2000000 /* dip sws set actual size */
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SLOT1)
|
||||
#define CMA_MB_SLOT1_BASE (CFG_CMA_MB_BASE+0x2000000)
|
||||
#define CMA_MB_SLOT1_SIZE 0x2000000
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SLOT2)
|
||||
#define CMA_MB_SLOT2_BASE (CFG_CMA_MB_BASE+0x4000000)
|
||||
#define CMA_MB_SLOT2_SIZE 0x2000000
|
||||
#endif
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_PCI)
|
||||
#define CMA_MB_STDPCI_BASE (CFG_CMA_MB_BASE+0x4000000)
|
||||
#define CMA_MB_STDPCI_SIZE 0x1ff0000
|
||||
#define CMA_MB_V360EPC_BASE (CFG_CMA_MB_BASE+0x5ff0000)
|
||||
#define CMA_MB_V360EPC_SIZE 0x10000
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SLOT3)
|
||||
#define CMA_MB_SLOT3_BASE (CFG_CMA_MB_BASE+0x6000000)
|
||||
#define CMA_MB_SLOT3_SIZE 0x2000000
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_PCI_EXT)
|
||||
#define CMA_MB_EXTPCI_BASE (CFG_CMA_MB_BASE+0xa000000)
|
||||
#define CMA_MB_EXTPCI_SIZE 0x4000000
|
||||
#endif
|
||||
|
||||
#define CMA_MB_ROMLOW_BASE (CFG_CMA_MB_BASE+0xe000000)
|
||||
#define CMA_MB_ROMLOW_SIZE 0x800000
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_FLASH)
|
||||
#define CMA_MB_FLLOW_EXEC_BASE (CFG_CMA_MB_BASE+0xe000000)
|
||||
#define CMA_MB_FLLOW_EXEC_SIZE 0x100000
|
||||
#define CMA_MB_FLLOW_RDWR_BASE (CFG_CMA_MB_BASE+0xe400000)
|
||||
#define CMA_MB_FLLOW_RDWR_SIZE 0x400000
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_RTC)
|
||||
#define CMA_MB_RTC_BASE (CFG_CMA_MB_BASE+0xe800000)
|
||||
#define CMA_MB_RTC_SIZE 0x4000
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SERPAR)
|
||||
#define CMA_MB_SERPAR_BASE (CFG_CMA_MB_BASE+0xe900000)
|
||||
#define CMA_MB_SERIALB_BASE (CMA_MB_SERPAR_BASE+0x00)
|
||||
#define CMA_MB_SERIALA_BASE (CMA_MB_SERPAR_BASE+0x40)
|
||||
#define CMA_MB_PARALLEL_BASE (CMA_MB_SERPAR_BASE+0x80)
|
||||
#define CMA_MB_SERPAR_SIZE 0xa0
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_KBM)
|
||||
#define CMA_MB_PKBM_BASE (CFG_CMA_MB_BASE+0xe900100)
|
||||
#define CMA_MB_PKBM_SIZE 0x10
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_LCD)
|
||||
#define CMA_MB_LCD_BASE (CFG_CMA_MB_BASE+0xeb00000)
|
||||
#define CMA_MB_LCD_SIZE 0x10
|
||||
#endif
|
||||
|
||||
#define CMA_MB_DIPSW_BASE (CFG_CMA_MB_BASE+0xec00000)
|
||||
#define CMA_MB_DIPSW_SIZE 0x10
|
||||
|
||||
#if (CMA_MB_CAPS & (CMA_MB_CAP_SLOT1|CMA_MB_CAP_SER2|CMA_MB_CAP_KBM))
|
||||
#define CMA_MB_SLOT1CFG_BASE (CFG_CMA_MB_BASE+0xf100000)
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SER2)
|
||||
#define CMA_MB_SER2_BASE (CMA_MB_SLOT1CFG_BASE+0x80)
|
||||
#define CMA_MB_SER2B_BASE (CMA_MB_SER2_BASE+0x00)
|
||||
#define CMA_MB_SER2A_BASE (CMA_MB_SER2_BASE+0x40)
|
||||
#endif
|
||||
#if defined(CONFIG_CMA302) && defined(CONFIG_CMA302_SLOT1)
|
||||
#define CMA_MB_S1KBM_BASE (CMA_MB_SLOT1CFG_BASE+0x200)
|
||||
#endif
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_KBM) && !defined(COGENT_CMA150)
|
||||
#define CMA_MB_IREQ1STAT_BASE (CMA_MB_SLOT1CFG_BASE+0x100)
|
||||
#define CMA_MB_AKBM_BASE (CMA_MB_SLOT1CFG_BASE+0x200)
|
||||
#define CMA_MB_IREQ1MASK_BASE (CMA_MB_SLOT1CFG_BASE+0x300)
|
||||
#endif
|
||||
#define CMA_MB_SLOT1CFG_SIZE 0x400
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SLOT2)
|
||||
#define CMA_MB_SLOT2CFG_BASE (CFG_CMA_MB_BASE+0xf200000)
|
||||
#if defined(CONFIG_CMA302) && defined(CONFIG_CMA302_SLOT2)
|
||||
#define CMA_MB_S2KBM_BASE (CMA_MB_SLOT2CFG_BASE+0x200)
|
||||
#endif
|
||||
#define CMA_MB_SLOT2CFG_SIZE 0x400
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_PCI)
|
||||
#define CMA_MB_PCICTL_BASE (CFG_CMA_MB_BASE+0xf200000)
|
||||
#define CMA_MB_PCI_V3CTL_BASE (CMA_MB_PCICTL_BASE+0x100)
|
||||
#define CMA_MB_PCI_IDSEL_BASE (CMA_MB_PCICTL_BASE+0x200)
|
||||
#define CMA_MB_PCI_IMASK_BASE (CMA_MB_PCICTL_BASE+0x300)
|
||||
#define CMA_MB_PCI_ISTAT_BASE (CMA_MB_PCICTL_BASE+0x400)
|
||||
#define CMA_MB_PCI_MBID_BASE (CMA_MB_PCICTL_BASE+0x500)
|
||||
#define CMA_MB_PCI_MBREV_BASE (CMA_MB_PCICTL_BASE+0x600)
|
||||
#define CMA_MB_PCICTL_SIZE 0x700
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SLOT3)
|
||||
#define CMA_MB_SLOT3CFG_BASE (CFG_CMA_MB_BASE+0xf300000)
|
||||
#if defined(CONFIG_CMA302) && defined(CONFIG_CMA302_SLOT3)
|
||||
#define CMA_MB_S3KBM_BASE (CMA_MB_SLOT3CFG_BASE+0x200)
|
||||
#endif
|
||||
#define CMA_MB_SLOT3CFG_SIZE 0x400
|
||||
#endif
|
||||
|
||||
#define CMA_MB_ROMHIGH_BASE (CFG_CMA_MB_BASE+0xf800000)
|
||||
#define CMA_MB_ROMHIGH_SIZE 0x800000
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_FLASH)
|
||||
#define CMA_MB_FLHIGH_EXEC_BASE (CFG_CMA_MB_BASE+0xf800000)
|
||||
#define CMA_MB_FLHIGH_EXEC_SIZE 0x100000
|
||||
#define CMA_MB_FLHIGH_RDWR_BASE (CFG_CMA_MB_BASE+0xfc00000)
|
||||
#define CMA_MB_FLHIGH_RDWR_SIZE 0x400000
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_PCI)
|
||||
|
||||
/* PCI Control Register bits */
|
||||
|
||||
/* V360EPC Control register bits */
|
||||
#define CMA_MB_PCI_V3CTL_RESET 0x01
|
||||
#define CMA_MB_PCI_V3CTL_EXTADD 0x08
|
||||
|
||||
/* PCI ID Select register bits */
|
||||
#define CMA_MB_PCI_IDSEL_SLOTA 0x01
|
||||
#define CMA_MB_PCI_IDSEL_SLOTB 0x02
|
||||
#define CMA_MB_PCI_IDSEL_GD82559 0x04
|
||||
#define CMA_MB_PCI_IDSEL_B69000 0x08
|
||||
#define CMA_MB_PCI_IDSEL_PD6832 0x10
|
||||
|
||||
/* PCI Interrupt Mask/Status register bits */
|
||||
#define CMA_MB_PCI_IMS_INTA 0x01
|
||||
#define CMA_MB_PCI_IMS_INTB 0x02
|
||||
#define CMA_MB_PCI_IMS_INTC 0x04
|
||||
#define CMA_MB_PCI_IMS_INTD 0x08
|
||||
#define CMA_MB_PCI_IMS_CBINT 0x10
|
||||
#define CMA_MB_PCI_IMS_V3LINT 0x80
|
||||
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & (CMA_MB_CAP_KBM|CMA_MB_CAP_SER2)) && !defined(COGENT_CMA150)
|
||||
|
||||
/*
|
||||
* IREQ1 Interrupt Mask/Status register bits
|
||||
* (Note: not available on CMA150 - must poll HT6542B interrupt register)
|
||||
*/
|
||||
|
||||
#define IREQ1_MINT 0x01
|
||||
#define IREQ1_KINT 0x02
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SER2)
|
||||
#define IREQ1_SINT2 0x04
|
||||
#define IREQ1_SINT3 0x08
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/* a single CMA10x motherboard i/o register */
|
||||
typedef
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
unsigned char value;
|
||||
#endif
|
||||
unsigned char filler[7];
|
||||
#if defined(__BIG_ENDIAN)
|
||||
unsigned char value;
|
||||
#endif
|
||||
}
|
||||
cma_mb_reg;
|
||||
|
||||
extern __inline__ unsigned char
|
||||
cma_mb_reg_read(volatile cma_mb_reg *reg)
|
||||
{
|
||||
unsigned char data = reg->value;
|
||||
__asm__ __volatile__ ("eieio" : : : "memory");
|
||||
return data;
|
||||
}
|
||||
|
||||
extern __inline__ void
|
||||
cma_mb_reg_write(volatile cma_mb_reg *reg, unsigned char data)
|
||||
{
|
||||
reg->value = data;
|
||||
__asm__ __volatile__ ("eieio" : : : "memory");
|
||||
}
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_RTC)
|
||||
|
||||
/* MK48T02 RTC registers */
|
||||
typedef
|
||||
struct {
|
||||
cma_mb_reg sram[2040];/* Battery-Backed SRAM */
|
||||
cma_mb_reg clk_ctl; /* Clock Control Register */
|
||||
cma_mb_reg clk_sec; /* Clock Seconds Register */
|
||||
cma_mb_reg clk_min; /* Clock Minutes Register */
|
||||
cma_mb_reg clk_hour; /* Clock Hour Register */
|
||||
cma_mb_reg clk_day; /* Clock Day Register */
|
||||
cma_mb_reg clk_date; /* Clock Date Register */
|
||||
cma_mb_reg clk_month; /* Clock Month Register */
|
||||
cma_mb_reg clk_year; /* Clock Year Register */
|
||||
}
|
||||
cma_mb_rtc;
|
||||
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SERPAR)
|
||||
|
||||
/* ST16C522 Serial I/O */
|
||||
typedef
|
||||
struct {
|
||||
cma_mb_reg ser_rhr; /* Receive Holding Register (R, DLAB=0) */
|
||||
cma_mb_reg ser_ier; /* Interrupt Enable Register (R/W, DLAB=0) */
|
||||
cma_mb_reg ser_isr; /* Interrupt Status Register (R) */
|
||||
cma_mb_reg ser_lcr; /* Line Control Register (R/W) */
|
||||
cma_mb_reg ser_mcr; /* Modem Control Register (R/W) */
|
||||
cma_mb_reg ser_lsr; /* Line Status Register (R) */
|
||||
cma_mb_reg ser_msr; /* Modem Status Register (R/W) */
|
||||
cma_mb_reg ser_spr; /* Scratch Pad Register (R/W) */
|
||||
}
|
||||
cma_mb_serial;
|
||||
|
||||
#define ser_thr ser_rhr /* Transmit Holding Register (W, DLAB=0) */
|
||||
#define ser_brl ser_rhr /* Baud Rate Divisor Low Byte (R/W, DLAB=1) */
|
||||
#define ser_brh ser_ier /* Baud Rate Divisor High Byte (R/W, DLAB=1) */
|
||||
#define ser_fcr ser_isr /* FIFO Control Register (W) */
|
||||
#define ser_nop ser_lsr /* No Operation (W) */
|
||||
|
||||
/* ST16C522 Parallel I/O */
|
||||
typedef
|
||||
struct {
|
||||
cma_mb_reg par_rdr; /* Port Read Data Register (R) */
|
||||
cma_mb_reg par_sr; /* Status Register (R) */
|
||||
cma_mb_reg par_cmd; /* Command Register (R) */
|
||||
}
|
||||
cma_mb_parallel;
|
||||
|
||||
#define par_wdr par_rdr /* Port Write Data Register (W) */
|
||||
#define par_ios par_sr /* I/O Select Register (W) */
|
||||
#define par_ctl par_cmd /* Control Register (W) */
|
||||
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_KBM) || defined(CONFIG_CMA302)
|
||||
|
||||
/* HT6542B PS/2 Keyboard/Mouse Controller */
|
||||
typedef
|
||||
struct {
|
||||
cma_mb_reg kbm_rdr; /* Read Data Register (R) */
|
||||
cma_mb_reg kbm_sr; /* Status Register (R) */
|
||||
}
|
||||
cma_mb_kbm;
|
||||
|
||||
#define kbm_wdr kbm_rdr /* Write Data Register (W) */
|
||||
#define kbm_cmd kbm_sr /* Command Register (W) */
|
||||
|
||||
#endif
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_LCD)
|
||||
|
||||
/* HD44780 LCD Display */
|
||||
typedef
|
||||
struct {
|
||||
cma_mb_reg lcd_ccr; /* Current Character Register (R/W) */
|
||||
cma_mb_reg lcd_bsr; /* Busy Status Register (R) */
|
||||
}
|
||||
cma_mb_lcd;
|
||||
|
||||
#define lcd_cmd lcd_bsr /* Command Register (W) */
|
||||
|
||||
#endif
|
||||
|
||||
/* 8-Position Configuration Switch */
|
||||
typedef
|
||||
struct {
|
||||
cma_mb_reg dip_val; /* Dip Switch value (R) */
|
||||
}
|
||||
cma_mb_dipsw;
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_PCI)
|
||||
|
||||
/* V360EPC PCI Bridge */
|
||||
typedef
|
||||
struct {
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
unsigned short v3_pci_vendor; /* 0x00 */
|
||||
unsigned short v3_pci_device;
|
||||
unsigned short v3_pci_cmd; /* 0x04 */
|
||||
unsigned short v3_pci_stat;
|
||||
unsigned long v3_pci_cc_rev; /* 0x08 */
|
||||
unsigned long v3_pci_hdr_cfg; /* 0x0c */
|
||||
unsigned long v3_pci_io_base; /* 0x10 */
|
||||
unsigned long v3_pci_base0; /* 0x14 */
|
||||
unsigned long v3_pci_base1; /* 0x18 */
|
||||
unsigned long reserved1[4]; /* 0x1c */
|
||||
unsigned short v3_pci_sub_vendor; /* 0x2c */
|
||||
unsigned short v3_pci_sub_id;
|
||||
unsigned long v3_pci_rom; /* 0x30 */
|
||||
unsigned long reserved2[2]; /* 0x34 */
|
||||
unsigned long v3_pci_bparam; /* 0x3c */
|
||||
unsigned long v3_pci_map0; /* 0x40 */
|
||||
unsigned long v3_pci_map1; /* 0x44 */
|
||||
unsigned long v3_pci_int_stat; /* 0x48 */
|
||||
unsigned long v3_pci_int_cfg; /* 0x4c */
|
||||
unsigned long reserved3[1]; /* 0x50 */
|
||||
unsigned long v3_lb_base0; /* 0x54 */
|
||||
unsigned long v3_lb_base1; /* 0x58 */
|
||||
unsigned short reserved4; /* 0x5c */
|
||||
unsigned short v3_lb_map0;
|
||||
unsigned short reserved5; /* 0x60 */
|
||||
unsigned short v3_lb_map1;
|
||||
unsigned short v3_lb_base2; /* 0x64 */
|
||||
unsigned short v3_lb_map2;
|
||||
unsigned long v3_lb_size; /* 0x68 */
|
||||
unsigned short reserved6; /* 0x6c */
|
||||
unsigned short v3_lb_io_base;
|
||||
unsigned short v3_fifo_cfg; /* 0x70 */
|
||||
unsigned short v3_fifo_priority;
|
||||
unsigned short v3_fifo_stat; /* 0x74 */
|
||||
unsigned char v3_lb_istat;
|
||||
unsigned char v3_lb_imask;
|
||||
unsigned short v3_system; /* 0x78 */
|
||||
unsigned short v3_lb_cfg;
|
||||
unsigned short v3_pci_cfg; /* 0x7c */
|
||||
unsigned short reserved7;
|
||||
unsigned long v3_dma_pci_addr0; /* 0x80 */
|
||||
unsigned long v3_dma_local_addr0; /* 0x84 */
|
||||
unsigned long v3_dma_length0:24; /* 0x88 */
|
||||
unsigned long v3_dma_csr0:8;
|
||||
unsigned long v3_dma_ctlb_adr0; /* 0x8c */
|
||||
unsigned long v3_dma_pci_addr1; /* 0x90 */
|
||||
unsigned long v3_dma_local_addr1; /* 0x94 */
|
||||
unsigned long v3_dma_length1:24; /* 0x98 */
|
||||
unsigned long v3_dma_csr1:8;
|
||||
unsigned long v3_dma_ctlb_adr1; /* 0x9c */
|
||||
unsigned long v3_i20_mups[8]; /* 0xa0 */
|
||||
unsigned char v3_mail_data0; /* 0xc0 */
|
||||
unsigned char v3_mail_data1;
|
||||
unsigned char v3_mail_data2;
|
||||
unsigned char v3_mail_data3;
|
||||
unsigned char v3_mail_data4; /* 0xc4 */
|
||||
unsigned char v3_mail_data5;
|
||||
unsigned char v3_mail_data6;
|
||||
unsigned char v3_mail_data7;
|
||||
unsigned char v3_mail_data8; /* 0xc8 */
|
||||
unsigned char v3_mail_data9;
|
||||
unsigned char v3_mail_data10;
|
||||
unsigned char v3_mail_data11;
|
||||
unsigned char v3_mail_data12; /* 0xcc */
|
||||
unsigned char v3_mail_data13;
|
||||
unsigned char v3_mail_data14;
|
||||
unsigned char v3_mail_data15;
|
||||
unsigned short v3_pci_mail_iewr; /* 0xd0 */
|
||||
unsigned short v3_pci_mail_ierd;
|
||||
unsigned short v3_lb_mail_iewr; /* 0xd4 */
|
||||
unsigned short v3_lb_mail_ierd;
|
||||
unsigned short v3_mail_wr_stat; /* 0xd8 */
|
||||
unsigned short v3_mail_rd_stat;
|
||||
unsigned long v3_qba_map; /* 0xdc */
|
||||
unsigned long v3_dma_delay:8; /* 0xe0 */
|
||||
unsigned long reserved8:24;
|
||||
unsigned long reserved9[7]; /* 0xe4 */
|
||||
#endif
|
||||
#if defined(__BIG_ENDIAN)
|
||||
unsigned short v3_pci_device; /* 0x00 */
|
||||
unsigned short v3_pci_vendor;
|
||||
unsigned short v3_pci_stat; /* 0x04 */
|
||||
unsigned short v3_pci_cmd;
|
||||
unsigned long v3_pci_cc_rev; /* 0x08 */
|
||||
unsigned long v3_pci_hdr_cfg; /* 0x0c */
|
||||
unsigned long v3_pci_io_base; /* 0x10 */
|
||||
unsigned long v3_pci_base0; /* 0x14 */
|
||||
unsigned long v3_pci_base1; /* 0x18 */
|
||||
unsigned long reserved1[4]; /* 0x1c */
|
||||
unsigned short v3_pci_sub_id; /* 0x2c */
|
||||
unsigned short v3_pci_sub_vendor;
|
||||
unsigned long v3_pci_rom; /* 0x30 */
|
||||
unsigned long reserved2[2]; /* 0x34 */
|
||||
unsigned long v3_pci_bparam; /* 0x3c */
|
||||
unsigned long v3_pci_map0; /* 0x40 */
|
||||
unsigned long v3_pci_map1; /* 0x44 */
|
||||
unsigned long v3_pci_int_stat; /* 0x48 */
|
||||
unsigned long v3_pci_int_cfg; /* 0x4c */
|
||||
unsigned long reserved3; /* 0x50 */
|
||||
unsigned long v3_lb_base0; /* 0x54 */
|
||||
unsigned long v3_lb_base1; /* 0x58 */
|
||||
unsigned short v3_lb_map0; /* 0x5c */
|
||||
unsigned short reserved4;
|
||||
unsigned short v3_lb_map1; /* 0x60 */
|
||||
unsigned short reserved5;
|
||||
unsigned short v3_lb_map2; /* 0x64 */
|
||||
unsigned short v3_lb_base2;
|
||||
unsigned long v3_lb_size; /* 0x68 */
|
||||
unsigned short v3_lb_io_base; /* 0x6c */
|
||||
unsigned short reserved6;
|
||||
unsigned short v3_fifo_priority; /* 0x70 */
|
||||
unsigned short v3_fifo_cfg;
|
||||
unsigned char v3_lb_imask; /* 0x74 */
|
||||
unsigned char v3_lb_istat;
|
||||
unsigned short v3_fifo_stat;
|
||||
unsigned short v3_lb_cfg; /* 0x78 */
|
||||
unsigned short v3_system;
|
||||
unsigned short reserved7; /* 0x7c */
|
||||
unsigned short v3_pci_cfg;
|
||||
unsigned long v3_dma_pci_addr0; /* 0x80 */
|
||||
unsigned long v3_dma_local_addr0; /* 0x84 */
|
||||
unsigned long v3_dma_csr0:8; /* 0x88 */
|
||||
unsigned long v3_dma_length0:24;
|
||||
unsigned long v3_dma_ctlb_adr0; /* 0x8c */
|
||||
unsigned long v3_dma_pci_addr1; /* 0x90 */
|
||||
unsigned long v3_dma_local_addr1; /* 0x94 */
|
||||
unsigned long v3_dma_csr1:8; /* 0x98 */
|
||||
unsigned long v3_dma_length1:24;
|
||||
unsigned long v3_dma_ctlb_adr1; /* 0x9c */
|
||||
unsigned long v3_i20_mups[8]; /* 0xa0 */
|
||||
unsigned char v3_mail_data3; /* 0xc0 */
|
||||
unsigned char v3_mail_data2;
|
||||
unsigned char v3_mail_data1;
|
||||
unsigned char v3_mail_data0;
|
||||
unsigned char v3_mail_data7; /* 0xc4 */
|
||||
unsigned char v3_mail_data6;
|
||||
unsigned char v3_mail_data5;
|
||||
unsigned char v3_mail_data4;
|
||||
unsigned char v3_mail_data11; /* 0xc8 */
|
||||
unsigned char v3_mail_data10;
|
||||
unsigned char v3_mail_data9;
|
||||
unsigned char v3_mail_data8;
|
||||
unsigned char v3_mail_data15; /* 0xcc */
|
||||
unsigned char v3_mail_data14;
|
||||
unsigned char v3_mail_data13;
|
||||
unsigned char v3_mail_data12;
|
||||
unsigned short v3_pci_mail_ierd; /* 0xd0 */
|
||||
unsigned short v3_pci_mail_iewr;
|
||||
unsigned short v3_lb_mail_ierd; /* 0xd4 */
|
||||
unsigned short v3_lb_mail_iewr;
|
||||
unsigned short v3_mail_rd_stat; /* 0xd8 */
|
||||
unsigned short v3_mail_wr_stat;
|
||||
unsigned long v3_qba_map; /* 0xdc */
|
||||
unsigned long reserved8:24; /* 0xe0 */
|
||||
unsigned long v3_dma_delay:8;
|
||||
unsigned long reserved9[7]; /* 0xe4 */
|
||||
#endif
|
||||
} /* 0x100 */
|
||||
cma_mb_v360epc;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* _COGENT_MB_H */
|
||||
3
board/cogent/par.c
Normal file
3
board/cogent/par.c
Normal file
@@ -0,0 +1,3 @@
|
||||
/* parallel not implemented yet */
|
||||
|
||||
int cma_parallel_not_implemented = 1;
|
||||
3
board/cogent/par.h
Normal file
3
board/cogent/par.h
Normal file
@@ -0,0 +1,3 @@
|
||||
/* parallel not implemented yet */
|
||||
|
||||
extern int cma_parallel_not_implemented;
|
||||
3
board/cogent/pci.c
Normal file
3
board/cogent/pci.c
Normal file
@@ -0,0 +1,3 @@
|
||||
/* pci not implemented yet */
|
||||
|
||||
int cma_pci_not_implemented = 1;
|
||||
3
board/cogent/pci.h
Normal file
3
board/cogent/pci.h
Normal file
@@ -0,0 +1,3 @@
|
||||
/* pci not implemented yet */
|
||||
|
||||
extern int cma_pci_not_implemented;
|
||||
3
board/cogent/rtc.c
Normal file
3
board/cogent/rtc.c
Normal file
@@ -0,0 +1,3 @@
|
||||
/* rtc not implemented yet */
|
||||
|
||||
int cma_rtc_not_implemented = 1;
|
||||
3
board/cogent/rtc.h
Normal file
3
board/cogent/rtc.h
Normal file
@@ -0,0 +1,3 @@
|
||||
/* rtc not implemented yet */
|
||||
|
||||
extern int cma_rtc_not_implemented;
|
||||
190
board/cogent/serial.c
Normal file
190
board/cogent/serial.c
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Simple serial driver for Cogent motherboard serial ports
|
||||
* for use during boot
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <board/cogent/serial.h>
|
||||
|
||||
#if (CMA_MB_CAPS & CMA_MB_CAP_SERPAR)
|
||||
|
||||
#if (defined(CONFIG_8xx) && defined(CONFIG_8xx_CONS_NONE)) || \
|
||||
(defined(CONFIG_8260) && defined(CONFIG_CONS_NONE))
|
||||
|
||||
#if CONFIG_CONS_INDEX == 1
|
||||
#define CMA_MB_SERIAL_BASE CMA_MB_SERIALA_BASE
|
||||
#elif CONFIG_CONS_INDEX == 2
|
||||
#define CMA_MB_SERIAL_BASE CMA_MB_SERIALB_BASE
|
||||
#elif CONFIG_CONS_INDEX == 3 && (CMA_MB_CAPS & CMA_MB_CAP_SER2)
|
||||
#define CMA_MB_SERIAL_BASE CMA_MB_SER2A_BASE
|
||||
#elif CONFIG_CONS_INDEX == 4 && (CMA_MB_CAPS & CMA_MB_CAP_SER2)
|
||||
#define CMA_MB_SERIAL_BASE CMA_MB_SER2B_BASE
|
||||
#else
|
||||
#error CONFIG_CONS_INDEX must be configured for Cogent motherboard serial
|
||||
#endif
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
/* DECLARE_GLOBAL_DATA_PTR; */
|
||||
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_SERIAL_BASE;
|
||||
|
||||
cma_mb_reg_write(&mbsp->ser_ier, 0x00); /* turn off interrupts */
|
||||
serial_setbrg ();
|
||||
cma_mb_reg_write(&mbsp->ser_lcr, 0x03); /* 8 data, 1 stop, no parity */
|
||||
cma_mb_reg_write(&mbsp->ser_mcr, 0x03); /* RTS/DTR */
|
||||
cma_mb_reg_write(&mbsp->ser_fcr, 0x07); /* Clear & enable FIFOs */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
serial_setbrg (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_SERIAL_BASE;
|
||||
unsigned int divisor;
|
||||
unsigned char lcr;
|
||||
|
||||
if ((divisor = br_to_div(gd->baudrate)) == 0)
|
||||
divisor = DEFDIV;
|
||||
|
||||
lcr = cma_mb_reg_read(&mbsp->ser_lcr);
|
||||
cma_mb_reg_write(&mbsp->ser_lcr, lcr|0x80);/* Access baud rate(set DLAB)*/
|
||||
cma_mb_reg_write(&mbsp->ser_brl, divisor & 0xff);
|
||||
cma_mb_reg_write(&mbsp->ser_brh, (divisor >> 8) & 0xff);
|
||||
cma_mb_reg_write(&mbsp->ser_lcr, lcr); /* unset DLAB */
|
||||
}
|
||||
|
||||
void
|
||||
serial_putc(const char c)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_SERIAL_BASE;
|
||||
|
||||
if (c == '\n')
|
||||
serial_putc('\r');
|
||||
|
||||
while ((cma_mb_reg_read(&mbsp->ser_lsr) & LSR_THRE) == 0)
|
||||
;
|
||||
|
||||
cma_mb_reg_write(&mbsp->ser_thr, c);
|
||||
}
|
||||
|
||||
void
|
||||
serial_puts(const char *s)
|
||||
{
|
||||
while (*s != '\0')
|
||||
serial_putc(*s++);
|
||||
}
|
||||
|
||||
int
|
||||
serial_getc(void)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_SERIAL_BASE;
|
||||
|
||||
while ((cma_mb_reg_read(&mbsp->ser_lsr) & LSR_DR) == 0)
|
||||
;
|
||||
|
||||
return ((int)cma_mb_reg_read(&mbsp->ser_rhr) & 0x7f);
|
||||
}
|
||||
|
||||
int
|
||||
serial_tstc(void)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_SERIAL_BASE;
|
||||
|
||||
return ((cma_mb_reg_read(&mbsp->ser_lsr) & LSR_DR) != 0);
|
||||
}
|
||||
|
||||
#endif /* CONS_NONE */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB) && \
|
||||
defined(CONFIG_KGDB_NONE)
|
||||
|
||||
#if CONFIG_KGDB_INDEX == CONFIG_CONS_INDEX
|
||||
#error Console and kgdb are on the same serial port - this is not supported
|
||||
#endif
|
||||
|
||||
#if CONFIG_KGDB_INDEX == 1
|
||||
#define CMA_MB_KGDB_SER_BASE CMA_MB_SERIALA_BASE
|
||||
#elif CONFIG_KGDB_INDEX == 2
|
||||
#define CMA_MB_KGDB_SER_BASE CMA_MB_SERIALB_BASE
|
||||
#elif CONFIG_KGDB_INDEX == 3 && (CMA_MB_CAPS & CMA_MB_CAP_SER2)
|
||||
#define CMA_MB_KGDB_SER_BASE CMA_MB_SER2A_BASE
|
||||
#elif CONFIG_KGDB_INDEX == 4 && (CMA_MB_CAPS & CMA_MB_CAP_SER2)
|
||||
#define CMA_MB_KGDB_SER_BASE CMA_MB_SER2B_BASE
|
||||
#else
|
||||
#error CONFIG_KGDB_INDEX must be configured for Cogent motherboard serial
|
||||
#endif
|
||||
|
||||
void
|
||||
kgdb_serial_init(void)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_KGDB_SER_BASE;
|
||||
unsigned int divisor;
|
||||
|
||||
if ((divisor = br_to_div(CONFIG_KGDB_BAUDRATE)) == 0)
|
||||
divisor = DEFDIV;
|
||||
|
||||
cma_mb_reg_write(&mbsp->ser_ier, 0x00); /* turn off interrupts */
|
||||
cma_mb_reg_write(&mbsp->ser_lcr, 0x80); /* Access baud rate(set DLAB)*/
|
||||
cma_mb_reg_write(&mbsp->ser_brl, divisor & 0xff);
|
||||
cma_mb_reg_write(&mbsp->ser_brh, (divisor >> 8) & 0xff);
|
||||
cma_mb_reg_write(&mbsp->ser_lcr, 0x03); /* 8 data, 1 stop, no parity */
|
||||
cma_mb_reg_write(&mbsp->ser_mcr, 0x03); /* RTS/DTR */
|
||||
cma_mb_reg_write(&mbsp->ser_fcr, 0x07); /* Clear & enable FIFOs */
|
||||
|
||||
printf("[on cma10x serial port B] ");
|
||||
}
|
||||
|
||||
void
|
||||
putDebugChar(int c)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_KGDB_SER_BASE;
|
||||
|
||||
while ((cma_mb_reg_read(&mbsp->ser_lsr) & LSR_THRE) == 0)
|
||||
;
|
||||
|
||||
cma_mb_reg_write(&mbsp->ser_thr, c & 0xff);
|
||||
}
|
||||
|
||||
void
|
||||
putDebugStr(const char *str)
|
||||
{
|
||||
while (*str != '\0') {
|
||||
if (*str == '\n')
|
||||
putDebugChar('\r');
|
||||
putDebugChar(*str++);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
getDebugChar(void)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_KGDB_SER_BASE;
|
||||
|
||||
while ((cma_mb_reg_read(&mbsp->ser_lsr) & LSR_DR) == 0)
|
||||
;
|
||||
|
||||
return ((int)cma_mb_reg_read(&mbsp->ser_rhr) & 0x7f);
|
||||
}
|
||||
|
||||
void
|
||||
kgdb_interruptible(int yes)
|
||||
{
|
||||
cma_mb_serial *mbsp = (cma_mb_serial *)CMA_MB_KGDB_SER_BASE;
|
||||
|
||||
if (yes == 1) {
|
||||
printf("kgdb: turning serial ints on\n");
|
||||
cma_mb_reg_write(&mbsp->ser_ier, 0xf);
|
||||
}
|
||||
else {
|
||||
printf("kgdb: turning serial ints off\n");
|
||||
cma_mb_reg_write(&mbsp->ser_ier, 0x0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* KGDB && KGDB_NONE */
|
||||
|
||||
#endif /* CAPS & SERPAR */
|
||||
15
board/cogent/serial.h
Normal file
15
board/cogent/serial.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/* Line Status Register bits */
|
||||
#define LSR_DR 0x01 /* Data ready */
|
||||
#define LSR_OE 0x02 /* Overrun */
|
||||
#define LSR_PE 0x04 /* Parity error */
|
||||
#define LSR_FE 0x08 /* Framing error */
|
||||
#define LSR_BI 0x10 /* Break */
|
||||
#define LSR_THRE 0x20 /* Xmit holding register empty */
|
||||
#define LSR_TEMT 0x40 /* Xmitter empty */
|
||||
#define LSR_ERR 0x80 /* Error */
|
||||
|
||||
#define CLKRATE 3686400 /* cogent motherboard serial clk = 3.6864MHz */
|
||||
#define DEFDIV 1 /* default to 230400 bps */
|
||||
|
||||
#define br_to_div(br) (CLKRATE / (16 * (br)))
|
||||
#define div_to_br(div) (CLKRATE / (16 * (div)))
|
||||
121
board/cogent/u-boot.lds
Normal file
121
board/cogent/u-boot.lds
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
common/environment.o(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
131
board/cogent/u-boot.lds.debug
Normal file
131
board/cogent/u-boot.lds.debug
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
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 = .);
|
||||
|
||||
__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/cpu86/Makefile
Normal file
40
board/cpu86/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
40
board/cpu86/config.mk
Normal file
40
board/cpu86/config.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# CPU86 boards
|
||||
#
|
||||
|
||||
# This should be equal to the CFG_FLASH_BASE define in config_CPU86.h
|
||||
# for the "final" configuration, with U-Boot in flash, or the address
|
||||
# in RAM where U-Boot is loaded at for debugging.
|
||||
#
|
||||
|
||||
ifeq ($(CONFIG_BOOT_ROM),y)
|
||||
TEXT_BASE := 0xFF800000
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_BOOT_ROM
|
||||
else
|
||||
TEXT_BASE := 0xFF000000
|
||||
endif
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)
|
||||
354
board/cpu86/cpu86.c
Normal file
354
board/cpu86/cpu86.c
Normal file
@@ -0,0 +1,354 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ioports.h>
|
||||
#include <mpc8260.h>
|
||||
#include "cpu86.h"
|
||||
|
||||
/*
|
||||
* I/O Port configuration table
|
||||
*
|
||||
* if conf is 1, then that port pin will be configured at boot time
|
||||
* according to the five values podr/pdir/ppar/psor/pdat for that entry
|
||||
*/
|
||||
|
||||
const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port A configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII COL */
|
||||
/* PA30 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII CRS */
|
||||
/* PA29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_ER */
|
||||
/* PA28 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_EN */
|
||||
/* PA27 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_DV */
|
||||
/* PA26 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_ER */
|
||||
/* PA25 */ { 1, 0, 0, 1, 0, 0 }, /* FCC2 MII MDIO */
|
||||
/* PA24 */ { 1, 0, 0, 1, 0, 0 }, /* FCC2 MII MDC */
|
||||
/* PA23 */ { 1, 0, 0, 1, 0, 0 }, /* FCC1 MII MDIO */
|
||||
/* PA22 */ { 1, 0, 0, 1, 0, 0 }, /* FCC1 MII MDC */
|
||||
/* PA21 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[3] */
|
||||
/* PA20 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[2] */
|
||||
/* PA19 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[1] */
|
||||
/* PA18 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[0] */
|
||||
/* PA17 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[0] */
|
||||
/* PA16 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[1] */
|
||||
/* PA15 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[2] */
|
||||
/* PA14 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[3] */
|
||||
/* PA13 */ { 1, 0, 0, 1, 0, 0 }, /* FCC2 MII TXSL1 */
|
||||
/* PA12 */ { 1, 0, 0, 1, 0, 1 }, /* FCC2 MII TXSL0 */
|
||||
/* PA11 */ { 1, 0, 0, 1, 0, 0 }, /* FCC1 MII TXSL1 */
|
||||
/* PA10 */ { 1, 0, 0, 1, 0, 1 }, /* FCC1 MII TXSL0 */
|
||||
/* PA9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC2 TXD */
|
||||
/* PA8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC2 RXD */
|
||||
/* PA7 */ { 0, 0, 0, 0, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 1, 0, 0, 1, 0, 1 }, /* FCC2 MII PAUSE */
|
||||
/* PA5 */ { 1, 0, 0, 1, 0, 1 }, /* FCC1 MII PAUSE */
|
||||
/* PA4 */ { 1, 0, 0, 1, 0, 0 }, /* FCC2 MII PWRDN */
|
||||
/* PA3 */ { 1, 0, 0, 1, 0, 0 }, /* FCC1 MII PWRDN */
|
||||
/* PA2 */ { 0, 0, 0, 0, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FCC2 MII MDINT */
|
||||
/* PA0 */ { 1, 0, 0, 1, 0, 0 } /* FCC1 MII MDINT */
|
||||
},
|
||||
|
||||
/* 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, 0, 0, 0, 0, 0 }, /* PB17 */
|
||||
/* PB16 */ { 0, 0, 0, 0, 0, 0 }, /* PB16 */
|
||||
/* PB15 */ { 0, 0, 0, 0, 0, 0 }, /* PB15 */
|
||||
/* PB14 */ { 0, 0, 0, 0, 0, 0 }, /* PB14 */
|
||||
/* PB13 */ { 0, 0, 0, 0, 0, 0 }, /* PB13 */
|
||||
/* PB12 */ { 0, 0, 0, 0, 0, 0 }, /* PB12 */
|
||||
/* PB11 */ { 0, 0, 0, 0, 0, 0 }, /* PB11 */
|
||||
/* PB10 */ { 0, 0, 0, 0, 0, 0 }, /* PB10 */
|
||||
/* PB9 */ { 0, 0, 0, 0, 0, 0 }, /* PB9 */
|
||||
/* PB8 */ { 0, 0, 0, 0, 0, 0 }, /* PB8 */
|
||||
/* PB7 */ { 0, 0, 0, 0, 0, 0 }, /* PB7 */
|
||||
/* PB6 */ { 0, 0, 0, 0, 0, 0 }, /* PB6 */
|
||||
/* PB5 */ { 0, 0, 0, 0, 0, 0 }, /* PB5 */
|
||||
/* PB4 */ { 0, 0, 0, 0, 0, 0 }, /* PB4 */
|
||||
/* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* PB3 */
|
||||
/* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* PB2 */
|
||||
/* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* PB1 */
|
||||
/* PB0 */ { 0, 0, 0, 0, 0, 0 } /* PB0 */
|
||||
},
|
||||
|
||||
/* Port C */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 0, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 1, 0, 0, 0, 0, 0 }, /* SCC1 CTS */
|
||||
/* PC28 */ { 1, 0, 0, 0, 0, 0 }, /* SCC2 CTS */
|
||||
/* 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 }, /* FDC37C78 DACFD */
|
||||
/* PC22 */ { 0, 0, 0, 0, 0, 0 }, /* FDC37C78 DNFD */
|
||||
/* PC21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RX_CLK */
|
||||
/* PC20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII TX_CLK */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII TX_CLK */
|
||||
/* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */
|
||||
/* 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 */
|
||||
/* PC10 */ { 0, 0, 0, 0, 0, 0 }, /* PC10 */
|
||||
/* PC9 */ { 0, 0, 0, 0, 0, 0 }, /* FC9 */
|
||||
/* 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 }, /* FDC37C78 DRQFD */
|
||||
},
|
||||
|
||||
/* Port D */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 RXD */
|
||||
/* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 TXD */
|
||||
/* PD29 */ { 1, 0, 0, 1, 0, 0 }, /* SCC1 RTS */
|
||||
/* PD28 */ { 1, 1, 0, 0, 0, 0 }, /* SCC2 RXD */
|
||||
/* PD27 */ { 1, 1, 0, 1, 0, 0 }, /* SCC2 TXD */
|
||||
/* PD26 */ { 1, 0, 0, 1, 0, 0 }, /* SCC2 RTS */
|
||||
/* PD25 */ { 0, 0, 0, 0, 0, 0 }, /* PD25 */
|
||||
/* PD24 */ { 0, 0, 0, 0, 0, 0 }, /* PD24 */
|
||||
/* PD23 */ { 0, 0, 0, 0, 0, 0 }, /* PD23 */
|
||||
/* PD22 */ { 0, 0, 0, 0, 0, 0 }, /* PD22 */
|
||||
/* PD21 */ { 0, 0, 0, 0, 0, 0 }, /* PD21 */
|
||||
/* PD20 */ { 0, 0, 0, 0, 0, 0 }, /* PD20 */
|
||||
/* PD19 */ { 0, 0, 0, 0, 0, 0 }, /* PD19 */
|
||||
/* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */
|
||||
/* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */
|
||||
/* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */
|
||||
#if defined(CONFIG_SOFT_I2C)
|
||||
/* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */
|
||||
#else
|
||||
#if defined(CONFIG_HARD_I2C)
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
|
||||
#else /* normal I/O port pins */
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
|
||||
#endif
|
||||
#endif
|
||||
/* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
|
||||
/* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
|
||||
/* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
|
||||
/* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
|
||||
/* PD9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD7 */ { 0, 0, 0, 0, 0, 0 }, /* PD7 */
|
||||
/* PD6 */ { 0, 0, 0, 0, 0, 0 }, /* PD6 */
|
||||
/* PD5 */ { 0, 0, 0, 0, 0, 0 }, /* PD5 */
|
||||
/* PD4 */ { 0, 0, 0, 0, 0, 0 }, /* PD4 */
|
||||
/* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* PD3 */
|
||||
/* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* PD2 */
|
||||
/* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* PD1 */
|
||||
/* PD0 */ { 0, 0, 0, 0, 0, 0 } /* PD0 */
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Check Board Identity:
|
||||
*/
|
||||
int checkboard (void)
|
||||
{
|
||||
printf ("Board: CPU86 (Rev %02x)\n", CPU86_REV);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
|
||||
*
|
||||
* This routine performs standard 8260 initialization sequence
|
||||
* and calculates the available memory size. It may be called
|
||||
* several times to try different SDRAM configurations on both
|
||||
* 60x and local buses.
|
||||
*/
|
||||
static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
|
||||
ulong orx, volatile uchar * base)
|
||||
{
|
||||
volatile uchar c = 0xff;
|
||||
ulong cnt, val;
|
||||
volatile ulong *addr;
|
||||
volatile uint *sdmr_ptr;
|
||||
volatile uint *orx_ptr;
|
||||
int i;
|
||||
ulong save[32]; /* to make test non-destructive */
|
||||
ulong maxsize;
|
||||
|
||||
/* We must be able to test a location outsize the maximum legal size
|
||||
* to find out THAT we are outside; but this address still has to be
|
||||
* mapped by the controller. That means, that the initial mapping has
|
||||
* to be (at least) twice as large as the maximum expected size.
|
||||
*/
|
||||
maxsize = (1 + (~orx | 0x7fff)) / 2;
|
||||
|
||||
/* Since CFG_SDRAM_BASE is always 0 (??), we assume that
|
||||
* we are configuring CS1 if base != 0
|
||||
*/
|
||||
sdmr_ptr = &memctl->memc_psdmr;
|
||||
orx_ptr = &memctl->memc_or2;
|
||||
|
||||
*orx_ptr = orx;
|
||||
|
||||
/*
|
||||
* Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
|
||||
*
|
||||
* "At system reset, initialization software must set up the
|
||||
* programmable parameters in the memory controller banks registers
|
||||
* (ORx, BRx, P/LSDMR). After all memory parameters are configured,
|
||||
* system software should execute the following initialization sequence
|
||||
* for each SDRAM device.
|
||||
*
|
||||
* 1. Issue a PRECHARGE-ALL-BANKS command
|
||||
* 2. Issue eight CBR REFRESH commands
|
||||
* 3. Issue a MODE-SET command to initialize the mode register
|
||||
*
|
||||
* The initial commands are executed by setting P/LSDMR[OP] and
|
||||
* accessing the SDRAM with a single-byte transaction."
|
||||
*
|
||||
* The appropriate BRx/ORx registers have already been set when we
|
||||
* get here. The SDRAM can be accessed at the address CFG_SDRAM_BASE.
|
||||
*/
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_PREA;
|
||||
*base = c;
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_CBRR;
|
||||
for (i = 0; i < 8; i++)
|
||||
*base = c;
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_MRW;
|
||||
*(base + CFG_MRS_OFFS) = c; /* setting MR on address lines */
|
||||
|
||||
*sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
|
||||
*base = c;
|
||||
|
||||
/*
|
||||
* Check memory range for valid RAM. A simple memory test determines
|
||||
* the actually available RAM size between addresses `base' and
|
||||
* `base + maxsize'. Some (not all) hardware errors are detected:
|
||||
* - short between address lines
|
||||
* - short between data lines
|
||||
*/
|
||||
i = 0;
|
||||
for (cnt = maxsize / sizeof (long); cnt > 0; cnt >>= 1) {
|
||||
addr = (volatile ulong *) base + cnt; /* pointer arith! */
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
addr = (volatile ulong *) base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
if ((val = *addr) != 0) {
|
||||
*addr = save[i];
|
||||
return (0);
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt <= maxsize / sizeof (long); cnt <<= 1) {
|
||||
addr = (volatile ulong *) base + cnt; /* pointer arith! */
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
if (val != ~cnt) {
|
||||
/* Write the actual size to ORx
|
||||
*/
|
||||
*orx_ptr = orx | ~(cnt * sizeof (long) - 1);
|
||||
return (cnt * sizeof (long));
|
||||
}
|
||||
}
|
||||
return (maxsize);
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong size8, size9;
|
||||
#endif
|
||||
long psize;
|
||||
|
||||
psize = 32 * 1024 * 1024;
|
||||
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
memctl->memc_psrt = CFG_PSRT;
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
/* 60x SDRAM setup:
|
||||
*/
|
||||
size8 = try_init (memctl, CFG_PSDMR_8COL, CFG_OR2_8COL,
|
||||
(uchar *) CFG_SDRAM_BASE);
|
||||
size9 = try_init (memctl, CFG_PSDMR_9COL, CFG_OR2_9COL,
|
||||
(uchar *) CFG_SDRAM_BASE);
|
||||
|
||||
if (size8 < size9) {
|
||||
psize = size9;
|
||||
printf ("(60x:9COL) ");
|
||||
} else {
|
||||
psize = try_init (memctl, CFG_PSDMR_8COL, CFG_OR2_8COL,
|
||||
(uchar *) CFG_SDRAM_BASE);
|
||||
printf ("(60x:8COL) ");
|
||||
}
|
||||
|
||||
#endif /* CFG_RAMBOOT */
|
||||
|
||||
icache_enable ();
|
||||
|
||||
return (psize);
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_DOC)
|
||||
extern void doc_probe (ulong physadr);
|
||||
void doc_init (void)
|
||||
{
|
||||
doc_probe (CFG_DOC_BASE);
|
||||
}
|
||||
#endif
|
||||
27
board/cpu86/cpu86.h
Normal file
27
board/cpu86/cpu86.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __BOARD_CPU86__
|
||||
#define __BOARD_CPU86__
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#define REG8(x) (*(volatile unsigned char *)(x))
|
||||
|
||||
/* CPU86 register definitions */
|
||||
#define CPU86_VME_EAC REG8(CFG_BCRS_BASE + 0x00)
|
||||
#define CPU86_VME_SAC REG8(CFG_BCRS_BASE + 0x01)
|
||||
#define CPU86_VME_MAC REG8(CFG_BCRS_BASE + 0x02)
|
||||
#define CPU86_BCR REG8(CFG_BCRS_BASE + 0x03)
|
||||
#define CPU86_BSR REG8(CFG_BCRS_BASE + 0x04)
|
||||
#define CPU86_WDOG_RPORT REG8(CFG_BCRS_BASE + 0x05)
|
||||
#define CPU86_MBOX_IRQ REG8(CFG_BCRS_BASE + 0x04)
|
||||
#define CPU86_REV REG8(CFG_BCRS_BASE + 0x07)
|
||||
#define CPU86_VME_IRQMASK REG8(CFG_BCRS_BASE + 0x80)
|
||||
#define CPU86_VME_IRQSTATUS REG8(CFG_BCRS_BASE + 0x81)
|
||||
#define CPU86_LOCAL_IRQMASK REG8(CFG_BCRS_BASE + 0x82)
|
||||
#define CPU86_LOCAL_IRQSTATUS REG8(CFG_BCRS_BASE + 0x83)
|
||||
#define CPU86_PMCL_IRQSTATUS REG8(CFG_BCRS_BASE + 0x84)
|
||||
|
||||
/* Board Control Register bits */
|
||||
#define CPU86_BCR_FWPT 0x01
|
||||
#define CPU86_BCR_FWRE 0x02
|
||||
|
||||
#endif /* __BOARD_CPU86__ */
|
||||
615
board/cpu86/flash.c
Normal file
615
board/cpu86/flash.c
Normal file
@@ -0,0 +1,615 @@
|
||||
/*
|
||||
* (C) Copyright 2001, 2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* Flash Routines for Intel devices
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
#include "cpu86.h"
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
ulong flash_int_get_size (volatile unsigned long *baseaddr,
|
||||
flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
unsigned long flashtest_h, flashtest_l;
|
||||
|
||||
info->sector_count = info->size = 0;
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* Write query command sequence and test FLASH answer
|
||||
*/
|
||||
baseaddr[0] = 0x00980098;
|
||||
baseaddr[1] = 0x00980098;
|
||||
|
||||
flashtest_h = baseaddr[0]; /* manufacturer ID */
|
||||
flashtest_l = baseaddr[1];
|
||||
|
||||
if (flashtest_h != INTEL_MANUFACT || flashtest_l != INTEL_MANUFACT)
|
||||
return (0); /* no or unknown flash */
|
||||
|
||||
flashtest_h = baseaddr[2]; /* device ID */
|
||||
flashtest_l = baseaddr[3];
|
||||
|
||||
if (flashtest_h != flashtest_l)
|
||||
return (0);
|
||||
|
||||
switch (flashtest_h) {
|
||||
case INTEL_ID_28F160C3B:
|
||||
info->flash_id = FLASH_28F160C3B;
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00800000; /* 4 * 2 MB = 8 MB */
|
||||
break;
|
||||
case INTEL_ID_28F160F3B:
|
||||
info->flash_id = FLASH_28F160F3B;
|
||||
info->sector_count = 39;
|
||||
info->size = 0x00800000; /* 4 * 2 MB = 8 MB */
|
||||
break;
|
||||
default:
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
info->flash_id |= INTEL_MANUFACT << 16; /* set manufacturer offset */
|
||||
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
volatile unsigned long *tmp = baseaddr;
|
||||
|
||||
/* set up sector start adress table (bottom sector type)
|
||||
* AND unlock the sectors (if our chip is 160C3)
|
||||
*/
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if ((info->flash_id & FLASH_TYPEMASK) == FLASH_28F160C3B) {
|
||||
tmp[0] = 0x00600060;
|
||||
tmp[1] = 0x00600060;
|
||||
tmp[0] = 0x00D000D0;
|
||||
tmp[1] = 0x00D000D0;
|
||||
}
|
||||
info->start[i] = (uint) tmp;
|
||||
tmp += i < 8 ? 0x2000 : 0x10000; /* pointer arith */
|
||||
}
|
||||
}
|
||||
|
||||
memset (info->protect, 0, info->sector_count);
|
||||
|
||||
baseaddr[0] = 0x00FF00FF;
|
||||
baseaddr[1] = 0x00FF00FF;
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
static ulong flash_amd_get_size (vu_char *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
uchar vendor, devid;
|
||||
ulong base = (ulong)addr;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x0555] = 0xAA;
|
||||
addr[0x02AA] = 0x55;
|
||||
addr[0x0555] = 0x90;
|
||||
|
||||
udelay(1000);
|
||||
|
||||
vendor = addr[0];
|
||||
devid = addr[1] & 0xff;
|
||||
|
||||
/* only support AMD */
|
||||
if (vendor != 0x01) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
vendor &= 0xf;
|
||||
devid &= 0xff;
|
||||
|
||||
if (devid == AMD_ID_F040B) {
|
||||
info->flash_id = vendor << 16 | devid;
|
||||
info->sector_count = 8;
|
||||
info->size = info->sector_count * 0x10000;
|
||||
}
|
||||
else if (devid == AMD_ID_F080B) {
|
||||
info->flash_id = vendor << 16 | devid;
|
||||
info->sector_count = 16;
|
||||
info->size = 4 * info->sector_count * 0x10000;
|
||||
}
|
||||
else if (devid == AMD_ID_F016D) {
|
||||
info->flash_id = vendor << 16 | devid;
|
||||
info->sector_count = 32;
|
||||
info->size = 4 * info->sector_count * 0x10000;
|
||||
}
|
||||
else {
|
||||
printf ("## Unknown Flash Type: %02x\n", devid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* sector base address */
|
||||
info->start[i] = base + i * (info->size / info->sector_count);
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr = (volatile unsigned char *)(info->start[i]);
|
||||
info->protect[i] = addr[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (vu_char *)info->start[0];
|
||||
addr[0] = 0xF0; /* reset bank */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0 = 0;
|
||||
unsigned long size_b1 = 0;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known
|
||||
*/
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Disable flash protection */
|
||||
CPU86_BCR |= (CPU86_BCR_FWPT | CPU86_BCR_FWRE);
|
||||
|
||||
/* Static FLASH Bank configuration here (only one bank) */
|
||||
|
||||
size_b0 = flash_int_get_size ((ulong *) CFG_FLASH_BASE, &flash_info[0]);
|
||||
size_b1 = flash_amd_get_size ((uchar *) CFG_BOOTROM_BASE, &flash_info[1]);
|
||||
|
||||
if (size_b0 > 0 || size_b1 > 0) {
|
||||
|
||||
printf("(");
|
||||
|
||||
if (size_b0 > 0) {
|
||||
puts ("Bank#1 - ");
|
||||
print_size (size_b0, (size_b1 > 0) ? ", " : ") ");
|
||||
}
|
||||
|
||||
if (size_b1 > 0) {
|
||||
puts ("Bank#2 - ");
|
||||
print_size (size_b1, ") ");
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf ("## No FLASH found.\n");
|
||||
return 0;
|
||||
}
|
||||
/* protect monitor and environment sectors
|
||||
*/
|
||||
|
||||
#if CFG_MONITOR_BASE >= CFG_BOOTROM_BASE
|
||||
if (size_b1) {
|
||||
/* If U-Boot is booted from ROM the CFG_MONITOR_BASE > CFG_FLASH_BASE
|
||||
* but we shouldn't protect it.
|
||||
*/
|
||||
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1, &flash_info[1]
|
||||
);
|
||||
}
|
||||
#else
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1, &flash_info[0]
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# if CFG_ENV_ADDR >= CFG_BOOTROM_BASE
|
||||
if (size_b1) {
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[1]);
|
||||
}
|
||||
# else
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return (size_b0 + size_b1);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((info->flash_id >> 16) & 0xff) {
|
||||
case 0x89:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
case 0x1:
|
||||
printf ("AMD ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F160C3B:
|
||||
printf ("28F160C3B (16 Mbit, bottom sector)\n");
|
||||
break;
|
||||
case FLASH_28F160F3B:
|
||||
printf ("28F160F3B (16 Mbit, bottom sector)\n");
|
||||
break;
|
||||
case AMD_ID_F040B:
|
||||
printf ("AM29F040B (4 Mbit)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->size < 0x100000)
|
||||
printf (" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
else
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
/* Check the type of erased flash
|
||||
*/
|
||||
if (info->flash_id >> 16 == 0x1) {
|
||||
/* Erase AMD flash
|
||||
*/
|
||||
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;
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
/* 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 AMD_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 */
|
||||
serial_putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
AMD_DONE:
|
||||
/* reset to read mode */
|
||||
addr = (volatile unsigned char *)info->start[0];
|
||||
addr[0] = 0xF0; /* reset bank */
|
||||
|
||||
} else {
|
||||
/* Erase Intel flash
|
||||
*/
|
||||
|
||||
/* Start erase on unprotected sectors
|
||||
*/
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
volatile ulong *addr =
|
||||
(volatile unsigned long *) info->start[sect];
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
if (info->protect[sect] == 0) {
|
||||
/* Disable interrupts which might cause a timeout here
|
||||
*/
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Erase the block
|
||||
*/
|
||||
addr[0] = 0x00200020;
|
||||
addr[1] = 0x00200020;
|
||||
addr[0] = 0x00D000D0;
|
||||
addr[1] = 0x00D000D0;
|
||||
|
||||
/* re-enable interrupts if necessary
|
||||
*/
|
||||
if (flag)
|
||||
enable_interrupts ();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms
|
||||
*/
|
||||
udelay (1000);
|
||||
|
||||
last = start;
|
||||
while ((addr[0] & 0x00800080) != 0x00800080 ||
|
||||
(addr[1] & 0x00800080) != 0x00800080) {
|
||||
if ((now = get_timer (start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout (erase suspended!)\n");
|
||||
/* Suspend erase
|
||||
*/
|
||||
addr[0] = 0x00B000B0;
|
||||
addr[1] = 0x00B000B0;
|
||||
goto DONE;
|
||||
}
|
||||
/* show that we're waiting
|
||||
*/
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
serial_putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
if (addr[0] & 0x00220022 || addr[1] & 0x00220022) {
|
||||
printf ("*** ERROR: erase failed!\n");
|
||||
goto DONE;
|
||||
}
|
||||
}
|
||||
/* Clear status register and reset to read mode
|
||||
*/
|
||||
addr[0] = 0x00500050;
|
||||
addr[1] = 0x00500050;
|
||||
addr[0] = 0x00FF00FF;
|
||||
addr[1] = 0x00FF00FF;
|
||||
}
|
||||
}
|
||||
|
||||
printf (" done\n");
|
||||
|
||||
DONE:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_word (flash_info_t *, volatile unsigned long *, ulong);
|
||||
static int write_byte (flash_info_t *info, ulong dest, uchar data);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong v;
|
||||
int i, l, rc, cc = cnt, res = 0;
|
||||
|
||||
if (info->flash_id >> 16 == 0x1) {
|
||||
|
||||
/* Write to AMD 8-bit flash
|
||||
*/
|
||||
while (cnt > 0) {
|
||||
if ((rc = write_byte(info, addr, *src)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
addr++;
|
||||
src++;
|
||||
cnt--;
|
||||
}
|
||||
|
||||
return (0);
|
||||
} else {
|
||||
|
||||
/* Write to Intel 64-bit flash
|
||||
*/
|
||||
for (v=0; cc > 0; addr += 4, cc -= 4 - l) {
|
||||
l = (addr & 3);
|
||||
addr &= ~3;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
v = (v << 8) + (i < l || i - l >= cc ?
|
||||
*((unsigned char *) addr + i) : *src++);
|
||||
}
|
||||
|
||||
if ((res = write_word (info, (volatile unsigned long *) addr, v)) != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word (flash_info_t * info, volatile unsigned long *addr,
|
||||
ulong data)
|
||||
{
|
||||
int flag, res = 0;
|
||||
ulong start;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased
|
||||
*/
|
||||
if ((*addr & data) != data)
|
||||
return (2);
|
||||
|
||||
/* Disable interrupts which might cause a timeout here
|
||||
*/
|
||||
flag = disable_interrupts ();
|
||||
|
||||
*addr = 0x00400040;
|
||||
*addr = data;
|
||||
|
||||
/* re-enable interrupts if necessary
|
||||
*/
|
||||
if (flag)
|
||||
enable_interrupts ();
|
||||
|
||||
start = get_timer (0);
|
||||
while ((*addr & 0x00800080) != 0x00800080) {
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
/* Suspend program
|
||||
*/
|
||||
*addr = 0x00B000B0;
|
||||
res = 1;
|
||||
goto OUT;
|
||||
}
|
||||
}
|
||||
|
||||
if (*addr & 0x00220022) {
|
||||
printf ("*** ERROR: program failed!\n");
|
||||
res = 1;
|
||||
}
|
||||
|
||||
OUT:
|
||||
/* Clear status register and reset to read mode
|
||||
*/
|
||||
*addr = 0x00500050;
|
||||
*addr = 0x00FF00FF;
|
||||
|
||||
return (res);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a byte 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);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
118
board/cpu86/u-boot.lds
Normal file
118
board/cpu86/u-boot.lds
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
cpu/mpc8260/start.o (.text)
|
||||
*(.text)
|
||||
common/environment.o(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
47
board/cradle/Makefile
Normal file
47
board/cradle/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000, 2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := cradle.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
3
board/cradle/config.mk
Normal file
3
board/cradle/config.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
TEXT_BASE = 0xa0f08000
|
||||
#TEXT_BASE = 0
|
||||
|
||||
227
board/cradle/cradle.c
Normal file
227
board/cradle/cradle.c
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
#include <common.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* local prototypes */
|
||||
void set_led (int led, int color);
|
||||
void error_code_halt (int code);
|
||||
int init_sio (int led, unsigned long base);
|
||||
inline void cradle_outb (unsigned short val, unsigned long base,
|
||||
unsigned long reg);
|
||||
inline unsigned char cradle_inb (unsigned long base, unsigned long reg);
|
||||
inline void sleep (int i);
|
||||
|
||||
inline void
|
||||
/**********************************************************/
|
||||
sleep (int i)
|
||||
/**********************************************************/
|
||||
{
|
||||
while (i--) {
|
||||
udelay (1000000);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
/**********************************************************/
|
||||
error_code_halt (int code)
|
||||
/**********************************************************/
|
||||
{
|
||||
while (1) {
|
||||
led_code (code, RED);
|
||||
sleep (1);
|
||||
led_code (0, OFF);
|
||||
sleep (1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
/**********************************************************/
|
||||
led_code (int code, int color)
|
||||
/**********************************************************/
|
||||
{
|
||||
int i;
|
||||
|
||||
code &= 0xf; /* only 4 leds */
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (code & (1 << i)) {
|
||||
set_led (i, color);
|
||||
} else {
|
||||
set_led (i, OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
/**********************************************************/
|
||||
set_led (int led, int color)
|
||||
/**********************************************************/
|
||||
{
|
||||
int shift = led * 2;
|
||||
unsigned long mask = 0x3 << shift;
|
||||
|
||||
CRADLE_LED_CLR_REG = mask; /* clear bits */
|
||||
CRADLE_LED_SET_REG = (color << shift); /* set bits */
|
||||
udelay (5000);
|
||||
}
|
||||
|
||||
inline void
|
||||
/**********************************************************/
|
||||
cradle_outb (unsigned short val, unsigned long base, unsigned long reg)
|
||||
/**********************************************************/
|
||||
{
|
||||
*(volatile unsigned short *) (base + (reg * 2)) = val;
|
||||
}
|
||||
|
||||
inline unsigned char
|
||||
/**********************************************************/
|
||||
cradle_inb (unsigned long base, unsigned long reg)
|
||||
/**********************************************************/
|
||||
{
|
||||
unsigned short val;
|
||||
|
||||
val = *(volatile unsigned short *) (base + (reg * 2));
|
||||
return (val & 0xff);
|
||||
}
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
init_sio (int led, unsigned long base)
|
||||
/**********************************************************/
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
set_led (led, YELLOW);
|
||||
val = cradle_inb (base, CRADLE_SIO_INDEX);
|
||||
val = cradle_inb (base, CRADLE_SIO_INDEX);
|
||||
if (val != 0) {
|
||||
set_led (led, RED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* map SCC2 to COM1 */
|
||||
cradle_outb (0x01, base, CRADLE_SIO_INDEX);
|
||||
cradle_outb (0x00, base, CRADLE_SIO_DATA);
|
||||
|
||||
/* enable SCC2 extended regs */
|
||||
cradle_outb (0x40, base, CRADLE_SIO_INDEX);
|
||||
cradle_outb (0xa0, base, CRADLE_SIO_DATA);
|
||||
|
||||
/* enable SCC2 clock multiplier */
|
||||
cradle_outb (0x51, base, CRADLE_SIO_INDEX);
|
||||
cradle_outb (0x04, base, CRADLE_SIO_DATA);
|
||||
|
||||
/* enable SCC2 */
|
||||
cradle_outb (0x00, base, CRADLE_SIO_INDEX);
|
||||
cradle_outb (0x04, base, CRADLE_SIO_DATA);
|
||||
|
||||
/* map SCC2 DMA to channel 0 */
|
||||
cradle_outb (0x4f, base, CRADLE_SIO_INDEX);
|
||||
cradle_outb (0x09, base, CRADLE_SIO_DATA);
|
||||
|
||||
/* read ID from SIO to check operation */
|
||||
cradle_outb (0xe4, base, 0x3f8 + 0x3);
|
||||
val = cradle_inb (base, 0x3f8 + 0x0);
|
||||
if ((val & 0xf0) != 0x20) {
|
||||
set_led (led, RED);
|
||||
/* disable SCC2 */
|
||||
cradle_outb (0, base, CRADLE_SIO_INDEX);
|
||||
cradle_outb (0, base, CRADLE_SIO_DATA);
|
||||
return -1;
|
||||
}
|
||||
/* set back to bank 0 */
|
||||
cradle_outb (0, base, 0x3f8 + 0x3);
|
||||
set_led (led, GREEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
board_post_init (void)
|
||||
/**********************************************************/
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
board_init (void)
|
||||
/**********************************************************/
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
led_code (0xf, YELLOW);
|
||||
|
||||
/* arch number of HHP Cradle */
|
||||
gd->bd->bi_arch_number = 174;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0xa0000100;
|
||||
|
||||
/* Init SIOs to enable SCC2 */
|
||||
udelay (100000); /* delay makes it look neat */
|
||||
init_sio (0, CRADLE_SIO1_PHYS);
|
||||
udelay (100000);
|
||||
init_sio (1, CRADLE_SIO2_PHYS);
|
||||
udelay (100000);
|
||||
init_sio (2, CRADLE_SIO3_PHYS);
|
||||
udelay (100000);
|
||||
set_led (3, GREEN);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
/**********************************************************/
|
||||
dram_init (void)
|
||||
/**********************************************************/
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
|
||||
gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
|
||||
gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
|
||||
gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
|
||||
|
||||
return (PHYS_SDRAM_1_SIZE +
|
||||
PHYS_SDRAM_2_SIZE +
|
||||
PHYS_SDRAM_3_SIZE +
|
||||
PHYS_SDRAM_4_SIZE );
|
||||
}
|
||||
367
board/cradle/flash.c
Normal file
367
board/cradle/flash.c
Normal file
@@ -0,0 +1,367 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#define FLASH_BANK_SIZE 0x400000
|
||||
#define MAIN_SECT_SIZE 0x20000
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ulong flash_init(void)
|
||||
{
|
||||
int i, j;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++)
|
||||
{
|
||||
ulong flashbase = 0;
|
||||
flash_info[i].flash_id =
|
||||
(INTEL_MANUFACT & FLASH_VENDMASK) |
|
||||
(INTEL_ID_28F128J3 & FLASH_TYPEMASK);
|
||||
flash_info[i].size = FLASH_BANK_SIZE;
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
|
||||
memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
flashbase = PHYS_FLASH_1;
|
||||
break;
|
||||
case 1:
|
||||
flashbase = PHYS_FLASH_2;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j=0; j<CFG_MAX_FLASH_BANKS; j++)
|
||||
{
|
||||
switch (info->flash_id & FLASH_VENDMASK)
|
||||
{
|
||||
case (INTEL_MANUFACT & FLASH_VENDMASK):
|
||||
printf("Intel: ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK)
|
||||
{
|
||||
case (INTEL_ID_28F320J3A & FLASH_TYPEMASK):
|
||||
printf("28F320J3A (32Mbit)\n");
|
||||
break;
|
||||
case (INTEL_ID_28F128J3 & FLASH_TYPEMASK):
|
||||
printf("28F128J3 (128Mbit)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
goto Done;
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
if ((i % 5) == 0)
|
||||
{
|
||||
printf ("\n ");
|
||||
}
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
info++;
|
||||
}
|
||||
|
||||
Done:
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
int rc = ERR_OK;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
return ERR_UNKNOWN_FLASH_TYPE;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
return ERR_INVAL;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) !=
|
||||
(INTEL_MANUFACT & FLASH_VENDMASK)) {
|
||||
return ERR_UNKNOWN_FLASH_VENDOR;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
if (prot)
|
||||
return ERR_PROTECTED;
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last && !ctrlc(); sect++) {
|
||||
|
||||
printf("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
vu_short *addr = (vu_short *)(info->start[sect]);
|
||||
|
||||
*addr = 0x20; /* erase setup */
|
||||
*addr = 0xD0; /* erase confirm */
|
||||
|
||||
while ((*addr & 0x80) != 0x80) {
|
||||
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) {
|
||||
*addr = 0xB0; /* suspend erase */
|
||||
*addr = 0xFF; /* reset to read mode */
|
||||
rc = ERR_TIMOUT;
|
||||
goto outahere;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register command */
|
||||
*addr = 0x50;
|
||||
/* reset to read mode */
|
||||
*addr = 0xFF;
|
||||
}
|
||||
printf("ok.\n");
|
||||
}
|
||||
if (ctrlc())
|
||||
printf("User Interrupt!\n");
|
||||
|
||||
outahere:
|
||||
|
||||
/* allow flash to settle - wait 10 ms */
|
||||
udelay_masked(10000);
|
||||
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash
|
||||
*/
|
||||
|
||||
static int write_word (flash_info_t *info, ulong dest, ushort data)
|
||||
{
|
||||
vu_short *addr = (vu_short *)dest, val;
|
||||
int rc = ERR_OK;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased
|
||||
*/
|
||||
if ((*addr & data) != data)
|
||||
return ERR_NOT_ERASED;
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* clear status register command */
|
||||
*addr = 0x50;
|
||||
|
||||
/* program set-up command */
|
||||
*addr = 0x40;
|
||||
|
||||
/* latch address/data */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while(((val = *addr) & 0x80) != 0x80)
|
||||
{
|
||||
if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) {
|
||||
rc = ERR_TIMOUT;
|
||||
/* suspend program command */
|
||||
*addr = 0xB0;
|
||||
goto outahere;
|
||||
}
|
||||
}
|
||||
|
||||
if(val & 0x1A) { /* check for error */
|
||||
printf("\nFlash write error %02x at address %08lx\n",
|
||||
(int)val, (unsigned long)dest);
|
||||
if(val & (1<<3)) {
|
||||
printf("Voltage range error.\n");
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
if(val & (1<<1)) {
|
||||
printf("Device protect error.\n");
|
||||
rc = ERR_PROTECTED;
|
||||
goto outahere;
|
||||
}
|
||||
if(val & (1<<4)) {
|
||||
printf("Programming error.\n");
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
|
||||
outahere:
|
||||
/* read array command */
|
||||
*addr = 0xFF;
|
||||
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash.
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
ushort data;
|
||||
int l;
|
||||
int i, rc;
|
||||
|
||||
wp = (addr & ~1); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0)
|
||||
{
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<l; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
for (; i<2 && cnt>0; ++i) {
|
||||
data = (data >> 8) | (*src++ << 8);
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt==0 && i<2; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 2) {
|
||||
data = *((vu_short*)src);
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
src += 2;
|
||||
wp += 2;
|
||||
cnt -= 2;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) {
|
||||
data = (data >> 8) | (*src++ << 8);
|
||||
--cnt;
|
||||
}
|
||||
for (; i<2; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
|
||||
return write_word(info, wp, data);
|
||||
}
|
||||
515
board/cradle/memsetup.S
Normal file
515
board/cradle/memsetup.S
Normal file
@@ -0,0 +1,515 @@
|
||||
/*
|
||||
* Most of this taken from Redboot hal_platform_setup.h with cleanup
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
DRAM_SIZE: .long CFG_DRAM_SIZE
|
||||
|
||||
/* wait for coprocessor write complete */
|
||||
.macro CPWAIT reg
|
||||
mrc p15,0,\reg,c2,c0,0
|
||||
mov \reg,\reg
|
||||
sub pc,pc,#4
|
||||
.endm
|
||||
|
||||
.macro SET_LED val
|
||||
ldr r6, =CRADLE_LED_CLR_REG
|
||||
ldr r7, =0
|
||||
str r7, [r6]
|
||||
ldr r6, =CRADLE_LED_SET_REG
|
||||
ldr r7, =\val
|
||||
str r7, [r6]
|
||||
.endm
|
||||
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
|
||||
mov r10, lr
|
||||
|
||||
/* Set up GPIO pins first */
|
||||
|
||||
ldr r0, =GPSR0
|
||||
ldr r1, =CFG_GPSR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPSR1
|
||||
ldr r1, =CFG_GPSR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPSR2
|
||||
ldr r1, =CFG_GPSR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR0
|
||||
ldr r1, =CFG_GPCR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR1
|
||||
ldr r1, =CFG_GPCR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR2
|
||||
ldr r1, =CFG_GPCR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GRER0
|
||||
ldr r1, =CFG_GRER0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GRER1
|
||||
ldr r1, =CFG_GRER1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GRER2
|
||||
ldr r1, =CFG_GRER2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GFER0
|
||||
ldr r1, =CFG_GFER0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GFER1
|
||||
ldr r1, =CFG_GFER1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GFER2
|
||||
ldr r1, =CFG_GFER2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR0
|
||||
ldr r1, =CFG_GPDR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR1
|
||||
ldr r1, =CFG_GPDR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR2
|
||||
ldr r1, =CFG_GPDR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR0_L
|
||||
ldr r1, =CFG_GAFR0_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR0_U
|
||||
ldr r1, =CFG_GAFR0_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR1_L
|
||||
ldr r1, =CFG_GAFR1_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR1_U
|
||||
ldr r1, =CFG_GAFR1_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR2_L
|
||||
ldr r1, =CFG_GAFR2_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR2_U
|
||||
ldr r1, =CFG_GAFR2_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
/* enable GPIO pins */
|
||||
ldr r0, =PSSR
|
||||
ldr r1, =CFG_PSSR_VAL
|
||||
str r1, [r0]
|
||||
|
||||
SET_LED 1
|
||||
|
||||
ldr r3, =MSC1 /* low - bank 2 Lubbock Registers / SRAM */
|
||||
ldr r2, =CFG_MSC1_VAL /* high - bank 3 Ethernet Controller */
|
||||
str r2, [r3] /* need to set MSC1 before trying to write to the HEX LEDs */
|
||||
ldr r2, [r3] /* need to read it back to make sure the value latches (see MSC section of manual) */
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
Initlialize Memory Controller
|
||||
|
||||
See PXA250 Operating System Developer's Guide
|
||||
|
||||
pause for 200 uSecs- allow internal clocks to settle
|
||||
*Note: only need this if hard reset... doing it anyway for now
|
||||
*/
|
||||
|
||||
@ Step 1
|
||||
@ ---- Wait 200 usec
|
||||
ldr r3, =OSCR @ reset the OS Timer Count to zero
|
||||
mov r2, #0
|
||||
str r2, [r3]
|
||||
ldr r4, =0x300 @ really 0x2E1 is about 200usec, so 0x300 should be plenty
|
||||
1:
|
||||
ldr r2, [r3]
|
||||
cmp r4, r2
|
||||
bgt 1b
|
||||
|
||||
SET_LED 2
|
||||
|
||||
mem_init:
|
||||
@ get memory controller base address
|
||||
ldr r1, =MEMC_BASE
|
||||
|
||||
|
||||
@****************************************************************************
|
||||
@ Step 2
|
||||
@
|
||||
|
||||
@ Step 2a
|
||||
@ write msc0, read back to ensure data latches
|
||||
@
|
||||
ldr r2, =CFG_MSC0_VAL
|
||||
str r2, [r1, #MSC0_OFFSET]
|
||||
ldr r2, [r1, #MSC0_OFFSET]
|
||||
|
||||
@ write msc1
|
||||
ldr r2, =CFG_MSC1_VAL
|
||||
str r2, [r1, #MSC1_OFFSET]
|
||||
ldr r2, [r1, #MSC1_OFFSET]
|
||||
|
||||
@ write msc2
|
||||
ldr r2, =CFG_MSC2_VAL
|
||||
str r2, [r1, #MSC2_OFFSET]
|
||||
ldr r2, [r1, #MSC2_OFFSET]
|
||||
|
||||
@ Step 2b
|
||||
@ write mecr
|
||||
ldr r2, =CFG_MECR_VAL
|
||||
str r2, [r1, #MECR_OFFSET]
|
||||
|
||||
@ write mcmem0
|
||||
ldr r2, =CFG_MCMEM0_VAL
|
||||
str r2, [r1, #MCMEM0_OFFSET]
|
||||
|
||||
@ write mcmem1
|
||||
ldr r2, =CFG_MCMEM1_VAL
|
||||
str r2, [r1, #MCMEM1_OFFSET]
|
||||
|
||||
@ write mcatt0
|
||||
ldr r2, =CFG_MCATT0_VAL
|
||||
str r2, [r1, #MCATT0_OFFSET]
|
||||
|
||||
@ write mcatt1
|
||||
ldr r2, =CFG_MCATT1_VAL
|
||||
str r2, [r1, #MCATT1_OFFSET]
|
||||
|
||||
@ write mcio0
|
||||
ldr r2, =CFG_MCIO0_VAL
|
||||
str r2, [r1, #MCIO0_OFFSET]
|
||||
|
||||
@ write mcio1
|
||||
ldr r2, =CFG_MCIO1_VAL
|
||||
str r2, [r1, #MCIO1_OFFSET]
|
||||
|
||||
/*SET_LED 3 */
|
||||
|
||||
@ Step 2c
|
||||
@ fly-by-dma is defeatured on this part
|
||||
@ write flycnfg
|
||||
@ldr r2, =CFG_FLYCNFG_VAL
|
||||
@str r2, [r1, #FLYCNFG_OFFSET]
|
||||
|
||||
/* FIXME Does this sequence really make sense */
|
||||
#ifdef REDBOOT_WAY
|
||||
@ Step 2d
|
||||
@ get the mdrefr settings
|
||||
ldr r3, =CFG_MDREFR_VAL
|
||||
|
||||
@ extract DRI field (we need a valid DRI field)
|
||||
@
|
||||
ldr r2, =0xFFF
|
||||
|
||||
@ valid DRI field in r3
|
||||
@
|
||||
and r3, r3, r2
|
||||
|
||||
@ get the reset state of MDREFR
|
||||
@
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ clear the DRI field
|
||||
@
|
||||
bic r4, r4, r2
|
||||
|
||||
@ insert the valid DRI field loaded above
|
||||
@
|
||||
orr r4, r4, r3
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ *Note: preserve the mdrefr value in r4 *
|
||||
|
||||
/*SET_LED 4 */
|
||||
|
||||
@****************************************************************************
|
||||
@ Step 3
|
||||
@
|
||||
@ NO SRAM
|
||||
|
||||
mov pc, r10
|
||||
|
||||
|
||||
@****************************************************************************
|
||||
@ Step 4
|
||||
@
|
||||
|
||||
@ Assumes previous mdrefr value in r4, if not then read current mdrefr
|
||||
|
||||
@ clear the free-running clock bits
|
||||
@ (clear K0Free, K1Free, K2Free
|
||||
@
|
||||
bic r4, r4, #(0x00800000 | 0x01000000 | 0x02000000)
|
||||
|
||||
@ set K0RUN for CPLD clock
|
||||
@
|
||||
orr r4, r4, #0x00002000
|
||||
|
||||
@ set K1RUN if bank 0 installed
|
||||
@
|
||||
orr r4, r4, #0x00010000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ deassert SLFRSH
|
||||
@
|
||||
bic r4, r4, #0x00400000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ assert E1PIN
|
||||
@
|
||||
orr r4, r4, #0x00008000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
nop
|
||||
nop
|
||||
#else
|
||||
@ Step 2d
|
||||
@ get the mdrefr settings
|
||||
ldr r3, =CFG_MDREFR_VAL
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ Step 4
|
||||
|
||||
@ set K0RUN for CPLD clock
|
||||
@
|
||||
orr r4, r4, #0x00002000
|
||||
|
||||
@ set K1RUN for bank 0
|
||||
@
|
||||
orr r4, r4, #0x00010000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ deassert SLFRSH
|
||||
@
|
||||
bic r4, r4, #0x00400000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
@ assert E1PIN
|
||||
@
|
||||
orr r4, r4, #0x00008000
|
||||
|
||||
@ write back mdrefr
|
||||
@
|
||||
str r4, [r1, #MDREFR_OFFSET]
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
nop
|
||||
nop
|
||||
#endif
|
||||
|
||||
@ Step 4d
|
||||
@ fetch platform value of mdcnfg
|
||||
@
|
||||
ldr r2, =CFG_MDCNFG_VAL
|
||||
|
||||
@ disable all sdram banks
|
||||
@
|
||||
bic r2, r2, #(MDCNFG_DE0 | MDCNFG_DE1)
|
||||
bic r2, r2, #(MDCNFG_DE2 | MDCNFG_DE3)
|
||||
|
||||
@ program banks 0/1 for bus width
|
||||
@
|
||||
bic r2, r2, #MDCNFG_DWID0 @0=32-bit
|
||||
|
||||
@ write initial value of mdcnfg, w/o enabling sdram banks
|
||||
@
|
||||
str r2, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
@ Step 4e
|
||||
@ pause for 200 uSecs
|
||||
@
|
||||
ldr r3, =OSCR @ reset the OS Timer Count to zero
|
||||
mov r2, #0
|
||||
str r2, [r3]
|
||||
ldr r4, =0x300 @ really 0x2E1 is about 200usec, so 0x300 should be plenty
|
||||
1:
|
||||
ldr r2, [r3]
|
||||
cmp r4, r2
|
||||
bgt 1b
|
||||
|
||||
/*SET_LED 5 */
|
||||
|
||||
/* Why is this here??? */
|
||||
mov r0, #0x78 @turn everything off
|
||||
mcr p15, 0, r0, c1, c0, 0 @(caches off, MMU off, etc.)
|
||||
|
||||
@ Step 4f
|
||||
@ Access memory *not yet enabled* for CBR refresh cycles (8)
|
||||
@ - CBR is generated for all banks
|
||||
|
||||
ldr r2, =CFG_DRAM_BASE
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
str r2, [r2]
|
||||
|
||||
@ Step 4g
|
||||
@get memory controller base address
|
||||
@
|
||||
ldr r1, =MEMC_BASE
|
||||
|
||||
@fetch current mdcnfg value
|
||||
@
|
||||
ldr r3, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
@enable sdram bank 0 if installed (must do for any populated bank)
|
||||
@
|
||||
orr r3, r3, #MDCNFG_DE0
|
||||
|
||||
@write back mdcnfg, enabling the sdram bank(s)
|
||||
@
|
||||
str r3, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
@ Step 4h
|
||||
@ write mdmrs
|
||||
@
|
||||
ldr r2, =CFG_MDMRS_VAL
|
||||
str r2, [r1, #MDMRS_OFFSET]
|
||||
|
||||
@ Done Memory Init
|
||||
|
||||
/*SET_LED 6 */
|
||||
|
||||
@********************************************************************
|
||||
@ Disable (mask) all interrupts at the interrupt controller
|
||||
@
|
||||
|
||||
@ clear the interrupt level register (use IRQ, not FIQ)
|
||||
@
|
||||
mov r1, #0
|
||||
ldr r2, =ICLR
|
||||
str r1, [r2]
|
||||
|
||||
@ Set interrupt mask register
|
||||
@
|
||||
ldr r1, =CFG_ICMR_VAL
|
||||
ldr r2, =ICMR
|
||||
str r1, [r2]
|
||||
|
||||
@ ********************************************************************
|
||||
@ Disable the peripheral clocks, and set the core clock
|
||||
@
|
||||
|
||||
@ Turn Off ALL on-chip peripheral clocks for re-configuration
|
||||
@
|
||||
ldr r1, =CKEN
|
||||
mov r2, #0
|
||||
str r2, [r1]
|
||||
|
||||
@ set core clocks
|
||||
@
|
||||
ldr r2, =CFG_CCCR_VAL
|
||||
ldr r1, =CCCR
|
||||
str r2, [r1]
|
||||
|
||||
#ifdef ENABLE32KHZ
|
||||
@ enable the 32Khz oscillator for RTC and PowerManager
|
||||
@
|
||||
ldr r1, =OSCC
|
||||
mov r2, #OSCC_OON
|
||||
str r2, [r1]
|
||||
|
||||
@ NOTE: spin here until OSCC.OOK get set,
|
||||
@ meaning the PLL has settled.
|
||||
@
|
||||
60:
|
||||
ldr r2, [r1]
|
||||
ands r2, r2, #1
|
||||
beq 60b
|
||||
#endif
|
||||
|
||||
@ Turn on needed clocks
|
||||
@
|
||||
ldr r1, =CKEN
|
||||
ldr r2, =CFG_CKEN_VAL
|
||||
str r2, [r1]
|
||||
|
||||
/*SET_LED 7 */
|
||||
|
||||
/* Is this needed???? */
|
||||
#define NODEBUG
|
||||
#ifdef NODEBUG
|
||||
/*Disable software and data breakpoints */
|
||||
mov r0,#0
|
||||
mcr p15,0,r0,c14,c8,0 /* ibcr0 */
|
||||
mcr p15,0,r0,c14,c9,0 /* ibcr1 */
|
||||
mcr p15,0,r0,c14,c4,0 /* dbcon */
|
||||
|
||||
/*Enable all debug functionality */
|
||||
mov r0,#0x80000000
|
||||
mcr p14,0,r0,c10,c0,0 /* dcsr */
|
||||
|
||||
#endif
|
||||
|
||||
/*SET_LED 8 */
|
||||
|
||||
mov pc, r10
|
||||
|
||||
@ End memsetup
|
||||
53
board/cradle/u-boot.lds
Normal file
53
board/cradle/u-boot.lds
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/xscale/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.bss : { *(.bss) }
|
||||
|
||||
armboot_end = .;
|
||||
}
|
||||
302
board/cray/L1/L1.c
Normal file
302
board/cray/L1/L1.c
Normal file
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <405gp_i2c.h>
|
||||
#include <command.h>
|
||||
#include <cmd_nvedit.h>
|
||||
#include <cmd_bootm.h>
|
||||
#include <rtc.h>
|
||||
#include <net.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define L1_MEMSIZE (32*1024*1024)
|
||||
|
||||
/* the std. DHCP stufff */
|
||||
#define DHCP_ROUTER 3
|
||||
#define DHCP_NETMASK 1
|
||||
#define DHCP_BOOTFILE 67
|
||||
#define DHCP_ROOTPATH 17
|
||||
#define DHCP_HOSTNAME 12
|
||||
|
||||
/* some extras used by CRAY
|
||||
*
|
||||
* on the server this looks like:
|
||||
*
|
||||
* option L1-initrd-image code 224 = string;
|
||||
* option L1-initrd-image "/opt/craysv2/craymcu/l1/flash/initrd.image"
|
||||
*/
|
||||
#define DHCP_L1_INITRD 224
|
||||
|
||||
/* new, [better?] way via official vendor-extensions, defining an option
|
||||
* space.
|
||||
* on the server this looks like:
|
||||
*
|
||||
* option space U-Boot;
|
||||
* option U-Boot.initrd code 3 = string;
|
||||
* option U-Boot.bootcmd code 4 = string;
|
||||
* option U-Boot.bootflags code 5 = string;
|
||||
* option U-Boot.rootdev code 6 = string;
|
||||
*/
|
||||
#define DHCP_VENDOR_SPECX 43
|
||||
#define DHCP_VX_INITRD 3
|
||||
#define DHCP_VX_BOOTCMD 4
|
||||
#define DHCP_VX_BOOTFLAGS 5
|
||||
#define DHCP_VX_ROOTDEV 6
|
||||
|
||||
/* Things DHCP server can tellme about. If there's no flash address, then
|
||||
* they dont participate in 'update' to flash, and we force their values
|
||||
* back to '0' every boot to be sure to get them fresh from DHCP. Yes, I
|
||||
* know this is a pain...
|
||||
*
|
||||
* If I get no bootfile, boot from flash. If rootpath, use that. If no
|
||||
* rootpath use initrd in flash.
|
||||
*/
|
||||
typedef struct dhcp_item_s {
|
||||
u8 dhcp_option;
|
||||
u8 dhcp_vendor_option;
|
||||
char *dhcpvalue;
|
||||
char *envname;
|
||||
} dhcp_item_t;
|
||||
static dhcp_item_t Things[] = {
|
||||
{DHCP_ROUTER, 0, NULL, "gateway"},
|
||||
{DHCP_NETMASK, 0, NULL, "netmask"},
|
||||
{DHCP_BOOTFILE, 0, NULL, "bootfile"},
|
||||
{DHCP_ROOTPATH, 0, NULL, "rootpath"},
|
||||
{DHCP_HOSTNAME, 0, NULL, "hostname"},
|
||||
{DHCP_L1_INITRD, 0, NULL, "initrd"},
|
||||
/* and the other way.. */
|
||||
{DHCP_VENDOR_SPECX, DHCP_VX_INITRD, NULL, "initrd"},
|
||||
{DHCP_VENDOR_SPECX, DHCP_VX_BOOTCMD, NULL, "bootcmd"},
|
||||
{DHCP_VENDOR_SPECX, DHCP_VX_BOOTFLAGS, NULL, NULL},
|
||||
{DHCP_VENDOR_SPECX, DHCP_VX_ROOTDEV, NULL, NULL},
|
||||
};
|
||||
|
||||
#define N_THINGS ((sizeof(Things))/(sizeof(dhcp_item_t)))
|
||||
|
||||
static void init_ecc_sdram (void);
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
int board_pre_init (void)
|
||||
{
|
||||
init_ecc_sdram ();
|
||||
mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
|
||||
mtdcr (uicer, 0x00000000); /* disable all ints */
|
||||
mtdcr (uiccr, 0x00000020); /* set all but FPGA SMI to be non-critical */
|
||||
mtdcr (uicpr, 0xFFFFFFE0); /* set int polarities */
|
||||
mtdcr (uictr, 0x10000000); /* set int trigger levels */
|
||||
mtdcr (uicvcr, 0x00000001); /* set vect base=0,INT0 highest priority */
|
||||
mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
int checkboard (void)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
int misc_init_r (void)
|
||||
{
|
||||
unsigned char *s, *e;
|
||||
image_header_t *hdr;
|
||||
time_t timestamp;
|
||||
struct rtc_time tm;
|
||||
|
||||
hdr = (image_header_t *) (CFG_MONITOR_BASE - sizeof (image_header_t));
|
||||
timestamp = (time_t) hdr->ih_time;
|
||||
to_tm (timestamp, &tm);
|
||||
printf ("Welcome to U-Boot on Cray L1. Compiled %4d-%02d-%02d %2d:%02d:%02d (UTC)\n", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
#define FACTORY_SETTINGS 0xFFFC0000
|
||||
if ((s = getenv ("ethaddr")) == NULL) {
|
||||
e = (unsigned char *) (FACTORY_SETTINGS);
|
||||
if (*(e + 0) != '0'
|
||||
|| *(e + 1) != '0'
|
||||
|| *(e + 2) != ':'
|
||||
|| *(e + 3) != '4' || *(e + 4) != '0' || *(e + 17) != '\0') {
|
||||
printf ("No valid MAC address in flash location 0x3C0000!\n");
|
||||
} else {
|
||||
printf ("Factory MAC: %s\n", e);
|
||||
setenv ("ethaddr", e);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
return (L1_MEMSIZE);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* stubs so we can print dates w/o any nvram RTC.*/
|
||||
void rtc_get (struct rtc_time *tmp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void rtc_set (struct rtc_time *tmp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void rtc_reset (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Do sdram bank init in C so I can read it..
|
||||
*/
|
||||
static void init_ecc_sdram (void)
|
||||
{
|
||||
unsigned long tmp, *p;
|
||||
|
||||
/* write SDRAM bank 0 register */
|
||||
mtdcr (memcfga, mem_mb0cf);
|
||||
mtdcr (memcfgd, 0x00062001);
|
||||
|
||||
/* Set the SDRAM Timing reg, SDTR1 and the refresh timer reg, RTR. */
|
||||
/* To set the appropriate timings, we need to know the SDRAM speed. */
|
||||
/* We can use the PLB speed since the SDRAM speed is the same as */
|
||||
/* the PLB speed. The PLB speed is the FBK divider times the */
|
||||
/* 405GP reference clock, which on the L1 is 25Mhz. */
|
||||
/* Thus, if FBK div is 2, SDRAM is 50Mhz; if FBK div is 3, SDRAM is */
|
||||
/* 150Mhz; if FBK is 3, SDRAM is 150Mhz. */
|
||||
|
||||
/* divisor = ((mfdcr(strap)>> 28) & 0x3); */
|
||||
|
||||
/* write SDRAM timing for 100Mhz. */
|
||||
mtdcr (memcfga, mem_sdtr1);
|
||||
mtdcr (memcfgd, 0x0086400D);
|
||||
|
||||
/* write SDRAM refresh interval register */
|
||||
mtdcr (memcfga, mem_rtr);
|
||||
mtdcr (memcfgd, 0x05F00000);
|
||||
udelay (200);
|
||||
|
||||
/* sdram controller.*/
|
||||
mtdcr (memcfga, mem_mcopt1);
|
||||
mtdcr (memcfgd, 0x90800000);
|
||||
udelay (200);
|
||||
|
||||
/* disable ECC on all banks */
|
||||
mtdcr (memcfga, mem_ecccf);
|
||||
tmp = mfdcr (memcfgd);
|
||||
tmp &= 0xff0fffff;
|
||||
mtdcr (memcfga, mem_ecccf);
|
||||
mtdcr (memcfgd, tmp);
|
||||
|
||||
/* set up SDRAM Controller with ECC enabled */
|
||||
mtdcr (memcfga, mem_mcopt1);
|
||||
tmp = (mfdcr (memcfgd) & ~0xFFE00000) | 0x90800000;
|
||||
mtdcr (memcfga, mem_mcopt1);
|
||||
mtdcr (memcfgd, tmp);
|
||||
udelay (600);
|
||||
|
||||
/* fill all the memory */
|
||||
for (p = (unsigned long) 0; ((unsigned long) p < L1_MEMSIZE);
|
||||
*p++ = 0L);
|
||||
udelay (400);
|
||||
mtdcr (memcfga, mem_ecccf);
|
||||
tmp = mfdcr (memcfgd);
|
||||
|
||||
/* enable ECC on bank 0 */
|
||||
tmp |= 0x00800000;
|
||||
mtdcr (memcfgd, tmp);
|
||||
udelay (400);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
static u8 *dhcp_env_update (u8 thing, u8 * pop)
|
||||
{
|
||||
u8 i, oplen;
|
||||
|
||||
oplen = *(pop + 1);
|
||||
|
||||
if ((Things[thing].dhcpvalue = malloc (oplen)) == NULL) {
|
||||
printf ("Whoops! failed to malloc space for DHCP thing %s\n",
|
||||
Things[thing].envname);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; (i < oplen); i++)
|
||||
if ((*(Things[thing].dhcpvalue + i) = *(pop + 2 + i)) == ' ')
|
||||
break;
|
||||
*(Things[thing].dhcpvalue + i) = '\0';
|
||||
|
||||
/* set env. */
|
||||
if (Things[thing].envname)
|
||||
setenv (Things[thing].envname, Things[thing].dhcpvalue);
|
||||
return (Things[thing].dhcpvalue);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
u8 *dhcp_vendorex_prep (u8 * e)
|
||||
{
|
||||
u8 thing;
|
||||
|
||||
/* ask for the things I want. */
|
||||
*e++ = 55; /* Parameter Request List */
|
||||
*e++ = N_THINGS;
|
||||
for (thing = 0; thing < N_THINGS; thing++)
|
||||
*e++ = Things[thing].dhcp_option;
|
||||
*e++ = 255;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* .. return NULL means it wasnt mine, non-null means I got it..*/
|
||||
u8 *dhcp_vendorex_proc (u8 * pop)
|
||||
{
|
||||
u8 oplen, *sub_op, sub_oplen, *retval;
|
||||
u8 thing = 0;
|
||||
|
||||
retval = NULL;
|
||||
oplen = *(pop + 1);
|
||||
/* if pop is vender spec indicator, there are sub-options. */
|
||||
if (*pop == DHCP_VENDOR_SPECX) {
|
||||
for (sub_op = pop + 2;
|
||||
oplen && (sub_oplen = *(sub_op + 1));
|
||||
oplen -= sub_oplen, sub_op += (sub_oplen + 2)) {
|
||||
for (thing = 0; thing < N_THINGS; thing++) {
|
||||
if (*sub_op == Things[thing].dhcp_vendor_option) {
|
||||
if (!(retval = dhcp_env_update (thing, sub_op))) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (thing = 0; thing < N_THINGS; thing++) {
|
||||
if (*pop == Things[thing].dhcp_option)
|
||||
if (!(retval = dhcp_env_update (thing, pop)))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return (thing >= N_THINGS ? NULL : pop);
|
||||
}
|
||||
44
board/cray/L1/L1.h
Normal file
44
board/cray/L1/L1.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* FLASH Memory Map as used by CRAY L1, 4MB AMD29F032B flash chip
|
||||
*
|
||||
* Start Address Length
|
||||
* +++++++++++++++++++++++++ 0xFFC0_0000 Start of Flash -----------------
|
||||
* | Failsafe Linux Image | (1M)
|
||||
* +=======================+ 0xFFD0_0000
|
||||
* | (Reserved FlashFiles) | (1M)
|
||||
* +=======================+ 0xFFE0_0000
|
||||
* | Failsafe RootFS | (1M)
|
||||
* +=======================+ 0xFFF0_0000
|
||||
* | |
|
||||
* | U N U S E D |
|
||||
* | |
|
||||
* +-----------------------+ 0xFFFD_0000 U-Boot image header (64 bytes)
|
||||
* | environment settings | (64k)
|
||||
* +-----------------------+ 0xFFFE_0000 U-Boot image header (64 bytes)
|
||||
* | U-Boot | 0xFFFE_0040 _start of U-Boot
|
||||
* | | 0xFFFE_FFFC reset vector - branch to _start
|
||||
* +++++++++++++++++++++++++ 0xFFFF_FFFF End of Flash -----------------
|
||||
*****************************************************************************/
|
||||
47
board/cray/L1/Makefile
Normal file
47
board/cray/L1/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
SOBJS = init.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
26
board/cray/L1/config.mk
Normal file
26
board/cray/L1/config.mk
Normal file
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# Note: I make an "image" from U-Boot itself, which prefixes 0x40 bytes of
|
||||
# header info, hence start address is thus shifted.
|
||||
TEXT_BASE = 0xFFFD0040
|
||||
471
board/cray/L1/flash.c
Normal file
471
board/cray/L1/flash.c
Normal file
@@ -0,0 +1,471 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 4/5/2001
|
||||
* Wait for completion of each sector erase command issued
|
||||
* 4/5/2001
|
||||
* Chris Hallinan - DS4.COM, Inc. - clh@net1plus.com
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified July 20, 2001
|
||||
* Strip down to support ONLY the AMD29F032B.
|
||||
* Dave Updegraff - Cray, Inc. dave@cray.com
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ppc4xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
/* The flash chip we use... */
|
||||
#define AMD_ID_F032B 0x41 /* 29F032B ID 32 Mbit,64 64Kx8 sectors */
|
||||
#define FLASH_AM320B 0x0009
|
||||
|
||||
|
||||
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, size_b1;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
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 */
|
||||
if (CFG_MAX_FLASH_BANKS == 1)
|
||||
{
|
||||
/* Setup offsets */
|
||||
flash_get_offsets (FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
#if 0
|
||||
/* Monitor protection ON by default */
|
||||
(void)flash_protect(FLAG_PROTECT_SET,
|
||||
FLASH_BASE0_PRELIM,
|
||||
FLASH_BASE0_PRELIM+CFG_MONITOR_LEN-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
size_b1 = 0 ;
|
||||
flash_info[0].size = size_b0;
|
||||
}
|
||||
|
||||
return (size_b0 + size_b1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set up sector start address table */
|
||||
for (i = 0; i < info->sector_count; 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;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM320B:printf ("AM29F032B (32 Mbit 64x64KB uniform sectors)\n");
|
||||
break;
|
||||
default: printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
/*
|
||||
* Check if whole sector is erased
|
||||
*/
|
||||
if (i != (info->sector_count-1))
|
||||
size = info->start[i+1] - info->start[i];
|
||||
else
|
||||
size = info->start[0] + info->size - info->start[i];
|
||||
erased = 1;
|
||||
flash = (volatile unsigned long *)info->start[i];
|
||||
size = size >> 2; /* divide by 4 for longword access */
|
||||
for (k=0; k<size; k++)
|
||||
{
|
||||
if (*flash++ != 0xffffffff)
|
||||
{
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
|
||||
printf (" %08lX%s%s",
|
||||
info->start[i],
|
||||
erased ? " E" : " ",
|
||||
info->protect[i] ? "RO " : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
value = addr2[0];
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE)AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr2[1]; /* device ID */
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE)AMD_ID_F032B:
|
||||
info->flash_id += FLASH_AM320B;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x0400000; /* => 4 MB */
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile FLASH_WORD_SIZE *)(info->start[i]);
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr2 = (FLASH_WORD_SIZE *)info->start[0];
|
||||
*addr2 = (FLASH_WORD_SIZE)0x00F000F0; /* reset bank */
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE)0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE)0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE)0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE)0x00300030; /* sector erase */
|
||||
l_sect = sect;
|
||||
/*
|
||||
* Wait for each sector to complete, it's more
|
||||
* reliable. According to AMD Spec, you must
|
||||
* issue all erase commands within a specified
|
||||
* timeout. This has been seen to fail, especially
|
||||
* if printf()s are included (for debug)!!
|
||||
*/
|
||||
wait_for_DQ7(info, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
/* reset to read mode */
|
||||
addr = (FLASH_WORD_SIZE *)info->start[0];
|
||||
addr[0] = (FLASH_WORD_SIZE)0x00F000F0; /* reset bank */
|
||||
|
||||
printf (" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
for (; i<4 && cnt>0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt==0 && i<4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i=0; i<4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i<4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
return (write_word(info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *)(info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *)dest;
|
||||
volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *)&data;
|
||||
ulong start;
|
||||
int flag;
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((volatile FLASH_WORD_SIZE *)dest) &
|
||||
(FLASH_WORD_SIZE)data) != (FLASH_WORD_SIZE)data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
for (i=0; i<4/sizeof(FLASH_WORD_SIZE); i++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
147
board/cray/L1/init.S
Normal file
147
board/cray/L1/init.S
Normal file
@@ -0,0 +1,147 @@
|
||||
/*------------------------------------------------------------------------------+ */
|
||||
/* */
|
||||
/* 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. */
|
||||
/* Bank 0 - Flash and SRAM */
|
||||
/* Bank 1 - NVRAM/RTC */
|
||||
/* Bank 2 - Keyboard/Mouse controller */
|
||||
/* Bank 3 - IR controller */
|
||||
/* Bank 4 - not used */
|
||||
/* Bank 5 - not used */
|
||||
/* Bank 6 - not used */
|
||||
/* Bank 7 - FPGA registers */
|
||||
/*-----------------------------------------------------------------------------#include <config.h> */
|
||||
#include <ppc4xx.h>
|
||||
|
||||
#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
#include <ppc_defs.h>
|
||||
|
||||
#include <asm/cache.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
/* CRAY - L1: only nominally a 'walnut', since ext.Bus.Cntlr is all empty */
|
||||
/* except for #1 which we use for DMA'ing to IOCA-like things, so the */
|
||||
/* control registers to set that up are determined by what we've */
|
||||
/* empirically discovered work there. */
|
||||
|
||||
.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 */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------- */
|
||||
/* Peripheral Bank 0 (Flash) initialization */
|
||||
/*---------------------------------------------------------------------- */
|
||||
/* 0x7F8FFE80 slowest boot */
|
||||
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,0xFFC5 /* BAS=0xFFC,BS=0x4(4MB),BU=0x3(R/W), */
|
||||
ori r4,r4,0x8000 /* BW=0x0( 8 bits) */
|
||||
mtdcr ebccfgd,r4
|
||||
|
||||
blr
|
||||
|
||||
/*---------------------------------------------------------------------- */
|
||||
/* Peripheral Bank 1 (NVRAM/RTC) initialization */
|
||||
/* CRAY:the L1 has NOT this bank, it is tied to SV2/IOCA/etc/ instead */
|
||||
/* and we do DMA on it. The ConfigurationRegister part is threfore */
|
||||
/* almost arbitrary, except that our linux driver needs to know the */
|
||||
/* address, but it can query, it.. */
|
||||
/* */
|
||||
/* The AccessParameter is CRITICAL, */
|
||||
/* thouch, since it needs to agree with the electrical timings on the */
|
||||
/* IOCA parallel interface. That value is: 0x0185,4380 */
|
||||
/* BurstModeEnable BME=0 */
|
||||
/* TransferWait TWT=3 */
|
||||
/* ChipSelectOnTiming CSN=1 */
|
||||
/* OutputEnableOnTimimg OEN=1 */
|
||||
/* WriteByteEnableOnTiming WBN=1 */
|
||||
/* WriteByteEnableOffTiming WBF=0 */
|
||||
/* TransferHold TH=1 */
|
||||
/* ReadyEnable RE=1 */
|
||||
/* SampleOnReady SOR=1 */
|
||||
/* ByteEnableMode BEM=0 */
|
||||
/* ParityEnable PEN=0 */
|
||||
/* all reserved bits=0 */
|
||||
/*---------------------------------------------------------------------- */
|
||||
/*---------------------------------------------------------------------- */
|
||||
addi r4,0,pb1ap
|
||||
mtdcr ebccfga,r4
|
||||
addis r4,0,0x0185 /* hiword */
|
||||
ori r4,r4,0x4380 /* loword */
|
||||
mtdcr ebccfgd,r4
|
||||
|
||||
addi r4,0,pb1cr
|
||||
mtdcr ebccfga,r4
|
||||
addis r4,0,0xF001 /* BAS=0xF00,BS=0x0(1MB),BU=0x3(R/W), */
|
||||
ori r4,r4,0x8000 /* BW=0x0( 8 bits) */
|
||||
mtdcr ebccfgd,r4
|
||||
|
||||
blr
|
||||
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Function: sdram_init */
|
||||
/* Description: Configures SDRAM memory banks. */
|
||||
/* NOTE: for CrayL1 we have ECC memory, so enable it. */
|
||||
/*....now done in C in L1.c:init_sdram for readability. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
.globl sdram_init
|
||||
|
||||
sdram_init:
|
||||
blr
|
||||
144
board/cray/L1/u-boot.lds
Normal file
144
board/cray/L1/u-boot.lds
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
.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 :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/ppc4xx/start.o (.text)
|
||||
board/cray/L1/init.o (.text)
|
||||
cpu/ppc4xx/traps.o (.text)
|
||||
cpu/ppc4xx/interrupts.o (.text)
|
||||
cpu/ppc4xx/serial.o (.text)
|
||||
cpu/ppc4xx/cpu_init.o (.text)
|
||||
cpu/ppc4xx/speed.o (.text)
|
||||
cpu/ppc4xx/405gp_enet.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
/*. = env_offset;*/
|
||||
common/environment.o(.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.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 = .);
|
||||
|
||||
__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 = .);
|
||||
}
|
||||
131
board/cray/L1/u-boot.lds.debug
Normal file
131
board/cray/L1/u-boot.lds.debug
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
mpc8xx/start.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
|
||||
common/environment.o(.text)
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
47
board/csb226/Makefile
Normal file
47
board/csb226/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := csb226.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
16
board/csb226/config.mk
Normal file
16
board/csb226/config.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Linux-Kernel is expected to be at c000'8000, entry c000'8000
|
||||
#
|
||||
# we load ourself to c170'0000, the upper 1 MB of second bank
|
||||
#
|
||||
# download areas is c800'0000
|
||||
#
|
||||
|
||||
# This is the address where U-Boot lives in flash:
|
||||
#TEXT_BASE = 0
|
||||
|
||||
# FIXME: armboot does only work correctly when being compiled
|
||||
# for the addresses _after_ relocation to RAM!! Otherwhise the
|
||||
# .bss segment is assumed in flash...
|
||||
TEXT_BASE = 0xa1fe0000
|
||||
|
||||
59
board/csb226/csb226.c
Normal file
59
board/csb226/csb226.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Robert Schwebel, Pengutronix, r.schwebel@pengutronix.de
|
||||
* Kyle Harris, Nexus Technologies, Inc., kharris@nexus-tech.net
|
||||
* Marius Groeger, Sysgo Real-Time Solutions GmbH, mgroeger@sysgo.de
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* memory and cpu-speed are setup before relocation */
|
||||
/* so we do _nothing_ here */
|
||||
|
||||
/* arch number of CSB226 board */
|
||||
gd->bd->bi_arch_number = 0; /* FIXME */
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0xa0000100;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dram_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
364
board/csb226/flash.c
Normal file
364
board/csb226/flash.c
Normal file
@@ -0,0 +1,364 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#define FLASH_BANK_SIZE 0x02000000
|
||||
#define MAIN_SECT_SIZE 0x40000 /* 2x16 = 256k per sector */
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
ulong flash_init(void)
|
||||
{
|
||||
int i, j;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++)
|
||||
{
|
||||
ulong flashbase = 0;
|
||||
flash_info[i].flash_id =
|
||||
(INTEL_MANUFACT & FLASH_VENDMASK) |
|
||||
(INTEL_ID_28F128J3 & FLASH_TYPEMASK);
|
||||
flash_info[i].size = FLASH_BANK_SIZE;
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
|
||||
memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
flashbase = PHYS_FLASH_1;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
flash_info[i].start[j] = flashbase + j*MAIN_SECT_SIZE;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
|
||||
&flash_info[0]);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j=0; j<CFG_MAX_FLASH_BANKS; j++)
|
||||
{
|
||||
switch (info->flash_id & FLASH_VENDMASK)
|
||||
{
|
||||
case (INTEL_MANUFACT & FLASH_VENDMASK):
|
||||
printf("Intel: ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK)
|
||||
{
|
||||
case (INTEL_ID_28F128J3 & FLASH_TYPEMASK):
|
||||
printf("28F128J3 (128Mbit)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
goto Done;
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
if ((i % 5) == 0)
|
||||
{
|
||||
printf ("\n ");
|
||||
}
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
info++;
|
||||
}
|
||||
|
||||
Done:
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
int rc = ERR_OK;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN)
|
||||
return ERR_UNKNOWN_FLASH_TYPE;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
return ERR_INVAL;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) !=
|
||||
(INTEL_MANUFACT & FLASH_VENDMASK)) {
|
||||
return ERR_UNKNOWN_FLASH_VENDOR;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
if (prot)
|
||||
return ERR_PROTECTED;
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last && !ctrlc(); sect++) {
|
||||
|
||||
printf("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
/* vushort *addr = (vushort *)(info->start[sect]); */
|
||||
ushort *addr = (ushort *)(info->start[sect]);
|
||||
|
||||
*addr = 0x20; /* erase setup */
|
||||
*addr = 0xD0; /* erase confirm */
|
||||
|
||||
while ((*addr & 0x80) != 0x80) {
|
||||
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) {
|
||||
*addr = 0xB0; /* suspend erase */
|
||||
*addr = 0xFF; /* reset to read mode */
|
||||
rc = ERR_TIMOUT;
|
||||
goto outahere;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register command */
|
||||
*addr = 0x50;
|
||||
/* reset to read mode */
|
||||
*addr = 0xFF;
|
||||
}
|
||||
printf("ok.\n");
|
||||
}
|
||||
if (ctrlc())
|
||||
printf("User Interrupt!\n");
|
||||
|
||||
outahere:
|
||||
|
||||
/* allow flash to settle - wait 10 ms */
|
||||
udelay_masked(10000);
|
||||
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash
|
||||
*/
|
||||
|
||||
static int write_word (flash_info_t *info, ulong dest, ushort data)
|
||||
{
|
||||
/* vushort *addr = (vushort *)dest, val; */
|
||||
ushort *addr = (ushort *)dest, val;
|
||||
int rc = ERR_OK;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased
|
||||
*/
|
||||
if ((*addr & data) != data)
|
||||
return ERR_NOT_ERASED;
|
||||
|
||||
/*
|
||||
* Disable interrupts which might cause a timeout
|
||||
* here. Remember that our exception vectors are
|
||||
* at address 0 in the flash, and we don't want a
|
||||
* (ticker) exception to happen while the flash
|
||||
* chip is in programming mode.
|
||||
*/
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* clear status register command */
|
||||
*addr = 0x50;
|
||||
|
||||
/* program set-up command */
|
||||
*addr = 0x40;
|
||||
|
||||
/* latch address/data */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while(((val = *addr) & 0x80) != 0x80)
|
||||
{
|
||||
if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) {
|
||||
rc = ERR_TIMOUT;
|
||||
/* suspend program command */
|
||||
*addr = 0xB0;
|
||||
goto outahere;
|
||||
}
|
||||
}
|
||||
|
||||
if(val & 0x1A) { /* check for error */
|
||||
printf("\nFlash write error %02x at address %08lx\n",
|
||||
(int)val, (unsigned long)dest);
|
||||
if(val & (1<<3)) {
|
||||
printf("Voltage range error.\n");
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
if(val & (1<<1)) {
|
||||
printf("Device protect error.\n");
|
||||
rc = ERR_PROTECTED;
|
||||
goto outahere;
|
||||
}
|
||||
if(val & (1<<4)) {
|
||||
printf("Programming error.\n");
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
rc = ERR_PROG_ERROR;
|
||||
goto outahere;
|
||||
}
|
||||
|
||||
outahere:
|
||||
/* read array command */
|
||||
*addr = 0xFF;
|
||||
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash.
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
ushort data;
|
||||
int l;
|
||||
int i, rc;
|
||||
|
||||
wp = (addr & ~1); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<l; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
for (; i<2 && cnt>0; ++i) {
|
||||
data = (data >> 8) | (*src++ << 8);
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt==0 && i<2; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 2) {
|
||||
/* data = *((vushort*)src); */
|
||||
data = *((ushort*)src);
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
src += 2;
|
||||
wp += 2;
|
||||
cnt -= 2;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<2 && cnt>0; ++i, ++cp) {
|
||||
data = (data >> 8) | (*src++ << 8);
|
||||
--cnt;
|
||||
}
|
||||
for (; i<2; ++i, ++cp) {
|
||||
data = (data >> 8) | (*(uchar *)cp << 8);
|
||||
}
|
||||
|
||||
return write_word(info, wp, data);
|
||||
}
|
||||
428
board/csb226/memsetup.S
Normal file
428
board/csb226/memsetup.S
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Most of this taken from Redboot hal_platform_setup.h with cleanup
|
||||
*
|
||||
* NOTE: I haven't clean this up considerably, just enough to get it
|
||||
* running. See hal_platform_setup.h for the source. See
|
||||
* board/cradle/memsetup.S for another PXA250 setup that is
|
||||
* much cleaner.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <version.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
DRAM_SIZE: .long CFG_DRAM_SIZE
|
||||
|
||||
/* wait for coprocessor write complete */
|
||||
.macro CPWAIT reg
|
||||
mrc p15,0,\reg,c2,c0,0
|
||||
mov \reg,\reg
|
||||
sub pc,pc,#4
|
||||
.endm
|
||||
|
||||
|
||||
/*
|
||||
* Memory setup
|
||||
*/
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
|
||||
mov r10, lr
|
||||
|
||||
/* Set up GPIO pins first ----------------------------------------- */
|
||||
|
||||
ldr r0, =GPSR0
|
||||
ldr r1, =CFG_GPSR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPSR1
|
||||
ldr r1, =CFG_GPSR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPSR2
|
||||
ldr r1, =CFG_GPSR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR0
|
||||
ldr r1, =CFG_GPCR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR1
|
||||
ldr r1, =CFG_GPCR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPCR2
|
||||
ldr r1, =CFG_GPCR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR0
|
||||
ldr r1, =CFG_GPDR0_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR1
|
||||
ldr r1, =CFG_GPDR1_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GPDR2
|
||||
ldr r1, =CFG_GPDR2_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR0_L
|
||||
ldr r1, =CFG_GAFR0_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR0_U
|
||||
ldr r1, =CFG_GAFR0_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR1_L
|
||||
ldr r1, =CFG_GAFR1_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR1_U
|
||||
ldr r1, =CFG_GAFR1_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR2_L
|
||||
ldr r1, =CFG_GAFR2_L_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =GAFR2_U
|
||||
ldr r1, =CFG_GAFR2_U_VAL
|
||||
str r1, [r0]
|
||||
|
||||
ldr r0, =PSSR /* enable GPIO pins */
|
||||
ldr r1, =CFG_PSSR_VAL
|
||||
str r1, [r0]
|
||||
|
||||
/* ldr r3, =MSC1 / low - bank 2 Lubbock Registers / SRAM */
|
||||
/* ldr r2, =CFG_MSC1_VAL / high - bank 3 Ethernet Controller */
|
||||
/* str r2, [r3] / need to set MSC1 before trying to write to the HEX LEDs */
|
||||
/* ldr r2, [r3] / need to read it back to make sure the value latches (see MSC section of manual) */
|
||||
/* */
|
||||
/* ldr r1, =LED_BLANK */
|
||||
/* mov r0, #0xFF */
|
||||
/* str r0, [r1] / turn on hex leds */
|
||||
/* */
|
||||
/*loop: */
|
||||
/* */
|
||||
/* ldr r0, =0xB0070001 */
|
||||
/* ldr r1, =_LED */
|
||||
/* str r0, [r1] / hex display */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Enable memory interface */
|
||||
/* */
|
||||
/* The sequence below is based on the recommended init steps */
|
||||
/* detailed in the Intel PXA250 Operating Systems Developers Guide, */
|
||||
/* Chapter 10. */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 1: Wait for at least 200 microsedonds to allow internal */
|
||||
/* clocks to settle. Only necessary after hard reset... */
|
||||
/* FIXME: can be optimized later */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
ldr r3, =OSCR /* reset the OS Timer Count to zero */
|
||||
mov r2, #0
|
||||
str r2, [r3]
|
||||
ldr r4, =0x300 /* really 0x2E1 is about 200usec, */
|
||||
/* so 0x300 should be plenty */
|
||||
1:
|
||||
ldr r2, [r3]
|
||||
cmp r4, r2
|
||||
bgt 1b
|
||||
|
||||
mem_init:
|
||||
|
||||
ldr r1, =MEMC_BASE /* get memory controller base addr. */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2a: Initialize Asynchronous static memory controller */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* MSC registers: timing, bus width, mem type */
|
||||
|
||||
/* MSC0: nCS(0,1) */
|
||||
ldr r2, =CFG_MSC0_VAL
|
||||
str r2, [r1, #MSC0_OFFSET]
|
||||
ldr r2, [r1, #MSC0_OFFSET] /* read back to ensure */
|
||||
/* that data latches */
|
||||
/* MSC1: nCS(2,3) */
|
||||
ldr r2, =CFG_MSC1_VAL
|
||||
str r2, [r1, #MSC1_OFFSET]
|
||||
ldr r2, [r1, #MSC1_OFFSET]
|
||||
|
||||
/* MSC2: nCS(4,5) */
|
||||
ldr r2, =CFG_MSC2_VAL
|
||||
str r2, [r1, #MSC2_OFFSET]
|
||||
ldr r2, [r1, #MSC2_OFFSET]
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2b: Initialize Card Interface */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* MECR: Memory Expansion Card Register */
|
||||
ldr r2, =CFG_MECR_VAL
|
||||
str r2, [r1, #MECR_OFFSET]
|
||||
ldr r2, [r1, #MECR_OFFSET]
|
||||
|
||||
/* MCMEM0: Card Interface slot 0 timing */
|
||||
ldr r2, =CFG_MCMEM0_VAL
|
||||
str r2, [r1, #MCMEM0_OFFSET]
|
||||
ldr r2, [r1, #MCMEM0_OFFSET]
|
||||
|
||||
/* MCMEM1: Card Interface slot 1 timing */
|
||||
ldr r2, =CFG_MCMEM1_VAL
|
||||
str r2, [r1, #MCMEM1_OFFSET]
|
||||
ldr r2, [r1, #MCMEM1_OFFSET]
|
||||
|
||||
/* MCATT0: Card Interface Attribute Space Timing, slot 0 */
|
||||
ldr r2, =CFG_MCATT0_VAL
|
||||
str r2, [r1, #MCATT0_OFFSET]
|
||||
ldr r2, [r1, #MCATT0_OFFSET]
|
||||
|
||||
/* MCATT1: Card Interface Attribute Space Timing, slot 1 */
|
||||
ldr r2, =CFG_MCATT1_VAL
|
||||
str r2, [r1, #MCATT1_OFFSET]
|
||||
ldr r2, [r1, #MCATT1_OFFSET]
|
||||
|
||||
/* MCIO0: Card Interface I/O Space Timing, slot 0 */
|
||||
ldr r2, =CFG_MCIO0_VAL
|
||||
str r2, [r1, #MCIO0_OFFSET]
|
||||
ldr r2, [r1, #MCIO0_OFFSET]
|
||||
|
||||
/* MCIO1: Card Interface I/O Space Timing, slot 1 */
|
||||
ldr r2, =CFG_MCIO1_VAL
|
||||
str r2, [r1, #MCIO1_OFFSET]
|
||||
ldr r2, [r1, #MCIO1_OFFSET]
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2c: Write FLYCNFG FIXME: what's that??? */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 2d: Initialize Timing for Sync Memory (SDCLK0) */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Before accessing MDREFR we need a valid DRI field, so we set */
|
||||
/* this to power on defaults + DIR field. */
|
||||
|
||||
ldr r4, =0x03ca4fff
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
ldr r4, =0x03ca4030
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
/* Note: preserve the mdrefr value in r4 */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 3: Initialize Synchronous Static Memory (Flash/Peripherals) */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Initialize SXCNFG register. Assert the enable bits */
|
||||
|
||||
/* Write SXMRS to cause an MRS command to all enabled banks of */
|
||||
/* synchronous static memory. Note that SXLCR need not be written */
|
||||
/* at this time. */
|
||||
|
||||
/* FIXME: we use async mode for now */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Step 4: Initialize SDRAM */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Step 4a: assert MDREFR:K1RUN and MDREFR:K2RUN and configure */
|
||||
/* MDREFR:K1DB2 and MDREFR:K2DB2 as desired. */
|
||||
|
||||
orr r4, r4, #(MDREFR_K1RUN|MDREFR_K2RUN|MDREFR_K0RUN)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
|
||||
/* Step 4b: de-assert MDREFR:SLFRSH. */
|
||||
|
||||
bic r4, r4, #(MDREFR_SLFRSH)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
|
||||
/* Step 4c: assert MDREFR:E1PIN and E0PIO */
|
||||
|
||||
orr r4, r4, #(MDREFR_E1PIN|MDREFR_E0PIN)
|
||||
|
||||
str r4, [r1, #MDREFR_OFFSET] /* write back MDREFR */
|
||||
ldr r4, [r1, #MDREFR_OFFSET]
|
||||
|
||||
|
||||
/* Step 4d: write MDCNFG with MDCNFG:DEx deasserted (set to 0), to */
|
||||
/* configure but not enable each SDRAM partition pair. */
|
||||
|
||||
ldr r4, [r1, #MDCNFG_OFFSET]
|
||||
bic r4, r4, #(MDCNFG_DE0|MDCNFG_DE1)
|
||||
|
||||
str r4, [r1, #MDCNFG_OFFSET] /* write back MDCNFG */
|
||||
ldr r4, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
|
||||
/* Step 4e: Wait for the clock to the SDRAMs to stabilize, */
|
||||
/* 100..200 µsec. */
|
||||
|
||||
ldr r3, =OSCR /* reset the OS Timer Count to zero */
|
||||
mov r2, #0
|
||||
str r2, [r3]
|
||||
ldr r4, =0x300 /* really 0x2E1 is about 200usec, */
|
||||
/* so 0x300 should be plenty */
|
||||
1:
|
||||
ldr r2, [r3]
|
||||
cmp r4, r2
|
||||
bgt 1b
|
||||
|
||||
|
||||
/* Step 4f: Trigger a number (usually 8) refresh cycles by */
|
||||
/* attempting non-burst read or write accesses to disabled */
|
||||
/* SDRAM, as commonly specified in the power up sequence */
|
||||
/* documented in SDRAM data sheets. The address(es) used */
|
||||
/* for this purpose must not be cacheable. */
|
||||
|
||||
ldr r3, =CFG_DRAM_BASE
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
str r2, [r3]
|
||||
|
||||
|
||||
/* Step 4g: Write MDCNFG with enable bits asserted */
|
||||
/* (MDCNFG:DEx set to 1). */
|
||||
|
||||
ldr r3, [r1, #MDCNFG_OFFSET]
|
||||
orr r3, r3, #(MDCNFG_DE0|MDCNFG_DE1)
|
||||
str r3, [r1, #MDCNFG_OFFSET]
|
||||
|
||||
/* Step 4h: Write MDMRS. */
|
||||
|
||||
ldr r2, =CFG_MDMRS_VAL
|
||||
str r2, [r1, #MDMRS_OFFSET]
|
||||
|
||||
|
||||
/* We are finished with Intel's memory controller initialisation */
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Disable (mask) all interrupts at interrupt controller */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
initirqs:
|
||||
|
||||
mov r1, #0 /* clear int. level register (IRQ, not FIQ) */
|
||||
ldr r2, =ICLR
|
||||
str r1, [r2]
|
||||
|
||||
ldr r2, =ICMR /* mask all interrupts at the controller */
|
||||
str r1, [r2]
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Clock initialisation */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
initclks:
|
||||
|
||||
/* Disable the peripheral clocks, and set the core clock frequency */
|
||||
/* (hard-coding at 398.12MHz for now). */
|
||||
|
||||
/* Turn Off ALL on-chip peripheral clocks for re-configuration */
|
||||
/* Note: See label 'ENABLECLKS' for the re-enabling */
|
||||
ldr r1, =CKEN
|
||||
mov r2, #0
|
||||
str r2, [r1]
|
||||
|
||||
|
||||
/* default value in case no valid rotary switch setting is found */
|
||||
ldr r2, =(CCCR_L27|CCCR_M2|CCCR_N10) /* DEFAULT: {200/200/100} */
|
||||
|
||||
/* ... and write the core clock config register */
|
||||
ldr r1, =CCCR
|
||||
str r2, [r1]
|
||||
|
||||
/* enable the 32Khz oscillator for RTC and PowerManager */
|
||||
ldr r1, =OSCC
|
||||
mov r2, #OSCC_OON
|
||||
str r2, [r1]
|
||||
|
||||
/* NOTE: spin here until OSCC.OOK get set, meaning the PLL */
|
||||
/* has settled. */
|
||||
60:
|
||||
ldr r2, [r1]
|
||||
ands r2, r2, #1
|
||||
beq 60b
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
/* Save SDRAM size */
|
||||
ldr r1, =DRAM_SIZE
|
||||
str r8, [r1]
|
||||
|
||||
/* Interrupt init: Mask all interrupts */
|
||||
ldr r0, =ICMR /* enable no sources */
|
||||
mov r1, #0
|
||||
str r1, [r0]
|
||||
|
||||
/* FIXME */
|
||||
|
||||
#define NODEBUG
|
||||
#ifdef NODEBUG
|
||||
/*Disable software and data breakpoints */
|
||||
mov r0,#0
|
||||
mcr p15,0,r0,c14,c8,0 /* ibcr0 */
|
||||
mcr p15,0,r0,c14,c9,0 /* ibcr1 */
|
||||
mcr p15,0,r0,c14,c4,0 /* dbcon */
|
||||
|
||||
/*Enable all debug functionality */
|
||||
mov r0,#0x80000000
|
||||
mcr p14,0,r0,c10,c0,0 /* dcsr */
|
||||
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* End memsetup */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
endmemsetup:
|
||||
|
||||
mov pc, lr
|
||||
|
||||
53
board/csb226/u-boot.lds
Normal file
53
board/csb226/u-boot.lds
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/xscale/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.bss : { *(.bss) }
|
||||
|
||||
armboot_end = .;
|
||||
}
|
||||
40
board/cu824/Makefile
Normal file
40
board/cu824/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
453
board/cu824/README
Normal file
453
board/cu824/README
Normal file
@@ -0,0 +1,453 @@
|
||||
ppcboot for a CU824 board
|
||||
---------------------------
|
||||
|
||||
CU824 has two banks of flash 8MB each. In board's notation, bank 0 is
|
||||
the one at the address of 0xFF800000 and bank 1 is the one at the
|
||||
address of 0xFF000000. On power-up the processor jumps to the address
|
||||
of 0xFFF00100, the last megabyte of the bank 0 of flash. Thus,
|
||||
U-Boot is configured to reside in flash starting at the address of
|
||||
0xFFF00000. The environment space is not embedded in the U-Boot code
|
||||
and is located in flash separately from U-Boot, at the address of
|
||||
0xFF008000.
|
||||
|
||||
|
||||
U-Boot test results
|
||||
--------------------
|
||||
|
||||
x.x Operation on all available serial consoles
|
||||
|
||||
x.x.x CONFIG_CONS_INDEX 1
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>he
|
||||
go - start application at address 'addr'
|
||||
run - run commands in an environment variable
|
||||
bootm - boot application image from memory
|
||||
bootp - boot image via network using BootP/TFTP protocol
|
||||
tftpboot- boot image via network using TFTP protocol
|
||||
and env variables ipaddr and serverip
|
||||
rarpboot- boot image via network using RARP/TFTP protocol
|
||||
bootd - boot default, i.e., run 'bootcmd'
|
||||
loads - load S-Record file over serial line
|
||||
loadb - load binary file over serial line (kermit mode)
|
||||
md - memory display
|
||||
mm - memory modify (auto-incrementing)
|
||||
nm - memory modify (constant address)
|
||||
mw - memory write (fill)
|
||||
cp - memory copy
|
||||
cmp - memory compare
|
||||
crc32 - checksum calculation
|
||||
base - print or set address offset
|
||||
printenv- print environment variables
|
||||
setenv - set environment variables
|
||||
saveenv - save environment variables to persistent storage
|
||||
protect - enable or disable FLASH write protection
|
||||
erase - erase FLASH memory
|
||||
flinfo - print FLASH memory information
|
||||
bdinfo - print Board Info structure
|
||||
iminfo - print header information for application image
|
||||
coninfo - print console devices and informations
|
||||
loop - infinite loop on address range
|
||||
mtest - simple RAM test
|
||||
icache - enable or disable instruction cache
|
||||
dcache - enable or disable data cache
|
||||
reset - Perform RESET of the CPU
|
||||
echo - echo args to console
|
||||
version - print monitor version
|
||||
help - print online help
|
||||
? - alias for 'help'
|
||||
=>
|
||||
|
||||
|
||||
x.x.x CONFIG_CONS_INDEX 2
|
||||
|
||||
**** NOT TESTED ****
|
||||
|
||||
x.x Flash Driver Operation
|
||||
|
||||
x.x.x Erase Operation
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>
|
||||
=>
|
||||
=>md ff000000
|
||||
ff000000: 27051956 70706362 6f6f7420 302e382e '..Vppcboot 0.8.
|
||||
ff000010: 3320284d 61792031 31203230 3031202d 3 (May 11 2001 -
|
||||
ff000020: 2031343a 35373a30 33290000 00000000 14:57:03)......
|
||||
ff000030: 00000000 00000000 00000000 00000000 ................
|
||||
ff000040: 00000000 00000000 00000000 00000000 ................
|
||||
ff000050: 00000000 00000000 00000000 00000000 ................
|
||||
ff000060: 00000000 00000000 00000000 00000000 ................
|
||||
ff000070: 00000000 00000000 00000000 00000000 ................
|
||||
ff000080: 00000000 00000000 00000000 00000000 ................
|
||||
ff000090: 00000000 00000000 00000000 00000000 ................
|
||||
ff0000a0: 00000000 00000000 00000000 00000000 ................
|
||||
ff0000b0: 00000000 00000000 00000000 00000000 ................
|
||||
ff0000c0: 00000000 00000000 00000000 00000000 ................
|
||||
ff0000d0: 00000000 00000000 00000000 00000000 ................
|
||||
ff0000e0: 00000000 00000000 00000000 00000000 ................
|
||||
ff0000f0: 00000000 00000000 00000000 00000000 ................
|
||||
=>erase ff000000 ff007fff
|
||||
Erase Flash from 0xff000000 to 0xff007fff
|
||||
done
|
||||
Erased 1 sectors
|
||||
=>md ff000000
|
||||
ff000000: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000010: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000020: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000030: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000040: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000050: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000060: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000070: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000080: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000090: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000a0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000b0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000c0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000d0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000e0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000f0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
=>
|
||||
|
||||
x.x.x Information
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>
|
||||
=>
|
||||
=>
|
||||
=>flinfo
|
||||
|
||||
Bank # 1: Intel: 28F160F3B (16Mbit)
|
||||
Size: 8 MB in 39 Sectors
|
||||
Sector Start Addresses:
|
||||
FF000000 FF008000 (RO) FF010000 FF018000 FF020000
|
||||
FF028000 FF030000 FF038000 FF040000 FF080000
|
||||
FF0C0000 FF100000 FF140000 FF180000 FF1C0000
|
||||
FF200000 FF240000 FF280000 FF2C0000 FF300000
|
||||
FF340000 FF380000 FF3C0000 FF400000 FF440000
|
||||
FF480000 FF4C0000 FF500000 FF540000 FF580000
|
||||
FF5C0000 FF600000 FF640000 FF680000 FF6C0000
|
||||
FF700000 FF740000 FF780000 FF7C0000
|
||||
|
||||
Bank # 2: Intel: 28F160F3B (16Mbit)
|
||||
Size: 8 MB in 39 Sectors
|
||||
Sector Start Addresses:
|
||||
FF800000 FF808000 FF810000 FF818000 FF820000
|
||||
FF828000 FF830000 FF838000 FF840000 FF880000
|
||||
FF8C0000 FF900000 FF940000 FF980000 FF9C0000
|
||||
FFA00000 FFA40000 FFA80000 FFAC0000 FFB00000
|
||||
FFB40000 FFB80000 FFBC0000 FFC00000 FFC40000
|
||||
FFC80000 FFCC0000 FFD00000 FFD40000 FFD80000
|
||||
FFDC0000 FFE00000 FFE40000 FFE80000 FFEC0000
|
||||
FFF00000 (RO) FFF40000 FFF80000 FFFC0000
|
||||
=>
|
||||
|
||||
x.x.x Flash Programming
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>
|
||||
=>
|
||||
=>
|
||||
=>cp 0 ff000000 20
|
||||
Copy to Flash... done
|
||||
=>md 0
|
||||
00000000: 0ec08ce0 03f9800c 00000001 040c0000 ................
|
||||
00000010: 00000001 03fd1aa0 03fd1ae4 03fd1a00 ................
|
||||
00000020: 03fd1a58 03fceb04 03fd34cc 03fd34d0 ...X......4...4.
|
||||
00000030: 03fcd5bc 03fcdabc 00000000 00000000 ................
|
||||
00000040: 00000000 00000000 00000000 00000000 ................
|
||||
00000050: 00000000 00000000 00000000 00000000 ................
|
||||
00000060: 00000000 00000000 00000000 00000000 ................
|
||||
00000070: 00000000 00000000 00000000 00000000 ................
|
||||
00000080: 00000000 00000000 00000000 00000000 ................
|
||||
00000090: 00000000 00000000 00000000 00000000 ................
|
||||
000000a0: 00000000 00000000 00000000 00000000 ................
|
||||
000000b0: 00000000 00000000 00000000 00000000 ................
|
||||
000000c0: 00000000 00000000 00000000 00000000 ................
|
||||
000000d0: 00000000 00000000 00000000 00000000 ................
|
||||
000000e0: 00000000 00000000 00000000 00000000 ................
|
||||
000000f0: 00000000 00000000 00000000 00000000 ................
|
||||
=>md ff000000
|
||||
ff000000: 0ec08ce0 03f9800c 00000001 040c0000 ................
|
||||
ff000010: 00000001 03fd1aa0 03fd1ae4 03fd1a00 ................
|
||||
ff000020: 03fd1a58 03fceb04 03fd34cc 03fd34d0 ...X......4...4.
|
||||
ff000030: 03fcd5bc 03fcdabc 00000000 00000000 ................
|
||||
ff000040: 00000000 00000000 00000000 00000000 ................
|
||||
ff000050: 00000000 00000000 00000000 00000000 ................
|
||||
ff000060: 00000000 00000000 00000000 00000000 ................
|
||||
ff000070: 00000000 00000000 00000000 00000000 ................
|
||||
ff000080: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff000090: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000a0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000b0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000c0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000d0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000e0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
ff0000f0: ffffffff ffffffff ffffffff ffffffff ................
|
||||
=>
|
||||
|
||||
x.x.x Storage of environment variables in flash
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>printenv
|
||||
bootargs=
|
||||
bootcmd=bootm FE020000
|
||||
bootdelay=5
|
||||
baudrate=9600
|
||||
ipaddr=192.168.4.2
|
||||
serverip=192.168.4.1
|
||||
ethaddr=00:40:42:01:00:a0
|
||||
stdin=serial
|
||||
stdout=serial
|
||||
stderr=serial
|
||||
|
||||
Environment size: 167/32764 bytes
|
||||
=>setenv myvar 1234
|
||||
=>save_env
|
||||
Un-Protected 1 sectors
|
||||
Erasing Flash...
|
||||
done
|
||||
Erased 1 sectors
|
||||
Saving Environment to Flash...
|
||||
Protected 1 sectors
|
||||
=>reset
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>printenv
|
||||
bootargs=
|
||||
bootcmd=bootm FE020000
|
||||
bootdelay=5
|
||||
baudrate=9600
|
||||
ipaddr=192.168.4.2
|
||||
serverip=192.168.4.1
|
||||
ethaddr=00:40:42:01:00:a0
|
||||
myvar=1234
|
||||
stdin=serial
|
||||
stdout=serial
|
||||
stderr=serial
|
||||
|
||||
Environment size: 178/32764 bytes
|
||||
=>
|
||||
|
||||
x.x Image Download and run over serial port
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>
|
||||
=>mw 40000 0 10000
|
||||
=>md 40000
|
||||
00040000: 00000000 00000000 00000000 00000000 ................
|
||||
00040010: 00000000 00000000 00000000 00000000 ................
|
||||
00040020: 00000000 00000000 00000000 00000000 ................
|
||||
00040030: 00000000 00000000 00000000 00000000 ................
|
||||
00040040: 00000000 00000000 00000000 00000000 ................
|
||||
00040050: 00000000 00000000 00000000 00000000 ................
|
||||
00040060: 00000000 00000000 00000000 00000000 ................
|
||||
00040070: 00000000 00000000 00000000 00000000 ................
|
||||
00040080: 00000000 00000000 00000000 00000000 ................
|
||||
00040090: 00000000 00000000 00000000 00000000 ................
|
||||
000400a0: 00000000 00000000 00000000 00000000 ................
|
||||
000400b0: 00000000 00000000 00000000 00000000 ................
|
||||
000400c0: 00000000 00000000 00000000 00000000 ................
|
||||
000400d0: 00000000 00000000 00000000 00000000 ................
|
||||
000400e0: 00000000 00000000 00000000 00000000 ................
|
||||
000400f0: 00000000 00000000 00000000 00000000 ................
|
||||
=>loads
|
||||
## Ready for S-Record download ...
|
||||
|
||||
(Back at xpert.denx.de)
|
||||
[vlad@xpert vlad]$ cat hello_world.srec >/dev/ttyS0
|
||||
[vlad@xpert vlad]$ kermit -l /dev/ttyS0 -b 9600 -c
|
||||
Connecting to /dev/ttyS0, speed 9600.
|
||||
The escape character is Ctrl-\ (ASCII 28, FS)
|
||||
Type the escape character followed by C to get back,
|
||||
or followed by ? to see other options.
|
||||
md 40000
|
||||
00040000: 00018148 9421ffe0 7c0802a6 bf61000c ...H.!..|....a..
|
||||
00040010: 90010024 48000005 7fc802a6 801effe8 ...$H...........
|
||||
00040020: 7fc0f214 7c7f1b78 813f0038 7c9c2378 ....|..x.?.8|.#x
|
||||
00040030: 807e8000 7cbd2b78 80090010 3b600000 .~..|.+x....;`..
|
||||
00040040: 7c0803a6 4e800021 813f0038 7f84e378 |...N..!.?.8...x
|
||||
00040050: 807e8004 80090010 7c0803a6 4e800021 .~......|...N..!
|
||||
00040060: 7c1be000 4181003c 80bd0000 813f0038 |...A..<.....?.8
|
||||
00040070: 3bbd0004 2c050000 40820008 80be8008 ;...,...@.......
|
||||
00040080: 80090010 7f64db78 807e800c 3b7b0001 .....d.x.~..;{..
|
||||
00040090: 7c0803a6 4e800021 7c1be000 4081ffcc |...N..!|...@...
|
||||
000400a0: 813f0038 807e8010 80090010 7c0803a6 .?.8.~......|...
|
||||
000400b0: 4e800021 813f0038 80090004 7c0803a6 N..!.?.8....|...
|
||||
000400c0: 4e800021 2c030000 4182ffec 813f0038 N..!,...A....?.8
|
||||
000400d0: 80090000 7c0803a6 4e800021 813f0038 ....|...N..!.?.8
|
||||
000400e0: 807e8014 80090010 7c0803a6 4e800021 .~......|...N..!
|
||||
000400f0: 38600000 80010024 7c0803a6 bb61000c 8`.....$|....a..
|
||||
=>go 40004
|
||||
## Starting application at 0x00040004 ...
|
||||
Hello World
|
||||
argc = 1
|
||||
argv[0] = "40004"
|
||||
argv[1] = "<NULL>"
|
||||
Hit any key to exit ...
|
||||
|
||||
## Application terminated, rc = 0x0
|
||||
=>
|
||||
|
||||
x.x Image download and run over ethernet interface
|
||||
|
||||
|
||||
ppcboot 0.9.2 (May 13 2001 - 17:56:46)
|
||||
|
||||
Initializing...
|
||||
CPU: MPC8240 Revsion 1.1 at 247 MHz: 16 kB I-Cache 16 kB D-Cache
|
||||
Board: CU824 Revision 1 Local Bus at 99 MHz
|
||||
DRAM: 64 MB
|
||||
FLASH: 16 MB
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
|
||||
Hit any key to stop autoboot: 0
|
||||
=>
|
||||
=>
|
||||
=>mw 40000 0 10000
|
||||
=>md 40000
|
||||
00040000: 00000000 00000000 00000000 00000000 ................
|
||||
00040010: 00000000 00000000 00000000 00000000 ................
|
||||
00040020: 00000000 00000000 00000000 00000000 ................
|
||||
00040030: 00000000 00000000 00000000 00000000 ................
|
||||
00040040: 00000000 00000000 00000000 00000000 ................
|
||||
00040050: 00000000 00000000 00000000 00000000 ................
|
||||
00040060: 00000000 00000000 00000000 00000000 ................
|
||||
00040070: 00000000 00000000 00000000 00000000 ................
|
||||
00040080: 00000000 00000000 00000000 00000000 ................
|
||||
00040090: 00000000 00000000 00000000 00000000 ................
|
||||
000400a0: 00000000 00000000 00000000 00000000 ................
|
||||
000400b0: 00000000 00000000 00000000 00000000 ................
|
||||
000400c0: 00000000 00000000 00000000 00000000 ................
|
||||
000400d0: 00000000 00000000 00000000 00000000 ................
|
||||
000400e0: 00000000 00000000 00000000 00000000 ................
|
||||
000400f0: 00000000 00000000 00000000 00000000 ................
|
||||
=>tftpboot 40000 hello_world.bin
|
||||
ARP broadcast 1
|
||||
TFTP from server 192.168.4.1; our IP address is 192.168.4.2
|
||||
Filename 'hello_world.bin'.
|
||||
Load address: 0x40000
|
||||
Loading: #############
|
||||
done
|
||||
Bytes transferred = 65912 (10178 hex)
|
||||
=>md 40000
|
||||
00040000: 00018148 9421ffe0 7c0802a6 bf61000c ...H.!..|....a..
|
||||
00040010: 90010024 48000005 7fc802a6 801effe8 ...$H...........
|
||||
00040020: 7fc0f214 7c7f1b78 813f0038 7c9c2378 ....|..x.?.8|.#x
|
||||
00040030: 807e8000 7cbd2b78 80090010 3b600000 .~..|.+x....;`..
|
||||
00040040: 7c0803a6 4e800021 813f0038 7f84e378 |...N..!.?.8...x
|
||||
00040050: 807e8004 80090010 7c0803a6 4e800021 .~......|...N..!
|
||||
00040060: 7c1be000 4181003c 80bd0000 813f0038 |...A..<.....?.8
|
||||
00040070: 3bbd0004 2c050000 40820008 80be8008 ;...,...@.......
|
||||
00040080: 80090010 7f64db78 807e800c 3b7b0001 .....d.x.~..;{..
|
||||
00040090: 7c0803a6 4e800021 7c1be000 4081ffcc |...N..!|...@...
|
||||
000400a0: 813f0038 807e8010 80090010 7c0803a6 .?.8.~......|...
|
||||
000400b0: 4e800021 813f0038 80090004 7c0803a6 N..!.?.8....|...
|
||||
000400c0: 4e800021 2c030000 4182ffec 813f0038 N..!,...A....?.8
|
||||
000400d0: 80090000 7c0803a6 4e800021 813f0038 ....|...N..!.?.8
|
||||
000400e0: 807e8014 80090010 7c0803a6 4e800021 .~......|...N..!
|
||||
000400f0: 38600000 80010024 7c0803a6 bb61000c 8`.....$|....a..
|
||||
=>go 40004
|
||||
## Starting application at 0x00040004 ...
|
||||
Hello World
|
||||
argc = 1
|
||||
argv[0] = "40004"
|
||||
argv[1] = "<NULL>"
|
||||
Hit any key to exit ...
|
||||
|
||||
## Application terminated, rc = 0x0
|
||||
=>
|
||||
30
board/cu824/config.mk
Normal file
30
board/cu824/config.mk
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# CU824 board
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xFFF00000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
|
||||
119
board/cu824/cu824.c
Normal file
119
board/cu824/cu824.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
|
||||
*
|
||||
* (C) Copyright 2001, 2002
|
||||
* Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
||||
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc824x.h>
|
||||
#include <asm/processor.h>
|
||||
#include <pci.h>
|
||||
|
||||
#define BOARD_REV_REG 0xFE80002B
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
char revision = *(volatile char *)(BOARD_REV_REG);
|
||||
char buf[32];
|
||||
|
||||
puts ("Board: CU824 ");
|
||||
printf("Revision %d ", revision);
|
||||
printf("Local Bus at %s MHz\n", strmhz(buf, gd->bus_clk));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
int i, cnt;
|
||||
volatile uchar * base = CFG_SDRAM_BASE;
|
||||
volatile ulong * addr;
|
||||
ulong save[32];
|
||||
ulong val, ret = 0;
|
||||
|
||||
for (i=0, cnt=(CFG_MAX_RAM_SIZE / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
|
||||
addr = (volatile ulong *)base + cnt;
|
||||
save[i++] = *addr;
|
||||
*addr = ~cnt;
|
||||
}
|
||||
|
||||
addr = (volatile ulong *)base;
|
||||
save[i] = *addr;
|
||||
*addr = 0;
|
||||
|
||||
if (*addr != 0) {
|
||||
*addr = save[i];
|
||||
goto Done;
|
||||
}
|
||||
|
||||
for (cnt = 1; cnt <= CFG_MAX_RAM_SIZE / sizeof(long); cnt <<= 1) {
|
||||
addr = (volatile ulong *)base + cnt;
|
||||
val = *addr;
|
||||
*addr = save[--i];
|
||||
if (val != ~cnt) {
|
||||
ulong new_bank0_end = cnt * sizeof(long) - 1;
|
||||
ulong mear1 = mpc824x_mpc107_getreg(MEAR1);
|
||||
ulong emear1 = mpc824x_mpc107_getreg(EMEAR1);
|
||||
mear1 = (mear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
||||
emear1 = (emear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
||||
mpc824x_mpc107_setreg(MEAR1, mear1);
|
||||
mpc824x_mpc107_setreg(EMEAR1, emear1);
|
||||
|
||||
ret = cnt * sizeof(long);
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
ret = CFG_MAX_RAM_SIZE;
|
||||
Done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize PCI Devices, report devices found.
|
||||
*/
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
static struct pci_config_table pci_sandpoint_config_table[] = {
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
PCI_BUS(CFG_ETH_DEV_FN), PCI_DEV(CFG_ETH_DEV_FN), PCI_FUNC(CFG_ETH_DEV_FN),
|
||||
pci_cfgfunc_config_device, { CFG_ETH_IOBASE,
|
||||
0,
|
||||
PCI_COMMAND_IO | PCI_COMMAND_MASTER }},
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
struct pci_controller hose = {
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
config_table: pci_sandpoint_config_table,
|
||||
#endif
|
||||
};
|
||||
|
||||
void pci_init(void)
|
||||
{
|
||||
pci_mpc824x_init(&hose);
|
||||
}
|
||||
486
board/cu824/flash.c
Normal file
486
board/cu824/flash.c
Normal file
@@ -0,0 +1,486 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc824x.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define FLASH_BANK_SIZE 0x800000
|
||||
#define MAIN_SECT_SIZE 0x40000
|
||||
#define PARAM_SECT_SIZE 0x8000
|
||||
|
||||
#define BOARD_CTRL_REG 0xFE800013
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
static int write_data (flash_info_t *info, ulong dest, ulong *data);
|
||||
static void write_via_fpu(vu_long *addr, ulong *data);
|
||||
static __inline__ unsigned long get_msr(void);
|
||||
static __inline__ void set_msr(unsigned long msr);
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#undef DEBUG_FLASH
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#ifdef DEBUG_FLASH
|
||||
#define DEBUGF(fmt,args...) printf(fmt ,##args)
|
||||
#else
|
||||
#define DEBUGF(fmt,args...)
|
||||
#endif
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
int i, j;
|
||||
ulong size = 0;
|
||||
volatile unsigned char *bcr = (volatile unsigned char *)(BOARD_CTRL_REG);
|
||||
|
||||
DEBUGF("Write protect was: 0x%02X\n", *bcr);
|
||||
*bcr &= 0x1; /* FWPT must be 0 */
|
||||
*bcr |= 0x6; /* FWP0 = FWP1 = 1 */
|
||||
DEBUGF("Write protect is: 0x%02X\n", *bcr);
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
vu_long *addr = (vu_long *)(CFG_FLASH_BASE + i * FLASH_BANK_SIZE);
|
||||
|
||||
addr[0] = 0x00900090;
|
||||
|
||||
DEBUGF ("Flash bank # %d:\n"
|
||||
"\tManuf. ID @ 0x%08lX: 0x%08lX\n"
|
||||
"\tDevice ID @ 0x%08lX: 0x%08lX\n",
|
||||
i,
|
||||
(ulong)(&addr[0]), addr[0],
|
||||
(ulong)(&addr[2]), addr[2]);
|
||||
|
||||
if ((addr[0] == addr[1]) && (addr[0] == INTEL_MANUFACT) &&
|
||||
(addr[2] == addr[3]) && (addr[2] == INTEL_ID_28F160F3B))
|
||||
{
|
||||
flash_info[i].flash_id = (FLASH_MAN_INTEL & FLASH_VENDMASK) |
|
||||
(INTEL_ID_28F160F3B & FLASH_TYPEMASK);
|
||||
} else {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
addr[0] = 0xFFFFFFFF;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
DEBUGF ("flash_id = 0x%08lX\n", flash_info[i].flash_id);
|
||||
|
||||
addr[0] = 0xFFFFFFFF;
|
||||
|
||||
flash_info[i].size = FLASH_BANK_SIZE;
|
||||
flash_info[i].sector_count = CFG_MAX_FLASH_SECT;
|
||||
memset(flash_info[i].protect, 0, CFG_MAX_FLASH_SECT);
|
||||
for (j = 0; j < flash_info[i].sector_count; j++) {
|
||||
if (j <= 7) {
|
||||
flash_info[i].start[j] = CFG_FLASH_BASE +
|
||||
i * FLASH_BANK_SIZE +
|
||||
j * PARAM_SECT_SIZE;
|
||||
} else {
|
||||
flash_info[i].start[j] = CFG_FLASH_BASE +
|
||||
i * FLASH_BANK_SIZE +
|
||||
(j - 7)*MAIN_SECT_SIZE;
|
||||
}
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE + FLASH_BANK_SIZE
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
|
||||
&flash_info[1]);
|
||||
#else
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (CFG_ENV_IS_IN_FLASH == 1) && defined(CFG_ENV_ADDR)
|
||||
#if CFG_ENV_ADDR >= CFG_FLASH_BASE + FLASH_BANK_SIZE
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[1]);
|
||||
#else
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Done:
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch ((i = info->flash_id & FLASH_VENDMASK)) {
|
||||
case (FLASH_MAN_INTEL & FLASH_VENDMASK):
|
||||
printf ("Intel: ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor 0x%04x ", i);
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((i = info->flash_id & FLASH_TYPEMASK)) {
|
||||
case (INTEL_ID_28F160F3B & FLASH_TYPEMASK):
|
||||
printf ("28F160F3B (16Mbit)\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type 0x%04x\n", i);
|
||||
goto Done;
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if ((i % 5) == 0) {
|
||||
printf ("\n ");
|
||||
}
|
||||
printf (" %08lX%s", info->start[i],
|
||||
info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
|
||||
Done:
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
|
||||
DEBUGF ("Erase flash bank %d sect %d ... %d\n",
|
||||
info - &flash_info[0], s_first, s_last);
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) !=
|
||||
(FLASH_MAN_INTEL & FLASH_VENDMASK)) {
|
||||
printf ("Can erase only Intel flash types - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
vu_long *addr = (vu_long *)(info->start[sect]);
|
||||
|
||||
DEBUGF ("Erase sect %d @ 0x%08lX\n",
|
||||
sect, (ulong)addr);
|
||||
|
||||
/* Disable interrupts which might cause a timeout
|
||||
* here.
|
||||
*/
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0] = 0x00500050; /* clear status register */
|
||||
addr[0] = 0x00200020; /* erase setup */
|
||||
addr[0] = 0x00D000D0; /* erase confirm */
|
||||
|
||||
addr[1] = 0x00500050; /* clear status register */
|
||||
addr[1] = 0x00200020; /* erase setup */
|
||||
addr[1] = 0x00D000D0; /* erase confirm */
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
|
||||
while (((addr[0] & 0x00800080) != 0x00800080) ||
|
||||
((addr[1] & 0x00800080) != 0x00800080) ) {
|
||||
if ((now=get_timer(start)) >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
addr[0] = 0x00B000B0; /* suspend erase */
|
||||
addr[0] = 0x00FF00FF; /* to read mode */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
addr[0] = 0x00FF00FF;
|
||||
}
|
||||
}
|
||||
printf (" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
#define FLASH_WIDTH 8 /* flash bus width in bytes */
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong wp, cp, msr;
|
||||
int l, rc, i;
|
||||
ulong data[2];
|
||||
ulong *datah = &data[0];
|
||||
ulong *datal = &data[1];
|
||||
|
||||
DEBUGF ("Flash write_buff: @ 0x%08lx, src 0x%08lx len %ld\n",
|
||||
addr, (ulong)src, cnt);
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
msr = get_msr();
|
||||
set_msr(msr | MSR_FP);
|
||||
|
||||
wp = (addr & ~(FLASH_WIDTH-1)); /* get lower aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
*datah = *datal = 0;
|
||||
|
||||
for (i = 0, cp = wp; i < l; i++, cp++) {
|
||||
if (i >= 4) {
|
||||
*datah = (*datah << 8) |
|
||||
((*datal & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
*datal = (*datal << 8) | (*(uchar *)cp);
|
||||
}
|
||||
for (; i < FLASH_WIDTH && cnt > 0; ++i) {
|
||||
char tmp;
|
||||
|
||||
tmp = *src;
|
||||
|
||||
src++;
|
||||
|
||||
if (i >= 4) {
|
||||
*datah = (*datah << 8) |
|
||||
((*datal & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
*datal = (*datal << 8) | tmp;
|
||||
|
||||
--cnt; ++cp;
|
||||
}
|
||||
|
||||
for (; cnt == 0 && i < FLASH_WIDTH; ++i, ++cp) {
|
||||
if (i >= 4) {
|
||||
*datah = (*datah << 8) |
|
||||
((*datal & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
*datal = (*datah << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data(info, wp, data)) != 0) {
|
||||
set_msr(msr);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
wp += FLASH_WIDTH;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle FLASH_WIDTH aligned part
|
||||
*/
|
||||
while (cnt >= FLASH_WIDTH) {
|
||||
*datah = *(ulong *)src;
|
||||
*datal = *(ulong *)(src + 4);
|
||||
if ((rc = write_data(info, wp, data)) != 0) {
|
||||
set_msr(msr);
|
||||
return (rc);
|
||||
}
|
||||
wp += FLASH_WIDTH;
|
||||
cnt -= FLASH_WIDTH;
|
||||
src += FLASH_WIDTH;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
set_msr(msr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
*datah = *datal = 0;
|
||||
for (i = 0, cp = wp; i < FLASH_WIDTH && cnt > 0; ++i, ++cp) {
|
||||
char tmp;
|
||||
|
||||
tmp = *src;
|
||||
|
||||
src++;
|
||||
|
||||
if (i >= 4) {
|
||||
*datah = (*datah << 8) | ((*datal & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
*datal = (*datal << 8) | tmp;
|
||||
|
||||
--cnt;
|
||||
}
|
||||
|
||||
for (; i < FLASH_WIDTH; ++i, ++cp) {
|
||||
if (i >= 4) {
|
||||
*datah = (*datah << 8) | ((*datal & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
*datal = (*datal << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
rc = write_data(info, wp, data);
|
||||
set_msr(msr);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t *info, ulong dest, ulong *data)
|
||||
{
|
||||
vu_long *addr = (vu_long *)dest;
|
||||
ulong start;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if (((addr[0] & data[0]) != data[0]) ||
|
||||
((addr[1] & data[1]) != data[1]) ) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr[0] = 0x00400040; /* write setup */
|
||||
write_via_fpu(addr, data);
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
start = get_timer (0);
|
||||
|
||||
while (((addr[0] & 0x00800080) != 0x00800080) ||
|
||||
((addr[1] & 0x00800080) != 0x00800080) ) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
addr[0] = 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
addr[0] = 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void write_via_fpu(vu_long *addr, ulong *data)
|
||||
{
|
||||
__asm__ __volatile__ ("lfd 1, 0(%0)" : : "r" (data));
|
||||
__asm__ __volatile__ ("stfd 1, 0(%0)" : : "r" (addr));
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static __inline__ unsigned long get_msr(void)
|
||||
{
|
||||
unsigned long msr;
|
||||
|
||||
__asm__ __volatile__ ("mfmsr %0" : "=r" (msr) :);
|
||||
return msr;
|
||||
}
|
||||
|
||||
static __inline__ void set_msr(unsigned long msr)
|
||||
{
|
||||
__asm__ __volatile__ ("mtmsr %0" : : "r" (msr));
|
||||
}
|
||||
128
board/cu824/u-boot.lds
Normal file
128
board/cu824/u-boot.lds
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
cpu/mpc824x/start.o (.text)
|
||||
lib_ppc/board.o (.text)
|
||||
lib_ppc/ppcstring.o (.text)
|
||||
lib_generic/vsprintf.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
. = DEFINED(env_offset) ? env_offset : .;
|
||||
common/environment.o (.text)
|
||||
|
||||
*(.text)
|
||||
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
|
||||
47
board/dnp1110/Makefile
Normal file
47
board/dnp1110/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := dnp1110.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user